/// <summary> /// Function to fill the grid /// </summary> public void AccountLedgerReportFill() { decimal decTotalClosing = 0; AccountLedgerSP SpAccountLedger = new AccountLedgerSP(); try { dgvAccountLedgerReport.DataSource = SpAccountLedger.AccountLedgerReportFill(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text), Convert.ToDecimal(cmbAccountGroup.SelectedValue.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString())); if (dgvAccountLedgerReport.RowCount > 0) { for (int i = 0; i < dgvAccountLedgerReport.RowCount; i++) { decTotalClosing = decTotalClosing + Convert.ToDecimal(dgvAccountLedgerReport.Rows[i].Cells["dgvtxtClosing1"].Value.ToString()); } } if (decTotalClosing < 0) { decTotalClosing = -1 * decTotalClosing; lblTotalAmount.Text = decTotalClosing.ToString() + "Cr"; } else { lblTotalAmount.Text = decTotalClosing.ToString() + "Dr"; } } catch (Exception ex) { MessageBox.Show("ALREP4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }