189 lines
6.3 KiB
C#
189 lines
6.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BeWo.Service.ServiceImplementations;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraReports.UI;
|
|
using System.Data;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace VkmAachenSbd
|
|
{
|
|
public partial class FolgeantraegeEltern : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<QueryRO>
|
|
{
|
|
//Nur Hauptbetreuung?
|
|
//Welche HP Zeiträume?
|
|
|
|
public FolgeantraegeEltern()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
public void SetReportDataSource(QueryRO pRO)
|
|
{
|
|
this.bindingSource1.DataSource = CreateTable(pRO);
|
|
;
|
|
}
|
|
|
|
private QueryRO CreateTable(QueryRO ro)
|
|
{
|
|
QueryRO newQueryRo = new QueryRO();
|
|
|
|
|
|
IList<SupportConcept> list = DAOFactory.GenericDAO.GetAllActive<SupportConcept>();
|
|
foreach (var sc in list)
|
|
{
|
|
foreach (var c2s in sc.CostBearer2SupportConceptList)
|
|
{
|
|
if (SollAngezeigtWerden(c2s))
|
|
{
|
|
|
|
var customer = c2s.SupportConcept.Customer;
|
|
Person sorgeberechtigter = FindeSorgeberechtigtePerson(customer);
|
|
|
|
QueryRO.Row row = new QueryRO.Row();
|
|
|
|
String personTitle = "";
|
|
String pVorname = "";
|
|
String pNachname = "";
|
|
String pStr = "";
|
|
String pPlz = "";
|
|
String pOrt = "";
|
|
String pLand = "";
|
|
String kVorname = "";
|
|
String kNachname = "";
|
|
|
|
String orgName = "";
|
|
String orgAbt = "";
|
|
String orgAp = "";
|
|
String orgStr = "";
|
|
String orgPlz = "";
|
|
String orgOrt = "";
|
|
String orgAnredeAp = "";
|
|
|
|
if (sorgeberechtigter != null)
|
|
{
|
|
if (sorgeberechtigter.Title != null)
|
|
{
|
|
personTitle = sorgeberechtigter.Title.Value;
|
|
}
|
|
|
|
pVorname = sorgeberechtigter.FirstName;
|
|
pNachname = sorgeberechtigter.LastName;
|
|
|
|
if (sorgeberechtigter.Address != null)
|
|
{
|
|
pStr = sorgeberechtigter.Address.Street;
|
|
pPlz = sorgeberechtigter.Address.PostalCode;
|
|
pOrt = sorgeberechtigter.Address.Town;
|
|
}
|
|
}
|
|
|
|
kVorname = customer.Person.FirstName;
|
|
kNachname = customer.Person.LastName;
|
|
|
|
var org = c2s.CostBearer.Organisation;
|
|
|
|
orgName = org.Name;
|
|
orgAbt = org.Name2;
|
|
|
|
if (org.Address != null)
|
|
{
|
|
orgStr = org.Address.Street;
|
|
orgPlz = org.Address.PostalCode;
|
|
orgOrt = org.Address.Town;
|
|
}
|
|
|
|
if (c2s.CostBearerContactPerson != null)
|
|
{
|
|
orgAp = c2s.CostBearerContactPerson.LastName;
|
|
|
|
if (c2s.CostBearerContactPerson.Title != null)
|
|
{
|
|
orgAnredeAp = c2s.CostBearerContactPerson.Title.Value;
|
|
}
|
|
}
|
|
row.Field1 = personTitle;
|
|
row.Field2 = pVorname;
|
|
row.Field3 = pNachname;
|
|
row.Field4 = kVorname;
|
|
row.Field5 = kNachname;
|
|
row.Field6 = pStr;
|
|
row.Field7 = pPlz;
|
|
row.Field8 = pOrt;
|
|
row.Field9 = pLand;
|
|
row.Field10 = orgName;
|
|
row.Field11 = orgAbt;
|
|
row.Field12 = orgAp;
|
|
row.Field13 = orgStr;
|
|
row.Field14 = orgPlz;
|
|
row.Field15 = orgOrt;
|
|
row.Field16 = orgAnredeAp;
|
|
|
|
|
|
|
|
newQueryRo.Rows.Add(row);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
newQueryRo.Rows.Sort((a, b) => a.Field3.ToString().CompareTo(b.Field3));
|
|
|
|
return newQueryRo;
|
|
}
|
|
|
|
private Person FindeSorgeberechtigtePerson(Customer customer)
|
|
{
|
|
foreach (var c2p in customer.Customer2PersonList)
|
|
{
|
|
foreach (ValueListEntry2Object v2o in c2p.ValueList)
|
|
{
|
|
ValueListEntry vle = v2o.Entry;
|
|
if (vle.Type == ValueListEntryType.EnvironmentPersonType)
|
|
{
|
|
if (vle.Value == "Gesetzlicher Vertreter" || vle.Value == "Vormund")
|
|
{
|
|
return c2p.Person;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (var c2p in customer.Customer2PersonList)
|
|
{
|
|
foreach (ValueListEntry2Object v2o in c2p.ValueList)
|
|
{
|
|
ValueListEntry vle = v2o.Entry;
|
|
if (vle.Type == ValueListEntryType.RoleInFamily)
|
|
{
|
|
return c2p.Person;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
private bool SollAngezeigtWerden(CostBearer2SupportConcept c2s)
|
|
{
|
|
if (c2s.CostBearer.Organisation.Function != null &&
|
|
c2s.CostBearer.Organisation.Function.Value.Contains("Sozialamt") && c2s.SupportConcept.IsActive == ActivationTypeId.Active && c2s.SupportConcept.Customer.IsActive == ActivationTypeId.Active)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
}
|
|
}
|