예제 #1
0
        public static Print_invoiceItemsList GetData(string p_id)
        {
            Print_invoiceItemsList list = new Print_invoiceItemsList();
            //
            List <Upvc_invoiceitems> inv_item_list = CUpvc_invoiceitems_exten.FKId(p_id, new DAL());

            for (int r = 0; r <= inv_item_list.Count - 1; r++)
            {
                Print_invoiceitemsRow row = new Print_invoiceitemsRow();
                //
                row.INVOICE_ITEM_ID = inv_item_list[r].Upvc_invoiceitems_id;
                row.INVOICE_ID      = inv_item_list[r].Upvc_invoice_id;
                row.SL_NO           = (r + 1).ToString();
                row.PRODUCT_ID      = inv_item_list[r].Product_id;

                row.HSN_CODE_ID = Ccoreplus.GetHsncode_name(inv_item_list[r].Product_id);

                row.PCRATE  = inv_item_list[r].Pcrate;
                row.MSM     = inv_item_list[r].Msm;
                row.QTY     = ConvertTO.DecimalToS(inv_item_list[r].Qty.ToString());
                row.WIDTHS  = ConvertTO.DecimalToS(inv_item_list[r].Widths.ToString());
                row.HEIGTHS = ConvertTO.DecimalToS(inv_item_list[r].Heights.ToString());
                row.AREASQ  = ConvertTO.DecimalToS(inv_item_list[r].TotalAreasq.ToString());
                row.PRICE   = ConvertTO.DecimalToS(inv_item_list[r].Price.ToString());

                Upvc_invoiceitems obj = new Upvc_invoiceitems()
                {
                    Pcrate       = row.PCRATE,
                    Msm          = row.MSM,
                    Qty          = ConvertTO.Decimal(row.QTY),
                    Widths       = ConvertTO.Decimal(row.WIDTHS),
                    Heights      = ConvertTO.Decimal(row.HEIGTHS),
                    Price        = ConvertTO.Decimal(row.PRICE),
                    Cgst_percent = inv_item_list[r].Cgst_percent,
                    Sgst_percent = inv_item_list[r].Sgst_percent,
                    Igst_percent = inv_item_list[r].Igst_percent
                };

                UpvcCalculation.Calculate(obj);

                row.TAXABLEVALUE = ConvertTO.Decimal2d(obj.Taxable_amount.ToString());

                row.CGST_PERCENT = ConvertTO.DecimalToS(obj.Cgst_percent.ToString());

                row.CGST_AMOUNT = ConvertTO.Decimal2d(obj.Cgst_amount.ToString());

                row.SGST_PERCENT = ConvertTO.DecimalToS(obj.Sgst_percent.ToString());

                row.SGST_AMOUNT = ConvertTO.Decimal2d(obj.Sgst_amount.ToString());

                row.SUB_TOTAL = ConvertTO.Decimal2d((obj.Taxable_amount + obj.Cgst_amount + obj.Sgst_amount + obj.Igst_amount).ToString());
                //
                list.Add(row);
                //
            }
            //
            return(list);
        }
예제 #2
0
        public static void Calculate(Upvc_invoiceitems items)
        {
            decimal vCalculation = 304.8M;

            decimal vWidths  = items.Widths;
            decimal vHeights = items.Heights;

            decimal vPrice = items.Price;
            decimal vQty   = items.Qty;


            if (items.Pcrate == Core.InSqFt)
            {
                decimal vAreasq = ((vWidths / vCalculation) * (vHeights / vCalculation));
                items.TotalAreasq    = vAreasq * vQty;
                items.Taxable_amount = Math.Round(vPrice * items.TotalAreasq, 2, MidpointRounding.AwayFromZero);
            }
            else if (items.Pcrate == Core.Inpcsrate)
            {
                items.TotalAreasq    = 0;
                items.Taxable_amount = Math.Round(vQty * vPrice, 2, MidpointRounding.AwayFromZero);
            }

            if (items.Msm == Core.InMM)
            {
                items.TotalAreasq = Math.Round(items.TotalAreasq, 2, MidpointRounding.AwayFromZero);
            }
            else if (items.Msm == Core.InInch)
            {
                decimal calculateInInchs = 0.0393M;

                items.TotalAreasq = Math.Round((items.TotalAreasq * calculateInInchs), 2, MidpointRounding.AwayFromZero);
            }

            items.Cgst_amount = (items.Taxable_amount * items.Cgst_percent) / 100;
            items.Sgst_amount = (items.Taxable_amount * items.Sgst_percent) / 100;
            items.Igst_amount = (items.Taxable_amount * items.Igst_percent) / 100;
        }