/// <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(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo(); PDCClearanceBll BllPdcClearance = new PDCClearanceBll(); PDCPayableMasterInfo infoPDCPayable = new PDCPayableMasterInfo(); PDCPayableBll BllPDCPayable = new PDCPayableBll(); PDCReceivableMasterInfo infoPDCReceivable = new PDCReceivableMasterInfo(); PDCRecivebleBll BllPDCReciveble = new PDCRecivebleBll(); strVoucherType = BllPdcClearance.TypeOfVoucherReturnUnderVoucherName(cmbvouchertype.Text.ToString()); if (strVoucherType == "PDC Payable") { infoPDCPayable = BllPDCPayable.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()); } BllLedgerPosting.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; BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } else if (strVoucherType == "PDC Receivable") { infoPDCReceivable = BllPDCReciveble.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; BllLedgerPosting.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; BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } } catch (Exception ex) { MessageBox.Show("PC12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill function for updation /// </summary> public void FillFunction() { try { PDCPayableMasterInfo infopdcpayable = new PDCPayableMasterInfo(); PDCPayableBll BllPdcPayable = new PDCPayableBll(); infopdcpayable = BllPdcPayable.PDCPayableMasterView(decPDCpayableEditId); txtvoucherNo.ReadOnly = false; strVoucherNo = infopdcpayable.VoucherNo; strInvoiceNo = infopdcpayable.InvoiceNo; txtvoucherNo.Text = strInvoiceNo; decSufixprefixPdcpayableID = infopdcpayable.SuffixPrefixId; decPDCpayableVoucherTypeId = infopdcpayable.VoucherTypeId; VoucherTypeBll BllVOucherType = new VoucherTypeBll(); isAutomatic = BllVOucherType.CheckMethodOfVoucherNumbering(decPDCpayableVoucherTypeId); if (isAutomatic) { txtvoucherNo.ReadOnly = true; } else { txtvoucherNo.ReadOnly = false; } if (infopdcpayable.PdcPayableMasterId != 0) { txtvoucherNo.Text = infopdcpayable.InvoiceNo; dtpVoucherDate.Value = infopdcpayable.Date; txtVoucherDate.Text = dtpVoucherDate.Value.ToString("dd-MMM-yyyy"); txtNarration.Text = infopdcpayable.Narration; cmbAccountLedger.SelectedValue = infopdcpayable.LedgerId; txtAmount.Text = infopdcpayable.Amount.ToString(); if (infopdcpayable.BankId != 0) cmbBank.SelectedValue = infopdcpayable.BankId; else cmbBank.SelectedValue = string.Empty; txtcheckNo.Text = infopdcpayable.ChequeNo; txtChequeDate.Text = infopdcpayable.ChequeDate.ToString("dd-MMM-yyyy"); btnSave.Text = "Update"; PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); List<DataTable> listObj = new List<DataTable>(); listObj = BllPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPDCpayableVoucherTypeId, strVoucherNo, infopdcpayable.Date); dtblPartyBalance = listObj[0]; } } catch (Exception ex) { MessageBox.Show("PP22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }