147 lines
5.8 KiB
C#
147 lines
5.8 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
|
|
namespace LandshuterNetzwerk
|
|
{
|
|
public partial class InvoiceCustomerReport : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<InvoiceCustomerRO>
|
|
{
|
|
public InvoiceCustomerReport()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(InvoiceCustomerRO pRO)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
if ((!String.IsNullOrEmpty(pRO.RecipientFirstName) && !String.IsNullOrEmpty(pRO.RecipientFirstName.Trim()))
|
|
|| (!String.IsNullOrEmpty(pRO.RecipientLastName) && !String.IsNullOrEmpty(pRO.RecipientLastName.Trim())))
|
|
{
|
|
sb.AppendLine(String.Format("{0} {1}", pRO.RecipientFirstName, pRO.RecipientLastName).Trim());
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientStreet) && !String.IsNullOrEmpty(pRO.RecipientStreet.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCode) && !String.IsNullOrEmpty(pRO.RecipientPostCode.Trim()))
|
|
{
|
|
sb.Append(pRO.RecipientPostCode);
|
|
sb.Append(" ");
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientTown) && !String.IsNullOrEmpty(pRO.RecipientTown.Trim()))
|
|
{
|
|
sb.Append(pRO.RecipientTown);
|
|
}
|
|
lblAddress.Text = sb.ToString();
|
|
|
|
lblAbrechnungszeitraum.Text = String.Format("Betreuungspflegesatzabrechnung {0:MMMM yyyy}\nBetreute/r: {1}, {2} geb. {3:dd.MM.yyyy}", pRO.AccountingPeriodEnd, pRO.CustomerLastName, pRO.CustomerFirstName, pRO.CustomerBirthdate);
|
|
|
|
Customer c = null;
|
|
if (pRO.InvoiceBase.RecipientCustomerOid.HasValue)
|
|
{
|
|
c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.InvoiceBase.RecipientCustomerOid.Value);
|
|
}
|
|
if (c != null)
|
|
{
|
|
SetzeStandortdaten(pRO, c);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetzeStandortdaten(InvoiceCustomerRO pRO, Customer c)
|
|
{
|
|
String team = "";
|
|
foreach (var t2c in c.Team2CustomerList)
|
|
{
|
|
team = t2c.Team.Name;
|
|
|
|
if (t2c.Team.Leader != null)
|
|
{
|
|
pRO.CreatorFirstName = String.Format("{0}", t2c.Team.Leader.Person.FirstName);
|
|
pRO.CreatorLastName = String.Format("{0}", t2c.Team.Leader.Person.LastName);
|
|
}
|
|
}
|
|
|
|
pRO.Notice = "Betreutes Einzelwohnen - eigene Wohnung";
|
|
|
|
if (team.Contains("Landshut"))
|
|
{
|
|
lblNameStandort.Text = "Ambulant Begleitetes Wohnen\nLandshut";
|
|
lblAnschriftKurz.Text = "Landshuter Netzwerk e.V., Neustadt 464-465, 84028 Landshut";
|
|
lblKontaktdaten.Text = @"
|
|
Neustadt 464-465
|
|
84028 Landshut
|
|
Tel: 0871/96367- 0
|
|
Fax: 0871/96367-118
|
|
abw@landshuter-netzwerk.de
|
|
www.landshuter-netzwerk.de";
|
|
}
|
|
else if (team.Contains("Dingolfing-Landau"))
|
|
{
|
|
pRO.Notice = "Therapeutische Wohngemeinschaft";
|
|
|
|
lblNameStandort.Text = "Ambulant Begleitetes Wohnen\nDingolfing-Landau";
|
|
lblAnschriftKurz.Text = "Landshuter Netzwerk e.V., Bahnhofstraße 1, 84130 Dingolfing";
|
|
lblKontaktdaten.Text = @"
|
|
Bahnhofstraße 1
|
|
84130 Dingolfing
|
|
Tel: 08731/309 9777
|
|
Fax: 08731/309 9614
|
|
bw-dingolfing@landshuter-netzwerk.de
|
|
www.landshuter-netzwerk.de";
|
|
|
|
}
|
|
else if (team == "Therapeutische Wohngemeinschaft")
|
|
{
|
|
pRO.Notice = "Therapeutische Wohngemeinschaft";
|
|
|
|
lblNameStandort.Text = "Ambulant Begleitetes Wohnen\nLandshut";
|
|
lblAnschriftKurz.Text = "Landshuter Netzwerk e.V., Neustadt 464-465, 84028 Landshut";
|
|
lblKontaktdaten.Text = @"
|
|
Neustadt 464-465
|
|
84028 Landshut
|
|
Tel: 0871/96367- 0
|
|
Fax: 0871/96367-118
|
|
twg@landshuter-netzwerk.de
|
|
www.landshuter-netzwerk.de";
|
|
}
|
|
else
|
|
{
|
|
lblNameStandort.Text = team;
|
|
}
|
|
|
|
var wg = GetWohngemeinschaft(pRO, c);
|
|
if (!String.IsNullOrEmpty(wg) && wg.Trim() == "490")
|
|
{
|
|
pRO.Notice = "Betreutes Einzelwohnen - eigene Wohnung";
|
|
}
|
|
|
|
}
|
|
|
|
private String GetWohngemeinschaft(InvoiceCustomerRO pRO, Customer c)
|
|
{
|
|
foreach (var vv in c.VarFieldValueList)
|
|
{
|
|
if (vv.VarFieldDefOid == 1)
|
|
{
|
|
return Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName)) as String;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|