Everything needed to run a real load end-to-end — quote → invoice → QuickBooks. Check items off as they're completed.
detention_rate_per_hr) on customer record, system default fallback. Add to customer file.net_terms) on customer record, default Net 30. Add to customer file.gl_account field on accessorial_types table + freight GL account as a system setting.credit_limit + outstanding_balance fields on customers table. Webhook post-beta.opStopTab(): if(_op.stops[stop-1]) _op.stops[stop-1].activeSubTab = name; 1-line fixsent, Driver dispatched → dispatched, CDL verified → verified, ARRIVED shipper → at_shipper, DONE at shipper → in_transit, ARRIVED consignee → at_consignee, BOL submitted → delivered codeemail_body column exists on orders, just needs to render as a collapsible card codeassign-driver.html — dispatcher-facing page to enter driver name + cell; sets status = 'awaiting_driver'; sends dispatch SMS to driver codeassign_driver_token, last_driver_chase_at on orders table SQLawaiting_driver; sends chaser messages to carrier dispatch on schedule coderate_con_signed_at is null; show warning or hard block codedriver-checkin.html already captures the photo; wire upload to Supabase Storage (carrier-docs bucket) + write bol_upload_url to order codestatus → delivered trigger — fires in sms-webhook.js when sms_state = 'completed' (or BOL confirmed); writes load_events row codeinvoices table — id, order_id, invoice_number (HPL-INV-XXXX), customer_id, status (draft/sent/paid/void), freight_charge, accessorial_lines (jsonb), detention_charge, total_amount, invoice_date, due_date, paid_at, invoice_pdf_url, qbo_invoice_id, qbo_synced_at SQLdetention_start_shipper/consignee from order; compute billable hours (>2hr free); apply rate from [source — decide before building] codeapi/generate-invoice.js — uses pdf-lib (already installed); pulls customer, freight charge, accessorials, detention, order details; generates PDF; uploads to Supabase Storage; writes invoice_pdf_url codeapi/send-invoice.js — sends PDF as email attachment via Graph API; writes status = 'sent' and customer_communications row codehttps://loadboard.cptms.com/api/qbo-callback DavidQBO_CLIENT_ID, QBO_CLIENT_SECRET, QBO_REDIRECT_URI, QBO_REALM_ID Davidapi/qbo-auth.js, api/qbo-callback.js, api/_qbo-client.js (token refresh helper), qbo_tokens table, "Connect to QuickBooks" setup page codeapi/qbo-sync-customer.js (find or create customer), api/qbo-push-invoice.js (post invoice with line items on send), sync status badge in order panel invoice tab (✅ Synced / ⚠ Not synced / ❌ Failed + Retry) codeinvoices.paid_at, amount, payment method; status → closed; closed loads filter on board codedocument_capture_types, order_documents, document_capture_requests, document_type_role_notifications. Add OS&D role to roles table. Add interested_party to order_contacts constraint. Seed 8 built-in types (CDL front/back, door, trailer, seal, BOL, scale ticket, OS&D) all with active=false. SQL — David runsapi/_stamp-image.js: takes image buffer, doc type label, order/carrier ref, server timestamp; burns small header into top-right corner; returns stamped buffer. Wire into storePhoto() immediately so every upload from this point forward is stamped automatically — CDL, door, and all future types. Two flavors: order docs (HPL-1234 · CDL Front · [date/time]) and carrier onboarding docs ([Carrier Name] · Received [date/time]). codeGET /api/document-capture-types endpoint. Files & Master Data UI: table of types with add/edit modal (label, slug, category, color mode, resolution, quality, barcode decode, AI extract, active toggle, role notifications, external notification, invoice inclusion). New types addable from UI with zero code changes. codedriver-checkin.html reads type config from API dynamically (no hardcoded type logic). jscanify guided camera capture — auto-fires when document stable ~1 sec. Color/grayscale/BW applied per config. POST /api/capture-document receives image, stamps it, stores in order_documents, fires notifications (Relay DM to roles + email to order contacts). codePOST /api/send-doc-request). Dispatcher manual upload path for docs arriving by email or from customer. Include-with-invoice toggle per doc. codepod_url. Attaches to invoice automatically. Raw original and stamped working copy stored separately for dispute protection. codebol_upload_url, door_photo_url, seal_photo_url, etc.) after full E2E test of new system passes on a real load. SQL + code