4. Zwischenstand
This commit is contained in:
@@ -136,8 +136,13 @@ const links = computed(() => {
|
|||||||
to: "/incomingInvoices",
|
to: "/incomingInvoices",
|
||||||
icon: "i-heroicons-document-text",
|
icon: "i-heroicons-document-text",
|
||||||
} : null,
|
} : null,
|
||||||
|
((featureEnabled("createDocument") || featureEnabled("incomingInvoices")) || featureEnabled("accounts") || featureEnabled("ownaccounts") || featureEnabled("costcentres")) ? {
|
||||||
|
label: "Auswertungen",
|
||||||
|
icon: "i-heroicons-chart-pie",
|
||||||
|
defaultOpen: false,
|
||||||
|
children: visibleItems([
|
||||||
(featureEnabled("createDocument") || featureEnabled("incomingInvoices")) ? {
|
(featureEnabled("createDocument") || featureEnabled("incomingInvoices")) ? {
|
||||||
label: "USt-Auswertung",
|
label: "USt",
|
||||||
to: "/accounting/tax",
|
to: "/accounting/tax",
|
||||||
icon: "i-heroicons-calculator",
|
icon: "i-heroicons-calculator",
|
||||||
} : null,
|
} : null,
|
||||||
@@ -157,10 +162,12 @@ const links = computed(() => {
|
|||||||
icon: "i-heroicons-document-text",
|
icon: "i-heroicons-document-text",
|
||||||
} : null,
|
} : null,
|
||||||
featureEnabled("ownaccounts") ? {
|
featureEnabled("ownaccounts") ? {
|
||||||
label: "zusätzliche Buchungskonten",
|
label: "Zusätzliche Buchungskonten",
|
||||||
to: "/standardEntity/ownaccounts",
|
to: "/standardEntity/ownaccounts",
|
||||||
icon: "i-heroicons-document-text"
|
icon: "i-heroicons-document-text"
|
||||||
} : null,
|
} : null,
|
||||||
|
])
|
||||||
|
} : null,
|
||||||
featureEnabled("banking") ? {
|
featureEnabled("banking") ? {
|
||||||
label: "Bank",
|
label: "Bank",
|
||||||
to: "/banking",
|
to: "/banking",
|
||||||
@@ -401,16 +408,11 @@ const links = computed(() => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
const navItems = computed(() =>
|
const mapNavItem = (item, valuePrefix = "item") => {
|
||||||
links.value
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((item, index) => {
|
|
||||||
const children = Array.isArray(item.children)
|
const children = Array.isArray(item.children)
|
||||||
? item.children.map((child, childIndex) => ({
|
? item.children
|
||||||
...child,
|
.filter(Boolean)
|
||||||
value: child.id || child.label || `${index}-${childIndex}`,
|
.map((child, index) => mapNavItem(child, `${valuePrefix}-${index}`))
|
||||||
active: isRouteActive(child.to)
|
|
||||||
}))
|
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
const active = item.active || isRouteActive(item.to) || Boolean(children?.some(child => child.active))
|
const active = item.active || isRouteActive(item.to) || Boolean(children?.some(child => child.active))
|
||||||
@@ -418,14 +420,19 @@ const navItems = computed(() =>
|
|||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
children,
|
children,
|
||||||
value: item.id || item.label || String(index),
|
value: item.id || item.label || valuePrefix,
|
||||||
defaultOpen: item.defaultOpen || active,
|
defaultOpen: item.defaultOpen || active,
|
||||||
active,
|
active,
|
||||||
tooltip: true,
|
tooltip: true,
|
||||||
popover: true,
|
popover: true,
|
||||||
trailingIcon: children?.length ? undefined : ''
|
trailingIcon: children?.length ? undefined : ''
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
const navItems = computed(() =>
|
||||||
|
links.value
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((item, index) => mapNavItem(item, String(index)))
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
221
frontend/components/displayBWASummary.vue
Normal file
221
frontend/components/displayBWASummary.vue
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import dayjs from "dayjs"
|
||||||
|
import {
|
||||||
|
getCreatedDocumentTaxBreakdown,
|
||||||
|
getIncomingInvoiceTaxBreakdown
|
||||||
|
} from "~/composables/useTaxEvaluation"
|
||||||
|
|
||||||
|
const loading = ref(true)
|
||||||
|
const summary = ref({
|
||||||
|
label: "",
|
||||||
|
income: 0,
|
||||||
|
expenses: 0,
|
||||||
|
result: 0,
|
||||||
|
taxBalance: 0,
|
||||||
|
incomeCount: 0,
|
||||||
|
expenseCount: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const formatCurrency = (value: number) => {
|
||||||
|
return new Intl.NumberFormat("de-DE", {
|
||||||
|
style: "currency",
|
||||||
|
currency: "EUR"
|
||||||
|
}).format(Number(value || 0))
|
||||||
|
}
|
||||||
|
|
||||||
|
const isRelevantOutputDocument = (doc: any) => {
|
||||||
|
return doc?.state === "Gebucht" && ["invoices", "advanceInvoices", "cancellationInvoices"].includes(doc?.type)
|
||||||
|
}
|
||||||
|
|
||||||
|
const isRelevantInputInvoice = (invoice: any) => {
|
||||||
|
return invoice?.state === "Gebucht" && !!invoice?.date
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadSummary = async () => {
|
||||||
|
loading.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const bounds = {
|
||||||
|
start: dayjs().startOf("month"),
|
||||||
|
end: dayjs().endOf("month")
|
||||||
|
}
|
||||||
|
|
||||||
|
const [docs, incoming, allocations] = await Promise.all([
|
||||||
|
useEntities("createddocuments").select(),
|
||||||
|
useEntities("incominginvoices").select(),
|
||||||
|
useEntities("statementallocations").select("*, bankstatement(*)")
|
||||||
|
])
|
||||||
|
|
||||||
|
const outputDocs = (docs || []).filter((doc: any) => {
|
||||||
|
if (!isRelevantOutputDocument(doc)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const date = dayjs(doc.documentDate)
|
||||||
|
return date.isValid() && !date.isBefore(bounds.start, "day") && !date.isAfter(bounds.end, "day")
|
||||||
|
})
|
||||||
|
|
||||||
|
const inputDocs = (incoming || []).filter((invoice: any) => {
|
||||||
|
if (!isRelevantInputInvoice(invoice)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const date = dayjs(invoice.date)
|
||||||
|
return date.isValid() && !date.isBefore(bounds.start, "day") && !date.isAfter(bounds.end, "day")
|
||||||
|
})
|
||||||
|
|
||||||
|
const directExpenses = (allocations || []).filter((allocation: any) => {
|
||||||
|
if (allocation?.account === null || typeof allocation?.account === "undefined") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const statementDate = allocation?.bankstatement?.date || allocation?.bankstatement?.valueDate || allocation?.date || allocation?.created_at
|
||||||
|
const date = dayjs(statementDate)
|
||||||
|
const amount = Number(allocation?.amount || 0)
|
||||||
|
|
||||||
|
return amount < 0 && date.isValid() && !date.isBefore(bounds.start, "day") && !date.isAfter(bounds.end, "day")
|
||||||
|
})
|
||||||
|
|
||||||
|
const income = outputDocs.reduce((sum: number, doc: any) => {
|
||||||
|
return sum + (doc.rows || []).reduce((rowSum: number, row: any) => {
|
||||||
|
if (!row || ["pagebreak", "title", "text"].includes(row.mode)) {
|
||||||
|
return rowSum
|
||||||
|
}
|
||||||
|
|
||||||
|
const quantity = Number(row.quantity || 0)
|
||||||
|
const price = Number(row.price || 0)
|
||||||
|
const discountPercent = Number(row.discountPercent || 0)
|
||||||
|
|
||||||
|
return rowSum + (quantity * price * (1 - discountPercent / 100))
|
||||||
|
}, 0)
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
const invoiceExpenses = inputDocs.reduce((sum: number, invoice: any) => {
|
||||||
|
return sum + (invoice.accounts || []).reduce((accountSum: number, account: any) => accountSum + Number(account.amountNet || 0), 0)
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
const directAccountExpenses = directExpenses.reduce((sum: number, allocation: any) => {
|
||||||
|
return sum + Math.abs(Number(allocation.amount || 0))
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
const outputTax = outputDocs.reduce((sum: number, doc: any) => {
|
||||||
|
const breakdown = getCreatedDocumentTaxBreakdown(doc)
|
||||||
|
return sum + breakdown.tax19 + breakdown.tax7
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
const inputTax = inputDocs.reduce((sum: number, invoice: any) => {
|
||||||
|
const breakdown = getIncomingInvoiceTaxBreakdown(invoice)
|
||||||
|
return sum + breakdown.tax19 + breakdown.tax7
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
const expenses = invoiceExpenses + directAccountExpenses
|
||||||
|
|
||||||
|
summary.value = {
|
||||||
|
label: dayjs().format("MMMM YYYY"),
|
||||||
|
income: Number(income.toFixed(2)),
|
||||||
|
expenses: Number(expenses.toFixed(2)),
|
||||||
|
result: Number((income - expenses).toFixed(2)),
|
||||||
|
taxBalance: Number((outputTax - inputTax).toFixed(2)),
|
||||||
|
incomeCount: outputDocs.length,
|
||||||
|
expenseCount: inputDocs.length + directExpenses.length
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(loadSummary)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="bwa-summary-top">
|
||||||
|
<div>
|
||||||
|
<p class="bwa-summary-period">{{ summary.label }}</p>
|
||||||
|
<p class="bwa-summary-range">Aktueller Monat</p>
|
||||||
|
</div>
|
||||||
|
<UButton
|
||||||
|
size="xs"
|
||||||
|
variant="soft"
|
||||||
|
color="gray"
|
||||||
|
icon="i-heroicons-arrow-top-right-on-square"
|
||||||
|
@click="navigateTo('/accounting/bwa')"
|
||||||
|
>
|
||||||
|
Details
|
||||||
|
</UButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bwa-summary-row">
|
||||||
|
<span class="bwa-summary-label">Einnahmen</span>
|
||||||
|
<span class="bwa-summary-value text-primary-500">
|
||||||
|
{{ loading ? "..." : formatCurrency(summary.income) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bwa-summary-row">
|
||||||
|
<span class="bwa-summary-label">Ausgaben</span>
|
||||||
|
<span class="bwa-summary-value text-error">
|
||||||
|
{{ loading ? "..." : formatCurrency(summary.expenses) }}
|
||||||
|
</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'">
|
||||||
|
{{ loading ? "..." : formatCurrency(summary.result) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bwa-summary-meta">
|
||||||
|
{{ summary.incomeCount }} Einnahmenbelege | {{ summary.expenseCount }} Ausgabenbelege | USt-Saldo {{ formatCurrency(summary.taxBalance) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.bwa-summary-top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bwa-summary-period {
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 700;
|
||||||
|
color: rgb(17 24 39);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bwa-summary-range,
|
||||||
|
.bwa-summary-meta {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: rgb(107 114 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bwa-summary-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
|
gap: 0.75rem;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bwa-summary-label {
|
||||||
|
color: rgb(55 65 81);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bwa-summary-value {
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.dark) .bwa-summary-period {
|
||||||
|
color: rgb(243 244 246);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.dark) .bwa-summary-range,
|
||||||
|
:deep(.dark) .bwa-summary-meta,
|
||||||
|
:deep(.dark) .bwa-summary-label {
|
||||||
|
color: rgb(156 163 175);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -34,21 +34,21 @@ const monthItems = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const accountColumns = [
|
const accountColumns = [
|
||||||
{ accessorKey: "number", header: "Nummer" },
|
{ accessorKey: "gross", header: "Brutto" },
|
||||||
{ accessorKey: "label", header: "Konto" },
|
|
||||||
{ accessorKey: "bookings", header: "Buchungen" },
|
|
||||||
{ accessorKey: "net", header: "Netto" },
|
{ accessorKey: "net", header: "Netto" },
|
||||||
{ accessorKey: "tax", header: "Steuer" },
|
{ accessorKey: "tax", header: "Steuer" },
|
||||||
{ accessorKey: "gross", header: "Brutto" }
|
{ accessorKey: "number", header: "Nummer" },
|
||||||
|
{ accessorKey: "label", header: "Konto" },
|
||||||
|
{ accessorKey: "bookings", header: "Buchungen" }
|
||||||
]
|
]
|
||||||
|
|
||||||
const ownAccountColumns = [
|
const ownAccountColumns = [
|
||||||
|
{ accessorKey: "balance", header: "Saldo" },
|
||||||
|
{ accessorKey: "expenses", header: "Ausgaben" },
|
||||||
|
{ accessorKey: "income", header: "Einnahmen" },
|
||||||
{ accessorKey: "number", header: "Nummer" },
|
{ accessorKey: "number", header: "Nummer" },
|
||||||
{ accessorKey: "label", header: "Konto" },
|
{ accessorKey: "label", header: "Konto" },
|
||||||
{ accessorKey: "bookings", header: "Buchungen" },
|
{ accessorKey: "bookings", header: "Buchungen" }
|
||||||
{ accessorKey: "income", header: "Einnahmen" },
|
|
||||||
{ accessorKey: "expenses", header: "Ausgaben" },
|
|
||||||
{ accessorKey: "balance", header: "Saldo" }
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const isRelevantOutputDocument = (doc: any) => {
|
const isRelevantOutputDocument = (doc: any) => {
|
||||||
@@ -148,18 +148,36 @@ const filteredStatementAllocations = computed(() => {
|
|||||||
return statementAllocations.value.filter((allocation) => matchesSelectedPeriod(getStatementDate(allocation)))
|
return statementAllocations.value.filter((allocation) => matchesSelectedPeriod(getStatementDate(allocation)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const filteredAccountStatementAllocations = computed(() => {
|
||||||
|
return filteredStatementAllocations.value.filter((allocation) => allocation.account !== null && allocation.account !== undefined)
|
||||||
|
})
|
||||||
|
|
||||||
const incomeTotal = computed(() => {
|
const incomeTotal = computed(() => {
|
||||||
return Number(filteredDocuments.value.reduce((sum, doc) => sum + computeDocumentNet(doc), 0).toFixed(2))
|
return Number(filteredDocuments.value.reduce((sum, doc) => sum + computeDocumentNet(doc), 0).toFixed(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
const expenseNetTotal = computed(() => {
|
const expenseNetTotal = computed(() => {
|
||||||
return Number(filteredIncomingInvoices.value.reduce((sum, invoice) => {
|
const invoiceExpenses = filteredIncomingInvoices.value.reduce((sum, invoice) => {
|
||||||
return sum + (invoice.accounts || []).reduce((accountSum: number, account: any) => accountSum + Number(account.amountNet || 0), 0)
|
return sum + (invoice.accounts || []).reduce((accountSum: number, account: any) => accountSum + Number(account.amountNet || 0), 0)
|
||||||
}, 0).toFixed(2))
|
}, 0)
|
||||||
|
|
||||||
|
const directAccountExpenses = filteredAccountStatementAllocations.value.reduce((sum, allocation) => {
|
||||||
|
const amount = Number(allocation.amount || 0)
|
||||||
|
return amount < 0 ? sum + Math.abs(amount) : sum
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
return Number((invoiceExpenses + directAccountExpenses).toFixed(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
const expenseGrossTotal = computed(() => {
|
const expenseGrossTotal = computed(() => {
|
||||||
return Number(filteredIncomingInvoices.value.reduce((sum, invoice) => sum + computeIncomingInvoiceGross(invoice), 0).toFixed(2))
|
const invoiceExpenses = filteredIncomingInvoices.value.reduce((sum, invoice) => sum + computeIncomingInvoiceGross(invoice), 0)
|
||||||
|
|
||||||
|
const directAccountExpenses = filteredAccountStatementAllocations.value.reduce((sum, allocation) => {
|
||||||
|
const amount = Number(allocation.amount || 0)
|
||||||
|
return amount < 0 ? sum + Math.abs(amount) : sum
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
return Number((invoiceExpenses + directAccountExpenses).toFixed(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
const taxSummary = computed(() => {
|
const taxSummary = computed(() => {
|
||||||
@@ -201,14 +219,42 @@ const operatingResult = computed(() => {
|
|||||||
return Number((incomeTotal.value - expenseNetTotal.value).toFixed(2))
|
return Number((incomeTotal.value - expenseNetTotal.value).toFixed(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const incomeDocumentCount = computed(() => filteredDocuments.value.length)
|
||||||
|
const expenseDocumentCount = computed(() => {
|
||||||
|
return filteredIncomingInvoices.value.length + filteredAccountStatementAllocations.value.length
|
||||||
|
})
|
||||||
|
|
||||||
const accountRows = computed(() => {
|
const accountRows = computed(() => {
|
||||||
return accounts.value
|
return accounts.value
|
||||||
.map((account) => {
|
.map((account) => {
|
||||||
const bookings = filteredIncomingInvoices.value.flatMap((invoice) => {
|
const invoiceBookings = filteredIncomingInvoices.value.flatMap((invoice) => {
|
||||||
return (invoice.accounts || [])
|
return (invoice.accounts || [])
|
||||||
.filter((invoiceAccount: any) => sameId(invoiceAccount.account?.id || invoiceAccount.account, account.id))
|
.filter((invoiceAccount: any) => sameId(invoiceAccount.account?.id || invoiceAccount.account, account.id))
|
||||||
|
.map((invoiceAccount: any) => ({
|
||||||
|
type: "incominginvoice",
|
||||||
|
amountNet: Number(invoiceAccount.amountNet || 0),
|
||||||
|
amountTax: Number(invoiceAccount.amountTax || 0),
|
||||||
|
amountGross: Number.isFinite(Number(invoiceAccount.amountGross))
|
||||||
|
? Number(invoiceAccount.amountGross)
|
||||||
|
: Number(invoiceAccount.amountNet || 0) + Number(invoiceAccount.amountTax || 0)
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const directBookings = filteredAccountStatementAllocations.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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const bookings = [...invoiceBookings, ...directBookings]
|
||||||
|
|
||||||
if (bookings.length === 0) {
|
if (bookings.length === 0) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -231,7 +277,7 @@ const accountRows = computed(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.sort((left: any, right: any) => Number(right.gross) - Number(left.gross))
|
.sort((left: any, right: any) => Math.abs(Number(right.gross)) - Math.abs(Number(left.gross)))
|
||||||
})
|
})
|
||||||
|
|
||||||
const ownAccountRows = computed(() => {
|
const ownAccountRows = computed(() => {
|
||||||
@@ -315,16 +361,7 @@ onMounted(setupPage)
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDashboardNavbar title="BWA">
|
<UDashboardNavbar title="BWA">
|
||||||
<template #right>
|
|
||||||
<UButton
|
|
||||||
icon="i-heroicons-arrow-path"
|
|
||||||
variant="outline"
|
|
||||||
:loading="loading"
|
|
||||||
@click="setupPage"
|
|
||||||
>
|
|
||||||
Aktualisieren
|
|
||||||
</UButton>
|
|
||||||
</template>
|
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
|
|
||||||
<UDashboardPanelContent class="min-w-0 space-y-6 overflow-x-hidden overflow-y-auto p-4 md:p-6">
|
<UDashboardPanelContent class="min-w-0 space-y-6 overflow-x-hidden overflow-y-auto p-4 md:p-6">
|
||||||
@@ -355,7 +392,7 @@ onMounted(setupPage)
|
|||||||
<div class="text-sm text-gray-500 dark:text-gray-400">Einnahmen netto</div>
|
<div class="text-sm text-gray-500 dark:text-gray-400">Einnahmen netto</div>
|
||||||
<div class="mt-2 text-2xl font-semibold">{{ useCurrency(incomeTotal) }}</div>
|
<div class="mt-2 text-2xl font-semibold">{{ useCurrency(incomeTotal) }}</div>
|
||||||
<div class="mt-2 text-sm text-gray-500 dark:text-gray-400">
|
<div class="mt-2 text-sm text-gray-500 dark:text-gray-400">
|
||||||
{{ filteredDocuments.length }} gebuchte Ausgangsbelege
|
{{ incomeDocumentCount }} gebuchte Ausgangsbelege
|
||||||
</div>
|
</div>
|
||||||
</UCard>
|
</UCard>
|
||||||
|
|
||||||
@@ -367,6 +404,24 @@ onMounted(setupPage)
|
|||||||
</div>
|
</div>
|
||||||
</UCard>
|
</UCard>
|
||||||
|
|
||||||
|
<UCard class="min-w-0">
|
||||||
|
<div class="text-sm text-gray-500 dark:text-gray-400">Einnahmen Belege</div>
|
||||||
|
<div class="mt-2 text-2xl font-semibold">{{ incomeDocumentCount }}</div>
|
||||||
|
<div class="mt-2 text-sm text-gray-500 dark:text-gray-400">
|
||||||
|
Ausgangsbelege im Zeitraum
|
||||||
|
</div>
|
||||||
|
</UCard>
|
||||||
|
|
||||||
|
<UCard class="min-w-0">
|
||||||
|
<div class="text-sm text-gray-500 dark:text-gray-400">Ausgaben Belege</div>
|
||||||
|
<div class="mt-2 text-2xl font-semibold">{{ expenseDocumentCount }}</div>
|
||||||
|
<div class="mt-2 text-sm text-gray-500 dark:text-gray-400">
|
||||||
|
Eingangsbelege plus direkte Buchungen
|
||||||
|
</div>
|
||||||
|
</UCard>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid min-w-0 gap-4 md:grid-cols-2">
|
||||||
<UCard class="min-w-0">
|
<UCard class="min-w-0">
|
||||||
<div class="text-sm text-gray-500 dark:text-gray-400">Betriebsergebnis</div>
|
<div class="text-sm text-gray-500 dark:text-gray-400">Betriebsergebnis</div>
|
||||||
<div class="mt-2 text-2xl font-semibold" :class="operatingResult >= 0 ? 'text-primary-500' : 'text-error'">
|
<div class="mt-2 text-2xl font-semibold" :class="operatingResult >= 0 ? 'text-primary-500' : 'text-error'">
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ onMounted(loadData)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<UDashboardNavbar title="USt-Auswertung">
|
<UDashboardNavbar title="USt-Auswertung">
|
||||||
<template #right>
|
<template #right>
|
||||||
<UButton
|
<UButton
|
||||||
@@ -285,5 +284,4 @@ onMounted(loadData)
|
|||||||
</UTable>
|
</UTable>
|
||||||
</UCard>
|
</UCard>
|
||||||
</UDashboardPanelContent>
|
</UDashboardPanelContent>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ const documentTypeItems = computed(() => Object.keys(dataStore.documentTypesForC
|
|||||||
const taxTypeItems = [
|
const taxTypeItems = [
|
||||||
{ key: 'Standard', label: 'Standard' },
|
{ key: 'Standard', label: 'Standard' },
|
||||||
{ key: '13b UStG', label: '13b UStG' },
|
{ key: '13b UStG', label: '13b UStG' },
|
||||||
{ key: '19 UStG', label: '19 UStG Kleinunternehmer' }
|
{ key: '19 UStG', label: '19 UStG Kleinunternehmer' },
|
||||||
|
{ key: '12.3 UStG', label: '12.3 UStG' }
|
||||||
]
|
]
|
||||||
const deliveryDateTypeItems = ['Lieferdatum', 'Lieferzeitraum', 'Leistungsdatum', 'Leistungszeitraum', 'Kein Lieferdatum anzeigen']
|
const deliveryDateTypeItems = ['Lieferdatum', 'Lieferzeitraum', 'Leistungsdatum', 'Leistungszeitraum', 'Kein Lieferdatum anzeigen']
|
||||||
const paymentTypeItems = [
|
const paymentTypeItems = [
|
||||||
@@ -115,6 +116,11 @@ const formatNumberLikeValue = (value) => {
|
|||||||
return '-'
|
return '-'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const normalizeTaxTypeValue = (value) => {
|
||||||
|
const normalized = typeof value === "string" ? value.trim() : value
|
||||||
|
return taxTypeItems.find((item) => item.key === normalized)?.key || "Standard"
|
||||||
|
}
|
||||||
|
|
||||||
const getCalendarValue = (value) => {
|
const getCalendarValue = (value) => {
|
||||||
if (!value) return undefined
|
if (!value) return undefined
|
||||||
|
|
||||||
@@ -174,6 +180,7 @@ const setupPage = async () => {
|
|||||||
if (route.params.id) {
|
if (route.params.id) {
|
||||||
console.log(route.params)
|
console.log(route.params)
|
||||||
itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,'',false)
|
itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,'',false)
|
||||||
|
itemInfo.value.taxType = normalizeTaxTypeValue(itemInfo.value.taxType)
|
||||||
await setContactPersonData()
|
await setContactPersonData()
|
||||||
checkCompatibilityWithInputPrice()
|
checkCompatibilityWithInputPrice()
|
||||||
}
|
}
|
||||||
@@ -357,7 +364,7 @@ const setupPage = async () => {
|
|||||||
console.log(optionsToImport)
|
console.log(optionsToImport)
|
||||||
console.log(linkedDocument)
|
console.log(linkedDocument)
|
||||||
|
|
||||||
if (optionsToImport.taxType) itemInfo.value.taxType = linkedDocument.taxType
|
if (optionsToImport.taxType) itemInfo.value.taxType = normalizeTaxTypeValue(linkedDocument.taxType)
|
||||||
if (optionsToImport.customer) itemInfo.value.customer = linkedDocument.customer
|
if (optionsToImport.customer) itemInfo.value.customer = linkedDocument.customer
|
||||||
if (optionsToImport.letterhead) itemInfo.value.letterhead = linkedDocument.letterhead
|
if (optionsToImport.letterhead) itemInfo.value.letterhead = linkedDocument.letterhead
|
||||||
if (optionsToImport.contact) itemInfo.value.contact = linkedDocument.contact
|
if (optionsToImport.contact) itemInfo.value.contact = linkedDocument.contact
|
||||||
@@ -382,7 +389,7 @@ const setupPage = async () => {
|
|||||||
|
|
||||||
if (process.dev) console.log(linkedDocument)
|
if (process.dev) console.log(linkedDocument)
|
||||||
|
|
||||||
itemInfo.value.taxType = linkedDocument.taxType
|
itemInfo.value.taxType = normalizeTaxTypeValue(linkedDocument.taxType)
|
||||||
itemInfo.value.customer = linkedDocument.customer
|
itemInfo.value.customer = linkedDocument.customer
|
||||||
await setCustomerData(null, true)
|
await setCustomerData(null, true)
|
||||||
itemInfo.value.letterhead = linkedDocument.letterhead
|
itemInfo.value.letterhead = linkedDocument.letterhead
|
||||||
@@ -545,7 +552,7 @@ const setCustomerData = async (customerId, loadOnlyAdress = false) => {
|
|||||||
if (!loadOnlyAdress && customer.customPaymentDays) itemInfo.value.paymentDays = customer.customPaymentDays
|
if (!loadOnlyAdress && customer.customPaymentDays) itemInfo.value.paymentDays = customer.customPaymentDays
|
||||||
if (!loadOnlyAdress && customer.custom_payment_type) itemInfo.value.payment_type = customer.custom_payment_type
|
if (!loadOnlyAdress && customer.custom_payment_type) itemInfo.value.payment_type = customer.custom_payment_type
|
||||||
if (!loadOnlyAdress) {
|
if (!loadOnlyAdress) {
|
||||||
itemInfo.value.taxType = customer.customTaxType || "Standard"
|
itemInfo.value.taxType = normalizeTaxTypeValue(customer.customTaxType)
|
||||||
setTaxType()
|
setTaxType()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1459,7 +1466,7 @@ const saveDocument = async (state, resetup = false) => {
|
|||||||
|
|
||||||
let createData = {
|
let createData = {
|
||||||
type: itemInfo.value.type,
|
type: itemInfo.value.type,
|
||||||
taxType: ['invoices', 'cancellationInvoices', 'advanceInvoices', 'qoutes', 'confirmationOrders'].includes(itemInfo.value.type) ? itemInfo.value.taxType : null,
|
taxType: ['invoices', 'cancellationInvoices', 'advanceInvoices', 'quotes', 'confirmationOrders'].includes(itemInfo.value.type) ? normalizeTaxTypeValue(itemInfo.value.taxType) : null,
|
||||||
state: itemInfo.value.state || "Entwurf",
|
state: itemInfo.value.state || "Entwurf",
|
||||||
customer: itemInfo.value.customer,
|
customer: itemInfo.value.customer,
|
||||||
contact: itemInfo.value.contact,
|
contact: itemInfo.value.contact,
|
||||||
|
|||||||
@@ -246,7 +246,15 @@ const types = computed(() => {
|
|||||||
return templateTypes.filter((type) => selectedTypes.value.find(i => i.key === type.key))
|
return templateTypes.filter((type) => selectedTypes.value.find(i => i.key === type.key))
|
||||||
})
|
})
|
||||||
|
|
||||||
const selectItem = (item) => {
|
const unwrapSelectedRow = (itemLike) => itemLike?.original || itemLike
|
||||||
|
|
||||||
|
const selectItem = (itemLike) => {
|
||||||
|
const item = unwrapSelectedRow(itemLike)
|
||||||
|
|
||||||
|
if (!item?.id) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (item.state === "Entwurf") {
|
if (item.state === "Entwurf") {
|
||||||
router.push(`/createDocument/edit/${item.id}`)
|
router.push(`/createDocument/edit/${item.id}`)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import DisplayBankaccounts from "~/components/displayBankaccounts.vue"
|
|||||||
import DisplayProjectsInPhases from "~/components/displayProjectsInPhases.vue"
|
import DisplayProjectsInPhases from "~/components/displayProjectsInPhases.vue"
|
||||||
import DisplayOpenTasks from "~/components/displayOpenTasks.vue"
|
import DisplayOpenTasks from "~/components/displayOpenTasks.vue"
|
||||||
import DisplayTaxSummary from "~/components/displayTaxSummary.vue"
|
import DisplayTaxSummary from "~/components/displayTaxSummary.vue"
|
||||||
|
import DisplayBWASummary from "~/components/displayBWASummary.vue"
|
||||||
|
|
||||||
setPageLayout("default")
|
setPageLayout("default")
|
||||||
|
|
||||||
@@ -78,6 +79,15 @@ const DASHBOARD_WIDGETS = [
|
|||||||
defaultLayout: { x: 4, y: 7, w: 4, h: 3 },
|
defaultLayout: { x: 4, y: 7, w: 4, h: 3 },
|
||||||
minW: 3,
|
minW: 3,
|
||||||
minH: 3
|
minH: 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "bwa-summary",
|
||||||
|
title: "BWA aktuell",
|
||||||
|
description: "Einnahmen, Ausgaben und Ergebnis des aktuellen Monats",
|
||||||
|
component: markRaw(DisplayBWASummary),
|
||||||
|
defaultLayout: { x: 8, y: 7, w: 4, h: 3 },
|
||||||
|
minW: 3,
|
||||||
|
minH: 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -348,7 +358,6 @@ onBeforeUnmount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<UDashboardNavbar title="Home">
|
<UDashboardNavbar title="Home">
|
||||||
<template #right>
|
<template #right>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@@ -501,7 +510,6 @@ onBeforeUnmount(() => {
|
|||||||
</UCard>
|
</UCard>
|
||||||
</template>
|
</template>
|
||||||
</UModal>
|
</UModal>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user