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); }
private void CalcRow(int pRowIndex) { if ((editgrid[UPVC_INVOICEITEMS.PRODUCT_ID, pRowIndex].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.PCRATE, pRowIndex].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.MSM, pRowIndex].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.QTY, pRowIndex].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.WIDTHS, pRowIndex].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.HEIGHTS, pRowIndex].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.PRICE, pRowIndex].Value + "") == "" ) { //==LEAVE IT(the empty row). } else { Upvc_invoiceitems items = new Upvc_invoiceitems { Qty = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.QTY, pRowIndex].Value.ToString()), Widths = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.WIDTHS, pRowIndex].Value.ToString()), Heights = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.HEIGHTS, pRowIndex].Value.ToString()), Pcrate = editgrid[UPVC_INVOICEITEMS.PCRATE, pRowIndex].Value + "", Msm = editgrid[UPVC_INVOICEITEMS.MSM, pRowIndex].Value + "", Price = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.PRICE, pRowIndex].Value), Cgst_percent = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.CGST_PERCENT, pRowIndex].Value), Sgst_percent = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.SGST_PERCENT, pRowIndex].Value), Igst_percent = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.IGST_PERCENT, pRowIndex].Value), }; UpvcCalculation.Calculate(items); editgrid[UPVC_INVOICEITEMS.TOTALAREASQ, pRowIndex].Value = items.TotalAreasq.ToString(); editgrid[UPVC_INVOICEITEMS.TAXABLE_AMOUNT, pRowIndex].Value = items.Taxable_amount.ToString(); editgrid[UPVC_INVOICEITEMS.CGST_AMOUNT, pRowIndex].Value = items.Cgst_amount.ToString(); editgrid[UPVC_INVOICEITEMS.SGST_AMOUNT, pRowIndex].Value = items.Sgst_amount.ToString(); editgrid[UPVC_INVOICEITEMS.IGST_AMOUNT, pRowIndex].Value = items.Igst_amount.ToString(); }//if conditoin }