コード例 #1
0
 /// <summary>
 /// Function to fill the grid
 /// </summary>
 public void AccountLedgerReportFill()
 {
     decimal decTotalClosing = 0;
     AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
     List<DataTable> listObj = new List<DataTable>();
     try
     {
         listObj= bllAccountLedger.AccountLedgerReportFill(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text), Convert.ToDecimal(cmbAccountGroup.SelectedValue.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString()));
         dgvAccountLedgerReport.DataSource = listObj[0];
         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);
     }
 }