InputFamilienhilfe/CustomReportCreator - in einigen Fällen QB an Rechnung

This commit is contained in:
2024-08-19 10:28:29 +02:00
parent d9181cad47
commit 1023ceee15
2 changed files with 65 additions and 31 deletions

View File

@@ -15,39 +15,83 @@ namespace InputFamilienhilfe
{
class CustomReportCreator : DefaultReportCreator
{
public override XtraReport CreateServiceInvoiceReport(String dcIds, long? invoiceBaseOid)
public override XtraReport CreateServiceInvoiceReport(string dcIds, long? invoiceBaseOid)
{
ServiceInvoice serviceInvoice = null;
int serviceInvoiceOid = 0;
if (!String.IsNullOrEmpty(dcIds) && Int32.TryParse(dcIds, out serviceInvoiceOid))
if (String.IsNullOrEmpty(dcIds) && invoiceBaseOid.HasValue)
{
serviceInvoice = DAOFactory.GenericDAO.LoadByID<ServiceInvoice>(serviceInvoiceOid);
}
else if (invoiceBaseOid.HasValue)
{
serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(invoiceBaseOid.Value);
var serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(invoiceBaseOid.Value);
dcIds = String.Format("{0}", serviceInvoice.Oid);
}
if (serviceInvoice != null)
if (!string.IsNullOrEmpty(dcIds))
{
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))
var dcList = new List<ServiceInvoiceDC>();
var dcidStrs = dcIds.Split(';');
foreach (var oidStr in dcidStrs)
{
report = new InputFamilienhilfe.Neu.Rechnung();
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;
if (iDC.ServiceInvoicePeriods.Count > 0 && iDC.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.ServiceCategory != null
&& iDC.ServiceInvoicePeriods[0].Customer.CustomerAlias != null &&
iDC.ServiceInvoicePeriods[0].Customer.CustomerAlias.ToLower() != "aws" &&
iDC.ServiceInvoicePeriods[0].Customer.CustomerAlias.ToLower() != "bjw" &&
iDC.ServiceInvoicePeriods[0].Customer.CustomerAlias.ToLower() != "tagesbetreuung" &&
iDC.ServiceInvoicePeriods[0].Customer.CustomerAlias.ToLower() != "ion")
{
var seite1 = new InputFamilienhilfe.Neu.Rechnung();
var ro = ServiceInvoiceRO.Create(iDC);
seite1.SetReportDataSource(ro);
seite1.CreateDocument();
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;
var qb = CreateServiceOverviewSingleCustomerReport(cOid, month, year, oOid, 0, null, 1, DateTime.DaysInMonth(year, month));
qb.CreateDocument();
seite1.Pages.AddRange(qb.Pages);
invoiceReport = seite1;
}
else
{
report = new InputFamilienhilfe.Rechnung();
IBeWoReport<ServiceInvoiceRO> singleReport = FindReportImp<ServiceInvoiceRO>(iDC.InvoiceBase.InvoiceId);
var ro = ServiceInvoiceRO.Create(iDC);
singleReport.SetReportDataSource(ro);
((XtraReport)singleReport).CreateDocument();
invoiceReport = singleReport as XtraReport;
}
report.SetReportDataSource(ro);
((XtraReport)report).CreateDocument();
return (XtraReport)report;
if (allReports == null)
{
allReports = invoiceReport;
}
else
{
((XtraReport)allReports).Pages.AddRange(invoiceReport.Pages);
}
}
return base.CreateServiceInvoiceReport(dcIds, invoiceBaseOid);
return allReports as XtraReport;
}
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)

View File

@@ -35,7 +35,6 @@
<Reference Include="DevExpress.Data.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.DataAccess.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.Office.v23.2.Core, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.RichEdit.v23.2.Core, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
@@ -129,12 +128,6 @@
<Compile Include="RechnungspositionenSubReport.Designer.cs">
<DependentUpon>RechnungspositionenSubReport.cs</DependentUpon>
</Compile>
<Compile Include="Rechnung.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Rechnung.Designer.cs">
<DependentUpon>Rechnung.cs</DependentUpon>
</Compile>
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
<Compile Include="Invoicing\VerfahrensbeistandInvoiceCreation.cs" />
<Compile Include="Invoicing\DefaultInvoiceCreation.cs" />
@@ -220,9 +213,6 @@
<EmbeddedResource Include="RechnungspositionenSubReport.resx">
<DependentUpon>RechnungspositionenSubReport.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rechnung.resx">
<DependentUpon>Rechnung.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="SettlementReport.resx">
<DependentUpon>SettlementReport.cs</DependentUpon>