Files
BeWoPlaner/ReportImp/InternationalesFamilienzentrum/SupportConceptReport.cs
2025-01-08 09:36:32 +01:00

160 lines
7.0 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using BS.Shared.Extensions;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using BeWo.Data.Access;
using BeWo.Data.Entities;
namespace InternationalesFamilienzentrum
{
public partial class Hilfeplanuebersicht : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<SupportConceptListRO>
{
public Hilfeplanuebersicht()
{
InitializeComponent();
}
public void SetReportDataSource(SupportConceptListRO pRO)
{
if (pRO.AppointedDate.HasValue && pRO.AppointedDate.Value.Date < DateTime.Now.Date)
{
xrLabel1.Text = String.Format("Hilfeplanübersicht Stand {0:dd.MM.yyyy}", pRO.AppointedDate);
}
BerechneAuslastungNachLeistungsgruppen(pRO);
this.bindingSource1.DataSource = pRO;
}
private void BerechneAuslastungNachLeistungsgruppen(SupportConceptListRO pRO)
{
foreach (var sc in pRO.SupportConceptDetailList)
{
sc.Custom1 = "KEINE";
sc.Custom2 = ""; // Auslastung LG in % Min-wert
sc.Custom3 = ""; // Auslastung LG in % Max-wert
if (sc.CostBearer2SupportConceptOid > 0)
{
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(sc.CostBearer2SupportConceptOid);
foreach (var scap in c2s.ApprovalPeriodList)
{
if (scap.ServiceCategory != null)
{
sc.Custom1 = scap.ServiceCategory.Name; // Leistungsgruppe
}
}
}
decimal ratio = 1;
if (sc.FLSPerWeekSoll != 0)
{
ratio = sc.FLSTotal / sc.FLSPerWeekSoll;
}
if (sc.Custom1.Contains("LG 1"))
{
sc.Custom2 = Math.Round(8 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(90 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
else if (sc.Custom1.Contains("LG 2"))
{
sc.Custom2 = Math.Round(91 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(150 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
else if (sc.Custom1.Contains("LG 3"))
{
sc.Custom2 = Math.Round(151 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(210 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
else if (sc.Custom1.Contains("LG 4"))
{
sc.Custom2 = Math.Round(211 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(270 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
else if (sc.Custom1.Contains("LG 5"))
{
sc.Custom2 = Math.Round(271 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(390 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
else if (sc.Custom1.Contains("LG 6"))
{
sc.Custom2 = Math.Round(391 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(510 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
else if (sc.Custom1.Contains("LG 7"))
{
sc.Custom2 = Math.Round(511 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(750 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
else if (sc.Custom1.Contains("LG 8"))
{
sc.Custom2 = Math.Round(751 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
sc.Custom3 = Math.Round(1050 * ratio / 60, 2, MidpointRounding.AwayFromZero).ToString();
}
}
}
private void BerechneAuslastungNachLeistungsgruppenOld(SupportConceptListRO pRO)
{
foreach (var sc in pRO.SupportConceptDetailList)
{
sc.Custom1 = "LG"; // Leistungsgruppe
sc.Custom2 =""; // Auslastung LG in % Min-wert
sc.Custom3 = ""; // Auslastung LG in % Max-wert
if ((sc.FLSPerWeekSoll * 60) < 91)
{
sc.Custom1 += " 1";
sc.Custom2 = (sc.FLSPerWeekIst / 8 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst / 90 * 60).ToString("0.00 %");
}
else if ((sc.FLSPerWeekSoll * 60) < 151)
{
sc.Custom1 += " 2";
sc.Custom2 = (sc.FLSPerWeekIst / 91 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst / 150 * 60).ToString("0.00 %");
}
else if ((sc.FLSPerWeekSoll * 60) < 211)
{
sc.Custom1 += " 3";
sc.Custom2 = (sc.FLSPerWeekIst / 151 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst /210 * 60).ToString("0.00 %");
}
else if ((sc.FLSPerWeekSoll * 60) < 271)
{
sc.Custom1 += " 4";
sc.Custom2 = (sc.FLSPerWeekIst / 211 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst / 270 * 60).ToString("0.00 %");
}
else if ((sc.FLSPerWeekSoll * 60) < 391)
{
sc.Custom1 += " 5";
sc.Custom2 = (sc.FLSPerWeekIst / 271 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst / 390 * 60).ToString("0.00 %");
}
else if ((sc.FLSPerWeekSoll * 60) < 511)
{
sc.Custom1 += " 6";
sc.Custom2 = (sc.FLSPerWeekIst / 391 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst / 510 * 60).ToString("0.00 %");
}
else if ((sc.FLSPerWeekSoll * 60) < 751)
{
sc.Custom1 += " 7";
sc.Custom2 = (sc.FLSPerWeekIst / 511 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst / 750* 60).ToString("0.00 %");
}
else if ((sc.FLSPerWeekSoll * 60) < 1051)
{
sc.Custom1 += " 8";
sc.Custom2 = (sc.FLSPerWeekIst / 751 * 60).ToString("0.00 %");
sc.Custom3 = (sc.FLSPerWeekIst / 1050 * 60).ToString("0.00 %");
}
}
}
}
}