Exemple #1
0
        private void bindReport()
        {
            int clientID = Core.SessionHelper.getClientId();
            List <CRM.Data.Entities.vw_ClaimsClosedListing> reportData = null;

            using (RerportManager report = new RerportManager()) {
                reportData = report.claimsClosedListing(clientID);
            }


            if (reportData != null)
            {
                reportViewer.Reset();
                reportViewer.ProcessingMode = ProcessingMode.Local;

                reportViewer.LocalReport.DataSources.Clear();

                reportViewer.LocalReport.EnableExternalImages = true;

                ReportDataSource reportDataSource = new ReportDataSource();
                reportDataSource.Name  = "DataSet1";
                reportDataSource.Value = reportData;

                reportViewer.LocalReport.DataSources.Add(reportDataSource);

                reportViewer.LocalReport.ReportPath = Server.MapPath("~/Protected/Reports/ClaimClosed/ClaimsClosedListing.rdlc");
            }
        }
        /// <summary>
        /// Generate report for Adjuster Payroll For All Billed Summary
        /// </summary>
        private void GenerateAdjusterPayrollSummary()
        {
            int    adjusterId = 0;
            string branchId   = string.Empty;
            int    clientID   = Core.SessionHelper.getClientId();
            Expression <Func <vw_AdjusterPayrollForAllBilled, bool> > predicate = null;
            List <vw_AdjusterPayrollForAllBilled> reportData = null;

            predicate = PredicateBuilder.True <CRM.Data.Entities.vw_AdjusterPayrollForAllBilled>();
            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.AdjusterPayrollAllBilled(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  = "AdjusterPayrollForAllBilled";
                reportDataSource.Value = reportData;
                reportViewer.LocalReport.DataSources.Add(reportDataSource);

                // check for  AdjusterPayrollForAllBilledWithoutReimbursable
                // check for IsIncluded Reimbursable
                if (cbxIncludeReimbursable.Checked)
                {
                    reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Protected/Reports/payroll/AdjusterPayrollForAllBilled.rdlc");
                }
                else
                {
                    reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Protected/Reports/payroll/AdjusterPayrollForAllBilledWithoutReimbursable.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
                });
            }
        }