public async Task <IActionResult> finishClaimRequestAsync(string dateofclaim, string svcno, string fundcode) { DischargeCalcView dischargeCalcView = new DischargeCalcView(); dischargeCalcView = ledgerService.dischargeCalculation(svcno, fundcode); decimal sumloan = 0; decimal sumContr = 0; decimal sumofthetwo = 0; foreach (var dloan in dischargeCalcView.personLoans) { sumloan += dloan.amount; } foreach (var dcon in dischargeCalcView.personContributions) { if (dcon.description == "Total") { sumContr = dcon.amount; break; } } dischargeCalcView.loanTotal = sumloan; dischargeCalcView.contrTotal = sumContr; sumofthetwo = sumloan + sumContr; dischargeCalcView.theTwoTotal = sumofthetwo; string yeartouse = dateofclaim.Substring(0, 4); string monthtouse = dateofclaim.Substring(4, 2); string daytouse = dateofclaim.Substring(6, 2); string ddate = yeartouse + "/" + monthtouse + "/" + daytouse; if (await claimRegisterService.GetClaimRegisterByCode(svcno) != null) { TempData["message"] = "The Person has exited"; } else { await claimRegisterService.AddNpfClaimRegister(new Npf_ClaimRegister() { svcno = svcno, loan = dischargeCalcView.personLoans == null ? 0 : sumloan, appdate = DateTime.Parse(ddate), AmountDue = sumofthetwo, status = "Pending", statusdate = DateTime.Now, interest = 10, TotalContribution = dischargeCalcView.personContributions == null ? 0 : sumContr, }); return(await generatePdf.GetPdf("Views/ClaimRegister/ReportPage.cshtml", dischargeCalcView)); } return(RedirectToAction("Index")); }
public IActionResult getDischargeCalculation(string svcno, string fundcode) { try { return(Ok(new { responseCode = "200", responseDescription = "Record Retrieved Successfully", data = ledgerService.dischargeCalculation(svcno, fundcode) })); } catch (Exception ex) { return(Ok(new { responseCode = "500", responseDescription = "Record Retrieval Failed" })); } }