160 lines
5.9 KiB
C#
160 lines
5.9 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
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 - ", "");
|
|
}
|
|
if (pRO.RecipientOrganisation.Contains("1 SB EGH - "))
|
|
{
|
|
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("1 SB EGH - ", "");
|
|
}
|
|
if (pRO.RecipientOrganisation.Contains("1 SB JA - "))
|
|
{
|
|
pRO.RecipientOrganisation = pRO.RecipientOrganisation.Replace("1 SB JA - ", "");
|
|
}
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
|
|
//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);
|
|
SetAbrechnungszeitraum(pRO);
|
|
|
|
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 void SetAbrechnungszeitraum(ServiceInvoiceRO pRO)
|
|
{
|
|
String leistung = "Sozialgesetzbuch IX";
|
|
|
|
if (pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
var sc = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept.SupportConcept;
|
|
|
|
|
|
foreach (var vv in sc.VarFieldValueList)
|
|
{
|
|
if (vv.VarFieldDefOid.Value == 1)
|
|
{
|
|
var varFieldValue = BS.Shared.Core.Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName));
|
|
if (varFieldValue != null)
|
|
{
|
|
var vfString = varFieldValue.ToString();
|
|
|
|
if (!String.IsNullOrEmpty(vfString))
|
|
{
|
|
leistung = vfString;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//if (c.Person.InvoiceAddress != null && !String.IsNullOrEmpty(c.Person.InvoiceAddress.AddressLine1))
|
|
//{
|
|
// pRO.RecipientAddressLine1 = c.Person.InvoiceAddress.AddressLine1;
|
|
//}
|
|
}
|
|
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
DateTime? bewilligt = GetBewilligtDatum(pRO);
|
|
lblAbrechnungszeitraum.Text = String.Format("hiermit stelle ich auf Grundlage des Bescheids vom {0:dd.MM.yyyy} für Leistungen gemäß\n" +
|
|
"{2} folgende Leistungen für {1:MM}/{1:yyyy} in Rechnung:", bewilligt, start, leistung);
|
|
}
|
|
|
|
private DateTime? GetBewilligtDatum(ServiceInvoiceRO pRO)
|
|
{
|
|
if (pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
var c2s = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept;
|
|
|
|
return c2s.SupportConcept.ApprovalDate;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |