75 lines
2.7 KiB
C#
75 lines
2.7 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 BeWo.SprungbrettReports
|
|
{
|
|
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 && lSettlementDC.DifferentHourlyRateCount < 4)
|
|
{
|
|
IBeWoReport<SettlementRO> lSettlementReport = FindReportImp<SettlementRO>(reportId);
|
|
var ro = SettlementRO.Create(lSettlementDC);
|
|
lSettlementReport.SetReportDataSource(ro);
|
|
|
|
report = lSettlementReport as XtraReport;
|
|
}
|
|
else
|
|
{
|
|
var ro = new Budgetnachweis();
|
|
var sro = SettlementRO.Create(lSettlementDC);
|
|
//foreach (var item in sro.InvoiceItems)
|
|
//{
|
|
// item.UnitCount *= 1.2m;
|
|
//}
|
|
ro.SetReportDataSource(sro);
|
|
ro.CreateDocument();
|
|
report = ro as XtraReport;
|
|
}
|
|
|
|
|
|
return report;
|
|
}
|
|
}
|
|
}
|