Files
BeWoPlaner/ReportImp/MuenchenerAidsHilfeEV/ServiceInvoiceReport.cs
Christian 6a6fb7ad44 cb
2022-04-06 11:49:20 +02:00

78 lines
2.9 KiB
C#

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace MuenchenerAidsHilfeEV
{
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReport()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
pRO.InvoiceDate = String.Format("{0:dd.MM.yyyy}", new DateTime(pRO.InvoiceDateTime.Value.Year, pRO.InvoiceDateTime.Value.Month, 1));
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
//if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
//{
// sb.AppendLine(pRO.RecipientContactPerson);
//}
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
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} folgende erbrachte Leistungen:", start);
}
else
{
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Leistungen:", start, end);
}
String einrichtungsnummer = "102106";
foreach (var sip in pRO.ServiceInvoicePeriods)
{
foreach (var item in sip.ServiceInvoiceItems)
{
if (item.ServiceDescription == "1:6" || item.ServiceDescription == "1:8" || item.ServiceDescription == "1:10")
{
einrichtungsnummer = "102021";
}
}
}
lblEinrichtungsnummer.Text = "Einrichtungsnummer " + einrichtungsnummer;
lblDatum.Text = pRO.InvoiceDate;
pRO.InvoiceDateTime = pRO.AccountingPeriodEnd;
pRO.InvoiceDate = String.Format("{0:dd.MM.yyyy}", pRO.InvoiceDateTime);
pRO.AccountingPeriodStart = pRO.InvoiceBase.SupportConceptCostBearerRelDc.StartDate.Value;
pRO.AccountingPeriodEnd = pRO.InvoiceBase.SupportConceptCostBearerRelDc.EndDate.Value;
this.bindingSource1.DataSource = pRO;
}
}
}