118 lines
4.3 KiB
C#
118 lines
4.3 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 VKMAachen
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
if (!string.IsNullOrEmpty(pRO.SenderContactPersonPhone))
|
|
{
|
|
pRO.SenderContactPersonPhone = pRO.SenderContactPersonPhone.Remove(0, 6);
|
|
}
|
|
if (!string.IsNullOrEmpty(pRO.SenderContactPersonFax))
|
|
{
|
|
pRO.SenderContactPersonFax = pRO.SenderContactPersonFax.Remove(0, 5);
|
|
}
|
|
if (!string.IsNullOrEmpty(pRO.SenderContactPersonMail))
|
|
{
|
|
pRO.SenderContactPersonMail = pRO.SenderContactPersonMail.Remove(0, 9);
|
|
}
|
|
|
|
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("");
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
String leistungsart = "§35a Abs. 2 SGB VIII";
|
|
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
|
{
|
|
if (pRO.RecipientOrganisation == "Sozialamt-SPFH")
|
|
{
|
|
leistungsart = "§53 Abs. 1 Satz 2 SGB XII";
|
|
}
|
|
else if (pRO.RecipientOrganisation.Contains("Städteregion-SPFH"))
|
|
{
|
|
leistungsart = "§27ff SGB VIII";
|
|
}
|
|
else if (pRO.RecipientOrganisation.Contains("LVR"))
|
|
{
|
|
leistungsart = "§53 Abs. 1 Satz 2 SGB XII";
|
|
}
|
|
}
|
|
|
|
var varfield = GetRechtsgrundlage(pRO);
|
|
if (!String.IsNullOrEmpty(varfield))
|
|
{
|
|
leistungsart = varfield;
|
|
}
|
|
|
|
xrLabel3.Text = @"Sehr geehrte Damen und Herren,
|
|
|
|
bezugnehmend auf den Bewilligungsbescheid vom [ApprovalDate] stellen wir für die Leistungen der Hilfe gem. [Leistungsart] lt. beigefügter Aufstellung folgenden Betrag in Rechnung:";
|
|
|
|
xrLabel3.Text = xrLabel3.Text.Replace("[Leistungsart]", leistungsart);
|
|
|
|
lblBetreff.Text = String.Format("Gewährung von Hilfe gem. {0} für {1}, geb. am {2:dd.MM.yyyy}, Verwendungszweck {3}, {4}", leistungsart, pRO.CustomerName, pRO.CustomerBirthdate, pRO.CustomerReferenceNumber, pRO.InvoiceNumber);
|
|
bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private String GetRechtsgrundlage(ServiceInvoiceRO pRO)
|
|
{
|
|
|
|
if (pRO.InvoiceBase.SupportConceptCostBearerRelDc != null)
|
|
{
|
|
var org = DAOFactory.GenericDAO.LoadByID<Organisation>(pRO.InvoiceBase.SupportConceptCostBearerRelDc.CostBearer.OrganisationOid);
|
|
|
|
foreach (var vv in org.VarFieldValueList)
|
|
{
|
|
if (vv.VarFieldDefOid.Value == 1)
|
|
{
|
|
var varFieldValue = BS.Shared.Core.Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName));
|
|
|
|
if (varFieldValue != null)
|
|
{
|
|
return varFieldValue.ToString();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |