$parts_total = $totals['parts'] ?? 0; $stmt = $pdo->prepare(" INSERT INTO workorders (customer_id, unit_id, km, tech_notes, labor_rate, labor_subtotal, parts_total, shop_supplies, enviro_fee, tire_levy, discount, gst, total, status, internal_notes, payment_status, created_at) VALUES (?, ?, 0, '', 0, ?, ?, ?, ?, 0, 0, ?, ?, ?, '', 'Unpaid', NOW()) "); $stmt->execute([ $customerId, $unitId, $labor_subtotal, $parts_total, $shop_supplies, $enviro_fee, $gst, $total, $status ]);