Exemple #1
0
        protected void PageRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var ee = new PageRepeaterItemEventArgs(e);

            ee.CompanyLiteral.Text     = ShopperConfiguration.Default.Mandantor.Company;
            ee.StreetLiteral.Text      = ShopperConfiguration.Default.Mandantor.Street;
            ee.ZipCityLiteral.Text     = ShopperConfiguration.Default.Mandantor.ZipWithCity;
            ee.PhoneLiteral.Text       = ShopperConfiguration.Default.Mandantor.Phone;
            ee.FaxLiteral.Text         = ShopperConfiguration.Default.Mandantor.Fax;
            ee.WebUrlLiteral.Text      = ShopperConfiguration.Default.Mandantor.WebUrl;
            ee.EmailLiteral.Text       = ShopperConfiguration.Default.Mandantor.Email;
            ee.FullAddressLiteral.Text = ShopperConfiguration.Default.Mandantor.FullAddress;
            ee.TaxLiteral.Text         = ShopperConfiguration.Default.Mandantor.Tax.Replace("|", "<br/>");
            ee.BankLiteral.Text        = ShopperConfiguration.Default.Mandantor.Bank.Replace("@", "<br/>");

            if (ee.Data != null)
            {
                var validInvoiceAddress = ee.Data.Sale;

                if (validInvoiceAddress != null)
                {
                    ee.InvoiceAddressPanel.Visible = true;
                    ee.InvoiceNameLabel.Text       = ee.Data.Sale.InvoiceName;
                    ee.InvoiceAddress1Label.Text   = ee.Data.Sale.InvoiceStreet1;
                    ee.InvoiceAddress2Label.Text   = ee.Data.Sale.InvoiceStreet2;
                    ee.InvoiceCountryLabel.Text    = ee.Data.Sale.InvoiceCountry;
                    ee.InvoicePostcodeLabel.Text   = ee.Data.Sale.InvoicePostcode;
                    ee.InvoiceCityLabel.Text       = ee.Data.Sale.InvoiceCity;
                }
                else
                {
                    ee.InvoiceAddressPanel.Visible = false;
                }

                ee.SalesIdLabel.Text         = ee.Data.Sale.Id.ToString();
                ee.ProtocoleNumberLabel.Text = ee.Data.Sale.ProtocolNumber;
                ee.DateOfSaleLabel.Text      = ee.Data.Sale.DateOfSale.ToShortDateString();

                ee.TotalNetCaptionLiteral.Text = ee.Data.NextPage == null ? StringTable.TotalNet : StringTable.SubtotalNet;
                ee.TotalNetLabel.Text          = ee.Data.TotalPriceNet.ToString("0.00");

                ee.TaxRateLiteral.Text = ShopperConfiguration.Default.CurrentTaxRate.ToString("0");

                ee.TotalTaxRow.Visible = true;
                ee.TotalTaxLabel.Text  = ee.Data.SalesTaxes.ToString("0.00");

                ee.TotalGrossCaptionLiteral.Text = ee.Data.NextPage == null ? StringTable.TotalGross : StringTable.SubtotalGross;
                ee.TotalGrossRow.Visible         = true;
                ee.TotalGrossLabel.Text          = ee.Data.TotalPriceGross.ToString("0.00");

                ee.ItemRepeater.DataSource = ee.Data.SaleItems;
                ee.ItemRepeater.DataBind();
            }
        }
        protected void PageRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var ee = new PageRepeaterItemEventArgs(e);

            ee.CompanyLiteral.Text     = ShopperConfiguration.Default.Mandantor.Company;
            ee.StreetLiteral.Text      = ShopperConfiguration.Default.Mandantor.Street;
            ee.ZipCityLiteral.Text     = ShopperConfiguration.Default.Mandantor.ZipWithCity;
            ee.PhoneLiteral.Text       = ShopperConfiguration.Default.Mandantor.Phone;
            ee.FaxLiteral.Text         = ShopperConfiguration.Default.Mandantor.Fax;
            ee.WebUrlLiteral.Text      = ShopperConfiguration.Default.Mandantor.WebUrl;
            ee.EmailLiteral.Text       = ShopperConfiguration.Default.Mandantor.Email;
            ee.FullAddressLiteral.Text = ShopperConfiguration.Default.Mandantor.FullAddress;
            ee.TaxLiteral.Text         = ShopperConfiguration.Default.Mandantor.Tax.Replace("|", "<br/>");
            ee.BankLiteral.Text        = ShopperConfiguration.Default.Mandantor.Bank.Replace("|", "<br/>");

            if (ee.Data != null)
            {
                var validInvoiceAddress = ee.Data.Invoice.Sales.FirstOrDefault(runner => runner.HasValidInvoiceAddress);

                if (validInvoiceAddress != null)
                {
                    ee.InvoiceAddressPanel.Visible = true;
                    ee.InvoiceNameLabel.Text       = ee.Data.Invoice.InvoiceName;
                    ee.InvoiceAddress1Label.Text   = ee.Data.Invoice.InvoiceStreet1;
                    ee.InvoiceAddress2Label.Text   = ee.Data.Invoice.InvoiceStreet2;
                    ee.InvoiceCountryLabel.Text    = ee.Data.Invoice.InvoiceCountry;
                    ee.InvoicePostcodeLabel.Text   = ee.Data.Invoice.InvoicePostcode;
                    ee.InvoiceCityLabel.Text       = ee.Data.Invoice.InvoiceCity;
                }
                else
                {
                    ee.InvoiceAddressPanel.Visible = false;
                }

                ee.InvoiceCopyLiteral.Text = ee.Data.IsCopy ? "* Copy" : String.Empty;

                ee.InvoiceNumberLabel.Text   = ee.Data.Invoice.InvoiceNumber;
                ee.ProtocoleNumberLabel.Text = ee.Data.Invoice.ProtocolNumbers;
                ee.InvoiceDateLabel.Text     = ee.Data.Invoice.InvoiceDate.ToShortDateString();
                ee.ShippingDateLabel.Text    = ee.Data.Invoice.DeliveryDate.ToShortDateString();

                ee.TaxTableHeadLiteral.Visible   = !(ee.Data.Invoice.HideNetPrices);
                ee.GrossTableHeadLiteral.Visible = !(ee.Data.Invoice.HideNetPrices);

                ee.TotalNetRow.Visible         = !(ee.Data.Invoice.HideNetPrices);
                ee.TotalNetCaptionLiteral.Text = ee.Data.NextPage == null ? "Total (net)" : "Subtotal (net)";
                ee.TotalNetLabel.Text          = ee.Data.TotalPriceNet.ToString("0.00");

                ee.TotalTaxRow.Visible = !(ee.Data.Invoice.HideGrossPrice || ee.Data.Invoice.HideNetPrices || !this.IsLastPage(e.Item.ItemIndex));
                ee.TotalTaxLabel.Text  = ee.Data.SalesTaxes.ToString("0.00");

                MailingCostCountry country = MailingCostCountry.LoadByName(ee.Data.Invoice.InvoiceCountry);
                if (country != null && country.DhlProductCode == DhlZones.World && !ee.Data.Invoice.HideGrossPrice)
                {
                    //Patch (brutto for netto) in case of foreign recepients
                    ee.TotalGrossCaptionLiteral.Text = ee.Data.NextPage == null ? "Total (net)" : "Subtotal (net)";
                }
                else
                {
                    ee.TotalGrossRow.Visible         = !(ee.Data.Invoice.HideGrossPrice || !this.IsLastPage(e.Item.ItemIndex));
                    ee.TotalGrossCaptionLiteral.Text = ee.Data.NextPage == null ? "Subtotal (gross)" : "Subtotal (gross)";
                }
                ee.TotalGrossLabel.Text = ee.Data.TotalPriceGross.ToString("0.00");

                ee.TypeOfDocumentLiteral.Text = this.RequestAddOn.Query.DocumentType == DocumentTypes.Invoice ? "Invoice" : "Invoice cancellation";

                ee.UstIdNrRow.Visible = ee.Data.Invoice.HideGrossPrice;
                ee.UstIdNrLabel.Text  = ee.Data.Invoice.UstIdNr;

                ee.ItemRepeater.DataSource = ee.Data.InvoiceItems;
                ee.ItemRepeater.DataBind();

                var allPaidWithPayPal = ee.Data.Invoice.Sales.All(runner => runner.PaidWithPayPal);
                ee.BankPanel.Visible = !allPaidWithPayPal;
            }
        }