100 lines
3.2 KiB
C#
100 lines
3.2 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
using System;
|
|
using System.Text;
|
|
|
|
namespace VivaAVida
|
|
{
|
|
[IDSpecificClass(Identifier = "RechnungSoziotherapie")]
|
|
public partial class SoziotherapieRechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public SoziotherapieRechnung()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
string poBox = null;
|
|
if (pRO.InvoiceBase.RecipientContactInformations.Count > 0)
|
|
{
|
|
foreach (var i in pRO.InvoiceBase.RecipientContactInformations)
|
|
{
|
|
if (i.ContactType == BS.Shared.ContactType.private_POBox)
|
|
poBox = i.ContactValue;
|
|
}
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
|
{
|
|
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))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
if (!String.IsNullOrEmpty(poBox))
|
|
{
|
|
sb.AppendLine(poBox);
|
|
}
|
|
else 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();
|
|
|
|
decimal hours = 0;
|
|
if (pRO.ServiceInvoicePeriods != null)
|
|
{
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
hours += ii.Hours ?? 0;
|
|
if (ii.UnitDescription == null || !ii.UnitDescription.StartsWith("GPos"))
|
|
{
|
|
ii.UnitDescription = "";
|
|
}
|
|
|
|
// Einheit setzen
|
|
ii.HourlyRateString = "Stunden";
|
|
if (ii.ServiceDescription != null && ii.ServiceDescription.ToLower().Contains("hausbesuchspauschale"))
|
|
{
|
|
ii.HourlyRateString = "Anzahl";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (String.IsNullOrEmpty(pRO.Notice))
|
|
{
|
|
xrLabel5.Visible = false;
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |