184 lines
7.6 KiB
C#
184 lines
7.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
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 PraxisPusteblume
|
|
{
|
|
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);
|
|
|
|
}
|
|
|
|
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid)
|
|
{
|
|
XtraReport report = null;
|
|
if (ro.CostBearer2SupportConceptList != null && ro.CostBearer2SupportConceptList.Count > 0)
|
|
{
|
|
//var orga = DAOFactory.GenericDAO.GetByID<Organisation>(ro.SupportConceptCostBearer.CostBearer.OrganisationOid);
|
|
|
|
ServicesOverviewRO praxisRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
ServicesOverviewRO ifsMedizinRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
ServicesOverviewRO ifsPsychRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
ServicesOverviewRO ifsEingangsdiagnostikRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
ServicesOverviewRO krankenkasseRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
ServicesOverviewRO defaultRo = ServicesOverviewRO.CopyFromRO(ro);
|
|
|
|
if (ro.Services != null)
|
|
{
|
|
foreach (ServicesOverviewRO.ServiceDetail s in ro.Services)
|
|
{
|
|
if (s.IsBillable)
|
|
{
|
|
if (s.ServiceCategory.ToLower().StartsWith("ifs "))
|
|
{
|
|
//if (s.CostBearer.Contains("Bezirk Oberbayern - IFS"))
|
|
//{
|
|
|
|
// if (!s.ServiceDescription.ToLower().Contains("offenes beratungsangebot"))
|
|
// {
|
|
// ifsPsychRo.Services.Add(s);
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
// ifsEingangsdiagnostikRo.Services.Add(s);
|
|
//}
|
|
if (s.CostBearer.Contains("- IFS"))
|
|
{
|
|
|
|
if (!s.ServiceDescription.ToLower().Contains("offenes beratungsangebot"))
|
|
{
|
|
ifsPsychRo.Services.Add(s);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
krankenkasseRo.Services.Add(s);
|
|
krankenkasseRo.Costbearer = s.CostBearer;
|
|
}
|
|
|
|
//if (s.ServiceDescription.Contains("Heilpädagogik") ||
|
|
// s.ServiceDescription.Contains("Psychologie"))
|
|
//{
|
|
// ifsPsychRo.Services.Add(s);
|
|
//}
|
|
//else
|
|
//{
|
|
// ifsMedizinRo.Services.Add(s);
|
|
//}
|
|
}
|
|
else if (s.CostBearer.Contains("Bezirk Oberbayern"))
|
|
{
|
|
praxisRo.Services.Add(s);
|
|
|
|
}
|
|
else
|
|
{
|
|
defaultRo.Services.Add(s);
|
|
}
|
|
}
|
|
}
|
|
// Für KrankenkassenRO muss die Eingangsdiagnostik rausgesucht werden, weil das Datum im QB auftauchen soll
|
|
// Das Datum wird, wenn es eins gibt, in RequestedStartDate geschrieben
|
|
var eingangsdiagnostik = DAOFactory.SearchDAO.GetServiceRecordsForServiceDescriptionAndCustomer(60, ro.CustomerOid);
|
|
if (eingangsdiagnostik != null && eingangsdiagnostik.Count > 0)
|
|
{
|
|
krankenkasseRo.RequestedStartDate = null;
|
|
|
|
eingangsdiagnostik = eingangsdiagnostik.OrderBy(e => e.Start).ToList();
|
|
krankenkasseRo.RequestedStartDate = string.Format("{0:dd.MM.yyyy}", eingangsdiagnostik[0].Start);
|
|
}
|
|
}
|
|
|
|
report = AddReportToReport<QuittierungsbelegPraxis>(report, praxisRo);
|
|
report = AddReportToReport<QuittierungsbelegIfsEingangsdiagnostik>(report, ifsEingangsdiagnostikRo);
|
|
report = AddReportToReport<QuittierungsbelegIfs>(report, ifsPsychRo);
|
|
report = AddReportToReport<QuittierungsbelegPraxis>(report, ifsMedizinRo);
|
|
report = AddReportToReport<LeistungsnachweisKrankenkasse>(report, krankenkasseRo);
|
|
report = AddReportToReport<Quittierungsbeleg>(report, defaultRo);
|
|
|
|
|
|
//report = AddReportToReport(report, eingliederungshilfe);
|
|
|
|
|
|
}
|
|
|
|
if (report == null)
|
|
report = new XtraReport();
|
|
|
|
return report;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|