57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraReports.UI;
|
|
using System;
|
|
|
|
namespace InputFamilienhilfe
|
|
{
|
|
class CustomReportCreator : DefaultReportCreator
|
|
{
|
|
public override XtraReport CreateServiceInvoiceReport(String dcIds, long? invoiceBaseOid)
|
|
{
|
|
ServiceInvoice serviceInvoice = null;
|
|
int serviceInvoiceOid = 0;
|
|
if (!String.IsNullOrEmpty(dcIds) && Int32.TryParse(dcIds, out serviceInvoiceOid))
|
|
{
|
|
serviceInvoice = DAOFactory.GenericDAO.LoadByID<ServiceInvoice>(serviceInvoiceOid);
|
|
}
|
|
else if (invoiceBaseOid.HasValue)
|
|
{
|
|
serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(invoiceBaseOid.Value);
|
|
}
|
|
|
|
if (serviceInvoice != null)
|
|
{
|
|
|
|
var dc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(serviceInvoice);
|
|
var ro = ServiceInvoiceRO.Create(dc);
|
|
|
|
IBeWoReport<ServiceInvoiceRO> report = null;
|
|
|
|
if (serviceInvoice.InvoiceBase.AccountingPeriodStart.Value >= new DateTime(2022, 12, 1))
|
|
{
|
|
report = new InputFamilienhilfe.Neu.Rechnung();
|
|
}
|
|
else
|
|
{
|
|
report = new InputFamilienhilfe.Rechnung();
|
|
}
|
|
|
|
report.SetReportDataSource(ro);
|
|
((XtraReport)report).CreateDocument();
|
|
|
|
return (XtraReport)report;
|
|
|
|
}
|
|
|
|
return base.CreateServiceInvoiceReport(dcIds, invoiceBaseOid);
|
|
}
|
|
|
|
|
|
}
|
|
}
|