/// <summary> /// Frontend Page: Pay Curtailment Page(Curtailment Receipt Report) /// Title: Display Curtailment Receipt report during session /// Designed: Kanishka SHM /// User story: /// Developed: Kanishka SHM /// Date created: /// </summary> public void RenderReport(int loanId) { //Check authentication session is null then return if (Session["AuthenticatedUser"] == null) return; User userData = (User)Session["AuthenticatedUser"]; //set reportviewr properties rptViewerCurtailmentReceiptDuringSession.ProcessingMode = ProcessingMode.Local; rptViewerCurtailmentReceiptDuringSession.Reset(); rptViewerCurtailmentReceiptDuringSession.LocalReport.EnableExternalImages = true; rptViewerCurtailmentReceiptDuringSession.LocalReport.ReportPath = Server.MapPath("~/Reports/RptCurtailmentDuringSession.rdlc"); rptViewerCurtailmentReceiptDuringSession.ZoomMode = ZoomMode.PageWidth; //Get account details ReportAccess ra = new ReportAccess(); List<LoanDetailsRpt> details = ra.TopHeaderDetails(loanId, userData.UserId); foreach (var dates in details) { dates.ReportDate = DateTime.Now.ToString("MM/dd/yyyy"); } //Set data set to report rptViewerCurtailmentReceiptDuringSession.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", details)); //get unit list from session List<CurtailmentShedule> selectedCurtailmentSchedules = (List<CurtailmentShedule>) Session["CurtUnitDuringSession"]; //assign unit ids List<string> uniList = (from item in selectedCurtailmentSchedules select item.UnitId).Distinct().ToList(); //create xml string XElement xEle = new XElement("Curtailments", from id in uniList select new XElement("Unit", new XElement("UnitId", id) )); string xmlDoc = xEle.ToString(); //get unit curatilment details during session List<CurtailmentShedule> unitWithAdvanceAmount = ra.GetCurtailmentPaidDetailsDuringSession(xmlDoc); foreach (var item in selectedCurtailmentSchedules) { item.PurchasePrice = unitWithAdvanceAmount.First(x => x.UnitId == item.UnitId).PurchasePrice; } if (selectedCurtailmentSchedules != null && selectedCurtailmentSchedules.Count > 0) { //Set data set to report rptViewerCurtailmentReceiptDuringSession.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", selectedCurtailmentSchedules)); } }