Files
BeWoPlaner/ReportImp/VereinSozialmedizinStade/CustomReportCreator.cs

69 lines
3.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BeWo.Service.DCEntityMapper;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using DevExpress.XtraReports.UI;
namespace VereinSozialmedizinStade
{
public class CustomReportCreator : DefaultReportCreator
{
public override XtraReport CreateFlsReport(String flsReportId, String subType)
{
string flsReportPath = BS.Shared.Core.Utils.CreateSavePath(TempPath, flsReportId + ".xml");
var lFLSAnalysisDataReportDC = Utils.XMLDeserialize<FLSAnalysisDataReportDC>(flsReportPath);
IBeWoReport<FLSReportRO> lFLSReportObject = null;
if (!String.IsNullOrEmpty(subType))
lFLSReportObject = this.FindReportImp<FLSReportRO>(subType);
if (lFLSReportObject == null)
lFLSReportObject = this.FindReportImp<FLSReportRO>(lFLSAnalysisDataReportDC.ShowGroups
? "FLSAuswertung"
: "Leistungsdokumentation");
var ro = FLSReportRO.Create(lFLSAnalysisDataReportDC);
foreach (var group in ro.FLSReportGroups)
{
foreach (var detail in group.FLSReportDetails)
{
foreach (var sr in detail.ServiceRecords)
{
sr.Notice4 = "";
sr.Notice5 = "";
var entity = DAOFactory.GenericDAO.GetByID<ServiceRecord>(sr.ServiceRecordOid.Value);
if (entity.Group != null && entity.Group.ServiceRecordList.Count > 1)
{
// Erst Mitarbeiter
entity.Group.ServiceRecordList= entity.Group.ServiceRecordList.OrderBy(s => s.Employee.Person.LastName).ToList();
foreach (var groupRecord in entity.Group.ServiceRecordList)
{
if (!sr.Notice4.Contains(groupRecord.Employee.Person.FirstNameLastName))
sr.Notice4 += groupRecord.Employee.Person.FirstNameLastName + ", ";
}
// Dann Klienten
entity.Group.ServiceRecordList = entity.Group.ServiceRecordList.OrderBy(s => s.Customer.Person.LastName).ToList();
foreach (var groupRecord in entity.Group.ServiceRecordList)
{
if (!sr.Notice5.Contains(groupRecord.Customer.Person.FirstNameLastName))
sr.Notice5 += groupRecord.Customer.Person.FirstNameLastName + ", ";
}
}
}
}
}
lFLSReportObject.SetReportDataSource(ro);
return lFLSReportObject as XtraReport;
}
}
}