Files
BeWoPlaner/ReportImp/CaritasUnna/CustomReportCreator.cs
2020-08-17 15:50:00 +02:00

79 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace CaritasUnna
{
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);
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);
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);
}
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid)
{
IBeWoReport<ServicesOverviewRO> report = null;
if (!String.IsNullOrEmpty(ro.Costbearer))
{
if (ro.Costbearer.Contains("Wohnungslos"))
{
report = new StundenzettelWlh();
}
else
{
if (ro.SupportConceptCostBearer != null && ro.SupportConceptCostBearer.CostBearer != null && !String.IsNullOrWhiteSpace(ro.SupportConceptCostBearer.CostBearer.Function))
{
if (ro.SupportConceptCostBearer.CostBearer.Function.Replace(" ", "").Contains("§67"))
{
report = new StundenzettelWlh();
}
}
}
}
if (report == null)
report = new CaritasUnna.Stundenzettel();
report.SetReportDataSource(ro);
return report as XtraReport;
}
}
}