Esempio n. 1
0
        protected override void BindTotals()
        {
            var lstShoppingCartItems = (Page as ProductsBase).ShoppingCart.ShoppingCartItems;

            try
            {
                if ((HLConfigManager.Configurations.DOConfiguration.CalculateWithoutItems &&
                     _shoppingCart.Totals != null &&
                     (_shoppingCart.Totals as OrderTotals_V01).AmountDue != decimal.Zero) || (lstShoppingCartItems.Count > 0 && ShoppingCart.Totals != null))

                //                if (lstShoppingCartItems.Count > 0 && ShoppingCart.Totals != null)
                {
                    OrderTotals_V01 totals = ShoppingCart.Totals as OrderTotals_V01;

                    lblDiscountRate.Text = _shoppingCart.Totals == null
                                               ? "0%"
                                               : ((_shoppingCart.Totals as OrderTotals_V01).DiscountPercentage).ToString() + "%";
                    _shoppingCart.EmailValues.DistributorSubTotal          = OrderProvider.GetDistributorSubTotal(_shoppingCart.Totals as OrderTotals_V01);
                    _shoppingCart.EmailValues.DistributorSubTotalFormatted = getAmountString(_shoppingCart.EmailValues.DistributorSubTotal);
                    lblDistributorSubtotal.Text = _shoppingCart.EmailValues.DistributorSubTotalFormatted;
                    lblEarnBase.Text            = getAmountString(GetTotalEarnBase(lstShoppingCartItems));
                    if (lblDiscountTotal != null)
                    {
                        lblDiscountTotal.Text =
                            getAmountString(CheckoutTotalsDetailed.GetDiscountTotal(lstShoppingCartItems));
                    }

                    // added for China DO
                    if (HLConfigManager.Configurations.CheckoutConfiguration.HasDiscountAmount)
                    {
                        OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                        if (totals_V02 != null)
                        {
                            HLRulesManager.Manager.PerformDiscountRules(_shoppingCart, null, Locale,
                                                                        ShoppingCartRuleReason.CartCalculated);
                            lblDiscountAmount.Text = getAmountString(totals_V02.DiscountAmount);
                            trDiscountRate.Visible = false;
                        }
                    }
                    if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU)
                    {
                        if (trDonationAmount != null)
                        {
                            trDonationAmount.Visible = true;
                            OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                            if (totals_V02 != null)
                            {
                                lblDonationAmount.Text = getAmountString(totals_V02.Donation);
                            }
                        }
                    }
                    lblOrderMonth.Text = GetOrderMonthString();

                    decimal currentMonthVolume = 0;
                    if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayFormatNeedsDecimal)
                    {
                        lblOrderMonthVolume.Text = decimal.TryParse(ProductsBase.CurrentMonthVolume, NumberStyles.Any, CultureInfo.InstalledUICulture, out currentMonthVolume)
                            ? ProductsBase.GetVolumePointsFormat(currentMonthVolume) :
                                                   (Page as ProductsBase).CurrentMonthVolume;
                    }
                    else if (decimal.TryParse((Page as ProductsBase).CurrentMonthVolume, out currentMonthVolume))
                    {
                        lblOrderMonthVolume.Text = ProductsBase.GetVolumePointsFormat(currentMonthVolume);
                    }
                    else
                    {
                        lblOrderMonthVolume.Text = (Page as ProductsBase).CurrentMonthVolume;
                    }


                    Charge_V01 otherCharges =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.OTHER); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.OTHER, (decimal)0.0);
                    Charge_V01 pHCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.PH); }) as Charge_V01 ??
                        new Charge_V01(ChargeTypes.PH, (decimal)0.0);
                    Charge_V01 freightCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0);
                    Charge_V01 localTaxCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOCALTAX); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.LOCALTAX, (decimal)0.0);
                    lblOtherCharges.Text = getAmountString(otherCharges.Amount);
                    lblLocalTax.Text     = getAmountString(localTaxCharge.Amount);
                    Charge_V01 logisticCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOGISTICS_CHARGE); })
                        as Charge_V01 ?? new Charge_V01(ChargeTypes.LOGISTICS_CHARGE, (decimal)0.0);
                    lblLogisticCharges.Text = getAmountString(logisticCharge.Amount);
                    lblPackageHandling.Text = getAmountString(pHCharge.Amount + totals.MarketingFundAmount);
                    lblShippingCharges.Text = getAmountString(freightCharge.Amount);
                    lblRetailPrice.Text     = getAmountString(totals.ItemsTotal);

                    decimal vatTax = totals.VatTax != null ? (decimal)totals.VatTax : decimal.Zero;
                    lblTaxVAT.Text = getAmountString(vatTax);

                    //Changes as per User Story 235045
                    bool    hideLabels = RemovePHCharge();
                    decimal serviceTax = totals.ServiceTax != null ? (decimal)totals.ServiceTax: decimal.Zero;
                    lblServiceTax.Text = getAmountString(serviceTax);
                    if (serviceTax == 0)
                    {
                        serviceTAX.Visible = hideLabels ? false : true;
                    }

                    decimal bharatTax = totals.SwachhBharatCess != null ? (decimal)totals.SwachhBharatCess : decimal.Zero;
                    lblBharatCessTax.Text = getAmountString(bharatTax);
                    if (bharatTax == 0)
                    {
                        bharatCessTAX.Visible = hideLabels ? false : true;
                    }

                    var kkcEnabled = HL.Common.Configuration.Settings.GetRequiredAppSetting("KKCEnabled", false);
                    if (kkcEnabled)
                    {
                        decimal krishiTax = totals.KrishiKalyanCess != null ? (decimal)totals.KrishiKalyanCess : decimal.Zero;
                        lblKKCTax.Text = getAmountString(krishiTax);
                        if (krishiTax == 0)
                        {
                            kkcTax.Visible = hideLabels ? false : true;
                        }
                    }
                    else
                    {
                        kkcTax.Visible = false;
                    }
                    //User Story 251995:GDO[PRODUCTION SUPPORT]: IN: For fixing the Tax display issue on GDO Checkout page for Additional/Exceptional Tax applicable states
                    decimal AdditionalTax = totals.AdditionalTaxCess != null ? (decimal)totals.AdditionalTaxCess : decimal.Zero;
                    lblAdditionalTax.Text = getAmountString(AdditionalTax);
                    if (AdditionalTax == 0)
                    {
                        additionalTax.Visible = hideLabels ? false : true;
                    }
                    decimal CSTTax = totals.CstTax != null ? (decimal)totals.CstTax : decimal.Zero;
                    lblCSTTax.Text = getAmountString(CSTTax);
                    if (CSTTax == 0)
                    {
                        cstTax.Visible = hideLabels ? false : true;
                    }
                    //

                    if (lblSubtotal != null)
                    {
                        lblSubtotal.Text = getAmountString(logisticCharge.Amount);
                    }
                    if (lblAdditionalDiscount != null)
                    {
                        lblAdditionalDiscount.Text = getAmountString(otherCharges.Amount);
                    }
                    lblVolumePoints.Text = ProductsBase.GetVolumePointsFormat(totals.VolumePoints);
                }
                else
                {
                    if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU)
                    {
                        if (trDonationAmount != null)
                        {
                            trDonationAmount.Visible = true;
                            OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                            if (totals_V02 != null)
                            {
                                lblDonationAmount.Text = getAmountString(totals_V02.Donation);
                            }
                        }
                    }

                    DisplayEmptyLabels();
                }
            }
            catch (Exception ex)
            {
                //Log Exception
                LoggerHelper.Error("Exception while displaying totals - " + ex);
                DisplayEmptyLabels();
            }
        }
Esempio n. 2
0
 public decimal GetDistributorSubTotal(OrderTotals_V01 totals)
 {
     return(OrderProvider.GetDistributorSubTotal(totals));
 }
        protected virtual void BindTotals()
        {
            List <DistributorShoppingCartItem> lstShoppingCartItems =
                (Page as ProductsBase).ShoppingCart.ShoppingCartItems;

            try
            {
                if ((HLConfigManager.Configurations.DOConfiguration.CalculateWithoutItems &&
                     _shoppingCart.Totals != null &&
                     (_shoppingCart.Totals as OrderTotals_V01).AmountDue != decimal.Zero) || (lstShoppingCartItems.Count > 0 && ShoppingCart.Totals != null))
                {
                    OrderTotals_V01 totals = ShoppingCart.Totals as OrderTotals_V01;

                    lblDiscountRate.Text = _shoppingCart.Totals == null
                                               ? "0%"
                                               : ((_shoppingCart.Totals as OrderTotals_V01).DiscountPercentage).ToString() + "%";
                    _shoppingCart.EmailValues.DistributorSubTotal          = OrderProvider.GetDistributorSubTotal(_shoppingCart.Totals as OrderTotals_V01);
                    _shoppingCart.EmailValues.DistributorSubTotalFormatted = getAmountString(_shoppingCart.EmailValues.DistributorSubTotal);
                    lblDistributorSubtotal.Text = _shoppingCart.EmailValues.DistributorSubTotalFormatted;
                    lblEarnBase.Text            = getAmountString(GetTotalEarnBase(lstShoppingCartItems));
                    if (lblDiscountTotal != null)
                    {
                        lblDiscountTotal.Text =
                            getAmountString(CheckoutTotalsDetailed.GetDiscountTotal(lstShoppingCartItems));
                    }
                    if (IsChina && (DistributorOrderingProfile.IsPC || (ShoppingCart.OrderCategory == OrderCategoryType.ETO && SessionInfo != null && !SessionInfo.IsReplacedPcOrder)))
                    {
                        lblPCLearningPointAmount.Text = getAmountString(_shoppingCart.pcLearningPointOffSet);
                    }
                    // added for China DO
                    if (HLConfigManager.Configurations.CheckoutConfiguration.HasDiscountAmount)
                    {
                        OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                        if (totals_V02 != null)
                        {
                            HLRulesManager.Manager.PerformDiscountRules(_shoppingCart, null, Locale,
                                                                        ShoppingCartRuleReason.CartCalculated);
                            lblDiscountAmount.Text = getAmountString(totals_V02.DiscountAmount);
                            trDiscountRate.Visible = false;
                        }
                    }
                    if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU)
                    {
                        if (trDonationAmount != null)
                        {
                            trDonationAmount.Visible = true;
                            OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                            if (totals_V02 != null)
                            {
                                lblDonationAmount.Text = getAmountString(totals_V02.Donation);
                            }
                        }
                    }
                    if (ProductsBase.IsEventTicketMode)
                    {
                        var orderMonthShortString = string.Empty;
                        var ordermonth            = OrderMonth.DualOrderMonthForEventTicket(true, out orderMonthShortString); // dual ordermonth should be desable for ETO
                        lblOrderMonth.Text = string.IsNullOrWhiteSpace(ordermonth) ? GetOrderMonthString() : ordermonth;
                        var currentSession = SessionInfo;

                        if (null != currentSession && !string.IsNullOrWhiteSpace(orderMonthShortString))
                        {
                            currentSession.OrderMonthString      = ordermonth;
                            currentSession.OrderMonthShortString = orderMonthShortString;
                        }
                    }
                    else
                    {
                        lblOrderMonth.Text = GetOrderMonthString();
                    }

                    decimal currentMonthVolume = 0;
                    if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayFormatNeedsDecimal)
                    {
                        lblOrderMonthVolume.Text = decimal.TryParse(ProductsBase.CurrentMonthVolume, NumberStyles.Any, CultureInfo.InstalledUICulture, out currentMonthVolume)
                            ? ProductsBase.GetVolumePointsFormat(currentMonthVolume) :
                                                   (Page as ProductsBase).CurrentMonthVolume;
                    }
                    else
                    {
                        lblOrderMonthVolume.Text = (Page as ProductsBase).CurrentMonthVolume;
                    }

                    Charge_V01 otherCharges =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.OTHER); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.OTHER, (decimal)0.0);
                    Charge_V01 pHCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.PH); }) as Charge_V01 ??
                        new Charge_V01(ChargeTypes.PH, (decimal)0.0);
                    Charge_V01 freightCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0);
                    Charge_V01 localTaxCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOCALTAX); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.LOCALTAX, (decimal)0.0);
                    lblOtherCharges.Text = getAmountString(otherCharges.Amount);
                    lblLocalTax.Text     = getAmountString(localTaxCharge.Amount);
                    Charge_V01 logisticCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOGISTICS_CHARGE); })
                        as Charge_V01 ?? new Charge_V01(ChargeTypes.LOGISTICS_CHARGE, (decimal)0.0);
                    lblLogisticCharges.Text = getAmountString(logisticCharge.Amount);
                    lblPackageHandling.Text = getAmountString(pHCharge.Amount);
                    lblShippingCharges.Text = getAmountString(freightCharge.Amount);
                    lblRetailPrice.Text     = getAmountString(totals.ItemsTotal);
                    lblTaxVAT.Text          = getAmountString(totals.TaxAmount);
                    if (lblSubtotal != null)
                    {
                        lblSubtotal.Text = getAmountString(logisticCharge.Amount);
                    }
                    if (lblAdditionalDiscount != null)
                    {
                        lblAdditionalDiscount.Text = getAmountString(otherCharges.Amount);
                    }
                    lblVolumePoints.Text = ProductsBase.GetVolumePointsFormat(totals.VolumePoints);

                    //added for HR
                    if (HLConfigManager.Configurations.CheckoutConfiguration.MergePHAndShippingCharges)
                    {
                        decimal phShippingCharges = pHCharge.Amount + freightCharge.Amount;
                        lblPackageHandling.Text = getAmountString(phShippingCharges);
                    }

                    if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayWeight && !SessionInfo.IsEventTicketMode && lblWeight != null)
                    {
                        lblWeight.Text = ShoppingCartProvider.GetWeight(ShoppingCart);
                    }
                }
                else
                {
                    if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU)
                    {
                        if (trDonationAmount != null)
                        {
                            trDonationAmount.Visible = true;
                            OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                            if (totals_V02 != null)
                            {
                                lblDonationAmount.Text = getAmountString(totals_V02.Donation);
                            }
                        }
                    }

                    DisplayEmptyLabels();
                }
            }
            catch (Exception ex)
            {
                //Log Exception
                LoggerHelper.Error("Exception while displaying totals - " + ex);
                DisplayEmptyLabels();
            }
        }
        private void BindTotals()
        {
            //init etosku
            InitEtoPanel();
            try
            {
                if (ShoppingCart != null)
                {
                    var lstShoppingCartItems = ShoppingCart.ShoppingCartItems;
                    if (lstShoppingCartItems.Count > 0 && ShoppingCart.Totals != null)
                    {
                        MyHLShoppingCart shoppingCart = ProductsBase.ShoppingCart;
                        OrderTotals_V01  totals       = shoppingCart.Totals as OrderTotals_V01;
                        lblDiscountRate.Text =
                            HLConfigManager.Configurations.CheckoutConfiguration.ShowVolumePointRange ?
                            HLRulesManager.Manager.PerformDiscountRangeRules(shoppingCart, Locale, ProductsBase.DistributorDiscount) : (totals.DiscountPercentage).ToString() + "%";
                        trDiscountRate.Visible = !string.IsNullOrEmpty(lblDiscountRate.Text);

                        if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                        {
                            if (ShoppingCart.OrderCategory == OrderCategoryType.ETO && SessionInfo != null && !SessionInfo.IsReplacedPcOrder)
                            {
                                GetEligibleUseETOPoints();
                            }
                            else
                            {
                                GetEligibleUsePoint();
                            }
                            if (shoppingCart != null && shoppingCart.pcLearningPointOffSet > 0)
                            {
                                txtPCLearningPoint.Text = shoppingCart.pcLearningPointOffSet.ToString();
                            }
                            else
                            {
                                txtPCLearningPoint.Text = "0";
                            }
                            // added for China DO
                            if (HLConfigManager.Configurations.CheckoutConfiguration.HasDiscountAmount)
                            {
                                OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                                if (totals_V02 != null)
                                {
                                    HLRulesManager.Manager.PerformDiscountRules(ShoppingCart, null, Locale,
                                                                                ShoppingCartRuleReason.CartCalculated);
                                    trDiscountTotal.Visible = totals_V02.DiscountAmount > 0;
                                    lblDiscountTotal.Text   = getAmountString(totals_V02.DiscountAmount);
                                    trDiscountRate.Visible  = false;
                                }
                            }

                            if ((HLConfigManager.Configurations.DOConfiguration.CalculateWithoutItems &&
                                 ShoppingCart.Totals != null &&
                                 (ShoppingCart.Totals as OrderTotals_V01).AmountDue != decimal.Zero) || (ShoppingCart.CartItems.Count > 0 && ShoppingCart.Totals != null))
                            {
                                if (HLConfigManager.Configurations.CheckoutConfiguration.ConvertAmountDue)
                                {
                                    decimal amountDue = OrderProvider.GetConvertedAmount(totals.AmountDue, CountryCode);
                                    if (HLConfigManager.Configurations.PaymentsConfiguration.RoundAmountDue == "Standard")
                                    {
                                        amountDue = Math.Round(amountDue);
                                    }
                                    if (DistributorOrderingProfile.IsPC)
                                    {
                                        if (HttpContext.Current.Request.UrlReferrer != null &&
                                            HttpContext.Current.Request.UrlReferrer.ToString().Contains("Checkout.aspx"))
                                        {
                                            totals.AmountDue   = ShoppingCart.AmountduepriorpcLearningoffset;
                                            lblGrandTotal.Text =
                                                getAmountString(shoppingCart.AmountduepriorpcLearningoffset, true);
                                        }
                                        else
                                        {
                                            lblGrandTotal.Text = getAmountString(amountDue, true);
                                        }
                                    }
                                    else
                                    {
                                        lblGrandTotal.Text = getAmountString(amountDue, true);
                                    }
                                }
                                else
                                {
                                    if (HLConfigManager.Configurations.PaymentsConfiguration.RoundAmountDue == "Standard")
                                    {
                                        totals.AmountDue = Math.Round(totals.AmountDue);
                                    }
                                    if (DistributorOrderingProfile.IsPC)
                                    {
                                        if (HttpContext.Current.Request.UrlReferrer != null &&
                                            HttpContext.Current.Request.UrlReferrer.ToString().Contains("Checkout.aspx"))
                                        {
                                            totals.AmountDue   = ShoppingCart.AmountduepriorpcLearningoffset;
                                            lblGrandTotal.Text =
                                                getAmountString(ShoppingCart.AmountduepriorpcLearningoffset);
                                        }
                                        else
                                        {
                                            lblGrandTotal.Text =
                                                getAmountString(ShoppingCart.Totals != null ? totals.AmountDue : (decimal)0.00);
                                        }
                                    }
                                    else
                                    {
                                        lblGrandTotal.Text =
                                            getAmountString(ShoppingCart.Totals != null ? totals.AmountDue : (decimal)0.00);
                                    }
                                }
                            }
                            if (IsReturnFromCheckout && ShoppingCart.OrderCategory == OrderCategoryType.ETO)
                            {
                                lblGrandTotal.Text = getAmountString(totals != null ? totals.ItemsTotal : 0M);
                                lblDisplayPCLearningPoint.ForeColor = System.Drawing.Color.Green;
                                lblDisplayPCLearningPoint.Font.Bold = true;
                            }
                        }
                        else
                        {
                            if (lblDiscountTotal != null)
                            {
                                lblDiscountTotal.Text =
                                    getAmountString(CheckoutTotalsDetailed.GetDiscountTotal(lstShoppingCartItems));
                            }
                        }

                        lblEarnBase.Text = getAmountString(CheckoutTotalsDetailed.GetTotalEarnBase(lstShoppingCartItems));

                        decimal currentMonthVolume = 0.00M;
                        if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayFormatNeedsDecimal)
                        {
                            lblOrderMonthVolume.Text = decimal.TryParse(ProductsBase.CurrentMonthVolume, NumberStyles.Any, CultureInfo.InstalledUICulture, out currentMonthVolume)
                                ? ProductsBase.GetVolumePointsFormat(currentMonthVolume) :
                                                       (Page as ProductsBase).CurrentMonthVolume;
                        }
                        else
                        {
                            lblOrderMonthVolume.Text = (Page as ProductsBase).CurrentMonthVolume;
                        }

                        lblRetailPrice.Text  = getAmountString(totals.ItemsTotal);
                        lblSubtotal.Text     = getAmountString(totals.DiscountedItemsTotal);
                        lblVolumePoints.Text = ProductsBase.GetVolumePointsFormat(totals.VolumePoints);

                        if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                        {
                            if (totals.ChargeList != null)
                            {
                                Charge_V01 otherCharges =
                                    totals.ChargeList.Find(
                                        delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.OTHER); }) as
                                    Charge_V01 ?? new Charge_V01(ChargeTypes.OTHER, (decimal)0.0);
                                Charge_V01 pHCharge =
                                    totals.ChargeList.Find(
                                        delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.PH); }) as Charge_V01 ??
                                    new Charge_V01(ChargeTypes.PH, (decimal)0.0);
                                Charge_V01 freightCharge =
                                    totals.ChargeList.Find(
                                        delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as
                                    Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0);
                                Charge_V01 localTaxCharge =
                                    totals.ChargeList.Find(
                                        delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOCALTAX); }) as
                                    Charge_V01 ?? new Charge_V01(ChargeTypes.LOCALTAX, (decimal)0.0);
                                lblOtherCharges.Text = getAmountString(otherCharges.Amount);
                                lblLocalTax.Text     = getAmountString(localTaxCharge.Amount);
                                Charge_V01 logisticCharge =
                                    totals.ChargeList.Find(
                                        delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOGISTICS_CHARGE); })
                                    as Charge_V01 ?? new Charge_V01(ChargeTypes.LOGISTICS_CHARGE, (decimal)0.0);
                                lblLogisticCharges.Text = getAmountString(logisticCharge.Amount);
                                lblPackageHandling.Text = getAmountString(pHCharge.Amount);
                                lblShippingCharges.Text = getAmountString(freightCharge.Amount);

                                //added for HR
                                if (HLConfigManager.Configurations.CheckoutConfiguration.MergePHAndShippingCharges)
                                {
                                    decimal phShippingCharges = pHCharge.Amount + freightCharge.Amount;
                                    lblPackageHandling.Text = getAmountString(phShippingCharges);
                                }
                            }
                            lblTaxVAT.Text = getAmountString(totals.TaxAmount);
                        }
                        else
                        {
                            lblRetailPrice.Text = getAmountString((ShoppingCart.Totals as OrderTotals_V01).ItemsTotal);
                            lblSubtotal.Text    = getAmountString(OrderProvider.GetDistributorSubTotal(ShoppingCart.Totals as OrderTotals_V01));
                        }
                        if (HLConfigManager.Configurations.DOConfiguration.ShowFreightChrageonCOP1)
                        {
                            if (totals.ChargeList != null)
                            {
                                Charge_V01 freightCharge =
                                    totals.ChargeList.Find(
                                        delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as
                                    Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0);
                                lblShippingCharges.Text  = getAmountString(freightCharge.Amount);
                                trShippingCharge.Visible = !string.IsNullOrEmpty(lblShippingCharges.Text) && HLConfigManager.Configurations.DOConfiguration.ShowFreightChrageonCOP1 &&
                                                           shoppingCart.DeliveryInfo != null && shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping;
                            }
                        }
                        if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayWeight && !SessionInfo.IsEventTicketMode && lblWeight != null)
                        {
                            lblWeight.Text = ShoppingCartProvider.GetWeight(ShoppingCart);
                        }
                    }
                    else
                    {
                        if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                        {
                            if ((ShoppingCart.Totals == null || (ShoppingCart.Totals as OrderTotals_V01).AmountDue == 0.0M) &&
                                !(ShoppingCart.OrderCategory == OrderCategoryType.ETO && HLConfigManager.Configurations.DOConfiguration.AllowZeroPricingEventTicket) &&
                                (ShoppingCart.ShoppingCartItems != null && ShoppingCart.ShoppingCartItems.Any()))
                            {
                                OnQuoteError(null, null);
                            }

                            if (trDonationTotal != null)
                            {
                                trDonationTotal.Visible = true;
                                OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                                if (totals_V02 != null)
                                {
                                    lblDonationTotal.Text = getAmountString(totals_V02.Donation);
                                }
                            }
                            //trDiscountRate.Visible = false;
                            lblGrandTotal.Text = getAmountString(ShoppingCart.Totals != null ? (ShoppingCart.Totals as OrderTotals_V01).AmountDue : (decimal)0.00);
                        }

                        DisplayEmptyTotals();
                    }
                    if (ShoppingCart.Totals != null && HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU)
                    {
                        if (trDonationTotal != null)
                        {
                            trDonationTotal.Visible = true;
                            OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                            if (totals_V02 != null)
                            {
                                lblDonationTotal.Text = getAmountString(totals_V02.Donation);
                            }
                        }
                    }
                }
                else
                {
                    if (trDonationTotal != null)
                    {
                        trDonationTotal.Visible = true;
                        OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                        if (totals_V02 != null)
                        {
                            lblDonationTotal.Text = getAmountString(totals_V02.Donation);
                        }
                    }
                    lblGrandTotal.Text = getAmountString(ShoppingCart.Totals != null ? (ShoppingCart.Totals as OrderTotals_V01).AmountDue : (decimal)0.00);
                    DisplayEmptyTotals();
                }
            }
            catch (Exception ex)
            {
                //Log Exception
                LoggerHelper.Error(string.Format("Exception while displaying totals. Message: {0}, StackTrace: {1}, TargetSite:{2}, DistributorID: {3}", ex.Message, ex.StackTrace, ex.TargetSite, DistributorID));

                if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                {
                    if (trDonationTotal != null)
                    {
                        trDonationTotal.Visible = true;
                        OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                        if (totals_V02 != null)
                        {
                            lblDonationTotal.Text = getAmountString(totals_V02.Donation);
                        }
                    }
                }

                DisplayEmptyTotals();
            }
        }