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'); }
$y = receipt_header(80, $y); $y = receipt_buyer(80, $y); $y = receipt_data(80, $y); $y = receipt_footer(80, $y); } break; default: require $template; break; } if (!$receipt['last']) { $id = $pdf->newPage(1, $id, 'after'); } } require_once LIB_DIR . '/pdf.php'; $pdf = init_pdf('A4', 'portrait', trans('Receipts')); $id = $pdf->getFirstPageId(); if (isset($_GET['print']) && $_GET['print'] == 'cached' && sizeof($_POST['marks'])) { $SESSION->restore('rlm', $rlm); $SESSION->remove('rlm'); if (sizeof($_POST['marks'])) { foreach ($_POST['marks'] as $idx => $mark) { $rlm[$idx] = $mark; } } if (sizeof($rlm)) { foreach ($rlm as $mark) { $ids[] = intval($mark); } } if (empty($ids)) {
} $pdf->addtext(15 * $scale + $x, 385 * $scale + $y, $font_size * $scale, trans('Invoice No. $a', $invoice['t_number'])); } function address_box($x, $y, $scale) { global $pdf, $_NAME, $_ADDRESS, $_ZIP, $_CITY, $_SERVICE, $_SHORT_NAME, $invoice; $font_size = 30; while ($pdf->getTextWidth($font_size * $scale, iconv('UTF-8', 'ISO-8859-2', $invoice['name'])) > 240) { $font_size = $font_size - 1; } $pdf->addtext(5 * $scale + $x, 310 * $scale + $y, $font_size * $scale, iconv('UTF-8', 'ISO-8859-2', $invoice['name'])); $pdf->addtext(5 * $scale + $x, 275 * $scale + $y, 30 * $scale, iconv('UTF-8', 'ISO-8859-2', $invoice['address'])); $pdf->addtext(5 * $scale + $x, 240 * $scale + $y, 30 * $scale, iconv('UTF-8', 'ISO-8859-2', $invoice['zip'] . " " . $invoice['city'])); } require_once LIB_DIR . '/pdf.php'; $pdf =& init_pdf('A4', 'portrait', trans('Form of Cash Transfer')); $pdf->setLineStyle(2); $id = $pdf->getFirstPageId(); $control_lines = 0; $ids = $DB->GetCol('SELECT id FROM documents d WHERE cdate >= ? AND cdate <= ? AND type = 1' . (!empty($_GET['customerid']) ? ' AND d.customerid = ' . intval($_GET['customerid']) : '') . (!empty($_GET['numberplanid']) ? ' AND d.numberplanid = ' . intval($_GET['numberplanid']) : '') . (!empty($_GET['groupid']) ? ' AND ' . (!empty($_GET['groupexclude']) ? 'NOT' : '') . ' EXISTS (SELECT 1 FROM customerassignments a WHERE a.customergroupid = ' . intval($_GET['groupid']) . ' AND a.customerid = d.customerid)' : '') . ' AND NOT EXISTS ( SELECT 1 FROM customerassignments a JOIN excludedgroups e ON (a.customergroupid = e.customergroupid) WHERE e.userid = lms_current_user() AND a.customerid = d.customerid)' . ' ORDER BY CEIL(cdate/86400), id', array($_GET['from'], $_GET['to'])); if (!$ids) { $SESSION->close(); die; }
FROM customersview c LEFT JOIN cash ON (c.id = cash.customerid) LEFT JOIN divisions d ON (d.id = c.divisionid) WHERE deleted = 0' . ($customer ? ' AND c.id = ' . $customer : '') . ($group ? ' AND ' . ($exclgroup ? 'NOT' : '') . ' EXISTS (SELECT 1 FROM customerassignments a WHERE a.customergroupid = ' . $group . ' AND a.customerid = c.id)' : '') . ' GROUP BY c.id, c.lastname, c.name, c.address, c.zip, c.city, d.account, d.name, d.address, d.zip, d.city HAVING COALESCE(SUM(cash.value), 0.00) < ? ORDER BY c.id', array(str_replace(',', '.', $balance))); if (!$list) { $SESSION->close(); die; } $_TITLE = ConfigHelper::getConfig('finances.pay_title', trans('Not set')); $_LMARGIN = ConfigHelper::getConfig('finances.leftmargin', 0); $_BMARGIN = ConfigHelper::getConfig('finances.bottommargin', 0); require_once LIB_DIR . '/ezpdf.php'; $pdf = init_pdf('A4', 'landscape', trans('Form of Cash Transfer')); $pdf->setLineStyle(2); //$id = $pdf->getFirstPageId(); $count = sizeof($list); $i = 0; foreach ($list as $row) { main_form(0, 0, $row); main_form(0, 310, $row); main_form(440, 0, $row); main_form(440, 310, $row); $i++; //if($i < $count) $id = $pdf->newPage(1, $id, 'after'); if ($i < $count) { $pdf->newPage(); } }
$fname = tempnam("/tmp", "CSV"); $f = fopen($fname, 'w'); foreach ((array) $data as $key => $val) { $line = ''; $line1 = ''; if ($key == 0) { foreach ((array) $val as $key1 => $val1) { $line1 .= $key1 . ';'; $line .= $val1 . ';'; } $line = substr($line1, 0, -1) . "\n" . $line; } else { foreach ((array) $val as $key1 => $val1) { $line .= $val1 . ';'; } } $line = substr($line, 0, -1) . "\n"; fwrite($f, $line); } fclose($f); header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="cenn.csv"'); readfile($fname); unlink($fname); exit; } require_once LIB_DIR . '/ezpdf.php'; $pdf =& init_pdf('A4', 'portrait', trans('Invoices')); $pdf->ezTable($data, '', '', array('fontSize' => 5)); $pdf->ezStream(); close_pdf($pdf);
$i = 0; foreach (array_keys($_POST['inv']) as $key) { $invoice = $LMS->GetInvoiceContent(intval($key)); $invoice['type'] = $type; $i++; if ($invoice['customerid'] != $SESSION->id) { continue; } if ($i == $count) { $invoice['last'] = TRUE; } invoice_body(); } close_pdf($pdf); die; } $invoice = $LMS->GetInvoiceContent($_GET['id']); if ($invoice['customerid'] != $SESSION->id) { die; } $number = docnumber($invoice['number'], $invoice['template'], $invoice['cdate']); if (!isset($invoice['invoice'])) { $title = trans('Invoice No. $a', $number); } else { $title = trans('Credit Note No. $a', $number); } $pdf =& init_pdf('A4', 'portrait', $title); $invoice['last'] = TRUE; $invoice['type'] = $type; invoice_body(); close_pdf($pdf);
function module_tariff() { global $LMS, $voip; $cnet = 'Cena za minutę połączenia (netto)'; $voip->toiso($cnet); $cbrut = 'Cena za minutę połączenia (brutto)'; $voip->toiso($cbrut); $taxes = $LMS->GetTaxes(); $tax = 23; if (is_array($taxes)) { foreach ($taxes as $val) { if ($val['id'] == $voip->config['taxid']) { $tax = $val['value']; } } } setlocale(LC_TIME, "C"); $sip = $voip->GetNode($_GET['id']); $exp = $voip->wsdl->CennExport($sip['id_tariffs']); $data = array(); $i = 1; $suma = 0; $poz = 0; if (is_array($exp)) { foreach ($exp as $val) { $el = array(); $el['L.p.'] = $i++; $el['Kierunek'] = $val['desc']; if ($val['days'] == 510 && $val['from'] == '00:00' && $val['to'] == '23:59') { $el['Kiedy'] = 'zawsze'; } else { $x = decbin($val['days']); $x = sprintf('%09s', $x); $x = $voip->str_split($x); $el['Kiedy'] = $val['from'] . '-' . $val['to'] . "\n" . $voip->wsdl->days($x); } $koszt = $val['price'] * 60; $el[$cnet] = sprintf("%.3f", round($koszt, 3)); $koszt = $koszt * ($tax / 100) + $koszt; $el[$cbrut] = sprintf("%.3f", round($koszt, 3)); $data[] = $voip->toiso($el); } } if ($_GET['csv']) { $fname = tempnam("/tmp", "CSV"); $f = fopen($fname, 'w'); foreach ((array) $data as $key => $val) { $line = ''; $line1 = ''; if ($key == 0) { foreach ((array) $val as $key1 => $val1) { $line1 .= $key1 . ';'; $line .= $val1 . ';'; } $line = substr($line1, 0, -1) . "\n" . $line; } else { foreach ((array) $val as $key1 => $val1) { $line .= $val1 . ';'; } } $line = substr($line, 0, -1) . "\n"; fwrite($f, $line); } fclose($f); header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="cenn.csv"'); readfile($fname); unlink($fname); exit; } require_once LIB_DIR . '/ezpdf.php'; $pdf = init_pdf('A4', 'portrait', trans('Invoices')); $pdf->ezTable($data, '', '', array('fontSize' => 5)); $pdf->ezStream(); close_pdf($pdf); exit; }