Esempio n. 1
0
        private static Tuple <decimal, decimal> GetOrderPriceAndTax(tbl_Orders table)
        {
            if (table == null || table.tbl_OrderContent.Count == 0)
            {
                return(new Tuple <decimal, decimal>(0, 0));
            }

            decimal totalPrice = 0, totalTaxAmount = 0;

            foreach (var content in table.tbl_OrderContent)
            {
                Tuple <decimal, decimal> priceAndTax = PriceManager.GetPrice(content.OC_Price.GetValueOrDefault(), content.OC_Tax.GetValueOrDefault(0), (int)content.OC_Quantity.GetValueOrDefault(0), table.O_DomainID);
                totalPrice     += priceAndTax.Item1;
                totalTaxAmount += priceAndTax.Item2;
            }

            if (table.tbl_Discount != null)
            {
                Tuple <decimal, decimal> priceAndTax = PriceManager.AddDiscountToPrice(table.tbl_Discount, totalPrice, totalTaxAmount, table.O_DomainID);
                totalPrice     = priceAndTax.Item1;
                totalTaxAmount = priceAndTax.Item2;
            }

            if (table.tbl_Postage != null)
            {
                decimal maxTax = table.tbl_OrderContent.Max(bc => bc.GetTaxValue());
                Tuple <decimal, decimal> postagePriceAndTax = PriceManager.GetPostagePriceAndTax(table.tbl_Postage, maxTax, table.O_DomainID);
                totalPrice     += postagePriceAndTax.Item1;
                totalTaxAmount += postagePriceAndTax.Item2;
            }

            return(new Tuple <decimal, decimal>(totalPrice, totalTaxAmount));
        }
Esempio n. 2
0
        public static string GetItemPriceString(this tbl_OrderContent table, bool hideTax = false)
        {
            Tuple <decimal, decimal> priceAndTax = PriceManager.GetPrice(table.OC_Price.GetValueOrDefault(), table.OC_Tax.GetValueOrDefault(), 1, table.tbl_Orders.O_DomainID);

            return(PriceManager.FormatPrice(priceAndTax.Item1, priceAndTax.Item2, table.tbl_Orders.O_DomainID, hideTax));
        }
Esempio n. 3
0
        public static string GetPriceString(this tbl_OrderContent table, bool hideTax = false)
        {
            var price = PriceManager.GetPrice(table.OC_Price.GetValueOrDefault(), table.OC_Tax.GetValueOrDefault(), (int)table.OC_Quantity.GetValueOrDefault(), table.tbl_Orders.O_DomainID);

            return(PriceManager.FormatPrice(price.Item1, price.Item2, table.tbl_Orders.O_DomainID, hideTax));
        }