Files
BeWoPlaner/ReportImp/ProIntegra/CustomReportCreator.cs

89 lines
3.5 KiB
C#

using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BeWo.Service.ServiceImplementations;
using DevExpress.XtraReports.UI;
using System;
using System.Collections.Generic;
namespace ProIntegra
{
class CustomReportCreator : DefaultReportCreator
{
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)
{
String reportId = null;
if (orgaOid > 0)
{
var organisation = DAOFactory.GenericDAO.LoadByID<Organisation>(orgaOid);
if (organisation != null)
reportId = organisation.Name;
}
IBeWoReport<ServicesOverviewRO> lServiceOverviewAllCustomersReport = new Quittierungsbeleg();
if (reportId != null)
{
if (reportId.ToLower().Contains("neu"))
lServiceOverviewAllCustomersReport = new QuittierungsbelegNiedersachsen();
}
lServiceOverviewAllCustomersReport.SetReportDataSource(lROs[0]);
(lServiceOverviewAllCustomersReport as XtraReport).CreateDocument();
var Report = lServiceOverviewAllCustomersReport as XtraReport;
for (int i = 1; i < lROs.Count; i++)
{
IBeWoReport<ServicesOverviewRO> lNext = new Quittierungsbeleg();
if (reportId != null)
{
if (reportId.ToLower().Contains("neu"))
lNext = new QuittierungsbelegNiedersachsen();
}
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)
{
String reportId = null;
if (orgaOid > 0)
{
var organisation = DAOFactory.GenericDAO.LoadByID<Organisation>(orgaOid);
if (organisation != null)
reportId = organisation.Name;
}
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
IBeWoReport<ServicesOverviewRO> lServiceOverviewSingleCustomerReport = new Quittierungsbeleg();
if (reportId == null)
reportId = ro.Costbearer;
if (reportId != null)
{
if (reportId.ToLower().Contains("neu"))
lServiceOverviewSingleCustomerReport = new QuittierungsbelegNiedersachsen();
}
if (ro != null)
{
lServiceOverviewSingleCustomerReport.SetReportDataSource(ro);
}
return lServiceOverviewSingleCustomerReport as XtraReport;
}
}
}