public object OutletSumTransReportByOutlet(ReportModel model) { try { StringBuilderService builder = new StringBuilderService(); string mphone = builder.ExtractText(Convert.ToString(model.ReportOption), "mphone", ","); string fromDate = builder.ExtractText(Convert.ToString(model.ReportOption), "fromDate", ","); string toDate = builder.ExtractText(Convert.ToString(model.ReportOption), "toDate", ","); string dateType = builder.ExtractText(Convert.ToString(model.ReportOption), "dateType", "}"); //var clientInfo = (Reginfo)kycService.GetClientInfoByMphone(mphone); var childMerchantCode = chainMerchantService.GetChainMerchantCodeByMphone(mphone); List <OutletSummaryTransaction> merchantTransactionList = new List <OutletSummaryTransaction>(); merchantTransactionList = childMerchantService.ChainMerTransSummReportByOutlet(mphone, childMerchantCode, fromDate, toDate, dateType).ToList(); string merchantName = merchantTransactionList[0].OutletName; string merchantCode = merchantTransactionList[0].OutletId; ReportViewer reportViewer = new ReportViewer(); reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTChainMerTranSumByOutlet.rdlc"); reportViewer.LocalReport.SetParameters(GetReportParameterOutletSumTransReportByOutlet(mphone, fromDate, toDate, merchantName, merchantCode)); ReportDataSource A = new ReportDataSource("OutletSummaryTransaction", merchantTransactionList); reportViewer.LocalReport.DataSources.Add(A); ReportUtility reportUtility = new ReportUtility(); MFSFileManager fileManager = new MFSFileManager(); return(reportUtility.GenerateReport(reportViewer, model.FileType)); } catch (Exception ex) { throw; } }
public byte[] ChainMerchantReport(ReportModel model) { StringBuilderService builder = new StringBuilderService(); string chainMerchantCode = null; string outletAccNo = builder.ExtractText(Convert.ToString(model.ReportOption), "outletAccNo", ","); string chainMerchantNo = builder.ExtractText(Convert.ToString(model.ReportOption), "mphone", ","); string reportType = builder.ExtractText(Convert.ToString(model.ReportOption), "reportType", ","); string reportViewType = builder.ExtractText(Convert.ToString(model.ReportOption), "reportViewType", ","); string fromDate = builder.ExtractText(Convert.ToString(model.ReportOption), "fromDate", ","); string toDate = builder.ExtractText(Convert.ToString(model.ReportOption), "toDate", ","); string dateType = builder.ExtractText(Convert.ToString(model.ReportOption), "dateType", ","); string outletCode = builder.ExtractText(Convert.ToString(model.ReportOption), "outletCode", "}"); if (chainMerchantCode == null) { chainMerchantCode = _chainMerchantService.GetChainMerchantCodeByMphone(chainMerchantNo); } //string chainMerchantCode = "1811050000040000"; // string chainMerchantNo = "01841700736"; // string outletAccNo = null; // string outletCode = null; // string reportType = "OSTR"; // string reportViewType = "Transaction Date"; // string fromDate = System.DateTime.Now.AddYears(-5).ToString(); // string toDate = System.DateTime.Now.ToString(); // string dateType = "Transaction Date"; if (reportViewType == "TD") { reportViewType = "Transaction Date"; } if (dateType == "TD") { dateType = "Transaction Date"; } ReportViewer reportViewer = new ReportViewer(); if (reportType == "ODTR") { List <OutletDetailsTransaction> OutletDetailsTransactionList = new List <OutletDetailsTransaction>(); var parentMerchantMphone = kycService.GetChainMerchantMphoneByCode(chainMerchantCode).ToString(); var parentReginfo = (Reginfo)kycService.GetClientInfoByMphone(parentMerchantMphone); OutletDetailsTransactionList = _chainMerchantService.GetOutletDetailsTransactionList(chainMerchantCode, outletAccNo, outletCode, reportType, reportViewType, fromDate, toDate, dateType).ToList(); reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTOutletDetailsTransaction.rdlc"); reportViewer.LocalReport.SetParameters(RptParamForOutletDetailsTransaction(fromDate, toDate, chainMerchantCode, parentMerchantMphone, parentReginfo.CompanyName)); ReportDataSource A = new ReportDataSource("OutletDetailsTransaction", OutletDetailsTransactionList); reportViewer.LocalReport.DataSources.Add(A); } else if (reportType == "OSTR") { List <OutletSummaryTransaction> outletSummaryTransactionList = new List <OutletSummaryTransaction>(); outletSummaryTransactionList = _chainMerchantService.GetOutletSummaryTransactionList(chainMerchantCode, outletAccNo, outletCode, reportType, reportViewType, fromDate, toDate, dateType).ToList(); var parentMerchantMphone = kycService.GetChainMerchantMphoneByCode(chainMerchantCode).ToString(); var parentReginfo = (Reginfo)kycService.GetClientInfoByMphone(parentMerchantMphone); string reportName = "Outlet Summary Transaction report"; reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTOutletSummaryTransaction.rdlc"); //Request.RequestUri(""); reportViewer.LocalReport.SetParameters(RptParamForOutletSummaryTransaction(fromDate, toDate, chainMerchantCode, reportViewType, reportName, parentMerchantMphone, parentReginfo.CompanyName)); ReportDataSource A = new ReportDataSource("OutletSummaryTransaction", outletSummaryTransactionList); reportViewer.LocalReport.DataSources.Add(A); } else if (reportType == "OTPTR") { List <OutletSummaryTransaction> OutletToParentSummaryTransactionList = new List <OutletSummaryTransaction>(); OutletToParentSummaryTransactionList = _chainMerchantService.GetOutletToParentTransSummaryList(chainMerchantCode, chainMerchantNo, outletAccNo, outletCode, reportType, reportViewType, fromDate, toDate, dateType).ToList(); string reportName = "Outlet To Parent Transaction report"; var parentMerchantMphone = kycService.GetChainMerchantMphoneByCode(chainMerchantCode).ToString(); var parentReginfo = (Reginfo)kycService.GetClientInfoByMphone(parentMerchantMphone); reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTOutletSummaryTransaction.rdlc"); //Request.RequestUri(""); reportViewer.LocalReport.SetParameters(RptParamForOutletSummaryTransaction(fromDate, toDate, chainMerchantCode, reportViewType, reportName, parentMerchantMphone, parentReginfo.CompanyName)); ReportDataSource A = new ReportDataSource("OutletSummaryTransaction", OutletToParentSummaryTransactionList); reportViewer.LocalReport.DataSources.Add(A); } else //if (reportType == "DSR") { List <OutletDailySummaryTransaction> outletDailySummaryTransactionList = new List <OutletDailySummaryTransaction>(); outletDailySummaryTransactionList = _chainMerchantService.GetOutletDailySummaryTransList(chainMerchantCode, outletAccNo, outletCode, reportType, fromDate, toDate, dateType).ToList(); string reportName = null; var parentMerchantMphone = kycService.GetChainMerchantMphoneByCode(chainMerchantCode).ToString(); var parentReginfo = (Reginfo)kycService.GetClientInfoByMphone(parentMerchantMphone); reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTOutletDailySummaryTrans.rdlc"); //Request.RequestUri(""); reportViewer.LocalReport.SetParameters(RptParamForOutletSummaryTransaction(fromDate, toDate, chainMerchantCode, reportViewType, reportName, parentMerchantMphone, parentReginfo.CompanyName)); ReportDataSource A = new ReportDataSource("OutletDailyTransaction", outletDailySummaryTransactionList); reportViewer.LocalReport.DataSources.Add(A); } ReportUtility reportUtility = new ReportUtility(); MFSFileManager fileManager = new MFSFileManager(); return(reportUtility.GenerateReport(reportViewer, model.FileType)); }