function invoice_create_pdf_file($docid, $output) { global $pdf, $LMS, $invoice; $pdf = init_pdf('A4', 'portrait', trans('Invoices')); $invoice = $LMS->GetInvoiceContent($docid); $which = array(); if (!empty($_GET['original'])) { $which[] = trans('ORIGINAL'); } if (!empty($_GET['copy'])) { $which[] = trans('COPY'); } if (!empty($_GET['duplicate'])) { $which[] = trans('DUPLICATE'); } if (!sizeof($which)) { $tmp = explode(',', $CONFIG['invoices']['default_printpage']); foreach ($tmp as $t) { if (trim($t) == 'original') { $which[] = trans('ORIGINAL'); } elseif (trim($t) == 'copy') { $which[] = trans('COPY'); } elseif (trim($t) == 'duplicate') { $which[] = trans('DUPLICATE'); } } if (!sizeof($which)) { $which[] = ''; } } $count = sizeof($which); $i = 0; foreach ($which as $type) { $i++; if ($i == $count) { $invoice['last'] = TRUE; } if ($invoice['version'] == '2') { invoice_body_v2(); } else { invoice_body(); } } $pdf->output($output, 'F'); }
invoice_body_v2(); } else { invoice_body(); } } } elseif (!empty($_POST['inv'])) { $pdf = init_pdf('A4', 'portrait', trans('Invoices')); $count = count($_POST['inv']); $i = 0; foreach (array_keys($_POST['inv']) as $key) { $invoice = $LMS->GetInvoiceContent(intval($key)); $i++; if ($invoice['customerid'] != $SESSION->id) { continue; } if ($i == $count) { $invoice['last'] = TRUE; } if ($invoice['version'] == '2') { invoice_body_v2(); } else { invoice_body(); } } close_pdf($pdf); die; } //else { // $SESSION->redirect('?m=invoicelist'); //} close_pdf($pdf);