172 lines
5.6 KiB
C#
172 lines
5.6 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;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace LandshuterNetzwerk
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
pRO.InvoiceDate = String.Format("{0:dd.MM.yyyy}", pRO.AccountingPeriodEnd);
|
|
|
|
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(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
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("Betreuungspflegesatzabrechnung {0:MMMM yyyy}\nBetreute/r: {1}, {2} geb. {3:dd.MM.yyyy}", pRO.AccountingPeriodEnd, pRO.CustomerLastName, pRO.CustomerFirstName, pRO.CustomerBirthdate);
|
|
//}
|
|
//else
|
|
//{
|
|
// lblAbrechnungszeitraum.Text = String.Format("Betreuungspflegesatzabrechnung {0:MMMM yyyy} - {1:MMMM yyyy}\nBetreute/r: {2}, {3} geb. {4:dd.MM.yyyy}", start, end, pRO.CustomerLastName, pRO.CustomerFirstName, pRO.CustomerBirthdate);
|
|
|
|
//}
|
|
|
|
SetzeStandortdaten(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetzeStandortdaten(ServiceInvoiceRO pRO)
|
|
{
|
|
|
|
var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.InvoiceBase.SupportConceptCostBearerRelDc.CostBearer2SupportConceptOid.Value);
|
|
|
|
var c = cb2sc.SupportConcept.Customer;
|
|
|
|
String team = "";
|
|
|
|
foreach (var t2c in c.Team2CustomerList)
|
|
{
|
|
team = t2c.Team.Name;
|
|
|
|
if (t2c.Team.Leader != null)
|
|
{
|
|
pRO.CreatorName = String.Format("{0} {1}", t2c.Team.Leader.Person.FirstName,
|
|
t2c.Team.Leader.Person.LastName);
|
|
}
|
|
}
|
|
|
|
pRO.Notice = "Betreutes Einzelwohnen - eigene Wohnung";
|
|
|
|
if (team.Contains("Landshut"))
|
|
{
|
|
lblNameStandort.Text = "Ambulant Begleitetes Einzelwohnen";
|
|
lblAnschriftKurz.Text = "Landshuter Netzwerk e.V., Postfach 1118, 84004 Landshut";
|
|
lblKontaktdaten.Text = @"
|
|
Bahnhofplatz 1a
|
|
84032 Landshut
|
|
Tel: 0871/96367- 0
|
|
Fax: 0871/96367-118
|
|
bew@landshuter-netzwerk.de
|
|
www.landshuter-netzwerk.de";
|
|
}
|
|
else if (team.Contains("Dingolfing-Landau"))
|
|
{
|
|
pRO.Notice = "Therapeutische Wohngemeinschaft";
|
|
|
|
lblNameStandort.Text = "Ambulant Begleitetes Wohnen";
|
|
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 = "Therapeutische Wohngemeinschaften";
|
|
lblAnschriftKurz.Text = "Landshuter Netzwerk e.V., Postfach 1118, 84004 Landshut";
|
|
lblKontaktdaten.Text = @"
|
|
Bahnhofplatz 1a
|
|
84032 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);
|
|
if (!String.IsNullOrEmpty(wg) && wg.Trim() == "490")
|
|
{
|
|
pRO.Notice = "Betreutes Einzelwohnen - eigene Wohnung";
|
|
}
|
|
|
|
}
|
|
|
|
private String GetWohngemeinschaft(ServiceInvoiceRO pRO)
|
|
{
|
|
String mnr = String.Empty;
|
|
Customer c = null;
|
|
if (pRO.CustomerOid.HasValue)
|
|
{
|
|
c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.CustomerOid.Value);
|
|
}
|
|
if (c == null)
|
|
{
|
|
if (pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
var c2s = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept;
|
|
c = c2s.SupportConcept.Customer;
|
|
}
|
|
}
|
|
|
|
if (c != null)
|
|
{
|
|
foreach (var vv in c.VarFieldValueList)
|
|
{
|
|
if (vv.VarFieldDefOid == 1)
|
|
{
|
|
return Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName)) as String;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
}
|
|
} |