FenixSozialeDienste/CustomReportCreator.cs - Anhängen der Leistungsnachweise an Rechnung
This commit is contained in:
93
ReportImp/FenixSozialeDienste/CustomReportCreator.cs
Normal file
93
ReportImp/FenixSozialeDienste/CustomReportCreator.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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;
|
||||
|
||||
namespace FenixSozialeDienste
|
||||
{
|
||||
public class CustomReportCreator : DefaultReportCreator
|
||||
{
|
||||
|
||||
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 dcList = new List<ServiceInvoiceDC>();
|
||||
var dcidStrs = dcIds.Split(';');
|
||||
|
||||
foreach (var oidStr in dcidStrs)
|
||||
{
|
||||
var oid = long.Parse(oidStr);
|
||||
var invoice = DAOFactory.GenericDAO.LoadByID<ServiceInvoice>(oid);
|
||||
var dc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(invoice);
|
||||
dcList.Add(dc);
|
||||
}
|
||||
|
||||
return CreateInvoiceReport(dcList);
|
||||
}
|
||||
return new XtraReport();
|
||||
}
|
||||
|
||||
private XtraReport CreateInvoiceReport(List<ServiceInvoiceDC> invoices)
|
||||
{
|
||||
XtraReport allReports = null;
|
||||
|
||||
foreach (var iDC in invoices)
|
||||
{
|
||||
XtraReport invoiceReport = null;
|
||||
IBeWoReport<ServiceInvoiceRO> seite1 = FindReportImp<ServiceInvoiceRO>(iDC.InvoiceBase.InvoiceId);
|
||||
|
||||
if (iDC.ServiceInvoicePeriods.Count > 0 && iDC.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.ServiceCategory != null)
|
||||
{
|
||||
var ro = ServiceInvoiceRO.Create(iDC);
|
||||
seite1.SetReportDataSource(ro);
|
||||
((XtraReport)seite1).CreateDocument();
|
||||
invoiceReport = seite1 as XtraReport;
|
||||
|
||||
int month = iDC.InvoiceBase.AccountingPeriodStart.Value.Month;
|
||||
int year = iDC.InvoiceBase.AccountingPeriodStart.Value.Year;
|
||||
long cOid = iDC.InvoiceBase.SupportConceptCostBearerRelDc.SupportConcept.Customer.CustomerOid;
|
||||
long oOid = iDC.InvoiceBase.RecipientOrganisationOid ?? 0;
|
||||
|
||||
while (month <= iDC.InvoiceBase.AccountingPeriodEnd.Value.Month)
|
||||
{
|
||||
var qb = CreateServiceOverviewSingleCustomerReport(cOid, month, year, oOid, 0, null, 1, DateTime.DaysInMonth(year, month));
|
||||
qb.CreateDocument();
|
||||
|
||||
invoiceReport.Pages.AddRange(qb.Pages);
|
||||
month++;
|
||||
}
|
||||
}
|
||||
if (invoiceReport == null)
|
||||
{
|
||||
var ro = ServiceInvoiceRO.Create(iDC);
|
||||
seite1.SetReportDataSource(ro);
|
||||
((XtraReport)seite1).CreateDocument();
|
||||
invoiceReport = seite1 as XtraReport;
|
||||
}
|
||||
if (allReports == null)
|
||||
{
|
||||
allReports = invoiceReport;
|
||||
}
|
||||
else
|
||||
{
|
||||
((XtraReport)allReports).Pages.AddRange(invoiceReport.Pages);
|
||||
}
|
||||
}
|
||||
|
||||
return allReports as XtraReport;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CustomReportCreator.cs" />
|
||||
<Compile Include="EmployeeKilometerauswertungsListReport.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user