Files
accounted/lib/salary/payment/effective-net.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

23 lines
1.0 KiB
TypeScript

/**
* The net amount actually paid out to an employee's bank account for a salary
* run, honoring any manual tax-withheld override. This is exactly the figure
* written into the pain.001 / Bankgirot LB payment files.
*
* Bank details (clearing + account number) are only required when this is > 0:
* a zero payout: e.g. a nollkörning, or an employee whose net is fully
* consumed by a nettolöneavdrag: produces no payment-file line, so there is
* no destination account to fill in. Gating the bank-details requirement on
* this keeps the approve guard and the payment-file generators in agreement.
*/
export interface EffectiveNetInput {
net_salary: number
tax_withheld: number
tax_withheld_override?: number | null
}
export function effectiveNetPayout(sre: EffectiveNetInput): number {
// net_salary was computed with the calculated tax; if the user overrode the
// tax, the payout shifts by the difference (lower tax → higher payout).
return sre.net_salary + (sre.tax_withheld - (sre.tax_withheld_override ?? sre.tax_withheld))
}