Files
BeWoPlaner/ReportImp/Hiba/ServicesOverviewReport.cs
Christian bb25b9f7ff cb
2018-05-28 15:02:55 +02:00

87 lines
2.9 KiB
C#

using System.Collections.Generic;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared;
namespace Hiba
{
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
{
public Stundenzettel()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.Services != null)
{
bool isHaushaltshilfe = false;
bool isFls = false;
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;
}
else
{
isFls = true;
}
}
}
pRO.Services = servicesBillable;
if (isHaushaltshilfe && !isFls)
{
lblTitel.Text = "Quittierungsbeleg über aktivierende Haushaltshilfe";
}
}
SetzeBewilligung(pRO);
this.bindingSource1.DataSource = pRO;
}
private void SetzeBewilligung(ServicesOverviewRO pRo)
{
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)
{
if (scap.StartDate <= pRo.EndDate && scap.EndDate >= pRo.StartDate)
{
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;
}
}
}
}
lblBewilligt.Text = text;
}
}
}