96 lines
3.6 KiB
C#
96 lines
3.6 KiB
C#
using System;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.Extensions;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWoWalzPaiva
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
// Achtung! 2 Rechnungen in einer - anderes Logo, Betreff und IKNr. bei Soziotherapie
|
|
// MH, Ergänzung: Bei Kostenträger Bahn BKK zusätzlich das Genehmigungskennzeichen aus Varfields
|
|
logoSoziotherapie.Location = logoBeWo.Location;
|
|
logoSoziotherapie.Visible = false;
|
|
|
|
if (pRO.InvoiceBase.RecipientOrganisationOid.HasValue)
|
|
{
|
|
var org = DAOFactory.GenericDAO.LoadByID<Organisation>(pRO.InvoiceBase.RecipientOrganisationOid.Value);
|
|
|
|
if (org.Function != null && org.Function.Value == "Soziotherapie")
|
|
{
|
|
logoBeWo.Visible = false;
|
|
logoSoziotherapie.Visible = true;
|
|
lblIKNummer.Visible = true;
|
|
lblBetreff.Text = String.Format("Abrechnung Soziotherapieleistungen für {0} {1}", pRO.CustomerSalutation, pRO.CustomerName);
|
|
SetzeGenehmigungskennzeichen(pRO);
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetzeGenehmigungskennzeichen(ServiceInvoiceRO pRO)
|
|
{
|
|
string kennzeichen = null;
|
|
|
|
Customer c = null;
|
|
if (pRO.CustomerOid.HasValue)
|
|
{
|
|
c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.CustomerOid.Value);
|
|
}
|
|
if (c == null)
|
|
{
|
|
if (pRO.ServiceInvoicePeriods.Count > 0 && !pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems[0].ServiceDescription.StartsWith("Rechnungsdifferenz"))
|
|
{
|
|
var c2s = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept;
|
|
c = c2s.SupportConcept.Customer;
|
|
}
|
|
}
|
|
|
|
if (c != null)
|
|
{
|
|
foreach (var vv in c.VarFieldValueList)
|
|
{
|
|
var varFieldValue = Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName));
|
|
if (varFieldValue != null)
|
|
{
|
|
switch (vv.VarFieldDefOid)
|
|
{
|
|
case 1: // Lastschriftmandat
|
|
kennzeichen = varFieldValue.ToString();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (!kennzeichen.IsNullOrEmpty())
|
|
{
|
|
lblGenehmigungskennzeichen.Visible = true;
|
|
lblGenehmigungskennzeichenValue.Visible = true;
|
|
lblGenehmigungskennzeichenValue.Text = kennzeichen;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |