/// <summary> /// Function to Update values in ReceiptMaster Table /// </summary> /// <param name="receiptmasterinfo"></param> /// <returns></returns> public decimal ReceiptMasterEdit(ReceiptMasterInfo receiptmasterinfo) { decimal decRecieptMasterId = 0; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ReceiptMasterEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal); sprmparam.Value = receiptmasterinfo.ReceiptMasterId; sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam.Value = receiptmasterinfo.VoucherNo; sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam.Value = receiptmasterinfo.InvoiceNo; sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = receiptmasterinfo.SuffixPrefixId; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = receiptmasterinfo.Date; sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam.Value = receiptmasterinfo.LedgerId; sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal); sprmparam.Value = receiptmasterinfo.TotalAmount; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = receiptmasterinfo.Narration; sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = receiptmasterinfo.VoucherTypeId; sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal); sprmparam.Value = receiptmasterinfo.UserId; sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = receiptmasterinfo.FinancialYearId; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = receiptmasterinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = receiptmasterinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = receiptmasterinfo.Extra2; decRecieptMasterId = Convert.ToDecimal(sccmd.ExecuteNonQuery().ToString()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return(decRecieptMasterId); }
public decimal ReceiptMasterEdit(ReceiptMasterInfo receiptmasterinfo) { decimal decResult = 0; try { decResult = spReceiptMaster.ReceiptMasterEdit(receiptmasterinfo); } catch (Exception) { throw; } return(decResult); }
public ReceiptMasterInfo ReceiptMasterViewByMasterId(decimal decReceiptMastertId) { ReceiptMasterInfo infoReceiptMaster = new ReceiptMasterInfo(); try { ReceiptMasterSP spReceiptMaster = new ReceiptMasterSP(); infoReceiptMaster = spReceiptMaster.ReceiptMasterViewByMasterId(decReceiptMastertId); } catch (Exception ex) { MessageBox.Show("RD11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(infoReceiptMaster); }
public decimal ReceiptMasterEdit(ReceiptMasterInfo receiptmasterinfo) { decimal decRecieptMasterId = 0; try { ReceiptMasterSP spReceiptMaster = new ReceiptMasterSP(); decRecieptMasterId = spReceiptMaster.ReceiptMasterEdit(receiptmasterinfo); } catch (Exception ex) { MessageBox.Show("RD8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(decRecieptMasterId); }
/// <summary> /// Function to get particular values from ReceiptMaster table based on the parameter /// </summary> /// <param name="receiptMasterId"></param> /// <returns></returns> public ReceiptMasterInfo ReceiptMasterView(decimal receiptMasterId) { ReceiptMasterInfo receiptmasterinfo = new ReceiptMasterInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ReceiptMasterView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal); sprmparam.Value = receiptMasterId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { receiptmasterinfo.ReceiptMasterId = decimal.Parse(sdrreader[0].ToString()); receiptmasterinfo.VoucherNo = sdrreader[1].ToString(); receiptmasterinfo.InvoiceNo = sdrreader[2].ToString(); receiptmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString()); receiptmasterinfo.Date = DateTime.Parse(sdrreader[4].ToString()); receiptmasterinfo.LedgerId = decimal.Parse(sdrreader[5].ToString()); receiptmasterinfo.TotalAmount = decimal.Parse(sdrreader[6].ToString()); receiptmasterinfo.Narration = sdrreader[7].ToString(); receiptmasterinfo.VoucherTypeId = decimal.Parse(sdrreader[8].ToString()); receiptmasterinfo.UserId = decimal.Parse(sdrreader[9].ToString()); receiptmasterinfo.FinancialYearId = decimal.Parse(sdrreader[10].ToString()); receiptmasterinfo.ExtraDate = DateTime.Parse(sdrreader[11].ToString()); receiptmasterinfo.Extra1 = sdrreader[12].ToString(); receiptmasterinfo.Extra2 = sdrreader[13].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(receiptmasterinfo); }
/// <summary> /// Function to get particular values from eceiptMaster table based on the parameter /// </summary> /// <param name="decReceiptMastertId"></param> /// <returns></returns> public ReceiptMasterInfo ReceiptMasterViewByMasterId(decimal decReceiptMastertId) { ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ReceiptMasterViewByMasterId", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal); sprmparam.Value = decReceiptMastertId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { InfoReceiptMaster.VoucherNo = sdrreader["voucherNo"].ToString(); InfoReceiptMaster.InvoiceNo = sdrreader["invoiceNo"].ToString(); InfoReceiptMaster.SuffixPrefixId = decimal.Parse(sdrreader["suffixprefixId"].ToString()); InfoReceiptMaster.Date = DateTime.Parse(sdrreader["date"].ToString()); InfoReceiptMaster.LedgerId = decimal.Parse(sdrreader["ledgerId"].ToString()); InfoReceiptMaster.TotalAmount = decimal.Parse(sdrreader["totalAmount"].ToString()); InfoReceiptMaster.Narration = sdrreader["narration"].ToString(); InfoReceiptMaster.VoucherTypeId = decimal.Parse(sdrreader["voucherTypeId"].ToString()); InfoReceiptMaster.UserId = decimal.Parse(sdrreader["userId"].ToString()); InfoReceiptMaster.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(InfoReceiptMaster); }
/// <summary> /// Function to fill datagridview /// </summary> public void gridfill() { try { ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP(); ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo(); DataTable dtbl = new DataTable(); if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView") { if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty) { dtbl = SpReceiptMaster.ReceiptMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text); dgvReceiptRegister.DataSource = dtbl; } } } catch (Exception ex) { MessageBox.Show("RR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Edit function /// </summary> /// <param name="decMasterId"></param> public void Edit(decimal decMasterId) { try { int inRowCount = dgvReceiptVoucher.RowCount; int inTableRowCount = dtblPartyBalance.Rows.Count; int inB = 0; ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo(); ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo(); RecieptVoucherBll bllRecieptVoucher = new RecieptVoucherBll(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); LedgerPostingInfo InfoLegerPosting = new LedgerPostingInfo(); PartyBalanceInfo InfopartyBalance = new PartyBalanceInfo(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); BankReconciliationBll BllBankReconciliation = new BankReconciliationBll(); InfoReceiptMaster.Date = dtpDate.Value; InfoReceiptMaster.ReceiptMasterId = decMasterId; InfoReceiptMaster.Extra1 = string.Empty; InfoReceiptMaster.Extra2 = string.Empty; InfoReceiptMaster.ExtraDate = DateTime.Now; InfoReceiptMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; InfoReceiptMaster.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString()); InfoReceiptMaster.Narration = txtNarration.Text.Trim(); decimal decTotalAmount = TotalAmountCalculation(); InfoReceiptMaster.TotalAmount = decTotalAmount; InfoReceiptMaster.UserId = PublicVariables._decCurrentUserId; if (!isAutomatic) { InfoReceiptMaster.VoucherNo = txtVoucherNo.Text.Trim(); InfoReceiptMaster.InvoiceNo = txtVoucherNo.Text.Trim(); InfoReceiptMaster.SuffixPrefixId = 0; } else { InfoReceiptMaster.VoucherNo = strVoucherNo; InfoReceiptMaster.InvoiceNo = strInvoiceNo; InfoReceiptMaster.SuffixPrefixId = decDailySuffixPrefixId; } InfoReceiptMaster.VoucherTypeId = decReceiptVoucherTypeId; decimal decEffectRow = bllRecieptVoucher.ReceiptMasterEdit(InfoReceiptMaster); if (decEffectRow != 0) { MasterLedgerPostingEdit(); } foreach (object obj in arrlstOfRemove) { string str = Convert.ToString(obj); bllRecieptVoucher.ReceiptDetailsDelete(Convert.ToDecimal(str)); BllLedgerPosting.LedgerPostDeleteByDetailsId(Convert.ToDecimal(str), strVoucherNo, decReceiptVoucherTypeId); } decimal decReceiptDetailsId1 = 0; BllLedgerPosting.LedgerPostingDeleteByVoucherNoVoucherTypeIdAndLedgerId(strVoucherNo, decReceiptVoucherTypeId, 12); for (int inI = 0; inI < inRowCount - 1; inI++) { InfoReceiptDetails.Amount = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value.ToString()); InfoReceiptDetails.ExchangeRateId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value.ToString()); InfoReceiptDetails.Extra1 = string.Empty; InfoReceiptDetails.Extra2 = string.Empty; InfoReceiptDetails.ReceiptMasterId = InfoReceiptMaster.ReceiptMasterId; if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty) { InfoReceiptDetails.LedgerId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString()); } if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty) { InfoReceiptDetails.ChequeNo = dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString(); if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value.ToString() != string.Empty) { InfoReceiptDetails.ChequeDate = Convert.ToDateTime(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value); } else { InfoReceiptDetails.ChequeDate = DateTime.Now; } } else { InfoReceiptDetails.ChequeNo = string.Empty; InfoReceiptDetails.ChequeDate = DateTime.Now; } if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtReceiptDetailsId"].Value == null || dgvReceiptVoucher.Rows[inI].Cells["dgvtxtReceiptDetailsId"].Value.ToString() == string.Empty)//if new rows are added { if (dgvReceiptVoucher.Rows[inI].HeaderCell.Value.ToString() != "X") { decimal decReceiptDetailsId = bllRecieptVoucher .ReceiptDetailsAdd(InfoReceiptDetails); if (decReceiptDetailsId != 0) { for (int inJ = 0; inJ < inTableRowCount; inJ++) { if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString()) { PartyBalanceAddOrEdit(inJ); } } inB++; DetailsLedgerPosting(inI, decReceiptDetailsId); } } } else { if (dgvReceiptVoucher.Rows[inI].HeaderCell.Value.ToString() != "X") { InfoReceiptDetails.ReceiptDetailsId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value.ToString()); decimal decReceiptDetailsId = bllRecieptVoucher.ReceiptDetailsEdit(InfoReceiptDetails); if (decReceiptDetailsId != 0) { for (int inJ = 0; inJ < inTableRowCount; inJ++) { if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString()) { PartyBalanceAddOrEdit(inJ); } } inB++; decReceiptDetailsId = InfoReceiptDetails.ReceiptDetailsId; decimal decLedgerPostId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value.ToString()); DetailsLedgerPostingEdit(inI, decLedgerPostId, decReceiptDetailsId1); } } else { decimal decDetailsId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value.ToString()); bllRecieptVoucher.ReceiptDetailsDelete(decDetailsId); BllLedgerPosting.LedgerPostDeleteByDetailsId(decDetailsId, strVoucherNo, decReceiptVoucherTypeId); for (int inJ = 0; inJ < dtblPartyBalance.Rows.Count; inJ++) { if (dtblPartyBalance.Rows.Count == inJ) { break; } if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty) { if (dtblPartyBalance.Rows[inJ]["LedgerId"].ToString() == dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString()) { if (dtblPartyBalance.Rows[inJ]["PartyBalanceId"].ToString() != "0") { arrlstOfDeletedPartyBalanceRow.Add(dtblPartyBalance.Rows[inJ]["PartyBalanceId"]); } } } } } } } DeletePartyBalanceOfRemovedRow(); isUpdated = true; Messages.UpdatedMessage(); if (cbxPrintafterSave.Checked) { if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(InfoReceiptMaster.ReceiptMasterId); } else { Print(InfoReceiptMaster.ReceiptMasterId); } } if (frmReceiptRegisterObj != null) { this.Close(); frmReceiptRegisterObj.CallFromReceiptVoucher(this); } if (frmReceiptReportObj != null) { this.Close(); frmReceiptReportObj.CallFromReceiptVoucher(this); } if (frmDayBookObj != null) { this.Close(); } if (frmBillallocationObj != null) { this.Close(); } } catch (Exception ex) { MessageBox.Show("RV13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Save function /// </summary> public void Save() { try { int inGridRowCount = dgvReceiptVoucher.RowCount; int inTableRowCount = dtblPartyBalance.Rows.Count; int inB = 0; ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo(); RecieptVoucherBll bllRecieptVoucher=new RecieptVoucherBll(); // ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP(); ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); PartyBalanceInfo InfopartyBalance = new PartyBalanceInfo(); InfoReceiptMaster.Date = dtpDate.Value; InfoReceiptMaster.Extra1 = string.Empty; InfoReceiptMaster.Extra2 = string.Empty; InfoReceiptMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; InfoReceiptMaster.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString()); InfoReceiptMaster.Narration = txtNarration.Text; decimal decTotalAmount = TotalAmountCalculation(); InfoReceiptMaster.TotalAmount = decTotalAmount; InfoReceiptMaster.UserId = PublicVariables._decCurrentUserId; if (!isAutomatic) { InfoReceiptMaster.VoucherNo = txtVoucherNo.Text.Trim(); InfoReceiptMaster.InvoiceNo = txtVoucherNo.Text.Trim(); InfoReceiptMaster.SuffixPrefixId = 0; } else { InfoReceiptMaster.VoucherNo = strVoucherNo; InfoReceiptMaster.InvoiceNo = strInvoiceNo; InfoReceiptMaster.SuffixPrefixId = decDailySuffixPrefixId; } InfoReceiptMaster.VoucherTypeId = decReceiptVoucherTypeId; decimal decReceiptMasterId = bllRecieptVoucher.ReceiptMasterAdd(InfoReceiptMaster); if (decReceiptMasterId != 0) { MasterLedgerPosting(); } for (int inI = 0; inI < inGridRowCount - 1; inI++) { if (dgvReceiptVoucher.Rows[inI].HeaderCell.Value.ToString() != "X") { InfoReceiptDetails.Amount = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value.ToString()); InfoReceiptDetails.ExchangeRateId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value.ToString()); InfoReceiptDetails.Extra1 = string.Empty; InfoReceiptDetails.Extra2 = string.Empty; InfoReceiptDetails.LedgerId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString()); InfoReceiptDetails.ReceiptMasterId = decReceiptMasterId; if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty) { InfoReceiptDetails.LedgerId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString()); } if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty) { InfoReceiptDetails.ChequeNo = dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString(); if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value.ToString() != string.Empty) { InfoReceiptDetails.ChequeDate = Convert.ToDateTime(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value); } else { InfoReceiptDetails.ChequeDate = DateTime.Now; } } else { InfoReceiptDetails.ChequeNo = string.Empty; InfoReceiptDetails.ChequeDate = DateTime.Now; } decimal decReceiptDetailsId = bllRecieptVoucher.ReceiptDetailsAdd(InfoReceiptDetails); if (decReceiptDetailsId != 0) { for (int inJ = 0; inJ < inTableRowCount; inJ++) { if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString()) { PartyBalanceAddOrEdit(inJ); } } inB++; DetailsLedgerPosting(inI, decReceiptDetailsId); } } } Messages.SavedMessage(); if (cbxPrintafterSave.Checked) { if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decReceiptMasterId); } else { Print(decReceiptMasterId); } } Clear(); } catch (Exception ex) { MessageBox.Show("RV12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill function for updation /// </summary> public void FillFunction() { try { isValueChange = false; ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo(); ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo(); RecieptVoucherBll bllRecieptVoucherBll = new RecieptVoucherBll(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); AccountGroupBll BllAccountGroup = new AccountGroupBll(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); InfoReceiptMaster = bllRecieptVoucherBll.ReceiptMasterViewByMasterId(decRecieptmasterId); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(InfoReceiptMaster.VoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; txtVoucherNo.Text = InfoReceiptMaster.InvoiceNo; } else { txtVoucherNo.ReadOnly = false; txtVoucherNo.Text = InfoReceiptMaster.VoucherNo; } dtpDate.Value = InfoReceiptMaster.Date; cmbCashOrBank.SelectedValue = InfoReceiptMaster.LedgerId; txtNarration.Text = InfoReceiptMaster.Narration; txtTotal.Text = InfoReceiptMaster.TotalAmount.ToString(); decDailySuffixPrefixId = InfoReceiptMaster.SuffixPrefixId; decReceiptVoucherTypeId = InfoReceiptMaster.VoucherTypeId; strVoucherNo = InfoReceiptMaster.VoucherNo; strInvoiceNo = InfoReceiptMaster.InvoiceNo; List<DataTable> listobj = new List<DataTable>(); listobj = bllRecieptVoucherBll.ReceiptDetailsViewByMasterId(decRecieptmasterId); for (int inI = 0; inI < listobj[0].Rows.Count; inI++) { dgvReceiptVoucher.Rows.Add(); dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(listobj[0].Rows[inI]["ledgerId"].ToString()); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptMasterId"].Value = listobj[0].Rows[inI]["receiptMasterId"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value = listobj[0].Rows[inI]["receiptDetailsId"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = listobj[0].Rows[inI]["amount"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(listobj[0].Rows[inI]["exchangeRateId"].ToString()); decimal decDetailsId1 = Convert.ToDecimal(listobj[0].Rows[inI]["receiptDetailsId"].ToString()); decimal decLedgerPostingId = BllLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decReceiptVoucherTypeId); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); decimal decLedgerId = Convert.ToDecimal(listobj[0].Rows[inI]["ledgerId"].ToString()); bool IsBankAccount = BllAccountGroup.AccountGroupwithLedgerId(decLedgerId); decimal decI = Convert.ToDecimal(bllAccountLedger.AccountGroupIdCheck(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].FormattedValue.ToString())); if (decI > 0) { dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = true; dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = true; } else { dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = false; dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = false; } if (listobj[0].Rows[inI]["chequeNo"].ToString() != string.Empty) { dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = listobj[0].Rows[inI]["chequeNo"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(listobj[0].Rows[inI]["chequeDate"].ToString()).ToString("dd-MMM-yyyy"); } dgvReceiptVoucher.Rows[inI].HeaderCell.Value = string.Empty; } List<DataTable> listObj = new List<DataTable>(); listObj = BllPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decReceiptVoucherTypeId, strVoucherNo, InfoReceiptMaster.Date); dtblPartyBalance = listObj[0]; isValueChange = true; } catch (Exception ex) { MessageBox.Show("RV34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }