100 lines
4.6 KiB
C#
100 lines
4.6 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
|
|
|
|
namespace BeWo.Report.DefaultReports
|
|
{
|
|
public partial class Leistungsdokumentation : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<FLSReportRO>
|
|
{
|
|
public Leistungsdokumentation()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(FLSReportRO pRO)
|
|
{
|
|
List<string> aktenzeichen = new List<string>();
|
|
List<string> kostenträgerkontakte = new List<string>();
|
|
|
|
if (pRO.GroupTypeHeader == "Klient/in")
|
|
{
|
|
foreach (var group in pRO.FLSReportGroups)
|
|
{
|
|
if (group.ServiceRecords != null)
|
|
{
|
|
var c2scOids = group.ServiceRecords.Where(sr => sr.CostBearer2SupportConceptOid.HasValue)
|
|
.Select(sr => sr.CostBearer2SupportConceptOid.Value)
|
|
.Distinct()
|
|
.ToList();
|
|
|
|
if (c2scOids != null && c2scOids.Count > 0)
|
|
{
|
|
var cb2scList = DAOFactory.GenericDAO.GetByIDs<CostBearer2SupportConcept>(c2scOids);
|
|
var customerName = cb2scList[0].SupportConcept.Customer.Person.FirstNameLastName;
|
|
foreach (var c2s in cb2scList)
|
|
{
|
|
var c2cList = c2s.SupportConcept.Customer.Customer2CostBearerList;
|
|
foreach (var item in c2cList)
|
|
{
|
|
if (item.ReferenceNumber != null && !aktenzeichen.Contains(item.ReferenceNumber))
|
|
aktenzeichen.Add(item.ReferenceNumber);
|
|
if (item.Notice != null && !kostenträgerkontakte.Contains(item.Notice))
|
|
kostenträgerkontakte.Add(item.Notice);
|
|
}
|
|
}
|
|
|
|
foreach (var sr in group.ServiceRecords)
|
|
{
|
|
if (sr.GroupName == null)
|
|
{
|
|
sr.GroupName = customerName;
|
|
if (aktenzeichen.Count > 0)
|
|
sr.GroupName += "\nAZ: " + string.Join(", ", aktenzeichen);
|
|
if (kostenträgerkontakte.Count > 0)
|
|
sr.GroupName += "\nKontakt: " + string.Join(", ", kostenträgerkontakte);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (pRO.GroupTypeHeader == "Mitarbeiter/in")
|
|
{
|
|
foreach (var group in pRO.FLSReportGroups)
|
|
{
|
|
if (group.ServiceRecords != null)
|
|
{
|
|
var c2scOid = group.ServiceRecords.FirstOrDefault(sr => sr.CostBearer2SupportConceptOid.HasValue).CostBearer2SupportConceptOid;
|
|
if (c2scOid.HasValue)
|
|
{
|
|
var c2s = DAOFactory.GenericDAO.GetByID<CostBearer2SupportConcept>(c2scOid.Value);
|
|
var c2cList = c2s.SupportConcept.Customer.Customer2CostBearerList;
|
|
|
|
foreach (var item in c2cList)
|
|
{
|
|
if (item.ReferenceNumber != null && !aktenzeichen.Contains(item.ReferenceNumber))
|
|
aktenzeichen.Add(item.ReferenceNumber);
|
|
if (item.Notice != null && !kostenträgerkontakte.Contains(item.Notice))
|
|
kostenträgerkontakte.Add(item.Notice);
|
|
}
|
|
}
|
|
}
|
|
if (aktenzeichen.Count > 0)
|
|
group.CustomValue1 += "AZ: " + string.Join(", ", aktenzeichen);
|
|
if (kostenträgerkontakte.Count > 0)
|
|
group.CustomValue1 += "\nKontakt: " + string.Join(", ", kostenträgerkontakte);
|
|
|
|
}
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
}
|
|
}
|