diff --git a/ReportImp/HshCologne/Invoicing/CustomInvoiceCreation.cs b/ReportImp/HshCologne/Invoicing/CustomInvoiceCreation.cs index f1c8b417e..8f6afe226 100644 --- a/ReportImp/HshCologne/Invoicing/CustomInvoiceCreation.cs +++ b/ReportImp/HshCologne/Invoicing/CustomInvoiceCreation.cs @@ -19,6 +19,7 @@ namespace HshCologne.Invoicing public class CustomInvoiceCreation : InvoiceCreation { + private VacationService _vs = null; private DateTime? accountingPeriodStart = null; private DateTime? accountingPeriodEnd = null; private decimal AMOUNT_PER_KM = 0.30m; @@ -85,6 +86,13 @@ namespace HshCologne.Invoicing { list.Add(invoiceItem); } + // Die haben ein paar Sonderfälle, wo sie im Teilstationären Bereich auch Wochenend- und Feiertagszuschläge abrechnen dürfen + // Wir haben dafür im Hilfeplan das Feld Beratung benötigt in "Mit Wochenendzuschlägen" umbenannt + if (scap.CostBearer2SupportConcept.SupportConcept.ConsultingNeeded.HasValue + && scap.CostBearer2SupportConcept.SupportConcept.ConsultingNeeded.Value) + { + _vs = PluginLoader.FindClass(); + } iServiceRecord.AlreadyAccounted = true; } } @@ -114,7 +122,7 @@ namespace HshCologne.Invoicing var c = DAOFactory.GenericDAO.LoadByID(serviceRecordsInPeriod[0].Customer.CustomerOid); if (c.HealthInsurance.IsNotNullOrEmpty() && decimal.TryParse(c.HealthInsurance, out custKm)) { - var leistungen = new List { "HPG", "Hausbesuch", "Abholung und Begleitung", "Einsatz HPG", "Fachgespräch"}; + var leistungen = new List { "HPG", "Hausbesuch", "Abholung und Begleitung", "Einsatz HPG", "Fachgespräch" }; int count = serviceRecordsInPeriod.Count(sr => leistungen.Contains(sr.ServiceDescription.Name)); custKm = custKm * count; @@ -198,7 +206,8 @@ namespace HshCologne.Invoicing } } else if (iServiceRecord.Employee.ValueListEntries != null && (iServiceRecord.ServiceDescription.Category.Name == "Schulbegleitung" - || iServiceRecord.ServiceDescription.Category.Abbreviation != null && iServiceRecord.ServiceDescription.Category.Name == "SB")) + || iServiceRecord.ServiceDescription.Category.Abbreviation != null && iServiceRecord.ServiceDescription.Category.Name == "SB" + || iServiceRecord.ServiceDescription.Category.Name.ToLower().StartsWith("außerschulische"))) { if (iServiceRecord.CostBearer.Name.Contains("Geilenkirchen")) // Geilenkirchen hat die Sonderlocke mit dem Preis liegt unter Orga { @@ -224,7 +233,7 @@ namespace HshCologne.Invoicing ii.UnitDescription = "Assistenzkraft mit 2 jähriger BE"; } else if (qOid.Any(q => q == 1463)) - { + { stundensatz = preisAK2Jahre; ii.UnitDescription = "Assistenzkraft UMA Erftstadt"; } @@ -286,8 +295,8 @@ namespace HshCologne.Invoicing private InvoiceItem CreateFAMInvoiceItem(List serviceRecordsInPeriod, SupportConceptApprovalPeriod scap, Calculations calc) { var days = serviceRecordsInPeriod.Where(r => r.ServiceDescription.CategoryName == "FAM").GroupBy(r => r.Start.Value.Date).Count(); - if (days > 0) - { + if (days > 0) + { InvoiceItem interimsItem = CreateInvoiceItem(serviceRecordsInPeriod.Where(r => r.ServiceDescription.CategoryName == "FAM").FirstOrDefault(), scap, calc); if (interimsItem != null) { @@ -314,7 +323,7 @@ namespace HshCologne.Invoicing base.CreateFixedAmounts(serviceInvoicePeriod, supportConceptApprovalPeriod, cb2sc); foreach (var ii in serviceInvoicePeriod.InvoiceItemList) { - if (ii.UnitCount == null) + if (ii.UnitCount == null) { ii.UnitCount = 1; ii.AmountPerUnit = ii.AmountTotal; @@ -351,12 +360,117 @@ namespace HshCologne.Invoicing //{ // sip.Notice = "Fachkraft"; //} - } + } } public override IList CreateSummaryInvoiceItems(IList itemList, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc) { return itemList; } + + // public virtual Zeitverteilung2 BerechneZuschlag(ServiceRecord sr) + // { + // Zeitverteilung2 zv = new Zeitverteilung2(); + // DateTime datum = sr.Start.Value; + // var duration = GetDuration(sr); + // if (duration > 0) + // { + // if (_vs.IstFeiertag(datum)) + // { + // zv.MinutenFeiertag = CheckUhrzeiten(datum, 0, 24, (double)duration); + // } + // else if (sr.Start.Value.DayOfWeek == DayOfWeek.Sunday) + // { + // zv.MinutenSonntag = CheckUhrzeiten(datum, 6, 22, (double)duration); + // } + // else if (sr.Start.Value.DayOfWeek == DayOfWeek.Saturday) + // { + // zv.MinutenSamstag13_24 = CheckUhrzeiten(datum, 13, 24, (double)duration); + // } + // } + + // return zv; + // } + + // private decimal GetDuration(ServiceRecord sr) + // { + // decimal duration = 0; + + // if (sr.GroupRoundedDuration.HasValue) + // { + // duration = sr.GroupRoundedDuration.Value; + // } + // else + // { + // duration = sr.RoundedDuration; + // } + // if (sr.ServiceDescription != null && sr.ServiceDescription.ServiceCategory != null) + // { + // var p = sr.ServiceDescription.ServiceCategory.ProzentAbrechnung; + // if (sr.ServiceDescription.ProzentAbrechnung.HasValue) + // { + // p = sr.ServiceDescription.ProzentAbrechnung.Value; + // } + + // if (p != 100 && p > 0) + // { + // duration *= p / 100; + // } + // } + + // return duration; + // } + + // private double CheckUhrzeiten(DateTime start, int startStunde, int endStunde, double minuten) + // { + // if (startStunde > endStunde) //Nachts + // { + // DateTime nachtStartDt = start.Date.AddHours(startStunde); + // DateTime nachtEndDt = start.Date.AddDays(1).AddHours(endStunde); + // DateTime dtEnd = start.AddMinutes(minuten); + + // double minutes = GetOverlappingMinutes(start, dtEnd, nachtStartDt, nachtEndDt); + // minutes += GetOverlappingMinutes(start, dtEnd, nachtStartDt.AddDays(-1), nachtEndDt.AddDays(-1)); + // minutes += GetOverlappingMinutes(start, dtEnd, nachtStartDt.AddDays(1), nachtEndDt.AddDays(1)); + + // return minutes; + // } + // else + // { + // DateTime tagsStartDt = start.Date.AddHours(startStunde); + // DateTime tagsEndDt = start.Date.AddHours(endStunde); + // DateTime dtEnd = start.AddMinutes(minuten); + // double minutes = GetOverlappingMinutes(start, dtEnd, tagsStartDt, tagsEndDt); + + // return minutes; + // } + // } + + // private double GetOverlappingMinutes(DateTime start, DateTime end, DateTime start2, DateTime end2) + // { + // if (end > start2 && start < end2) + // { + // DateTime dtStart = start; + // if (dtStart < start2) + // dtStart = start2; + + // DateTime dtEnd = end; + // if (dtEnd > end2) + // dtEnd = end2; + // TimeSpan ts = dtEnd.Subtract(dtStart); + + // return ts.TotalMinutes; + // } + + // return 0; + // } + //} + + //public class Zeitverteilung2 + //{ + // public double MinutenSamstag13_24 { get; set; } + // public double MinutenSonntag { get; set; } + // public double MinutenFeiertag { get; set; } + //} } -} +} \ No newline at end of file diff --git a/ReportImp/HshCologne/ServiceInvoiceReport.cs b/ReportImp/HshCologne/ServiceInvoiceReport.cs index 3b7a6d282..18292ec0e 100644 --- a/ReportImp/HshCologne/ServiceInvoiceReport.cs +++ b/ReportImp/HshCologne/ServiceInvoiceReport.cs @@ -70,6 +70,31 @@ namespace HshCologne if (subReport != null) subReport.SetReportDataSource(flsRO); + + // Daten für Bewilligungsumfang setzen +// foreach (var sip in pRO.ServiceInvoicePeriods) +// { +// string periode = ""; +// var scap = cb2sc.ApprovalPeriodList.Where(ap => ap.ServiceCategory != null && ap.ServiceCategory.Name.Contains("Interne") && +//ap.StartDate < pRO.AccountingPeriodEnd && ap.EndDate > pRO.AccountingPeriodStart).FirstOrDefault(); + +// if (sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval != null && sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval != 0) +// { + //switch (sip.SupportConceptApprovalPeriod.ApprovedBEInterval) + //{ + // case BS.Shared.SupportConceptApprovalInterval.Daily: periode = "Tag"; break; + // case BS.Shared.SupportConceptApprovalInterval.Weekly: periode = "Woche"; break; + // case BS.Shared.SupportConceptApprovalInterval.Monthly: periode = "Monat"; break; + // case BS.Shared.SupportConceptApprovalInterval.HalfYearly: periode = "Halbjahr"; break; + // case BS.Shared.SupportConceptApprovalInterval.Yearly: periode = "Jahr"; break; + // case BS.Shared.SupportConceptApprovalInterval.Fortnightly: periode = "Pauschal"; break; + + //} + + // var test = string.Format("{0:0.00}", sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval) + " FLS / " + periode + " bis " + string.Format("{0:dd.MM.yyyy}", sip.SupportConceptApprovalPeriod.EndDate) + "\n"; + // } + //} + if (pRO.ServiceInvoicePeriods.All(sip => sip.ServiceInvoiceItems != null)) { // Zweite Tabelle enthält alle bewilligten Leistungskategorien + Zeiterfassung in Fachkraft + Assistenz unterteilt diff --git a/ReportImp/HshCologne/ServiceInvoiceReportFLS.cs b/ReportImp/HshCologne/ServiceInvoiceReportFLS.cs index f362d0a4e..739f468ce 100644 --- a/ReportImp/HshCologne/ServiceInvoiceReportFLS.cs +++ b/ReportImp/HshCologne/ServiceInvoiceReportFLS.cs @@ -65,7 +65,12 @@ namespace HshCologne ii.UnitCountString = ""; if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower().Contains("erftstadt")) { + ii.UnitCountString = String.Format("{0:HH:mm}-{1:HH:mm}", ii.ServiceRecord.Start.Value, ii.ServiceRecord.End.Value); + if (ii.UnitCountString.StartsWith("00:00")) + { + ii.UnitCountString = ""; + } } if (ii.ServiceRecord != null) {