MH: BetreutesWohnenWoellReports QBs bew. Stunden

This commit is contained in:
2025-07-15 13:43:21 +02:00
parent 6812782f6b
commit a68ff83be5
3 changed files with 95 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ using System.Text.RegularExpressions;
using System.Drawing;
using BS.Shared.Core;
using System.IO;
using BS.Shared.DataContracts;
using BeWo.Service.ServiceImplementations;
namespace BeWo.BetreutesWohnenWoellReports
{
@@ -22,6 +24,9 @@ namespace BeWo.BetreutesWohnenWoellReports
public void SetReportDataSource(ServicesOverviewRO pRO)
{
double total = 0;
string cat = "";
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
@@ -39,6 +44,7 @@ namespace BeWo.BetreutesWohnenWoellReports
}
total += s.Minutes;
servicesBillable.Add(s);
cat = s.ServiceCategory;
}
}
@@ -47,9 +53,51 @@ namespace BeWo.BetreutesWohnenWoellReports
pRO.TotalFLMBillable = total;
SetBewilligung(pRO, cat);
this.bindingSource1.DataSource = pRO;
}
private void SetBewilligung(ServicesOverviewRO pRO, String name)
{
var stats = GetStatistics(pRO, name);
if (stats != null)
{
pRO.ApprovedFLSPerWeek = stats.MinutesApprovedPerWeek / 60;
}
else
pRO.ApprovedFLSPerWeek = 0;
}
private SupportConceptPeriodStatisticsDC GetStatistics(ServicesOverviewRO ro, String name)
{
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.StartsWith(name))
{
return ps;
}
}
}
}
}
return null;
}
private void picSignature_BeforePrint(object sender, CancelEventArgs e)
{
XRPictureBox xrBox = sender as XRPictureBox;

View File

@@ -65,6 +65,8 @@ namespace BeWo.BetreutesWohnenWoellReports
{
pRO.ApprovedFLSPerWeek = stats.MinutesApprovedPerWeek / 60;
}
else
pRO.ApprovedFLSPerWeek = 0;
}
private SupportConceptPeriodStatisticsDC GetStatistics(ServicesOverviewRO ro, String name)

View File

@@ -6,6 +6,8 @@ using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using System.Linq;
using BS.Shared.DataContracts;
using BeWo.Service.ServiceImplementations;
namespace BeWo.BetreutesWohnenWoellReports
{
@@ -19,6 +21,7 @@ namespace BeWo.BetreutesWohnenWoellReports
public void SetReportDataSource(ServicesOverviewRO pRO)
{
double total = 0;
string cat = "";
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
@@ -28,6 +31,7 @@ namespace BeWo.BetreutesWohnenWoellReports
{
total += s.Minutes;
servicesBillable.Add(s);
cat = s.ServiceCategory;
}
}
if (servicesBillable.Any(s => s.ServiceCategory.ToLower().Contains("pflegesachleistung")))
@@ -40,7 +44,48 @@ namespace BeWo.BetreutesWohnenWoellReports
}
pRO.TotalFLMBillable = total;
SetBewilligung(pRO, cat);
this.bindingSource1.DataSource = pRO;
}
private void SetBewilligung(ServicesOverviewRO pRO, String name)
{
var stats = GetStatistics(pRO, name);
if (stats != null)
{
pRO.ApprovedFLSPerWeek = stats.MinutesApprovedPerWeek / 60;
}
else
pRO.ApprovedFLSPerWeek = 0;
}
private SupportConceptPeriodStatisticsDC GetStatistics(ServicesOverviewRO ro, String name)
{
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.StartsWith(name))
{
return ps;
}
}
}
}
}
return null;
}
}
}