ModulesDocketsCSV Export

Docket CSV Export

The Docket Workbench can export billed pricing detail for any filter set as a long-format CSV — one row per (docket × pricing line × cost-code cell). Day-works rows are added with resource_type=dayworks.

How to export

  1. Apply filters on the Labour & Plant, Materials, or Day Works tab.
  2. Click Export CSV (top right of the filter bar).
  3. Switch to the Exports tab and watch the status flip from pending → running → completed.
  4. Click Download to grab the CSV.

Clicking Export CSV again with the same filters while an export is still pending or running brings back that export — it does not start a second one.

If an export fails

A failed export shows why when you hover its status, and has a Retry button that runs it again with the same filters.

MessageWhat happened
Export couldn't start — please retryThe export was saved but never began.
Export interrupted — please retryThe export stopped part-way and will not finish.
Export failed — please retryThe file could not be built or saved.

On the phone

Dockets → Exports lists the same exports. A failed one shows its reason under the status, with Retry (same filters) and Remove.

Starting an export — New Export or Retry — says what happened:

ToastWhen
Export startedThe export is pending or running.
Export readyAn export with the same filters is already completed.
Export failed + the reason aboveThe export was saved but couldn’t start.
Export failed + why the request failedThe request never reached the server, or was refused.
Export limit reached5 exports are already running.

The Export button on the phone’s Labour & Plant, Subcontractor and Materials lists shows the same reason when its export fails.

An export never sits on pending or running for long:

  • Each export runs on its own. Deleting a pending or running export stops it, and starting the same filters again always starts a fresh run.
  • An export that is still running is left to finish, for up to 30 minutes.
  • An export that has stopped is marked failed within about 10 minutes.

Exports expire 30 days after they’re started. The Exports tab shows the last 90 days of jobs you have requested.

For the full cost ledger with totals, use the Combined Report.

Reconciliation rules

Use only these formulas. amount is the engine’s pre-headcount line subtotal — useful as a reference, NOT for SUM math.

You wantFormula
Per-row billed dollarsunit_qty × line_rate × headcount
Per-docket grand total (worker + plant + material)SUMPRODUCT(unit_qty, line_rate, headcount) where resource_type IN ('worker', 'plant', 'material'), grouped by docket_no
Per-cost-code spendSUMPRODUCT(unit_qty, line_rate, headcount) GROUP BY cost_code
Per-resource hours / unitsSUM(unit_qty) GROUP BY docket_no + resource_name + cost_code
Day-works total (separate from grand_total)SUM(amount) WHERE resource_type='dayworks'

Reconciliation precision caveat

unit_qty for prorate-mode lines (typically plant hire and allowances) is rounded to 4 decimal places per synthesised cell. SUMPRODUCT therefore ties to grand_total to within $0.01 per prorate line — usually under a few cents per docket. For cent-exact docket totals, dedupe by line_id per docket and sum the amount column.

Manual-mode lines (workers, plant on manual mode) reconcile exactly — parity-tested against the ERP/GRN export pipeline.

Supplier columns

Every row carries two supplier pairs, and they mean different things.

ColumnsMeans
supplier_org_id, supplier_nameThe docket’s supplier — who the docket is booked against.
line_supplier_org_id, line_supplier_nameThe line’s supplier — who actually did this piece of work and is paid for it.

On an ordinary docket the two pairs are identical, because a docket carries one worker and therefore one supplier. On a subcontractor master they can differ: a master can carry workers engaged under more than one subcontractor, and each worker’s line is paid to the subcontractor who engaged them. Use line_supplier_name when you are working out who to pay; use supplier_name when you are working out which docket a row came from.

Day-works rows, materials and plant carry the docket’s supplier in both pairs — they have no per-worker engagement to resolve.

Filtering the export by supplier returns a docket if either its own supplier or any of its line suppliers matches, so filtering by a subcontractor no longer hides a master that carries their crew but is booked against someone else.

Column positions changed

line_supplier_org_id and line_supplier_name are appended at the end of the fixed columns, immediately after unit_qty. Every pre-existing fixed column keeps its position, so a sheet that reads supplier_name or amount by column number is unaffected.

The custom-field columns (cf_…) move two columns to the right. If a downstream process reads custom fields by column number rather than by header name, update it before taking a new export.

Times

  • submitted_at, reviewed_at, confirmed_at and exported_at are the project’s time with its offset, for example 2026-04-07T08:10:00+10:00.
  • start_time and end_time are the shift as entered, ending in Z: a 7:00 am start is 2026-04-07T07:00:00Z. Read the clock as it is. Do not convert it.

See Dates & Times.

What’s NOT in the CSV

  • Removed / tombstoned / stale pricing rows — by design.
  • The day-works total is separate from grand_total. Day-works rows appear as resource_type='dayworks' with cost_code blank.
  • Soft-deleted dockets — excluded.

Security note

The download link grants access to anyone with the URL until the export expires (30 days). Do not share it externally. The URL is unguessable (it embeds a UUID), but a leaked URL exposes the data until the cleanup workflow sweeps it. Future versions will use presigned URLs with a 24-hour TTL.

Where the data comes from

The export reflects billed truth exactly as ERP push consumes it. The worker/plant/material rows pattern after LoadDocketPricingLineCellsForGRN (the canonical billing flatten query); manual-mode rows are parity-tested. Prorate-mode lines are synthesised from docket_activity_hours using the same proportion math RecomputeDocketTotalsFromMatrix applies.

Limits

  • 500,000 rows max per export. Larger exports fail at click time (HTTP 413). Narrow filters (date range, supplier, status) to bring the count down.
  • 5 concurrent exports per user max. The 6th submission returns HTTP 429 until one of the in-flight exports finishes.
  • Soft-deleted exports are reaped by the daily cleanup workflow.
  • An export runs for at most 30 minutes; one still unfinished after that is marked failed and can be retried.