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
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:
@@ -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)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user