Functional Weave
Code in TypeScript

energy.water-bill@1.0.0

README.md

2,758 bytes · view raw

# energy.water-bill

A metered water and sewerage bill for England and Wales, from the reads at the
start and end of the period and the water company's charges:

| line | how |
|---|---|
| water volume | m³ used x water rate per m³ |
| sewerage volume | m³ used x return to sewer % x sewerage rate per m³ |
| water standing charge | annual charge x days / 365 |
| sewerage standing charge | annual charge x days / 365 |
| surface water drainage | annual charge x days / 365, unless the property's surface water does not drain to the public sewer |

The rates are the caller's: every company publishes its own charges scheme
each April, and they differ by company and by customer type.

## Decisions

- **Return to sewer.** Sewerage is charged on the water assumed to go back to
  the sewer, usually 95% of what is supplied (90% for some, a site-specific
  figure for many businesses). It is a tariff field in basis points, and the
  sewerage volume charge is computed exactly on `m³ x rate x share` with one
  rounding, not on a rounded volume.
- **Surface water drainage allowance.** Where no rainwater from the property
  drains to the public sewer (it goes to a soakaway, say), the company must
  not charge for surface water drainage. Pass `surfaceWaterDrains: false` and
  that line is zero. Companies that fold surface water into the sewerage
  standing charge publish a reduced sewerage charge for such properties
  instead; pass that tariff and a zero `surfaceWaterCharge`.
- **Days.** The period is the days between the two read dates
  (`dates.days-between`): reads on 1 April and 30 September are 182 days.
  Annual charges are apportioned by `days / 365` in every year, including a
  leap year, which is the usual daily-apportionment rule in charges schemes;
  a company that apportions by 366 in a leap year will differ by a penny or
  so.
- **Rollover** is handled by `energy.meter-advance`: a lower closing read is a
  meter that went round once.
- **Each line is rounded once** by `mode` and the total is the sum of the
  lines, as the bill prints them.
- **No VAT.** Water and sewerage services to households are zero-rated, and
  most business supplies are too; if yours are not, apply VAT to the total.

## Sources

- Ofwat, "Surface water and highway drainage",
  https://www.ofwat.gov.uk/households/your-water-bill/surfacewaterdrainage/
  ("If no surface water from your property enters a public sewer then you may
  qualify for a reduction in your sewerage charge").
- Ofwat, "Metered customers and applying for metered charges",
  https://www.ofwat.gov.uk/households/your-water-bill/metering/
- The rates, standing charges, return-to-sewer percentage and apportionment
  rule are each company's own, in its annual charges scheme.