128 lines
4.7 KiB
C#
128 lines
4.7 KiB
C#
using System;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
namespace AidshilfeDortmund
|
|
{
|
|
public partial class Finanzauswertung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<FinanceRO>
|
|
{
|
|
public Finanzauswertung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(FinanceRO pRO)
|
|
{
|
|
pRO.CalculateBillableAmountInReportTimeSpan();
|
|
pRO.CalculatePaidAmountInReportTimeSpan();
|
|
|
|
if (pRO.ReportStartDate.HasValue && pRO.ReportEndDate.HasValue)
|
|
{
|
|
DateTime start = pRO.ReportStartDate.Value;
|
|
DateTime end = pRO.ReportEndDate.Value;
|
|
|
|
if (start.Year == end.Year && start.Month == end.Month && start.Day == 1 &&
|
|
end.Day == DateTime.DaysInMonth(end.Year, end.Month))
|
|
{
|
|
lblTitel.Text = String.Format("Finanzauswertung {0:MMMM yyyy}", start);
|
|
cellBewilligtImZeitraumHeader.Text = String.Format("bewilligte FLS {0:MMMM}", start);
|
|
cellGeleistetImZeitraumHeader.Text = String.Format("geleistete Std. {0:MMMM}", start);
|
|
cellFehlkontakteHeader.Text = String.Format("Fehl-\nkontakte {0:MMMM}", start);
|
|
}
|
|
else
|
|
{
|
|
lblTitel.Text = String.Format("Finanzauswertung {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
cellBewilligtImZeitraumHeader.Text = String.Format("bewilligte FLS {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
cellGeleistetImZeitraumHeader.Text = String.Format("geleistete Std. {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
//cellFehlkontakteHeader.Text = String.Format("Fehl-\nkontakte {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
}
|
|
if (pRO.RateFactor.HasValue)
|
|
{
|
|
cellRateFactorHeader.Text = String.Format("geleistete Std. x {0:0.##}", pRO.RateFactor);
|
|
}
|
|
else
|
|
{
|
|
//cellRateFactorHeader.Visible = false;
|
|
//cellRateFactor.Visible = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
cellBewilligtImZeitraumHeader.Visible = false;
|
|
cellBewilligteFLSImBereich.Visible = false;
|
|
cellGeleistetImBereich.Visible = false;
|
|
cellGeleistetImZeitraumHeader.Visible = false;
|
|
cellRateFactorHeader.Visible = false;
|
|
cellRateFactor.Visible = false;
|
|
}
|
|
|
|
if (pRO.GruppierungLeistungskategorie && pRO.SupportConceptFinanceList != null)
|
|
{
|
|
GroupHeader1.Visible = true;
|
|
GroupFooter1.Visible = true;
|
|
foreach (var scRo in pRO.SupportConceptFinanceList)
|
|
{
|
|
if (String.IsNullOrEmpty(scRo.Leistungskategorie))
|
|
{
|
|
scRo.GruppierungsKategorie = " ";
|
|
}
|
|
else
|
|
{
|
|
scRo.GruppierungsKategorie = String.Format("Leistungskategorie {0}", scRo.Leistungskategorie);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 19.05.2025 Stunden über Bewilligung werden nicht abgerechnet
|
|
foreach (var sc in pRO.SupportConceptFinanceList)
|
|
{
|
|
if (sc.CustomerName.Contains("Kök"))
|
|
{
|
|
|
|
}
|
|
decimal bewilligtGesamt = 0;
|
|
decimal rateFactor = 1.2m;
|
|
decimal hourlyRate = 70;
|
|
foreach (var ap in sc.Costbearer2Supportconcept.ApprovalPeriodList)
|
|
{
|
|
var calc = BS.Shared.Services.Calculations.GetInstance(sc.Costbearer2Supportconcept.CostBearer.CostBearerOid.ToString());
|
|
var c2sdc = sc.Costbearer2Supportconcept;
|
|
|
|
var costRateDcs = c2sdc.CostBearer.CostRatePeriods;
|
|
bewilligtGesamt += calc.GetApprovedHoursTotal(ap, c2sdc.CostBearer.CostRatePeriods) ?? 0;
|
|
}
|
|
if (bewilligtGesamt < sc.StundenFehlkontakte / 0.8m + sc.StundenNichtFehlkontakte) // Problem sc.BillableHours - enthält Abrechenbarkeitsfaktor der Fehlkontakte :-(
|
|
{
|
|
rateFactor = sc.RateFactor.Value;
|
|
hourlyRate = sc.HourlyRate.Value;
|
|
|
|
var ueberStunden = sc.StundenFehlkontakte / 0.8m + sc.StundenNichtFehlkontakte - bewilligtGesamt;
|
|
if (sc.StundenNichtFehlkontakteInReportTimeSpan - ueberStunden > 0)
|
|
{
|
|
sc.StundenNichtFehlkontakteInReportTimeSpan -= ueberStunden;
|
|
sc.BillableHoursInReportTimeSpanWithFactor = sc.StundenNichtFehlkontakteInReportTimeSpan * rateFactor;
|
|
sc.BillableAmountInReportTimeSpan -= ueberStunden * rateFactor * hourlyRate;
|
|
}
|
|
else
|
|
{
|
|
if (sc.StundenFehlkontakteInReportTimeSpan > 0 && (ueberStunden - sc.StundenNichtFehlkontakteInReportTimeSpan - sc.StundenFehlkontakteInReportTimeSpan) < 0)
|
|
{
|
|
sc.StundenFehlkontakteInReportTimeSpan = sc.StundenFehlkontakteInReportTimeSpan - (ueberStunden - sc.StundenNichtFehlkontakteInReportTimeSpan);
|
|
sc.BillableAmountInReportTimeSpan = sc.StundenFehlkontakteInReportTimeSpan * hourlyRate * 0.8m;
|
|
}
|
|
else
|
|
{
|
|
sc.StundenFehlkontakteInReportTimeSpan = 0;
|
|
sc.BillableAmountInReportTimeSpan = 0;
|
|
}
|
|
sc.StundenNichtFehlkontakteInReportTimeSpan = 0;
|
|
sc.BillableHoursInReportTimeSpanWithFactor = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
}
|