Files
BeWoPlaner/ReportImp/AKGG/ServiceInvoiceReportPK.cs
2022-09-05 16:56:32 +02:00

84 lines
3.2 KiB
C#

using System;
using System.Linq;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace Akgg
{
[IDSpecificClass(Identifier = "PK")]
public partial class ServiceInvoiceReportPK : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReportPK()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
DateTime start = pRO.AccountingPeriodStart;
DateTime end = pRO.AccountingPeriodEnd;
if (start.Month == end.Month && start.Year == end.Year)
{
pRO.AccountingPeriod = String.Format("{0:MMMM yyyy}", start);
}
else
{
pRO.AccountingPeriod = String.Format("{0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
}
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !pRO.RecipientOrganisation.Contains("Selbsteinreicher"))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation != "SELBSTZAHLER")
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine("");
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
if (pRO.RecipientOrganisation.Contains("Selbsteinreicher"))
lblEinreichung.Visible = true;
foreach (var sip in pRO.ServiceInvoicePeriods)
{
foreach (var ii in sip.ServiceInvoiceItems)
{
if (ii.ServiceRecord != null && ii.ServiceRecord.ServiceDescription.CategoryName.Contains("Fahrten"))
ii.Duration = ii.ServiceDescription;
else if (ii.ServiceRecord != null && ii.ServiceRecord.ServiceDescription.CategoryName.Contains("Entlastung"))
ii.Duration = String.Format("Betreuungsstunden {0}", ii.Duration.Substring(0, 8));
else if (ii.ServiceRecord != null && ii.ServiceRecord.ServiceDescription.CategoryName.Contains("Verhinderung"))
ii.Duration = String.Format("Pflegestunden {0}", ii.Duration.Substring(0, 8));
else
ii.Duration = ii.ServiceDescription;
}
sip.ServiceInvoiceItems = sip.ServiceInvoiceItems.OrderBy(i => i.Duration).ToList();
}
if (pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems[0].Duration.Contains("Betreuung"))
lblKategorie.Text = "Entlastungsbetrag gem. § 45 SGB XI";
this.bindingSource1.DataSource = pRO;
}
}
}