public static string PrintInvoiceCheckout(string path, Guest guest, string imagePath) { string[] splitShopDetails = null; try { var shopDetails = ConfigurationManager.AppSettings["SHOPDETAILS"].ToString(); splitShopDetails = shopDetails.Split('@').ToArray(); if (splitShopDetails.Count() < 7) { splitShopDetails = null; } } catch (Exception) { } if (splitShopDetails == null) { splitShopDetails = new string[] { "AcademyVista Ltd. @ B03 Eleganza, V.G.C, @ Lagos State @ Nigeria @ 08105387515 @ www.academyvista.com @ 6543210" }; } string currency = "NGN ", reference = guest.Id.ToString() + "_" + DateTime.Now.ToShortTimeString().Replace(":", ""), companyReg = splitShopDetails[6]; string[] companyDetails = splitShopDetails, clientDetails = GetClientInformation(guest); List <ItemRow> itemsRows = new List <ItemRow>(); List <TotalRow> totalRows = new List <TotalRow>(); List <DetailRow> detailRows = new List <DetailRow>(); string footerWebsite = splitShopDetails[5]; var initialDeposit = guest.GuestRooms.SelectMany(x => x.GuestRoomAccounts).FirstOrDefault(x => x.PaymentTypeId == (int)RoomPaymentTypeEnum.InitialDeposit); var gr = guest.GuestRooms.FirstOrDefault(); var noOfNights = gr.CheckoutDate.Subtract(gr.CheckinDate).Days; var roomDetails = "Room " + gr.RoomNumber + "-" + gr.Room.RoomType1.Name + " Room Price - (NGN " + Decimal.Round(gr.RoomRate, 2) + ")"; var amountPaidCredit = decimal.Zero; var amountPaidDebit = decimal.Zero; var balance = decimal.Zero; amountPaidCredit = guest.GetGuestTotalPaid(); var guestItems = guest.GetGuestItems().Select(x => new ItemRow { Amount = x.Amount, Description = x.RoomPaymentType.Description, Name = x.RoomPaymentType.Description, Price = x.Amount, Discount = decimal.Zero.ToString(), Total = x.Amount, VAT = decimal.Zero }).ToList(); amountPaidDebit = guestItems.Sum(x => x.Amount); balance = amountPaidCredit - amountPaidDebit; if (string.IsNullOrEmpty(reference)) { reference = DateTime.Now.ToString(); } string filename = new InvoicerApi(SizeOption.A4, OrientationOption.Landscape, currency) .TextColor("#CC0000") .BackColor("#FFD6CC") .Image(imagePath, 125, 32) .Reference(reference) .Company(Address.Make("FROM", companyDetails, companyReg, "")) .Client(Address.Make("BILLING TO", clientDetails)) .Items(guestItems) .Totals(new List <TotalRow> { TotalRow.Make("Payments Total", amountPaidCredit), TotalRow.Make("Sub Total", amountPaidDebit), TotalRow.Make("TAX @ 0%", decimal.Zero), TotalRow.Make("Balance", balance, true), }) .Details(new List <DetailRow> { DetailRow.Make("CHECK-OUT INFORMATION", "A copy of this receipt will also be emailed to you.", "", "If you have any questions concerning this receipt, contact our front office or a duty manager.", "", "Thank you for your business.") }) .Footer(footerWebsite) .Save(path, 0); return(reference); }