From fdd097f440628cb0d7b692c3e0604afddf993bf4 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Wed, 29 Jul 2026 17:33:07 +0200 Subject: [PATCH] =?UTF-8?q?SKFLeverkusen/Export/DatevExporter.cs=20-=20Rec?= =?UTF-8?q?hnungen=20raus,=20Fehlkontakte=20u=20alle=20Kostentr=C3=A4ger?= =?UTF-8?q?=20rein=20SupportOID=3D169285?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SKFLeverkusen/Export/DatevExporter.cs | 64 +++++++++++++------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/ReportImp/SKFLeverkusen/Export/DatevExporter.cs b/ReportImp/SKFLeverkusen/Export/DatevExporter.cs index 334c9c764..2a70c1fdc 100644 --- a/ReportImp/SKFLeverkusen/Export/DatevExporter.cs +++ b/ReportImp/SKFLeverkusen/Export/DatevExporter.cs @@ -39,15 +39,15 @@ namespace SKFLeverkusen.Export { sb.Append(s); } + // AB, 29.07.2026: Frau Geroneit-Jepp will nur die Abgrenzung über die gesamte Zeiterfassung exportiert haben, die rechnen nach wie vor noch gar nicht mit dem BeWoPlaner ab + //s = GetMonatlicheRechnungenString(date); + //if (!String.IsNullOrWhiteSpace(s)) + //{ + // if (sb.Length > 0) + // sb.AppendLine(); - s = GetMonatlicheRechnungenString(date); - if (!String.IsNullOrWhiteSpace(s)) - { - if (sb.Length > 0) - sb.AppendLine(); - - sb.Append(s); - } + // sb.Append(s); + //} return sb.ToString(); } @@ -185,32 +185,60 @@ order by ib.invoicenumber { String sql = @" SELECT +sum(qry.Betrag) AS 'Betrag', +qry.DebitorNumber, +qry.CostCenter, +qry.Verwendung, +qry.Oid +FROM +( +(SELECT IF(crpRateFactor.`CostRateValue` is null, ROUND((sr.`GeleisteteFLM` / 60) * (SELECT crp.`CostRateValue` FROM `costrateperiod` crp WHERE crp.`ObjectTid` = 22 AND crp.`CostRateType` = 0 AND crp.`ObjectOid` = cb2sc.`CostBearerOid` AND (crp.`EndDate` is null or crp.`EndDate` > ':Monat_Start') order by IF(crp.`EndDate` is null, MAKEDATE(9999,365),crp.`EndDate`) LIMIT 1 )), ROUND(ROUND((sr.`GeleisteteFLM` / 60), 2) * (SELECT crp.`CostRateValue` FROM `costrateperiod` crp WHERE crp.`ObjectTid` = 22 AND crp.`CostRateType` = 0 AND crp.`ObjectOid` = cb2sc.`CostBearerOid` AND (crp.`EndDate` is null or crp.`EndDate` > ':Monat_Start') order by IF(crp.`EndDate` is null, MAKEDATE(9999,365),crp.`EndDate`) LIMIT 1 ) * ((100 + crpRateFactor.`CostRateValue`)/100), 2)) AS 'Betrag', c.DebitorNumber, c.CostCenter, CONCAT(p.`LastName`, ', ', p.`FirstName`) as 'Verwendung', cb2sc.Oid -FROM `supportconcept` sc +FROM `supportconcept` sc INNER JOIN `costbearer2supportconcept` cb2sc ON sc.`Oid` = cb2sc.`SupportConceptOid` INNER JOIN `costbearer` cb ON cb2sc.`CostBearerOid` = cb.`Oid` -LEFT JOIN - (SELECT crp.`ObjectOid`, crp.`CostRateValue` FROM `costrateperiod` crp +LEFT JOIN + (SELECT crp.`ObjectOid`, crp.`CostRateValue` FROM `costrateperiod` crp WHERE crp.`ObjectTid` = 22 AND crp.`CostRateType` = 2 AND (crp.`EndDate` is null or crp.`EndDate` > NOW())) AS crpRateFactor ON crpRateFactor.`ObjectOid` = cb.`Oid` INNER JOIN `organisation` org ON org.`CostBearerOid` = cb.`Oid` INNER JOIN `customer` c ON sc.`CustomerOid` = c.`Oid` -INNER JOIN `person` p on c.`PersonOid` = p.`Oid` -LEFT JOIN +INNER JOIN `person` p on c.`PersonOid` = p.`Oid` +LEFT JOIN (SELECT sr2.`CostBearer2SupportConceptOid`, SUM(sr2.`roundedduration` / IF(sr2.`GroupEmployeeCount` is null, 1, sr2.`GroupEmployeeCount`)) AS GeleisteteFLM FROM `servicerecord` sr2 INNER JOIN `servicedescription` sd ON sr2.`ServiceDescriptionOid` = sd.`Oid` INNER JOIN `servicecategory` sc ON sd.`ServiceCategoryOid` = sc.`Oid` - WHERE sr2.`StartDate` >= ':Monat_Start' AND sr2.`StartDate` < ':Monat_End' AND sc.`Billable` = 1 GROUP BY sr2.`CostBearer2SupportConceptOid`) + WHERE sr2.`StartDate` >= ':Monat_Start' AND sr2.`StartDate` < ':Monat_End' AND sc.`Billable` = 1 AND sd.Name <> 'Fehlkontakt' GROUP BY sr2.`CostBearer2SupportConceptOid`) AS sr ON sr.`CostBearer2SupportConceptOid` = cb2sc.`Oid` -WHERE c.`IsActive` = 1 AND sc.`IsActive` = 1 -and (sr.`GeleisteteFLM` is not null) -and org.Name = 'LVR' -ORDER BY p.`LastName`, p.`FirstName`, cb2sc.`ApprovedStartDate` +WHERE c.`IsActive` = 1 AND sc.`IsActive` = 1 and (sr.`GeleisteteFLM` is not null)) +UNION +(SELECT +ROUND(0.8 * (sr.`GeleisteteFLM` / 60) * (SELECT crp.`CostRateValue` FROM `costrateperiod` crp WHERE crp.`ObjectTid` = 22 AND crp.`CostRateType` = 0 AND crp.`ObjectOid` = cb2sc.`CostBearerOid` AND (crp.`EndDate` is null or crp.`EndDate` > ':Monat_Start') order by IF(crp.`EndDate` is null, MAKEDATE(9999,365),crp.`EndDate`) LIMIT 1 ),2) AS 'Betrag', +c.DebitorNumber, +c.CostCenter, +CONCAT(p.`LastName`, ', ', p.`FirstName`) as 'Verwendung', +cb2sc.Oid +FROM `supportconcept` sc +INNER JOIN `costbearer2supportconcept` cb2sc ON sc.`Oid` = cb2sc.`SupportConceptOid` +INNER JOIN `costbearer` cb ON cb2sc.`CostBearerOid` = cb.`Oid` +INNER JOIN `organisation` org ON org.`CostBearerOid` = cb.`Oid` +INNER JOIN `customer` c ON sc.`CustomerOid` = c.`Oid` +INNER JOIN `person` p on c.`PersonOid` = p.`Oid` +LEFT JOIN + (SELECT sr2.`CostBearer2SupportConceptOid`, SUM(sr2.`roundedduration` / IF(sr2.`GroupEmployeeCount` is null, 1, sr2.`GroupEmployeeCount`)) AS GeleisteteFLM FROM `servicerecord` sr2 + INNER JOIN `servicedescription` sd ON sr2.`ServiceDescriptionOid` = sd.`Oid` + INNER JOIN `servicecategory` sc ON sd.`ServiceCategoryOid` = sc.`Oid` + WHERE sr2.`StartDate` >= ':Monat_Start' AND sr2.`StartDate` < ':Monat_End' AND sc.`Billable` = 1 and sd.Name = 'Fehlkontakt' GROUP BY sr2.`CostBearer2SupportConceptOid`) + AS sr ON sr.`CostBearer2SupportConceptOid` = cb2sc.`Oid` +WHERE c.`IsActive` = 1 AND sc.`IsActive` = 1 and (sr.`GeleisteteFLM` is not null)) +)qry +GROUP BY qry.Oid +ORDER BY qry.Verwendung "; return sql;