Files
BeWoPlaner/ReportImp/LandshuterNetzwerk/ServiceInvoiceReport.cs

178 lines
5.8 KiB
C#
Raw Permalink Normal View History

2019-07-25 15:59:20 +02:00
using System;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
2019-08-09 16:44:13 +02:00
using BS.Shared.Core;
2019-07-25 15:59:20 +02:00
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);
if (pRO.AmountEquityContribution.Length > 0 && pRO.AmountEquityContribution != "0,00 <20>")
{
Zwischensumme.Visible = true;
Eigenanteil.Visible = true;
}
2019-07-25 15:59:20 +02:00
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";
2022-08-05 13:42:20 +02:00
2021-04-19 01:15:53 +02:00
if (team.Contains("Landshut"))
2019-07-25 15:59:20 +02:00
{
lblNameStandort.Text = "Ambulant Begleitetes Wohnen\nLandshut";
lblAnschriftKurz.Text = "Landshuter Netzwerk e.V., Neustadt 464-465, 84028 Landshut";
2019-07-25 15:59:20 +02:00
lblKontaktdaten.Text = @"
Neustadt 464-465
84028 Landshut
2019-07-25 15:59:20 +02:00
Tel: 0871/96367- 0
Fax: 0871/96367-118
2022-08-05 13:42:20 +02:00
abw@landshuter-netzwerk.de
2019-07-25 15:59:20 +02:00
www.landshuter-netzwerk.de";
}
2021-04-19 01:15:53 +02:00
else if (team.Contains("Dingolfing-Landau"))
2019-07-25 15:59:20 +02:00
{
2019-08-01 11:27:28 +02:00
pRO.Notice = "Therapeutische Wohngemeinschaft";
lblNameStandort.Text = "Ambulant Begleitetes Wohnen\nDingolfing-Landau";
2019-07-25 15:59:20 +02:00
lblAnschriftKurz.Text = "Landshuter Netzwerk e.V., Bahnhofstra<72>e 1, 84130 Dingolfing";
lblKontaktdaten.Text = @"
Bahnhofstra<EFBFBD>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";
2019-07-25 15:59:20 +02:00
lblKontaktdaten.Text = @"
Neustadt 464-465
84028 Landshut
2019-07-25 15:59:20 +02:00
Tel: 0871/96367- 0
Fax: 0871/96367-118
twg@landshuter-netzwerk.de
www.landshuter-netzwerk.de";
}
else
{
lblNameStandort.Text = team;
}
2019-08-09 16:44:13 +02:00
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;
2019-07-25 15:59:20 +02:00
}
}
}