private static List <Upvc_invoiceitems> EntityList(string q) { List <Upvc_invoiceitems> list = new List <Upvc_invoiceitems>(); using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Upvc_invoiceitems obj = new Upvc_invoiceitems() { Upvc_invoiceitems_id = redr[UPVC_INVOICEITEMS.UPVC_INVOICEITEMS_ID].ToString(), Upvc_invoice_id = redr[UPVC_INVOICEITEMS.UPVC_INVOICE_ID].ToString(), Product_id = redr[PRODUCT.PRODUCT_NAME].ToString(), Pcrate = redr[UPVC_INVOICEITEMS.PCRATE].ToString(), Msm = redr[UPVC_INVOICEITEMS.MSM].ToString(), Widths = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.WIDTHS].ToString()), Heights = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.HEIGHTS].ToString()), TotalAreasq = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.TOTALAREASQ].ToString()), Qty = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.QTY].ToString()), Price = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.PRICE].ToString()), Sgst_percent = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.SGST_PERCENT].ToString()), Cgst_percent = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.CGST_PERCENT].ToString()), Igst_percent = ConvertTO.Decimal(redr[UPVC_INVOICEITEMS.IGST_PERCENT].ToString()), Refered_id = redr[UPVC_INVOICEITEMS.REFERED_ID].ToString(), Locked = redr[UPVC_INVOICEITEMS.LOCKED].ToString(), }; list.Add(obj); } } return(list); }
public static Print_QuotationItemsList GetData(string p_id) { Print_QuotationItemsList list = new Print_QuotationItemsList(); // List <Upvc_Quotationitems> inv_item_list = CUpvc_Quotationitems_exten.FKId(p_id, new DAL()); for (int r = 0; r <= inv_item_list.Count - 1; r++) { Print_QuotationitemsRow row = new Print_QuotationitemsRow(); // row.QUOTATION_ITEM_ID = inv_item_list[r].Upvc_Quotationitems_id; row.QUOTATION_ID = inv_item_list[r].Upvc_Quotation_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 List <Upvc_invoiceitems> Collectitems(string vId) { List <Upvc_invoiceitems> list = new List <Upvc_invoiceitems>(); for (int r = 0; r < editgrid.RowCount; r++) { Upvc_invoiceitems obj = new Upvc_invoiceitems(); if ( (editgrid[UPVC_INVOICEITEMS.PRODUCT_ID, r].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.QTY, r].Value + "") == "" || (editgrid[UPVC_INVOICEITEMS.PRICE, r].Value + "") == "" ) { //==LEAVE IT(the empty row). } else { obj.Upvc_invoiceitems_id = ""; obj.Upvc_invoice_id = vId; obj.Product_id = CProduct_exten.GetId_Name(editgrid[UPVC_INVOICEITEMS.PRODUCT_ID, r].Value + ""); obj.Pcrate = (editgrid[UPVC_INVOICEITEMS.PCRATE, r].Value + ""); obj.Msm = (editgrid[UPVC_INVOICEITEMS.MSM, r].Value + ""); obj.Widths = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.WIDTHS, r].Value + ""); obj.Heights = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.HEIGHTS, r].Value + ""); obj.TotalAreasq = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.TOTALAREASQ, r].Value + ""); obj.Qty = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.QTY, r].Value + ""); obj.Price = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.PRICE, r].Value + ""); obj.Sgst_percent = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.SGST_PERCENT, r].Value + ""); obj.Cgst_percent = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.CGST_PERCENT, r].Value + ""); obj.Igst_percent = ConvertTO.Decimal(editgrid[UPVC_INVOICEITEMS.IGST_PERCENT, r].Value + ""); obj.Refered_id = ""; obj.Locked = Core.Unlocked; list.Add(obj); } } if (list.Count != 0) { return(list); } return(null); }
private static string AttachParams(string q, Upvc_invoiceitems v) { q = q.Replace("@" + UPVC_INVOICEITEMS.UPVC_INVOICE_ID + "@", "" + ConvertTO.SqlString(v.Upvc_invoice_id) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.PRODUCT_ID + "@", "" + ConvertTO.SqlString(v.Product_id) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.PCRATE + "@", "" + ConvertTO.SqlString(v.Pcrate) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.MSM + "@", "" + ConvertTO.SqlString(v.Msm) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.WIDTHS + "@", "" + ConvertTO.SqlString(v.Widths.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.HEIGHTS + "@", "" + ConvertTO.SqlString(v.Heights.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.TOTALAREASQ + "@", "" + ConvertTO.SqlString(v.TotalAreasq.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.QTY + "@", "" + ConvertTO.SqlString(v.Qty.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.PRICE + "@", "" + ConvertTO.SqlString(v.Price.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.SGST_PERCENT + "@", "" + ConvertTO.SqlString(v.Sgst_percent.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.CGST_PERCENT + "@", "" + ConvertTO.SqlString(v.Cgst_percent.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.IGST_PERCENT + "@", "" + ConvertTO.SqlString(v.Igst_percent.ToString()) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.REFERED_ID + "@", "" + ConvertTO.SqlString(v.Refered_id) + ""); q = q.Replace("@" + UPVC_INVOICEITEMS.LOCKED + "@", "" + ConvertTO.SqlString(v.Locked) + ""); return q; }
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 }
public static void InsertSub(Upvc_invoiceitems v, DAL dalsession) { string q = " INSERT INTO " + UPVC_INVOICEITEMS.UPVC_INVOICEITEMS_TBL + " ( "; q += " " + UPVC_INVOICEITEMS.UPVC_INVOICE_ID + " \r\n "; q += "," + UPVC_INVOICEITEMS.PRODUCT_ID + " \r\n "; q += "," + UPVC_INVOICEITEMS.PCRATE + " \r\n "; q += "," + UPVC_INVOICEITEMS.MSM + " \r\n "; q += "," + UPVC_INVOICEITEMS.WIDTHS + " \r\n "; q += "," + UPVC_INVOICEITEMS.HEIGHTS + " \r\n "; q += "," + UPVC_INVOICEITEMS.TOTALAREASQ + " \r\n "; q += "," + UPVC_INVOICEITEMS.QTY + " \r\n "; q += "," + UPVC_INVOICEITEMS.PRICE + " \r\n "; q += "," + UPVC_INVOICEITEMS.SGST_PERCENT + " \r\n "; q += "," + UPVC_INVOICEITEMS.CGST_PERCENT + " \r\n "; q += "," + UPVC_INVOICEITEMS.IGST_PERCENT + " \r\n "; q += "," + UPVC_INVOICEITEMS.REFERED_ID + " \r\n "; q += "," + UPVC_INVOICEITEMS.LOCKED + " \r\n "; q += " ) VALUES ( "; q += " @" + UPVC_INVOICEITEMS.UPVC_INVOICE_ID + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.PRODUCT_ID + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.PCRATE + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.MSM + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.WIDTHS + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.HEIGHTS + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.TOTALAREASQ + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.QTY + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.PRICE + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.SGST_PERCENT + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.CGST_PERCENT + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.IGST_PERCENT + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.REFERED_ID + "@ \r\n "; q += ", @" + UPVC_INVOICEITEMS.LOCKED + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
public static void Insert(List<Upvc_invoiceitems> list, DAL dalsession) { for (int i = 0; i < list.Count; i++) { Upvc_invoiceitems obj = new Upvc_invoiceitems() { Upvc_invoice_id = list[i].Upvc_invoice_id, Product_id = list[i].Product_id, Pcrate = list[i].Pcrate, Msm = list[i].Msm, Widths = list[i].Widths, Heights = list[i].Heights, TotalAreasq = list[i].TotalAreasq, Qty = list[i].Qty, Price = list[i].Price, Sgst_percent = list[i].Sgst_percent, Cgst_percent = list[i].Cgst_percent, Igst_percent = list[i].Igst_percent, Refered_id = list[i].Refered_id, Locked = list[i].Locked }; InsertSub(obj, dalsession); } }