<?php include '../scat.php'; include '../lib/item.php'; $id = (int) $_REQUEST['id']; $code = $_REQUEST['code']; if (!$id && $code) { $code = $db->escape($code); $q = "SELECT id FROM item WHERE code = '{$code}'"; $id = $db->get_one($q); } if (!$id) { die_jsonp("No item specified."); } $item = item_load($db, $id); echo jsonp(array('item' => $item));
<?php include '../scat.php'; include '../lib/item.php'; include '../lib/fpdf/alphapdf.php'; include '../lib/php-barcode.php'; if ($q = $_REQUEST['q']) { $items = item_find($db, $q, 0); if (!$items) { die_json("No items found."); } } else { $id = (int) $_REQUEST['id']; $items = array(item_load($db, $id)); if (!$items[0]) { die_json("No such item."); } } $trim = $_REQUEST['trim']; $left_margin = 0.2; $label_width = 2.0; $label_height = 0.75; $basefontsize = 9; $vmargin = 0.1; $dummy = new AlphaPDF('P', 'in', array($label_width, $label_height)); $pdf = new AlphaPDF('P', 'in', array($label_width, $label_height)); foreach ($items as $item) { $pdf->AddPage(); $pdf->Rotate(270); $pdf->SetFont('Helvetica', ''); $pdf->SetFontSize($size = $basefontsize);