118 lines
5.2 KiB
C#
118 lines
5.2 KiB
C#
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
using BS.Shared.Core;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace PerspektivenEV
|
|
{
|
|
//[IDSpecificClass(Identifier = "SammelrechnungBthg")]
|
|
public partial class SammelrechnungTabBthgIntern : XtraReport //, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public SammelrechnungTabBthgIntern()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
|
|
pRO.RecipientOrganisation = "LWV Hessen";
|
|
pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName));
|
|
var i = 1;
|
|
|
|
//if (pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept.ApprovedEndDate == null)
|
|
//{
|
|
// lblaktuell.Text = "Aktuell";
|
|
// lblZeitraum.Text = "beantragter Zeitraum";
|
|
//}
|
|
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (sip.ServiceInvoiceItems.Count > 0)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
ii.UnitCountString = "";
|
|
ii.CustomerFirstname = i++.ToString();
|
|
ii.CustomerLastname = sip.Customer.CustomerOid.ToString();
|
|
if (sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval.HasValue)
|
|
{
|
|
ii.RateFactor = sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval.Value.ToString("n0");
|
|
}
|
|
if (ii.ServiceDescription.Contains("TS"))
|
|
{
|
|
if (ii.ServiceDescription.Contains("Kö"))
|
|
{
|
|
ii.UnitCountString = "Kö";
|
|
}
|
|
else if (ii.ServiceDescription.Contains("Stb"))
|
|
{
|
|
ii.UnitCountString = "Stb";
|
|
}
|
|
else if (ii.ServiceDescription.Contains("OU"))
|
|
{
|
|
ii.UnitCountString = "OU";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (sip.Notice != null)
|
|
{
|
|
if (sip.ServiceInvoiceItems.Count > 0)
|
|
sip.NotBillableString = sip.ServiceInvoiceItems[0].UnitDescription;
|
|
}
|
|
sip.Notice = "Nein";
|
|
if (sip.CostBearer2SupportConcept.ApprovedStartDate != null)
|
|
{
|
|
sip.Notice = "Ja";
|
|
}
|
|
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 = "";
|
|
}
|
|
}
|
|
|
|
//Format der aggregierten TS Minuten
|
|
pRO.ServiceInvoicePeriods = pRO.ServiceInvoicePeriods.OrderBy(a => a.Customer.CustomerOid).ThenByDescending(b => b.ServiceInvoiceItems[0].ServiceDescription).ToList();
|
|
var listLength = pRO.ServiceInvoicePeriods.Count;
|
|
for (int j = listLength - 1; j >= 0; j--)
|
|
{
|
|
var sip = pRO.ServiceInvoicePeriods[j];
|
|
if (sip.ServiceInvoiceItems[0].ServiceDescription != null && sip.ServiceInvoiceItems[0].ServiceDescription.StartsWith("Qualifizierte Assistenz TS"))
|
|
{
|
|
if (j + 1 != listLength && pRO.ServiceInvoicePeriods[j + 1].ServiceInvoiceItems[0].ServiceDescription.StartsWith("Qualifizierte Assistenz"))
|
|
{
|
|
var ii = sip.ServiceInvoiceItems[0];
|
|
var iiNew = pRO.ServiceInvoicePeriods[j + 1].ServiceInvoiceItems[0];
|
|
decimal minTS = 0;
|
|
decimal minQa = 0;
|
|
decimal.TryParse(ii.Notice, out minTS);
|
|
decimal.TryParse(iiNew.Notice, out minQa);
|
|
if (minTS > 0 && minQa > 0)
|
|
{
|
|
minTS = minTS - minQa;
|
|
ii.Notice = ""; //minTS.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
pRO.ServiceInvoicePeriods = pRO.ServiceInvoicePeriods.OrderBy(a => a.Customer.LastNameFirstName).ThenByDescending(b => b.ServiceInvoiceItems[0].NetAmount).ToList();
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |