Files
BeWoPlaner/ReportImp/GpzBiberachReports/ServiceInvoiceReportPB.cs

126 lines
4.4 KiB
C#

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace BeWo.GpzBiberachReports
{
[IDSpecificClass(Identifier = "PersoenlichesBudget")]
public partial class RechnungPersoenlichesBudget : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public RechnungPersoenlichesBudget()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
//if (String.IsNullOrWhiteSpace(pRO.RecipientOrganisation) ||
// !pRO.RecipientOrganisation.ToLower().Contains("landratsamt biberach"))
//{
// this.Watermark.Image = null;
//}
//decimal minutesGespraeche = 0;
//decimal minutesGruppe = 0;
//decimal hausbesuchBetrag = 0;
//decimal betragGespraeche = 0;
//decimal betragGruppe = 0;
pRO.InvoiceNumber = String.Format("8235-{0}", pRO.InvoiceNumber);
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
{
foreach (var p in pRO.ServiceInvoicePeriods)
{
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
{
ServiceInvoiceItemRO pauschale = null;
foreach (var i in p.ServiceInvoiceItems)
{
if (!String.IsNullOrEmpty(i.ServiceDescription))
{
if (i.ServiceDescription.ToLower().IndexOf("monatliche pauschale") >= 0)
{
pauschale = i;
}
}
}
if (pauschale != null)
{
if (pauschale.AccountingPeriodStart.HasValue && pauschale.AccountingPeriodEnd.HasValue
&& pauschale.AccountingPeriodStart.Value.Date.Year == pauschale.AccountingPeriodEnd.Value.Date.Year
&& pauschale.AccountingPeriodStart.Value.Date.Month == pauschale.AccountingPeriodEnd.Value.Date.Month)
{
pauschale.ServiceDescription = String.Format("{0} {1:MMMM yyyy}", pauschale.ServiceDescription, pauschale.AccountingPeriodStart);
}
else
{
pauschale.ServiceDescription = String.Format("{0} {1:MMMM yyyy} - {2:MMMM yyyy}", pauschale.ServiceDescription, pauschale.AccountingPeriodStart,
pauschale.AccountingPeriodEnd);
}
p.ServiceInvoiceItems.Remove(pauschale);
pauschale.AccountingPeriodStart = null;
p.ServiceInvoiceItems.Add(pauschale);
// cellHausbesuche.Text = String.Format("{0:0} á {1:0.00}", hausbesuch.UnitCount, hausbesuch.AmountPerUnit);
// cellHausbesucheBetrag.Text = hausbesuch.GrossAmount;
}
//cellGespraecheGesamt.Text = String.Format("{0:0} Minuten", minutesGespraeche);
//cellGruppeGesamt.Text = String.Format("{0:0} Minuten", minutesGruppe);
//cellGespraecheBetrag.Text = String.Format("{0:c}", betragGespraeche);
//cellGruppeBetrag.Text = String.Format("{0:c}", betragGruppe);
}
}
}
cellBetrag.Text = pRO.GrossClaim;
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()))
{
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("Persönliches Budget", "").Trim();
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson) && !String.IsNullOrEmpty(pRO.RecipientContactPerson.Trim()))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet) && !String.IsNullOrEmpty(pRO.RecipientStreet.Trim()))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPoBox) && !String.IsNullOrEmpty(pRO.RecipientPoBox.Trim()))
{
sb.Append("Postfach ");
sb.AppendLine(pRO.RecipientPoBox.Replace("Postfach", "").Trim());
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAnschrift.Text = sb.ToString();
this.bindingSource1.DataSource = pRO;
}
}
}