Files
BeWoPlaner/ReportImp/HPHBersenbrueck/CustomReportCreator.cs

89 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Windows.Forms;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace HphBersenbrueck
{
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);
if (lROs.Count > 0)
{
var rootReport = CreateServicesOverviewReportForRo(lROs[0]);
rootReport.CreateDocument();
for (int i = 1; i < lROs.Count; i++)
{
var lNext = CreateServicesOverviewReportForRo(lROs[i]);
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);
}
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro)
{
bool neu = false;
if (ro.Services != null)
{
foreach (ServicesOverviewRO.ServiceDetail s in ro.Services)
{
if (s.ServiceCategory.Contains("Neu Qualifizierte Assistenz"))
{
neu = true;
}
//}
}
}
IBeWoReport<ServicesOverviewRO> qb;
if (neu)
{
qb = new BeWo.HPHBersenbrueck.QuittierungsbelegHannover();
}
else
{
qb = new BeWo.HPHBersenbrueck.Stundenzettel();
}
qb.SetReportDataSource(ro);
return qb as XtraReport;
}
}
}