Files
BeWoPlaner/ReportImp/SPZLeverkusen/ServicesOverviewReportJa.cs
Christian fa14e58de0 Bugfix beim Speichern von ServiceRecords ohne Uhrzeit
Bugfix beim Berechnen der FLSTotal im Quittierungsbeleg, wenn ProzentAbrechenbar = 0
2024-11-15 10:38:41 +01:00

94 lines
3.5 KiB
C#

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using System.Collections.Generic;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.Services;
namespace SPZLeverkusen
{
public partial class StundenzettelJugendamt : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
{
public StundenzettelJugendamt()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
double minutes = 0;
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
{
if (s.IsBillable)
{
minutes += s.Minutes;
servicesBillable.Add(s);
}
if (s.Notice != null && s.Notice.Contains("\n"))
{
var startindex = s.Notice.IndexOf("\n");
s.Notice = s.Notice.Substring(0, startindex);
}
}
pRO.TotalFLMBillable = minutes;
pRO.Services = servicesBillable;
}
if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0)
{
var dc = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(pRO
.CostBearer2SupportConceptList[0]);
var calc = PluginLoader.FindClass<Calculations>();
pRO.ApprovedFLSPerMonth = GetApprovedHoursPerMonth(calc, dc, pRO);
}
this.bindingSource1.DataSource = pRO;
}
private decimal GetApprovedHoursPerMonth(Calculations calc, SupportConceptCostBearerRelDC c2s, ServicesOverviewRO pRO)
{
foreach (var scap in c2s.ApprovalPeriodList)
{
if (scap.StartDate <= pRO.EndDate && scap.EndDate >= pRO.StartDate)
{
if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEPerInterval.HasValue)
{
if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Monthly)
{
return scap.ApprovedBEPerInterval.Value;
}
else if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Quarterly)
{
return scap.ApprovedBEPerInterval.Value / 3;
}
else if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.HalfYearly)
{
return scap.ApprovedBEPerInterval.Value / 6;
}
else if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Yearly)
{
return scap.ApprovedBEPerInterval.Value / 12;
}
}
}
}
var flsProWoche = calc.GetApprovedHoursPerWeek(c2s, c2s.StartDate.Value) ?? 0;
return flsProWoche * 4.34m;
}
}
}