68 lines
2.1 KiB
C#
68 lines
2.1 KiB
C#
using System;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BS.Shared;
|
|
using BS.Shared.Extensions;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace QuerFaelltEin
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
{
|
|
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Monat {0:MMMM yyyy} folgende erbrachte Tätigkeiten:", start);
|
|
}
|
|
else
|
|
{
|
|
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end);
|
|
}
|
|
|
|
String sd = GetServiceDescription(pRO);
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
ii.ServiceDescription = sd;
|
|
}
|
|
}
|
|
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private string GetServiceDescription(ServiceInvoiceRO pRo)
|
|
{
|
|
if (pRo.InvoiceBase != null)
|
|
{
|
|
if (pRo.InvoiceBase.RecipientOrganisationOid.HasValue)
|
|
{
|
|
var cb = DAOFactory.GenericDAO.LoadByID<CostBearer>(pRo.InvoiceBase.RecipientCostBearerOid.Value);
|
|
|
|
var crDcList = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(cb.CostRatePeriods);
|
|
|
|
var cr = crDcList.GetCurrentlyValidRate(CostRatePeriodType.MinutesPerServiceUnit);
|
|
|
|
if (cr != null)
|
|
{
|
|
return cr.UnitName;
|
|
}
|
|
}
|
|
}
|
|
|
|
return "";
|
|
}
|
|
}
|
|
} |