EvVereinFürWohnraumhilfe/Invoicing/CollectiveInvoiceCreation - Bugfix u Aufhebung Bewilligung HP

This commit is contained in:
2024-09-03 10:56:05 +02:00
parent 1414b9be61
commit f146c925ef
3 changed files with 29 additions and 76 deletions

View File

@@ -23,17 +23,21 @@ namespace BeWo.Report.DefaultReports
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat"))
sip.ApprovedHours = 1;
else
if (sip.SupportConceptApprovalPeriod != null)
{
DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd;
DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart;
sip.ApprovedHours = (decimal)(end - start).TotalDays;
if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat"))
sip.ApprovedHours = 1;
else
{
DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd;
DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart;
sip.ApprovedHours = (decimal)(end - start).TotalDays;
}
}
if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
if (sip.CostBearer2SupportConcept != null && sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG";
if (sip.Notice != null)
{

View File

@@ -21,22 +21,29 @@ namespace EvVereinF
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.Customer.LastNameFirstName.Contains("Prell"))
{
int test = 1;
}
if (sip.Notice != null)
{
if (sip.ServiceInvoiceItems.Count > 0)
sip.NotBillableString = sip.ServiceInvoiceItems[0].UnitDescription;
}
if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat"))
sip.ApprovedHours = 1;
else
if (sip.SupportConceptApprovalPeriod != null)
{
DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd;
DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart;
if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat"))
sip.ApprovedHours = 1;
else
{
DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd;
DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart;
sip.ApprovedHours = (decimal)(end - start).TotalDays + 1;
sip.ApprovedHours = (decimal)(end - start).TotalDays + 1;
}
if (sip.CostBearer2SupportConcept != null && sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG";
}
if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG";
}
//var anhang = new SammelrechnungAnhang();

View File

@@ -18,8 +18,6 @@ namespace EvVereinF
{
public class CollectiveInvoiceCreation : InvoiceCreation
{
private DateTime? accountingPeriodStart = null;
private DateTime? accountingPeriodEnd = null;
public override void SetInvoiceId(ServiceInvoice invoice)
{
@@ -29,7 +27,8 @@ namespace EvVereinF
public override ServiceInvoice CreateCollectiveBilling(CostBearer costBearer, DateTimeSpan invoicePeriod, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
{
FuegeAbgelaufeneHilfeplaeneMitAktuellenBewilligungenHinzu(costBearer, invoicePeriod, supportConcepts2ServiceRecords);
// 02.09.2024: ist nicht mehr nötig
// FuegeAbgelaufeneHilfeplaeneMitAktuellenBewilligungenHinzu(costBearer, invoicePeriod, supportConcepts2ServiceRecords);
var invoice = new ServiceInvoice();
var newDict = new Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>>();
@@ -59,33 +58,6 @@ namespace EvVereinF
return invoice;
}
private void FuegeAbgelaufeneHilfeplaeneMitAktuellenBewilligungenHinzu(CostBearer costBearer, DateTimeSpan invoicePeriod, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
{
var alleHilfeplaene = DAOFactory.GenericDAO.GetAllActiveAndArchived<SupportConcept>();
var cs = new CustomerService();
foreach (var sc in alleHilfeplaene)
{
foreach (var c2s in sc.CostBearer2SupportConceptList)
{
if (c2s.EndDate < invoicePeriod.StartDate)
{
if (c2s.CostBearer.Oid == costBearer.Oid)
{
foreach (var ap in c2s.ApprovalPeriodList)
{
if (ap.EndDate >= invoicePeriod.StartDate && ap.StartDate <= invoicePeriod.EndDate)
{
var scDc = cs.CreateFlatSupportConcept(sc, c2s);
supportConcepts2ServiceRecords.Add(scDc, new List<ServiceRecordDC>());
}
}
}
}
}
}
}
public override void SetServiceInvoicePeriods(ServiceInvoice invoice, CostBearer2SupportConcept costBearer2SupportConcept, DateTimeSpan invoicePeriod, List<ServiceRecordDC> serviceRecords)
{
var invoiceAccountingPeriodSpan = new DateTimeSpan
@@ -144,37 +116,7 @@ namespace EvVereinF
invoice.ServiceInvoicePeriodList.Add(serviceInvoicePeriod);
}
}
//if (invoice.ServiceInvoicePeriodList.Count > 0)
//{
// decimal cor = 0;
// for (int i = invoice.ServiceInvoicePeriodList.Count - 1; i >= 0; i--)
// {
// var sip = invoice.ServiceInvoicePeriodList[i];
// if (sip.SupportConceptApprovalPeriod.ServiceCategory == null)
// {
// cor = sip.InvoiceItemList[0].AmountTotal.Value;
// var cb2scOid = sip.SupportConceptApprovalPeriod.CostBearer2SupportConcept.Oid;
// var sipOther = invoice.ServiceInvoicePeriodList.Where(s => s.SupportConceptApprovalPeriod.CostBearer2SupportConcept.Oid == cb2scOid);
// var sipCor = sipOther.FirstOrDefault(s => s.SupportConceptApprovalPeriod.ServiceCategory != null);
// if (sipCor != null && cor != 0)
// {
// sipCor.InvoiceItemList[0].AmountTotal += cor;
// sipCor.InvoiceItemList[0].GrossAmountTotal += cor;
// sipCor.Notice = String.Format("{0:0.00}", cor);
// invoice.ServiceInvoicePeriodList.Remove(sip);
// }
// if (costBearer2SupportConcept.ApprovedEndDate < invoicePeriod.StartDate)
// {
// //sip.InvoiceItemList[0].AmountTotal += cor;
// //sip.InvoiceItemList[0].GrossAmountTotal += cor;
// sip.Notice = String.Format("{0:0.00}", cor);
// //invoice.ServiceInvoicePeriodList.Remove(sip);
// }
// }
// }
if (invoice.ServiceInvoicePeriodList.Count > 0)
{
foreach (var sip in invoice.ServiceInvoicePeriodList)