Files
BeWoPlaner/ReportImp/PassgenauUG/ServiceInvoiceReport.cs
2021-02-21 19:01:51 +01:00

110 lines
4.2 KiB
C#

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace PassgenauUG
{
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReport()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
if (pRO.RecipientOrganisation.Contains("ABW - "))
{
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("ABW - ", "");
}
if (pRO.RecipientOrganisation.Contains("aHH - "))
{
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("aHH - ", "");
}
if (pRO.RecipientOrganisation.Contains("1 SB - "))
{
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("1 SB - ", "");
}
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.RecipientPoBox))
{
sb.AppendLine(pRO.RecipientPoBox);
}
else
{
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
}
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 Tätigkeiten:", start);
//}
//else
//{
// lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end);
//}
SetBetreff(pRO);
DateTime? bewilligt = GetBewilligtDatum(pRO);
lblAbrechnungszeitraum.Text = String.Format("hiermit stelle ich auf Grundlage des Bescheids vom {0:dd.MM.yyyy} für Leistungen nach dem\n" +
"Sozialgesetzbuch IX folgende Leistungen für {1:MM}/{1:yyyy} in Rechnung:", bewilligt, start);
this.bindingSource1.DataSource = pRO;
}
private void SetBetreff(ServiceInvoiceRO pRo)
{
//String leistung = "";
//if (pRo.ServiceInvoicePeriods.Count > 0)
//{
// foreach (var sip in pRo.ServiceInvoicePeriods)
// {
// foreach (var ii in sip.ServiceInvoiceItems)
// {
// if (ii.ServiceDescription != null && ii.ServiceDescription.Contains("Schulassistenz"))
// {
// leistung = "Leistungen in der Schulassistenz";
// }
// }
// }
//}
//lblRechnungsNummer.Text = String.Format("Rechnung {0} für {1}, AZ {2} Abrechnung {3}, {4} *{5:dd.MM.yyyy}",
// pRo.InvoiceNumber, leistung, pRo.CustomerReferenceNumber, pRo.CustomerLastName, pRo.CustomerFirstName,
// pRo.CustomerBirthdate);
}
private DateTime? GetBewilligtDatum(ServiceInvoiceRO pRO)
{
if (pRO.ServiceInvoicePeriods.Count > 0)
{
var c2s = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept;
return c2s.SupportConcept.ApprovalDate;
}
return null;
}
}
}