feat(arap): write off a bad debt in the engine (P4b S7)
An invoice that will not be collected comes off the receivables and is deducted, the direct write-off method the owner chose (A-5; IRC §166(a); Treas. Reg. §1.166-1(e), -2(a), -3(a); rules.md B-41). Ledger::write_off posts one balanced entry, Dr 6990 Bad Debt Expense / Cr 1200 Accounts Receivable, its receivable line tagged WriteOff so the figures stay derived: what the invoice owes falls and what was written off rises, and a reversal re-instates it without a new movement (D-49). The amount is at most what is owed, and at most the least owed on any day from the write-off's on: a later payment can't leave the invoice owing less than nothing (B-38 INVARIANT 2). A partial write-off is allowed, as §1.166-3(a) allows to the extent charged off. Cash-basis books refuse it: an invoice never counted as income has no basis to deduct (§1.166-1(e)). The bad_debts role (6990) is a control role, so the account is created on demand and can be assigned like the others. The same-year recovery D-49 records is a reversal of the write-off and then a payment; a later year is a plain entry, and needs no movement. Tests: half_paid_rest_written_off_is_written_off, write_off_refused_on_cash_basis, write_off_above_outstanding_refused, write_off_then_recovery_same_year.
This commit is contained in:
1 parent
ed637f0e27
commit
d5af44b9cb
4 files changed
+410
-5
No files matched your search
@@ -778,6 +778,22 @@ pub enum LedgerError {
|
||||
#[error("{0}")]
|
||||
InvalidVoid(String),
|
||||
|
||||
/// A bad debt can't be written off on cash-basis books (rules.md
|
||||
/// B-41 INVARIANT 3; IRC §166(a); Treas. Reg. §1.166-1(e)): the
|
||||
/// invoice was never counted as income, so there is no basis to
|
||||
/// deduct.
|
||||
#[error(
|
||||
"a bad debt can't be written off on cash-basis books: the invoice was never counted as \
|
||||
income, so there is nothing to deduct (IRC §166; Treas. Reg. §1.166-1(e)); these books \
|
||||
are on the cash basis (books.accounting_basis)"
|
||||
)]
|
||||
WriteOffOnCashBasis,
|
||||
|
||||
/// A write-off the books can't take: its amount, its day, or its
|
||||
/// reason. The message says which, and what the invoice owes.
|
||||
#[error("{0}")]
|
||||
InvalidWriteOff(String),
|
||||
|
||||
/// Invoice/bill due date is before its date.
|
||||
#[error("due date {0} is before document date")]
|
||||
DueBeforeDate(String),
|
||||
|
||||
Reference in new issue
Block a user