Functional Weave
Code in TypeScript

construction.valuation@1.0.0

README.md

2,175 bytes · view raw

# construction.valuation

An interim valuation (application for payment, payment certificate) from the
quantity surveyor's figures to the amount the payer actually transfers.

## The order of operations

1. **Gross valuation** = work done to date + materials on site. Both are
   cumulative, as valuations always are.
2. **Retention** on the cumulative gross, with `construction.retention`: the
   full percentage before practical completion, half after it, none after the
   defects are made good.
3. **Net valuation** = gross - retention held.
4. **Amount due** = net - previously certified. Because everything above is
   cumulative, retention released at practical completion simply shows up
   here as money due.
5. **VAT** on the amount due, with `finance.tax.add-vat` (GB, the category and
   the valuation date). Under the domestic reverse charge nothing is charged:
   `vat` is zero and `reverseChargeVat` shows what the customer accounts for
   to HMRC. Whether the reverse charge applies is a separate question for
   `construction.vat-reverse-charge`; pass its answer as `reverseCharge`.
6. **CIS** with `construction.cis-deduction`: the deduction is taken from the
   amount due less `cisMaterials`, never from the VAT, at the payee's status
   and the rate on the valuation date. The deduction rounds **down** to the
   penny (HMRC publishes no rounding rule; down never over-deducts). Call
   `construction.cis-deduction` yourself if you need another mode.
7. **Amount payable** = amount due + VAT charged - CIS deduction.

## Edges

- A valuation below what was previously certified gives a negative amount
  due, with negative VAT: the payee owes the difference. Under CIS that is an
  error, because there is no payment to deduct from; correct it in the next
  valuation.
- `vatCategory` null means the payee is not VAT registered; the reverse charge
  then cannot apply and is refused, as is a reverse charge on zero-rated work.
- `cisMaterials` is ignored when `cisStatus` is null. It must not exceed the
  amount due.
- All amounts must share one currency.

Payment timing (due date, payment and pay-less notices) is
`construction.payment-notice-dates`.