/// <summary> /// Function to fill the grid based on the Search keys /// </summary> public void BillAllocationGridFill() { try { PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); 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)) { List <DataTable> listObj = new List <DataTable>(); listObj = BllPartyBalance.BillAllocationSearch(Convert.ToDateTime(txtfromdate.Text), Convert.ToDateTime(txttodate.Text), cmbAccountGroup.Text, cmbAccountLedger.Text); dgvBillAllocation.DataSource = listObj[0]; } else { Messages.InformationMessage("Fromdate should be less than or equal to todate"); txttodate.Focus(); } } } } catch (Exception ex) { MessageBox.Show("BA:06" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill datagridview /// </summary> public void GridFill() { try { PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); List <DataTable> listObj = new List <DataTable>(); decimal decVoucherTypeId = 0; decimal decVoucherTypeNameId = 0; decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); decVoucherTypeNameId = Convert.ToDecimal(cmbVoucherTypeName.SelectedValue.ToString()); listObj = BllPartyBalance.AgainstBillDetailsGridViewByLedgerId(decledgerId, strDebitOrCredit, decVoucherTypeId, decVoucherTypeNameId); dgvAgainstBillDetails.DataSource = listObj[0]; } catch (Exception ex) { MessageBox.Show("AB3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To fill combo with all ledgers to whome interest enabled is true /// </summary> public void FillInterestEnabledLedgersCombo() { try { PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); List <DataTable> listCashOrParty = BllPartyBalance.AccountLedgerGetByDebtorAndCreditorWithBalance(); DataRow dr1 = listCashOrParty[0].NewRow(); dr1["ledgerName"] = "All"; dr1["ledgerId"] = 0; listCashOrParty[0].Rows.InsertAt(dr1, 0); cmbLedger.DataSource = listCashOrParty[0]; cmbLedger.DisplayMember = "ledgerName"; cmbLedger.ValueMember = "ledgerId"; } catch (Exception ex) { MessageBox.Show("AR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To fill grid /// </summary> public void FillGrid() { try { if (!isFormLoad) { PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); List <DataTable> listObj = new List <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) { listObj = BllPartyBalance.AgeingReportLedgerReceivable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } else if (rbtnReceivable.Checked && rbtnVoucher.Checked) { listObj = BllPartyBalance.AgeingReportVoucherReceivable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } else if (rbtnPayable.Checked && rbtnLedgerWise.Checked) { listObj = BllPartyBalance.AgeingReportLedgerPayable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } else if (rbtnPayable.Checked && rbtnVoucher.Checked) { listObj = BllPartyBalance.AgeingReportVoucherPayable(DateTime.Parse(dtpAgeingDate.Text), Convert.ToDecimal(cmbLedger.SelectedValue.ToString())); } } decimal dcTotOne = 0m; decimal dcTotTwo = 0m; decimal dcTotThree = 0m; decimal dcTotFour = 0m; if (listObj[0].Rows.Count > 0) { dcTotOne = decimal.Parse(listObj[0].Compute("Sum([1 to 30])", string.Empty).ToString()); dcTotTwo = decimal.Parse(listObj[0].Compute("Sum([31 to 60])", string.Empty).ToString()); dcTotThree = decimal.Parse(listObj[0].Compute("Sum([61 to 90])", string.Empty).ToString()); dcTotFour = decimal.Parse(listObj[0].Compute("Sum([90 above])", string.Empty).ToString()); } listObj[0].Rows.Add(); listObj[0].Rows[listObj[0].Rows.Count - 1]["Account Ledger"] = "Total :"; listObj[0].Rows[listObj[0].Rows.Count - 1]["1 to 30"] = dcTotOne; listObj[0].Rows[listObj[0].Rows.Count - 1]["31 to 60"] = dcTotTwo; listObj[0].Rows[listObj[0].Rows.Count - 1]["61 to 90"] = dcTotThree; listObj[0].Rows[listObj[0].Rows.Count - 1]["90 above"] = dcTotFour; dgvReport.DataSource = listObj[0]; 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); } }