private void bttn_Print_Click(object sender, EventArgs e) { DataTable bar = new DataTable(); bar.Columns.Add("Category"); bar.Columns.Add("SubCategory"); bar.Columns.Add("SellingAmt"); bar.Columns.Add("Barcode"); bar.Columns.Add("Size"); bar.Columns.Add("Qty"); for (int i = 0; i < dgv_BarcodeDetail.Rows.Count; i++) { if (dgv_BarcodeDetail.Rows[i].Cells["Chk"].Value.ToString() == Convert.ToString(true)) { string category = Convert.ToString(dgv_BarcodeDetail.Rows[i].Cells["Category"].Value); string subcategory = Convert.ToString(dgv_BarcodeDetail.Rows[i].Cells["SubCategory"].Value); string sellingamt = Convert.ToString(dgv_BarcodeDetail.Rows[i].Cells["SellingAmt"].Value); string barcode = Convert.ToString(dgv_BarcodeDetail.Rows[i].Cells["Barcode"].Value); string Size = Convert.ToString(dgv_BarcodeDetail.Rows[i].Cells["size"].Value); string Qty = Convert.ToString(dgv_BarcodeDetail.Rows[i].Cells["Qty"].Value); bar.Rows.Add(category, subcategory, sellingamt, barcode, Size, Qty); } } _common.InsertIntoTemp(bar); if (dtsett.BarcodeType == "Thermal") { _barcode.PrintBarcode(Convert.ToInt32(dtsett.BarcodeCount)); } else if (dtsett.BarcodeType == "Laser") { _barcode.PrintBarcodeA4(1, Convert.ToInt32(dtsett.BarcodeCount)); } _common.DeleteTemp(); }
private void bttn_Purchase_Click(object sender, EventArgs e) { int p = 0; int BarcodeCount = Convert.ToInt32(dtsett.BarcodeCount); string TransactionLedgerID = null; if (checkData()) { //if (!_objCustmor.SupplierDetail(cmb_Name.Text)) try { if (supplierexs == "No") { _purchase.InsertSupplierInfo(lbl_AccNo1.Text, cmb_Name.Text, cmb_State.Text, txt_Address.Text, txt_City.Text, txt_ContactNo.Text, txt_PAN.Text, txt_GSTIN.Text, dtp_Date.Value.ToString("dd/MM/yyyy")); } } catch (Exception ex) { _error.AddException(ex, "Purchase"); } try { for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++) { if (_objCustmor.GetalooseItem(Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value))) { string category = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value); string subcategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value); string HSN = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value); string size = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value); string purchaseamt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["PurchaseAmt"].Value); string Qty = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value); string TotalAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value); string BatchNo = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value); string SellingAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SellingAmt"].Value); string CGSTper = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGSTper"].Value); string CGST = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGST"].Value); string SGSTper = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGSTper"].Value); string SGST = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGST"].Value); string IGSTper = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGSTper"].Value); string IGST = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGST"].Value); string PBillNo = txt_BillNo.Text; _purchase.InsertItem("", category, subcategory, size, PBillNo, "Purchase", Qty, CGSTper, CGST, SGSTper, SGST, IGSTper, IGST, purchaseamt, TotalAmt, BatchNo, SellingAmt, HSN, dtp_Date.Value.ToString("dd/MM/yyyy"), null, txt_PurchaseRef.Text); } else if (!_objCustmor.GetalooseItem(Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value))) { string barcode; if (dgv_ItemInfo.Rows[i].Cells["Barcode"].Value == "" || dgv_ItemInfo.Rows[i].Cells["Barcode"].Value == string.Empty) { barcode = _objSQLHelper.GetMaxID("B", "0"); } else { barcode = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Barcode"].Value); } string subcategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value); string category = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value); string size = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value); string HSN = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value); string purchaseamt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["PurchaseAmt"].Value); string qty = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value); string TotalAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value); string BatchNo = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value); string SellingAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SellingAmt"].Value); string CGSTper = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGSTper"].Value); string CGST = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGST"].Value); string SGSTper = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGSTper"].Value); string SGST = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGST"].Value); string IGSTper = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGSTper"].Value); string IGST = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGST"].Value); string BarcodePrint = dgv_ItemInfo.Rows[i].Cells["Chk"].Value.ToString(); string PBillNo = txt_BillNo.Text; _purchase.InsertItem(barcode, category, subcategory, size, PBillNo, "Purchase", qty, CGSTper, CGST, SGSTper, SGST, IGSTper, IGST, purchaseamt, TotalAmt, BatchNo, SellingAmt, HSN, dtp_Date.Value.ToString("dd/MM/yyyy"), BarcodePrint, txt_PurchaseRef.Text); } } } catch (Exception ex) { _error.AddException(ex, "Purchase/InsetItem"); } try { if (dtsett.Barcode == "Yes") { //insert Into Temp Table _Common.InsertIntoTemp(txt_PurchaseRef.Text); if (dtsett.BarcodeType == "Thermal") { _Barcode.PrintBarcode(Convert.ToInt32(dtsett.BarcodeCount)); } else if (dtsett.BarcodeType == "Laser") { _Barcode.PrintBarcodeA4(p = 0, Convert.ToInt32(dtsett.BarcodeCount)); } } _Common.DeleteTemp(); } catch (Exception ex) { _error.AddException(ex, "Purchase/PrintBarcode"); } try { _objCustmor.InsertBillDetail(lbl_AccNo1.Text, txt_BillNo.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_TotalAmt.Text, txt_CGSTValue.Text, txt_SGSTValue.Text, txt_IGSTValue.Text, txt_NetAmt.Text, cmb_State.Text, Type, txt_PurchaseRef.Text); if (txt_PaidAmt.Text != "0" || txt_PaidAmt.Text != "" || txt_PaidAmt.Text != string.Empty) { _objCustmor.InsertPaymentDetails("Supplier", txt_PaidAmt.Text, cmb_PayMode.Text, lbl_AccNo1.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_BillNo.Text); } } catch (Exception ex) { _error.AddException(ex, "Purchse"); } try { CustomerLedgerID = _purchase.insertAcountLedgerDetailPurchase(Vouchertypeid: VouchertypeID, SupplierName: cmb_Name.Text, AccNo: lbl_AccNo1.Text, Date: dtp_Date.Text, narration: ""); string VouchertypeIDPayment = _Common.getALLTableDetails(sTableName: TableNames.VoucherType, sColomnName: "VoucherTypeName", sColumnValue: "Purchase Receipt Voucher").Rows[0]["VoucherTypeID"].ToString(); bool Payformstatus = true; if (Convert.ToDouble(txt_PaidAmt.Text) == 0) { DialogResult dr1 = MessageBox.Show("Save with Zero Amount :" + txt_PaidAmt.Text + "\n\n Do You Want To Continue", "JMS Says ", MessageBoxButtons.YesNo); if (dr1 == DialogResult.No) { Payformstatus = false; } } else if (Convert.ToDouble(txt_PaidAmt.Text) > 0) { DialogResult dr = MessageBox.Show("Amount to be Payed : " + txt_PaidAmt.Text + "\n\n Do You Want To Continue", "JMS Says ", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { if (dtsett.PaymentForm == "1") { PaymentOption.frm_PaymentOptionForPaymentVoucher form = new PaymentOption.frm_PaymentOptionForPaymentVoucher(txt_PaidAmt.Text, txt_BillNo.Text, lbl_AccNo1.Text, dtp_Date.Text, CustomerType.SupplierPurchaseGST, OperationType.Create); form.ShowDialog(); PaymentIDs = form.PaymentIDs; Payformstatus = true; TransactionLedgerID = form.TransactionLedgerID; if (form.ReturnStatus == false) { Payformstatus = false; } } else if (dtsett.PaymentForm == "0") { Payformstatus = true; } } else if (dr == DialogResult.No) { Payformstatus = false; } } _purchase.InsertCreditDebitInPurchaseAccount(customerLedgerID: CustomerLedgerID, VouchertypeID: VouchertypeID, sbillno: txt_BillNo.Text, CurrentAmount: txt_PaidAmt.Text, date: dtp_Date.Text, Date: dtp_Date.Text, SupplierName: cmb_Name.Text, Narration: ""); } catch (Exception ex) { _error.AddException(ex, "Purchse"); } try { Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer(); SendData _obj = new SendData(_objfrm_ReportViewer.SupplierBill); _obj(txt_PurchaseRef.Text, "Print"); } catch (Exception ex) { MessageBox.Show(ex.Message); _error.AddException(ex, "Purchacse/BillPrint"); } Masterclear(); MessageBox.Show("Purchased Done"); cmb_Name.Select(); } }
private void bttn_Purchase_Click(object sender, EventArgs e) { int p = 0; if (checkData()) { //if (!_objCustmor.SupplierDetail(cmb_Name.Text)) try { if (supplierexs == "No") { _purchase.InsertSupplierInfo(lbl_AccNo1.Text, cmb_Name.Text, cmb_State.Text, txt_Address.Text, txt_City.Text, txt_ContactNo.Text, txt_PAN.Text, txt_GSTIN.Text, dtp_Date.Value.ToString("dd/MM/yyyy")); } } catch (Exception ex) { _error.AddException(ex, "EstPurchase_Insert_Supplier"); } //try //{ for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++) { if (_objCustmor.GetalooseItem(Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value))) { string category = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value); string subcategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value); string HSN = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value); string size = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value); string purchaseamt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["PurchaseAmt"].Value); string Qty = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value); string TotalAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value); string BatchNo = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value); string SellingAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SellingAmt"].Value); string PBillNo = txt_BillNo.Text; _purchase.InsertItem("", category, subcategory, size, PBillNo, "Purchase", Qty, "0", "0", "0", "0", "0", "0", purchaseamt, TotalAmt, BatchNo, SellingAmt, HSN, dtp_Date.Value.ToString("dd/MM/yyyy"), null, txt_refrence.Text); } else if (!_objCustmor.GetalooseItem(Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value))) { string barcode; if (dgv_ItemInfo.Rows[i].Cells["Barcode"].Value == "" || dgv_ItemInfo.Rows[i].Cells[0].Value == "true") { barcode = _objSQLHelper.GetMaxID("B", "0"); } else { barcode = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Barcode"].Value); } string subcategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value); string category = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value); string size = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value); string HSN = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value); string purchaseamt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["PurchaseAmt"].Value); string qty = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value); string TotalAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value); string BatchNo = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value); string SellingAmt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SellingAmt"].Value); string BarcodePrint = dgv_ItemInfo.Rows[i].Cells["Chk"].Value.ToString(); string PBillNo = txt_BillNo.Text; _purchase.InsertItem(barcode, category, subcategory, size, PBillNo, "Purchase", qty, "0", "0", "0", "0", "0", "0", purchaseamt, TotalAmt, BatchNo, SellingAmt, HSN, dtp_Date.Value.ToString("dd/MM/yyyy"), BarcodePrint, txt_refrence.Text); } } //} //catch (Exception ex) //{ // _error.AddException(ex, "EstPurchase"); // MessageBox.Show("Problem Inserting Item \n" + ex.Message); //} try { if (dtsett.Barcode == "Yes") { _Common.InsertIntoTemp(txt_refrence.Text); if (dtsett.BarcodeType == "Thermal") { _Barcode.PrintBarcode(Convert.ToInt32(dtsett.BarcodeCount)); } else if (dtsett.BarcodeType == "Laser") { _Barcode.PrintBarcodeA4(p = 0, Convert.ToInt32(dtsett.BarcodeCount)); } } _Common.DeleteTemp(); } catch (Exception ex) { _error.AddException(ex, "Purchase/PrintBarcode"); } try { _objCustmor.InsertBillDetail(lbl_AccNo1.Text, txt_BillNo.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_TotalAmt.Text, "0", "0", "0", txt_NetAmt.Text, cmb_State.Text, Type, txt_refrence.Text); if (txt_PaidAmt.Text != "0" || txt_PaidAmt.Text != "" || txt_PaidAmt.Text != string.Empty) { _objCustmor.InsertPaymentDetails("Supplier", txt_PaidAmt.Text, cmb_PayMode.Text, lbl_AccNo1.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_BillNo.Text); } } catch (Exception ex) { _error.AddException(ex, "Purchse"); } Masterclear(); MessageBox.Show("Purchased Done"); cmb_Name.Select(); } }