/// <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> /// Fill function to updation /// </summary> public void FillFunction() { try { PDCReceivableMasterSP sppdcreceivable = new PDCReceivableMasterSP(); PDCReceivableMasterInfo infopdcrecivable = new PDCReceivableMasterInfo(); infopdcrecivable = sppdcreceivable.PDCReceivableMasterView(decPDCReceivableEditId); txtVoucherNo.ReadOnly = false; strVoucherNo = infopdcrecivable.VoucherNo; strInvoiceNo = infopdcrecivable.InvoiceNo; txtVoucherNo.Text = strInvoiceNo; decSufixprefixPdcReceivableID = infopdcrecivable.SuffixPrefixId; decPDCReceivableVoucherTypeId = infopdcrecivable.VoucherTypeId; VoucherTypeSP spVoucherType = new VoucherTypeSP(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPDCReceivableVoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; lblVoucherNoManualValidator.Visible = false; } if (infopdcrecivable.PdcReceivableMasterId != 0) { txtVoucherNo.Text = infopdcrecivable.InvoiceNo; dtpVoucherDate.Value = infopdcrecivable.Date; txtVoucherDate.Text = dtpVoucherDate.Value.ToString("dd-MMM-yyyy"); txtNarration.Text = infopdcrecivable.Narration; cmbAccountLedger.SelectedValue = infopdcrecivable.LedgerId; txtAmount.Text = infopdcrecivable.Amount.ToString(); if (infopdcrecivable.BankId != 0) cmbBank.SelectedValue = infopdcrecivable.BankId; else cmbBank.SelectedValue = string.Empty; txtcheckNo.Text = infopdcrecivable.ChequeNo; txtCheckDate.Text = infopdcrecivable.ChequeDate.ToString("dd-MMM-yyyy"); btnSave.Text = "Update"; PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); DataTable dtbl1 = new DataTable(); dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPDCReceivableVoucherTypeId, strVoucherNo, infopdcrecivable.Date); dtblPartyBalance = dtbl1; } } catch (Exception ex) { MessageBox.Show("PP24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }