SKFLeverkusen/Export/DatevExporter.cs - Rechnungen raus, Fehlkontakte u alle Kostenträger rein
SupportOID=169285
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user