Files
BeWoPlaner/ReportImp/VkmHamm/Teamauslastung.cs
2022-12-05 15:38:39 +01:00

69 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
namespace VkmHamm
{
[IDSpecificClass(Identifier = "Teamauslastung")]
public partial class Teamauslastung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<MitarbeiterauslastungRO>
{
public Teamauslastung()
{
InitializeComponent();
}
public void SetReportDataSource(MitarbeiterauslastungRO pRO)
{
AuslastungBerechnung b = new AuslastungBerechnung();
b.CreateReport(pRO);
if (pRO.TeamDetailList != null)
{
foreach (var td in pRO.TeamDetailList)
{
foreach (var scd in td.SupportConceptDetailList)
{
if (scd.Customer != null && scd.Customer.Employee2CustomerList != null)
foreach (var e2c in scd.Customer.Employee2CustomerList)
{
foreach (var v2o in e2c.ValueList)
{
if (v2o.Entry.Type == ValueListEntryType.StaffRoleType)
{
if (v2o.Entry.Value.Contains("Bezugsbetreuer"))
{
if (e2c.Employee != null && e2c.Employee.Person != null)
scd.Custom3 = e2c.Employee.Person.LastName + ", " + e2c.Employee.Person.FirstName;
if (e2c.Employee.Contracts != null && e2c.Employee.Contracts.Count != 0)
{
var contract = e2c.Employee.Contracts.FirstOrDefault(x => (!x.EntryDate.HasValue ||
x.EntryDate.Value <= pRO.ReportStartDate.Date) &&
(!x.ContractEndDate.HasValue || x.ContractEndDate.Value >= pRO.ReportStartDate.Date));
if (contract != null)
scd.Custom2 = String.Format("Wochenstunden {0:0.00}, FLS/Woche: {1:0.00}", contract.WeeklyTotalHours ?? 0, contract.WeeklyFLS ?? 0);
else
scd.Custom2 = "Wochenstunden 0.00, FLS/Woche: 0.00";
}
else
scd.Custom2 = "Wochenstunden 0.00, FLS/Woche: 0.00";
}
}
}
}
}
}
}
this.bindingSource1.DataSource = pRO;
}
}
}