120 lines
3.9 KiB
C#
120 lines
3.9 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using DevExpress.XtraReports.UI;
|
|
using BS.Shared.Extensions;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BeWo.Service.Plugins;
|
|
using DevExpress.Data.Filtering.Helpers;
|
|
using PraunheimerWerkstaetten2.Calculation;
|
|
|
|
namespace PraunheimerWerkstaetten2.Statistics
|
|
{
|
|
public partial class Hilfeplanuebersicht : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<SupportConceptListRO>
|
|
{
|
|
public Hilfeplanuebersicht()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(SupportConceptListRO pRO)
|
|
{
|
|
if (pRO.EmployeeSupportConceptDetailList != null)
|
|
{
|
|
foreach (var ecd in pRO.EmployeeSupportConceptDetailList)
|
|
{
|
|
foreach (var scd in ecd.SupportConceptDetailList)
|
|
{
|
|
BerechneFelder(pRO, ecd, scd);
|
|
//BerechneUebertrag(pRO, scd);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (pRO.SupportConceptDetailList != null)
|
|
{
|
|
foreach (var scd in pRO.SupportConceptDetailList)
|
|
{
|
|
BerechneFelder(pRO, null, scd);
|
|
//BerechneUebertrag(pRO, scd);
|
|
}
|
|
}
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void BerechneFelder(SupportConceptListRO pRo, SupportConceptListRO.EmployeeSupportConceptDetail ecd, SupportConceptListRO.SupportConceptDetail scd)
|
|
{
|
|
scd.Costbearer = "";
|
|
|
|
if (scd.CostBearer2SupportConceptOid > 0)
|
|
{
|
|
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(scd.CostBearer2SupportConceptOid);
|
|
|
|
foreach (var scap in c2s.ApprovalPeriodList)
|
|
{
|
|
if (scap.ServiceCategory != null)
|
|
{
|
|
scd.Costbearer = scap.ServiceCategory.Name;
|
|
}
|
|
}
|
|
//var bewilligtProJahr = calc.
|
|
}
|
|
}
|
|
|
|
private void BerechneUebertrag(SupportConceptListRO pRo, SupportConceptListRO.SupportConceptDetail scd)
|
|
{
|
|
|
|
|
|
decimal uebertrag = 0;
|
|
|
|
DateTime dt = DateTime.Now;
|
|
|
|
|
|
//Herr Diettrich Übertrag von 118
|
|
if (pRo.AppointedDate.HasValue)
|
|
{
|
|
dt = pRo.AppointedDate.Value;
|
|
}
|
|
dt = new DateTime(dt.AddMonths(1).Year, dt.AddMonths(1).Month, 1);
|
|
if (dt > scd.EndDate)
|
|
{
|
|
dt = scd.EndDate;
|
|
}
|
|
if (scd.CostBearer2SupportConceptOid > 0)
|
|
{
|
|
SetzeUebetrag(scd, dt);
|
|
|
|
|
|
DateTime testdt = new DateTime(2018, 6, 1);
|
|
SetzeUebetrag(scd, testdt);
|
|
testdt = new DateTime(2018, 5, 1);
|
|
SetzeUebetrag(scd, testdt);
|
|
testdt = new DateTime(2018, 4, 1);
|
|
SetzeUebetrag(scd, testdt);
|
|
|
|
}
|
|
}
|
|
|
|
private void SetzeUebetrag(SupportConceptListRO.SupportConceptDetail scd, DateTime dt)
|
|
{
|
|
var statFactory = new CustomServiceRecordStatisticFactory();
|
|
|
|
var stats = statFactory.CreateSupportConceptStatisticsImpl(scd.CostBearer2SupportConceptOid, dt);
|
|
|
|
if (stats.PeriodStatistics != null && stats.PeriodStatistics.Count == 1)
|
|
{
|
|
scd.DurationPercentage = (stats.PeriodStatistics[0].IstTotalUntilThisMonth - stats.PeriodStatistics[0].SollTotalUntilThisMonth) / 60;
|
|
}
|
|
else
|
|
{
|
|
scd.DurationPercentage = (stats.IstTotalUntilThisMonth - stats.SollTotalUntilThisMonth) / 60;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|