Calculation version and purpose
The production finance service identifies this method as safe_to_spend_v1. Its purpose is to produce a deterministic, conservative planning value from customer-owned records. The finance engine stores and calculates all money as integer sen.
Calculation sequence
- Establish available cash. Start from the latest manual cash snapshot and apply recorded income and spending events that occurred after it and no later than the calculation time. Clamp a negative available balance to zero.
- Select required commitments. Include active, open, required occurrences from Malaysia-local today through the selected horizon. Paid occurrences and optional commitments are excluded.
- Apply linked reserve coverage. Process commitments in order. A linked reserve covers up to its remaining balance; only the uncovered part joins the commitment deduction.
- Protect every reserve. Add all positive virtual reserve balances to the protected-reserve deduction, including reserves linked to commitments.
- Protect the safety buffer. Deduct the user's non-negative recorded buffer.
- Separate display from shortfall. Keep the signed raw result. Display at least RM0.00 and report any negative distance from zero as shortfall.
The no-double-count invariant
Because all reserve balances remain protected, the commitment deduction contains only amounts not covered by the linked reserve pool. Coverage is consumed as commitments are processed and cannot be reused. This prevents the same reserve balance from being subtracted again as a fully uncovered commitment.
What the calculation does not do
- It does not add future income, predicted earnings or unpaid invoices.
- It does not read a bank account or verify that a recorded balance matches one.
- It does not automatically judge whether a commitment, reserve or buffer is appropriate.
- It does not provide financial, investment, tax or legal advice.
Read the main Safe-to-Spend explanation and worked example before using this technical summary on its own.
