Files
BeWoPlaner/ReportImp/AidshilfeDortmund/ServiceInvoiceReport.cs
Christian a065be5e76 - Bugfix verschwundener Button in Hilfeplan Maske
- Verbesserung Zielauswahl Mok
- Bugfix Filterung ServiceRecords im Mok
- Aidshilfe Dortmund Text in Rechnung angepasst
2025-09-12 16:43:32 +02:00

99 lines
3.7 KiB
C#

using System;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Extensions;
using DevExpress.XtraReports.UI;
namespace AidshilfeDortmund
{
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReport()
{
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);
}
if (pRO.CustomerSalutation.IsNullOrEmpty())
{
lblAnrede.Text = "Guten Tag " + pRO.CustomerFirstName + " " + pRO.CustomerLastName + ",";
}
SetzeAdresse(pRO);
var c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.InvoiceBase.CustomerOid);
if (c.TerminationDate.HasValue)
{
xrCheckBox1.Text = String.Format(" Die Betreuung wurde beendet am {0:dd.MM.yyyy}.", c.TerminationDate);
xrCheckBox2.Checked = false;
xrCheckBox1.Checked = true;
}
else
{
xrCheckBox2.Checked = true;
xrCheckBox1.Checked = false;
}
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count == 1 && pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems != null && pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems.Count == 1)
{
var ii = pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems[0];
if ("ear to ear".Equals(ii.ServiceDescription))
{
ii.ServiceDescription = "face to face";
}
}
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))
//{
// 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();
}
}
}