Manuelle Buchungen in Statementallocations integrieren

This commit is contained in:
2026-04-23 16:28:44 +02:00
parent df4b591be4
commit 743bf0660c
8 changed files with 518 additions and 39 deletions

View File

@@ -35,11 +35,13 @@ const getStatementLike = (allocation) => allocation?.bankstatement || (typeof al
const getAllocationDate = (allocation) => {
const statement = getStatementLike(allocation)
return statement?.date || statement?.valueDate || allocation?.bs_id?.date || allocation?.bs_id?.valueDate || null
return statement?.date || statement?.valueDate || allocation?.bs_id?.date || allocation?.bs_id?.valueDate || allocation?.manualBookingDate || null
}
const getAllocationPartner = (allocation) => {
const statement = getStatementLike(allocation)
if (!statement && allocation?.manualBookingDate) return "Manuelle Buchung"
return statement?.debName || statement?.credName || statement?.partner || allocation?.bs_id?.debName || allocation?.bs_id?.credName || ""
}
const getAllocationDescription = (allocation) => {
@@ -48,12 +50,20 @@ const getAllocationDescription = (allocation) => {
return allocation?.description || statement?.purpose || statement?.text || statement?.description || allocation?.bs_id?.purpose || allocation?.bs_id?.text || ""
}
const hasContent = (value) => value !== null && value !== undefined && String(value).trim() !== ""
const isContraAllocation = (allocation) =>
sameAccount(allocation.contraAccount?.id || allocation.contraAccount)
|| sameAccount(allocation.contraOwnaccount?.id || allocation.contraOwnaccount)
const touchesCurrentAccount = (allocation) =>
sameAccount(allocation.account?.id || allocation.account)
|| sameAccount(allocation.ownaccount?.id || allocation.ownaccount)
|| isContraAllocation(allocation)
const monthItems = [
{ label: "Ganzes Jahr", value: "all" },
{ label: "Januar", value: "1" },
{ label: "Februar", value: "2" },
{ label: "Maerz", value: "3" },
{ label: "März", value: "3" },
{ label: "April", value: "4" },
{ label: "Mai", value: "5" },
{ label: "Juni", value: "6" },
@@ -73,7 +83,7 @@ const allAllocations = computed(() => {
date: getAllocationDate(allocation),
partner: getAllocationPartner(allocation),
description: getAllocationDescription(allocation),
amount: Number(allocation.amount || 0)
amount: Number(allocation.amount || 0) * (isContraAllocation(allocation) ? -1 : 1)
}))
const incomingInvoiceRows = incomingInvoices.value.flatMap((invoice) => {
@@ -162,7 +172,7 @@ const setup = async () => {
loading.value = true
statementAllocations.value = (await useEntities("statementallocations").select("*, bankstatement(*), createddocument(*), incominginvoice(*)"))
.filter((allocation) => sameAccount(allocation.account?.id || allocation.account) || sameAccount(allocation.ownaccount?.id || allocation.ownaccount))
.filter((allocation) => touchesCurrentAccount(allocation))
incomingInvoices.value = (await useEntities("incominginvoices").select("*, vendor(*)"))
.filter((invoice) => (invoice.accounts || []).some((account) => sameAccount(account.account?.id || account.account)))
@@ -248,7 +258,7 @@ const selectAllocation = (allocationLike) => {
<template #empty>
<div class="flex flex-col items-center justify-center py-10 text-center">
<UIcon name="i-heroicons-circle-stack-20-solid" class="mb-2 h-10 w-10 text-gray-400" />
<p class="font-medium">Keine Buchungen im ausgewaehlten Zeitraum</p>
<p class="font-medium">Keine Buchungen im ausgewählten Zeitraum</p>
</div>
</template>
@@ -259,7 +269,7 @@ const selectAllocation = (allocationLike) => {
</template>
<template #date-cell="{ row }">
{{ row.original.bankstatement.date && dayjs(row.original.bankstatement.date).isValid() ? dayjs(row.original.bankstatement.date).format('DD.MM.YYYY') : '-' }}
{{ row.original.date && dayjs(row.original.date).isValid() ? dayjs(row.original.date).format('DD.MM.YYYY') : '-' }}
</template>
<template #partner-cell="{ row }">