/* Frontend page: Report page Title: Loan pdf viwer Designed: Kanishka SHM User story: Developed: Kanishka SHM Date created: Modified: Kanishka SHM Date Modified: 06/28/2016 */ public FileResult PrintPage() { //check authentication session is null, if null return if (Session["AuthenticatedUser"] == null) return null; User userData = (User)Session["AuthenticatedUser"]; //to store report viwer as a pdf file Warning[] warnings; string[] streamids; string mimeType; string encoding; string filenameExtension; ReportViewer rptViewerPrint; string rptType = ""; int loanId = 0; string range1 = ""; string range2 = ""; int titleStatus = 0; int branchId = 0; string branchName = ""; //individual curtailment summary report string idnumber = ""; // get report type if (Request.QueryString["rptType"] != "") rptType = Request.QueryString["rptType"]; // get loan id if (Request.QueryString["loanId"] != "") loanId = Convert.ToInt32(Request.QueryString["loanId"]); // stat date of range if(Request.QueryString["range1"] != "") range1 = Request.QueryString["range1"]; // end date of range if (Request.QueryString["range2"] != "") range2 = Request.QueryString["range2"]; // title status if(Request.QueryString["titleStatus"] != "") titleStatus = Convert.ToInt32(Request.QueryString["titleStatus"]); // branch if (Request.QueryString["branchId"] != "") branchId = Convert.ToInt32(Request.QueryString["branchId"]); if (Request.QueryString["branchName"] != "") branchName = Request.QueryString["branchName"]; // individual curtailment summary if (Request.QueryString["idNumber"] != "") idnumber =Request.QueryString["idNumber"]; // call pdf viwer by report type if (rptType == "LotInspection") { RptDivLotInspection lInspection = new RptDivLotInspection(); rptViewerPrint = lInspection.PrintPage(loanId); } else if (rptType == "CurtailmentInvoice") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivCurtailmentInvoice ciInvoice = new RptDivCurtailmentInvoice(); rptViewerPrint = ciInvoice.PrintPage(loanId, startDate, endtDate); } else if (rptType == "AdvanceFeeInvoice") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivAdvanceFeeInvoice afInvoice = new RptDivAdvanceFeeInvoice(); rptViewerPrint = afInvoice.PrintPage(loanId, startDate, endtDate); } else if (rptType == "LoanFeeInvoice") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivMonthlyLoanFeeInvoice lfInvoice = new RptDivMonthlyLoanFeeInvoice(); rptViewerPrint = lfInvoice.PrintPage(loanId, startDate, endtDate); } else if (rptType == "LotInspectionFeeInvoice") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivLotInspectionFeeInvoice liInvoice = new RptDivLotInspectionFeeInvoice(); rptViewerPrint = liInvoice.PrintPage(loanId, startDate, endtDate); } else if (rptType == "PayOff") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptPayOff payOff = new RptPayOff(); rptViewerPrint = payOff.PrintPage(loanId, startDate, endtDate); } else if (rptType == "AdvanceFeeReceipt") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivAdvanceFeeReceipt adFeeReceipt = new RptDivAdvanceFeeReceipt(); rptViewerPrint = adFeeReceipt.PrintPage(loanId, startDate, endtDate); } else if (rptType == "MonthlyLoanFeeReceipt") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivMonthlyLoanFeeReceipt monthlyLoanFeeReceipt = new RptDivMonthlyLoanFeeReceipt(); rptViewerPrint = monthlyLoanFeeReceipt.PrintPage(loanId, startDate, endtDate); } else if (rptType == "LotInspectionFeeReceipt") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivLotInspectionFeeReceipt lotInspectionFeeReceipt = new RptDivLotInspectionFeeReceipt(); rptViewerPrint = lotInspectionFeeReceipt.PrintPage(loanId, startDate, endtDate); } else if (rptType == "CurtailmentReceipt") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivCurtailmentReceipt crReceipt = new RptDivCurtailmentReceipt(); rptViewerPrint = crReceipt.PrintPage(loanId, startDate, endtDate); } else if (rptType == "TransactionHistory") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivTransactionHistory loanSmmry = new RptDivTransactionHistory(); rptViewerPrint = loanSmmry.PrintPage(loanId, startDate, endtDate); } else if (rptType == "TitlesStatus") { RptDivTitleStatus tsStatus = new RptDivTitleStatus(); rptViewerPrint = tsStatus.PrintPage(loanId, titleStatus); } else if (rptType == "FullInventory") { RptDivFullInventory fInventory = new RptDivFullInventory(); rptViewerPrint = fInventory.PrintPage(loanId); } else if (rptType == "AdvanceUnit") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptAdvanceUnitReport advanceUnit = new RptAdvanceUnitReport(); rptViewerPrint = advanceUnit.PrintPage(loanId, startDate, endtDate); } else if (rptType == "LoanTerms") { RptDivLoanTerms loanTerms = new RptDivLoanTerms(); rptViewerPrint = loanTerms.PrintPage(loanId); } else if(rptType == "CompanySummary") { RptDivCompanySummary companySummary = new RptDivCompanySummary(); rptViewerPrint = companySummary.PrintPage(userData.Company_Id); } else if (rptType == "BranchSummary") { RptDivBranchSummary branchSummary = new RptDivBranchSummary(); if (userData.RoleId == 1) { rptViewerPrint = branchSummary.PrintPage(branchId,branchName); } else { rptViewerPrint = branchSummary.PrintPage(userData.BranchId,userData.BranchName); } } else if (rptType == "DeletedUnits") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivDeletedUnits deleteUnits = new RptDivDeletedUnits(); rptViewerPrint = deleteUnits.PrintPage(loanId, startDate, endtDate); } else if (rptType == "LoanSummary") { DateTime startDate = Convert.ToDateTime(range1); DateTime endtDate = Convert.ToDateTime(range2); RptDivLoanSummary deleteUnits = new RptDivLoanSummary(); rptViewerPrint = deleteUnits.PrintPage(loanId, startDate, endtDate); } else if (rptType == "FullCurtSummary") { RptDivFullCurtailmentSummary fullCurtSummary = new RptDivFullCurtailmentSummary(); rptViewerPrint = fullCurtSummary.PrintPage(loanId); } else if (rptType == "IndCurtSummary") { RptDivIndividualCurtailmentSummary indCurtSummary = new RptDivIndividualCurtailmentSummary(); rptViewerPrint = indCurtSummary.PrintPage(loanId,idnumber); } else { return null; } // store report viewer as pdf format byte[] bytes = rptViewerPrint.LocalReport.Render( "PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); // return pdf file FileContentResult fsResult = File(bytes, "application/pdf"); return fsResult; }
/// <summary> /// Created by : kasun /// Created Date: 7/6/2016 /// /// Summery: Loan term print /// </summary> /// <param name="loanId"></param> /// <returns></returns> public FileResult PrintPage(int loanId) { Warning[] warnings; string[] streamids; string mimeType; string encoding; string filenameExtension; RptDivLoanTerms loanTerm = new RptDivLoanTerms(); var rptViewerPrint = loanTerm.PrintPage(loanId); var bytes = rptViewerPrint.LocalReport.Render( "PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); var fsResult = File(bytes, "application/pdf"); return fsResult; }