123 lines
3.9 KiB
C#
123 lines
3.9 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.DCEntityMapper;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraReports.Design;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace Fortis
|
|
{
|
|
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).OrderBy(ro => ro.CustomerLastName).ToList();
|
|
|
|
if (lROs.Count > 0)
|
|
{
|
|
|
|
var rootReport = CreateServicesOverviewReportForRo(lROs[0], serviceCategoryOid);
|
|
//rootReport.CreateDocument();
|
|
|
|
for (int i = 1; i < lROs.Count; i++)
|
|
{
|
|
var lNext = CreateServicesOverviewReportForRo(lROs[i], serviceCategoryOid);
|
|
|
|
rootReport.Pages.AddRange(lNext.Pages);
|
|
}
|
|
|
|
return rootReport;
|
|
}
|
|
return new 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);
|
|
}
|
|
}
|
|
|
|
roList = roList.OrderBy(ro => ro.CustomerLastName).ToList();
|
|
|
|
if (roList.Count > 0)
|
|
{
|
|
var rootReport = CreateServicesOverviewReportForRo(roList[0], serviceCategoryOid);
|
|
|
|
|
|
for (int i = 1; i < roList.Count; i++)
|
|
{
|
|
var lNext = CreateServicesOverviewReportForRo(roList[i], serviceCategoryOid);
|
|
|
|
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 customer = DAOFactory.GenericDAO.LoadByID<Customer>(customerOid);
|
|
//if (customer.Person.LastName.ToLower().Contains("test") || customer.Person.FirstName.ToLower().Contains("test"))
|
|
//{
|
|
DateTime startDate = new DateTime(year, month, 1);
|
|
|
|
if (startDay == 1 && endDay == DateTime.DaysInMonth(year, month))
|
|
{
|
|
int months = 3;
|
|
var endDate = startDate.AddMonths(months);
|
|
|
|
endDay = (int)endDate.Subtract(startDate).TotalDays;
|
|
}
|
|
//}
|
|
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
|
|
|
|
return CreateServicesOverviewReportForRo(ro, serviceCategoryOid);
|
|
|
|
}
|
|
|
|
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid)
|
|
{
|
|
IBeWoReport<ServicesOverviewRO> report = null;
|
|
|
|
//if (ro.CustomerFirstName.Contains("TEST") || ro.CustomerLastName.Contains("TEST"))
|
|
//{
|
|
report = new Fortis.ZeitdokumentationPlanIstUebersicht();
|
|
report.SetReportDataSource(ro);
|
|
((XtraReport)report).CreateDocument();
|
|
|
|
var qb = new Fortis.Quittierungsbeleg();
|
|
qb.SetReportDataSource(ro);
|
|
qb.CreateDocument();
|
|
((XtraReport)report).Pages.AddRange(qb.Pages);
|
|
|
|
return report as XtraReport;
|
|
//}
|
|
|
|
report = new BeWo.Report.DefaultReports.Quittierungsbeleg();
|
|
report.SetReportDataSource(ro);
|
|
|
|
return report as XtraReport;
|
|
}
|
|
}
|
|
}
|