GetTotalTax() public method

public GetTotalTax ( ) : decimal
return decimal
Example #1
0
        /// <summary>
        /// Add all the booking content
        /// </summary>
        /// <param name="doc"></param>
        void AddPageWithTable(Document doc, Invoice invoiceData)
        {
            // Add a new page to the document
            doc.NewPage();

            var context = ModelFactory.GetUnitOfWork();
            var mRepo = ModelFactory.GetRepository<IMemberRepository>(context);
            var lRepo = ModelFactory.GetRepository<ILocalisationRepository>(context);

            var client = mRepo.Get(invoiceData.MemberId);
            var localisation = lRepo.Get(invoiceData.LocalisationId);

            var bookingOwner = new StringBuilder();
            bookingOwner.AppendLine(localisation.Name);
            bookingOwner.AppendLine(localisation.Member.GetFullDisplayName());
            bookingOwner.AppendLine(localisation.Member.MemberMainData.PhoneNumber);
            bookingOwner.AppendLine(localisation.Member.Email);
            if (!string.IsNullOrEmpty(localisation.Member.MemberMainData.TaxNumber))
                bookingOwner.AppendLine(string.Format(Worki.Resources.Models.Booking.Invoice.TaxNumber,localisation.Member.MemberMainData.TaxNumber));
            if (!string.IsNullOrEmpty(localisation.Member.MemberMainData.SiretNumber))
                bookingOwner.AppendLine(string.Format(Worki.Resources.Models.Booking.Invoice.SiretNumber, localisation.Member.MemberMainData.SiretNumber));

            this.AddParagraph(doc, Element.ALIGN_LEFT, _standardFont, new Chunk(bookingOwner.ToString()));

            var bookingClient = new StringBuilder();
            bookingClient.AppendLine(client.GetFullDisplayName());
            if (!string.IsNullOrEmpty(client.MemberMainData.CompanyName))
                bookingClient.AppendLine(client.MemberMainData.CompanyName);
            bookingClient.AppendLine(client.MemberMainData.Address);
            bookingClient.AppendLine(client.MemberMainData.PostalCode + " " + client.MemberMainData.City);
            bookingClient.AppendLine(client.MemberMainData.Country);
            if (!string.IsNullOrEmpty(client.MemberMainData.TaxNumber))
                bookingClient.AppendLine(string.Format(Worki.Resources.Models.Booking.Invoice.TaxNumber, client.MemberMainData.TaxNumber));

            this.AddParagraph(doc, Element.ALIGN_RIGHT, _standardFont, new Chunk(bookingClient.ToString()));

            var billingDesc = new StringBuilder();
            billingDesc.AppendLine(string.Format(Worki.Resources.Models.Booking.Invoice.InvoiceNumber,invoiceData.InvoiceNumber.DisplayName()));
            billingDesc.AppendLine(string.Format(Worki.Resources.Models.Booking.Invoice.Date, CultureHelpers.GetSpecificFormat(DateTime.Now, CultureHelpers.TimeFormat.Date)));

            this.AddParagraph(doc, Element.ALIGN_LEFT, _standardFont, new Chunk(billingDesc.ToString()));

            PdfPTable table = new PdfPTable(4);
            float[] widths = new float[] { 3f, 1f, 1f, 1f };
            table.SetWidths(widths);
            table.WidthPercentage = 100f;
            table.SpacingBefore = 20f;
            table.SpacingAfter = 10f;

            //headers
            this.AddCellHeader(table, Worki.Resources.Models.Booking.Invoice.Description);
            this.AddCellHeader(table, Worki.Resources.Models.Booking.Invoice.Quantity);
            this.AddCellHeader(table, Worki.Resources.Models.Booking.Invoice.PriceWT);
            this.AddCellHeader(table, Worki.Resources.Models.Booking.Invoice.SubTotal);

            var currency = (Offer.CurrencyEnum)invoiceData.Currency;

            //offer
            foreach (var item in invoiceData.InvoiceItems)
            {
                this.AddCell(table, item.Description, Element.ALIGN_LEFT, Rectangle.BOTTOM_BORDER);
                this.AddCell(table, item.Quantity.ToString(), Element.ALIGN_RIGHT, Rectangle.BOTTOM_BORDER);
                this.AddCell(table, item.GetWithoutTax().GetPriceDisplay(currency), Element.ALIGN_RIGHT, Rectangle.BOTTOM_BORDER);
                this.AddCell(table, (item.Price * item.Quantity).GetPriceDisplay(currency), Element.ALIGN_RIGHT, Rectangle.BOTTOM_BORDER);
            }

            //total
            this.AddCell(table, Worki.Resources.Models.Booking.Invoice.TotalWithoutTax, Element.ALIGN_LEFT, Rectangle.BOTTOM_BORDER , 3);
            this.AddCell(table, invoiceData.GetTotalWithoutTax().GetPriceDisplay(currency), Element.ALIGN_RIGHT, Rectangle.BOTTOM_BORDER);

            this.AddCell(table, Worki.Resources.Models.Booking.Invoice.TotalTax, Element.ALIGN_LEFT, Rectangle.BOTTOM_BORDER, 3);
            this.AddCell(table, invoiceData.GetTotalTax().GetPriceDisplay(currency), Element.ALIGN_RIGHT, Rectangle.BOTTOM_BORDER);

            this.AddCell(table, Worki.Resources.Models.Booking.Invoice.Total, Element.ALIGN_LEFT, Rectangle.TOP_BORDER, 3, 2f, _smallFontBold);
            this.AddCell(table, invoiceData.GetTotal().GetPriceDisplay(currency), Element.ALIGN_RIGHT, Rectangle.TOP_BORDER, 1, 2f, _smallFontBold);

            doc.Add(table);  // Add the list to the page

            this.AddParagraph(doc, Element.ALIGN_LEFT, _standardFont, new Chunk(string.Format(Worki.Resources.Models.Booking.Invoice.PaymentBy, Offer.GetPaymentTypeEnumType((int)invoiceData.PaymentType))));

            this.AddParagraph(doc, Element.ALIGN_LEFT, _standardFont, new Chunk("\n\n"));
            this.AddParagraph(doc, Element.ALIGN_RIGHT, _standardFont, new Chunk(string.Format(Worki.Resources.Models.Booking.Invoice.SeeYouSoon, localisation.Name)));
        }