196 lines
6.2 KiB
C#
196 lines
6.2 KiB
C#
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraReports.UI;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using TranskulturellesBetreuungsbuero;
|
|
|
|
namespace TranskulturellesBetreuungsbuero
|
|
{
|
|
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);
|
|
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 CreateServiceOverviewReportForCustomers(IList<long> customerOids, int month, int year, long? orgaOid, long? empOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende)
|
|
{
|
|
var roList = new List<ServicesOverviewRO>();
|
|
|
|
foreach (var coid in customerOids)
|
|
{
|
|
var ro = ServicesOverviewRO.Create(coid, month, year, true, orgaOid ?? 0, empOid ?? 0, startDay, endDay, serviceCategoryOid);
|
|
if (ro != null)
|
|
{
|
|
roList.Add(ro);
|
|
}
|
|
}
|
|
|
|
if (roList.Count > 0)
|
|
{
|
|
var rootReport = CreateServicesOverviewReportForRo(roList[0], serviceCategoryOid);
|
|
rootReport.CreateDocument();
|
|
for (int i = 1; i < roList.Count; i++)
|
|
{
|
|
var lNext = CreateServicesOverviewReportForRo(roList[i], serviceCategoryOid);
|
|
lNext.CreateDocument();
|
|
rootReport.Pages.AddRange(lNext.Pages);
|
|
}
|
|
|
|
return rootReport;
|
|
}
|
|
|
|
return new XtraReport();
|
|
}
|
|
|
|
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid)
|
|
{
|
|
ServicesOverviewRO defaultRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
ServicesOverviewRO sozioRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
|
|
if (ro.Services != null)
|
|
{
|
|
foreach (ServicesOverviewRO.ServiceDetail s in ro.Services)
|
|
{
|
|
ServicesOverviewRO.CreateSignatureString(s);
|
|
|
|
if (s.ServiceCategory.ToLower().Contains("sozio"))
|
|
{
|
|
sozioRo.Services.Add(s);
|
|
}
|
|
else
|
|
{
|
|
defaultRo.Services.Add(s);
|
|
}
|
|
}
|
|
}
|
|
|
|
XtraReport report = null;
|
|
report = AddReportToReport<Quittierungsbeleg>(report, defaultRo);
|
|
report = AddReportToReport<LeistungsnachweisSoziotherapie>(report, sozioRo);
|
|
|
|
if (report == null)
|
|
report = new XtraReport();
|
|
|
|
return report;
|
|
}
|
|
|
|
public override XtraReport CreateReportForServicesOverviewRo(ServicesOverviewRO ro, string reportId)
|
|
{
|
|
return CreateServicesOverviewReportForRo(ro, null);
|
|
}
|
|
|
|
private XtraReport AddReportToReport<T>(XtraReport report, ServicesOverviewRO ro) where T : XtraReport, IBeWoReport<ServicesOverviewRO>, new()
|
|
{
|
|
if (ro.Services.Count > 0)
|
|
{
|
|
if (report == null)
|
|
{
|
|
report = new T();
|
|
((T)report).SetReportDataSource(ro);
|
|
}
|
|
else
|
|
{
|
|
if (report.Pages.Count == 0)
|
|
{
|
|
report.CreateDocument();
|
|
}
|
|
|
|
XtraReport newReport = new T();
|
|
((T)newReport).SetReportDataSource(ro);
|
|
|
|
newReport.CreateDocument();
|
|
report.Pages.AddRange(newReport.Pages);
|
|
}
|
|
}
|
|
return report;
|
|
}
|
|
|
|
public override XtraReport CreateFlsReport(string flsReportId, string subType)
|
|
{
|
|
#region Standard
|
|
string flsReportPath = BS.Shared.Core.Utils.CreateSavePath(TempPath, flsReportId + ".xml");
|
|
var lFLSAnalysisDataReportDC = Utils.XMLDeserialize<FLSAnalysisDataReportDC>(flsReportPath);
|
|
|
|
|
|
IBeWoReport<FLSReportRO> lFLSReportObject = null;
|
|
|
|
if (!String.IsNullOrEmpty(subType))
|
|
lFLSReportObject = this.FindReportImp<FLSReportRO>(subType);
|
|
|
|
if (lFLSReportObject == null)
|
|
lFLSReportObject = this.FindReportImp<FLSReportRO>(lFLSAnalysisDataReportDC.ShowGroups
|
|
? "FLSAuswertung"
|
|
: "Leistungsdokumentation");
|
|
#endregion
|
|
|
|
// lFLSAnalysisDataReportDC.ReportType = 0: Nach MA
|
|
// lFLSAnalysisDataReportDC.ReportType = 1: Nach Klient:innen
|
|
|
|
var ro = FLSReportRO.Create(lFLSAnalysisDataReportDC);
|
|
|
|
Dictionary<long, Customer> customerDict = new Dictionary<long, Customer>();
|
|
Dictionary<long, Customer> employeeDict = new Dictionary<long, Customer>();
|
|
|
|
// Im RO muss in den Klienten stehen, ob es Hauptbetreuung (FLSReportGroups.FLSReportDetail.CustomValue1) oder
|
|
// Stellvertretung (FLSReportGroups.FLSReportDetail.CustomValue2) ist
|
|
foreach (var group in ro.FLSReportGroups)
|
|
{
|
|
foreach (var detail in group.FLSReportDetails)
|
|
{
|
|
if (detail.ServiceRecords != null)
|
|
{
|
|
foreach (var sr in detail.ServiceRecords)
|
|
{
|
|
if (sr.CustomerOid.HasValue && !customerDict.ContainsKey(sr.CustomerOid.Value))
|
|
{
|
|
|
|
}
|
|
if (sr.EmployeeOid.HasValue && !employeeDict.ContainsKey(sr.EmployeeOid.Value))
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
lFLSReportObject.SetReportDataSource(ro);
|
|
return lFLSReportObject as XtraReport;
|
|
}
|
|
}
|
|
}
|