/// <summary> /// Function to fill the grid based on the Search keys /// </summary> public void BillAllocationGridFill() { try { PartyBalanceSP sppartybalance = new PartyBalanceSP(); if (cmbAccountGroup.SelectedIndex > -1 && cmbAccountLedger.SelectedIndex > -1) { if (cmbAccountGroup.SelectedItem.ToString() != "System.Data.DataRowView" || cmbAccountGroup.Text != "System.Data.DataRowView" && cmbAccountLedger.SelectedItem.ToString() != "System.Data.DataRowView" || cmbAccountLedger.Text != "System.Data.DataRowView") { if (Convert.ToDateTime(txtfromdate.Text) <= Convert.ToDateTime(txttodate.Text)) { dgvBillAllocation.DataSource = sppartybalance.BillAllocationSearch(Convert.ToDateTime(txtfromdate.Text), Convert.ToDateTime(txttodate.Text), cmbAccountGroup.Text, cmbAccountLedger.Text); } else { Messages.InformationMessage("Fromdate should be less than or equal to todate"); txttodate.Focus(); } } } } catch (Exception ex) { formMDI.infoError.ErrorString = "BA6:" + ex.Message; } }
/// <summary> /// Function to fill datagridview /// </summary> public void GridFill() { try { PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo(); PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); DataTable dtbl = new DataTable(); decimal decVoucherTypeId = 0; decimal decVoucherTypeNameId = 0; decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); decVoucherTypeNameId = Convert.ToDecimal(cmbVoucherTypeName.SelectedValue.ToString()); dtbl = SpPartyBalance.AgainstBillDetailsGridViewByLedgerId(decledgerId, strDebitOrCredit, decVoucherTypeId, decVoucherTypeNameId); dgvAgainstBillDetails.DataSource = dtbl; } catch (Exception ex) { formMDI.infoError.ErrorString = "AB3:" + ex.Message; } }
/// <summary> /// To fill combo with all ledgers to whome interest enabled is true /// </summary> public void FillInterestEnabledLedgersCombo() { try { PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); DataTable dtblCashOrParty = SpPartyBalance.AccountLedgerGetByDebtorAndCreditorWithBalance(); DataRow dr1 = dtblCashOrParty.NewRow(); dr1["ledgerName"] = "All"; dr1["ledgerId"] = 0; dtblCashOrParty.Rows.InsertAt(dr1, 0); cmbLedger.DataSource = dtblCashOrParty; cmbLedger.DisplayMember = "ledgerName"; cmbLedger.ValueMember = "ledgerId"; } catch (Exception ex) { formMDI.infoError.ErrorString = "AR2:" + ex.Message; } }
/// <summary> /// To fill grid /// </summary> public void FillGrid() { try { if (!isFormLoad) { PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); DataTable dtbl = new DataTable(); cmbLedger.Enabled = true; string p = string.Empty; if (cmbLedger.SelectedValue != null) { p = cmbLedger.SelectedValue.ToString().ToString(); } if (cmbLedger.SelectedValue != null) { if (rbtnVoucher.Checked) { fillby = "Voucher"; } else if (rbtnLedgerWise.Checked) { fillby = "Ledger"; } if (rbtnReceivable.Checked && rbtnLedgerWise.Checked) { dtbl = SpPartyBalance.AgeingReportLedgerReceivable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } else if (rbtnReceivable.Checked && rbtnVoucher.Checked) { dtbl = SpPartyBalance.AgeingReportVoucherReceivable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } else if (rbtnPayable.Checked && rbtnLedgerWise.Checked) { dtbl = SpPartyBalance.AgeingReportLedgerPayable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } else if (rbtnPayable.Checked && rbtnVoucher.Checked) { dtbl = SpPartyBalance.AgeingReportVoucherPayable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } } decimal dcTotOne = 0m; decimal dcTotTwo = 0m; decimal dcTotThree = 0m; decimal dcTotFour = 0m; if (dtbl.Rows.Count > 0) { dcTotOne = decimal.Parse(dtbl.Compute("Sum([1 to 30])", string.Empty).ToString()); dcTotTwo = decimal.Parse(dtbl.Compute("Sum([31 to 60])", string.Empty).ToString()); dcTotThree = decimal.Parse(dtbl.Compute("Sum([61 to 90])", string.Empty).ToString()); dcTotFour = decimal.Parse(dtbl.Compute("Sum([90 above])", string.Empty).ToString()); } dtbl.Rows.Add(); dtbl.Rows[dtbl.Rows.Count - 1]["Account Ledger"] = "Total :"; dtbl.Rows[dtbl.Rows.Count - 1]["1 to 30"] = dcTotOne; dtbl.Rows[dtbl.Rows.Count - 1]["31 to 60"] = dcTotTwo; dtbl.Rows[dtbl.Rows.Count - 1]["61 to 90"] = dcTotThree; dtbl.Rows[dtbl.Rows.Count - 1]["90 above"] = dcTotFour; dgvReport.DataSource = dtbl; if (dgvReport.Columns.Count > 0) { if (rbtnLedgerWise.Checked == true) { dgvReport.Columns["ledgerId"].Visible = false; dgvReport.Columns["masterId"].Visible = false; dgvReport.Columns["voucherTypeId"].Visible = false; dgvReport.Columns["VoucherType"].Visible = false; dgvReport.Columns["VoucherNo"].Visible = false; dgvReport.Columns["Date"].Visible = true; dgvReport.Columns["Account Ledger"].Visible = true; } else { dgvReport.Columns["masterId"].Visible = false; dgvReport.Columns["ledgerId"].Visible = false; dgvReport.Columns["voucherTypeId"].Visible = false; dgvReport.Columns["VoucherType"].Visible = true; dgvReport.Columns["VoucherNo"].Visible = true; dgvReport.Columns["Date"].Visible = true; dgvReport.Columns["Account Ledger"].Visible = false; } } dgvReport.Columns["1 to 30"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvReport.Columns["31 to 60"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvReport.Columns["61 to 90"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvReport.Columns["90 above"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; lblTotOne.Text = "1 to 30: " + dcTotOne.ToString(); lblTotTwo.Text = "31 to 60: " + dcTotTwo.ToString(); lblTotThree.Text = "61 to 90: " + dcTotThree.ToString(); lblTotFour.Text = "90 above: " + dcTotFour.ToString(); ledgerId = string.Empty; if (inCurrenRowIndex >= 0 && dgvReport.Rows.Count > 0 && inCurrenRowIndex < dgvReport.Rows.Count) { dgvReport.CurrentCell = dgvReport.Rows[inCurrenRowIndex].Cells["1 to 30"]; dgvReport.CurrentCell.Selected = true; } inCurrenRowIndex = 0; } } catch (Exception ex) { formMDI.infoError.ErrorString = "AR3:" + ex.Message; } }