Files
BeWoPlaner/ReportImp/DomizielAnsbach/RechnungPB.cs

103 lines
3.5 KiB
C#
Raw Normal View History

2022-02-02 13:26:33 +01:00
using System;
using System.Linq;
2022-02-08 09:51:16 +01:00
using System.Text;
2022-02-02 13:26:33 +01:00
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace DomizielAnsbach
{
[IDSpecificClass(Identifier = "RechnungPB")]
public partial class RechnungPB : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public RechnungPB()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
bool bezirk = false;
2022-02-08 09:51:16 +01:00
var sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1) && pRO.RecipientAddressLine1.Contains("Bezirk"))
{
bezirk = true;
}
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !bezirk)
2022-02-08 09:51:16 +01:00
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1))
{
sb.AppendLine(pRO.RecipientAddressLine1);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
{
sb.AppendLine(pRO.RecipientPoBox);
}
else if (!String.IsNullOrEmpty(pRO.RecipientStreet))
2022-02-08 09:51:16 +01:00
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine("");
2022-02-08 09:51:16 +01:00
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
2022-02-02 13:26:33 +01:00
if (String.IsNullOrEmpty(pRO.Notice))
{
lblNotice.Visible = false;
}
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}", start);
2022-02-02 13:26:33 +01:00
}
else
{
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir f<>r den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
2022-02-02 13:26:33 +01:00
}
bool dbt = false;
if (pRO.RecipientOrganisation.ToLower().Contains("selbstzahler") && pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
{
if (pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems != null && pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems.Any(s => s.ServiceDescription.ToLower().Contains("dbt")))
{
dbt = true;
}
}
if (dbt)
{
lblAbrechnungszeitraum.Text += " Ambulante DBT-Gruppe:";
}
else
{
lblAbrechnungszeitraum.Text += " folgende erbrachte T<>tigkeiten:";
}
if (!bezirk)
2023-04-28 15:26:02 +02:00
{
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower().Contains("herr"))
{
lblAnrede.Text = String.Format("Sehr geehrter Herr {0},", pRO.CustomerLastName);
}
else if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower().Contains("frau"))
{
lblAnrede.Text = String.Format("Sehr geehrte Frau {0},", pRO.CustomerLastName);
}
2023-04-28 15:26:02 +02:00
}
2022-02-02 13:26:33 +01:00
this.bindingSource1.DataSource = pRO;
}
}
}