55 lines
2.1 KiB
C#
55 lines
2.1 KiB
C#
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
using BS.Shared.Core;
|
|
using System;
|
|
|
|
namespace SHKService
|
|
{
|
|
[IDSpecificClass(Identifier = "Sammelrechnung")]
|
|
public partial class SammelrechnungTab : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public SammelrechnungTab()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
|
|
pRO.RecipientOrganisation = "LWV Hessen";
|
|
pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName));
|
|
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (sip.Customer.LastName.ToLower().Contains("(ka)"))
|
|
{
|
|
sip.Customer.LastName = sip.Customer.LastName.Replace(" (ka)", "");
|
|
}
|
|
if (sip.Notice != null)
|
|
{
|
|
if (sip.ServiceInvoiceItems.Count > 0)
|
|
sip.NotBillableString = sip.ServiceInvoiceItems[0].UnitDescription;
|
|
}
|
|
if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat"))
|
|
sip.ApprovedHours = 1;
|
|
else
|
|
{
|
|
DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd;
|
|
DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart;
|
|
|
|
sip.ApprovedHours = (decimal)(end - start).TotalDays;
|
|
}
|
|
if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
|
|
sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG";
|
|
}
|
|
|
|
//var anhang = new SammelrechnungAnhang();
|
|
//xrSubreport1.ReportSource = anhang;
|
|
//anhang.SetReportDataSource(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |