if ($invoice->invoice_to_customer_id > 0) { $customer = getCustomer($invoice->invoice_to_customer_id); if (count($customer)) { $invoice->invoice_to_customer_name = $customer['customer_name']; } } } } } require "include/invoice_menu.php"; if (isset($preview) && $preview) { echo '<h1>Forhåndsvisning</h2>'; echo '<b>(Opprettelse forsetter under)</b><br>'; echo '<div style="border: 1px solid black; overflow: auto; width: 800px; height: 400px;">'; $smarty = new Smarty(); templateAssignInvoice('smarty', $invoice); templateAssignSystemvars('smarty'); $smarty->assign('invoice_heading', 'Forhåndsvisning av faktura'); $smarty->assign('invoice_css', 'invoice_css.css'); $smarty->display('file:invoice.tpl'); echo '</div>'; } echo '<h1>Opprett faktura</h1>' . chr(10); echo '<script language="javascript" src="js/jquery-1.3.2.min.js"></script>' . chr(10); //echo nl2br(str_replace(' ', '_ ', print_r($invoice, 1))); echo '<form method="post" name="invoiceform" action="' . $_SERVER['PHP_SELF'] . '">' . chr(10); if (count($invoice->invoice_idlinks)) { $datafrom_string = 'Fakturadata hentet fra' . chr(10); foreach ($invoice->invoice_idlinks as $link) { list($idtype, $id) = explode('=', $link); $datafrom_string .= '- ';
function createPDF() { global $smarty; $smarty = new Smarty(); templateAssignInvoice('smarty', $this); templateAssignSystemvars('smarty'); $smarty->assign('invoice_heading', 'Faktura'); $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($smarty->fetch('file:invoice.tpl')); $pdf->Output('invoice/invoice' . $this->invoice_id . '.pdf'); $smarty->assign('invoice_heading', 'Fakturakopi'); $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($smarty->fetch('file:invoice.tpl')); $pdf->Output('invoice/invoice' . $this->invoice_id . '_copy.pdf'); }