/// <summary> /// Generate report for AdjusterPayrollForAllBilledDetailed /// </summary> private void GenerateAdjusterPayrollForAllBilledDetailed() { int adjusterId = 0; string branchId = string.Empty; int clientID = Core.SessionHelper.getClientId(); Expression<Func<vw_AdjusterPayrollForAllBilledDetailed, bool>> predicate = null; List<vw_AdjusterPayrollForAllBilledDetailed> reportData = null; predicate = PredicateBuilder.True<CRM.Data.Entities.vw_AdjusterPayrollForAllBilledDetailed>(); predicate = predicate.And(x => x.ClientID == clientID); // check for selected adjuster, if any //if (ddlBranch.SelectedIndex > 0) // { // branchId = ddlBranch.SelectedValue; // predicate = predicate.And(x => x.BranchCode == branchId); // } // check for selected adjuster, if any if (ddlAdjusters.SelectedIndex > 0) { adjusterId = Convert.ToInt32(ddlAdjusters.SelectedValue); predicate = predicate.And(x => x.AdjusterId == adjusterId); } // check date range if (!string.IsNullOrEmpty(txtFromDate.Text)) { predicate = predicate.And(x => x.InvoiceDate >= txtFromDate.Date); } if (!string.IsNullOrEmpty(txtToDate.Text)) { predicate = predicate.And(x => x.InvoiceDate <= txtToDate.Date); } // check for All billed services and expenses if (rbtAllBilledServicesAndExpenses.Checked) { predicate = predicate.And(x => x.isBillable == rbtAllBilledServicesAndExpenses.Checked); } tabPanelReport.Visible = true; //int adjusterID = 0; using (RerportManager report = new RerportManager()) { reportData = report.AdjusterPayrollAllBilledDetailed(predicate); } //Invoice = InvoiceManager. // old report if (reportData != null) { reportViewer.Reset(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.EnableExternalImages = true; ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "AdjusterPayrollForAllBilledDetailed"; reportDataSource.Value = reportData; reportViewer.LocalReport.DataSources.Add(reportDataSource); // reportViewer.LocalReport.Refresh(); // if (cbxIncludeReimbursable.Checked) //if(true) //{ using (RerportManager report = new RerportManager()) { //reportData = ReportDataSource reportDataSource1 = new ReportDataSource(); reportDataSource1.Name = "AdjusterNames"; reportDataSource1.Value = report.AdjusterName(); reportViewer.LocalReport.DataSources.Add(reportDataSource1); reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); // reportViewer.LocalReport.Refresh(); //reportViewer.LocalReport.SetParameters(new ReportParameter("AdjusterName", string.Format("{0} - {1}", txtFromDate.Text.Trim(), txtToDate.Text.Trim()))); } // this report contains subreport named payroll.rdlc reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Protected/Reports/payroll/AdjusterPayrollDetails.rdlc"); // reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Protected/Reports/payroll/AdjusterPayrollForAllBilledDetailed.rdlc"); //} //else //{ // reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Protected/Reports/payroll/AdjusterPayrollForAllBilledDetailedWithoutReimbursable.rdlc"); //} } }
// subreport viewer void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e) { // report code int adjusterId = 0; string branchId = string.Empty; int clientID = Core.SessionHelper.getClientId(); Expression<Func<vw_AdjusterPayrollForAllBilledDetailed, bool>> predicate = null; List<vw_AdjusterPayrollForAllBilledDetailed> reportData = null; predicate = PredicateBuilder.True<CRM.Data.Entities.vw_AdjusterPayrollForAllBilledDetailed>(); predicate = predicate.And(x => x.ClientID == clientID); // check for selected adjuster, if any // if (ddlBranch.SelectedIndex > 0) // { // branchId = ddlBranch.SelectedValue; // predicate = predicate.And(x => x.BranchCode == branchId); // } // check for selected adjuster, if any if (ddlAdjusters.SelectedIndex > 0) { adjusterId = Convert.ToInt32(ddlAdjusters.SelectedValue); predicate = predicate.And(x => x.AdjusterId == adjusterId); } // check date range if (!string.IsNullOrEmpty(txtFromDate.Text)) { predicate = predicate.And(x => x.InvoiceDate >= txtFromDate.Date); } if (!string.IsNullOrEmpty(txtToDate.Text)) { predicate = predicate.And(x => x.InvoiceDate <= txtToDate.Date); } // check for All billed services and expenses if (rbtAllBilledServicesAndExpenses.Checked) { predicate = predicate.And(x => x.isBillable == rbtAllBilledServicesAndExpenses.Checked); } tabPanelReport.Visible = true; //int adjusterID = 0; using (RerportManager report = new RerportManager()) { reportData = report.AdjusterPayrollAllBilledDetailed(predicate); } // get adjusterName from the parameters string adjusterName = e.Parameters[0].Values[0]; // remove all previously attached Datasources. e.DataSources.Clear(); //Expression<Func<vw_AdjusterPayrollForAllBilledDetailed, bool>> predicate = null; //predicate = PredicateBuilder.True<CRM.Data.Entities.vw_AdjusterPayrollForAllBilledDetailed>(); //predicate.And(x => x.AdjusterName == adjusterName); using (RerportManager report = new RerportManager()) { // var reportData = report.AdjusterPayrollAllBilledDetailed(predicate); // Retrieve payrollData list based on adjusterName var payrollData = from m in reportData where m.AdjusterName == adjusterName select m; // add retrieved dataset or you can call it list to data source e.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource() { Name = "AdjusterPayrollForAllBilledDetailed", Value = payrollData }); } }