diff --git a/frontend/pages/incomingInvoices/index.vue b/frontend/pages/incomingInvoices/index.vue
index 6b25fff..c56b146 100644
--- a/frontend/pages/incomingInvoices/index.vue
+++ b/frontend/pages/incomingInvoices/index.vue
@@ -58,6 +58,7 @@ const isPreparing = ref(false)
const type = "incominginvoices"
const dataType = dataStore.dataTypes[type]
+const openAmountColumnKey = "openAmount"
const setupPage = async () => {
items.value = await useEntities(type).select("*, vendor(id,name), statementallocations(id,amount)",sort.value.column,sort.value.direction === "asc")
@@ -93,7 +94,13 @@ const prepareInvoices = async () => {
setupPage()
-const selectedColumns = ref(tempStore.columns[type] ? tempStore.columns[type] : dataType.templateColumns.filter(i => !i.disabledInTable))
+const selectedColumns = ref(tempStore.columns[type] ? [...tempStore.columns[type]] : dataType.templateColumns.filter(i => !i.disabledInTable))
+if (!selectedColumns.value.find((column) => column.key === openAmountColumnKey)) {
+ const openAmountColumn = dataType.templateColumns.find((column) => column.key === openAmountColumnKey)
+ if (openAmountColumn) {
+ selectedColumns.value.splice(5, 0, openAmountColumn)
+ }
+}
const columns = computed(() => dataType.templateColumns.filter((column) => !column.disabledInTable && selectedColumns.value.find(i => i.key === column.key)))
const selectableFilters = ref(dataType.filters.map(i => i.name))
@@ -142,10 +149,18 @@ const getInvoiceSum = (invoice) => {
return sum.toFixed(2)
}
-const isPaid = (item) => {
+const getPaidAmount = (item) => {
let amountPaid = 0
item.statementallocations.forEach(allocation => amountPaid += allocation.amount)
- return Math.abs(amountPaid) === Math.abs(Number(getInvoiceSum(item)))
+ return Number(Math.abs(amountPaid).toFixed(2))
+}
+
+const isPaid = (item) => {
+ return getPaidAmount(item) >= Number(Math.abs(Number(getInvoiceSum(item))).toFixed(2))
+}
+
+const getOpenAmount = (item) => {
+ return Number(Math.max(0, Number(getInvoiceSum(item)) - getPaidAmount(item)).toFixed(2))
}
const unwrapInvoiceRow = (invoiceLike) => invoiceLike?.original || invoiceLike
@@ -283,6 +298,11 @@ const selectIncomingInvoice = (invoiceLike) => {
{{displayCurrency(sum.getIncomingInvoiceSum(row.original))}}
+
+
+ {{ displayCurrency(getOpenAmount(row.original)) }}
+
+
{{dayjs(row.original.dueDate).format("DD.MM.YYYY")}}
diff --git a/frontend/stores/data.js b/frontend/stores/data.js
index 81838fa..341e4ab 100644
--- a/frontend/stores/data.js
+++ b/frontend/stores/data.js
@@ -2200,6 +2200,10 @@ export const useDataStore = defineStore('data', () => {
key: "amount",
label: "Betrag",
},
+ {
+ key: "openAmount",
+ label: "Offener Betrag",
+ },
{
key: "dueDate",
label: "Fälligkeitsdatum",