/// <summary> /// Function to fill the report in grid /// </summary> public void GridFill() { decimal decBalanceTotal = 0; try { AccountGroupSP spAccountGroup = new AccountGroupSP(); DataTable dtbl = new DataTable(); dtbl = spAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)); if (decAccountGroupId == 6) { FinancialStatementSP spFinace = new FinancialStatementSP(); CalculationMethod(); decimal dcOpeninggStock = spFinace.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true); dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces); int inRowCount = dtbl.Rows.Count; DataRow dr = dtbl.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; dtbl.Rows.InsertAt(dr, inRowCount); } dgvAccountGroupWiseReport.DataSource = dtbl; if (dtbl.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) { formMDI.infoError.ErrorString = "AGWREP2:" + ex.Message; } }
/// <summary> /// Function to fill the report in grid for fundflow /// </summary> /// <param name="decCS"></param> public void GridFillForFundFlow(decimal decCS) { decimal decBalanceTotal = 0; try { AccountGroupSP spAccountGroup = new AccountGroupSP(); DataTable dtbl = new DataTable(); dtbl = spAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)); DataRow drow = dtbl.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(); dtbl.Rows.InsertAt(drow, dtbl.Rows.Count); dgvAccountGroupWiseReport.DataSource = dtbl; if (dtbl.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) { formMDI.infoError.ErrorString = "AGWREP3:" + ex.Message; } }