116 lines
3.9 KiB
C#
116 lines
3.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Services;
|
|
|
|
namespace WahlEv
|
|
{
|
|
public partial class QuittierungsbelegBeWo : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public QuittierungsbelegBeWo()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
WahlHelper.CalculateBewilligung(pRO, true);
|
|
WahlHelper.CalculateFLSSollIst(pRO, true);
|
|
|
|
double geleistet = 0;
|
|
double stundenausgleich = 0;
|
|
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
//if (s.IsBillable || s.ServiceCategory == "Stundenausgleich")
|
|
//{
|
|
ServicesOverviewRO.CreateGoalList(s);
|
|
|
|
SetNotice(pRO, s);
|
|
|
|
ServicesOverviewRO.CreateGoalList(s);
|
|
servicesBillable.Add(s);
|
|
|
|
geleistet += s.Minutes;
|
|
//}
|
|
|
|
if (s.ServiceCategory == "Stundenausgleich")
|
|
{
|
|
stundenausgleich += s.Minutes;
|
|
}
|
|
}
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
decimal sollProMonat = Math.Round(pRO.ApprovedFLSPerWeek * 4.33m, 2, MidpointRounding.AwayFromZero);
|
|
|
|
lblStdGesamtBewilligt.Text = String.Format("{0:0.00}", pRO.ApprovedFLSTotal);
|
|
//lblStdMonatBewilligt.Text = String.Format("{0:0.00}", sollProMonat);
|
|
|
|
decimal geleisteteStunden = Math.Round((decimal)geleistet / 60, 2, MidpointRounding.AwayFromZero);
|
|
|
|
//var vormonat = Math.Round((pRO.MinutenGeleistetBisVormonat - pRO.MinutenSollBisVormonat) / 60, 2, MidpointRounding.AwayFromZero);
|
|
|
|
|
|
|
|
lblGeleistet.Text = String.Format("{0:0.00}", geleisteteStunden);
|
|
cellGeleistetGesamt.Text = String.Format("{0:0.00}", geleisteteStunden);
|
|
|
|
//if (stundenausgleich > 0)
|
|
//{
|
|
// nochzuleisten -= Math.Round((decimal) stundenausgleich / 60, 2, MidpointRounding.AwayFromZero);
|
|
//}
|
|
var geleistetGesamt = (pRO.MinutenGeleistetBisVormonat + (decimal)geleistet) / 60;
|
|
lblDiff.Text = String.Format("{0:0.00}", pRO.ApprovedFLSTotal - geleistetGesamt);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
|
|
private void SetNotice(ServicesOverviewRO pRo, ServicesOverviewRO.ServiceDetail sd)
|
|
{
|
|
var customer = DAOFactory.GenericDAO.LoadByID<Customer>(pRo.CustomerOid);
|
|
|
|
sd.Notice = "";
|
|
|
|
if (sd.ServiceCategory == "Vertretung Fachkraft")
|
|
{
|
|
sd.Notice = "Vertretung";
|
|
}
|
|
else
|
|
{
|
|
foreach (var e2c in customer.Employee2CustomerList)
|
|
{
|
|
if (e2c.EmployeeOid == sd.EmployeeOid)
|
|
{
|
|
foreach (var v2o in e2c.ValueList)
|
|
{
|
|
if (v2o.Entry.Type == ValueListEntryType.StaffRoleType)
|
|
{
|
|
sd.Notice = v2o.Entry.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (String.IsNullOrWhiteSpace(sd.Notice))
|
|
{
|
|
sd.Notice = "Vertretung";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|