2210 lines
94 KiB
C#
2210 lines
94 KiB
C#
using BeWo.Data;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Data.Security;
|
|
using BeWo.Report.DefaultReports;
|
|
using BeWo.Report.DefaultReports.Straffaelligenhilfe;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.Plugins;
|
|
using BeWo.Service.Reporting;
|
|
using BeWo.Service.Reporting.Straffaelligenhilfe;
|
|
using BeWo.Service.ServiceImplementations;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.ReportRequests;
|
|
using DevExpress.XtraReports.UI;
|
|
using DevExpress.XtraRichEdit;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Web;
|
|
|
|
namespace BeWo.Report
|
|
{
|
|
public class DefaultReportCreator : AbstractReportCreator
|
|
{
|
|
public IBeWoReport<T> FindReportImp<T>()
|
|
{
|
|
return FindReportImp<T>(null, null);
|
|
}
|
|
|
|
public IBeWoReport<T> FindReportImp<T>(string specificReportId)
|
|
{
|
|
return this.FindReportImp<T>(specificReportId, null);
|
|
}
|
|
|
|
public IBeWoReport<T> FindReportImp<T>(string specificReportId, string typename)
|
|
{
|
|
IBeWoReport<T> result = null;
|
|
|
|
if (TemplateOid.HasValue && TemplateOid.Value > 0)
|
|
{
|
|
var template = DAOFactory.GenericDAO.LoadByID<ReportTemplate>(TemplateOid.Value);
|
|
|
|
if (!String.IsNullOrEmpty(template.ReferenceClass))
|
|
{
|
|
specificReportId = template.ReferenceClass;
|
|
}
|
|
else if (!String.IsNullOrEmpty(template.DisplayName))
|
|
{
|
|
specificReportId = template.DisplayName;
|
|
}
|
|
}
|
|
Type[] lAllReportTypes = null;
|
|
|
|
lAllReportTypes = PluginLoader.GetAllCustomerTypes();
|
|
if (lAllReportTypes != null)
|
|
{
|
|
result = FindReportImp<T>(lAllReportTypes, specificReportId, typename, true);
|
|
}
|
|
|
|
if (result == null)
|
|
{
|
|
lAllReportTypes = typeof(IBeWoReport<T>).Assembly.GetTypes();
|
|
result = FindReportImp<T>(lAllReportTypes, specificReportId, typename, false);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public IBeWoReport<T> FindReportImp<T>(Type[] lAllReportTypes, string specificReportId, string typename, bool doNotUseReportsWithIdentifier)
|
|
{
|
|
IBeWoReport<T> result = null;
|
|
|
|
var typeOfT = typeof(T);
|
|
|
|
if (!string.IsNullOrEmpty(specificReportId) && !string.IsNullOrEmpty(typename))
|
|
{
|
|
var cbSpecific = lAllReportTypes
|
|
.Where(i => typeof(IBeWoReport<T>).IsAssignableFrom(i))
|
|
.FirstOrDefault(t => t.GetCustomAttributes(typeof(IDSpecificClassAttribute), true)
|
|
.ToList()
|
|
.Exists(i =>
|
|
{
|
|
var attr = (IDSpecificClassAttribute)i;
|
|
if (attr.Identifiers != null)
|
|
return attr.Identifiers.Contains(specificReportId);
|
|
if (!String.IsNullOrEmpty(attr.Identifier))
|
|
return attr.Identifier.Equals(specificReportId);
|
|
return false;
|
|
|
|
}
|
|
) && t.FullName == typename);
|
|
if (cbSpecific != null)
|
|
result = Activator.CreateInstance(cbSpecific) as IBeWoReport<T>;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(typename))
|
|
{
|
|
var cbSpecific = lAllReportTypes.FirstOrDefault(t => t.FullName == typename);
|
|
if (cbSpecific != null)
|
|
result = Activator.CreateInstance(cbSpecific) as IBeWoReport<T>;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(specificReportId))
|
|
{
|
|
var cbSpecific = lAllReportTypes
|
|
.Where(i => typeof(IBeWoReport<T>).IsAssignableFrom(i))
|
|
.FirstOrDefault(t => t.GetCustomAttributes(typeof(IDSpecificClassAttribute), true)
|
|
.ToList()
|
|
.Exists(i =>
|
|
{
|
|
var attr = (IDSpecificClassAttribute)i;
|
|
if (attr.Identifiers != null)
|
|
{
|
|
return attr.Identifiers.Contains(specificReportId);
|
|
}
|
|
if (!String.IsNullOrEmpty(attr.Identifier))
|
|
{
|
|
if (specificReportId == "SammelrechnungNachKlienten")
|
|
{
|
|
var test = attr.Identifier.Equals(specificReportId);
|
|
}
|
|
return attr.Identifier.Equals(specificReportId);
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
));
|
|
if (cbSpecific != null)
|
|
result = Activator.CreateInstance(cbSpecific) as IBeWoReport<T>;
|
|
}
|
|
|
|
if (result == null)
|
|
{
|
|
foreach (var iType in lAllReportTypes)
|
|
if (typeof(IBeWoReport<T>).IsAssignableFrom(iType))
|
|
if (iType.Name == specificReportId)
|
|
result = Activator.CreateInstance(iType) as IBeWoReport<T>;
|
|
}
|
|
|
|
if (result == null)
|
|
{
|
|
var list = lAllReportTypes.Where(t => typeof(IBeWoReport<T>).IsAssignableFrom(t)).ToList();
|
|
|
|
if (list.Count == 1)
|
|
{
|
|
var type = list[0];
|
|
if (doNotUseReportsWithIdentifier)
|
|
{
|
|
var attrs = type.GetCustomAttributes(typeof(IDSpecificClassAttribute), true);
|
|
if (attrs.Length == 0)
|
|
return Activator.CreateInstance(type) as IBeWoReport<T>;
|
|
}
|
|
else
|
|
{
|
|
result = Activator.CreateInstance(type) as IBeWoReport<T>;
|
|
}
|
|
|
|
}
|
|
else if (list.Count > 1)
|
|
{
|
|
foreach (var type in list)
|
|
{
|
|
var attrs = type.GetCustomAttributes(typeof(IDSpecificClassAttribute), true);
|
|
if (attrs.Length == 0)
|
|
{
|
|
if (String.IsNullOrEmpty(typename) || type.FullName == typename)
|
|
{
|
|
return Activator.CreateInstance(type) as IBeWoReport<T>;
|
|
}
|
|
}
|
|
}
|
|
if (!doNotUseReportsWithIdentifier)
|
|
{
|
|
result = Activator.CreateInstance(list[0]) as IBeWoReport<T>;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public override XtraReport CreateCustomerDataReport(long customerOid)
|
|
{
|
|
var lCustomerDataReport = FindReportImp<CustomerDataRO>();
|
|
lCustomerDataReport.SetReportDataSource(CustomerDataRO.Create(MapperFactory.CustomerDC_Customer.MapToNewDC(DAOFactory.GenericDAO.LoadByID<Customer>(customerOid))));
|
|
return lCustomerDataReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateCustomerInvoiceReport(long invoiceOid)
|
|
{
|
|
|
|
IBeWoReport<InvoiceCustomerRO> lInvoiceCustomerReport = FindReportImp<InvoiceCustomerRO>();
|
|
lInvoiceCustomerReport.SetReportDataSource(InvoiceCustomerRO.Create(MapperFactory.InvoiceBaseDC_InvoiceBase.MapToNewDC(DAOFactory.GenericDAO.LoadByID<InvoiceBase>(invoiceOid))));
|
|
return lInvoiceCustomerReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateCustomerInvoiceReportMitQb(long invoiceOid)
|
|
{
|
|
|
|
IBeWoReport<InvoiceCustomerRO> lInvoiceCustomerReport = FindReportImp<InvoiceCustomerRO>();
|
|
|
|
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(invoiceOid);
|
|
|
|
lInvoiceCustomerReport.SetReportDataSource(InvoiceCustomerRO.Create(MapperFactory.InvoiceBaseDC_InvoiceBase.MapToNewDC(ib)));
|
|
|
|
var qb = CreateBelegeForInvoice(ib);
|
|
|
|
AddReportPagesToMaster(lInvoiceCustomerReport as XtraReport, qb);
|
|
|
|
return lInvoiceCustomerReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateAssessmentSheetReport(long customerOid, int month, int year)
|
|
{
|
|
IBeWoReport<AssessmentSheetRO> report = FindReportImp<AssessmentSheetRO>();
|
|
report.SetReportDataSource(AssessmentSheetRO.Create(DAOFactory.GenericDAO.LoadByID<Customer>(customerOid), new DateTime(year, month, 1)));
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateFlsReport(String flsReportId, String subType)
|
|
{
|
|
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");
|
|
|
|
lFLSReportObject.SetReportDataSource(FLSReportRO.Create(lFLSAnalysisDataReportDC));
|
|
return lFLSReportObject as XtraReport;
|
|
}
|
|
|
|
|
|
public override XtraReport CreateQueryReport(long queryOid, String queryReportId)
|
|
{
|
|
//Muss irgendwann mal in die GUI integriert werden
|
|
if (queryOid == 11000)
|
|
{
|
|
return CreateVgaStatistic(CreateQueryRO(queryOid, queryReportId), VgaTypeEnum.Vga);
|
|
}
|
|
if (queryOid == 11001)
|
|
{
|
|
return CreateVgaStatistic(CreateQueryRO(queryOid, queryReportId), VgaTypeEnum.Asa);
|
|
}
|
|
if (queryOid == 11002)
|
|
{
|
|
return CreateVgaStatistic(CreateQueryRO(queryOid, queryReportId), VgaTypeEnum.Tgv);
|
|
}
|
|
|
|
|
|
var query = DAOFactory.GenericDAO.LoadByID<Query>(queryOid);
|
|
|
|
if (query is null)
|
|
{
|
|
return new XtraReport();
|
|
}
|
|
|
|
var path = Utils.CreateSavePath(TempPath, queryReportId + ".xml");
|
|
|
|
var table = Utils.XMLDeserialize<DataTable>(path);
|
|
|
|
var queryReport = FindReportImp<QueryRO>(null, query.ReportTypeName);
|
|
|
|
var queryReportObject = QueryRO.Create(query, table);
|
|
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
|
|
private XtraReport CreateVgaStatistic(QueryRO qro, VgaTypeEnum vgaType)
|
|
{
|
|
DateTime start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
|
|
DateTime ende = start.AddMonths(1).AddTicks(-1);
|
|
|
|
if (qro.Rows.Count > 0)
|
|
{
|
|
start = new DateTime(start.Year, start.Month, 1);
|
|
|
|
DateTime dt = DateTime.Now;
|
|
if (DateTime.TryParse(qro.Rows[0].Field1.ToString(), out dt) && dt > DateTime.MinValue)
|
|
{
|
|
start = dt;
|
|
|
|
}
|
|
if (DateTime.TryParse(qro.Rows[0].Field2.ToString(), out dt) && dt < DateTime.MaxValue.Date)
|
|
{
|
|
ende = dt.AddTicks(-1);
|
|
}
|
|
}
|
|
StatisticBase statistik = null;
|
|
|
|
if (vgaType == VgaTypeEnum.Vga)
|
|
{
|
|
statistik = new VgaStatisticCreator();
|
|
}
|
|
else if (vgaType == VgaTypeEnum.Tgv)
|
|
{
|
|
statistik = new TgvStatistic();
|
|
}
|
|
else if (vgaType == VgaTypeEnum.Asa)
|
|
{
|
|
statistik = new AsaStatistic();
|
|
}
|
|
statistik.CreateStatistic(start, ende);
|
|
|
|
return CreateReportForStatistik(statistik);
|
|
}
|
|
|
|
private XtraReport CreateReportForStatistik(StatisticBase statistik)
|
|
{
|
|
XtraReport report = null;
|
|
|
|
if (statistik.VgaType == VgaTypeEnum.Vga)
|
|
{
|
|
report = new VgaStatistikReport();
|
|
var vsc = (VgaStatisticCreator)statistik;
|
|
((VgaStatistikReport)report).SetReportDataSource(vsc.VgaStatisticEfs, vsc.VgaStatisticAuflage153a, vsc.VgaStatisticAuflage153aSteuerstraf, vsc.VgaStatisticBewOhne, vsc.VgaStatisticBewMit, vsc.VgaStatisticGnadenverfahren);
|
|
|
|
}
|
|
else if (statistik.VgaType == VgaTypeEnum.Asa)
|
|
{
|
|
report = new AsaStatistikReport();
|
|
((AsaStatistikReport)report).SetReportDataSource(statistik as AsaStatistic);
|
|
}
|
|
else if (statistik.VgaType == VgaTypeEnum.Tgv)
|
|
{
|
|
report = new TgvStatistikReport();
|
|
((TgvStatistikReport)report).SetReportDataSource(statistik as TgvStatistic);
|
|
|
|
}
|
|
if (report == null)
|
|
{
|
|
report = new XtraReport();
|
|
}
|
|
|
|
return report;
|
|
}
|
|
|
|
public virtual QueryRO CreateQueryRO(long queryOid, String queryReportId)
|
|
{
|
|
var query = DAOFactory.GenericDAO.LoadByID<Query>(queryOid);
|
|
|
|
if (query != null)
|
|
{
|
|
|
|
var path = Path.Combine(TempPath, queryReportId + ".xml");
|
|
var table = Utils.XMLDeserialize<DataTable>(path);
|
|
|
|
return QueryRO.Create(query, table);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public override XtraReport CreateServiceInvoiceReport(String dcIds, long? invoiceBaseOid)
|
|
{
|
|
if (String.IsNullOrEmpty(dcIds) && invoiceBaseOid.HasValue)
|
|
{
|
|
var serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(invoiceBaseOid.Value);
|
|
dcIds = String.Format("{0}", serviceInvoice.Oid);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(dcIds))
|
|
{
|
|
var serviceInvoiceOid2CostbearerId = new Dictionary<long, string>();
|
|
var dcList = new List<ServiceInvoiceDC>();
|
|
|
|
var dcidStrs = dcIds.Split(';');
|
|
|
|
// Gehe jede ServiceItem Reference durch
|
|
foreach (var oidStr in dcidStrs)
|
|
{
|
|
var oid = long.Parse(oidStr);
|
|
// Lade ServiceInvoice
|
|
var invoice = DAOFactory.GenericDAO.LoadByID<ServiceInvoice>(oid);
|
|
var dc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(invoice);
|
|
// Füge dcListe hinzu
|
|
dcList.Add(dc);
|
|
|
|
// Falls ServiceInvoice Oid bereits in serviceInvoiceOid2CostbearerOid List (S2C List) ist, überspringe
|
|
if (serviceInvoiceOid2CostbearerId.ContainsKey(oid))
|
|
continue;
|
|
|
|
// ServiceInvoice Oid ist noch nicht in S2C List
|
|
|
|
// Frage, ob InvoiceId existiert
|
|
if (!String.IsNullOrEmpty(invoice.InvoiceBase.InvoiceId))
|
|
// Falls InvoiceId existiert
|
|
serviceInvoiceOid2CostbearerId.Add(oid, invoice.InvoiceBase.InvoiceId);
|
|
else
|
|
{
|
|
// Falls InvoiceId nicht existiert
|
|
// Gehe jede peroide von ServiceInvoice - ServiceInvoicePeriodList durch
|
|
foreach (var period in invoice.ServiceInvoicePeriodList)
|
|
{
|
|
try
|
|
{
|
|
if (period.SupportConceptApprovalPeriod != null)
|
|
{
|
|
// Falls periode - SupportConecptApprovalPeriod nicht leer ist, füge
|
|
AddCostBearerIdToDict(oid, serviceInvoiceOid2CostbearerId,
|
|
period.SupportConceptApprovalPeriod.CostBearer2SupportConcept);
|
|
|
|
}
|
|
foreach (var item in period.InvoiceItemList)
|
|
{
|
|
if (item.SupportConceptApprovalPeriodOid.HasValue)
|
|
{
|
|
var approvalPeriod =
|
|
DAOFactory.GenericDAO.LoadByID<SupportConceptApprovalPeriod>(item.SupportConceptApprovalPeriodOid.Value);
|
|
if (approvalPeriod.CostBearer2SupportConcept != null)
|
|
{
|
|
AddCostBearerIdToDict(oid, serviceInvoiceOid2CostbearerId, approvalPeriod.CostBearer2SupportConcept);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
//ignore
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
IBeWoReport<ServiceInvoiceRO> allReports = null;
|
|
|
|
foreach (var iDC in dcList)
|
|
{
|
|
String reportId = null;
|
|
if (serviceInvoiceOid2CostbearerId.ContainsKey(iDC.ServiceInvoiceOid.Value))
|
|
reportId = serviceInvoiceOid2CostbearerId[iDC.ServiceInvoiceOid.Value];
|
|
|
|
IBeWoReport<ServiceInvoiceRO> singleReport = FindReportImp<ServiceInvoiceRO>(reportId);
|
|
|
|
singleReport.SetReportDataSource(ServiceInvoiceRO.Create(iDC));
|
|
((XtraReport)singleReport).CreateDocument();
|
|
if (allReports == null)
|
|
allReports = singleReport;
|
|
else
|
|
((XtraReport)allReports).Pages.AddRange(((XtraReport)singleReport).Pages);
|
|
}
|
|
|
|
return allReports as XtraReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
public override XtraReport CreateServiceInvoiceReportMitQb(long invoiceBaseOid)
|
|
{
|
|
var serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(invoiceBaseOid);
|
|
|
|
var dc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(serviceInvoice);
|
|
|
|
String reportId = serviceInvoice.InvoiceBase.InvoiceId;
|
|
if (String.IsNullOrEmpty(reportId))
|
|
{
|
|
// Falls InvoiceId nicht existiert
|
|
// Gehe jede peroide von ServiceInvoice - ServiceInvoicePeriodList durch
|
|
foreach (var period in serviceInvoice.ServiceInvoicePeriodList)
|
|
{
|
|
if (String.IsNullOrEmpty(reportId) && period.SupportConceptApprovalPeriod != null)
|
|
{
|
|
// Falls periode - SupportConecptApprovalPeriod nicht leer ist, füge
|
|
reportId = period.SupportConceptApprovalPeriod.CostBearer2SupportConcept.CostBearer.ID;
|
|
if (String.IsNullOrEmpty(reportId) && period.SupportConceptApprovalPeriod.CostBearer2SupportConcept.CostBearer.IsSingleInvoicePerCustomer)
|
|
{
|
|
reportId = "Sammelrechnung";
|
|
}
|
|
}
|
|
|
|
|
|
foreach (var item in period.InvoiceItemList)
|
|
{
|
|
if (String.IsNullOrEmpty(reportId) && item.SupportConceptApprovalPeriodOid.HasValue)
|
|
{
|
|
var approvalPeriod =
|
|
DAOFactory.GenericDAO.LoadByID<SupportConceptApprovalPeriod>(item.SupportConceptApprovalPeriodOid.Value);
|
|
if (approvalPeriod.CostBearer2SupportConcept != null)
|
|
{
|
|
reportId = approvalPeriod.CostBearer2SupportConcept.CostBearer.ID;
|
|
if (String.IsNullOrEmpty(reportId) && approvalPeriod.CostBearer2SupportConcept.CostBearer.IsSingleInvoicePerCustomer)
|
|
{
|
|
reportId = "Sammelrechnung";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
IBeWoReport<ServiceInvoiceRO> invoiceReport = FindReportImp<ServiceInvoiceRO>(reportId);
|
|
|
|
invoiceReport.SetReportDataSource(ServiceInvoiceRO.Create(dc));
|
|
((XtraReport)invoiceReport).CreateDocument();
|
|
|
|
var qb = CreateBelegeForInvoice(serviceInvoice.InvoiceBase);
|
|
|
|
AddReportPagesToMaster(invoiceReport as XtraReport, qb);
|
|
|
|
return invoiceReport as XtraReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
public virtual void AddCostBearerIdToDict(long serviceInvoiceOid, Dictionary<long, string> serviceInvoiceOid2CostbearerId, CostBearer2SupportConcept c2s)
|
|
{
|
|
if (c2s != null && c2s.CostBearer != null)
|
|
{
|
|
var id = c2s.CostBearer.ID;
|
|
if (String.IsNullOrEmpty(id) && c2s.CostBearer.IsSingleInvoicePerCustomer)
|
|
id = "Sammelrechnung";
|
|
if (!serviceInvoiceOid2CostbearerId.ContainsKey(serviceInvoiceOid))
|
|
serviceInvoiceOid2CostbearerId.Add(serviceInvoiceOid, id);
|
|
}
|
|
}
|
|
|
|
public virtual XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
|
|
{
|
|
return CreateServiceOverviewAllCustomersReport(month, year, orgaOid, empOid, serviceCategoryOid, startDay, endDay, false);
|
|
|
|
}
|
|
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende)
|
|
{
|
|
var os = new OperationsServiceImp();
|
|
var m = os.GetMandator2(false);
|
|
if (m.AllowSbd)
|
|
{
|
|
return CreateSbdLeistungsnachweisForAllCustomers(month, year, orgaOid, empOid, serviceCategoryOid ?? 0, startDay, endDay, false, "nrw");
|
|
}
|
|
|
|
|
|
List<ServicesOverviewRO> lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid, true, nurFehlende);
|
|
|
|
return CreateServiceOverviewReportForROs(lROs, orgaOid);
|
|
}
|
|
|
|
public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
|
|
{
|
|
var os = new OperationsServiceImp();
|
|
var m = os.GetMandator2(false);
|
|
if (m.AllowSbd)
|
|
{
|
|
return CreateSbdLeistungsnachweisForSingleCustomerReport(customerOid, month, year, orgaOid, empOid, serviceCategoryOid ?? 0, startDay, endDay, false, "nrw");
|
|
|
|
}
|
|
|
|
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
|
|
|
|
var roList = new List<ServicesOverviewRO>();
|
|
if (ro != null)
|
|
{
|
|
roList.Add(ro);
|
|
}
|
|
|
|
return CreateServiceOverviewReportForROs(roList, orgaOid);
|
|
}
|
|
|
|
public virtual XtraReport CreateServiceOverviewReportForROs(List<ServicesOverviewRO> roList, long orgaOid)
|
|
{
|
|
if (roList.Count > 0)
|
|
{
|
|
String reportId = null;
|
|
if (orgaOid > 0)
|
|
{
|
|
var organisation = DAOFactory.GenericDAO.LoadByID<Organisation>(orgaOid);
|
|
if (organisation != null)
|
|
reportId = organisation.Name;
|
|
}
|
|
|
|
var lServiceOverviewAllCustomersReport = this.FindReportImp<ServicesOverviewRO>(reportId);
|
|
lServiceOverviewAllCustomersReport.SetReportDataSource(roList[0]);
|
|
(lServiceOverviewAllCustomersReport as XtraReport).CreateDocument();
|
|
var Report = lServiceOverviewAllCustomersReport as XtraReport;
|
|
|
|
for (int i = 1; i < roList.Count; i++)
|
|
{
|
|
var lNext = FindReportImp<ServicesOverviewRO>(reportId);
|
|
lNext.SetReportDataSource(roList[i]);
|
|
(lNext as XtraReport).CreateDocument();
|
|
Report.Pages.AddRange((lNext as XtraReport).Pages);
|
|
}
|
|
|
|
return lServiceOverviewAllCustomersReport as XtraReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
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)
|
|
{
|
|
DateTime startDate = new DateTime(year, month, startDay);
|
|
DateTime endDate = new DateTime(year, month, endDay);
|
|
|
|
return CreateServiceOverviewReportNew((QBFilterEnum)filterType, customerOid, teamOid, empOid, orgaOid, serviceCategoryOid, startDate, endDate, nurFehlende);
|
|
}
|
|
|
|
public override XtraReport CreateServiceOverviewReportNew(QBFilterEnum filterType, long? customerOid, long? teamOid, long? empOid, long? orgaOid, long? serviceCategoryOid, DateTime startDate, DateTime endDate, bool nurFehlende)
|
|
{
|
|
XtraReport gesamtReport = null;
|
|
|
|
DateTime dt = startDate;
|
|
|
|
int startDay = dt.Day;
|
|
|
|
int month = dt.Month;
|
|
int year = dt.Year;
|
|
|
|
while (dt < endDate)
|
|
{
|
|
XtraReport report = null;
|
|
|
|
|
|
DateTime monatsEnde = new DateTime(dt.Year, dt.Month, DateTime.DaysInMonth(dt.Year, dt.Month));
|
|
int endDay = monatsEnde.Day;
|
|
if (endDate < monatsEnde)
|
|
{
|
|
endDay = endDate.Day;
|
|
}
|
|
|
|
switch (filterType)
|
|
{
|
|
case QBFilterEnum.AlleKlienten:
|
|
if (!nurFehlende)
|
|
{
|
|
report = CreateServiceOverviewAllCustomersReport(month, year, orgaOid ?? 0, empOid ?? 0, serviceCategoryOid, startDay, endDay);
|
|
}
|
|
else
|
|
{
|
|
report = CreateServiceOverviewAllCustomersReport(month, year, orgaOid ?? 0, empOid ?? 0, serviceCategoryOid, startDay, endDay, nurFehlende);
|
|
}
|
|
break;
|
|
case QBFilterEnum.NurKlientenMeinesTeams:
|
|
var list1 = GetKlientenOidsMeinesTeams(null);
|
|
report = CreateServiceOverviewReportForCustomers(list1, month, year, orgaOid, empOid, serviceCategoryOid, startDay, endDay, nurFehlende);
|
|
break;
|
|
case QBFilterEnum.MeineKlienten:
|
|
var list2 = GetMeineKlientenOids();
|
|
report = CreateServiceOverviewReportForCustomers(list2, month, year, orgaOid, empOid, serviceCategoryOid, startDay, endDay, nurFehlende);
|
|
break;
|
|
case QBFilterEnum.KlientenAuswahl:
|
|
report = CreateServiceOverviewSingleCustomerReport(customerOid ?? 0, month, year, orgaOid ?? 0, empOid ?? 0, serviceCategoryOid, startDay, endDay);
|
|
break;
|
|
case QBFilterEnum.TeamAuswahl:
|
|
var list3 = GetKlientenOidsMeinesTeams(teamOid);
|
|
report = CreateServiceOverviewReportForCustomers(list3, month, year, orgaOid, empOid, serviceCategoryOid, startDay, endDay, nurFehlende);
|
|
break;
|
|
}
|
|
|
|
if (gesamtReport == null)
|
|
{
|
|
gesamtReport = report;
|
|
}
|
|
else
|
|
{
|
|
AddReportPagesToMaster(gesamtReport, report);
|
|
}
|
|
|
|
dt = dt.AddMonths(1);
|
|
startDay = 1;
|
|
month = dt.Month;
|
|
year = dt.Year;
|
|
}
|
|
|
|
if (gesamtReport == null)
|
|
{
|
|
gesamtReport = new XtraReport();
|
|
}
|
|
|
|
return gesamtReport;
|
|
|
|
}
|
|
|
|
public virtual IList<long> GetMeineKlientenOids()
|
|
{
|
|
IList<long> customerOids = new List<long>();
|
|
|
|
ApplicationUser loggedInUser = null;
|
|
|
|
if (LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null)
|
|
{
|
|
loggedInUser = LoggedInUserOperationContextExt.Current.User;
|
|
}
|
|
else
|
|
{
|
|
loggedInUser = SessionFacade.LoggedInUser;
|
|
}
|
|
|
|
if (loggedInUser != null && loggedInUser.Employee != null)
|
|
{
|
|
foreach (var e2c in loggedInUser.Employee.Employee2CustomerList)
|
|
{
|
|
if (e2c.Customer.IsActive == ActivationTypeId.Active)
|
|
{
|
|
foreach (var v2o in e2c.ValueList)
|
|
{
|
|
if (v2o.Entry.Type == ValueListEntryType.StaffRoleType && v2o.Entry.SystemEntryID.HasValue && v2o.Entry.SystemEntryID.Value == SystemEntryID.EmployeeRoleMainAttendant)
|
|
{
|
|
if (!customerOids.Contains(e2c.Customer.Oid.Value))
|
|
{
|
|
customerOids.Add(e2c.Customer.Oid.Value);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return customerOids;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lädt die Oids der Klienten, die im Reiter "Betreuung" mit dem vom angemeldeten Mitarbeiter geleiteten Team verknüpft sind.
|
|
/// </summary>
|
|
/// <param name="teamOid">Die Oid des Teams oder aller Teams des Mitarbeiters, falls null</param>
|
|
/// <returns>CustomerOids, die im Reiter "Betreuung" mit dem vom angemeldeten Mitarbeiter geleiteten Team - falls die teamOid null ist, aller Teams des Mitarbeiters - verknüpft sind.</returns>
|
|
public virtual IList<long> GetKlientenOidsMeinesTeams(long? teamOid)
|
|
{
|
|
IList<long> customerOids = new List<long>();
|
|
|
|
ApplicationUser loggedInUser;
|
|
|
|
if (LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null)
|
|
{
|
|
loggedInUser = LoggedInUserOperationContextExt.Current.User;
|
|
}
|
|
else
|
|
{
|
|
loggedInUser = SessionFacade.LoggedInUser;
|
|
}
|
|
|
|
if (loggedInUser?.Employee != null)
|
|
{
|
|
var teams = new List<Team>();
|
|
|
|
if (teamOid.HasValue)
|
|
{
|
|
teams.Add(DAOFactory.GenericDAO.LoadByID<Team>(teamOid.Value));
|
|
}
|
|
else
|
|
{
|
|
teams.AddRange(DAOFactory.SearchDAO.FindLeadingTeams(loggedInUser.Employee.Oid.Value));
|
|
teams.AddRange(DAOFactory.SearchDAO.FindTeamsOfEmployee(loggedInUser.Employee.Oid.Value));
|
|
}
|
|
|
|
//1. Mitarbeiter der Teams durchlaufen oder
|
|
//foreach (var team in teams)
|
|
//{
|
|
// foreach (var employee in team.MemberList)
|
|
// {
|
|
// foreach (var e2c in employee.Employee2CustomerList)
|
|
// {
|
|
// if (e2c.Customer.IsActive == ActivationTypeId.Active)
|
|
// {
|
|
// foreach (var v2o in e2c.ValueList)
|
|
// {
|
|
// if (v2o.Entry.Type == ValueListEntryType.StaffRoleType && v2o.Entry.SystemEntryID.HasValue && v2o.Entry.SystemEntryID.Value == SystemEntryID.EmployeeRoleMainAttendant)
|
|
// {
|
|
// if (!customerOids.Contains(e2c.Customer.Oid.Value))
|
|
// {
|
|
// customerOids.Add(e2c.Customer.Oid.Value);
|
|
// }
|
|
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
//}
|
|
|
|
//2. Klienten der Teams durchlaufen oder
|
|
foreach (var team in teams)
|
|
{
|
|
var customers = DAOFactory.SearchDAO.FindCustomerOfTeam(team.Oid.Value);
|
|
foreach (var c in customers)
|
|
{
|
|
if (c.IsActive == ActivationTypeId.Active)
|
|
{
|
|
if (!customerOids.Contains(c.Oid.Value))
|
|
{
|
|
customerOids.Add(c.Oid.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return customerOids;
|
|
}
|
|
|
|
public virtual 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);
|
|
}
|
|
}
|
|
|
|
QBSortOrderEnum sortOrder = QBSortOrderEnum.NachKlient;
|
|
|
|
if (HttpContext.Current != null)
|
|
{
|
|
var so = HttpContext.Current.Request.Params["sortorder"];
|
|
if (!String.IsNullOrWhiteSpace(so))
|
|
{
|
|
sortOrder = (QBSortOrderEnum)(Int32.Parse(so));
|
|
}
|
|
}
|
|
if (sortOrder == QBSortOrderEnum.NachHauptbetreuung)
|
|
{
|
|
roList = roList.OrderBy(r => r.MainAttendant).ToList();
|
|
}
|
|
else
|
|
{
|
|
roList = roList.OrderBy(r => r.CustomerLastName + ", " + r.CustomerFirstName).ToList();
|
|
}
|
|
|
|
|
|
if (roList.Count > 0)
|
|
{
|
|
String reportId = null;
|
|
if (orgaOid.HasValue && orgaOid > 0)
|
|
{
|
|
var organisation = DAOFactory.GenericDAO.LoadByID<Organisation>(orgaOid.Value);
|
|
if (organisation != null)
|
|
reportId = organisation.Name;
|
|
}
|
|
|
|
var rootReport = CreateReportForServicesOverviewRo(roList[0], reportId);
|
|
if (rootReport.Pages.Count == 0)
|
|
{
|
|
rootReport.CreateDocument();
|
|
}
|
|
|
|
|
|
for (int i = 1; i < roList.Count; i++)
|
|
{
|
|
var lNext = CreateReportForServicesOverviewRo(roList[i], reportId);
|
|
|
|
AddReportPagesToMaster(rootReport, lNext);
|
|
}
|
|
|
|
return rootReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
|
|
|
|
public virtual XtraReport CreateReportForServicesOverviewRo(ServicesOverviewRO ro, String reportId)
|
|
{
|
|
|
|
var serviceOverviewReport = this.FindReportImp<ServicesOverviewRO>(reportId);
|
|
serviceOverviewReport.SetReportDataSource(ro);
|
|
|
|
|
|
return serviceOverviewReport as XtraReport;
|
|
}
|
|
|
|
public virtual XtraReport AddSubServicesOverviewReportToReport(XtraReport masterReport, IBeWoReport<ServicesOverviewRO> newReport, ServicesOverviewRO ro)
|
|
{
|
|
if (ro.Services.Count > 0)
|
|
{
|
|
newReport.SetReportDataSource(ro);
|
|
((XtraReport)newReport).CreateDocument();
|
|
if (masterReport == null)
|
|
{
|
|
masterReport = newReport as XtraReport;
|
|
}
|
|
else
|
|
{
|
|
|
|
AddReportPagesToMaster(masterReport, (XtraReport)newReport);
|
|
|
|
}
|
|
}
|
|
return masterReport;
|
|
}
|
|
|
|
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, false, "nrw"));
|
|
|
|
}
|
|
|
|
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, false, "nrw", false));
|
|
|
|
}
|
|
|
|
public virtual XtraReport CreateReportForStundenaufstellungROs(IList<SbdStundenaufstellungRO> ros)
|
|
{
|
|
if (ros.Count > 0)
|
|
{
|
|
var lServiceOverviewAllCustomersReport = this.FindReportImp<SbdStundenaufstellungRO>();
|
|
lServiceOverviewAllCustomersReport.SetReportDataSource(ros[0]);
|
|
(lServiceOverviewAllCustomersReport as XtraReport).CreateDocument();
|
|
var Report = lServiceOverviewAllCustomersReport as XtraReport;
|
|
|
|
for (int i = 1; i < ros.Count; i++)
|
|
{
|
|
var lNext = FindReportImp<SbdStundenaufstellungRO>();
|
|
lNext.SetReportDataSource(ros[i]);
|
|
(lNext as XtraReport).CreateDocument();
|
|
Report.Pages.AddRange((lNext as XtraReport).Pages);
|
|
}
|
|
|
|
return lServiceOverviewAllCustomersReport as XtraReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
public override XtraReport CreateServiceRecordListReport(long employeeOid, long customerOid, long supportConceptOid, long costbearer2SupportConceptOid, bool isLimitedToAdditionalServices, DateTimeSpan limitingTimeSpan)
|
|
{
|
|
|
|
IBeWoReport<ServiceRecordListRO> lServiceRecordListReport = FindReportImp<ServiceRecordListRO>();
|
|
lServiceRecordListReport.SetReportDataSource(ServiceRecordListRO.Create(employeeOid, customerOid, supportConceptOid, costbearer2SupportConceptOid, isLimitedToAdditionalServices, limitingTimeSpan));
|
|
|
|
return lServiceRecordListReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateSettlementReport(String dcId, long? invoiceBaseOid)
|
|
{
|
|
return CreateSettlementReport(dcId, invoiceBaseOid, false);
|
|
}
|
|
|
|
public virtual XtraReport CreateSettlementReport(String dcId, long? invoiceBaseOid, bool createAnhang)
|
|
{
|
|
XtraReport report = null;
|
|
|
|
String reportId = null;
|
|
|
|
var lSettlementDC = GetSettlementDC(dcId, invoiceBaseOid);
|
|
|
|
if (lSettlementDC.CostBearer2SupportConceptOid.HasValue)
|
|
{
|
|
CostBearer2SupportConcept c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(lSettlementDC.CostBearer2SupportConceptOid.Value);
|
|
reportId = c2s.CostBearer.ID;
|
|
}
|
|
|
|
if (lSettlementDC.DifferentHourlyRateCount > 0)
|
|
{
|
|
|
|
IBeWoReport<SettlementRO> lSettlementReport = FindReportImp<SettlementRO>(reportId);
|
|
var ro = SettlementRO.Create(lSettlementDC);
|
|
lSettlementReport.SetReportDataSource(ro);
|
|
|
|
report = lSettlementReport as XtraReport;
|
|
}
|
|
else
|
|
{
|
|
IBeWoReport<Settlement2RO> lSettlementReport = FindReportImp<Settlement2RO>(reportId);
|
|
lSettlementReport.SetReportDataSource(Settlement2RO.Create(lSettlementDC));
|
|
report = lSettlementReport as XtraReport;
|
|
|
|
|
|
}
|
|
|
|
if (createAnhang)
|
|
{
|
|
if (report != null)
|
|
{
|
|
report.CreateDocument();
|
|
if (reportId != null && reportId == "LWLDigga")
|
|
{
|
|
var anhang = CreateBudgetnachweisDiggiAnhang(lSettlementDC);
|
|
if (anhang != null)
|
|
{
|
|
anhang.CreateDocument();
|
|
report.Pages.AddRange(anhang.Pages);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var anhang = CreateBudgetnachweisAnhang(lSettlementDC);
|
|
if (anhang != null)
|
|
{
|
|
anhang.CreateDocument();
|
|
report.Pages.AddRange(anhang.Pages);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return report;
|
|
}
|
|
|
|
public override XtraReport CreateSettlementReportMitQB(String dcId, long? invoiceBaseOid)
|
|
{
|
|
XtraReport report = null;
|
|
|
|
|
|
String reportId = null;
|
|
var lSettlementDC = GetSettlementDC(dcId, invoiceBaseOid);
|
|
|
|
if (lSettlementDC.CostBearer2SupportConceptOid.HasValue)
|
|
{
|
|
CostBearer2SupportConcept c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(lSettlementDC.CostBearer2SupportConceptOid.Value);
|
|
reportId = c2s.CostBearer.ID;
|
|
}
|
|
|
|
if (lSettlementDC.DifferentHourlyRateCount > 0)
|
|
{
|
|
|
|
IBeWoReport<SettlementRO> lSettlementReport = FindReportImp<SettlementRO>(reportId);
|
|
var ro = SettlementRO.Create(lSettlementDC);
|
|
lSettlementReport.SetReportDataSource(ro);
|
|
|
|
report = lSettlementReport as XtraReport;
|
|
}
|
|
else
|
|
{
|
|
IBeWoReport<Settlement2RO> lSettlementReport = FindReportImp<Settlement2RO>(reportId);
|
|
lSettlementReport.SetReportDataSource(Settlement2RO.Create(lSettlementDC));
|
|
report = lSettlementReport as XtraReport;
|
|
}
|
|
|
|
if (lSettlementDC.InvoiceBaseOid.HasValue)
|
|
{
|
|
var sb = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(lSettlementDC.InvoiceBaseOid.Value);
|
|
var qb = CreateBelegeForInvoice(sb);
|
|
|
|
AddReportPagesToMaster(report, qb);
|
|
|
|
}
|
|
|
|
|
|
|
|
return report;
|
|
}
|
|
|
|
public void AddReportPagesToMaster(XtraReport master, XtraReport report2Add)
|
|
{
|
|
if (master == null || report2Add == null)
|
|
return;
|
|
|
|
if (report2Add.Pages.Count == 0)
|
|
{
|
|
report2Add.CreateDocument();
|
|
}
|
|
if (master.Pages.Count == 0)
|
|
{
|
|
master.CreateDocument();
|
|
}
|
|
master.Pages.AddRange(report2Add.Pages);
|
|
}
|
|
|
|
public virtual Settlement2DC GetSettlementDC(String dcId, long? invoiceBaseOid)
|
|
{
|
|
Settlement2DC dc;
|
|
|
|
long result;
|
|
|
|
if (string.IsNullOrEmpty(dcId) && invoiceBaseOid.HasValue)
|
|
{
|
|
dc = MapperFactory.SettlementDC_SettlementInvoice.MapToNewDC(DAOFactory.SearchDAO.GetSettlementInvoiceByInvoiceBaseOid(invoiceBaseOid.Value));
|
|
}
|
|
else if (Int64.TryParse(dcId, out result))
|
|
{
|
|
dc = MapperFactory.SettlementDC_SettlementInvoice.MapToNewDC(DAOFactory.GenericDAO.LoadByID<SettlementInvoice>(result)); // = Utils.XMLDeserialize<SettlementDC>(lPath);
|
|
}
|
|
else
|
|
{
|
|
string lPath = BS.Shared.Core.Utils.CreateSavePath(TempPath, dcId);
|
|
dc = Utils.XMLDeserialize<Settlement2DC>(lPath);
|
|
}
|
|
return dc;
|
|
}
|
|
|
|
protected virtual XtraReport CreateBelegeForInvoice(InvoiceBase invoiceBase)
|
|
{
|
|
|
|
List<ServicesOverviewRO> quittierungsbelegRos = null;
|
|
if (invoiceBase.CostBearer2SupportConcept != null)
|
|
{
|
|
var customerOid = invoiceBase.CostBearer2SupportConcept.SupportConcept.Customer.Oid.Value;
|
|
|
|
|
|
return CreateServiceOverviewReportNew(QBFilterEnum.KlientenAuswahl, customerOid, null, null, null, null, invoiceBase.AccountingPeriodStart.Value, invoiceBase.AccountingPeriodEnd.Value, false);
|
|
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
protected virtual XtraReport CreateBudgetnachweisAnhang(Settlement2DC settlementDC)
|
|
{
|
|
var ro = PluginLoader.FindClass<BudgetnachweisAnhangRO>();
|
|
ro.Create(settlementDC);
|
|
IBeWoReport<BudgetnachweisAnhangRO> anhang = FindReportImp<BudgetnachweisAnhangRO>();
|
|
anhang.SetReportDataSource(ro);
|
|
|
|
return anhang as XtraReport;
|
|
}
|
|
|
|
protected virtual XtraReport CreateBudgetnachweisDiggiAnhang(Settlement2DC settlementDC)
|
|
{
|
|
var ro = PluginLoader.FindClass<BudgetnachweisAnhangDiggaRO>();
|
|
ro.Create(settlementDC);
|
|
IBeWoReport<BudgetnachweisAnhangDiggaRO> anhang = FindReportImp<BudgetnachweisAnhangDiggaRO>();
|
|
anhang.SetReportDataSource(ro);
|
|
|
|
return anhang as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateSupportConceptReport(IList<long> c2sOids, long? employeeOid, long? teamOid, long? catOid, int? expiredMonths, bool archivedSupportConcepts, DateTime? startDate, DateTime? endDate)
|
|
{
|
|
var lSupportConceptReport = FindReportImp<SupportConceptListRO>();
|
|
lSupportConceptReport.SetReportDataSource(SupportConceptListRO.Create(c2sOids, employeeOid, teamOid, catOid, expiredMonths, archivedSupportConcepts, startDate, endDate));
|
|
|
|
return lSupportConceptReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateAdditionalServiceBookingReport(long addServiceRegionOid, Monat month, int year)
|
|
{
|
|
var report = FindReportImp<AdditionalServiceBookingRO>();
|
|
var x =
|
|
AdditionalServiceBookingRO.Create(
|
|
DAOFactory.GenericDAO.LoadByID<AdditionalServiceRegion>(addServiceRegionOid), month, year);
|
|
report.SetReportDataSource(x);
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateEmployeeHourReport(long? employeeOid, IList<long> teamOids, DateTime startDate, DateTime endDate, int ansicht)
|
|
{
|
|
IBeWoReport<MitarbeiterstundenkontoRO> report;
|
|
|
|
if (ansicht == 1)
|
|
{
|
|
report = FindReportImp<MitarbeiterstundenkontoRO>("Mitarbeiterarbeitszeitkonto");
|
|
}
|
|
else if (ansicht == 2)
|
|
{
|
|
var reportjahr = FindReportImp<MitarbeiterstundenkontoMonateRO>("MitarbeiterstundenkontoJahr");
|
|
var jahrStart = new DateTime(startDate.Year, 1, 1);
|
|
var ds = new MitarbeiterstundenkontoMonateRO(employeeOid, teamOids, jahrStart, endDate, null);
|
|
|
|
reportjahr.SetReportDataSource(ds);
|
|
|
|
return reportjahr as XtraReport;
|
|
}
|
|
else
|
|
{
|
|
if (teamOids != null && teamOids.Count > 0)
|
|
{
|
|
report = FindReportImp<MitarbeiterstundenkontoRO>("Teamstundenkonto");
|
|
}
|
|
else
|
|
{
|
|
report = FindReportImp<MitarbeiterstundenkontoRO>("Mitarbeiterstundenkonto");
|
|
}
|
|
}
|
|
|
|
var reportObject = MitarbeiterstundenkontoRO.Create(employeeOid, teamOids, startDate, endDate, null);
|
|
report.SetReportDataSource(reportObject);
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateAuslastungReport(long? employeeOid, IList<long> teamOids, DateTime startDate, DateTime endDate)
|
|
{
|
|
IBeWoReport<MitarbeiterauslastungRO> report;
|
|
if (teamOids != null && teamOids.Count > 0)
|
|
report = FindReportImp<MitarbeiterauslastungRO>("Teamauslastung");
|
|
else
|
|
report = FindReportImp<MitarbeiterauslastungRO>("Mitarbeiterauslastung");
|
|
|
|
var x = MitarbeiterauslastungRO.Create(employeeOid, teamOids, startDate, endDate);
|
|
report.SetReportDataSource(x);
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateMediVerordListenReport(long? mvlOid)
|
|
{
|
|
var report = FindReportImp<MedVerListRO>();
|
|
|
|
report.SetReportDataSource(MedVerListRO.Create(mvlOid));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateMediVerordListenMZfReport(long? mvlOid, bool mitZusatzfeldern)
|
|
{
|
|
var report = FindReportImp<MedVerListRO>();
|
|
|
|
report.SetReportDataSource(MedVerListRO.Create(mvlOid, mitZusatzfeldern));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateKalenderReport(long? employeeOid, AppointmentViewType viewType, DateTime rangeStartDate, DateTime rangeEndDate, List<DateTime> datesList, List<UserRightType> userRights)
|
|
{
|
|
var report = new DailyAppointmentReportKalender();
|
|
|
|
//switch (viewType)
|
|
//{
|
|
// case AppointmentViewType.Week:
|
|
// var r = new WeeklyAppointmentReport();
|
|
// r.SetReportDataSource(KalenderRO.Create(employeeOid, viewType, rangeStartDate, rangeEndDate, datesList));
|
|
// return r;
|
|
//}
|
|
//throw new NotImplementedException("Wird umgebaut");
|
|
//report.SetReportDataSource(KalenderRO.Create(employeeOid, viewType, rangeStartDate, rangeEndDate, datesList, userRights));
|
|
|
|
return report;
|
|
}
|
|
|
|
|
|
public override XtraReport CreateFinanceReport(DateTime? start, DateTime? end, bool splitByServiceCategory, bool onlyNotApproved)
|
|
{
|
|
var report = FindReportImp<FinanceRO>();
|
|
|
|
report.SetReportDataSource(FinanceRO.Create(start, end,splitByServiceCategory, onlyNotApproved));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateJahresberichtReport(AnnualReportConfigDC config)
|
|
{
|
|
var report = FindReportImp<JahresReportRO>();
|
|
|
|
report.SetReportDataSource(JahresReportRO.Create(config));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateEmployeeDataReport(long oid)
|
|
{
|
|
var report = FindReportImp<EmployeeDataRO>();
|
|
report.SetReportDataSource(EmployeeDataRO.Create(MapperFactory.EmployeeDC_Employee.MapToNewDC(DAOFactory.GenericDAO.LoadByID<Employee>(oid))));
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateEmployeeCustomerListReport(long? employeeOid)
|
|
{
|
|
var report = FindReportImp<EmployeeCustomerListRO>();
|
|
report.SetReportDataSource(EmployeeCustomerListRO.Create(employeeOid));
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateRatingReport(long ratingOid, long supportConceptOid)
|
|
{
|
|
var report = FindReportImp<RatingRO>();
|
|
report.SetReportDataSource(RatingRO.Create(ratingOid, supportConceptOid));
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateNotizenReport(long kategorieOid, DateTime start, DateTime end)
|
|
{
|
|
var report = FindReportImp<NotizenRO>();
|
|
report.SetReportDataSource(NotizenRO.Create(start, end, MapperFactory.NotizenKategorieDC_NotizenKategorie.MapToNewDC(DAOFactory.GenericDAO.LoadByID<NotizenKategorie>(kategorieOid))));
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateBewertungsstatistikReport(DateTime? start, DateTime? end, SupportConceptDC supportConcept, bool inclZeiterfassung, List<ValueListEntryDC> ziele, List<RatingDC> scZiele)
|
|
{
|
|
// Ist kein Hilfeplan gesetzt, wird die Tabelle für die Auswertung aller Bewertungen in einem Zeitraum gebaut
|
|
if (supportConcept == null)
|
|
{
|
|
var report = new Bewertungsstatistik();
|
|
report.SetReportDataSource(BewertungsstatistikRO.Create(start, end, supportConcept, inclZeiterfassung, null, null));
|
|
return report as XtraReport;
|
|
}
|
|
// Ist der Hilfeplan als Parameter gesetzt, Bericht für einen HP erstellen
|
|
else
|
|
{
|
|
var report = FindReportImp<BewertungsstatistikRO>();
|
|
report.SetReportDataSource(BewertungsstatistikRO.Create(start, end, supportConcept, inclZeiterfassung, ziele, scZiele));
|
|
return report as XtraReport;
|
|
}
|
|
}
|
|
|
|
public override XtraReport CreateCustomReport(long employeeOid, String reportName)
|
|
{
|
|
if (String.IsNullOrEmpty(reportName))
|
|
{
|
|
return new XtraReport();
|
|
}
|
|
|
|
var report = FindReportImp<QueryRO>(null, reportName);
|
|
if (report == null)
|
|
{
|
|
return new XtraReport();
|
|
}
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateSBDCharacteristicsReport(long customerOid)
|
|
{
|
|
var report = FindReportImp<SBDCharacteristicsRO>();
|
|
report.SetReportDataSource(SBDCharacteristicsRO.Create(MapperFactory.CustomerDC_Customer.MapToNewDC(DAOFactory.GenericDAO.LoadByID<Customer>(customerOid))));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateSBDEmployeeReport(long employeeOid)
|
|
{
|
|
var report = FindReportImp<SBDEmployeeRO>();
|
|
report.SetReportDataSource(SBDEmployeeRO.Create(DAOFactory.GenericDAO.LoadByID<Employee>(employeeOid)));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateKilometerauswertung(long customerOid, List<long> serviceDescriptionOids, DateTime start, DateTime end)
|
|
{
|
|
var report = FindReportImp<KilometerauswertungsRO>();
|
|
|
|
report.SetReportDataSource(KilometerauswertungsRO.Create(MapperFactory.CompactCustomerDC_CustomerCompact.MapToNewDC(DAOFactory.GenericDAO.LoadByID<Customer>(customerOid)), serviceDescriptionOids, start, end));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateKilometerauswertungForAllCustomers(List<long> customerOids, List<long> serviceDescriptionOids, DateTime start, DateTime end)
|
|
{
|
|
var report = FindReportImp<KilometerauswertungsListRO>();
|
|
|
|
report.SetReportDataSource(KilometerauswertungsListRO.Create(MapperFactory.CompactCustomerDC_CustomerCompact.MapToNewDCs(DAOFactory.GenericDAO.LoadByIDs<Customer>(customerOids)), serviceDescriptionOids, start, end));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateEmployeeKilometerauswertung(long employeeOid, List<long> serviceDescriptionOids, DateTime start, DateTime end)
|
|
{
|
|
var report = FindReportImp<EmployeeKilometerauswertungsRO>();
|
|
|
|
report.SetReportDataSource(EmployeeKilometerauswertungsRO.Create(MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(DAOFactory.GenericDAO.LoadByID<Employee>(employeeOid)), serviceDescriptionOids, start, end));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateKilometerauswertungForAllEmployees(List<long> employeeOids, List<long> serviceDescriptionOids, DateTime start, DateTime end)
|
|
{
|
|
var report = FindReportImp<EmployeeKilometerauswertungsListRO>();
|
|
|
|
report.SetReportDataSource(EmployeeKilometerauswertungsListRO.Create(MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(DAOFactory.GenericDAO.LoadByIDs<Employee>(employeeOids)), serviceDescriptionOids, start, end));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateAbsenceReport(DateTime dt, List<long> abs, List<long> empTypes, List<long> teams, List<int> feiertage)
|
|
{
|
|
var report = FindReportImp<AbsenceRO>();
|
|
var service = new OperationsServiceImp();
|
|
|
|
var filter = new AbsenceOverviewFilterDC() { AbsenceReasons = abs, EmploymentType = empTypes, Year = dt.Year, Month = dt.Month, Teams = teams };
|
|
List<CompactTeamDC> compactTeams = new List<CompactTeamDC>();
|
|
if (teams != null)
|
|
{
|
|
if (teams.Count > 0)
|
|
compactTeams = service.GetCertainTeamsById(teams);
|
|
}
|
|
|
|
report.SetReportDataSource(AbsenceRO.Create(service.GetAbsenceOverview(filter), filter, compactTeams, feiertage));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateRosterReport(long wOid, DateTime dt, List<int> feiertage, int sortingIndex, bool aufsteigend, long creator)
|
|
{
|
|
if (TemplateOid.HasValue && TemplateOid.Value == -2)
|
|
{
|
|
return CreateRosterReportIst(wOid, dt);
|
|
}
|
|
var service = new OperationsServiceImp();
|
|
var service2 = new CustomerServiceImp();
|
|
var report = FindReportImp<RosterRO>();
|
|
|
|
var dienstEintraege = service.GetAllDienstEintraegeAsList(wOid, dt.Year, dt.Month);
|
|
var vertretungen = service.GetAllDienstvertretungenAsList(wOid, dt.Year, dt.Month);
|
|
|
|
List<long> employeeOids = new List<long>();
|
|
foreach (var eintrag in dienstEintraege)
|
|
{
|
|
if (!employeeOids.Contains(eintrag.EmployeeOid))
|
|
employeeOids.Add(eintrag.EmployeeOid);
|
|
}
|
|
foreach (var vertretung in vertretungen)
|
|
{
|
|
if (!employeeOids.Contains(vertretung.EmployeeOid))
|
|
employeeOids.Add(vertretung.EmployeeOid);
|
|
}
|
|
|
|
List<EmployeeDC> employee = new List<EmployeeDC>();
|
|
foreach (var oid in employeeOids)
|
|
employee.Add(MapperFactory.EmployeeDC_Employee.MapToNewDC(DAOFactory.GenericDAO.GetByID<Employee>(oid)));
|
|
|
|
var creatorEmployee = MapperFactory.EmployeeDC_Employee.MapToNewDC(DAOFactory.GenericDAO.GetByID<Employee>(creator));
|
|
|
|
//report.SetReportDataSource(RosterRO.Create(service.GetDienstEintraege(wOid, dt.Year, dt.Month), service.GetAllDienste(), service2.GetAllActiveWohnheimeCompact().First(x => x.WohnheimOid == wOid), dt.Year, dt.Month));
|
|
report.SetReportDataSource(RosterRO.CreateNew(dienstEintraege, vertretungen, employee,
|
|
service.GetAllDienste(wOid), service2.GetAllActiveWohnheimeCompact().First(x => x.WohnheimOid == wOid), dt.Year, dt.Month, feiertage, sortingIndex, aufsteigend, creatorEmployee));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
public override XtraReport CreateRosterReportIst(long wOid, DateTime dt)
|
|
{
|
|
var opertionsService = new OperationsServiceImp();
|
|
var customerService = new CustomerServiceImp();
|
|
var employeeService = new EmployeeServiceImp();
|
|
|
|
var report = FindReportImp<RosterIstRO>();
|
|
|
|
var dienstEintraege = opertionsService.GetAllDienstEintraegeAsList(wOid, dt.Year, dt.Month);
|
|
var vertretungen = opertionsService.GetAllDienstvertretungenAsList(wOid, dt.Year, dt.Month);
|
|
|
|
List<long> employeeOids = new List<long>();
|
|
foreach (var eintrag in dienstEintraege)
|
|
{
|
|
if (!employeeOids.Contains(eintrag.EmployeeOid))
|
|
employeeOids.Add(eintrag.EmployeeOid);
|
|
}
|
|
foreach (var vertretung in vertretungen)
|
|
{
|
|
if (!employeeOids.Contains(vertretung.EmployeeOid))
|
|
employeeOids.Add(vertretung.EmployeeOid);
|
|
}
|
|
|
|
List<EmployeeDC> employee = new List<EmployeeDC>();
|
|
foreach (var oid in employeeOids)
|
|
employee.Add(MapperFactory.EmployeeDC_Employee.MapToNewDC(DAOFactory.GenericDAO.GetByID<Employee>(oid)));
|
|
|
|
List<AbsenceTimeDC> absences = employeeService.GetMultipleEmployeeAbsenceTimesForMonth(dt.Year, dt.Month, employeeOids);
|
|
List<FeiertagDC> feiertageDCs = opertionsService.ErstelleDefaultFeiertage(dt.Year).Where(f => f.Datum.Month == dt.Month).ToList();
|
|
|
|
Dictionary<long?, decimal> stundenBeiAbwesenheit = new Dictionary<long?, decimal>();
|
|
foreach (var emp in employee) // Irgendwo hier drin Fehler
|
|
{
|
|
ContractDC currentContract = null;
|
|
foreach (var c in emp.Contracts)
|
|
{
|
|
if (!c.ContractEndDate.HasValue)
|
|
{
|
|
if (dt >= c.EntryDate)
|
|
{
|
|
currentContract = c;
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (dt >= c.EntryDate && dt <= c.ContractEndDate)
|
|
{
|
|
currentContract = c;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (currentContract != null)
|
|
{
|
|
if ((currentContract.WeeklyTotalHours == null && currentContract.MonthlyTotalHours == null) || currentContract.WeeklyDays == null)
|
|
continue;
|
|
else
|
|
{
|
|
if (currentContract.WeeklyTotalHours != null)
|
|
stundenBeiAbwesenheit.Add(emp.EmployeeOid, currentContract.WeeklyTotalHours.Value / currentContract.WeeklyDays);
|
|
else if (currentContract.MonthlyTotalHours != null)
|
|
stundenBeiAbwesenheit.Add(emp.EmployeeOid, currentContract.MonthlyTotalHours.Value / DateTime.DaysInMonth(dt.Year, dt.Month));
|
|
}
|
|
}
|
|
}
|
|
|
|
report.SetReportDataSource(RosterIstRO.Create(dienstEintraege, vertretungen, employee, opertionsService.GetAllDienste(wOid),
|
|
customerService.GetAllActiveWohnheimeCompact().First(x => x.WohnheimOid == wOid), dt.Year, dt.Month, feiertageDCs, absences, stundenBeiAbwesenheit));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateVorlagenReport(long template, List<long> objectOids, long table)
|
|
{
|
|
string rtf = "";
|
|
|
|
var templateDC = MapperFactory.DokumentvorlageDC_Dokumentvorlage.MapToNewDC(DAOFactory.GenericDAO.GetByID<Dokumentvorlage>(template));
|
|
|
|
OperationsServiceImp operations = new OperationsServiceImp();
|
|
|
|
XtraReport mainReport = null;
|
|
|
|
foreach (var oid in objectOids)
|
|
{
|
|
string text = operations.ReplacePlaceholdersInTemplate(templateDC, oid, table);
|
|
|
|
|
|
|
|
//++++++++++++++++++++++
|
|
|
|
RichEditDocumentServer server = new RichEditDocumentServer();
|
|
|
|
using (var stream = new MemoryStream(Encoding.Default.GetBytes(text)))
|
|
{
|
|
server.LoadDocument(stream);
|
|
}
|
|
|
|
|
|
var ranges = server.Document.FindAll(DevExpress.Office.Characters.PageBreak.ToString(), DevExpress.XtraRichEdit.API.Native.SearchOptions.None);
|
|
var dp = server.Document.Paragraphs[0].Range.Start;
|
|
|
|
List<VorlageRO> collection = new List<VorlageRO>();
|
|
foreach (var dr in ranges)
|
|
{
|
|
var tmpRange = server.Document.CreateRange(dp, dr.Start.ToInt() - dp.ToInt());
|
|
collection.Add(new VorlageRO { RTFText = server.Document.GetRtfText(tmpRange) });
|
|
dp = dr.End;
|
|
}
|
|
var tmpRange2 = server.Document.CreateRange(dp, server.Document.Paragraphs[server.Document.Paragraphs.Count - 1].Range.End.ToInt() - dp.ToInt());
|
|
collection.Add(new VorlageRO { RTFText = server.Document.GetRtfText(tmpRange2) });
|
|
|
|
//var report = new XtraReport();
|
|
//report.DataSource = collection;
|
|
|
|
|
|
//++++++++++++++++++++++
|
|
|
|
|
|
//var report = FindReportImp<VorlageRO>();
|
|
var report = new VorlageReport();
|
|
report.SetReportDataSource(collection);
|
|
((XtraReport)report).CreateDocument();
|
|
|
|
if (mainReport == null)
|
|
{
|
|
mainReport = (XtraReport)report;
|
|
}
|
|
else
|
|
{
|
|
if (!text.Equals(""))
|
|
mainReport.Pages.AddRange(((XtraReport)report).Pages);
|
|
}
|
|
}
|
|
|
|
return mainReport;
|
|
}
|
|
|
|
public override XtraReport CreateAbwesenheitsPrintReport(List<long> oids, string titel)
|
|
{
|
|
EmployeeServiceImp employeeService = new EmployeeServiceImp();
|
|
List<AbwesenheitsInformationPrintDC> list = employeeService.GetAbwesenheitsInformationPrints(oids);
|
|
|
|
var report = FindReportImp<AbwesenheitsPrintRO>();
|
|
report.SetReportDataSource(AbwesenheitsPrintRO.Create(list, titel));
|
|
((XtraReport)report).CreateDocument();
|
|
|
|
return (XtraReport)report;
|
|
}
|
|
|
|
public override XtraReport CreateKassenbelegReport(BargeldtransaktionDC transaktion, long objectOid, TableID objectTid)
|
|
{
|
|
IBeWoReport<KassenbelegRO> report = FindReportImp<KassenbelegRO>();
|
|
|
|
var beguenstigter = LoadToBargeldkasseRelatedObject(objectTid, objectOid);
|
|
|
|
report.SetReportDataSource(KassenbelegRO.Create(transaktion, beguenstigter));
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateVertretungsPlanungReport(DateTime start, int ansicht)
|
|
{
|
|
//IBeWoReport<KassenbelegRO> report = FindReportImp<KassenbelegRO>();
|
|
|
|
//var beguenstigter = LoadToBargeldkasseRelatedObject(objectTid, objectOid);
|
|
|
|
//report.SetReportDataSource(KassenbelegRO.Create(transaktion, beguenstigter));
|
|
|
|
//return report as XtraReport;
|
|
return new XtraReport();
|
|
}
|
|
|
|
private BeWoEntityBase LoadToBargeldkasseRelatedObject(TableID pObjectTid, long pObjectOid)
|
|
{
|
|
switch (pObjectTid)
|
|
{
|
|
case TableID.Customer:
|
|
return DAOFactory.GenericDAO.LoadByID<Customer>(pObjectOid);
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public override XtraReport CreateValidationMessageListReport(DateTime startDate, DateTime endDate)
|
|
{
|
|
IBeWoReport<ValidationMessageListRO> report = FindReportImp<ValidationMessageListRO>();
|
|
|
|
report.SetReportDataSource(ValidationMessageListRO.Create(startDate, endDate, DAOFactory.SearchDAO.GetValidationMessagesForMonth(startDate, endDate).ToList()));
|
|
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateInvoiceListReport(List<long> oids)
|
|
{
|
|
XtraReport master = null;
|
|
|
|
var ibList = DAOFactory.GenericDAO.LoadByIDs<InvoiceBase>(oids);
|
|
|
|
foreach (var ib in ibList)
|
|
{
|
|
XtraReport report = null;
|
|
if (ib.Type == InvoiceType.Service)
|
|
{
|
|
report = CreateServiceInvoiceReport(null, ib.Oid);
|
|
}
|
|
else if (ib.Type == InvoiceType.Settlement)
|
|
{
|
|
report = CreateSettlementReport(null, ib.Oid);
|
|
}
|
|
else
|
|
{
|
|
report = CreateCustomerInvoiceReport(ib.Oid.Value);
|
|
}
|
|
if (report != null)
|
|
{
|
|
report.Watermark.PageRange = "1";
|
|
if (report.Pages.Count == 0)
|
|
{
|
|
report.CreateDocument();
|
|
}
|
|
|
|
|
|
if (master == null)
|
|
{
|
|
master = report;
|
|
}
|
|
else
|
|
{
|
|
//master.Pages.AddRange(report.Pages);
|
|
XRWatermark wm = new XRWatermark();
|
|
|
|
wm.CopyFrom(report.Watermark);
|
|
bool firstpage = true;
|
|
foreach (var item in report.Pages)
|
|
{
|
|
var page2add = item as DevExpress.XtraPrinting.Page;
|
|
if (page2add != null)
|
|
{
|
|
|
|
master.Pages.Add(page2add);
|
|
if (wm != null && firstpage)
|
|
{
|
|
var newpage = master.Pages[master.Pages.Count - 1];
|
|
newpage.AssignWatermark(wm);
|
|
//newpage.AssignWatermark(page2add.Watermark);
|
|
}
|
|
}
|
|
firstpage = false;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
if (master == null)
|
|
{
|
|
master = new XtraReport();
|
|
}
|
|
return master;
|
|
}
|
|
|
|
|
|
public override XtraReport CreateCustomerListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Klienten");
|
|
var customers = DAOFactory.GenericDAO.LoadByIDs<Customer>(oids);
|
|
|
|
DataTable table = new DataTable();
|
|
string[] spalten = new string[] { "Name", "Geburtsdatum", "Anschrift", "Telefon", "Mobil", "Mail",
|
|
"Betreuung begonnen", "Betreuung beendet" };
|
|
|
|
for (int i = 0; i < spalten.Length; i++)
|
|
table.Columns.Add(spalten[i], typeof(string));
|
|
|
|
for (int i = 0; i < customers.Count; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
Customer customer = customers[i];
|
|
|
|
Person person = customer.Person;
|
|
if (person != null)
|
|
{
|
|
row[0] = person.LastNameFirstName;
|
|
row[1] = String.Format("{0:dd.MM.yyyy}", person.DateOfBirth);
|
|
|
|
var address = person.Address;
|
|
if (address != null)
|
|
{
|
|
row[2] = address.Street + ", " + address.PostalCode + " " + address.Town;
|
|
}
|
|
|
|
var contacts = person.Contacts;
|
|
if (contacts != null)
|
|
{
|
|
row[3] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Phone)?.Value;
|
|
row[4] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_MobilePhone)?.Value;
|
|
row[5] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Mail)?.Value;
|
|
}
|
|
}
|
|
row[6] = String.Format("{0:dd.MM.yyyy}", customer.AssistanceBegin);
|
|
row[7] = String.Format("{0:dd.MM.yyyy}", customer.TerminationDate);
|
|
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Klienten" }, table);
|
|
queryReportObject.Name = "Klienten";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateSupportConceptListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Hilfeplaene");
|
|
var helper = PluginLoader.FindClass<ExportAndPrintHelper>();
|
|
|
|
string[] lHeaderCaption = helper.PrepareHeaderArrayForSupportConceptExport();
|
|
string[][] lContent = helper.PrepareContentArrayForSupportConceptExport(oids.ToArray());
|
|
|
|
DataTable table = new DataTable();
|
|
int columnNumber = lHeaderCaption.Count();
|
|
for (int i = 0; i < columnNumber; i++)
|
|
table.Columns.Add(lHeaderCaption[i], typeof(string));
|
|
|
|
|
|
int rowNumber = lContent.GetLength(0);
|
|
for (int i = 0; i < rowNumber; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
for (int j = 0; j < columnNumber; j++)
|
|
{
|
|
row[j] = lContent[i][j];
|
|
}
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Hilfepläne" }, table);
|
|
queryReportObject.Name = "Hilfepläne";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateWohnheimListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Wohnprojekte");
|
|
var wohnprojekte = DAOFactory.GenericDAO.LoadByIDs<Wohnheim>(oids);
|
|
|
|
DataTable table = new DataTable();
|
|
string[] spalten = new string[] { "Wohnprojekt", "Straße", "PLZ", "Ort", "Bemerkung" };
|
|
for (int i = 0; i < spalten.Length; i++)
|
|
table.Columns.Add(spalten[i], typeof(string));
|
|
|
|
for (int i = 0; i < wohnprojekte.Count; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
Wohnheim wohnprojekt = wohnprojekte[i];
|
|
row[0] = wohnprojekt.WohnheimName;
|
|
row[1] = wohnprojekt.Strasse;
|
|
row[2] = wohnprojekt.PLZ;
|
|
row[3] = wohnprojekt.Ort;
|
|
row[3] = wohnprojekt.Bemerkung;
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Wohnprojekte" }, table);
|
|
queryReportObject.Name = "Wohnprojekte";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateOrganisationListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Organisationen");
|
|
var organisations = DAOFactory.GenericDAO.LoadByIDs<Organisation>(oids);
|
|
|
|
DataTable table = new DataTable();
|
|
string[] spalten = new string[] { "Organisation", "Straße", "PLZ", "Ort", "Telefon", "Fax", "Mail", "Ansprechpartner" };
|
|
for (int i = 0; i < spalten.Length; i++)
|
|
table.Columns.Add(spalten[i], typeof(string));
|
|
|
|
for (int i = 0; i < organisations.Count; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
Organisation organisation = organisations[i];
|
|
row[0] = organisation.Name;
|
|
var address = organisation.Address;
|
|
if (address != null)
|
|
{
|
|
row[1] = address.Street;
|
|
row[2] = address.PostalCode;
|
|
row[3] = address.Town;
|
|
}
|
|
var contacts = organisation.Contacts;
|
|
if (contacts != null)
|
|
{
|
|
row[4] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Phone)?.Value;
|
|
row[5] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Fax)?.Value;
|
|
row[6] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Mail)?.Value;
|
|
row[7] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.ContactPerson)?.Value;
|
|
}
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Organisationen" }, table);
|
|
queryReportObject.Name = "Organisationen";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreatePersonListReport(List<long> oids)
|
|
{
|
|
|
|
var queryReport = FindReportImp<QueryRO>(null, "Personen");
|
|
var helper = PluginLoader.FindClass<ExportAndPrintHelper>();
|
|
|
|
string[] lHeaderCaption = helper.PrepareHeaderArrayForPersonExport();
|
|
string[][] lContent = helper.PrepareContentArrayForPersonExport(oids.ToArray());
|
|
|
|
|
|
DataTable table = new DataTable();
|
|
int columnNumber = lHeaderCaption.Count();
|
|
for (int i = 0; i < columnNumber; i++)
|
|
table.Columns.Add(lHeaderCaption[i], typeof(string));
|
|
|
|
|
|
int rowNumber = lContent.GetLength(0);
|
|
for (int i = 0; i < rowNumber; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
for (int j = 0; j < columnNumber; j++)
|
|
{
|
|
row[j] = lContent[i][j];
|
|
}
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Personen" }, table);
|
|
queryReportObject.Name = "Personen";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateUserListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Benutzergruppen");
|
|
|
|
#region alt
|
|
//var lUser = DAOFactory.GenericDAO.LoadByIDs<ApplicationUser>(oids);
|
|
|
|
//string[] lHeaderCaption = {
|
|
// "Mitarbeiter", // 0
|
|
// "Login", // 1
|
|
// "zugeordnete Benutzergruppen", // 2
|
|
// };
|
|
|
|
//string[][] lContent = new string[lUser.Count][];
|
|
|
|
//for (int iRowCount = 0; iRowCount < lUser.Count; iRowCount++)
|
|
//{
|
|
// lContent[iRowCount] = new string[lHeaderCaption.Count()];
|
|
|
|
// if (lUser[iRowCount].Employee != null)
|
|
// lContent[iRowCount][0] = lUser[iRowCount].Employee.Person.FirstNameLastName;
|
|
// else
|
|
// lContent[iRowCount][0] = string.Empty;
|
|
|
|
// if (lUser[iRowCount].LoginName != null)
|
|
// lContent[iRowCount][1] = lUser[iRowCount].LoginName;
|
|
// else
|
|
// lContent[iRowCount][1] = string.Empty;
|
|
|
|
// if (lUser[iRowCount].UserGroups != null && lUser[iRowCount].UserGroups.Count > 0)
|
|
// lContent[iRowCount][2] = string.Join(", ", lUser[iRowCount].UserGroups.Select(
|
|
// r => r.Name).OrderBy(s => s).ToArray());
|
|
// else
|
|
// lContent[iRowCount][2] = string.Empty;
|
|
//}
|
|
#endregion
|
|
|
|
var helper = PluginLoader.FindClass<ExportAndPrintHelper>();
|
|
|
|
string[] lHeaderCaption = helper.PrepareHeaderArrayForUserExport();
|
|
string[][] lContent = helper.PrepareContentArrayForUserExport(oids.ToArray());
|
|
|
|
// Zweidimensionales Array zu DataTable konvertieren
|
|
DataTable table = new DataTable();
|
|
int columnNumber = 3;
|
|
for (int i = 0; i < columnNumber; i++)
|
|
table.Columns.Add(lHeaderCaption[i], typeof(string));
|
|
|
|
|
|
int rowNumber = lContent.GetLength(0);
|
|
for (int i = 0; i < rowNumber; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
for (int j = 0; j < columnNumber; j++)
|
|
{
|
|
row[j] = lContent[i][j];
|
|
}
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Benutzer" }, table);
|
|
queryReportObject.Name = "Benutzer";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateEmployeeListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Mitarbeiter");
|
|
var helper = PluginLoader.FindClass<ExportAndPrintHelper>();
|
|
|
|
string[] lHeaderCaption = helper.PrepareHeaderArrayForEmployeeExport();
|
|
string[][] lContent = helper.PrepareContentArrayForEmployeeExport(oids.ToArray());
|
|
|
|
|
|
DataTable table = new DataTable();
|
|
int columnNumber = lHeaderCaption.Count();
|
|
// Spalten nur bis zur 10., da sonst der Druck nicht lesbar ist und weil in den ersten 9 die Kerninfos stehen
|
|
for (int i = 0; i < 10; i++)
|
|
table.Columns.Add(lHeaderCaption[i], typeof(string));
|
|
|
|
|
|
int rowNumber = lContent.GetLength(0);
|
|
for (int i = 0; i < rowNumber; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
// Spalten nur bis zur 10., da sonst der Druck nicht lesbar ist und weil in den ersten 9 die Kerninfos stehen
|
|
for (int j = 0; j < 10; j++)
|
|
{
|
|
row[j] = lContent[i][j];
|
|
}
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Mitarbeiter" }, table);
|
|
queryReportObject.Name = "Mitarbeiter";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateInvoiceOverviewReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Invoices");
|
|
var invoices = MapperFactory.InvoiceBaseDC_InvoiceBase.MapToNewDCs(DAOFactory.GenericDAO.LoadByIDs<InvoiceBase>(oids));
|
|
|
|
|
|
DataTable table = new DataTable();
|
|
string[] spalten = new string[] { "Art der Rechnung", "Klient/in", "Zeitraum", "Nummer", "Datum", "Empfänger", "Betrag", "Bemerkung",
|
|
"Geprüft", "Versendet", "Exportiert", "Bezahlt", "Teilzahlung"};
|
|
|
|
for (int i = 0; i < spalten.Length; i++)
|
|
table.Columns.Add(spalten[i], typeof(string));
|
|
|
|
for (int i = 0; i < invoices.Count; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
InvoiceBaseDC invoice = invoices[i];
|
|
row[0] = invoice.InvoiceTypeText;
|
|
row[1] = invoice.CustomerLastName + ", " + invoice.CustomerFirstName;
|
|
row[2] = invoice.PeriodString;
|
|
row[3] = invoice.InvoiceNumber;
|
|
row[4] = string.Format("{0:dd.MM.yyyy}", invoice.InvoiceDate);
|
|
string recipient = invoice.RecipientOrganisation;
|
|
if (!string.IsNullOrEmpty(recipient) && (!string.IsNullOrEmpty(invoice.RecipientPersonFirstName) || !string.IsNullOrEmpty(invoice.RecipientPersonLastName)))
|
|
{
|
|
recipient += " - ";
|
|
}
|
|
recipient += invoice.RecipientPersonFirstName + " " + invoice.RecipientPersonLastName;
|
|
|
|
row[5] = recipient;
|
|
row[6] = string.Format("{0:0.00}", invoice.TotalAmount);
|
|
row[7] = invoice.Notice;
|
|
row[8] = invoice.IsReviewed ? "Ja" : "";
|
|
row[9] = invoice.IsSent ? "Ja" : "";
|
|
row[10] = invoice.IsExported ? "Ja" : "";
|
|
row[11] = invoice.IsPaid ? "Ja" : "";
|
|
row[12] = invoice.PartialPayment;
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Rechnungen" }, table);
|
|
queryReportObject.Name = "Rechnungen";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateTeamListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Teams");
|
|
var teams = DAOFactory.GenericDAO.LoadByIDs<Team>(oids);
|
|
|
|
DataTable table = new DataTable();
|
|
string[] spalten = new string[] { "Name", "Leitung", "Notiz", "Mitglieder" };
|
|
for (int i = 0; i < spalten.Length; i++)
|
|
table.Columns.Add(spalten[i], typeof(string));
|
|
|
|
for (int i = 0; i < teams.Count; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
Team team = teams[i];
|
|
row[0] = team.Name;
|
|
row[1] = team.Leader;
|
|
row[2] = team.Notice;
|
|
String mitglieder = "";
|
|
|
|
IOrderedEnumerable<Employee> employees = team.MemberList.OrderBy(m => m.Person.LastName + ", " + m.Person.FirstName);
|
|
foreach (Employee employee in employees)
|
|
{
|
|
if (employee.Person != null)
|
|
{
|
|
mitglieder += employee.Person.FirstName + " " + employee.Person.LastName + ", ";
|
|
}
|
|
}
|
|
if (mitglieder.Length > 2)
|
|
{
|
|
row[3] = mitglieder.Substring(0, mitglieder.Length - 2);
|
|
}
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Teams" }, table);
|
|
queryReportObject.Name = "Teams";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public override XtraReport CreateUserGroupListReport(List<long> oids)
|
|
{
|
|
var queryReport = FindReportImp<QueryRO>(null, "Benutzergruppen");
|
|
var helper = PluginLoader.FindClass<ExportAndPrintHelper>();
|
|
|
|
//var lUserGroups = DAOFactory.GenericDAO.LoadByIDs<UserGroup>(oids);
|
|
|
|
string[] lHeaderCaption = helper.PrepareHeaderArrayForUserGroupExport();
|
|
string[][] lContent = helper.PrepareContentArrayForUserGroupExport(oids.ToArray());
|
|
|
|
#region alt
|
|
//for (int iRowCount = 0; iRowCount < lUserGroups.Count; iRowCount++)
|
|
//{
|
|
// lContent[iRowCount] = new string[lHeaderCaption.Count()];
|
|
|
|
// if (lUserGroups[iRowCount].Name != null)
|
|
// lContent[iRowCount][0] = lUserGroups[iRowCount].Name;
|
|
// else
|
|
// lContent[iRowCount][0] = string.Empty;
|
|
|
|
// if (lUserGroups[iRowCount].Description != null)
|
|
// lContent[iRowCount][1] = lUserGroups[iRowCount].Description;
|
|
// else
|
|
// lContent[iRowCount][1] = string.Empty;
|
|
|
|
// if (lUserGroups[iRowCount].Rights != null && lUserGroups[iRowCount].Rights.Count > 0)
|
|
// lContent[iRowCount][2] = string.Join(", ", lUserGroups[iRowCount].Rights.Select(
|
|
// r => EnumTranslations.UserRightType2Translations[r.RightType]).OrderBy(s => s).ToArray());
|
|
// else
|
|
// lContent[iRowCount][2] = string.Empty;
|
|
//}
|
|
#endregion
|
|
|
|
DataTable table = new DataTable();
|
|
int columnNumber = 3;
|
|
for (int i = 0; i < columnNumber; i++)
|
|
table.Columns.Add(lHeaderCaption[i], typeof(string));
|
|
|
|
|
|
int rowNumber = lContent.GetLength(0);
|
|
for (int i = 0; i < rowNumber; i++)
|
|
{
|
|
DataRow row = table.NewRow();
|
|
for (int j = 0; j < columnNumber; j++)
|
|
{
|
|
row[j] = lContent[i][j];
|
|
}
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
var queryReportObject = QueryRO.Create(new Query() { Title = "Benutzergruppen" }, table);
|
|
queryReportObject.Name = "Benutzergruppen";
|
|
queryReport.SetReportDataSource(queryReportObject);
|
|
|
|
return queryReport as XtraReport;
|
|
}
|
|
|
|
public XtraReport CreateServiceRecordChangesReport(DateTime start, DateTime end)
|
|
{
|
|
var ro = ServiceRecordChangesAfterInvoiceDateRO.Create(start, end);
|
|
|
|
var report = FindReportImp<ServiceRecordChangesAfterInvoiceDateRO>();
|
|
report.SetReportDataSource(ro);
|
|
|
|
return report as XtraReport;
|
|
|
|
}
|
|
|
|
public override XtraReport CreateGkvAbrechnungReport(GkvAbrechnungReportRequest req)
|
|
{
|
|
var os = new OperationsServiceImp();
|
|
var mandator = os.GetMandatorEntity();
|
|
|
|
var employee = UserRightHelper.GetLoggedInUser().Employee;
|
|
|
|
var gkvAbrechnung = DAOFactory.GenericDAO.LoadByID<GkvAbrechnung>(req.Oid);
|
|
var gkvAbrechnungDC = MapperFactory.GkvAbrechnungDC_GkvAbrechnung.MapToNewDC(gkvAbrechnung);
|
|
|
|
var invoicebase = gkvAbrechnungDC.InvoiceBases.First();
|
|
var customer_oid = invoicebase.CustomerOid;
|
|
|
|
var plugin = PluginLoader.FindClass<AccountingService>();
|
|
var address_information = plugin.GetAddressInformation(customer_oid);
|
|
|
|
var ro = GkvAbrechnungRO.Create(gkvAbrechnungDC, mandator, employee, address_information);
|
|
|
|
var report = FindReportImp<GkvAbrechnungRO>();
|
|
report.SetReportDataSource(ro);
|
|
|
|
var xtra = report as XtraReport;
|
|
|
|
if (req.AddUrbelege)
|
|
{
|
|
AddQuittierungsbelegToReport(xtra, gkvAbrechnung);
|
|
}
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
private void AddQuittierungsbelegToReport(XtraReport xtra, GkvAbrechnung gkvAbrechnung)
|
|
{
|
|
xtra.CreateDocument();
|
|
|
|
var dict = new Dictionary<long, HashSet<Point>>();
|
|
foreach (var invb in gkvAbrechnung.InvoiceBases)
|
|
{
|
|
var coid = invb.CostBearer2SupportConcept.SupportConcept.Customer.Oid.Value;
|
|
|
|
if (!dict.ContainsKey(coid))
|
|
dict.Add(coid, new HashSet<Point>());
|
|
|
|
var points = dict[coid];
|
|
|
|
var start = invb.AccountingPeriodStart.Value;
|
|
var end = invb.AccountingPeriodEnd.Value;
|
|
|
|
var start_1 = start.AddMonths(1);
|
|
var runner = new DateTime(start_1.Year, start_1.Month, 1);
|
|
|
|
points.Add(new Point(start.Year, start.Month));
|
|
|
|
while(runner <= end)
|
|
{
|
|
points.Add(new Point(runner.Year, runner.Month));
|
|
|
|
runner = runner.AddMonths(1);
|
|
}
|
|
}
|
|
|
|
foreach (var kv in dict)
|
|
{
|
|
var coid = kv.Key;
|
|
|
|
foreach (var point in kv.Value.OrderBy(x => x.X).ThenBy(x => x.Y))
|
|
{
|
|
var year = point.X;
|
|
var month = point.Y;
|
|
|
|
var quittierung = CreateServiceOverviewSingleCustomerReport(coid, month, year, 0, 0, null);
|
|
|
|
quittierung.CreateDocument();
|
|
|
|
xtra.Pages.AddRange(quittierung.Pages);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |