Files
BeWoPlaner/ReportImp/SeWo/FLSGroupReport.cs
Christian bce313c146 Reports
2017-06-28 09:00:09 +02:00

81 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using DevExpress.XtraReports.UI;
using BS.Shared.Core;
namespace BeWo.SeWo
{
[IDSpecificClass(Identifier = "FLSAuswertung")]
public partial class FLSAuswertung : XtraReport, IBeWoReport<FLSReportRO>
{
public FLSAuswertung()
{
InitializeComponent();
}
public void SetReportDataSource(FLSReportRO pRO)
{
StundenBerechnungHelper.CorrectOverlappingTimes(pRO);
pRO.TotalFLM = 0;
foreach (var group in pRO.FLSReportGroups)
{
group.TotalFLM = 0;
List<DateTimeSpan> allSpans = new List<DateTimeSpan>();
foreach (var detail in group.FLSReportDetails)
{
detail.TotalFLM = 0;
foreach (var sr in detail.ServiceRecords)
{
if (sr.ServiceDescription != "Pause")
{
var minuten = sr.RoundedDuration;
if (sr.ServiceRecordOid.HasValue)
{
var srDb = DAOFactory.GenericDAO.LoadByID<ServiceRecord>(sr.ServiceRecordOid.Value);
if (srDb.ServiceDescription.ServiceCategory.Percentage != 100)
{
minuten *= (srDb.ServiceDescription.ServiceCategory.Percentage)/100;
sr.RoundedDuration = minuten;
}
sr.Notice2 = srDb.Notice2;
sr.Notice3 = srDb.Notice3;
}
detail.TotalFLM += minuten;
}
else
{
sr.Notice2 = "Pause";
}
sr.Notice = sr.Notice2;
}
decimal pausenZeit = StundenBerechnungHelper.BerechnePausenZeit(detail.ServiceRecords);
detail.TotalFLM -= pausenZeit;
group.TotalFLM += detail.TotalFLM;
}
pRO.TotalFLM += group.TotalFLM;
}
this.bindingSource1.DataSource = pRO;
}
}
}