Added Abschreibungen

This commit is contained in:
2026-03-25 17:13:59 +01:00
parent f6c9875320
commit 42e0d7b35e
16 changed files with 13054 additions and 55 deletions

View File

@@ -136,6 +136,11 @@ const links = computed(() => {
to: "/incomingInvoices",
icon: "i-heroicons-document-text",
} : null,
(featureEnabled("incomingInvoices") || featureEnabled("banking")) ? {
label: "Abschreibungen",
to: "/accounting/depreciation",
icon: "i-heroicons-calendar-days",
} : null,
((featureEnabled("createDocument") || featureEnabled("incomingInvoices")) || featureEnabled("accounts") || featureEnabled("ownaccounts") || featureEnabled("costcentres")) ? {
label: "Auswertungen",
icon: "i-heroicons-chart-pie",

View File

@@ -4,16 +4,24 @@ import {
getCreatedDocumentTaxBreakdown,
getIncomingInvoiceTaxBreakdown
} from "~/composables/useTaxEvaluation"
import {
getIncomingInvoiceDepreciationRows,
getIncomingInvoiceImmediateExpenseNet,
getStatementAllocationDepreciationRow,
getStatementAllocationImmediateExpenseAmount
} from "~/composables/useDepreciation"
const loading = ref(true)
const summary = ref({
label: "",
income: 0,
expenses: 0,
depreciations: 0,
result: 0,
taxBalance: 0,
incomeCount: 0,
expenseCount: 0
expenseCount: 0,
depreciationCount: 0
})
const formatCurrency = (value: number) => {
@@ -91,13 +99,20 @@ const loadSummary = async () => {
}, 0)
const invoiceExpenses = inputDocs.reduce((sum: number, invoice: any) => {
return sum + (invoice.accounts || []).reduce((accountSum: number, account: any) => accountSum + Number(account.amountNet || 0), 0)
return sum + getIncomingInvoiceImmediateExpenseNet(invoice)
}, 0)
const directAccountExpenses = directExpenses.reduce((sum: number, allocation: any) => {
return sum + Math.abs(Number(allocation.amount || 0))
return sum + getStatementAllocationImmediateExpenseAmount(allocation)
}, 0)
const depreciationRows = [
...inputDocs.flatMap((invoice: any) => getIncomingInvoiceDepreciationRows(invoice, bounds.start, bounds.end)),
...(allocations || []).map((allocation: any) => getStatementAllocationDepreciationRow(allocation, bounds.start, bounds.end)).filter(Boolean)
]
const depreciations = depreciationRows.reduce((sum: number, row: any) => sum + Number(row.amount || 0), 0)
const outputTax = outputDocs.reduce((sum: number, doc: any) => {
const breakdown = getCreatedDocumentTaxBreakdown(doc)
return sum + breakdown.tax19 + breakdown.tax7
@@ -108,16 +123,18 @@ const loadSummary = async () => {
return sum + breakdown.tax19 + breakdown.tax7
}, 0)
const expenses = invoiceExpenses + directAccountExpenses
const expenses = invoiceExpenses + directAccountExpenses + depreciations
summary.value = {
label: dayjs().format("MMMM YYYY"),
income: Number(income.toFixed(2)),
expenses: Number(expenses.toFixed(2)),
depreciations: Number(depreciations.toFixed(2)),
result: Number((income - expenses).toFixed(2)),
taxBalance: Number((outputTax - inputTax).toFixed(2)),
incomeCount: outputDocs.length,
expenseCount: inputDocs.length + directExpenses.length
expenseCount: inputDocs.filter((invoice: any) => getIncomingInvoiceImmediateExpenseNet(invoice) > 0).length + directExpenses.filter((allocation: any) => getStatementAllocationImmediateExpenseAmount(allocation) > 0).length,
depreciationCount: depreciationRows.length
}
} finally {
loading.value = false
@@ -159,6 +176,13 @@ onMounted(loadSummary)
</span>
</div>
<div class="bwa-summary-row">
<span class="bwa-summary-label">Davon Abschreibungen</span>
<span class="bwa-summary-value text-amber-600">
{{ loading ? "..." : formatCurrency(summary.depreciations) }}
</span>
</div>
<div class="bwa-summary-row">
<span class="bwa-summary-label">Ergebnis</span>
<span class="bwa-summary-value" :class="summary.result >= 0 ? 'text-primary-500' : 'text-error'">
@@ -167,7 +191,7 @@ onMounted(loadSummary)
</div>
<div class="bwa-summary-meta">
{{ summary.incomeCount }} Einnahmenbelege | {{ summary.expenseCount }} Ausgabenbelege | USt-Saldo {{ formatCurrency(summary.taxBalance) }}
{{ summary.incomeCount }} Einnahmenbelege | {{ summary.expenseCount }} Ausgabenbelege | {{ summary.depreciationCount }} Abschreibungen | USt-Saldo {{ formatCurrency(summary.taxBalance) }}
</div>
</div>
</template>