コード例 #1
0
        public CostCalculateResponse CostWithTax(CostCalculateRequest costCalculateRequest)
        {
            CostCalculateResponse costCalculateResponse = new CostCalculateResponse();
            int tempCustCost     = costCalculateRequest.costprice + costCalculateRequest.VendorShippingCost + costCalculateRequest.CustomerShippingCost + costCalculateRequest.CustomerMarginRupees;
            int tempTraderCost   = costCalculateRequest.costprice + costCalculateRequest.VendorShippingCost + costCalculateRequest.CustomerShippingCost + costCalculateRequest.TraderMarginRupees;
            int taxpercent       = 0;
            int taxpercentTrader = 0;

            if (_context.prd_tax_percentage.Where(e => ((e.productstichingtypeId == costCalculateRequest.prdStichingType) && (e.taxtype == TaxTypes.GST))).FirstOrDefault() != null)
            {
                if ((costCalculateRequest.costprice + costCalculateRequest.CustomerMarginRupees) > 1000)
                {
                    taxpercent = _context.prd_tax_percentage.Where(e => ((e.productstichingtypeId == costCalculateRequest.prdStichingType) && (e.taxtype == TaxTypes.GST_OverMargin))).FirstOrDefault().taxpercentage;
                }
                else
                {
                    taxpercent = _context.prd_tax_percentage.Where(e => (e.productstichingtypeId == costCalculateRequest.prdStichingType) && (e.taxtype == TaxTypes.GST)).FirstOrDefault().taxpercentage;
                }
                if ((costCalculateRequest.costprice + costCalculateRequest.TraderMarginRupees) > 1000)
                {
                    taxpercentTrader = _context.prd_tax_percentage.Where(e => ((e.productstichingtypeId == costCalculateRequest.prdStichingType) && (e.taxtype == TaxTypes.GST_OverMargin))).FirstOrDefault().taxpercentage;
                }
                else
                {
                    taxpercentTrader = _context.prd_tax_percentage.Where(e => (e.productstichingtypeId == costCalculateRequest.prdStichingType) && (e.taxtype == TaxTypes.GST)).FirstOrDefault().taxpercentage;
                }
            }
            else
            {
                taxpercent       = _context.prd_tax_percentage.Where(e => (e.productstichingtypeId == costCalculateRequest.prdStichingType) && (e.taxtype == TaxTypes.GST)).FirstOrDefault().taxpercentage;
                taxpercentTrader = taxpercent;
            }

            costCalculateResponse.CustomerPrice = tempCustCost + (tempCustCost * taxpercent) / 100;
            costCalculateResponse.TraderPrice   = tempTraderCost + (tempTraderCost * taxpercentTrader) / 100;
            return(costCalculateResponse);
        }
コード例 #2
0
 public IActionResult CalculateSellingCost(CostCalculateRequest costCalculateRequest)
 {
     return(Ok(_prd.CostWithTax(costCalculateRequest)));
 }