public async Task <IActionResult> trialbalance(AuditViewModel model)
        {
            var    result       = new List <LedgersView2>();
            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)
            {
                //get list from surplus or deficit nd get total
                var     res    = service.GetAllSurplus();
                decimal total2 = GroupBybalsheetcode(res.ToList());


                result = service.GetBalSheet_TrialBalance().ToList();
            }

            return(await generatePdf.GetPdf("Views/BalsheetReport/BalsheetReport_trialbalance.cshtml", result));
        }
Ejemplo n.º 2
0
        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));
        }