/// <summary> /// Function to fill the report in grid /// </summary> public void GridFill() { decimal decBalanceTotal = 0; try { AccountGroupBll bllAccountGroup = new AccountGroupBll(); List <DataTable> ListObj = new List <DataTable>(); ListObj = bllAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)); if (decAccountGroupId == 6) { FinancialStatementBll bllFinancialStatement = new FinancialStatementBll(); CalculationMethod(); decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true); dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces); int inRowCount = ListObj[0].Rows.Count; DataRow dr = ListObj[0].NewRow(); dr["SlNo"] = inRowCount + 1; dr["accountGroupId"] = -2; dr["ledgerId"] = 0; dr["name"] = "Opening Stock"; if (dcOpeninggStock >= 0) { dr["OpeningBalance"] = dcOpeninggStock + "Dr"; dr["Balance"] = dcOpeninggStock + "Dr"; } else { dr["OpeningBalance"] = dcOpeninggStock + "Cr"; dr["Balance"] = dcOpeninggStock + "Cr"; } dr["debit"] = Math.Round(Convert.ToDecimal(0.00000), PublicVariables._inNoOfDecimalPlaces).ToString() + ".00"; dr["credit"] = Math.Round(Convert.ToDecimal(0.00000), PublicVariables._inNoOfDecimalPlaces).ToString() + ".00"; dr["balance1"] = dcOpeninggStock; ListObj[0].Rows.InsertAt(dr, inRowCount); } dgvAccountGroupWiseReport.DataSource = ListObj[0]; if (ListObj[0].Rows.Count > 0) { for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++) { decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString()); } } if (decBalanceTotal < 0) { decBalanceTotal = -1 * decBalanceTotal; lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr"; } else { lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr"; } } catch (Exception ex) { MessageBox.Show("AGWREP02:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the report in grid for fundflow /// </summary> /// <param name="decCS"></param> public void GridFillForFundFlow(decimal decCS) { decimal decBalanceTotal = 0; try { AccountGroupBll bllAccountGroup = new AccountGroupBll(); List <DataTable> ListObj = new List <DataTable>(); ListObj = bllAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)); DataRow drow = ListObj[0].NewRow(); decimal decCsop = 0; drow[1] = -2; drow[2] = 0; drow[3] = "Closing Stock"; drow[4] = decCsop.ToString() + ".00Dr"; drow[5] = decCS; drow[6] = "0.00"; drow[7] = decCS.ToString() + "Dr"; drow[8] = decCS.ToString(); ListObj[0].Rows.InsertAt(drow, ListObj[0].Rows.Count); dgvAccountGroupWiseReport.DataSource = ListObj[0]; if (ListObj[0].Rows.Count > 0) { for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++) { decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString()); } } if (decBalanceTotal < 0) { decBalanceTotal = -1 * decBalanceTotal; lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr"; } else { lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr"; } } catch (Exception ex) { MessageBox.Show("AGWREP03:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }