111 lines
3.8 KiB
C#
111 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.ServiceImplementations;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.BloemelingUndTeckhaus
|
|
{
|
|
public partial class StundenzettelAssistenz : DevExpress.XtraReports.UI.XtraReport//, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public StundenzettelAssistenz()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
double minTotal = 0;
|
|
Dictionary<string, string> empDict = new Dictionary<string, string>();
|
|
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
if (s.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
s.StartDateString += " (Fehlkontakt)";
|
|
|
|
if (s.ServiceCategory.Contains("Assistenz"))
|
|
{
|
|
minTotal += s.Minutes;
|
|
if (!empDict.ContainsKey(s.EmployeeFullname))
|
|
{
|
|
empDict.Add(s.EmployeeFullname, s.EmployeeFullname);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
if (empDict.Count == 1)
|
|
{
|
|
lblMainAttendant.Text = empDict.Values.ToArray()[0];
|
|
}
|
|
else
|
|
{
|
|
lblMainAttendant.Text = "";
|
|
foreach (var value in empDict.Values)
|
|
{
|
|
if (lblMainAttendant.Text.Length > 0)
|
|
{
|
|
lblMainAttendant.Text += ", ";
|
|
}
|
|
lblMainAttendant.Text += value;
|
|
}
|
|
}
|
|
lblSummeMinuten.Text = string.Format("{0:0.##}", minTotal / 60);
|
|
cellMinuten.Text = string.Format("{0:0.##}", minTotal);
|
|
cellStunden.Text = string.Format("{0:0.00}", minTotal / 60);
|
|
|
|
var approved = pRO.ApprovedFLSPerWeek;
|
|
|
|
var stats = GetStatistics(pRO);
|
|
if (stats != null)
|
|
{
|
|
approved = stats.MinutesApprovedPerWeek / 60;
|
|
}
|
|
|
|
lblBewilligteStunden.Text = string.Format("{0:0.##}", approved);
|
|
|
|
bindingSource1.DataSource = pRO;
|
|
// rechnungsDatum.Text = DateTime.Now.ToShortDateString();
|
|
|
|
}
|
|
|
|
private SupportConceptPeriodStatisticsDC GetStatistics(ServicesOverviewRO ro)
|
|
{
|
|
if (ro.CostBearer2SupportConceptList != null && ro.CostBearer2SupportConceptList.Count > 0)
|
|
{
|
|
var service = new OperationsServiceImp();
|
|
|
|
foreach (var cb2sc in ro.CostBearer2SupportConceptList)
|
|
{
|
|
long cb2scOid = cb2sc.Oid.Value;
|
|
|
|
|
|
var stats = service.CreateSupportConceptStatistics(cb2scOid, ro.EndDate);
|
|
|
|
if (stats.PeriodStatistics != null && stats.PeriodStatistics.Count > 0)
|
|
{
|
|
foreach (var ps in stats.PeriodStatistics)
|
|
{
|
|
if (ps.SupportConceptApprovalPeriod != null && ps.SupportConceptApprovalPeriod.ServiceCategory != null &&
|
|
ps.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Assistenz"))
|
|
{
|
|
return ps;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
return null;
|
|
}
|
|
|
|
}
|
|
}
|