<?php
require_once __DIR__ . '/../../app/includes/auth.php'; require_auth();
require __DIR__ . '/render.php';
$id = (int)($_GET['id'] ?? 0);
$stmt = db()->prepare('SELECT q.*, c.customer_name, c.phone, c.email, c.address, c.location, u.name prepared_by, u.role as creator_role FROM quotations q JOIN customers c ON c.id=q.customer_id JOIN users u ON u.id=q.created_by WHERE q.id=?');
$mode = (string)($_GET['mode'] ?? 'customer');
log_activity('quotation.printed', 'Printed quotation #' . $id);
echo render_quotation($id, false, $mode);
