public void RenderReport(int loanId) { //check authentication session is null, if null return if (Session["AuthenticatedUser"] == null) return; User userData = (User)Session["AuthenticatedUser"]; //set reportviewr properties rptViewerLoanTerms.ProcessingMode = ProcessingMode.Local; rptViewerLoanTerms.Reset(); rptViewerLoanTerms.LocalReport.EnableExternalImages = true; rptViewerLoanTerms.LocalReport.ReportPath = Server.MapPath("~/Reports/RptLoanTerms.rdlc"); rptViewerLoanTerms.ZoomMode = ZoomMode.PageWidth; ReportAccess ra = new ReportAccess(); //Get loan details and set to reportviwer List<RptLoanTerms> loanTermsDetails = ra.RptLoanTermsDetails(loanId); rptViewerLoanTerms.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", loanTermsDetails)); List<LoanDetailsRpt> details = ra.GetLoanDetailsRptforCompanySummary(userData.Company_Id, userData.UserId); rptViewerLoanTerms.LocalReport.DataSources.Add(new ReportDataSource("DataSet6", details)); //get curtailment schedule details and set to reportviwer CurtailmentAccess ca = new CurtailmentAccess(); List<Curtailment> curtailments = ca.retreiveCurtailmentByLoanId(loanId); if (curtailments != null && curtailments.Count > 0) { for (int i = 0; i < curtailments.Count; i++) { curtailments[i].CurtailmentId = i + 1; } } rptViewerLoanTerms.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", curtailments)); //get fees details and set to reportviwer List<RptFeeLoanTerm> loanTermsFeeDetails = ra.RptLoanTermsFeeDetails(loanId); rptViewerLoanTerms.LocalReport.DataSources.Add(new ReportDataSource("DataSet3", loanTermsFeeDetails)); //get reminders details and set to reportviwer List<RptEmailReminder> loanTermsEmailReminders = ra.RptLoanTermsEmailReminders(loanId); rptViewerLoanTerms.LocalReport.DataSources.Add(new ReportDataSource("DataSet4", loanTermsEmailReminders)); //get unit types and set to reportviwer IList<UnitType> unitTypes = ra.RptGetUnitTypes(loanId); rptViewerLoanTerms.LocalReport.DataSources.Add(new ReportDataSource("DataSet5", unitTypes)); }
public ActionResult Step10(string lbl) { CurtailmentModel curtailment = new CurtailmentModel(); int userId = userData.UserId; if (userData.RoleId >= 3) { return RedirectToAction("UserLogin", "Login", new { lbl = "You are not Allowed." }); } //check user step is valid for this step StepAccess sa = new StepAccess(); if (loanData.stepId == 5) { ViewBag.LoanId = 0; if (lbl == "Details added successfully") { ViewBag.SuccessMsg = "Loan setup is completed"; Session["loanStep"] = null; if (TempData["LoanId"] != null && (int)TempData["LoanId"] > 0) { ViewBag.LoanId = (int)TempData["LoanId"]; } if (HttpContext.Request.IsAjaxRequest()) { ViewBag.AjaxRequest = 1; return PartialView(curtailment); } return View(curtailment); } int branchId = loanData.BranchId; LoanSetupAccess la = new LoanSetupAccess(); int loanId = loanData.loanId; CurtailmentAccess curAccess = new CurtailmentAccess(); _loan = curAccess.GetLoanDetailsByLoanId(loanId); _loan.loanId = loanId; curtailment.AdvancePt = _loan.advancePercentage; curtailment.RemainingPercentage = curtailment.AdvancePt; curtailment.InfoModel = new List<Curtailment>(); var curtailments = curAccess.retreiveCurtailmentByLoanId(loanId); int payPercentage = _loan.advancePercentage; int? totalPercentage = 0; int curId = 0; if (curtailments != null && curtailments.Count > 0) { for (int i = 0; i < curtailments.Count; i++) { curId++; totalPercentage += curtailments[i].Percentage; curtailment.InfoModel.Add(new Curtailment { CurtailmentId = curId, TimePeriod = curtailments[i].TimePeriod, Percentage = curtailments[i].Percentage }); } curtailment.LoanStatus = _loan.LoanStatus ? "Yes" : "No"; curtailment.CalculationBase = _loan.CurtailmentCalculationBase == "a" ? "Advance" : "Full payment"; curtailment.DueDate = _loan.CurtailmentDueDate; curtailment.AutoRemindEmail = _loan.CurtailmentAutoRemindEmail; curtailment.EmailRemindPeriod = _loan.CurtailmentEmailRemindPeriod; } ViewBag.CalMode = "Full Payment"; curtailment.RemainingPercentage = payPercentage - totalPercentage; if (curtailment.RemainingPercentage > 0) curtailment.InfoModel.Add(new Curtailment { CurtailmentId = curId + 1 }); ViewData["objmodel"] = curtailment; if (HttpContext.Request.IsAjaxRequest()) { ViewBag.AjaxRequest = 1; return PartialView(curtailment); } else { return View(curtailment); } } return RedirectToAction("UserLogin", "Login", new { lbl = "Due to inactivity your session has timed out, please log in again." }); }