/// <summary> /// Function to fill Datagridview /// </summary> public void Search() { try { DataTable dtblPDCClearnceRegister = new DataTable(); PDCClearanceMasterSP SppdcClearance = new PDCClearanceMasterSP(); dtblPDCClearnceRegister = SppdcClearance.PDCClearanceRegisterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbAccountLedger.Text, cmbVouchertype.Text, txtCheckno.Text.Trim(), Convert.ToDecimal(cmbBank.SelectedValue), cmbStatus.Text); dgvClearanceSearch.DataSource = dtblPDCClearnceRegister; } catch (Exception ex) { formMDI.infoError.ErrorString = "PCREG7:" + ex.Message; } }
/// <summary> /// Search function to fill the grid based on condition /// </summary> public void ReportSearch() { try { DataTable dtblPDCClearnceReport = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); dtblPDCClearnceReport = sppdcClearance.PDCClearanceReportSearch(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbAccountLedger.Text.ToString(), cmbVoucherType.Text.ToString(), txtVoucherNo.Text.ToString()); DGVClraranceReport.DataSource = dtblPDCClearnceReport; } catch (Exception ex) { formMDI.infoError.ErrorString = "PCREP5:" + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> public void Search() { try { DataTable dtblPDCClearnceRegister = new DataTable(); PDCClearanceMasterSP SppdcClearance = new PDCClearanceMasterSP(); dtblPDCClearnceRegister = SppdcClearance.PDCClearanceRegisterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbAccountLedger.Text, cmbVouchertype.Text, txtCheckno.Text.Trim(), Convert.ToDecimal(cmbBank.SelectedValue), cmbStatus.Text); dgvClearanceSearch.DataSource = dtblPDCClearnceRegister; } catch (Exception ex) { MessageBox.Show("PCREG6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Search function to fill the grid based on condition /// </summary> public void ReportSearch() { try { DataTable dtblPDCClearnceReport = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); dtblPDCClearnceReport = sppdcClearance.PDCClearanceReportSearch(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbAccountLedger.Text.ToString(), cmbVoucherType.Text.ToString(), txtVoucherNo.Text.ToString()); DGVClraranceReport.DataSource = dtblPDCClearnceReport; } catch (Exception ex) { MessageBox.Show("PCREP5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// VoucherType Combofill /// </summary> public void VoucherTypeComboFill() { try { isDontExecuteVoucherType = true; DataTable dtbl = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); cmbvouchertype.DataSource = null; dtbl = sppdcClearance.VouchertypeComboFill(); cmbvouchertype.DataSource = dtbl; cmbvouchertype.ValueMember = "voucherTypeId"; cmbvouchertype.DisplayMember = "voucherTypeName"; cmbvouchertype.SelectedIndex = -1; isDontExecuteVoucherType = false; } catch (Exception ex) { MessageBox.Show("PC1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// print button click, call the print function /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (DGVClraranceReport.RowCount > 0) { PDCClearanceMasterSP SPPdcClearance = new PDCClearanceMasterSP(); DataSet dsPDCClearance = new DataSet(); dsPDCClearance = SPPdcClearance.PDCClearanceReportPrinting(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbAccountLedger.Text.ToString(), cmbVoucherType.Text.ToString(), txtVoucherNo.Text.ToString(), 1); frmReport frmreport = new frmReport(); frmreport.MdiParent = formMDI.MDIObj; frmreport.PDCClearanceReportPrinting(dsPDCClearance); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PCREP12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboFill() { try { isDontExecuteVoucherType = true; DataTable dtbl = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); cmbVouchertype.DataSource = null; dtbl = sppdcClearance.VouchertypeComboFill(); DataRow dr = dtbl.NewRow(); dr["voucherTypeId"] = 0; dr["voucherTypeName"] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbVouchertype.DataSource = dtbl; cmbVouchertype.ValueMember = "voucherTypeId"; cmbVouchertype.DisplayMember = "voucherTypeName"; cmbVouchertype.SelectedIndex = 0; isDontExecuteVoucherType = false; } catch (Exception ex) { formMDI.infoError.ErrorString = "PCREG5:" + ex.Message; } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboFill() { try { isDontExecuteVoucherType = true; DataTable dtbl = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); cmbVoucherType.DataSource = null; dtbl = sppdcClearance.VouchertypeComboFill(); DataRow dr = dtbl.NewRow(); dr["voucherTypeId"] = 0; dr["voucherTypeName"] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtbl; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = 0; isDontExecuteVoucherType = false; } catch (Exception ex) { MessageBox.Show("PCREP2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmPDCClearanceReport to view details and for updation /// </summary> /// <param name="PDCClearanceReport"></param> /// <param name="decMasterId"></param> public void CallFromPDCClearanceReport(frmPDCClearanceReport PDCClearanceReport, decimal decMasterId) { try { PDCClearanceReport.Enabled = false; base.Show(); isInEditMode = true; btnDelete.Enabled = true; pdcClearanceReportObj = PDCClearanceReport; decPDCClearanceEditId = decMasterId; PDCClearanceMasterSP spPDCClearance = new PDCClearanceMasterSP(); decMasterIdEdit = spPDCClearance.PDCClearanceAgainstIdUnderClearanceId(decPDCClearanceEditId); FillFunction(); } catch (Exception ex) { MessageBox.Show("PC17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmLedgerDetails to view details and for updation /// </summary> /// <param name="frmLedgerDetails"></param> /// <param name="decMasterId"></param> public void CallFromLedgerDetails(frmLedgerDetails frmLedgerDetails, decimal decMasterId) { try { base.Show(); frmLedgerDetailsObj = frmLedgerDetails; frmLedgerDetailsObj.Enabled = false; isInEditMode = true; btnDelete.Enabled = true; decPDCClearanceEditId = decMasterId; PDCClearanceMasterSP spPDCClearance = new PDCClearanceMasterSP(); decMasterIdEdit = spPDCClearance.PDCClearanceAgainstIdUnderClearanceId(decPDCClearanceEditId); FillFunction(); } catch (Exception ex) { MessageBox.Show("PC15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Its the fill function to update or delete /// </summary> public void FillFunction() { try { PDCClearanceMasterInfo infoPDCClearance = new PDCClearanceMasterInfo(); PDCClearanceMasterSP Sppdcclerance = new PDCClearanceMasterSP(); infoPDCClearance = Sppdcclerance.PDCClearanceMasterView(decPDCClearanceEditId); VoucherTypeComboFill(); strVoucherNo = infoPDCClearance.VoucherNo; strInvoiceNo = infoPDCClearance.InvoiceNo; txtvoucherNo.Text = strInvoiceNo; decSufixprefixPdcpayableID = infoPDCClearance.SuffixPrefixId; decPDCclearanceVoucherTypeId = infoPDCClearance.VoucherTypeId; VoucherTypeSP spVoucherType = new VoucherTypeSP(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPDCclearanceVoucherTypeId); if (isAutomatic) { txtvoucherNo.ReadOnly = true; } else { txtvoucherNo.ReadOnly = false; } if (infoPDCClearance.PDCClearanceMasterId != 0) { PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); txtvoucherNo.Text = infoPDCClearance.VoucherNo; dtpVoucherDate.Value = infoPDCClearance.Date; txtVoucherDate.Text = dtpVoucherDate.Value.ToString("dd-MMM-yyyy"); txtNarration.Text = infoPDCClearance.Narration; cmbvouchertype.Text = infoPDCClearance.Type; InvoiceNumberCombofill(cmbvouchertype.Text.ToString(), decMasterIdEdit); cmbStatus.Text = infoPDCClearance.Status; cmbInvoiceNo.SelectedValue = decMasterIdEdit; btnSave.Text = "Update"; } } catch (Exception ex) { MessageBox.Show("PC14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// delete function /// </summary> /// <param name="decpdcMasterId"></param> public void DeleteFunction(decimal decpdcMasterId) { try { PDCClearanceMasterSP spPdcclearance = new PDCClearanceMasterSP(); AccountLedgerSP SpAccountLedger = new AccountLedgerSP(); spPdcclearance.PDCClearanceDelete(decpdcMasterId, decPDCclearanceVoucherTypeId, strVoucherNo); Messages.DeletedMessage(); if (pdcClearanceRegObj != null) { this.Close(); pdcClearanceRegObj.Show(); } else if (pdcClearanceReportObj != null) { this.Close(); pdcClearanceReportObj.Show(); } else if (objVoucherSearch != null) { this.Close(); objVoucherSearch.GridFill(); } else if (frmLedgerDetailsObj != null) { this.Close(); } else if (frmDayBookObj != null) { this.Close(); } else { ClearFunction(); } } catch (Exception ex) { MessageBox.Show("PC21:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Voucher no automatic generation, it considered the settings also /// </summary> public void VoucherNumberGeneration() { try { TransactionsGeneralFill obj = new TransactionsGeneralFill(); PDCClearanceMasterSP spPdclearance = new PDCClearanceMasterSP(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCclearanceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName); if (Convert.ToDecimal(strVoucherNo) != spPdclearance.PDCClearanceMaxUnderVoucherTypePlusOne(decPDCclearanceVoucherTypeId)) { strVoucherNo = spPdclearance.PDCClearanceMaxUnderVoucherType(decPDCclearanceVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCclearanceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName); if (spPdclearance.PDCClearanceMaxUnderVoucherType(decPDCclearanceVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCclearanceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName); } } if (isAutomatic) { SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPDCclearanceVoucherTypeId, dtpVoucherDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decSufixprefixPdcpayableID = infoSuffixPrefix.SuffixprefixId; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtvoucherNo.Text = strInvoiceNo; lblVoucherNoManualValidator.Visible = false; txtvoucherNo.ReadOnly = true; txtvoucherNo.Enabled = false; } else { txtvoucherNo.ReadOnly = false; txtvoucherNo.Text = string.Empty; lblVoucherNoManualValidator.Visible = true; strInvoiceNo = txtvoucherNo.Text.Trim(); } } catch (Exception ex) { MessageBox.Show("PC8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Details fill function when user changed the invoice no. here fill thje curresponding invoice no /// </summary> public void filldetailsfunction() { try { PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); decmasterId = Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()); dtblDetails = sppdcClearance.pdcclearancedetailsFill(cmbvouchertype.Text.ToString(), decmasterId); string strchequeNo = dtblDetails.Rows[0]["chequeNo"].ToString(); decimal decAmount = Convert.ToDecimal(dtblDetails.Rows[0]["amount"].ToString()); string straccountledger = dtblDetails.Rows[0]["ledgerName"].ToString(); DateTime dtcheckdate = Convert.ToDateTime(dtblDetails.Rows[0]["checkDate"].ToString()); string strBank = dtblDetails.Rows[0]["Bank"].ToString(); strledgerId = dtblDetails.Rows[0]["ledgerId"].ToString(); txtcheckNo.Text = strchequeNo; txtAmount.Text = decAmount.ToString(); txtAccountLedger.Text = straccountledger; txtcheckdate.Text = Convert.ToString(dtblDetails.Rows[0]["checkDate"].ToString()); txtBank.Text = strBank; } catch (Exception ex) { MessageBox.Show("PC3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Delete button click, checking the user role PrivilegeCheck and call the delete function /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnDelete.Text)) { if (PublicVariables.isMessageDelete) { if (Messages.DeleteMessage()) { if (isInEditMode) { DeleteFunction(decPDCClearanceEditId); txtvoucherNo.Focus(); } } } else { if (isInEditMode) { DeleteFunction(decPDCClearanceEditId); txtvoucherNo.Focus(); } } } else { Messages.NoPrivillageMessage(); } } catch (Exception ex) { MessageBox.Show("PC30:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void Search() { try { DataTable dtblPDCClearnceRegister = new DataTable(); PDCClearanceMasterSP SppdcClearance = new PDCClearanceMasterSP(); dtblPDCClearnceRegister = SppdcClearance.PDCClearanceRegisterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbAccountLedger.Text, cmbVouchertype.Text, txtCheckno.Text.Trim(), Convert.ToDecimal(cmbBank.SelectedValue), cmbStatus.Text); dgvClearanceSearch.DataSource = dtblPDCClearnceRegister; } catch (Exception ex) { MessageBox.Show("PCREG6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Its the function for print function /// </summary> /// <param name="decMasterId"></param> public void Print(decimal decMasterId) { try { DataSet dsPdcClearance = new DataSet(); PDCClearanceMasterSP SppdcClearance = new PDCClearanceMasterSP(); dsPdcClearance = SppdcClearance.PDCClearanceVoucherPrinting(decMasterId, 1); frmReport frmreport = new frmReport(); frmreport.MdiParent = formMDI.MDIObj; frmreport.PDCClearancevoucherPrinting(dsPdcClearance); } catch (Exception ex) { MessageBox.Show("PC18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Save Or edit function, here checking the invalid entries /// </summary> public void SaveOrEditFunction() { try { bool isOk = true; if (isOk) if (txtvoucherNo.Text == string.Empty) { Messages.InformationMessage("Enter voucher no"); txtvoucherNo.Focus(); } else if (txtVoucherDate.Text == string.Empty) { Messages.InformationMessage("Select date"); txtVoucherDate.Focus(); } else if (cmbvouchertype.SelectedValue == null) { Messages.InformationMessage("Select voucher type"); cmbvouchertype.Focus(); } else if (cmbInvoiceNo.SelectedValue == null) { Messages.InformationMessage("Select against invoice no"); cmbInvoiceNo.Focus(); } else if (cmbStatus.Text == string.Empty) { Messages.InformationMessage("Select status"); cmbStatus.Focus(); } else { if (PublicVariables.isMessageAdd) { isOk = false; PDCClearanceMasterSP sppdcClerance = new PDCClearanceMasterSP(); if (!isInEditMode) { if (Messages.SaveMessage()) if (!sppdcClerance.PDCclearanceCheckExistence(txtvoucherNo.Text.Trim(), decPDCclearanceVoucherTypeId, 0)) { SaveFunction(); } else { Messages.InformationMessage("Voucher number already exist"); } } else if (isInEditMode) { if (Messages.UpdateMessage()) { SaveFunction(); } } } if (isOk) { if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text)) { PDCPayableMasterSP SpPDCpayable = new PDCPayableMasterSP(); if (isInEditMode) { SaveFunction(); } else { SaveFunction(); } } else { Messages.NoPrivillageMessage(); } } } } catch (Exception ex) { MessageBox.Show("PC10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Invoice no Combo fill function /// </summary> /// <param name="strVoucherType"></param> /// <param name="masterId"></param> public void InvoiceNumberCombofill(string strVoucherType, decimal masterId) { try { if (cmbvouchertype.Text != string.Empty) { if (cmbvouchertype.SelectedValue.ToString() != "System.Data.DataRowView" && cmbvouchertype.Text != "System.Data.DataRowView") { isInvoicefill = true; if (isInEditMode) { masterId = decMasterIdEdit; } DataTable dtblInvoice = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); dtblInvoice = sppdcClearance.InvoiceNumberCombofillUnderVoucherType(strVoucherType, masterId); cmbInvoiceNo.DataSource = dtblInvoice; if (cmbInvoiceNo.DataSource != null) { cmbInvoiceNo.DisplayMember = "invoiceNo"; cmbInvoiceNo.ValueMember = "MasterId"; cmbInvoiceNo.SelectedIndex = -1; } isInvoicefill = false; } } } catch (Exception ex) { MessageBox.Show("PC2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Search function to fill the grid based on condition /// </summary> public void ReportSearch() { try { DataTable dtblPDCClearnceReport = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); dtblPDCClearnceReport = sppdcClearance.PDCClearanceReportSearch(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbAccountLedger.Text.ToString(), cmbVoucherType.Text.ToString(), txtVoucherNo.Text.ToString()); DGVClraranceReport.DataSource = dtblPDCClearnceReport; } catch (Exception ex) { MessageBox.Show("PCREP5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmDayBook to view details and for updation /// </summary> /// <param name="frmDayBook"></param> /// <param name="decMasterId"></param> public void callFromDayBook(frmDayBook frmDayBook, decimal decMasterId) { try { frmDayBook.Enabled = false; base.Show(); isInEditMode = true; btnDelete.Enabled = true; frmDayBookObj = frmDayBook; decPDCClearanceEditId = decMasterId; PDCClearanceMasterSP spPDCClearance = new PDCClearanceMasterSP(); decMasterIdEdit = spPDCClearance.PDCClearanceAgainstIdUnderClearanceId(decPDCClearanceEditId); FillFunction(); } catch (Exception ex) { MessageBox.Show("PC22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Ledger Posting Function, here saving the curresponding details into the ledger /// </summary> public void LedgerPostingAdd() { try { string strstatus = cmbStatus.Text.ToString(); LedgerPostingInfo InfoPosting = new LedgerPostingInfo(); LedgerPostingSP SpLedgerPosting = new LedgerPostingSP(); AccountLedgerSP SpLedger = new AccountLedgerSP(); LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); PDCPayableMasterInfo infoPDCPayable = new PDCPayableMasterInfo(); PDCPayableMasterSP spPDCPayable = new PDCPayableMasterSP(); PDCReceivableMasterInfo infoPDCReceivable = new PDCReceivableMasterInfo(); PDCReceivableMasterSP spPDCReceivable = new PDCReceivableMasterSP(); strVoucherType = sppdcClearance.TypeOfVoucherReturnUnderVoucherName(cmbvouchertype.Text.ToString()); if (strVoucherType == "PDC Payable") { infoPDCPayable = spPDCPayable.PDCPayableMasterView(Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString())); infoLedgerPosting.VoucherNo = strVoucherNo; infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim(); infoLedgerPosting.Date = Convert.ToDateTime(txtVoucherDate.Text.ToString()); infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId; infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text.ToString()); infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim(); infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; if (strstatus == "Cleared") { infoLedgerPosting.LedgerId = infoPDCPayable.BankId; infoLedgerPosting.Debit = 0; infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString()); } else if (strstatus == "Bounced") { infoLedgerPosting.LedgerId = infoPDCPayable.LedgerId; infoLedgerPosting.Debit = 0; infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString()); } SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting); infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId; infoLedgerPosting.VoucherNo = txtvoucherNo.Text.Trim(); infoLedgerPosting.Date = Convert.ToDateTime(txtVoucherDate.Text.ToString()); infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text); infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim(); infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; infoLedgerPosting.VoucherNo = strVoucherNo; infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim(); infoLedgerPosting.LedgerId = 6; infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString()); infoLedgerPosting.Credit = 0; SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } else if (strVoucherType == "PDC Receivable") { infoPDCReceivable = spPDCReceivable.PDCReceivableMasterView(Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString())); infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId; infoLedgerPosting.VoucherNo = strVoucherNo; infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim(); infoLedgerPosting.Date = PublicVariables._dtCurrentDate; infoLedgerPosting.LedgerId = 7; infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.Debit = 0; infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString()); infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text.ToString()); infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim(); infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting); infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId; infoLedgerPosting.Date = PublicVariables._dtCurrentDate; if (strstatus == "Cleared") { infoLedgerPosting.LedgerId = infoPDCReceivable.BankId; } else if (strstatus == "Bounced") { infoLedgerPosting.LedgerId = infoPDCReceivable.LedgerId; } infoLedgerPosting.VoucherNo = strVoucherNo; infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim(); infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString()); infoLedgerPosting.Credit = 0; infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text); infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim(); infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } } catch (Exception ex) { MessageBox.Show("PC12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Save Function /// </summary> public void SaveFunction() { try { DateValidation Objdatevalidation = new DateValidation(); OtherDateValidationFunction ObjotherdateValidation = new OtherDateValidationFunction(); Objdatevalidation.DateValidationFunction(txtVoucherDate); AccountLedgerSP SpAccountLedger = new AccountLedgerSP(); SettingsSP spSettings = new SettingsSP(); txtVoucherDate.Text = txtVoucherDate.Text.Trim(); cmbvouchertype.Text = cmbvouchertype.Text.Trim(); txtAmount.Text = txtAmount.Text.Trim(); txtBank.Text = txtBank.Text.Trim(); txtcheckdate.Text = txtcheckdate.Text.Trim(); txtcheckNo.Text = txtcheckNo.Text.Trim(); txtNarration.Text = txtNarration.Text.Trim(); DataTable dtblMaster = new DataTable(); PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP(); PDCClearanceMasterInfo infoPdcclearance = new PDCClearanceMasterInfo(); infoPdcclearance.SuffixPrefixId = decSufixprefixPdcpayableID; infoPdcclearance.FinancialYearId = Convert.ToDecimal(PublicVariables._decCurrentFinancialYearId.ToString()); infoPdcclearance.VoucherNo = strVoucherNo; infoPdcclearance.InvoiceNo = txtvoucherNo.Text; if (txtVoucherDate.Text != string.Empty) infoPdcclearance.Date = Convert.ToDateTime(txtVoucherDate.Text); else infoPdcclearance.Date = DateTime.Now; infoPdcclearance.LedgerId = decimal.Parse(strledgerId.ToString()); infoPdcclearance.AgainstId = decmasterId; infoPdcclearance.UserId = PublicVariables._decCurrentUserId; infoPdcclearance.VoucherTypeId = decPDCclearanceVoucherTypeId; infoPdcclearance.Status = cmbStatus.Text.ToString(); infoPdcclearance.Type = cmbvouchertype.Text.ToString(); infoPdcclearance.ExtraDate = DateTime.Now; infoPdcclearance.Narration = txtNarration.Text; infoPdcclearance.Extra1 = string.Empty; infoPdcclearance.Extra2 = string.Empty; if (!isInEditMode) { decimal decIdentity = sppdcClearance.PDCClearanceMasterAdd(infoPdcclearance); LedgerPostingAdd(); if (cmbStatus.Text.ToString() == "Bounced") { if (SpAccountLedger.AccountGroupIdCheck(txtAccountLedger.Text.ToString())) { PartyBalanceAddOrEdit(); } } Messages.SavedMessage(); if (cbxPrint.Checked) { if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decIdentity); } else { Print(decIdentity); } } ClearFunction(); } else { decimal decIdentity = decPDCClearanceEditId; infoPdcclearance.PDCClearanceMasterId = decPDCClearanceEditId; sppdcClearance.PDCClearanceMasterEdit(infoPdcclearance); SpAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(strVoucherNo, decPDCclearanceVoucherTypeId); LedgerPostingAdd(); SpAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(strVoucherNo, decPDCclearanceVoucherTypeId); if (cmbStatus.Text.ToString() == "Bounced") { if (SpAccountLedger.AccountGroupIdCheck(txtAccountLedger.Text.ToString())) { PartyBalanceAddOrEdit(); } } Messages.UpdatedMessage(); if (cbxPrint.Checked) { if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decIdentity); } else { Print(decIdentity); } } this.Close(); } } catch (Exception ex) { MessageBox.Show("PC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// print button click, call the print function /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (DGVClraranceReport.RowCount > 0) { PDCClearanceMasterSP SPPdcClearance = new PDCClearanceMasterSP(); DataSet dsPDCClearance = new DataSet(); dsPDCClearance = SPPdcClearance.PDCClearanceReportPrinting(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbAccountLedger.Text.ToString(), cmbVoucherType.Text.ToString(), txtVoucherNo.Text.ToString(), 1); frmReport frmreport = new frmReport(); frmreport.MdiParent = formMDI.MDIObj; frmreport.PDCClearanceReportPrinting(dsPDCClearance); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PCREP12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }