64 lines
2.7 KiB
C#
64 lines
2.7 KiB
C#
using System;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using DevExpress.XtraReports.UI;
|
|
using BS.Shared.Core;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace HausDuelken
|
|
{
|
|
[IDSpecificClass(Identifier = "Stationär")]
|
|
public partial class ServiceInvoiceReportStationaer : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReportStationaer()
|
|
{
|
|
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);
|
|
}
|
|
|
|
Dictionary<string, string> cats = new Dictionary<string, string>();
|
|
pRO.ApprovalDate = null;
|
|
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (sip.ServiceInvoiceItems.Count > 0)
|
|
{
|
|
sip.ApprovedAmount = sip.ServiceInvoiceItems[0].GrossAmount;
|
|
sip.ApprovedHours = sip.ServiceInvoiceItems.Count;
|
|
sip.Notice = sip.ServiceInvoiceItems[0].ServiceDescription;
|
|
var first = sip.ServiceInvoiceItems.OrderBy(i => i.AccountingPeriodStart).FirstOrDefault();
|
|
var last = sip.ServiceInvoiceItems.OrderBy(i => i.AccountingPeriodStart).LastOrDefault();
|
|
sip.ApprovalPeriod = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", first.AccountingPeriodStart, last.AccountingPeriodEnd);
|
|
}
|
|
|
|
if (sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.ServiceCategory != null)
|
|
{
|
|
if (!cats.ContainsKey(sip.SupportConceptApprovalPeriod.ServiceCategory.Name))
|
|
{
|
|
if (pRO.ApprovalDate != null)
|
|
{
|
|
pRO.ApprovalDate += ", ";
|
|
}
|
|
pRO.ApprovalDate += sip.SupportConceptApprovalPeriod.ServiceCategory.Name;
|
|
cats.Add(sip.SupportConceptApprovalPeriod.ServiceCategory.Name, sip.SupportConceptApprovalPeriod.ServiceCategory.Name);
|
|
}
|
|
}
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |