/// <summary> /// Function to fill the fields for edit or delete /// </summary> public void FillFunction() { try { ServicesBll BllService = new ServicesBll(); //ServiceMasterSP spServiceMaster = new ServiceMasterSP(); ServiceMasterInfo infoServiceMaster = new ServiceMasterInfo(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo(); decServiceMasterId = decMasterId; infoServiceMaster = BllService.ServiceMasterView(decServiceMasterId); infoVoucherType = BllVoucherType.VoucherTypeView(infoServiceMaster.VoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(infoServiceMaster.VoucherTypeId); txtInvoiceNumber.ReadOnly = true; strVoucherNo = infoServiceMaster.VoucherNo.ToString(); txtInvoiceNumber.Text = infoServiceMaster.InvoiceNo; txtCreditPeriod.Text = infoServiceMaster.CreditPeriod.ToString(); strInvoiceNo = infoServiceMaster.InvoiceNo.ToString(); decServiceSuffixPrefixId = Convert.ToDecimal(infoServiceMaster.SuffixPrefixId.ToString()); DecServicetVoucherTypeId = Convert.ToDecimal(infoServiceMaster.VoucherTypeId.ToString()); int inDecimalPlace = PublicVariables._inNoOfDecimalPlaces; txtVoucherDate.Text = infoServiceMaster.Date.ToString("dd-MMM-yyyy"); dtpVoucherDate.Value = Convert.ToDateTime(infoServiceMaster.Date); cmbCashParty.SelectedValue = infoServiceMaster.LedgerId; cmbServiceAC.SelectedValue = infoServiceMaster.ServiceAccount; cmbSalesman.SelectedValue = infoServiceMaster.EmployeeId; txtCustomer.Text = infoServiceMaster.Customer; txtNarration.Text = infoServiceMaster.Narration; List<DataTable> listObjServiceDetails = new List<DataTable>(); listObjServiceDetails = BllService.ServiceDetailsViewWithMasterId(decServiceMasterId); for (int i = 0; i < listObjServiceDetails[0].Rows.Count; i++) { dgvServiceVoucher.Rows.Add(); dgvServiceVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceDetailsId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvtxtServiceMasterId"].Value = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceMasterId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value = listObjServiceDetails[0].Rows[i]["measure"].ToString(); dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value = listObjServiceDetails[0].Rows[i]["amount"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceDetailsId"].ToString()); decimal decLedgerPostingId = BllLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, DecServicetVoucherTypeId); dgvServiceVoucher.Rows[i].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); } cmbCurrency.SelectedValue = infoServiceMaster.ExchangeRateId; txtTotalAmount.Text = infoServiceMaster.TotalAmount.ToString(); txtDiscount.Text = infoServiceMaster.Discount.ToString(); txtGrandTotal.Text = infoServiceMaster.GrandTotal.ToString(); infoPartyBalance = BllPartyBalance.PartyBalanceViewByVoucherNoAndVoucherTypeId(DecServicetVoucherTypeId, strVoucherNo, infoServiceMaster.Date); decPartyBalanceId = infoPartyBalance.PartyBalanceId; } catch (Exception ex) { MessageBox.Show("SV 32 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill all the controlls while coming from other forms for update or delete /// </summary> public void FillFunction() { try { ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll(); ContraMasterInfo infoContraMaster = new ContraMasterInfo(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); VoucherTypeBll BllVOucherType = new VoucherTypeBll(); infoContraMaster = bllContraVoucherDetails.ContraMasterView(decMasterId); txtVoucherNo.ReadOnly = false; strVoucherNo = infoContraMaster.VoucherNo; txtVoucherNo.Text = infoContraMaster.InvoiceNo; strInvoiceNo = infoContraMaster.InvoiceNo; strInvoiceNo = infoContraMaster.InvoiceNo; decContraSuffixPrefixId = Convert.ToDecimal(infoContraMaster.SuffixPrefixId.ToString()); DecContraVoucherTypeId = Convert.ToDecimal(infoContraMaster.VoucherTypeId.ToString()); int inDecimalPlace = PublicVariables._inNoOfDecimalPlaces; txtNarration.Text = infoContraMaster.Narration; txtContraVoucherDate.Text = Convert.ToString(infoContraMaster.date); cmbBankAccount.SelectedValue = infoContraMaster.LedgerId; strVoucherNo = infoContraMaster.VoucherNo; if (infoContraMaster.Type == "Deposit") { rbtnDeposit.Checked = true; } else { rbtnWithdrawal.Checked = true; } isAutomatic = BllVOucherType.CheckMethodOfVoucherNumbering(DecContraVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } List<DataTable> listObj = new List<DataTable>(); listObj = bllContraVoucherDetails.ContraDetailsViewWithMasterId(decMasterId); for (int i = 0; i < listObj[0].Rows.Count; i++) { dgvContraVoucher.Rows.Add(); dgvContraVoucher.Rows[i].Cells["dgvcmbBankorCashAccount"].Value = Convert.ToDecimal(listObj[0].Rows[i]["ledgerId"].ToString()); dgvContraVoucher.Rows[i].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(listObj[0].Rows[i]["exchangeRateId"].ToString()); dgvContraVoucher.Rows[i].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(listObj[0].Rows[i]["amount"].ToString()); if (listObj[0].Rows[i]["chequeNo"].ToString() != string.Empty) { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeNo"].Value = listObj[0].Rows[i]["chequeNo"].ToString(); if (listObj[0].Rows[i]["chequeDate"].ToString() == "01 Jan 1753") { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeDate"].Value = null; } else { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeDate"].Value = listObj[0].Rows[i]["chequeDate"].ToString(); } } dgvContraVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value = listObj[0].Rows[i]["contraDetailsId"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(listObj[0].Rows[i]["contraDetailsId"].ToString()); decimal decLedgerPostingId = BllLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, DecContraVoucherTypeId); dgvContraVoucher.Rows[i].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); } } catch (Exception ex) { MessageBox.Show("CV:31" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the fields for edit or delete /// </summary> public void FillFunction() { try { JournalMasterInfo infoJournalMaster = new JournalMasterInfo(); JournalVoucherBll bllJournalMaster = new JournalVoucherBll(); infoJournalMaster = bllJournalMaster.JournalMasterView(decJournalMasterIdForEdit); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); infoVoucherType = BllVoucherType.VoucherTypeView(infoJournalMaster.VoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; txtVoucherNo.ReadOnly = false; strVoucherNo = infoJournalMaster.VoucherNo; strInvoiceNo = infoJournalMaster.InvoiceNo; txtVoucherNo.Text = strInvoiceNo; decJournalSuffixPrefixId = infoJournalMaster.SuffixPrefixId; decJournalVoucherTypeId = infoJournalMaster.VoucherTypeId; dtpVoucherDate.Value = infoJournalMaster.Date; txtNarration.Text = infoJournalMaster.Narration; isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decJournalVoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; } //GridFill List<DataTable> ListObj = new List<DataTable>(); JournalVoucherBll bllJournalDetailsSp = new JournalVoucherBll(); ListObj = bllJournalDetailsSp.JournalDetailsViewByMasterId(decJournalMasterIdForEdit); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); for (int inI = 0; inI < ListObj[0].Rows.Count; inI++) { dgvJournalVoucher.Rows.Add(); dgvJournalVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(ListObj[0].Rows[inI]["ledgerId"].ToString()); if (Convert.ToDecimal(ListObj[0].Rows[inI]["debit"].ToString()) == 0) { dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Cr"; dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(ListObj[0].Rows[inI]["credit"].ToString()); } else { dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Dr"; dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(ListObj[0].Rows[inI]["debit"].ToString()); } dgvJournalVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(ListObj[0].Rows[inI]["exchangeRateId"].ToString()); if (ListObj[0].Rows[inI]["chequeNo"].ToString() != string.Empty) { dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = ListObj[0].Rows[inI]["chequeNo"].ToString(); dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = (Convert.ToDateTime(ListObj[0].Rows[inI]["chequeDate"].ToString())).ToString("dd-MMM-yyyy"); } dgvJournalVoucher.Rows[inI].Cells["dgvtxtDetailsId"].Value = ListObj[0].Rows[inI]["journalDetailsId"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(ListObj[0].Rows[inI]["journalDetailsId"].ToString()); decimal decLedgerPostingId = BllLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decJournalVoucherTypeId); dgvJournalVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); btnSave.Text = "Update"; } PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); List<DataTable> listObj = new List<DataTable>(); listObj = BllPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decJournalVoucherTypeId, strVoucherNo, infoJournalMaster.Date); dtblPartyBalance = listObj[0]; dgvJournalVoucher.ClearSelection(); txtDate.Focus(); } catch (Exception ex) { MessageBox.Show("JV37:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Grid Fill function while coming from other form to update or delete /// </summary> public void FillFunction() { try { //PaymentMasterSP SpPaymentMaster = new PaymentMasterSP(); PaymentMasterInfo InfoPaymentMaster = new PaymentMasterInfo(); //PaymentDetailsSP SpPaymentDetails = new PaymentDetailsSP(); PaymentVoucherBll BllPaymentVoucher = new PaymentVoucherBll(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); AccountGroupBll bllAccountGroup = new AccountGroupBll(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); InfoPaymentMaster = BllPaymentVoucher.PaymentMasterViewByMasterId(decPaymentmasterId);//view master details isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(InfoPaymentMaster.VoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; txtVoucherNo.Text = InfoPaymentMaster.InvoiceNo; txtDate.Focus(); } else { txtVoucherNo.ReadOnly = false; txtVoucherNo.Text = InfoPaymentMaster.InvoiceNo; txtVoucherNo.Focus(); } dtpDate.Text = InfoPaymentMaster.Date.ToString(); cmbBankorCash.SelectedValue = InfoPaymentMaster.LedgerId; txtNarration.Text = InfoPaymentMaster.Narration; txtTotal.Text = InfoPaymentMaster.TotalAmount.ToString(); decDailySuffixPrefixId = InfoPaymentMaster.SuffixPrefixId; decPaymentVoucherTypeId = InfoPaymentMaster.VoucherTypeId; strVoucherNo = InfoPaymentMaster.VoucherNo; strInvoiceNo = InfoPaymentMaster.InvoiceNo; //DataTable dtbl = new DataTable(); List<DataTable> listObj1 = new List<DataTable>(); listObj1 = BllPaymentVoucher.PaymentDetailsViewByMasterId(decPaymentmasterId);//view details details for (int inI = 0; inI < listObj1[0].Rows.Count; inI++) { dgvPaymentVoucher.Rows.Add(); dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(listObj1[0].Rows[inI]["ledgerId"].ToString()); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentMasterId"].Value = listObj1[0].Rows[inI]["paymentMasterId"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentDetailsId"].Value = listObj1[0].Rows[inI]["paymentDetailsId"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = listObj1[0].Rows[inI]["amount"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(listObj1[0].Rows[inI]["exchangeRateId"].ToString()); decimal decDetailsId1 = Convert.ToDecimal(listObj1[0].Rows[inI]["paymentDetailsId"].ToString()); decimal decLedgerPostingId = BllLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decPaymentVoucherTypeId); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); decimal decLedgerId = Convert.ToDecimal(listObj1[0].Rows[inI]["ledgerId"].ToString()); bool IsBankAccount = bllAccountGroup.AccountGroupwithLedgerId(decLedgerId); decimal decI = Convert.ToDecimal(bllAccountLedger.AccountGroupIdCheck(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].FormattedValue.ToString())); if (decI > 0)//to make amount and currency read only when party is choosen as ledger { dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = true; dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = true; } else { dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = false; dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = false; } dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = listObj1[0].Rows[inI]["ChequeNo"].ToString(); if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty) { dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(listObj1[0].Rows[inI]["ChequeDate"].ToString()).ToString("dd-MMM-yyyy"); } dgvPaymentVoucher.Rows[inI].HeaderCell.Value = string.Empty; } List<DataTable> listObj = new List<DataTable>(); listObj = BllPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPaymentVoucherTypeId, strVoucherNo, InfoPaymentMaster.Date); dtblPartyBalance = listObj[0]; } catch (Exception ex) { MessageBox.Show("PV36:" + 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); } }