AuswegHeikePuetz/Invoicing/JugendamtInvoiceCreation - keine Kappung durch Abwesenheiten
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
<Compile Include="InvoiceCustomerReport.Designer.cs">
|
||||
<DependentUpon>InvoiceCustomerReport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Invoicing\JugendamtInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\AssistenzInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
|
||||
<Compile Include="Invoicing\SettlementInvoiceCreation.cs" />
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace Ausweg.Invoicing
|
||||
String cat = sd.Name.ToLower().Trim();
|
||||
if (cat.IndexOf("assistenz") >= 0)
|
||||
{
|
||||
return new CustomAssistenzInvoiceCreation();
|
||||
return new CustomAssistenzInvoiceCreation(); // Klassischer Filter für Abrechnung Assistenz in Sammelrg und FLS in Spitzabrechnung für LVR
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return new CustomJugendamtInvoiceCreation(); // Abrechnung mit JA geht über FLS in Sammelrechnung, aber die Abwesenheiten spielen keine Rolle
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace Ausweg.Invoicing
|
||||
{
|
||||
// keine Berücksichtung von Abwesenheiten in Abrechnung
|
||||
|
||||
public class CustomJugendamtInvoiceCreation : InvoiceCreation
|
||||
{
|
||||
public override void SetAmountAdvancePayments(ServiceInvoice invoice)
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public override void SetAmountEquityContribution(ServiceInvoice invoice)
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public override void SetInvoiceItems(ServiceInvoice invoice,
|
||||
ServiceInvoicePeriod serviceInvoicePeriod,
|
||||
SupportConceptApprovalPeriodDC supportConceptApprovalPeriod,
|
||||
CostBearer2SupportConcept cb2sc,
|
||||
DateTimeSpan invoicePeriod,
|
||||
List<ServiceRecordDC> serviceRecords)
|
||||
{
|
||||
Calculations calc = PluginLoader.FindClass<Calculations>(_SpecificID) ?? Calculations.GetInstance(_SpecificID);
|
||||
|
||||
if (ShouldCreateFixedAmounts(serviceInvoicePeriod, supportConceptApprovalPeriod, cb2sc))
|
||||
{
|
||||
CreateFixedAmounts(serviceInvoicePeriod, supportConceptApprovalPeriod, cb2sc);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ServiceRecordDC> serviceRecordsInPeriod = serviceRecords.Where(
|
||||
i =>
|
||||
{
|
||||
bool valid = i.Start.Value.InBetween(serviceInvoicePeriod.Start.Value,
|
||||
serviceInvoicePeriod.End.Value, true);
|
||||
|
||||
if (valid && serviceInvoicePeriod.SupportConceptApprovalPeriod != null && serviceInvoicePeriod.SupportConceptApprovalPeriod.ServiceCategory != null)
|
||||
valid = serviceInvoicePeriod.SupportConceptApprovalPeriod.ServiceCategory.Oid ==
|
||||
i.ServiceDescription.Category.ServiceCategoryOid;
|
||||
return valid;
|
||||
}).ToList();
|
||||
|
||||
if (serviceRecordsInPeriod.Count > 0)
|
||||
{
|
||||
var absenceTimes = MapperFactory.AbsenceTimeDC_AbsenceTime.MapToNewDCs(cb2sc.SupportConcept.Customer.AbsenceTimes);
|
||||
Dictionary<DateTimeSpan, decimal> span2Hours = calc.GetAbsencesTimesNotBillable(absenceTimes);
|
||||
|
||||
// serviceInvoicePeriod.HoursNotBillableAbsence - eingeschränkte Anzahl bei Abwesenheit nicht bei Jugenämtern
|
||||
serviceInvoicePeriod.HoursNotBillableNotApproved +=
|
||||
calc.GetHoursNotBillableDueToMoreThanApproved(supportConceptApprovalPeriod,
|
||||
cb2sc.CostBearer.CostRatePeriods.MapToNewDCs(),
|
||||
serviceRecordsInPeriod,
|
||||
true, true);
|
||||
|
||||
var itemList = CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, serviceInvoicePeriod.SupportConceptApprovalPeriod, calc);
|
||||
serviceInvoicePeriod.InvoiceItemList.AddRange(itemList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user