public async Task <IActionResult> Index(AuditViewModel model) { string fundTypeCode = HttpContext.Session.GetString("fundtypecode"); var p = fundService.GetFundTypeCodeByCode(fundTypeCode); int m = p.processingMonth; int y = p.processingYear; string fperiod = model.year.ToString(); string fundperiod = y.ToString(); var gh = new ReportViewModelQ(); List <LedgersView2> result = new List <LedgersView2>(); List <LedgersView2> result2 = new List <LedgersView2>(); List <LedgersView2> result3 = new List <LedgersView2>(); if (fperiod == fundperiod) { result = service.GetAllSurplus().ToList(); result2 = GroupBybalsheetcode(result.ToList()).ToList(); result3 = GroupBybalsheetcode9(result.ToList()).ToList(); gh.p = result2; gh.q = result3; } //else //{ // string year = model.year; // string wdoc2 = "Open" + fundTypeCode + year.Substring(2, 2) ; // var result2 = service.GetAllSurplus2(); // var result3 = result2.Where(x => x.docNo.Substring(0,8) == wdoc2).ToList(); // decimal total; // var res2 = GroupBybalsheetcode(result3.ToList(), out total); // var res3 = new List<LedgersView2>(); // var res4 = new List<ReportViewModel4>(); // foreach (var j in res2) // { // foreach (var k in result3) // { // if (j.balSheetCode == k.balSheetCode) // { // var z = new LedgersView2 // { // description = k.MDesc, // Amount = k.Amount, // acctcode = k.balSheetCode // }; // res3.Add(z); // } // } // var fh = new ReportViewModel4 // { // bl_desc = j.bl_desc, // code = j.balSheetCode, // tolly = res3, // total = (j.Amount == null) ? 0M : (decimal)j.Amount // }; // res4.Add(fh); // } // ViewBag.total = total; // var gh = new ReportViewModel5 // { // deficit = total, // colly = res4 // }; // return await generatePdf.GetPdf("Views/SuplusReport/SurplusReport.cshtml", gh); //} return(await generatePdf.GetPdf("Views/SuplusReport/SurplusReport.cshtml", gh)); }
public async Task <IActionResult> Index(AuditViewModel model) { var result = new List <LedgersView2>(); var result2 = new List <LedgersView2>(); var result3 = new List <LedgersView2>(); var gh = new ReportViewModelQ(); string fundTypeCode = HttpContext.Session.GetString("fundtypecode"); var p = fundService.GetFundTypeCodeByCode(fundTypeCode); int m = p.processingMonth; int y = p.processingYear; string fperiod = model.year; string fundperiod = y.ToString(); if (fperiod == fundperiod) { result = service.GetBalSheet().ToList(); result2 = GroupBybalsheetcode2(result).ToList(); result3 = GroupBybalsheetcode9(result).ToList(); gh.p = result2; gh.q = result3; } return(await generatePdf.GetPdf("Views/BalsheetReport/BalsheetReport.cshtml", gh)); // else // { // string year = model.year; // string wdoc = "Open" + fundTypeCode + year.Substring(2, 2) ; // var res = service.GetAllSurplus2(); // var res2 = res.ToList(); //// res2 = Refractlist(res2, wdoc); // decimal total2 = GroupBybalsheetcode(res2.ToList()); // var result = service.GetBalSheet2(); // var resultM = Refractlist(result.ToList(), wdoc); // var resultj = resultM.ToList(); // var r2 = FilterRecord(resultj, total2).ToList(); // resultj.AddRange(r2); // decimal total3 = 0M; // var result2 = GroupBybalsheetcode2(resultj); // var result3 = new List<LedgersView2>(); // var result4 = new List<ReportViewModel4>(); // foreach (var j in result2) // { // foreach (var k in resultj) // { // if (j.balSheetCode == k.balSheetCode) // { // var z = new LedgersView2 // { // description = k.MDesc, // Amount = k.Amount, // acctcode = k.balSheetCode // }; // result3.Add(z); // } // } // var fh = new ReportViewModel4 // { // bl_desc = j.bl_desc, // code = j.balSheetCode, // tolly = result3, // total = (j.Amount == null) ? 0M : (decimal)j.Amount // }; // result4.Add(fh); // total3 += fh.total; // } // gh.deficit = total3; // gh.colly = result4; // return await generatePdf.GetPdf("Views/BalsheetReport/BalsheetReport.cshtml", gh); //} }