Files
BeWoPlaner/ReportImp/PortaEV/ServiceInvoiceReport.cs
2025-07-01 16:34:35 +02:00

89 lines
3.2 KiB
C#

using System;
using System.Linq;
using System.Text;
using BeWo.Report.ReportObjects;
using BS.Shared.Extensions;
using DevExpress.XtraReports.UI;
namespace BeWo.Report.DefaultReports
{
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,";
}
SetzeAdresse(pRO);
if (pRO.InvoiceBase.SenderContactInformations != null)
{
var mobilnummer = pRO.InvoiceBase.SenderContactInformations.FirstOrDefault(i => i.ContactType == BS.Shared.ContactType.business_MobilePhone);
if (mobilnummer != null)
lblMobilnummer.Text = "Mobil: " + mobilnummer.ContactValue;
}
pRO.SenderContactPersonPhone = pRO.SenderContactPersonPhone.Replace("Tel.", "Telefon");
if (!pRO.SenderContactPerson.IsNullOrEmpty() && pRO.SenderContactPerson.Contains("Peters"))
pRO.SenderContactPersonDivision = "(Leitung Ambulant Betreutes Wohnen Porta e.V.)";
else
pRO.SenderContactPersonDivision = "(Verwaltung)";
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();
}
}
}