Skip to content

NizKhata Android v1.11.6

Choose a tag to compare

@github-actions github-actions released this 27 Sep 14:30
8d81936
Withdraw a card bill the ledger no longer supports (#120)

Reported from a real workspace: a Flipkart Axis card showing "Nothing to
pay" on its statement of 14 Sept, while the dues list asked for
₹2,233.00 against that same statement.

The card screen was right. On 14 Sept the card was ₹1,561 in credit:

    626 + 608 + 1,584 − 585 − 3,794 = −1,561

The bill was right too, when it was raised — 2,233 is that sum without
the 3,794 cashback, which was entered afterwards and dated back inside
the cycle. What was wrong was that nothing reconciled the two.

statementDuePlans keeps an unpaid bill in step with the ledger, but the
"nothing owed" check ran BEFORE the existing bill was looked up:

    if (owed <= 0.005) continue;   // returns here
    final existing = byId[id];     // never reached

So while the figure stayed positive the bill self-corrected, and the
moment the statement fell to zero or into credit it was abandoned at
whatever it last said — asking for money that was never owed, and
inflating the payable total by exactly that.

The check now happens first: a bill standing against a statement that
owes nothing is withdrawn, status cancelled, the same mechanism the
manual Cancel action uses, so it leaves both the dues list and the
payable total.

Two bills are deliberately left alone. One already cancelled, and one
that has been part paid — money has moved against that, and withdrawing
it quietly would hide the fact rather than surface it.

Six tests carry the reported figures: 2,233 at the moment it was raised,
−1,561 once the cashback lands, the withdrawal itself, and the two cases
that must not be touched. Removing the fix fails the withdrawal test.
277 mobile tests pass.


Claude-Session: https://claude.ai/code/session_016jkAcgzuuxTfBiAgMLWgC4

Co-authored-by: Claude <noreply@anthropic.com>