public ReportMonthFilter() { ThisMonth = hdl.FinencialReportPerMonth(today.Month); PrevousMonth = hdl.FinencialReportPerMonth(today.Month - 1); TwoMonthsBefore = hdl.FinencialReportPerMonth(today.Month - 2); ThreeMonthsBefore = hdl.FinencialReportPerMonth(today.Month - 3); FourMonthsBefore = hdl.FinencialReportPerMonth(today.Month - 4); FiveMonthsBefore = hdl.FinencialReportPerMonth(today.Month - 5); }
public FinencialReport FinencialReportPerMonth(int month) { var assetInvoices = invoices.Where(p => p.invoiceType == "Assets"); var repairsInvoices = invoices.Where(p => p.invoiceType == "Replacement Parts"); var report = new FinencialReport() { AssetsBought = assetInvoices.Where(p => p.InvoiceDate.Month == month).Count(), ReplacementPartsBought = repairsInvoices.Where(p => p.InvoiceDate.Month == month).Count(), TotalAssetsCost = TotalInvoiceCostForMonth(assetInvoices.ToList(), month), TotalRepairCost = TotalInvoiceCostForMonth(repairsInvoices.ToList(), month), FullCost = FullTotal(month) }; return(report); }