178 lines
7.1 KiB
C#
178 lines
7.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using DevExpress.XtraReports.Design;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace AkggMid
|
|
{
|
|
public class CustomReportCreator : DefaultReportCreator
|
|
{
|
|
public override XtraReport CreateServiceOverviewReportNew(int month, int year, QBFilterEnum filterType, long? customerOid, long? teamOid, long? empOid, long? orgaOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende)
|
|
{
|
|
return base.CreateServiceOverviewReportNew(month, year, filterType, customerOid, teamOid, empOid, orgaOid, serviceCategoryOid, startDay, endDay, nurFehlende);
|
|
}
|
|
|
|
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende)
|
|
{
|
|
List<ServicesOverviewRO> lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid, true, nurFehlende);
|
|
|
|
if (lROs.Count > 0)
|
|
{
|
|
|
|
var lServiceOverviewAllCustomersReport = ErstelleReport(lROs[0]);
|
|
lServiceOverviewAllCustomersReport.SetReportDataSource(lROs[0]);
|
|
(lServiceOverviewAllCustomersReport as XtraReport).CreateDocument();
|
|
var Report = lServiceOverviewAllCustomersReport as XtraReport;
|
|
|
|
for (int i = 1; i < lROs.Count; i++)
|
|
{
|
|
var lNext = ErstelleReport(lROs[i]);
|
|
lNext.SetReportDataSource(lROs[i]);
|
|
(lNext as XtraReport).CreateDocument();
|
|
Report.Pages.AddRange((lNext as XtraReport).Pages);
|
|
}
|
|
|
|
return lServiceOverviewAllCustomersReport as XtraReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
|
|
{
|
|
if (customerOid == 0)
|
|
{
|
|
return CreateSbdLeistungsnachweisForSingleCustomerReport(customerOid, month, year, orgaOid, empOid, serviceCategoryOid ?? 0, startDay, endDay, false, "hessen");
|
|
}
|
|
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
|
|
var lServiceOverviewSingleCustomerReport = ErstelleReport(ro);
|
|
|
|
lServiceOverviewSingleCustomerReport.SetReportDataSource(ro);
|
|
|
|
return lServiceOverviewSingleCustomerReport as XtraReport;
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
var sortedList = roList.OrderBy(r => r.CustomerLastName + ", " + r.CustomerFirstName).ToList();
|
|
|
|
if (sortedList.Count > 0)
|
|
{
|
|
var rootReport = CreateReportForServicesOverviewRo(sortedList[0], "");
|
|
if (rootReport.Pages.Count == 0)
|
|
{
|
|
rootReport.CreateDocument();
|
|
}
|
|
|
|
|
|
for (int i = 1; i < sortedList.Count; i++)
|
|
{
|
|
var lNext = CreateReportForServicesOverviewRo(sortedList[i], "");
|
|
if (lNext.Pages.Count == 0)
|
|
{
|
|
lNext.CreateDocument();
|
|
}
|
|
|
|
rootReport.Pages.AddRange(lNext.Pages);
|
|
}
|
|
|
|
return rootReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
public override XtraReport CreateReportForServicesOverviewRo(ServicesOverviewRO ro, String reportId)
|
|
{
|
|
IBeWoReport<ServicesOverviewRO> report = ErstelleReport(ro);
|
|
|
|
report.SetReportDataSource(ro);
|
|
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
private IBeWoReport<ServicesOverviewRO> ErstelleReport(ServicesOverviewRO ro)
|
|
{
|
|
if (ro.Costbearer == null)
|
|
{
|
|
if (ro.CustomerOid > 0)
|
|
{
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(ro.CustomerOid);
|
|
foreach (var sc in c.SupportConcepts)
|
|
{
|
|
foreach (var c2s in sc.CostBearer2SupportConceptList)
|
|
{
|
|
if (c2s.StartDate <= ro.EndDate && c2s.EndDate >= ro.StartDate)
|
|
{
|
|
ro.Costbearer = c2s.CostBearer.Organisation.Name;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
if (ro.Costbearer == "SEK -Jugend und Familie-")
|
|
{
|
|
return new LeistungsnachweisJugendamt();
|
|
}
|
|
|
|
bool hatBlutzuckerMessung = false;
|
|
bool hatBlutzuckerPumpe = false;
|
|
|
|
foreach (var item in ro.Services)
|
|
{
|
|
if (!String.IsNullOrEmpty(item.Notice3))
|
|
{
|
|
hatBlutzuckerMessung = true;
|
|
}
|
|
if (!String.IsNullOrEmpty(item.Notice4))
|
|
{
|
|
hatBlutzuckerPumpe = true;
|
|
}
|
|
}
|
|
|
|
if (hatBlutzuckerPumpe)
|
|
{
|
|
return new LeistungsnachweisSozialamtMitBlutzuckerPumpe();
|
|
}
|
|
if (hatBlutzuckerMessung)
|
|
{
|
|
return new LeistungsnachweisSozialamtMitBlutzucker();
|
|
}
|
|
|
|
return new LeistungsnachweisSozialamt();
|
|
}
|
|
|
|
public override XtraReport CreateSbdLeistungsnachweisForAllCustomers(int month, int year, long orgaOid, long empOid, long serviceCategoryOid, int startDay, int endDay, bool checkServiceRecords, string bundesland)
|
|
{
|
|
return CreateReportForStundenaufstellungROs(SbdStundenaufstellungRO.Create(month, year, orgaOid, empOid, serviceCategoryOid, startDay, endDay, true, "hessen"));
|
|
}
|
|
|
|
public override XtraReport CreateSbdLeistungsnachweisForSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long serviceCategoryOid, int startDay, int endDay, bool checkServiceRecords, string bundesland)
|
|
{
|
|
return CreateReportForStundenaufstellungROs(SbdStundenaufstellungRO.Create(customerOid, month, year, orgaOid, empOid, serviceCategoryOid, startDay, endDay, true, "hessen", false));
|
|
}
|
|
}
|
|
}
|