"Why is there no invoice yet?" and "why is this line here?" have the same answer: the rules below. They are applied every time a dispatch is confirmed, and nowhere else.
The moment
Invoice lines are drafted when a business presses Confirm & create invoices on a dispatch, and the stops in that business's slice are all closed (Completed, Unable, Removed or Cancelled), with at least one Completed. Nothing is drafted when the last driver finishes; nothing is drafted when the dispatch is marked complete; only the confirmation drafts. Each invoicing business confirms its own slice, so a root can bill one subcontractor's finished work while another is still out.
Confirming again is harmless: the system remembers which stops it has drafted and drafts only what is new.
Which stops become lines
- Completed stops, and only those. Unable, removed and cancelled stops bill nothing and block nothing.
- One address on a dispatch is one line, however many routes or visits it had. An hourly address covered by two routes bills the sum of its passes, not the stretch from the first arrival to the last departure, and its line waits until every pass is registered. See when two routes cover the same address.
- A stop that carries extra work types (gritting added to a salting visit, say) gets one more line per extra, beside its own line and at the extra's own price, on both sides of the chain. See Extra work types on a stop.
- A stop with no price for its work type is skipped (no zero line) and stays billable until a price exists; then it surfaces in the retroactive-billing offer.
- A per-season address produces no per-dispatch customer line; its money comes as seasonal instalments. Its subcontractor settlement still runs per stop.
- A municipality's own addresses produce no lines in either direction.
- A business that declined the dispatch gets no line toward it and none from it.
- An address dispatch bills only the sides its creator chose: Customer and subcontractor, Customer only, Subcontractor only, or nothing at all when Should be invoiced was switched off. Route, zone and manual dispatches always bill both sides, and a test dispatch bills neither. See Who is invoiced for an address dispatch.
Each completed stop produces up to two kinds of line: a customer line on the invoice of the business that owns the address, at that business's price; and a settlement line for every link in the subcontractor chain, at the paying business's cost. The two sides are independent: billing the customer does not require the subcontractor side to exist, and vice versa.
Which invoice the line lands on
The line goes on the customer's open generated draft for the same month (the month of the work, not the month you confirmed). If there is no open draft, one is created. A draft that has been Sent is never reopened: the next confirmation starts a new draft.
How drafts are split is the invoice grouping: By customer (one draft per customer per month) or By location (one per address). The customer's own setting wins over the business default. Grouping follows the business that invoices the customer, never the subcontractor that did the work.
What can still change a line
- Editing a stop's Work type while its line is a draft archives the line and drafts it anew; once the invoice has left draft, the change is refused. Adding or removing an extra work type follows the same rule.
- Restoring a completed stop to not-started removes its draft line.
- A second dispatch of the same address and work type bills its own line; when the two visits are within six hours of each other the line carries Possible duplicate so a person decides.
- Unsend takes an invoice back to draft; nothing is re-drafted by it.
If invoicing fails
If the accounting push or the drafting itself fails, the dispatch stays completed: the failure is shown, never rolled back. Fix the cause and confirm again.