fix(accounting): Kostenstellen-Auswertung wertet Einnahmen positiv und Ausgaben negativ
Some checks failed
Build and Release FEDEO / verify (push) Failing after 1m9s
Build and Release FEDEO / build-and-release (push) Has been skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 12:47:34 +01:00
parent f0775ad52a
commit ea31a15eac

View File

@@ -119,10 +119,13 @@ const reportRows = computed(() => {
relevantCostCentreIds.value.has(account.costCentre)
)
// Expenses reduce the cost centre result; incoming documents marked as income increase it.
const sign = invoice.expense === false ? 1 : -1
return matchingAccounts.map((account, index) => {
const amountNet = Number(account.amountNet || 0)
const amountTax = Number(account.amountTax || 0)
const amountGross = Number(account.amountGross || amountNet + amountTax || 0)
const amountNet = Number(account.amountNet || 0) * sign
const amountTax = Number(account.amountTax || 0) * sign
const amountGross = Number(account.amountGross || Number(account.amountNet || 0) + Number(account.amountTax || 0) || 0) * sign
const accountCostCentre = costCentreMap.value.get(getCostCentreId(account.costCentre))
return {
@@ -196,8 +199,7 @@ const reportRows = computed(() => {
const centre = costCentreMap.value.get(getCostCentreId(allocation.costcentre))
const account = accounts.value.find(account => account.id === (allocation.account?.id || allocation.account)) || allocation.ownaccount
const amounts = getBankAllocationAmounts(allocation)
// As for incoming documents, expenses are positive and refunds negative.
const sign = amounts.kind === "input" || (amounts.kind === "none" && amounts.amountGross < 0) ? -1 : 1
// The bank amount is already signed: outflows (expenses) negative, inflows positive.
return [{
id: `bank-${allocation.id}`,
sourceLabel: "Bankbuchung",
@@ -209,9 +211,9 @@ const reportRows = computed(() => {
accountLabel: `${account?.number || ""} ${account?.label || account?.name || ""}`.trim() || "-",
costCentreName: centre ? `${centre.number} - ${centre.name}` : "-",
description: allocation.description || statement.text || "-",
amountNet: amounts.amountNet * sign,
amountTax: amounts.amountTax * sign,
amountGross: amounts.amountGross * sign,
amountNet: amounts.amountNet,
amountTax: amounts.amountTax,
amountGross: amounts.amountGross,
}]
})
return [...incomingRows, ...outgoingRows, ...bankRows]