Beispiel #1
0
        public async Task <IActionResult> generate(LoanPositionViewModel model)
        {
            string indicator = "Specific Main ledger";
            string fundcode  = model.fundcode;

            string code = model.mainacct;

            var result = services.GenerateTrialBalanceReport(indicator, fundcode);

            result = GetAllLoanfiltered(result, code).ToList();
            var result2 = FilteredLoan(result.ToList());

            return(await generatePdf.GetPdf("Views/LoanPosition/LoanReport.cshtml", GetAllSubs(result2)));
        }
        public async Task <IActionResult> getReport(string indicator, string year, string mainacct)
        {
            string fundTypeCode = HttpContext.Session.GetString("fundtypecode");
            var    p            = fundService.GetFundTypeCodeByCode(fundTypeCode);
            string ProcessYear  = p.processingYear.ToString();

            if (!string.IsNullOrWhiteSpace(indicator))
            {
                List <LedgersView> j       = new List <LedgersView>();
                string             valDb   = RefractCode2(ProcessYear);
                string             frmForm = RefractCode2(year);



                //string month = model.month;
                //string year = model.year;
                string headerVariable = string.Empty;

                if (valDb == frmForm)
                {
                    j = services.GenerateTrialBalanceReport(indicator, fundTypeCode).ToList();
                }
                else
                {
                    string wdoc2 = "Open" + fundTypeCode + frmForm;
                    //check npf_history
                    j = services.GenerateNpfHistory(wdoc2).OrderBy(x => x.code).ToList();
                    if (indicator == "Main Ledger")
                    {
                        j = services.GenMainLedgers(j).ToList();
                    }
                }


                var q = FilterViewModel(j.ToList());

                if (indicator == "Main Ledger")
                {
                    headerVariable = "Trial Balance Report";

                    return(await generatePdf.GetPdf("Views/TrialbalanceReport/ReportPage.cshtml", GroupSum(q.ToList(), year, headerVariable)));
                }
                else if (indicator == "Subsidiary Ledger")
                {
                    headerVariable = "Trial Balance Report";
                    return(await generatePdf.GetPdf("Views/TrialbalanceReport/ReportPage.cshtml", GetAllSubs(q.ToList(), year, headerVariable)));
                }
                else
                {
                    if (mainacct == null)
                    {
                        return(RedirectToAction("index", "TrialbalanceReport"));
                    }
                    else
                    {
                        //string maincode = mainacct;
                        headerVariable = services.getMainActDesc(mainacct).ToLowerInvariant();
                        var t = GetAllfiltered(q, mainacct);
                        return(await generatePdf.GetPdf("Views/TrialbalanceReport/ReportPage.cshtml", GetAllSubs(t, year, headerVariable)));
                    }
                }
            }

            return(RedirectToAction("Index"));
        }