Include manual tax accounts in VAT evaluation
All checks were successful
Build and Push Docker Images / build-central-services-api (push) Successful in 35s
Build and Push Docker Images / build-central-services-admin (push) Successful in 35s
Build and Push Docker Images / build-backend (push) Successful in 57s
Build and Push Docker Images / build-frontend (push) Successful in 1m58s
Build and Push Docker Images / build-website (push) Successful in 36s
Build and Push Docker Images / build-docs (push) Successful in 34s

This commit is contained in:
2026-08-09 16:38:43 +02:00
parent 8301d8777e
commit 7ad55aaa0b
5 changed files with 104 additions and 7 deletions

View File

@@ -166,3 +166,33 @@ export const getIncomingInvoiceTaxBreakdown = (invoice: any) => {
net0: Number(breakdown.net0.toFixed(2)),
}
}
const getSkr03AccountNumber = (account: any) => {
if (!account || String(account.accountChart || "").toLowerCase() !== "skr03") return null
return String(account.number || "")
}
export const getManualBookingTaxBreakdown = (booking: any) => {
const amount = Number(booking?.amount || 0)
const breakdown = { outputTax19: 0, inputTax19: 0 }
if (!Number.isFinite(amount) || amount === 0) return breakdown
const applySide = (account: any, side: "debit" | "credit") => {
const accountNumber = getSkr03AccountNumber(account)
if (accountNumber === "1576") {
breakdown.inputTax19 += side === "debit" ? amount : -amount
} else if (accountNumber === "1776") {
breakdown.outputTax19 += side === "credit" ? amount : -amount
}
}
applySide(booking.account, "debit")
applySide(booking.contraAccount, "credit")
return {
outputTax19: Number(breakdown.outputTax19.toFixed(2)),
inputTax19: Number(breakdown.inputTax19.toFixed(2)),
}
}