KI-AGENT: BWA-Ausgaben nach Kontosaldo berechnen
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 23s
Build and Push Docker Images / build-frontend (push) Successful in 1m11s
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-central-services-api (push) Successful in 22s
Build and Push Docker Images / build-central-services-admin (push) Successful in 22s
Build and Push Docker Images / build-docs (push) Successful in 1m20s
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 23s
Build and Push Docker Images / build-frontend (push) Successful in 1m11s
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-central-services-api (push) Successful in 22s
Build and Push Docker Images / build-central-services-admin (push) Successful in 22s
Build and Push Docker Images / build-docs (push) Successful in 1m20s
This commit is contained in:
@@ -317,6 +317,31 @@ export const getStatementAllocationImmediateExpenseAmount = (allocation: any) =>
|
||||
return Math.max(0, getStatementAllocationImmediateExpenseImpact(allocation))
|
||||
}
|
||||
|
||||
export const getStatementAccountExpenseTotal = (allocations: any[] = []) => {
|
||||
const balances = new Map<string, number>()
|
||||
const addAmount = (account: any, amount: number) => {
|
||||
const id = account?.id || account
|
||||
if (id === null || id === undefined || id === "") return
|
||||
|
||||
const key = String(id)
|
||||
balances.set(key, Number(balances.get(key) || 0) + amount)
|
||||
}
|
||||
|
||||
;(allocations || []).forEach((allocation) => {
|
||||
if (normalizeExpenseBookingMode(allocation?.bookingMode) !== "expense") return
|
||||
|
||||
const amount = Number(allocation?.amount || 0)
|
||||
addAmount(allocation?.account, amount)
|
||||
addAmount(allocation?.contraAccount, -amount)
|
||||
})
|
||||
|
||||
const total = Array.from(balances.values()).reduce((sum, balance) => {
|
||||
return balance < 0 ? sum + Math.abs(balance) : sum
|
||||
}, 0)
|
||||
|
||||
return Number(total.toFixed(2))
|
||||
}
|
||||
|
||||
export const getStatementAllocationDepreciationAmount = (allocation: any, rangeStart: any, rangeEnd: any) => {
|
||||
const mode = normalizeExpenseBookingMode(allocation?.bookingMode)
|
||||
const rawAmount = Number(allocation?.amount || 0)
|
||||
|
||||
Reference in New Issue
Block a user