152 lines
4.7 KiB
C#
152 lines
4.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWoWalzPaiva
|
|
{
|
|
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, false, null, true, false);
|
|
|
|
if (lROs.Count > 0)
|
|
{
|
|
|
|
var rootReport = CreateServicesOverviewReportForRo(lROs[0], serviceCategoryOid);
|
|
if (rootReport.Pages.Count == 0)
|
|
{
|
|
rootReport.CreateDocument();
|
|
}
|
|
|
|
|
|
for (int i = 1; i < lROs.Count; i++)
|
|
{
|
|
var lNext = CreateServicesOverviewReportForRo(lROs[i], serviceCategoryOid);
|
|
if (lNext.Pages.Count == 0)
|
|
{
|
|
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;
|
|
|
|
ServicesOverviewRO flsRo = 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"))
|
|
{
|
|
sozioRo.Services.Add(s);
|
|
}
|
|
else if (s.IsBillable)
|
|
{
|
|
flsRo.Services.Add(s);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
report = AddReportToReport(report, flsRo, false);
|
|
report = AddReportToReport(report, sozioRo, true);
|
|
|
|
//report = AddReportToReport(report, eingliederungshilfe);
|
|
|
|
if (report == null)
|
|
report = new XtraReport();
|
|
return report;
|
|
}
|
|
|
|
private XtraReport AddReportToReport(XtraReport report, ServicesOverviewRO ro, bool isSozio)
|
|
{
|
|
if (ro.Services.Count > 0)
|
|
{
|
|
if (report == null)
|
|
{
|
|
if (isSozio)
|
|
{
|
|
report = new QuittierungsbelegSoziotherapie();
|
|
((QuittierungsbelegSoziotherapie)report).SetReportDataSource(ro);
|
|
}
|
|
else
|
|
{
|
|
if (ro.StartDate < new DateTime(2019, 1, 1))
|
|
{
|
|
report = new QuittierungsbelegBeWo2();
|
|
((QuittierungsbelegBeWo2) report).SetReportDataSource(ro);
|
|
}
|
|
else
|
|
{
|
|
report = new QuittierungsbelegBeWo();
|
|
((QuittierungsbelegBeWo)report).SetReportDataSource(ro);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (report.Pages.Count == 0)
|
|
{
|
|
report.CreateDocument();
|
|
}
|
|
|
|
XtraReport newReport = null;
|
|
if (isSozio)
|
|
{
|
|
newReport = new QuittierungsbelegSoziotherapie();
|
|
((QuittierungsbelegSoziotherapie)newReport).SetReportDataSource(ro);
|
|
}
|
|
else
|
|
{
|
|
newReport = new QuittierungsbelegBeWo();
|
|
((QuittierungsbelegBeWo)newReport).SetReportDataSource(ro);
|
|
}
|
|
if (newReport != null)
|
|
{
|
|
newReport.CreateDocument();
|
|
report.Pages.AddRange(newReport.Pages);
|
|
}
|
|
}
|
|
}
|
|
return report;
|
|
}
|
|
|
|
}
|
|
}
|