72 lines
3.0 KiB
C#
72 lines
3.0 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.FirstName.ToLower().Contains("(ka)"))
|
|
{
|
|
sip.Customer.FirstName = sip.Customer.FirstName.Replace("(ka)", "").Trim();
|
|
sip.Customer.FirstName = sip.Customer.FirstName.Replace("(KA)", "").Trim();
|
|
}
|
|
sip.Customer.LastName = sip.Customer.LastName + ", " + sip.Customer.FirstName;
|
|
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";
|
|
}
|
|
|
|
pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName));
|
|
var count = pRO.ServiceInvoicePeriods.Count;
|
|
var pos = 1;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
var sip = pRO.ServiceInvoicePeriods[i];
|
|
if (sip.ServiceInvoiceItems.Count > 0)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
ii.CustomerFirstname = pos++.ToString();
|
|
if(ii.Notice == null && sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval.HasValue)
|
|
{
|
|
ii.Notice = String.Format("{0:n0}", sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |