public PDFTablesCreate(ObservableCollection <Diagramm> ClassesDiagramm, decimal portfel) { Nowdate = DateTime.Now; Threemonthagodate = Nowdate.AddDays(-90); Sixmonthagodate = Nowdate.AddDays(-180); Yearagodate = Nowdate.AddYears(-1); TwoYearsAgodate = Nowdate.AddYears(-2); Startdate = Convert.ToDateTime(Storage.datasetKlient.Tables["ClientInfo"].Rows[0][19]); this.ClassesDiagramm = ClassesDiagramm; this.PortfellnowP = portfel; ReturnTable(); AllocationTable(); CellPolicyTable(); HoldingsTable(); TransactionTable(); }
private void CellPolicyTable() { List <DataColumn> ColumnsCollection = new List <DataColumn>() { new DataColumn("Title", typeof(String)), new DataColumn("This Year", typeof(String)), new DataColumn("Last Year", typeof(String)), new DataColumn("Total Cell", typeof(String)), }; CellPolicy = new DataTable(); CellPolicy.ColumnCollectionAdd(ColumnsCollection); #region Total Column decimal totalInflow = ClientReportVM.InflowDetailsCollection.SummValue(Startdate, Nowdate); decimal totalOutflow = ClientReportVM.WithdrawDetailsCollection.SummValue(Startdate, Nowdate); decimal totalActualResult = Convert.ToDecimal(Convert.ToDouble(PortfellnowP) - portfelstart); decimal totalClosingBalance = totalActualResult + totalInflow - totalOutflow; #endregion #region Last 1 year Column decimal YearInflow = ClientReportVM.InflowDetailsCollection.SummValue(Nowdate.AddYears(-1), Nowdate); decimal YearOutflow = ClientReportVM.WithdrawDetailsCollection.SummValue(Nowdate.AddYears(-1), Nowdate); decimal YearActualResult = Convert.ToDecimal(Convert.ToDouble(PortfellnowP) - portfelyearago); decimal YearClosingBalance = YearActualResult + YearInflow - YearOutflow; #endregion #region Last 2 years Column decimal TwoYearInflow = ClientReportVM.InflowDetailsCollection.SummValue(Nowdate.AddYears(-2), Nowdate); decimal TwoYearOutflow = ClientReportVM.WithdrawDetailsCollection.SummValue(Nowdate.AddYears(-2), Nowdate); decimal TwoYearActualResult = Convert.ToDecimal(Convert.ToDouble(PortfellnowP) - portfel2ya); decimal TwoYearClosingBalance = TwoYearActualResult + TwoYearInflow - TwoYearOutflow; #endregion DataRow inflof = CellPolicy.Rows.Add("Inflow", TwoYearInflow.ToString("N2"), YearInflow.ToString("N2"), totalInflow.ToString("N2")); DataRow outflow = CellPolicy.Rows.Add("Outflow", TwoYearOutflow.ToString("N2"), YearOutflow.ToString("N2"), totalOutflow.ToString("N2")); DataRow actualresult = CellPolicy.Rows.Add("Actual Result", TwoYearActualResult.ToString("N2"), YearActualResult.ToString("N2"), totalActualResult.ToString("N2")); DataRow closingbalance = CellPolicy.Rows.Add("Closing Balanse", TwoYearClosingBalance.ToString("N2"), YearClosingBalance.ToString("N2"), totalClosingBalance.ToString("N2")); }