public List <DataTable> AgeingReportVoucherReceivable(DateTime ageingDate, decimal decledgerId) { List <DataTable> listObj = new List <DataTable>(); try { listObj = SPPartyBalance.AgeingReportVoucherReceivable(ageingDate, decledgerId); } catch (Exception ex) { MessageBox.Show("PBBLL:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(listObj); }
/// <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) { MessageBox.Show("AR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }