Exemplo n.º 1
0
        private static string BuildTaxTable(ICollection <OrderTax> taxes, OrderCurrency currency)
        {
            var sb = new StringBuilder();

            if (taxes.Count != 0)
            {
                foreach (var tax in taxes)
                {
                    sb.Append(
                        "<tr bgcolor=\"white\" runat=\"server\" id=\"rowNDS\"><td align=\"right\" width=\"82%\"><font class=\"sc\">");
                    sb.Append((tax.TaxShowInPrice ? Resource.Core_TaxServices_Include_Tax : "") + " " + tax.TaxName);
                    sb.Append(":</font></td><td align=\"right\" width=\"18%\"><font class=\"sc\"><b>");
                    sb.Append(CatalogService.GetStringPrice(tax.TaxSum, currency.CurrencyValue, currency.CurrencyCode));
                    sb.Append("</b></font></td></tr>");
                }
            }
            else
            {
                sb.Append(
                    "<tr bgcolor=\"white\" runat=\"server\" id=\"rowNDS\"><td align=\"right\" width=\"82%\"><font class=\"sc\">");
                sb.Append(Resource.Client_Bill2_NDSAlreadyIncluded);
                sb.Append("</font></td><td align=\"right\" width=\"18%\"><font class=\"sc\"><b>");
                sb.Append("Без НДС");
                sb.Append("</b></font></td></tr>");
            }

            return(sb.ToString());
        }
Exemplo n.º 2
0
 protected string GetPriceFormat(float price, OrderCurrency currency)
 {
     return((price / currency.CurrencyValue * Bill.CurrencyValue).ToString("####0.00").Replace(",", "."));
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["ordernumber"].IsNullOrEmpty())
            {
                Response.Redirect("default.aspx");
                return;
            }

            try
            {
                var orderId = OrderService.GetOrderIdByNumber(Request["ordernumber"]);

                lblOrderID.Text = Resource.Admin_ViewOrder_ItemNum + orderId;

                Order = OrderService.GetOrder(orderId);

                if (Order == null)
                {
                    Response.Redirect("default.aspx");
                    return;
                }

                OrdCurrency     = Order.OrderCurrency;
                lOrderDate.Text = AdvantShop.Localization.Culture.ConvertDate(Order.OrderDate);

                if (Order.OrderCertificates != null && Order.OrderCertificates.Count > 0)
                {
                    trBilling.Visible  = false;
                    trShipping.Visible = false;
                }


                var productPrice = Order.OrderCertificates != null && Order.OrderCertificates.Count > 0
                                            ? Order.OrderCertificates.Sum(item => item.Sum)
                                            : Order.OrderItems.Sum(item => item.Amount * item.Price);

                var totalDiscount = Order.OrderDiscount;

                lblProductPrice.Text = CatalogService.GetStringPrice(productPrice, OrdCurrency.CurrencyValue,
                                                                     OrdCurrency.CurrencyCode);

                trDiscount.Visible    = Order.OrderDiscount != 0;
                lblOrderDiscount.Text = string.Format("-{0}",
                                                      CatalogService.GetStringDiscountPercent(productPrice, totalDiscount,
                                                                                              OrdCurrency.CurrencyValue,
                                                                                              Order.OrderCurrency.CurrencySymbol, Order.OrderCurrency.IsCodeBefore,
                                                                                              CurrencyService.CurrentCurrency.PriceFormat, false));

                trBonus.Visible    = Order.BonusCost != 0;
                lblOrderBonus.Text = string.Format("-{0}",
                                                   CatalogService.GetStringPrice(Order.BonusCost,
                                                                                 Order.OrderCurrency.CurrencyValue, Order.OrderCurrency.CurrencyCode));

                if (Order.Certificate != null)
                {
                    trCertificate.Visible = true;
                    lblCertificate.Text   = string.Format("-{0}",
                                                          CatalogService.GetStringPrice(Order.Certificate.Price,
                                                                                        OrdCurrency.CurrencyValue,
                                                                                        OrdCurrency.CurrencyCode));
                }
                else
                {
                    trCertificate.Visible = false;
                }

                if (Order.Coupon != null)
                {
                    var productsWithCoupon = Order.OrderItems.Where(item => item.IsCouponApplied).Sum(item => item.Price * item.Amount);
                    trCoupon.Visible = true;
                    switch (Order.Coupon.Type)
                    {
                    case CouponType.Fixed:
                        lblCoupon.Text = String.Format("-{0} ({1})",
                                                       CatalogService.GetStringPrice(Order.Coupon.Value, OrdCurrency.CurrencyValue, OrdCurrency.CurrencyCode),
                                                       Order.Coupon.Code);
                        break;

                    case CouponType.Percent:
                        lblCoupon.Text = String.Format("-{0} ({1}%) ({2})",
                                                       CatalogService.GetStringPrice(productsWithCoupon * Order.Coupon.Value / 100, OrdCurrency.CurrencyValue, OrdCurrency.CurrencyCode),
                                                       CatalogService.FormatPriceInvariant(Order.Coupon.Value),
                                                       Order.Coupon.Code);
                        break;
                    }
                }
                else
                {
                    trCoupon.Visible = false;
                }

                lblShippingPrice.Text = string.Format("{0}{1}", Order.ShippingCost > 0 ? "+" : "",
                                                      CatalogService.GetStringPrice(Order.ShippingCost, Order.OrderCurrency.CurrencyValue, Order.OrderCurrency.CurrencyCode));

                PaymentRow.Visible   = Order.PaymentCost != 0;
                lblPaymentPrice.Text = string.Format("{0}{1}", Order.PaymentCost > 0 ? "+" : "",
                                                     CatalogService.GetStringPrice(Order.PaymentCost, Order.OrderCurrency.CurrencyValue, Order.OrderCurrency.CurrencyCode));

                List <OrderTax> taxedItems = TaxServices.GetOrderTaxes(Order.OrderID);
                if (taxedItems.Count > 0)
                {
                    literalTaxCost.Text = TaxServices.BuildTaxTable(taxedItems, Order.OrderCurrency.CurrencyValue,
                                                                    Order.OrderCurrency.CurrencyCode,
                                                                    Resource.Admin_ViewOrder_Taxes);
                }


                lblTotalPrice.Text = CatalogService.GetStringPrice(Order.Sum, Order.OrderCurrency.CurrencyValue,
                                                                   Order.OrderCurrency.CurrencyCode);

                // ------------------------------------------------------------------------------------

                if (Order.OrderCertificates == null || Order.OrderCertificates.Count == 0)
                {
                    lvOrderItems.DataSource = Order.OrderItems;
                    lvOrderItems.DataBind();
                }
                else
                {
                    lvOrderGiftCertificates.DataSource = Order.OrderCertificates;
                    lvOrderGiftCertificates.DataBind();
                }


                MapAdress = Order.ShippingContact.Country + "," + Order.ShippingContact.Zone + "," +
                            Order.ShippingContact.City + "," + Order.ShippingContact.Address;
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
            }
        }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Request["ordernumber"]))
        {
            Response.Redirect("default.aspx");
        }

        try
        {
            int orderId = OrderService.GetOrderIdByNumber(Request["ordernumber"]);

            lblOrderID.Text = Resource.Admin_ViewOrder_ItemNum + orderId;
            //Added by Evgeni
            lOrder0.Text = orderId.ToString();

            if (!IsPostBack)
            {
                Order ord = OrderService.GetOrder(orderId);

                if (ord != null)
                {
                    ordCurrency     = ord.OrderCurrency;
                    lOrderDate.Text = AdvantShop.Localization.Culture.ConvertDate(ord.OrderDate);


                    lNumber.Text = ord.Number;

                    lblOrderStatus.Text = @"(" + ord.OrderStatus.StatusName + @")";

                    lblShipping.Text  = @"<b>" + Resource.Admin_ViewOrder_Name + @"</b>&nbsp;" + ord.ShippingContact.Name;
                    lblShipping.Text += @"<br />";
                    lblShipping.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Country +
                                        @"</b>&nbsp;" + ord.ShippingContact.Country + @"<br />";
                    lblShipping.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_City +
                                        @"</b>&nbsp;" + ord.ShippingContact.City + @"<br />";

                    if (ord.ShippingContact.Zone != null)
                    {
                        lblShipping.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Zone +
                                            @"</b>&nbsp;" + ord.ShippingContact.Zone.Trim() + @"<br />";
                    }

                    if (ord.ShippingContact.Zip != null)
                    {
                        lblShipping.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Zip +
                                            @"</b>&nbsp;" + ord.ShippingContact.Zip.Trim() + @"<br />";
                    }

                    lblShipping.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Address +
                                        @"</b>&nbsp;" + ord.ShippingContact.Address + @"<br />";


                    lblBilling.Text  = @"<b>" + Resource.Admin_ViewOrder_Name + @"</b>&nbsp;" + ord.BillingContact.Name;
                    lblBilling.Text += @"<br />";
                    lblBilling.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Country +
                                       @"</b>&nbsp;" + ord.BillingContact.Country + @"<br />";
                    lblBilling.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_City +
                                       @"</b>&nbsp;" + ord.BillingContact.City + @"<br />";

                    if (ord.BillingContact.Zone != null)
                    {
                        lblBilling.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Zone +
                                           @"</b>&nbsp;" + ord.BillingContact.Zone.Trim() + @"<br />";
                    }

                    if (ord.BillingContact.Zip != null)
                    {
                        lblBilling.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Zip +
                                           @"</b>&nbsp;" + ord.BillingContact.Zip.Trim() + @"<br />";
                    }

                    lblBilling.Text += @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + Resource.Admin_ViewOrder_Address +
                                       @"</b>&nbsp;" + ord.BillingContact.Address + @"<br />";

                    lblShippingMethod.Text = @"<b>" + ord.ArchivedShippingName + @"</b>";

                    if (ord.OrderPickPoint != null)
                    {
                        lblShippingMethod.Text += @"</br><b>" + ord.OrderPickPoint.PickPointAddress + @"</b>";
                    }

                    lblPaymentType.Text = @"<b>" + ord.PaymentMethodName + @"</b>";

                    // ------------------------------------------------------------------------------------


                    decimal productPrice  = ord.OrderItems.Sum(item => item.Amount * item.Price);
                    decimal totalDiscount = ord.OrderDiscount;

                    lblProductPrice.Text = CatalogService.GetStringPrice(productPrice, ordCurrency.CurrencyValue, ordCurrency.CurrencyCode);

                    trDiscount.Visible    = ord.OrderDiscount != 0;
                    lblOrderDiscount.Text = string.Format("-{0}", CatalogService.GetStringDiscountPercent(productPrice, totalDiscount,
                                                                                                          ordCurrency.CurrencyValue, ord.OrderCurrency.CurrencySymbol,
                                                                                                          ord.OrderCurrency.IsCodeBefore, CurrencyService.CurrentCurrency.PriceFormat, false));

                    if (ord.Certificate != null)
                    {
                        trCertificate.Visible = true;
                        lblCertificate.Text   = string.Format("-{0}",
                                                              CatalogService.GetStringPrice(ord.Certificate.Price,
                                                                                            ordCurrency.CurrencyValue,
                                                                                            ordCurrency.CurrencyCode));
                    }
                    else
                    {
                        trCertificate.Visible = false;
                    }

                    if (ord.Coupon != null)
                    {
                        trCoupon.Visible = true;
                        switch (ord.Coupon.Type)
                        {
                        case CouponType.Fixed:
                            lblCoupon.Text = String.Format("-{0} ({1})",
                                                           CatalogService.GetStringPrice(ord.Coupon.Value,
                                                                                         ordCurrency.CurrencyValue,
                                                                                         ordCurrency.CurrencyCode),
                                                           ord.Coupon.Code);
                            break;

                        case CouponType.Percent:
                            lblCoupon.Text = String.Format("-{0} ({1}%) ({2})",
                                                           CatalogService.GetStringPrice(ord.Coupon.Value,
                                                                                         ordCurrency.CurrencyValue,
                                                                                         ordCurrency.CurrencyCode),
                                                           CatalogService.FormatPriceInvariant(ord.Coupon.Value),
                                                           ord.Coupon.Code);
                            break;
                        }
                    }
                    else
                    {
                        trCoupon.Visible = false;
                    }

                    lblShippingPrice.Text = string.Format("+{0}", CatalogService.GetStringPrice(ord.ShippingCost, ord.OrderCurrency.CurrencyValue, ord.OrderCurrency.CurrencyCode));

                    List <TaxValue> taxedItems = TaxServices.GetOrderTaxes(ord.OrderID);
                    literalTaxCost.Text = TaxServices.BuildTaxTable(taxedItems, ord.OrderCurrency.CurrencyValue, ord.OrderCurrency.CurrencyCode, Resource.Admin_ViewOrder_Taxes);
                    //Added By Evgeni
                    lblTotalPrice.Text = lblTotalPrice0.Text = CatalogService.GetStringPrice(ord.Sum, ord.OrderCurrency.CurrencyValue, ord.OrderCurrency.CurrencyCode);

                    // ------------------------------------------------------------------------------------

                    if (string.IsNullOrEmpty(ord.CustomerComment))
                    {
                        lblUserComments.Visible = false;
                    }
                    else
                    {
                        lblUserComments.Text    = Resource.Client_PrintOrder_YourComment + @" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + ord.CustomerComment;
                        lblUserComments.Visible = true;
                    }

                    lStatusComment.Text = ord.StatusComment;

                    DataListOrderItems.DataSource = ord.OrderItems;
                    DataListOrderItems.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
        }
    }