135 lines
5.7 KiB
C#
135 lines
5.7 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace PerspektivenEV
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
|
|
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) && pRO.RecipientOrganisation != "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 != "SELBSTZAHLER")
|
|
{
|
|
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();
|
|
|
|
|
|
if (pRO.RecipientOrganisation == "SELBSTZAHLER")
|
|
{
|
|
lblBetreff.Text += " durch Perspektiven e.V.";
|
|
lblUeberweisung.Text = "Bitte überweisen Sie den Betrag innerhalb von 14 Tagen auf unser Konto bei der Bank für Sozialwirtschaft DE30 5502 0500 0007 6025 00.";
|
|
}
|
|
else
|
|
lblBetreff.Text += String.Format(" - Gz: {0}", pRO.CustomerReferenceNumber);
|
|
|
|
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
foreach (var p in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
|
|
{
|
|
foreach (var i in p.ServiceInvoiceItems)
|
|
{
|
|
if (i.ServiceDescription != null)
|
|
{
|
|
if (!i.ServiceDescription.Contains("Pauschale"))
|
|
i.Duration = String.Format("{0:0.00}", i.Hours);
|
|
else
|
|
{
|
|
lblUeberschrift.Text = "Zeitraum";
|
|
lblAnlage.Text = "";
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
i.Duration = String.Format("{0:MMMM yyyy}", start);
|
|
}
|
|
if (!i.ServiceDescription.Contains("Anfahrt") && !i.ServiceDescription.Contains("Handgeld") && !i.ServiceDescription.Contains("Pauschale")
|
|
&& !i.ServiceDescription.Contains("gefahren") && !i.ServiceDescription.Contains("Terminabsage"))
|
|
{
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
i.ServiceDescription = String.Format("{0:MMMM yyyy}", start);
|
|
else
|
|
i.ServiceDescription = String.Format("{0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
|
|
}
|
|
else if (i.ServiceDescription.Contains("Anfahrt"))
|
|
{
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
i.ServiceDescription = "Anfahrt(en)";
|
|
}
|
|
else if (i.ServiceDescription.Contains("Terminabsage"))
|
|
{
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
i.ServiceDescription = "Terminabsage";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//Sonderlösung um im Notice-Feld bei Bedarf Teilzahlungen anzeigen zu können
|
|
int index = 0;
|
|
if (!String.IsNullOrEmpty(pRO.Notice))
|
|
{
|
|
index = pRO.Notice.IndexOf("\r\n");
|
|
if (index == 0)
|
|
index = pRO.Notice.IndexOf("BEZAHLT");
|
|
if (index > 0)
|
|
pRO.Notice = pRO.Notice.Remove(index);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |