SBBMainzReports/Invoicing/CustomInvoiceCreationQA.cs - Bugfix HPs aus laufendem Monat
SupportOID=167329
This commit is contained in:
@@ -116,25 +116,41 @@ namespace SBBMainzReports.Invoicing
|
||||
{
|
||||
decimal? hourlyRate = cr.CostRateValue.Value;
|
||||
decimal weeklyFactor = 4.33m;
|
||||
if (scap.StartDate.HasValue && scap.StartDate.Value.Day > 7)
|
||||
// Anteilige Berechnung nur in dem Monat, in dem der HP tatsächlich beginnt bzw. endet -
|
||||
// in allen anderen (vollen) Monaten wird der volle Monatsfaktor berechnet
|
||||
if (scap.StartDate.HasValue && scap.StartDate.Value.Day > 7 && serviceInvoicePeriod.Start.HasValue
|
||||
&& scap.StartDate.Value.Year == serviceInvoicePeriod.Start.Value.Year && scap.StartDate.Value.Month == serviceInvoicePeriod.Start.Value.Month)
|
||||
{
|
||||
int startDay = scap.StartDate.Value.Day;
|
||||
if (startDay <= 14)
|
||||
{
|
||||
weeklyFactor = Math.Min(weeklyFactor, 3m);
|
||||
}
|
||||
else if (startDay <= 21)
|
||||
{
|
||||
weeklyFactor = Math.Min(weeklyFactor, 2m);
|
||||
}
|
||||
else
|
||||
{
|
||||
weeklyFactor = Math.Min(weeklyFactor, 1m);
|
||||
}
|
||||
}
|
||||
if (scap.EndDate.HasValue && scap.EndDate.Value.Day < 22)
|
||||
if (scap.EndDate.HasValue && scap.EndDate.Value.Day < 22 && serviceInvoicePeriod.End.HasValue
|
||||
&& scap.EndDate.Value.Year == serviceInvoicePeriod.End.Value.Year && scap.EndDate.Value.Month == serviceInvoicePeriod.End.Value.Month)
|
||||
{
|
||||
int endDay = scap.EndDate.Value.Day;
|
||||
if (endDay >= 15)
|
||||
{
|
||||
weeklyFactor = Math.Min(weeklyFactor, 3m);
|
||||
}
|
||||
else if (endDay >= 8)
|
||||
{
|
||||
weeklyFactor = Math.Min(weeklyFactor, 2m);
|
||||
}
|
||||
else
|
||||
{
|
||||
weeklyFactor = Math.Min(weeklyFactor, 1m);
|
||||
}
|
||||
}
|
||||
|
||||
decimal approvedHours = 0;
|
||||
@@ -142,7 +158,7 @@ namespace SBBMainzReports.Invoicing
|
||||
if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Weekly && scap.ApprovedBEPerInterval.HasValue)
|
||||
{
|
||||
approvedHours = scap.ApprovedBEPerInterval.Value;
|
||||
approvedHoursMonth = Math.Round(weeklyFactor * scap.ApprovedBEPerInterval.Value, 2, MidpointRounding.AwayFromZero);
|
||||
approvedHoursMonth = weeklyFactor * scap.ApprovedBEPerInterval.Value;
|
||||
}
|
||||
decimal amount = approvedHoursMonth * hourlyRate.Value;
|
||||
serviceInvoicePeriod.InvoiceItemList.Add(new InvoiceItem
|
||||
|
||||
Reference in New Issue
Block a user