$pdf->addLineFormat($cols); $y = 109; $res = mysql_query("select * from products where invoice='" . $info['id'] . "' order by id asc") or die(mysql_error()); $i = 1; while ($rand = mysql_fetch_array($res)) { unset($tx); $tx = array(); $taxprod = 0; $tx = explode(',', $rand['taxes']); foreach ($tx as $tax) { $pos1 = strpos($tax, '%'); $tm = str_replace('%', '', $tax); if ($pos1 !== false) { $taxprod += $tm * $rand['price'] * $rand['qty'] / 100; } else { $taxprod += $tm; } } $line = array("ID" => $i, $cfg['lang_description'] => substr($rand['title'], 0, 200) . "\n" . substr($rand['description'], 0, 180), $cfg['lang_qty'] => $rand['qty'], $cfg['lang_netprice'] => $rand['price'] * $rand['qty'] . ' ' . $info['currency'], $cfg['lang_taxes'] => $taxprod . ' ' . $info['currency'], $cfg['lang_amount'] => $rand['price'] * $rand['qty'] + $taxprod . " " . $info['currency']); $size = $pdf->addLine($y, $line); $y += $size + 2; $totals += $rand['qty'] * $rand['price']; $taxes += $taxprod; $i++; } $pdf->addTVAs($totals, $taxes, $i); $pdf->addCadreEurosFrancs(); if ($cfg['footer']) { $pdf->footerNote($cfg['footer']); } $pdf->Output(dirname(__FILE__) . '/invoices/' . $_GET['id'] . ".pdf", 'F');