Files
BeWoPlaner/ReportImp/Hiba/ServicesOverviewReport.cs

126 lines
4.5 KiB
C#
Raw Normal View History

using System;
2018-04-27 14:23:43 +02:00
using System.Collections.Generic;
using BeWo.Report;
using BeWo.Report.ReportObjects;
2018-05-28 15:02:55 +02:00
using BS.Shared;
2018-04-27 14:23:43 +02:00
namespace Hiba
{
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
{
public Stundenzettel()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
2019-07-12 10:33:31 +02:00
String hhName = "";
2020-02-06 18:43:11 +01:00
bool isHaushaltshilfe = false;
bool isFls = false;
2019-07-12 10:33:31 +02:00
2018-04-27 14:23:43 +02:00
if (pRO.Services != null)
{
2020-02-06 18:43:11 +01:00
2018-04-27 14:23:43 +02:00
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
{
if (s.IsBillable)
{
ServicesOverviewRO.CreateGoalList(s);
servicesBillable.Add(s);
if (s.ServiceCategory == "Aktivierende Haushaltshilfe")
{
isHaushaltshilfe = true;
2019-07-12 10:33:31 +02:00
hhName = s.EmployeeFullname;
2018-04-27 14:23:43 +02:00
}
else
{
isFls = true;
}
if (!String.IsNullOrWhiteSpace(s.GefahreneKilometer) && s.GefahreneKilometer != "0")
{
s.GefahreneKilometer = "x";
}
else
{
s.GefahreneKilometer = "";
}
2018-04-27 14:23:43 +02:00
}
}
pRO.Services = servicesBillable;
if (isHaushaltshilfe && !isFls)
{
lblTitel.Text = "Quittierungsbeleg <20>ber aktivierende Haushaltshilfe";
2019-07-12 10:33:31 +02:00
if (!String.IsNullOrEmpty(hhName))
{
pRO.MainAttendant = hhName;
}
2018-04-27 14:23:43 +02:00
}
}
2019-07-12 10:33:31 +02:00
2020-02-06 18:43:11 +01:00
SetzeBewilligung(pRO, isHaushaltshilfe && !isFls);
2018-04-27 14:23:43 +02:00
this.bindingSource1.DataSource = pRO;
}
2020-02-06 18:43:11 +01:00
private void SetzeBewilligung(ServicesOverviewRO pRo, bool isHaushaltshilfe)
2018-05-28 15:02:55 +02:00
{
string text = "Bewilligte Fachleistungsstunden w<>chentlich:";
if (pRo.CostBearer2SupportConceptList != null && pRo.CostBearer2SupportConceptList.Count > 0)
{
var c2s = pRo.CostBearer2SupportConceptList[0];
foreach (var scap in c2s.ApprovalPeriodList)
{
2020-02-06 18:43:11 +01:00
if (scap.ServiceCategory == null ||
((!isHaushaltshilfe && !scap.ServiceCategory.Name.Contains("Haushaltshilfe")) ||
(isHaushaltshilfe && scap.ServiceCategory.Name.Contains("Haushaltshilfe"))))
2018-05-28 15:02:55 +02:00
{
2020-02-06 18:43:11 +01:00
if (scap.StartDate <= pRo.EndDate && scap.EndDate >= pRo.StartDate)
2018-05-28 15:02:55 +02:00
{
2020-02-06 18:43:11 +01:00
if (scap.ApprovedBEInterval.HasValue &&
scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Weekly)
{
text = "Bewilligte Fachleistungsstunden w<>chentlich:";
pRo.ApprovedFLSPerWeek = scap.ApprovedBEPerInterval ?? 0;
}
if (scap.ApprovedBEInterval.HasValue &&
scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Monthly)
{
text = "Bewilligte Fachleistungsstunden monatlich:";
pRo.ApprovedFLSPerWeek = scap.ApprovedBEPerInterval ?? 0;
}
if (scap.ApprovedBEInterval.HasValue &&
scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Yearly)
{
text = "Bewilligte Fachleistungsstunden j<>hrlich:";
pRo.ApprovedFLSPerWeek = scap.ApprovedBEPerInterval ?? 0;
}
2018-05-28 15:02:55 +02:00
}
}
}
}
2020-02-06 18:43:11 +01:00
if (isHaushaltshilfe)
{
text = text.Replace("Fachleistungsstunden", "Stunden");
}
2018-05-28 15:02:55 +02:00
lblBewilligt.Text = text;
}
2018-04-27 14:23:43 +02:00
}
}