Esempio n. 1
0
        /// <summary>
        /// Calculates the tax.
        /// </summary>
        /// <param name="aboProduct">The product.</param>
        /// <param name="adecCurrentTaxRate">The current tax rate.</param>
        /// <param name="adecCurrentImportedRate">The current imported rate.</param>
        public static decimal CalculateTax(boProduct aboProduct, decimal adecCurrentTaxRate, decimal adecCurrentImportedRate)
        {
            decimal ldecCalculatedTax = 0m;

            if (aboProduct.iblnIsTaxable)
            {
                //Calculate Tax
                ldecCalculatedTax += (aboProduct.idecBasePrice * adecCurrentTaxRate);
            }

            if (aboProduct.iblnIsImported)
            {
                //Calculate Imported Tax
                ldecCalculatedTax += (aboProduct.idecBasePrice * adecCurrentImportedRate);
            }

            return(TaxHelper.RoundingToNearest05Rule(ldecCalculatedTax));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the receipt details.
        /// </summary>
        /// <param name="aclbCart">The cart.</param>
        /// <returns></returns>
        public StringBuilder GetReceiptDetails(Collection <boCart> aclbCart)
        {
            StringBuilder lstrReceiptDetails = new StringBuilder();

            if (aclbCart != null)
            {
                lstrReceiptDetails.Append("========================= TEKsystems =================================" + istrNewLineCharacter);

                foreach (boCart lboCart in aclbCart)
                {
                    lstrReceiptDetails.Append(istrNewLineCharacter + istrNewLineCharacter + "Receipt " + lboCart.GetCurrentCardId() + ":" + istrNewLineCharacter);
                    lstrReceiptDetails.Append("-------------------------------------------------" + istrNewLineCharacter);

                    if (lboCart.iclcCartProduct != null && lboCart.iclcCartProduct.Count > 0)
                    {
                        decimal ldecTotalTaxAmt = 0m;
                        decimal ldecTotalAmt    = 0m;

                        foreach (boProduct lboProduct in lboCart.iclcCartProduct)
                        {
                            lstrReceiptDetails.Append("1 ");

                            if (lboProduct.iblnIsImported)
                            {
                                lstrReceiptDetails.Append("imported ");
                            }

                            ldecTotalTaxAmt += lboProduct.idecProductTax;
                            ldecTotalAmt    += (lboProduct.idecBasePrice + lboProduct.idecProductTax);

                            lstrReceiptDetails.Append(lboProduct.istrProductName + ": " + TaxHelper.RoundingRule(lboProduct.idecBasePrice + lboProduct.idecProductTax).ToString("$0.00") + istrNewLineCharacter);
                        }

                        lstrReceiptDetails.Append("-----------------------------" + istrNewLineCharacter);
                        lstrReceiptDetails.Append("Sales Taxes: " + ldecTotalTaxAmt.ToString("$0.00") + Environment.NewLine);
                        lstrReceiptDetails.Append("Total: " + ldecTotalAmt.ToString("$0.00"));
                        lstrReceiptDetails.Append(istrNewLineCharacter + "-----------------------------" + istrNewLineCharacter);
                    }
                }
            }

            return(lstrReceiptDetails);
        }