include $_SERVER['DOCUMENT_ROOT'] . "/WebBuilder/main.class.php"; if (isset($_GET['record_id'])) { $db = new DBMain(); $mpdf = new \Mpdf\Mpdf([ 'margin_top' => 5, // Set your desired top margin in millimeters 'margin_bottom' => 1, 'margin_left' => 1, 'margin_right' => 1, ]); $mpdf->Addpage('L'); $stylesheet = file_get_contents('Styles/pdf.css'); $mpdf->WriteHTML($stylesheet, \Mpdf\HTMLParserMode::HEADER_CSS); $client_id = $_GET['record_id']; $client_res = $db->exec_query("clients", ['*'], '', '', '', '', "record_id = '$client_id'"); $client = $client_res->fetch_assoc(); $client_name = $client['clients_name']; $invoices_res = $db->exec_query("invoices", ['*'], '', '', '', '', "clients_id = '$client_id'"); $table_data = '
INVOICE NO |
INVOICE TOTAL |
PAYMENTS TOTAL |
NET |
DATE |
|---|---|---|---|---|
| $invoices[invoice_no] | R " . number_format($invoice_total, 2) . " | R " . number_format($payments_total, 2) . " | R " . number_format($net, 2) . " | $invoices[date_created] |
| TOTALS | R " . number_format($invoice_global_total, 2) . " | R " . number_format($payments_golbal_total, 2) . " | R " . number_format($net_total, 2) . " |