64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.Invoicing;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Services;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Intego.Invoicing
|
|
{
|
|
public class CustomSettlementInvoiceCreation : SettlementInvoiceCreation
|
|
{
|
|
public override bool CanCreateInvoiceTheOldWay(Settlement2DC si, CostBearer2SupportConcept c2s)
|
|
{
|
|
return false;
|
|
}
|
|
public override void CreateInvoiceDetails(Settlement2DC si, CostBearer2SupportConcept c2s, DateTime? periodStart,
|
|
DateTime? periodEnd)
|
|
{
|
|
base.CreateInvoiceDetails(si, c2s, periodStart, periodEnd);
|
|
|
|
si.Notice = c2s.SupportConcept.Oid.Value.ToString();
|
|
}
|
|
public override bool IsServiceRecordBillable(ServiceRecord iRecord)
|
|
{
|
|
if (iRecord.ServiceDescription.ServiceCategory.Name.Contains("Assistenz"))
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override void CalculateSettlementInvoiceApprovedAmounts(Settlement2DC si, SupportConceptCostBearerRelDC relDC, Calculations calc)
|
|
{
|
|
si.ApprovedFLSWeekly = 0;
|
|
si.ApprovedFLS = 0;
|
|
foreach (var sp in relDC.ApprovalPeriodList)
|
|
{
|
|
if (sp.ServiceCategory == null || !sp.ServiceCategory.Name.Contains("Assistenz"))
|
|
{
|
|
si.ApprovedFLSWeekly += calc.GetApprovedHoursPerWeek(sp, relDC.CostBearer.CostRatePeriods) ?? 0m;
|
|
|
|
decimal flsTotal = calc.GetApprovedHoursTotal(sp, relDC.CostBearer.CostRatePeriods) ?? 0m;
|
|
flsTotal = Math.Round(flsTotal, 2, MidpointRounding.AwayFromZero);
|
|
|
|
si.ApprovedFLS += flsTotal;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public override IList<ServiceRecord> GetBillableServiceRecords(CostBearer2SupportConcept c2s)
|
|
{
|
|
return c2s.ServiceRecords.OrderBy(s => s.Start).Where(s => !s.ServiceDescription.ServiceCategory.Name.ToLower().Contains("assistenz")).ToList();
|
|
}
|
|
}
|
|
}
|