feat(banking): add cost centres and VAT to account allocations

This commit is contained in:
2026-09-23 18:08:09 +02:00
parent 847a616285
commit cbec5b058d
21 changed files with 517 additions and 42 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import dayjs from "dayjs"
import { getBankAllocationAmounts, getBankAllocationTaxBreakdown } from "~/utils/bankAllocationTax"
import {
getCreatedDocumentTaxBreakdown,
getIncomingInvoiceTaxBreakdown
@@ -201,7 +202,7 @@ const expenseNetTotal = computed(() => {
const expenseGrossTotal = computed(() => {
const invoiceExpenses = filteredIncomingInvoices.value.reduce((sum, invoice) => sum + getIncomingInvoiceImmediateExpenseGross(invoice), 0)
const directAccountExpenses = getStatementAccountExpenseTotal(filteredStatementAllocations.value)
const directAccountExpenses = getStatementAccountExpenseTotal(filteredStatementAllocations.value, true)
const depreciations = depreciationTotal.value
@@ -231,6 +232,13 @@ const taxSummary = computed(() => {
}
}, { net19: 0, tax19: 0, net7: 0, tax7: 0, net0: 0 })
filteredStatementAllocations.value.forEach((allocation) => {
const breakdown = getBankAllocationTaxBreakdown(allocation)
for (const key of ["net19", "tax19", "net7", "tax7", "net0"] as const) {
output[key] += breakdown.output[key]
input[key] += breakdown.input[key]
}
})
const outputTax = Number((output.tax19 + output.tax7).toFixed(2))
const inputTax = Number((input.tax19 + input.tax7).toFixed(2))
@@ -303,13 +311,9 @@ const accountRows = computed(() => {
const debitBookings = filteredStatementAllocations.value
.filter((allocation) => sameId(allocation.account?.id || allocation.account, account.id))
.map((allocation) => {
const amount = Number(allocation.amount || 0)
return {
type: "statementallocation",
amountNet: amount,
amountTax: 0,
amountGross: amount
...getBankAllocationAmounts(allocation)
}
})