Compare commits

...

2 Commits

Author SHA1 Message Date
6473adca6c 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
2026-08-09 14:20:39 +02:00
ae4ff9aad0 feat: allow manual input tax adjustments 2026-08-09 14:17:31 +02:00
2 changed files with 53 additions and 3 deletions

View File

@@ -80,6 +80,20 @@ const formatDatevDate = (date: dayjs.ConfigType, format: string) => {
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 totals = getCreatedDocumentTotal(document);
@@ -369,7 +383,8 @@ export async function buildExportZip(
let amountGross =/* account.amountGross ? account.amountGross : */(account.amountNet || 0) + (account.amountTax || 0);
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
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;;;;"";;;;;;;`);

View File

@@ -194,6 +194,16 @@ const totalCalculated = computed(() => {
const hasAmount = (value) => value !== null && value !== undefined && value !== ""
const hasValidNumber = (value) => hasAmount(value) && Number.isFinite(Number(value))
const isDepreciationItem = (item) => isDepreciationBookingMode(item?.bookingMode)
const getCalculatedTax = (item) => {
const taxRate = Number(taxOptions.value.find((tax) => tax.key === item.taxType)?.percentage || 0)
return Number((Number(item.amountNet || 0) * (taxRate / 100)).toFixed(2))
}
const hasManualTaxDifference = (item) => {
if (!hasValidNumber(item.amountTax) || !hasValidNumber(item.amountNet)) return false
return Math.abs(Number(item.amountTax) - getCalculatedTax(item)) >= 0.005
}
const updateBookingMode = (item) => {
ensureDepreciationDefaults(item, itemInfo.value.date)
@@ -216,6 +226,14 @@ const recalculateItem = (item, source) => {
calculateFromNet()
} else if (source === 'gross') {
calculateFromGross()
} else if (source === 'tax') {
if(!hasValidNumber(item.amountTax)) return
if((useNetMode.value || !hasAmount(item.amountGross)) && hasAmount(item.amountNet)) {
item.amountGross = Number((Number(item.amountNet) + Number(item.amountTax)).toFixed(2))
} else if(hasAmount(item.amountGross)) {
item.amountNet = Number((Number(item.amountGross) - Number(item.amountTax)).toFixed(2))
}
} else if (source === 'taxType' || source === 'manual') {
if(hasAmount(item.amountNet)) calculateFromNet()
else if(hasAmount(item.amountGross)) calculateFromGross()
@@ -871,13 +889,30 @@ const hasBlockingIncomingInvoiceErrors = computed(() => blockingIncomingInvoiceE
</div>
<div class="col-span-6 md:col-span-3">
<UFormField label="Steuerbetrag" help="Automatisch berechnet">
<UInput class="w-full" :model-value="item.amountTax" disabled color="gray" >
<UFormField label="Steuerbetrag" help="Kann bei Rundungsabweichungen angepasst werden">
<UInput
class="w-full"
type="number"
step="0.01"
:model-value="item.amountTax"
:disabled="mode === 'show'"
@update:model-value="(val) => { item.amountTax = Number(val); recalculateItem(item, 'tax') }"
>
<template #trailing>€</template>
</UInput>
</UFormField>
</div>
<div v-if="hasManualTaxDifference(item)" class="col-span-12">
<UAlert
color="warning"
variant="soft"
icon="i-heroicons-exclamation-triangle"
title="Steuerbetrag manuell angepasst"
description="FEDEO verwendet diesen Betrag für Auswertungen und Summen. Im DATEV-Export wird bei der Automatikbuchung nur der Bruttobetrag mit Steuerschlüssel übertragen; DATEV berechnet die Steuer dort erneut."
/>
</div>
<div class="col-span-12 flex justify-end gap-2">
<UButton
size="xs"