Игорь Надеин 3da3100328
All checks were successful
Deploy production / deploy (push) Successful in 11m10s
Separate salary participation and preserve historical carryover rules
2026-10-15 19:37:51 +03:00

13 lines
454 B
Python

"""Versioned contribution shared by calculation, reconstruction and ledger."""
from decimal import Decimal
def carryover_contribution(kind: str, amount: Decimal, *, version: int = 2) -> Decimal:
if version not in (1, 2):
raise ValueError("Unsupported payroll balance rules version")
increases = kind in {"adjustment_debit", "deduction"} or (
kind == "payment" and version == 1
)
return amount if increases else -amount