private void btn_Save_Click(object sender, EventArgs e) { if (check()) { try { string VouchertypeID = _objCommon.getALLTableDetails(sTableName: TableNames.VoucherType, sColomnName: "VoucherTypeName", sColumnValue: "Receipt Voucher").Rows[0]["VoucherTypeID"].ToString(); string TransactionLedgerID = null; bool Payformstatus = true; if (Convert.ToDouble(txtAmount.Text) > 0) { DialogResult dr = MessageBox.Show("Amount to be Payed :" + txtAmount.Text + "\n\n Do You Want To Continue", "JMS Says ", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { if (datasv.PaymentForm == "1") { frm_PaymentOptionForReceiptVoucher form = new frm_PaymentOptionForReceiptVoucher ( Amountpaid: txtAmount.Text, billno: txtReceiptNo.Text, Accountno: "", Date: txtDate.Text, CustomerType: CustomerType.ReceiptVoucher, OperationType: OperationType.Create ); form.ShowDialog(); Payformstatus = true; TransactionLedgerID = form.TransactionLedgerID; PaymentIDs = form.PaymentIDs; if (form.ReturnStatus == false) { Payformstatus = false; } } else if (datasv.PaymentForm == "0") { Payformstatus = true; } } else if (dr == DialogResult.No) { Payformstatus = false; } } int ReceiptMasterID = _objCreditDebit.addReceiptVoucher ( ReceiptNo: txtReceiptNo.Text, Date: txtDate.Text, CashOrBankID: TransactionLedgerID.ToString(), AccountLedgerID: CmbAccountLedger.SelectedValue.ToString(), Amount: txtAmount.Text, Narration: txtNarration.Text ); if (txtAmount.Text != "" && txtAmount.Text != "0") { _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherTypeId", columnValue: VouchertypeID, paymentid: PaymentIDs[0]); _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherId", columnValue: ReceiptMasterID.ToString(), paymentid: PaymentIDs[0]); if (PaymentIDs[1] != 0) { _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherTypeId", columnValue: VouchertypeID, paymentid: PaymentIDs[1]); _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherId", columnValue: ReceiptMasterID.ToString(), paymentid: PaymentIDs[1]); } //acount ledger creditdebit With payment by cash /bank _ObjSalesCommon.insertcreditDebitWithPayment(customerLedgerID: CmbAccountLedger.SelectedValue.ToString(), VouchertypeID: VouchertypeID, sbillno: ReceiptMasterID.ToString(), transactionLedgerID: TransactionLedgerID, AmountPaid: txtAmount.Text, Narration: "", Date: txtDate.Text, name: CmbAccountLedger.Text.Trim()); } MessageBox.Show("Data Inserted...!"); MasterClear(); } catch (Exception ex) { MessageBox.Show(ex.Message); _error.AddException(ex, FormName); } } else { } }
private void bttn_Sale_Click(object sender, EventArgs e) { string BillNo = cmb_ServiceId.Text; string TransactionLedgerID = null; try { for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++) { //string barcode = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BarcodeNo"].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 BatchNo = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value); string Qty = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value); string price = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Rate"].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 TotalAmount = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value); string TotalPrice = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalPrice"].Value); string Size = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value); string PBillNo = BillNo; //string SalesPerson = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Sales"].Value); string Maintain = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Maintain"].Value); _Sale.AddItemDetails(category, subcategory, Size, cmb_ServiceId.Text, "Service Invoice", dtp_Date.Value.ToString("dd/MM/yyyy"), price, Qty, CGSTper, CGST, SGSTper, SGST, IGSTper, IGST, TotalAmount, BatchNo, HSN, TotalPrice, "", Maintain, "0", "0", "0", "0", "0"); if (dgv_ItemInfo.Rows[i].Cells["Maintain"].Value.ToString() != "0") { _service.AddMaintain(dtp_Date.Value.ToString("dd/MM/yyyy"), category + " " + subcategory, dtp_Date.Value.AddMonths(Convert.ToInt32(Maintain)).ToString("dd/MM/yyyy"), lbl_CustID.Text); } } } catch (Exception ex) { _error.AddException(ex, "Service Invoice"); } try { _Sale.AddBillDetails(cmb_ServiceId.Text, lbl_CustID.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), DateTime.Now.ToString("HH:mm:ss"), txt_TotalAmt.Text, lbl_CGSTValue.Text, lbl_SGSTValue.Text, lbl_IGSTValue.Text, txt_NetAmt.Text, "", txt_BillAmt.Text, txt_Discount.Text, "Service Invoice", txt_Extra.Text, txt_Other.Text, "0"); if (txt_PaidAmt.Text != "" || txt_PaidAmt.Text != "0" || txt_PaidAmt.Text == string.Empty) { _a.InsertPaymentDetails("Sale", txt_PaidAmt.Text, cmb_PayMode.Text, lbl_CustID.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), cmb_ServiceId.Text); } //create account ledger string ledgerId; ledgerId = _Sale.insertAcountLedgerDetail(Vouchertypeid: VouchertypeID, AccNo: lbl_CustID.Text, Name: txt_name.Text, Narration: "", Date: dtp_Date.Text); bool Payformstatus = true; if (Convert.ToInt32(txt_PaidAmt.Text) == 0) { DialogResult dr1 = MessageBox.Show("Save with Zero Amount :" + txt_PaidAmt.Text + "\n\n Do You Want To Continue", "ShopIn Says ", MessageBoxButtons.YesNo); if (dr1 == DialogResult.No) { Payformstatus = false; } } else if (Convert.ToInt32(txt_PaidAmt.Text) > 0) { DialogResult dr = MessageBox.Show("Amount to be Payed :" + txt_PaidAmt.Text + "\n\n Do You Want To Continue", "ShopIn Says ", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { if (dtSett.PaymentForm == "1") { frm_PaymentOptionForReceiptVoucher form = new frm_PaymentOptionForReceiptVoucher ( Amountpaid: txt_PaidAmt.Text, billno: cmb_ServiceId.Text, Accountno: lbl_CustID.Text, Date: dtp_Date.Text, CustomerType: CustomerType.CustomerSaleGST, OperationType: OperationType.Create ); form.ShowDialog(); Payformstatus = true; TransactionLedgerID = form.TransactionLedgerID; PaymentIDs = form.PaymentIDs; if (form.ReturnStatus == false) { Payformstatus = false; } } else if (dtSett.PaymentForm == "0") { Payformstatus = true; } } else if (dr == DialogResult.No) { Payformstatus = false; } } _Sale.InsertCreditDebitInSalesAccount(customerLedgerID: ledgerId, VouchertypeID: VouchertypeID, sbillno: lbl_CustID.Text.ToString(), Name: txt_name.Text, Amount: txt_PaidAmt.Text, Narration: "", Date: dtp_Date.Text); } catch (Exception ex) { _error.AddException(ex, "Sale/AddBillDetails"); } try { Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer(); SendData _obj = new SendData(_objfrm_ReportViewer.ServiceInvoice); _obj(cmb_ServiceId.Text, "Print"); } catch (Exception ex) { MessageBox.Show(ex.Message); _error.AddException(ex, "Sale/PrintBill"); } //_Sale.PrintBillThermal(BillNo); MessageBox.Show("Sale Successfully Done"); Masterclear(); Clear(); this.BringToFront(); }