91 lines
3.4 KiB
C#
91 lines
3.4 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>();
|
|
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
if (s.IsBillable)
|
|
servicesBillable.Add(s);
|
|
|
|
if (s.Notice.Contains("\n"))
|
|
{
|
|
var startindex = s.Notice.IndexOf("\n");
|
|
s.Notice = s.Notice.Substring(0, startindex);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|