Files
BeWoPlaner/ReportImp/AufEigenenFuessenStehen/CustomReportCreator.cs

77 lines
2.6 KiB
C#

using System.Collections.Generic;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace AufEigenenFuessenStehen
{
public class CustomReportCreator : DefaultReportCreator
{
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
{
List<ServicesOverviewRO> lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
if (lROs.Count > 0)
{
var rootReport = CreateServicesOverviewReportForRo(lROs[0], serviceCategoryOid);
rootReport.CreateDocument();
for (int i = 1; i < lROs.Count; i++)
{
var lNext = CreateServicesOverviewReportForRo(lROs[i], serviceCategoryOid);
lNext.CreateDocument();
rootReport.Pages.AddRange(lNext.Pages);
}
return rootReport;
}
return new XtraReport();
}
public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
{
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
return CreateServicesOverviewReportForRo(ro, serviceCategoryOid);
}
public override XtraReport CreateReportForServicesOverviewRo(ServicesOverviewRO ro, string reportId)
{
return CreateServicesOverviewReportForRo(ro, null);
}
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid)
{
XtraReport report = null;
// eigener QB bzw. Leistungsnachweis für Soziotherapie
ServicesOverviewRO defaultRo = ServicesOverviewRO.CopyFromRO(ro);
ServicesOverviewRO sozioRo = ServicesOverviewRO.CopyFromRO(ro);
if (ro.Services != null)
{
foreach (ServicesOverviewRO.ServiceDetail s in ro.Services)
{
if (s.ServiceCategory.ToLower().Contains("soziotherapie") || s.ServiceCategory.ToLower().Contains("soziotherapeutisch"))
{
sozioRo.Services.Add(s);
}
else
{
defaultRo.Services.Add(s);
}
}
}
report = AddSubServicesOverviewReportToReport(report, new Stundenzettel(), defaultRo);
report = AddSubServicesOverviewReportToReport(report, new LeistungsnachweisSoziotherapie(), sozioRo);
if (report == null)
report = new XtraReport();
return report;
}
}
}