KI-AGENT: Gegenkonten in der BWA vollständig saldieren
Some checks failed
Build and Push Docker Images / build-backend (push) Successful in 21s
Build and Push Docker Images / build-website (push) Has been cancelled
Build and Push Docker Images / build-central-services-api (push) Has been cancelled
Build and Push Docker Images / build-central-services-admin (push) Has been cancelled
Build and Push Docker Images / build-docs (push) Has been cancelled
Build and Push Docker Images / build-frontend (push) Has been cancelled
Some checks failed
Build and Push Docker Images / build-backend (push) Successful in 21s
Build and Push Docker Images / build-website (push) Has been cancelled
Build and Push Docker Images / build-central-services-api (push) Has been cancelled
Build and Push Docker Images / build-central-services-admin (push) Has been cancelled
Build and Push Docker Images / build-docs (push) Has been cancelled
Build and Push Docker Images / build-frontend (push) Has been cancelled
This commit is contained in:
@@ -78,7 +78,12 @@ const isRelevantInputInvoice = (invoice: any) => {
|
|||||||
const sameId = (left: any, right: any) => String(left ?? "") === String(right ?? "")
|
const sameId = (left: any, right: any) => String(left ?? "") === String(right ?? "")
|
||||||
|
|
||||||
const getStatementDate = (allocation: any) => {
|
const getStatementDate = (allocation: any) => {
|
||||||
return allocation?.bankstatement?.date || allocation?.bankstatement?.valueDate || allocation?.date || allocation?.created_at || null
|
return allocation?.bankstatement?.date
|
||||||
|
|| allocation?.bankstatement?.valueDate
|
||||||
|
|| allocation?.date
|
||||||
|
|| allocation?.manualBookingDate
|
||||||
|
|| allocation?.created_at
|
||||||
|
|| null
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchesSelectedPeriod = (dateValue: any) => {
|
const matchesSelectedPeriod = (dateValue: any) => {
|
||||||
@@ -154,21 +159,12 @@ const filteredStatementAllocations = computed(() => {
|
|||||||
return statementAllocations.value.filter((allocation) => matchesSelectedPeriod(getStatementDate(allocation)))
|
return statementAllocations.value.filter((allocation) => matchesSelectedPeriod(getStatementDate(allocation)))
|
||||||
})
|
})
|
||||||
|
|
||||||
const filteredDirectAccountStatementAllocations = computed(() => {
|
const filteredAccountStatementAllocations = computed(() => {
|
||||||
return filteredStatementAllocations.value.filter((allocation) => {
|
return filteredStatementAllocations.value.filter((allocation) => {
|
||||||
if (allocation.account === null || allocation.account === undefined) {
|
if (allocation.account === null || allocation.account === undefined) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return !allocation?.incominginvoice
|
|
||||||
&& !allocation?.createddocument
|
|
||||||
&& !allocation?.ii_id
|
|
||||||
&& !allocation?.cd_id
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const filteredAccountStatementAllocations = computed(() => {
|
|
||||||
return filteredDirectAccountStatementAllocations.value.filter((allocation) => {
|
|
||||||
return getStatementAllocationImmediateExpenseAmount(allocation) > 0
|
return getStatementAllocationImmediateExpenseAmount(allocation) > 0
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -307,7 +303,7 @@ const accountRows = computed(() => {
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
const directBookings = filteredDirectAccountStatementAllocations.value
|
const debitBookings = filteredStatementAllocations.value
|
||||||
.filter((allocation) => sameId(allocation.account?.id || allocation.account, account.id))
|
.filter((allocation) => sameId(allocation.account?.id || allocation.account, account.id))
|
||||||
.map((allocation) => {
|
.map((allocation) => {
|
||||||
const amount = Number(allocation.amount || 0)
|
const amount = Number(allocation.amount || 0)
|
||||||
@@ -320,7 +316,20 @@ const accountRows = computed(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const bookings = [...invoiceBookings, ...directBookings]
|
const creditBookings = filteredStatementAllocations.value
|
||||||
|
.filter((allocation) => sameId(allocation.contraAccount?.id || allocation.contraAccount, account.id))
|
||||||
|
.map((allocation) => {
|
||||||
|
const amount = -Number(allocation.amount || 0)
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: "statementallocation",
|
||||||
|
amountNet: amount,
|
||||||
|
amountTax: 0,
|
||||||
|
amountGross: amount
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const bookings = [...invoiceBookings, ...debitBookings, ...creditBookings]
|
||||||
|
|
||||||
if (bookings.length === 0) {
|
if (bookings.length === 0) {
|
||||||
return null
|
return null
|
||||||
@@ -350,23 +359,29 @@ const accountRows = computed(() => {
|
|||||||
const ownAccountRows = computed(() => {
|
const ownAccountRows = computed(() => {
|
||||||
return ownAccounts.value
|
return ownAccounts.value
|
||||||
.map((account) => {
|
.map((account) => {
|
||||||
const bookings = filteredStatementAllocations.value.filter((allocation) => sameId(allocation.ownaccount?.id || allocation.ownaccount, account.id))
|
const debitBookings = filteredStatementAllocations.value
|
||||||
|
.filter((allocation) => sameId(allocation.ownaccount?.id || allocation.ownaccount, account.id))
|
||||||
|
.map((allocation) => Number(allocation.amount || 0))
|
||||||
|
|
||||||
|
const creditBookings = filteredStatementAllocations.value
|
||||||
|
.filter((allocation) => sameId(allocation.contraOwnaccount?.id || allocation.contraOwnaccount, account.id))
|
||||||
|
.map((allocation) => -Number(allocation.amount || 0))
|
||||||
|
|
||||||
|
const bookings = [...debitBookings, ...creditBookings]
|
||||||
|
|
||||||
if (bookings.length === 0) {
|
if (bookings.length === 0) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const income = bookings.reduce((sum, booking) => {
|
const income = bookings.reduce((sum, amount) => {
|
||||||
const amount = Number(booking.amount || 0)
|
|
||||||
return amount > 0 ? sum + amount : sum
|
return amount > 0 ? sum + amount : sum
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
||||||
const expenses = bookings.reduce((sum, booking) => {
|
const expenses = bookings.reduce((sum, amount) => {
|
||||||
const amount = Number(booking.amount || 0)
|
|
||||||
return amount < 0 ? sum + Math.abs(amount) : sum
|
return amount < 0 ? sum + Math.abs(amount) : sum
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
||||||
const balance = bookings.reduce((sum, booking) => sum + Number(booking.amount || 0), 0)
|
const balance = bookings.reduce((sum, amount) => sum + amount, 0)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: account.id,
|
id: account.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user