From 60e2f8e5c7965cf1573f7858081744db6e664605 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 18 Sep 2023 17:50:16 +0200 Subject: [PATCH] Akgg SBD --- Report/AbstractReportCreator.cs | 2 + Report/DefaultReportCreator.cs | 39 +++++++++++++++ Report/ReportObjects/SettlementRO.cs | 16 +++++-- ...CustomMitarbeiterstundenkontoBerechnung.cs | 27 ++++++----- ReportImp/AkggMid/CustomReportCreator.cs | 2 +- ReportImp/AkggMid/LeistungsnachweisHelper.cs | 18 +++++-- .../AkggMid/LeistungsnachweisJugendamt.cs | 2 +- ...LeistungsnachweisSozialamtMitBlutzucker.cs | 2 +- ...ungsnachweisSozialamtMitBlutzuckerPumpe.cs | 2 +- .../CustomGroupDurationCalculator.cs | 48 +++++++------------ .../ReportServiceImp.cs | 5 +- Service/Plugins/PluginLoader.cs | 2 +- 12 files changed, 108 insertions(+), 57 deletions(-) diff --git a/Report/AbstractReportCreator.cs b/Report/AbstractReportCreator.cs index f6f50cae5..19193cfc7 100644 --- a/Report/AbstractReportCreator.cs +++ b/Report/AbstractReportCreator.cs @@ -105,6 +105,8 @@ namespace BeWo.Report public abstract XtraReport CreateValidationMessageListReport(DateTime startDate, DateTime endDate); + public abstract XtraReport CreateInvoiceListReport(List oids); + public abstract XtraReport CreateCustomerListReport(List oids); } } \ No newline at end of file diff --git a/Report/DefaultReportCreator.cs b/Report/DefaultReportCreator.cs index 9435453ab..fbdb8992c 100644 --- a/Report/DefaultReportCreator.cs +++ b/Report/DefaultReportCreator.cs @@ -1196,6 +1196,45 @@ namespace BeWo.Report return report as XtraReport; } + public override XtraReport CreateInvoiceListReport(List oids) + { + XtraReport master = null; + + var ibList = DAOFactory.GenericDAO.LoadByIDs(oids); + + foreach (var ib in ibList) + { + XtraReport report = null; + if (ib.Type == InvoiceType.Service) + { + report = CreateServiceInvoiceReport(null, ib.Oid); + } + else if (ib.Type == InvoiceType.Settlement) + { + report = CreateSettlementReport(null, ib.Oid); + } + else + { + report = CreateCustomerInvoiceReport(ib.Oid.Value); + } + if (report != null) + { + report.CreateDocument(); + if (master == null) + { + master = report; + } + else + { + master.Pages.AddRange(report.Pages); + } + + } + } + return master; + } + + public override XtraReport CreateCustomerListReport(List oids) { var ro = CustomerListRO.Create(oids); diff --git a/Report/ReportObjects/SettlementRO.cs b/Report/ReportObjects/SettlementRO.cs index d867346cc..0e0ae886f 100644 --- a/Report/ReportObjects/SettlementRO.cs +++ b/Report/ReportObjects/SettlementRO.cs @@ -359,12 +359,22 @@ namespace BeWo.Report.ReportObjects lResult.FehlkontakteString = fehlkontaktString; lResult.Fehlkontakte = fkDCs; } - - #endregion - String tenant = SessionFacade.Tenant; + #endregion + + String tenant = ""; + + if (MultitenancyOperationContextExt.Current != null && + !String.IsNullOrEmpty(MultitenancyOperationContextExt.Current.Tenant)) + { + tenant = MultitenancyOperationContextExt.Current.Tenant; + } + else + { + tenant = SessionFacade.Tenant; + } var creator = SettlementInvoiceCreation.GetInstance(lCb2Sc.CostBearer.ID, tenant); diff --git a/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs b/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs index c45707ea5..f223271f4 100644 --- a/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs +++ b/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs @@ -14,8 +14,8 @@ namespace AkggMid public class CustomMitarbeiterstundenkontoBerechnung : MitarbeiterstundenkontoBerechnung { private CustomVacationService customVacationService = new CustomVacationService(); - bool istSchulassi = false; - bool angemeldeterUserDarfAllesSehen = true; // Schulassistenzen dürfen den Stand Ende August nicht sehen + + bool angemeldeterUserDarfAllesSehen = false; // Schulassistenzen dürfen den Stand Ende August nicht sehen public override List GetFeiertage(int year) { @@ -29,10 +29,16 @@ namespace AkggMid public override void CreateEmployeeDetails(MitarbeiterstundenkontoRO ro) { - base.CreateEmployeeDetails(ro); + if (BeWo.Data.Security.UserRightHelper.LoggedInUserHasRight(BS.Shared.UserRightType.Mitarbeiterstundenkonto_ViewAll)) + { + angemeldeterUserDarfAllesSehen = true; + } + + + base.CreateEmployeeDetails(ro); foreach (var ep in ro.EmployeeDetailList) { - if (istSchulassi && ro.ReportStartDate < new DateTime(2023, 9, 1)) + if (!angemeldeterUserDarfAllesSehen && ro.ReportStartDate < new DateTime(2023, 9, 1)) { ep.StundenSollMax = 0; ep.StundenSollOhneUrlaubKrankheit = 0; @@ -53,8 +59,7 @@ namespace AkggMid protected override void StarteBerechnung(DateTime berichtsAnfang, DateTime berichtsEnde, MitarbeiterstundenkontoRO.EmployeeDetail empDetail) { BerechneFerienTage = false; - istSchulassi = false; - + var c = empDetail.Employee.GetValidContractForDate(berichtsAnfang); //if (c != null && c.EmploymentType != null && berichtsAnfang < new DateTime(2023, 9, 4)) if (c != null && c.EmploymentType != null) @@ -65,13 +70,10 @@ namespace AkggMid // } if (c.EmploymentType.Name == "Schulassistenz") { - istSchulassi = true; + empDetail.Custom10 = 1; BerechneFerienTage = true; - if (BeWo.Data.Security.UserRightHelper.LoggedInUserHasRight(BS.Shared.UserRightType.Mitarbeiterstundenkonto_ViewAll)) - { - istSchulassi = false; - } + } } @@ -139,7 +141,7 @@ namespace AkggMid // stichTag = new DateTime(2020, 1, 1); // } - if (monat >= stichTag) + if (monat >= stichTag && edOrig.Custom10 == 1) { decimal? ueberstundenBisStichtag = 0; decimal ueberstundenExtraBisStichtag = 0; @@ -153,6 +155,7 @@ namespace AkggMid return ed; } + return base.BerechneUeberstundenBis(edOrig, records, monat, out ueberstunden, out alteExtraUeberstunden); // var ed = base.BerechneUeberstundenBis(edOrig, records, monat, out ueberstunden, out alteExtraUeberstunden); //if (istSchulassi && monat < stichTag) diff --git a/ReportImp/AkggMid/CustomReportCreator.cs b/ReportImp/AkggMid/CustomReportCreator.cs index ae3d8b218..d43757ba9 100644 --- a/ReportImp/AkggMid/CustomReportCreator.cs +++ b/ReportImp/AkggMid/CustomReportCreator.cs @@ -134,7 +134,7 @@ namespace AkggMid } } - if (ro.Costbearer == "SEK -Jugend und Familie-") + if (!String.IsNullOrEmpty(ro.Costbearer) && ro.Costbearer.StartsWith("SEK -Jugend und Familie-") && ro.StartDate < new DateTime(2023, 9, 1)) { return new LeistungsnachweisJugendamt(); } diff --git a/ReportImp/AkggMid/LeistungsnachweisHelper.cs b/ReportImp/AkggMid/LeistungsnachweisHelper.cs index d83531c95..dbcc6495f 100644 --- a/ReportImp/AkggMid/LeistungsnachweisHelper.cs +++ b/ReportImp/AkggMid/LeistungsnachweisHelper.cs @@ -118,7 +118,7 @@ namespace AkggMid } } - var abrAbwTagDict = GetAbrechenbareAbwesenheiten(); + var abrAbwTagDict = GetAbrechenbareAbwesenheiten(pRO); double wochensumme = 0; for (int i = 1; i <= pRO.EndDate.Day; i++) @@ -383,7 +383,7 @@ where scap2e.EmployeeOid = {0} and scap.Start <= '{1:yyyy-MM-dd}' and scap.EndDa } - public Dictionary GetAbrechenbareAbwesenheiten() + public Dictionary GetAbrechenbareAbwesenheiten(ServicesOverviewRO ro) { //Herr Kloss meint, der erste Tag einer Abwesenheit darf ein fünftel der Wochenstundenzahl abgerechnet werden, //aber nur bis 5 mal im Zeitraum 01.01.2023 bis 21.07.2023 // PLUS zusätzlich ein 6. Tag ABER nur im Juli 2023, nicht träglich @@ -392,6 +392,18 @@ where scap2e.EmployeeOid = {0} and scap.Start <= '{1:yyyy-MM-dd}' and scap.EndDa DateTime startSchuljahr = DateTime.MinValue; DateTime endeSchuljahr = DateTime.MinValue; + Dictionary serviceRecordDates = new Dictionary(); + + if (ro.Services != null) + { + foreach (var s in ro.Services) + { + if (s.ServiceRecordOid > 0 && !serviceRecordDates.ContainsKey(String.Format("{0:dd.MM.yyyy}", s.StartDate))) + { + serviceRecordDates.Add(String.Format("{0:dd.MM.yyyy}", s.StartDate), true); + } + } + } DateTime dt; if (DateTime.TryParse(servicesOverviewRO.ApprovedStartDate, out dt)) @@ -435,7 +447,7 @@ where scap2e.EmployeeOid = {0} and scap.Start <= '{1:yyyy-MM-dd}' and scap.EndDa while (dtIterator <= end && (gesamtAnzahl < maxAnzahl || (end > new DateTime(2023, 06, 30) && end <= new DateTime(2023, 07, 21) && gesamtAnzahl < maxAnzahl + 1))) { - if (dtIterator.DayOfWeek != DayOfWeek.Saturday && dtIterator.DayOfWeek != DayOfWeek.Sunday) + if (dtIterator.DayOfWeek != DayOfWeek.Saturday && dtIterator.DayOfWeek != DayOfWeek.Sunday && !serviceRecordDates.ContainsKey(String.Format("{0:dd.MM.yyyy}", dtIterator))) { bool istAbrechenbar = true; if (tandemBetreuungHelper != null) diff --git a/ReportImp/AkggMid/LeistungsnachweisJugendamt.cs b/ReportImp/AkggMid/LeistungsnachweisJugendamt.cs index 8d36a97a1..4527ae6a6 100644 --- a/ReportImp/AkggMid/LeistungsnachweisJugendamt.cs +++ b/ReportImp/AkggMid/LeistungsnachweisJugendamt.cs @@ -37,7 +37,7 @@ namespace AkggMid //LeistungsnachweisHelper.PruefeWochenBudget(pRO); - var abrAbwTagDict = helper.GetAbrechenbareAbwesenheiten(); + var abrAbwTagDict = helper.GetAbrechenbareAbwesenheiten(pRO); double summe1bis16 = 0; double summeGesamt = 0; diff --git a/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzucker.cs b/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzucker.cs index 9e3cbbb52..9a25436e2 100644 --- a/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzucker.cs +++ b/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzucker.cs @@ -46,7 +46,7 @@ namespace AkggMid ServicesOverviewRO.CreateSignatureString(record); } - helper.PruefeWochenBudget(pRO); + //helper.PruefeWochenBudget(pRO); lblWegbegleitung.Text = String.Format("Kostenzusicherung: bis zu {0:0.00} Stunden pro Woche", pRO.ApprovedFLSPerWeek); if (pRO.CustomerOid > 0) diff --git a/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzuckerPumpe.cs b/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzuckerPumpe.cs index 954d3b546..93fb9fa34 100644 --- a/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzuckerPumpe.cs +++ b/ReportImp/AkggMid/LeistungsnachweisSozialamtMitBlutzuckerPumpe.cs @@ -46,7 +46,7 @@ namespace AkggMid ServicesOverviewRO.CreateSignatureString(record); } - helper.PruefeWochenBudget(pRO); + //helper.PruefeWochenBudget(pRO); lblWegbegleitung.Text = String.Format("Kostenzusicherung: bis zu {0:0.00} Stunden pro Woche", pRO.ApprovedFLSPerWeek); if (pRO.CustomerOid > 0) diff --git a/ReportImp/BeWoDarmstadt/Calculations/CustomGroupDurationCalculator.cs b/ReportImp/BeWoDarmstadt/Calculations/CustomGroupDurationCalculator.cs index 26d85eb49..5a064cd8c 100644 --- a/ReportImp/BeWoDarmstadt/Calculations/CustomGroupDurationCalculator.cs +++ b/ReportImp/BeWoDarmstadt/Calculations/CustomGroupDurationCalculator.cs @@ -18,16 +18,18 @@ namespace BeWoDarmstadt.Calculation var hatGruppenLeistung = group.ServiceRecordList.Any(s => GetMaxDuration(s.ServiceDescription.Name).HasValue); if (hatGruppenLeistung) { + foreach (var sr in group.ServiceRecordList) { - var duration = (decimal)sr.End.Value.Subtract(sr.Start.Value).TotalMinutes; + + var duration = (decimal)sr.End.Value.Subtract(sr.Start.Value).TotalMinutes / (sr.GroupPersonCount ?? 1); var max = GetMaxDuration(sr.ServiceDescription.Name); if (max.HasValue && max < duration) { duration = max.Value; } - sr.RoundedDuration = max.Value; + sr.RoundedDuration = duration; } @@ -65,38 +67,20 @@ namespace BeWoDarmstadt.Calculation return null; } + + public override GroupDurationDC CalculateGroupDuration(int personCount, int employeeCount, decimal totalDuration) { - return base.CalculateGroupDuration(personCount, employeeCount, totalDuration); + if (personCount > 1) + { + return new GroupDurationDC() + { + SingleDuration = totalDuration / personCount, + TotalDuration = totalDuration + }; + + } + return null; } - - public override GroupDurationDC CalculateGroupDuration(int personCount, int employeeCount, decimal totalDuration, long[] costBearer2SupportConceptArray) - { - return base.CalculateGroupDuration(personCount, employeeCount, totalDuration, costBearer2SupportConceptArray); - } - //public override GroupDurationDC CalculateGroupDuration(int personCount, int employeeCount, decimal totalDuration) - //{ - // if (personCount > 2) - // { - // var SingleDurationAll = ((totalDuration * employeeCount) / personCount); - // if (SingleDurationAll > 20) - // { - // return new GroupDurationDC() - // { - // SingleDuration = 20, - // TotalDuration = totalDuration - // }; - // } - // else - // { - // return new GroupDurationDC() - // { - // SingleDuration = ((totalDuration * employeeCount) / personCount), - // TotalDuration = totalDuration - // }; - // } - // } - // return null; - //} } } diff --git a/ReportService/ServiceImplementations/ReportServiceImp.cs b/ReportService/ServiceImplementations/ReportServiceImp.cs index aeb193d00..6f7ee7302 100644 --- a/ReportService/ServiceImplementations/ReportServiceImp.cs +++ b/ReportService/ServiceImplementations/ReportServiceImp.cs @@ -334,8 +334,9 @@ namespace ReportingService.ServiceImplementations public MemoryStream CreateInvoiceListReport(List invoiceBaseOids) { - return null; - } + var reportCreator = GetReportCreator(); + return CreateReportStream(reportCreator.CreateInvoiceListReport(invoiceBaseOids)); + } public MemoryStream CreateCustomerListReport(List oids) { diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index 5928f196c..d4d868d51 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -299,7 +299,7 @@ namespace BeWo.Service.Plugins //t = "8251343124"; // Rat Plus Tat //t = "6819347851"; // Awo Kreisverband Plön //t = "2385915144"; // AKGG GmbHd - //t = "8002913382"; // AKGG GmbH (MID) + t = "8002913382"; // AKGG GmbH (MID) //t = "5155880294"; // BHV Bergische Hauspflege //t = "8366649557"; // Münchner Aids-Hilfe e.V. //t = "2976949196"; // WHB Refrath gGmbH