public decimal PDCPayableMasterAdd(PDCPayableMasterInfo pdcpayablemasterinfo) { decimal decIdentity = 0m; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PDCPayableMasterAdd", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam16 = new SqlParameter(); sprmparam16 = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam16.Value = pdcpayablemasterinfo.VoucherNo; sprmparam16 = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam16.Value = pdcpayablemasterinfo.InvoiceNo; sprmparam16 = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam16.Value = pdcpayablemasterinfo.SuffixPrefixId; sprmparam16 = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam16.Value = pdcpayablemasterinfo.Date; sprmparam16 = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam16.Value = pdcpayablemasterinfo.LedgerId; sprmparam16 = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam16.Value = pdcpayablemasterinfo.Amount; sprmparam16 = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar); sprmparam16.Value = pdcpayablemasterinfo.ChequeNo; sprmparam16 = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime); sprmparam16.Value = pdcpayablemasterinfo.ChequeDate; sprmparam16 = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam16.Value = pdcpayablemasterinfo.Narration; sprmparam16 = sccmd.Parameters.Add("@userId", SqlDbType.Decimal); sprmparam16.Value = pdcpayablemasterinfo.UserId; sprmparam16 = sccmd.Parameters.Add("@bankId", SqlDbType.Decimal); sprmparam16.Value = pdcpayablemasterinfo.BankId; sprmparam16 = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam16.Value = pdcpayablemasterinfo.VoucherTypeId; sprmparam16 = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam16.Value = pdcpayablemasterinfo.FinancialYearId; sprmparam16 = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam16.Value = pdcpayablemasterinfo.Extra1; sprmparam16 = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam16.Value = pdcpayablemasterinfo.Extra2; decIdentity = Convert.ToDecimal(sccmd.ExecuteScalar().ToString()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } return(decIdentity); }
/// <summary> /// Function to Update values in PDCPayableMaster Table /// </summary> /// <param name="pdcpayablemasterinfo"></param> public void PDCPayableMasterEdit(PDCPayableMasterInfo pdcpayablemasterinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PDCPayableMasterEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@pdcPayableMasterId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.PdcPayableMasterId; sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.VoucherNo; sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.InvoiceNo; sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.SuffixPrefixId; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = pdcpayablemasterinfo.Date; sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.LedgerId; sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.Amount; sprmparam = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.ChequeNo; sprmparam = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime); sprmparam.Value = pdcpayablemasterinfo.ChequeDate; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.Narration; sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.UserId; sprmparam = sccmd.Parameters.Add("@bankId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.BankId; sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.VoucherTypeId; sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.FinancialYearId; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to Update values in PDCPayableMaster Table /// </summary> /// <param name="pdcpayablemasterinfo"></param> public void PDCPayableMasterEdit(PDCPayableMasterInfo pdcpayablemasterinfo) { try { spPdcPayableMaster.PDCPayableMasterEdit(pdcpayablemasterinfo); } catch (Exception ex) { MessageBox.Show("PDCP4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to insert values to PDCPayableMaster Table /// </summary> /// <param name="pdcpayablemasterinfo"></param> /// <returns></returns> public decimal PDCPayableMasterAdd(PDCPayableMasterInfo pdcpayablemasterinfo) { decimal decIdentity = 0; try { decIdentity = spPdcPayableMaster.PDCPayableMasterAdd(pdcpayablemasterinfo); } catch (Exception ex) { MessageBox.Show("PDCP3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(decIdentity); }
/// <summary> /// Function to get particular values from PDCPayableMaster table based on the parameter /// </summary> /// <param name="pdcPayableMasterId"></param> /// <returns></returns> public PDCPayableMasterInfo PDCPayableMasterView(decimal pdcPayableMasterId) { PDCPayableMasterInfo pdcpayablemasterinfo = new PDCPayableMasterInfo(); try { pdcpayablemasterinfo = spPdcPayableMaster.PDCPayableMasterView(pdcPayableMasterId); } catch (Exception ex) { MessageBox.Show("PDCP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(pdcpayablemasterinfo); }
public PDCPayableMasterInfo PDCPayableMasterView(decimal pdcPayableMasterId) { PDCPayableMasterInfo pdcpayablemasterinfo = new PDCPayableMasterInfo(); SqlDataReader sdrreader = null; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PDCPayableMasterView", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam2 = new SqlParameter(); sprmparam2 = sccmd.Parameters.Add("@pdcPayableMasterId", SqlDbType.Decimal); sprmparam2.Value = pdcPayableMasterId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { pdcpayablemasterinfo.PdcPayableMasterId = decimal.Parse(((DbDataReader)sdrreader)[0].ToString()); pdcpayablemasterinfo.VoucherNo = ((DbDataReader)sdrreader)[1].ToString(); pdcpayablemasterinfo.InvoiceNo = ((DbDataReader)sdrreader)[2].ToString(); pdcpayablemasterinfo.SuffixPrefixId = decimal.Parse(((DbDataReader)sdrreader)[3].ToString()); pdcpayablemasterinfo.Date = DateTime.Parse(((DbDataReader)sdrreader)[4].ToString()); pdcpayablemasterinfo.LedgerId = decimal.Parse(((DbDataReader)sdrreader)[5].ToString()); pdcpayablemasterinfo.Amount = decimal.Parse(((DbDataReader)sdrreader)[6].ToString()); pdcpayablemasterinfo.ChequeNo = ((DbDataReader)sdrreader)[7].ToString(); pdcpayablemasterinfo.ChequeDate = DateTime.Parse(((DbDataReader)sdrreader)[8].ToString()); pdcpayablemasterinfo.Narration = ((DbDataReader)sdrreader)[9].ToString(); pdcpayablemasterinfo.UserId = decimal.Parse(((DbDataReader)sdrreader)[10].ToString()); pdcpayablemasterinfo.BankId = decimal.Parse(((DbDataReader)sdrreader)[11].ToString()); pdcpayablemasterinfo.VoucherTypeId = decimal.Parse(((DbDataReader)sdrreader)[12].ToString()); pdcpayablemasterinfo.FinancialYearId = decimal.Parse(((DbDataReader)sdrreader)[13].ToString()); pdcpayablemasterinfo.ExtraDate = DateTime.Parse(((DbDataReader)sdrreader)[14].ToString()); pdcpayablemasterinfo.Extra1 = ((DbDataReader)sdrreader)[15].ToString(); pdcpayablemasterinfo.Extra2 = ((DbDataReader)sdrreader)[16].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); base.sqlcon.Close(); } return(pdcpayablemasterinfo); }
/// <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); } }
/// <summary> /// Save function /// </summary> public void SaveFunction() { try { SettingsBll BllSettings = new SettingsBll(); DateValidation Objdatevalidation = new DateValidation(); OtherDateValidationFunction ObjotherdateValidation = new OtherDateValidationFunction(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); Objdatevalidation.DateValidationFunction(txtVoucherDate); ObjotherdateValidation.DateValidationFunction(txtChequeDate, false); DataTable dtblMaster = new DataTable(); PDCPayableMasterInfo InfoPayable = new PDCPayableMasterInfo(); PDCPayableBll BllPdcpayable = new PDCPayableBll(); InfoPayable.VoucherNo = strVoucherNo; InfoPayable.InvoiceNo = txtvoucherNo.Text.Trim(); InfoPayable.Date = DateTime.Parse(txtVoucherDate.Text); InfoPayable.LedgerId = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString()); InfoPayable.Amount = decimal.Parse(txtAmount.Text); InfoPayable.Narration = txtNarration.Text; InfoPayable.ChequeNo = txtcheckNo.Text; if (txtChequeDate.Text != string.Empty) InfoPayable.ChequeDate = Convert.ToDateTime(txtChequeDate.Text); else InfoPayable.ChequeDate = DateTime.Now; InfoPayable.UserId = PublicVariables._decCurrentUserId; InfoPayable.VoucherTypeId = decPDCpayableVoucherTypeId; if (cmbBank.SelectedValue != null && cmbBank.SelectedValue.ToString() != string.Empty) { InfoPayable.BankId = Convert.ToDecimal(cmbBank.SelectedValue.ToString()); } else InfoPayable.ExtraDate = DateTime.Now; InfoPayable.Extra1 = string.Empty; InfoPayable.Extra2 = string.Empty; if (!isInEditMode) { decimal decIdentity = BllPdcpayable.PDCPayableMasterAdd(InfoPayable); LedgerPosting(); PartyBalanceAddOrEdit(); Messages.SavedMessage(); if (cbxPrint.Checked) { if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decIdentity); } else { Print(decIdentity); } } ClearFunction(); } else { decimal decIdentity = decPDCpayableEditId; InfoPayable.PdcPayableMasterId = decPDCpayableEditId; BllPdcpayable.PDCPayableMasterEdit(InfoPayable); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); BllLedgerPosting.LedgerPostingDeleteByVoucherNoVoucherTypeIdAndLedgerId(strVoucherNo, decPDCpayableVoucherTypeId, 12); BllPartyBalance.PartyBalanceDeleteByVoucherTypeAndVoucherNo(decPDCpayableVoucherTypeId, strVoucherNo); PartyBalanceAddOrEdit(); LedgerPostingEdit(decPDCpayableEditId); Messages.UpdatedMessage(); if (cbxPrint.Checked) { if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decIdentity); } else { Print(decIdentity); } } this.Close(); } } catch (Exception ex) { MessageBox.Show("PP7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }