103 lines
3.5 KiB
C#
103 lines
3.5 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 DomizielAnsbach
|
|
{
|
|
[IDSpecificClass(Identifier = "RechnungPB")]
|
|
public partial class RechnungPB : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public RechnungPB()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
bool bezirk = false;
|
|
|
|
var sb = new StringBuilder();
|
|
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1) && pRO.RecipientAddressLine1.Contains("Bezirk"))
|
|
{
|
|
bezirk = true;
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !bezirk)
|
|
{
|
|
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))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine("");
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
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);
|
|
}
|
|
else
|
|
{
|
|
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
|
|
}
|
|
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)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |