Files
BeWoPlaner/ReportImp/AspBegleitungNrw/Reporting/CustomReportCreator.cs

76 lines
3.1 KiB
C#

using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.DefaultReports;
using BeWo.Report.ReportObjects;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceImplementations;
using DevExpress.XtraReports.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AspBegleitungNrw.Reporting
{
public class CustomReportCreator : DefaultReportCreator
{
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende)
{
var os = new OperationsServiceImp();
var m = os.GetMandator2(false);
List<ServicesOverviewRO> lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid, true, nurFehlende);
if (lROs.Count > 0)
{
String reportId = null;
if (orgaOid > 0)
{
var organisation = DAOFactory.GenericDAO.LoadByID<Organisation>(orgaOid);
if (organisation != null)
reportId = organisation.Name;
}
var lServiceOverviewAllCustomersReport = this.FindReportImp<ServicesOverviewRO>(reportId);
lServiceOverviewAllCustomersReport.SetReportDataSource(lROs[0]);
(lServiceOverviewAllCustomersReport as XtraReport).CreateDocument();
var Report = lServiceOverviewAllCustomersReport as XtraReport;
for (int i = 1; i < lROs.Count; i++)
{
var lNext = FindReportImp<ServicesOverviewRO>(reportId);
lNext.SetReportDataSource(lROs[i]);
(lNext as XtraReport).CreateDocument();
Report.Pages.AddRange((lNext as XtraReport).Pages);
}
return lServiceOverviewAllCustomersReport as XtraReport;
}
return new XtraReport();
}
public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
{
var os = new OperationsServiceImp();
var m = os.GetMandator2(false);
String reportId = null;
if (orgaOid > 0)
{
var organisation = DAOFactory.GenericDAO.LoadByID<Organisation>(orgaOid);
if (organisation != null)
reportId = organisation.Name;
}
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
var lServiceOverviewSingleCustomerReport = this.FindReportImp<ServicesOverviewRO>(reportId);
if (ro != null)
{
lServiceOverviewSingleCustomerReport.SetReportDataSource(ro);
}
return lServiceOverviewSingleCustomerReport as XtraReport;
}
}
}