feat: flag adjusted tax in DATEV export
All checks were successful
Build and Push Docker Images / build-central-services-api (push) Successful in 35s
Build and Push Docker Images / build-docs (push) Successful in 34s
Build and Push Docker Images / build-central-services-admin (push) Successful in 34s
Build and Push Docker Images / build-backend (push) Successful in 59s
Build and Push Docker Images / build-website (push) Successful in 37s
Build and Push Docker Images / build-frontend (push) Successful in 1m58s

This commit is contained in:
2026-08-09 14:20:39 +02:00
parent ae4ff9aad0
commit 6473adca6c

View File

@@ -80,6 +80,20 @@ const formatDatevDate = (date: dayjs.ConfigType, format: string) => {
return parsed.isValid() ? parsed.tz(DATEV_TIMEZONE).format(format) : ""; return parsed.isValid() ? parsed.tz(DATEV_TIMEZONE).format(format) : "";
}; };
const getIncomingInvoiceTaxReview = (account: any) => {
const taxRate = account.taxType === "19" ? 19 : account.taxType === "7" ? 7 : null;
if (taxRate === null) return null;
const amountNet = Number(account.amountNet);
const amountTax = Number(account.amountTax);
if (!Number.isFinite(amountNet) || !Number.isFinite(amountTax)) return null;
const calculatedTax = Number((amountNet * (taxRate / 100)).toFixed(2));
if (Math.abs(amountTax - calculatedTax) < 0.005) return null;
return `USt pruefen ${displayCurrency(amountTax, true)}`;
};
const getCreatedDocumentRevenueLines = (document: any) => { const getCreatedDocumentRevenueLines = (document: any) => {
const totals = getCreatedDocumentTotal(document); const totals = getCreatedDocumentTotal(document);
@@ -369,7 +383,8 @@ export async function buildExportZip(
let amountGross =/* account.amountGross ? account.amountGross : */(account.amountNet || 0) + (account.amountTax || 0); let amountGross =/* account.amountGross ? account.amountGross : */(account.amountNet || 0) + (account.amountTax || 0);
let shSelector = Math.sign(amountGross) === -1 ? "H" : "S"; let shSelector = Math.sign(amountGross) === -1 ? "H" : "S";
let text = `ER ${ii.reference}: ${escapeString(ii.description)}`.substring(0,59); const taxReview = getIncomingInvoiceTaxReview(account);
let text = `${taxReview ? `${taxReview} - ` : ""}ER ${ii.reference}: ${escapeString(ii.description)}`.substring(0,59);
const vend = ii.vendor; // durch Mapping verfügbar const vend = ii.vendor; // durch Mapping verfügbar
bookingLines.push(`${Math.abs(amountGross).toFixed(2).replace(".",",")};"${shSelector}";;;;;${accountData.number};${vend?.vendorNumber || ""};"${buschluessel}";${formatDatevDate(ii.date, "DDMM")};"${ii.reference}";;;"${text}";;;;;;${file ? `"BEDI ""${file.id}"""` : ""};"Geschäftspartner";"${vend?.name || ""}";"Kundennummer";"${vend?.vendorNumber || ""}";"Belegnummer";"${ii.reference}";"Leistungsdatum";"${formatDatevDate(ii.date, "DD.MM.YYYY")}";"Belegdatum";"${formatDatevDate(ii.date, "DD.MM.YYYY")}";;;;;;;;;;"";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;;;;"";;;;;;;`); bookingLines.push(`${Math.abs(amountGross).toFixed(2).replace(".",",")};"${shSelector}";;;;;${accountData.number};${vend?.vendorNumber || ""};"${buschluessel}";${formatDatevDate(ii.date, "DDMM")};"${ii.reference}";;;"${text}";;;;;;${file ? `"BEDI ""${file.id}"""` : ""};"Geschäftspartner";"${vend?.name || ""}";"Kundennummer";"${vend?.vendorNumber || ""}";"Belegnummer";"${ii.reference}";"Leistungsdatum";"${formatDatevDate(ii.date, "DD.MM.YYYY")}";"Belegdatum";"${formatDatevDate(ii.date, "DD.MM.YYYY")}";;;;;;;;;;"";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;;;;"";;;;;;;`);