From ded1db9c0f542cc2787a0b145601a929c82e5ffd Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 12 May 2026 16:02:36 +0200 Subject: [PATCH] =?UTF-8?q?Eintr=C3=A4ge=20ohne=20Monatsunterschrift=20des?= =?UTF-8?q?=20Klienten=20-=20auch=20mehrere=20MA=20-=20Bugfix=20bei=20Grup?= =?UTF-8?q?penbuchungen=20mit=20mehreren=20MAs=20SupportOID=3D162631?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rschrift des Klienten - auch mehrere MA.txt | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Queries/Einträge ohne Monatsunterschrift des Klienten - auch mehrere MA.txt diff --git a/Queries/Einträge ohne Monatsunterschrift des Klienten - auch mehrere MA.txt b/Queries/Einträge ohne Monatsunterschrift des Klienten - auch mehrere MA.txt new file mode 100644 index 000000000..562d3f13b --- /dev/null +++ b/Queries/Einträge ohne Monatsunterschrift des Klienten - auch mehrere MA.txt @@ -0,0 +1,91 @@ +SELECT +p.LastName as 'Nachname', +p.Firstname as 'Vorname', +c2s.ApprovedStartDate as 'Bewilligt von', +c2s.ApprovedEndDate as 'Bewilligt bis', +scat.Name as 'Kategorie', +Date_Format(sr.StartDate, '%d.%m.%Y') as 'Datum', +IF (Date_Format(sr.StartDate, '%s') <> '00', '', Date_Format(sr.StartDate, '%H:%i')) as 'von', +IF (Date_Format(sr.StartDate, '%s') <> '00', '', Date_Format(Date_Add(sr.StartDate, INTERVAL sr.Roundedduration MINUTE), '%H:%i')) as 'bis', +Round(sr.Roundedduration, 0) as 'Minuten', +sr.InsUser as 'Angelegt von', +DATE_FORMAT(sr.InsTs, '%d.%m.%Y %H:%i') as 'Angelegt am', +(select CONCAT(emp1p.`FirstName`, ' ', emp1p.`LastName`) from employee emp1 join `person` emp1p on emp1p.`Oid` = emp1.`PersonOid` where emp1.`Oid` in (select employeeoid from `employee2customer` e2c1 join `valuelistentry2object` vl2o on e2c1.`Oid` = vl2o.`ObjectOid` join `valuelistentry` vle on vl2o.`ValueListEntryOid` = vle.`Oid` where e2c1.`CustomerOid` = c.`Oid` and vle.`SystemEntryID` = 3) LIMIT 1) as 'Hauptbetreuung', +(select t.`Name` from team t where t.`Oid` in (select teamoid from `team2customer` t2c where t2c.`CustomerOid` = c.`Oid`) LIMIT 1) as 'Team' +FROM servicerecord sr +join costbearer2supportconcept c2s on sr.costbearer2supportconceptoid = c2s.oid +join supportconcept sc on c2s.supportconceptoid = sc.oid +join customer c on sc.customeroid = c.oid +join person p on c.personoid = p.oid +join servicedescription sd on sd.oid = sr.servicedescriptionoid +join servicecategory scat on scat.oid = sd.servicecategoryoid +LEFT JOIN ( + -- direkt unterschriebene SRs + SELECT crs2s.servicerecordoid as signed_oid + FROM confirmationreceiptsignature2servicerecord crs2s + JOIN confirmationreceiptsignature crs ON crs2s.confirmationreceiptsignatureoid = crs.oid + WHERE crs.employeeoid IS NULL AND crs.customeroid IS NOT NULL + UNION + -- SRs, deren Gruppen-Partner unterschrieben ist + SELECT sr_other.oid as signed_oid + FROM servicerecord sr_other + JOIN servicerecord sr_signed ON sr_signed.GroupOid = sr_other.GroupOid + AND sr_other.GroupOid IS NOT NULL + JOIN confirmationreceiptsignature2servicerecord crs2s ON sr_signed.oid = crs2s.servicerecordoid + JOIN confirmationreceiptsignature crs ON crs2s.confirmationreceiptsignatureoid = crs.oid + WHERE crs.employeeoid IS NULL AND crs.customeroid IS NOT NULL +) signed_records ON signed_records.signed_oid = sr.oid +WHERE signed_records.signed_oid IS NULL +AND scat.billable = true +AND sr.startdate >= ':Von' AND sr.startdate < ':bis' +ORDER BY p.Lastname, sr.startdate + + + + +INSERT INTO `query` (`Oid`,`Tid`,`Type`,`Title`,`SQL`,`Notice`,`InsTs`,`InsUser`,`UdpUser`,`Version`,`IsActive`,`SystemEntryID`,`UserGroupOids`,`ReportTypeName`,`FileName`,`ExportTitle`) VALUES (4712,24,0,'Einträge ohne Monatsunterschrift des Klienten','SELECT +p.LastName as 'Nachname', +p.Firstname as 'Vorname', +c2s.ApprovedStartDate as 'Bewilligt von', +c2s.ApprovedEndDate as 'Bewilligt bis', +scat.Name as 'Kategorie', +Date_Format(sr.StartDate, '%d.%m.%Y') as 'Datum', +IF (Date_Format(sr.StartDate, '%s') <> '00', '', Date_Format(sr.StartDate, '%H:%i')) as 'von', +IF (Date_Format(sr.StartDate, '%s') <> '00', '', Date_Format(Date_Add(sr.StartDate, INTERVAL sr.Roundedduration MINUTE), '%H:%i')) as 'bis', +Round(sr.Roundedduration, 0) as 'Minuten', +sr.InsUser as 'Angelegt von', +DATE_FORMAT(sr.InsTs, '%d.%m.%Y %H:%i') as 'Angelegt am', +(select CONCAT(emp1p.`FirstName`, ' ', emp1p.`LastName`) from employee emp1 join `person` emp1p on emp1p.`Oid` = emp1.`PersonOid` where emp1.`Oid` in (select employeeoid from `employee2customer` e2c1 join `valuelistentry2object` vl2o on e2c1.`Oid` = vl2o.`ObjectOid` join `valuelistentry` vle on vl2o.`ValueListEntryOid` = vle.`Oid` where e2c1.`CustomerOid` = c.`Oid` and vle.`SystemEntryID` = 3) LIMIT 1) as 'Hauptbetreuung', +(select t.`Name` from team t where t.`Oid` in (select teamoid from `team2customer` t2c where t2c.`CustomerOid` = c.`Oid`) LIMIT 1) as 'Team' +FROM servicerecord sr +join costbearer2supportconcept c2s on sr.costbearer2supportconceptoid = c2s.oid +join supportconcept sc on c2s.supportconceptoid = sc.oid +join customer c on sc.customeroid = c.oid +join person p on c.personoid = p.oid +join servicedescription sd on sd.oid = sr.servicedescriptionoid +join servicecategory scat on scat.oid = sd.servicecategoryoid +LEFT JOIN ( + -- direkt unterschriebene SRs + SELECT crs2s.servicerecordoid as signed_oid + FROM confirmationreceiptsignature2servicerecord crs2s + JOIN confirmationreceiptsignature crs ON crs2s.confirmationreceiptsignatureoid = crs.oid + WHERE crs.employeeoid IS NULL AND crs.customeroid IS NOT NULL + UNION + -- SRs, deren Gruppen-Partner unterschrieben ist + SELECT sr_other.oid as signed_oid + FROM servicerecord sr_other + JOIN servicerecord sr_signed ON sr_signed.GroupOid = sr_other.GroupOid + AND sr_other.GroupOid IS NOT NULL + JOIN confirmationreceiptsignature2servicerecord crs2s ON sr_signed.oid = crs2s.servicerecordoid + JOIN confirmationreceiptsignature crs ON crs2s.confirmationreceiptsignatureoid = crs.oid + WHERE crs.employeeoid IS NULL AND crs.customeroid IS NOT NULL +) signed_records ON signed_records.signed_oid = sr.oid +WHERE signed_records.signed_oid IS NULL +AND scat.billable = true +AND sr.startdate >= ':Von' AND sr.startdate < ':bis' +ORDER BY p.Lastname, sr.startdate',NULL,NULL,NULL,NULL,1,1,NULL,'1',NULL,NULL,NULL); +INSERT INTO `parameter` (`QueryOid`,`Tid`,`Name`,`Type`,`DbType`,`InsTs`,`InsUser`,`UdpUser`,`Version`,`IsActive`,`SystemEntryID`,`DefaultValue`) VALUES (4712,25,'Von_bis',5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'aktueller Monat'); + + + +