MH: ASB Poolabrechnung

This commit is contained in:
2023-09-13 09:39:10 +02:00
parent f679dc54a4
commit 0abc8d6ac1
3 changed files with 30 additions and 10 deletions

View File

@@ -74,7 +74,7 @@
<Compile Include="Invoicing\CustomInvoiceCreation.cs" />
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
<Compile Include="Invoicing\CustomInvoiceNumberGenerator.cs" />
<Compile Include="Invoicing\ChristophorusPoolInvoiceCreation.cs" />
<Compile Include="Invoicing\PoolInvoiceCreation.cs" />
<Compile Include="LeistungsnachweisSbd.cs">
<SubType>Component</SubType>
</Compile>

View File

@@ -24,7 +24,7 @@ namespace AsbRheinErftDuerenSBD.Invoicing
return new CustomInvoiceCreationAldenhoven();
}
else if (sc.CostBearer.Contains("Sozialamt Düren Pools"))
return new ChristophorusPoolInvoiceCreation();
return new PoolInvoiceCreation();
//else if (sc.CostBearer.Contains("Sozialamt Kreis Düren"))
//{
// return new CustomInvoiceCreationAldenhoven();

View File

@@ -10,7 +10,7 @@ using System.Linq;
namespace AsbRheinErftDuerenSBD.Invoicing
{
public class ChristophorusPoolInvoiceCreation : InvoiceCreation
public class PoolInvoiceCreation : InvoiceCreation
{
public override void SetInvoiceId(ServiceInvoice invoice)
{
@@ -42,11 +42,11 @@ namespace AsbRheinErftDuerenSBD.Invoicing
if (team == null)
return;
var anzFK = 0;
decimal anzFK = 0;
var preiseFK = DAOFactory.GenericDAO.GetAllActive<ServiceCategory>().FirstOrDefault(sc => sc.Name == "Pool - Fachkraft (FK)").CostRatePeriods.ToList();
var anzHK = 0;
decimal anzHK = 0;
var preiseHK = DAOFactory.GenericDAO.GetAllActive<ServiceCategory>().FirstOrDefault(sc => sc.Name == "Pool-Nichtfachkraft (HK)").CostRatePeriods.ToList();
var anzHKTeilzeit = 0;
decimal anzHKTeilzeit = 0;
var preiseHKTeilzeit = DAOFactory.GenericDAO.GetAllActive<ServiceCategory>().FirstOrDefault(sc => sc.Name == "Pool-Nichtfachkraft(HK)").CostRatePeriods.ToList();
var employee = MapperFactory.EmployeeDC_Employee.MapToNewDCs(DAOFactory.GenericDAO.GetActiveByIDs<Employee>(team.Member.Select(m => m.EmployeeOid).ToList()));
@@ -55,16 +55,26 @@ namespace AsbRheinErftDuerenSBD.Invoicing
foreach (var e in employee)
{
if (allServiceRecords.Any(s => s.EmployeeOid == e.EmployeeOid && s.ServiceDescription.ServiceCategory.Name.ToLower().Contains("poolpauschale")))
var sr = allServiceRecords.FirstOrDefault(s => s.EmployeeOid == e.EmployeeOid && s.ServiceDescription.ServiceCategory.Name.ToLower().Contains("poolpauschale"));
if (sr != null)
{
serviceInvoicePeriod.Notice += e.FirstName + " " + e.LastName + ", ";
// Wenn Mitarbeiter erst Mitte oder 3/4 des Monats angefangen hat, wird der Anteil um 50 bzw 75% verringert
if (e.LastName.Contains("Bugla") && e.FirstName.Contains("Frank")) // Hier Ausnahme, also Teilzeit-MA, einfügen
anzHKTeilzeit++;
{
anzHKTeilzeit += VerringerungUeberpruefen(sr);
}
else if (e.IsQualified.HasValue && e.IsQualified.Value)
anzFK++;
{
anzFK += VerringerungUeberpruefen(sr);
}
else if (!e.IsQualified.HasValue || e.IsQualified.HasValue && !e.IsQualified.Value)
anzHK++;
{
anzHK += VerringerungUeberpruefen(sr);
}
}
}
if (!serviceInvoicePeriod.Notice.IsNullOrEmpty())
@@ -126,6 +136,16 @@ namespace AsbRheinErftDuerenSBD.Invoicing
}
}
private decimal VerringerungUeberpruefen(ServiceRecord sr)
{
if (sr.ServiceDescription.Name.Contains("50%"))
return 0.5m;
else if (sr.ServiceDescription.Name.Contains("25%"))
return 0.25m;
else
return 1m;
}
private static decimal GetPreis(DateTime datum, List<CostRatePeriod> preise)
{
var preis = 0.0m;