Files
BeWoPlaner/ReportImp/LebenshilfeBadKreuznachFUD/Reporting/Reports/ServiceInvoiceReport.cs

110 lines
3.9 KiB
C#

using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
using System;
using System.Linq;
using System.Text;
namespace LebenshilfeBadKreuznachFUD
{
public partial class Rechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public Rechnung()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
string art = "";
decimal hours = 0;
if (pRO.ServiceInvoicePeriods != null)
{
if (pRO.ServiceInvoicePeriods.Any(s => (s.SupportConceptApprovalPeriod.ServiceCategory?.Name.ToLower() ?? "").Contains("entlastung")))
{
art = "entlastung";
}
if (pRO.ServiceInvoicePeriods.Any(s => (s.SupportConceptApprovalPeriod.ServiceCategory?.Name.ToLower() ?? "").Contains("pflegesatz")))
{
art = "pflegesatz";
}
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.ServiceInvoiceItems != null && sip.ServiceInvoiceItems.Count > 0)
{
foreach (var ii in sip.ServiceInvoiceItems)
{
hours += ii.Hours ?? 0;
}
}
}
}
if (art == "entlastung")
{
lblZahlziel.Visible = true;
lblIk.Visible = true;
lblZahlziel.Text = String.Format("(bis {0:dd.MM.yyyy})", pRO.InvoiceDateTime.Value.AddDays(30));
lblZahlzeit.Text = "30 Tage";
}
else if (art == "pflegesatz")
{
lblVers.Text = String.Format("Aktenzeichen {0}", pRO.CustomerReferenceNumber);
lblHeader.Text = "Eingliederungshilfe nach SGB IX";
lblHeaderDuration.Text = "Zeitraum";
}
else
{
lblVers.Text = String.Format("Aktenzeichen {0}", pRO.CustomerReferenceNumber);
lblHeader.Text = "Abrechnung Integrationsleistungen";
}
if (!pRO.CreatorName.Contains("Ruta"))
{
lblBearbeiter.Text = "Kirmse";
lblTel.Text = "0671/483269-118";
lblMail.Text = "andrea.kirmse@\nlebenshilfe-kreuznach.de";
}
SetzeAdresse(pRO);
this.bindingSource1.DataSource = pRO;
}
private void SetzeAdresse(ServiceInvoiceRO pRO)
{
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
{
sb.AppendLine(pRO.RecipientAddressLine1);
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
{
sb.AppendLine(pRO.RecipientPoBox);
}
else if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
}
}
}