MalteserJohanniterJohanneshaus/Datev/DatevExporter.cs - Bugfix für besW bei Suche richtiges C2S

This commit is contained in:
2024-12-18 16:12:18 +01:00
parent 14f1423f19
commit 5f4c351fe9

View File

@@ -116,19 +116,19 @@ c2s.Notice AS 'Kostenstelle'
sb.Append(";");
String buchungstext = "";
long? c2sOid = (long?)row[5];
if (c2sOid.HasValue)
if (row[5].ToString().IsNotNullOrEmpty())
{
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(c2sOid.Value);
var c = c2s.SupportConcept.Customer;
buchungstext = String.Format("{0}, {1} - {2:yyyy}/{2:MM}", c.Person.LastName, c.Person.FirstName, lastDate);
buchungstext = String.Format("{0} - {1:yyyy}/{1:MM}", row[5], lastDate);
}
sb.Append(buchungstext);
sb.Append(";");
string costcenter;
costcenter = String.Format("{0}", row[7]); // CB2SC Notice
costcenter.Trim();
string costcenter = "";
if (row[7].ToString().IsNotNullOrEmpty())
{
costcenter = String.Format("{0}", row[7]); // CB2SC Notice
costcenter.Trim();
}
sb.Append(costcenter);
sb.Append(";S;0;EUR");
}
@@ -224,17 +224,17 @@ order by ib.invoicenumber
ib.InvoiceDate,
ib.invoicenumber,
c.CostCenter,
c2s.Oid,
CONCAT(p.LastName, ', ', p.FirstName),
ib.InvoiceId,
c2s.Notice AS Kostenstelle
FROM
invoicebase ib
JOIN serviceinvoice si ON si.invoicebaseoid = ib.oid
JOIN serviceinvoiceperiod sip ON sip.serviceinvoiceoid = si.oid
JOIN invoiceitem ii ON ii.serviceinvoiceperiodoid = sip.oid
LEFT JOIN serviceinvoiceperiod sip ON sip.serviceinvoiceoid = si.oid
LEFT JOIN supportconceptapprovalperiod scap ON scap.Oid = sip.SupportConceptApprovalPeriodOid
LEFT JOIN costbearer2supportconcept c2s ON c2s.Oid = scap.costbearer2supportconceptoid
JOIN customer c ON c.oid = sip.CustomerOid
join supportconcept sc on sc.customeroid = c.oid
inner join costbearer2supportconcept c2s on c2s.supportconceptoid = sc.oid
JOIN person p on p.oid = c.personoid
WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' AND ib.IsActive = 1
AND ib.RecipientOrganisation like '%besW%'
ORDER BY c.DebitorNumber