/// <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(); PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); LedgerPostingSP SpLedgerPosting = new LedgerPostingSP(); VoucherTypeSP SpVoucherType = new VoucherTypeSP(); AccountGroupSP spAccountGroup = new AccountGroupSP(); AccountLedgerSP SpAccountLedger = new AccountLedgerSP(); InfoPaymentMaster = SpPaymentMaster.PaymentMasterViewByMasterId(decPaymentmasterId);//view master details isAutomatic = SpVoucherType.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(); dtbl = SpPaymentDetails.PaymentDetailsViewByMasterId(decPaymentmasterId);//view details details for (int inI = 0; inI < dtbl.Rows.Count; inI++) { dgvPaymentVoucher.Rows.Add(); dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentMasterId"].Value = dtbl.Rows[inI]["paymentMasterId"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentDetailsId"].Value = dtbl.Rows[inI]["paymentDetailsId"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = dtbl.Rows[inI]["amount"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString()); decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["paymentDetailsId"].ToString()); decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decPaymentVoucherTypeId); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); decimal decLedgerId = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); bool IsBankAccount = spAccountGroup.AccountGroupwithLedgerId(decLedgerId); decimal decI = Convert.ToDecimal(SpAccountLedger.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 = dtbl.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(dtbl.Rows[inI]["ChequeDate"].ToString()).ToString("dd-MMM-yyyy"); } } DataTable dtbl1 = new DataTable(); dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPaymentVoucherTypeId, strVoucherNo, InfoPaymentMaster.Date); dtblPartyBalance = dtbl1; } catch (Exception ex) { MessageBox.Show("PV36:" + 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(); JournalMasterSP spJournalMaster = new JournalMasterSP(); infoJournalMaster = spJournalMaster.JournalMasterView(decJournalMasterIdForEdit); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); infoVoucherType = spVoucherType.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 = spVoucherType.CheckMethodOfVoucherNumbering(decJournalVoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; } //GridFill DataTable dtbl = new DataTable(); JournalDetailsSP spJournalDetailsSp = new JournalDetailsSP(); dtbl = spJournalDetailsSp.JournalDetailsViewByMasterId(decJournalMasterIdForEdit); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); LedgerPostingSP spLedgerPosting = new LedgerPostingSP(); for (int inI = 0; inI < dtbl.Rows.Count; inI++) { dgvJournalVoucher.Rows.Add(); dgvJournalVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); if (Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString()) == 0) { dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Cr"; dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["credit"].ToString()); } else { dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Dr"; dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString()); } dgvJournalVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString()); if (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty) { dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString(); dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = (Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString())).ToString("dd-MMM-yyyy"); } dgvJournalVoucher.Rows[inI].Cells["dgvtxtDetailsId"].Value = dtbl.Rows[inI]["journalDetailsId"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["journalDetailsId"].ToString()); decimal decLedgerPostingId = spLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decJournalVoucherTypeId); dgvJournalVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); btnSave.Text = "Update"; } PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); DataTable dtbl1 = new DataTable(); dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decJournalVoucherTypeId, strVoucherNo, infoJournalMaster.Date); dtblPartyBalance = dtbl1; dgvJournalVoucher.ClearSelection(); txtDate.Focus(); } catch (Exception ex) { MessageBox.Show("JV37:" + 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 { ContraDetailsSP spContraDetails = new ContraDetailsSP(); ContraMasterSP spContraMaster = new ContraMasterSP(); ContraMasterInfo infoContraMaster = new ContraMasterInfo(); LedgerPostingSP SpLedgerPosting = new LedgerPostingSP(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); infoContraMaster = spContraMaster.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 = spVoucherType.CheckMethodOfVoucherNumbering(DecContraVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } DataTable dtbl = new DataTable(); dtbl = spContraDetails.ContraDetailsViewWithMasterId(decMasterId); for (int i = 0; i < dtbl.Rows.Count; i++) { dgvContraVoucher.Rows.Add(); dgvContraVoucher.Rows[i].Cells["dgvcmbBankorCashAccount"].Value = Convert.ToDecimal(dtbl.Rows[i]["ledgerId"].ToString()); dgvContraVoucher.Rows[i].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[i]["exchangeRateId"].ToString()); dgvContraVoucher.Rows[i].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["amount"].ToString()); if (dtbl.Rows[i]["chequeNo"].ToString() != string.Empty) { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[i]["chequeNo"].ToString(); if (dtbl.Rows[i]["chequeDate"].ToString() == "01 Jan 1753") { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeDate"].Value = null; } else { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeDate"].Value = dtbl.Rows[i]["chequeDate"].ToString(); } } dgvContraVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value = dtbl.Rows[i]["contraDetailsId"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[i]["contraDetailsId"].ToString()); decimal decLedgerPostingId = SpLedgerPosting.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 { ServiceDetailsSP spServiceDetails = new ServiceDetailsSP(); ServiceMasterSP spServiceMaster = new ServiceMasterSP(); ServiceMasterInfo infoServiceMaster = new ServiceMasterInfo(); LedgerPostingSP SpLedgerPosting = new LedgerPostingSP(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); PartyBalanceSP spPartyBalance = new PartyBalanceSP(); PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo(); decServiceMasterId = decMasterId; infoServiceMaster = spServiceMaster.ServiceMasterView(decServiceMasterId); infoVoucherType = spVoucherType.VoucherTypeView(infoServiceMaster.VoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; isAutomatic = spVoucherType.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; DataTable dtblServiceDetails = new DataTable(); dtblServiceDetails = spServiceDetails.ServiceDetailsViewWithMasterId(decServiceMasterId); for (int i = 0; i < dtblServiceDetails.Rows.Count; i++) { dgvServiceVoucher.Rows.Add(); dgvServiceVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceDetailsId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvtxtServiceMasterId"].Value = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceMasterId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value = dtblServiceDetails.Rows[i]["measure"].ToString(); dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value = dtblServiceDetails.Rows[i]["amount"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceDetailsId"].ToString()); decimal decLedgerPostingId = SpLedgerPosting.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 = spPartyBalance.PartyBalanceViewByVoucherNoAndVoucherTypeId(DecServicetVoucherTypeId, strVoucherNo, infoServiceMaster.Date); decPartyBalanceId = infoPartyBalance.PartyBalanceId; } catch (Exception ex) { MessageBox.Show("SV 32 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill function for updation /// </summary> public void FillFunction() { try { isValueChange = false; ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo(); ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP(); ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo(); ReceiptDetailsSP SpReceiptDetails = new ReceiptDetailsSP(); PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); LedgerPostingSP SpLedgerPosting = new LedgerPostingSP(); VoucherTypeSP SpVoucherType = new VoucherTypeSP(); AccountGroupSP spAccountGroup = new AccountGroupSP(); AccountLedgerSP SpAccountLedger = new AccountLedgerSP(); InfoReceiptMaster = SpReceiptMaster.ReceiptMasterViewByMasterId(decRecieptmasterId); isAutomatic = SpVoucherType.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; DataTable dtbl = new DataTable(); dtbl = SpReceiptDetails.ReceiptDetailsViewByMasterId(decRecieptmasterId); for (int inI = 0; inI < dtbl.Rows.Count; inI++) { dgvReceiptVoucher.Rows.Add(); dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptMasterId"].Value = dtbl.Rows[inI]["receiptMasterId"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value = dtbl.Rows[inI]["receiptDetailsId"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = dtbl.Rows[inI]["amount"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString()); decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["receiptDetailsId"].ToString()); decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decReceiptVoucherTypeId); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); decimal decLedgerId = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); bool IsBankAccount = spAccountGroup.AccountGroupwithLedgerId(decLedgerId); decimal decI = Convert.ToDecimal(SpAccountLedger.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 (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty) { dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString(); dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString()).ToString("dd-MMM-yyyy"); } dgvReceiptVoucher.Rows[inI].HeaderCell.Value = string.Empty; } DataTable dtbl1 = new DataTable(); dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decReceiptVoucherTypeId, strVoucherNo, InfoReceiptMaster.Date); dtblPartyBalance = dtbl1; isValueChange = true; } catch (Exception ex) { MessageBox.Show("RV34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }