= 2;
$can_delete = lookupUserPermission('module_sales') >= 3;
$can_edit_lines = billingCanEditItems('quote', $quote);
$mail_ready = !empty($config_smtp_provider) && billingEmailableContacts('quote', $client_id) > 0;
$guest_url = billingGuestUrl('quote', $quote);
// Done long enough ago, its link no longer opens it - emailing it again does (functions/guest_link.php)
$guest_expired = guestLinkExpired('quote', $quote['quote_id']);
$csrf = $_SESSION['csrf_token'];
// The ticket it was raised from, and what the client sent back with their answer
$ticket = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_subject FROM tickets WHERE ticket_quote_id = $quote_id LIMIT 1"));
$files = [];
$sql = mysqli_query($mysqli, "SELECT files.file_id, file_name, file_ext, file_size, file_created_at FROM quote_files JOIN files ON quote_files.file_id = files.file_id
WHERE quote_id = $quote_id AND file_archived_at IS NULL ORDER BY file_name ASC");
while ($row = mysqli_fetch_assoc($sql)) {
$files[] = $row;
}
// Override Tab Title // No Sanitizing needed as this var will only be used in the tab title
$tab_title = $quote['client_name'];
$page_title = $number;
$paper = [
'type' => 'quote',
'row' => $quote,
'items' => $items,
'totals' => $totals,
'edit' => $can_edit_lines,
'ai' => $can_edit_lines && aiReady('Billing'),
'notes_edit' => $can_edit,
'taxes' => $can_edit_lines ? billingTaxes($quote['quote_created_at']) : [],
'logo_url' => billingCompany()['logo_url'],
'csrf' => $csrf,
];
// The banners, with the client's when it was opened without the client around it (functions/agent_banner.php)
echo agentBannersHtml($client_id);
?>