89 lines
3.3 KiB
C#
89 lines
3.3 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 BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraReports.Design;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace Wetterleuchten
|
|
{
|
|
public class CustomReportCreator : DefaultReportCreator
|
|
{
|
|
public override XtraReport CreateSettlementReport(string dcId, long? invoiceBaseOid)
|
|
{
|
|
XtraReport report = null;
|
|
|
|
Settlement2DC lSettlementDC;
|
|
|
|
long result;
|
|
|
|
if (string.IsNullOrEmpty(dcId) && invoiceBaseOid.HasValue)
|
|
lSettlementDC = MapperFactory.SettlementDC_SettlementInvoice.MapToNewDC(DAOFactory.SearchDAO.GetSettlementInvoiceByInvoiceBaseOid(invoiceBaseOid.Value));
|
|
|
|
else if (Int64.TryParse(dcId, out result))
|
|
lSettlementDC = MapperFactory.SettlementDC_SettlementInvoice.MapToNewDC(DAOFactory.GenericDAO.LoadByID<SettlementInvoice>(result)); // = Utils.XMLDeserialize<SettlementDC>(lPath);
|
|
|
|
else
|
|
{
|
|
string lPath = BS.Shared.Core.Utils.CreateSavePath(TempPath, dcId);
|
|
lSettlementDC = Utils.XMLDeserialize<Settlement2DC>(lPath);
|
|
}
|
|
if (lSettlementDC.RecordedBillableFLSNetto == 0)
|
|
{
|
|
lSettlementDC.RecordedBillableFLSNetto = lSettlementDC.RecordedBillableFLSBrutto ?? 0;
|
|
}
|
|
String reportId = null;
|
|
if (lSettlementDC.CostBearer2SupportConceptOid.HasValue)
|
|
{
|
|
CostBearer2SupportConcept c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(lSettlementDC.CostBearer2SupportConceptOid.Value);
|
|
reportId = c2s.CostBearer.ID;
|
|
}
|
|
|
|
if (lSettlementDC.DifferentHourlyRateCount > 0)
|
|
{
|
|
IBeWoReport<SettlementRO> lSettlementReport = FindReportImp<SettlementRO>(reportId);
|
|
var ro = SettlementRO.Create(lSettlementDC);
|
|
lSettlementReport.SetReportDataSource(ro);
|
|
|
|
report = lSettlementReport as XtraReport;
|
|
}
|
|
else
|
|
{
|
|
IBeWoReport<Settlement2RO> lSettlementReport = FindReportImp<Settlement2RO>(reportId);
|
|
lSettlementReport.SetReportDataSource(Settlement2RO.Create(lSettlementDC));
|
|
report = lSettlementReport as XtraReport;
|
|
}
|
|
|
|
var tmp = new Budgetnachweis();
|
|
tmp.SetReportDataSource(SettlementRO.Create(lSettlementDC));
|
|
tmp.CreateDocument();
|
|
|
|
if (report != null)
|
|
{
|
|
report.CreateDocument();
|
|
var anhang = CreateBudgetnachweisAnhang(lSettlementDC);
|
|
if (anhang != null)
|
|
{
|
|
anhang.CreateDocument();
|
|
tmp.Pages.AddRange(anhang.Pages);
|
|
}
|
|
}
|
|
|
|
var seite2 = report;
|
|
seite2.CreateDocument();
|
|
|
|
tmp.Pages.AddRange(seite2.Pages);
|
|
report = tmp;
|
|
return report;
|
|
}
|
|
//return base.CreateSettlementReport(dcId, invoiceBaseOid, true);
|
|
}
|
|
}
|