Пример #1
0
        /// <summary>
        /// Generates the test without VAT or discount.
        /// </summary>
        public void GenerateTestWithoutVAT()
        {
            byte[] image         = LoadImage("vodafone.jpg");
            string imageFilename = MigraDocFilenameFromByteArray(image);

            var invoice = new InvoicerApi(SizeOption.A4, OrientationOption.Landscape, "£")
                          .TextColor("#CC0000")
                          .BackColor("#FFD6CC")
                          .Image(imageFilename, 125, 27)
                          .Company(Address.Make(
                                       "FROM",
                                       new string[] {
                "Vodafone Limited",
                "Vodafone House",
                "The Connection",
                "Newbury",
                "Berkshire RG14 2FN"
            },
                                       "1471587",
                                       null,
                                       new string[] {
                "Vodafone Limited. Registered in England and Wales No. 1471587.",
                "Registered office: Vodafone House, The Connection, Newbury, Berkshire RG14 2FN."
            }))
                          .Client(Address.Make("INVOICE TO", new string[] { "Isabella Marsh", "Overton Circle", "Little Welland", "Worcester", "WR## 2DJ" }))
                          .Items(new List <ItemRow> {
                ItemRow.Make("Nexus 6", "Midnight Blue", (decimal)1, (decimal)199.99, (decimal)199.99),
                ItemRow.Make("24 Months (£22.50pm)", "100 minutes, Unlimited texts, 100 MB data 3G plan with 3GB of UK Wi-Fi", (decimal)1, (decimal)432.00, (decimal)432.00),
                ItemRow.Make("Special Offer", "Free case (blue)", (decimal)1, (decimal)0, (decimal)0),
            })
                          .Totals(new List <TotalRow> {
                TotalRow.Make("Total", (decimal)631.99, true),
            })
                          .Details(new List <DetailRow> {
                DetailRow.Make("PAYMENT INFORMATION", "Make all cheques payable to Vodafone UK Limited.", "", "If you have any questions concerning this invoice, contact our sales department at [email protected].", "", "Thank you for your business.")
            })
                          .Footer("http://www.vodafone.co.uk");

            using (var stream = invoice.Get())
            {
                using (var fs = new FileStream("fs.pdf", FileMode.Create))
                {
                    stream.CopyTo(fs);
                }
            }
        }
Пример #2
0
        public static string PrintInvoice(string path, string currency, string reference, string imagePath, string companyReg, string[] companyDetails, string[] clientDetails, List <ItemRow> itemsRows, List <TotalRow> totalRows, List <DetailRow> detailRows, string footerWebsite)
        {
            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(itemsRows)
                              .Totals(totalRows)
                              .Details(detailRows)
                              .Footer(footerWebsite)
                              .Save(path, 0);

            return(filename);
        }
Пример #3
0
        public static string PrintInvoiceBar(string path, InvoicerModel gravm, string imagePath)
        {
            var guestItems = new List <ItemRow>();

            foreach (var rm in gravm.InvoicerItemModelList.OrderBy(x => x.ItemName))
            {
                guestItems.Add(new ItemRow {
                    TransactionDate = rm.TimeOfSale, Quantity = rm.Quantity, Description = rm.ItemName, UnitPrice = rm.Price, TotalPrice = rm.TotalPrice
                });
            }

            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 = gravm.ReceiptNumber + "_" + DateTime.Now.ToShortTimeString().Replace(":", ""), companyReg = splitShopDetails[6];

            string[]         companyDetails = splitShopDetails, clientDetails = new string[] { "Sir/Madam" };
            List <ItemRow>   itemsRows      = new List <ItemRow>();
            List <TotalRow>  totalRows      = new List <TotalRow>();
            List <DetailRow> detailRows     = new List <DetailRow>();
            string           footerWebsite  = splitShopDetails[5];


            string filename = new InvoicerApi(SizeOption.A4, OrientationOption.Landscape, currency)
                              .TextColor("#CC0000")
                              .BackColor("#FFD6CC")
                              .Image(imagePath, 125, 27)
                              .Reference(reference)
                              .Company(Address.Make("FROM", companyDetails, companyReg, ""))
                              .Client(Address.Make("BILLING TO", clientDetails))
                              .Items(guestItems)
                              .Totals(new List <TotalRow> {
                TotalRow.Make("Sub Total", gravm.SubTotal),
                TotalRow.Make(gravm.TaxDetails, gravm.Tax),
                TotalRow.Make(gravm.DiscountDetails, gravm.Discount),
                TotalRow.Make("Total", gravm.Total, true),
            })
                              .Details(new List <DetailRow>
            {
                DetailRow.Make("PAYMENT 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);
        }
Пример #4
0
        public static string PrintInvoiceCheckingFuture(string path, Guest guest, string imagePath)
        {
            int qty = guest.GuestRooms.Count;

            string[] splitShopDetails = null;

            var termsAndConditions = GetTAC();

            var acknowledge = GetAcknowledge();

            var bottomDetailsRows = new List <DetailRow>();

            bottomDetailsRows.Add(DetailRow.Make("RESERVATION 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."));

            if (termsAndConditions.Any())
            {
                bottomDetailsRows.Add(DetailRow.Make("TERMS && CONDITIONS", termsAndConditions.ToArray()));
            }

            if (acknowledge.Any())
            {
                bottomDetailsRows.Add(DetailRow.Make("ACKNOWLEDGEMENT", acknowledge.ToArray()));
            }

            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.ReservationDeposit);

            var gr          = guest.GuestRooms.FirstOrDefault();
            var noOfNights  = gr.CheckoutDate.Subtract(gr.CheckinDate).Days;
            var roomDetails = "From " + gr.CheckinDate.ToShortDateString() + " To " + gr.CheckoutDate.ToShortDateString() + " Room Type - " + gr.Room.RoomType1.Name + " Room Price - (NGN " + decimal.Round(gr.RoomRate, 2) + " )";
            var amountPaid  = decimal.Zero;

            if (initialDeposit != null)
            {
                amountPaid = initialDeposit.Amount;
            }

            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(new List <ItemRow>
            {
                ItemRow.Make("Resevation Deposit", roomDetails, (decimal)qty, 0, amountPaid, amountPaid)
            })
                              .Totals(new List <TotalRow> {
                TotalRow.Make("Sub Total", amountPaid),
                TotalRow.Make("TAX @ 0%", decimal.Zero),
                TotalRow.Make("Total", amountPaid, true),
            })
                              .Details(bottomDetailsRows)
                              .Footer(footerWebsite)
                              .Save(path, 0);

            return(reference);
        }
Пример #5
0
        public static string PrintInvoicePayment(string path, GuestRoomAccount gra, string imagePath)
        {
            string[] splitShopDetails = null;

            var guest = gra.GuestRoom.Guest;

            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 = gra.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 = gra;

            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 amountPaid  = decimal.Zero;

            if (initialDeposit != null)
            {
                amountPaid = initialDeposit.Amount;
            }

            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(new List <ItemRow>
            {
                ItemRow.Make(GetPaymementNote(initialDeposit), GetPaymementNote(initialDeposit), (decimal)1, 0, amountPaid, amountPaid)
            })
                              .Totals(new List <TotalRow> {
                TotalRow.Make("Sub Total", amountPaid),
                TotalRow.Make("TAX @ 0%", decimal.Zero),
                TotalRow.Make("Total", amountPaid, true),
            })
                              .Details(new List <DetailRow>
            {
                DetailRow.Make("PAYMENT 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);
        }
Пример #6
0
        public static string PrintInvoiceCheckout(string path, GuestRoomAccountViewModel gravm, string imagePath)
        {
            var guestItems = new List <ItemRow>();

            foreach (var rm in gravm.DisplayList.OrderBy(x => x.TransactionDate))
            {
                guestItems.Add(new ItemRow {
                    TransactionDate = rm.TransactionDate, Amount = rm.Balance, Description = rm.Detail, Credit = rm.Credit, Debit = rm.Debit, Balance = rm.Balance
                });
            }


            var guest = gravm.Guest;


            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(gravm);
            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 = guestItems.Where(x => x.Credit > 0).Sum(x => x.Credit);

            amountPaidDebit = guestItems.Where(x => x.Debit > 0).Sum(x => x.Debit);

            balance = amountPaidCredit - amountPaidDebit;

            if (string.IsNullOrEmpty(reference))
            {
                reference = DateTime.Now.ToString();
            }

            var totalRowsTotal = new List <TotalRow>();

            var taxRow = guestItems.FirstOrDefault(x => x.Description.ToUpper().Contains("TAX"));

            if (taxRow != null)
            {
                amountPaidDebit = amountPaidDebit - taxRow.Debit;
            }

            totalRowsTotal.Add(TotalRow.Make("Payments Total", amountPaidCredit));

            //2347057706701
            totalRowsTotal.Add(TotalRow.Make("Sub Total", amountPaidDebit));

            if (taxRow != null)
            {
                totalRowsTotal.Add(TotalRow.Make(taxRow.Description, taxRow.Debit));
            }

            totalRowsTotal.Add(TotalRow.Make("Balance", balance, true));

            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(totalRowsTotal)
                              .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."),
                DetailRow.Make("INFORMATION", "")
            })
                              .Footer(footerWebsite)
                              .Save(path, 1);

            return(reference);
        }