Example #1
11
 private function printPDF($customer_id, $post_device, $post_user, $comment, $username, $randomcode, $date)
 {
     require_once Mage::getBaseDir('lib') . '/tcpdf/tcpdf.php';
     // create new PDF docume, nt
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // set font
     $pdf->SetFont('helvetica', '', 11);
     // add a page
     $pdf->AddPage();
     $pdf->setJPEGQuality(100);
     // set cell padding
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->SetLineWidth(0.2);
     // set cell margins
     $pdf->setCellMargins(0, 0, 0, 0);
     $pdf->setCellHeightRatio(1);
     // set color for background
     $pdf->SetFillColor(255, 255, 255);
     // Multicell
     // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
     // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(50, 0, 'SERVISNI LIST - REVERS', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->MultiCell(100, 0, 'GAMEBOX, Cara DuŔana 47, NiŔ - tel 018/514-666 - 060/514-666-0', 0, 'L', 1, 0, 80, $pdf->getY() + 1, true, 0, false);
     // Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
     // $pdf->Image(dirname(__FILE__). '/bcimages/'. $randkey . '.png',80,8,100,8,'','','',true);
     $pdf->Image(Mage::getBaseDir('media') . '/pdf/gbr.png', 182, 10, 20, 60, '', '', '', true);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 8);
     $pdf->Cell(70, 6, 'Naziv uredjaja', 0, 0, 'L', 0);
     $pdf->Cell(40, 6, 'Serijski broj', 0, 0, 'L', 0);
     $pdf->Cell(60, 6, 'Opis kvara', 0, 0, 'L', 0);
     $pdf->Ln();
     $i = 1;
     foreach ($post_device as $key => $post) {
         if ($i == 1) {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'LT', 'L', 1, 0, 10, '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 'T', 'L', 1, 0, 80, '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'TR', 'L', 1, 0, 120, '', true, 0, false);
         } else {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'L', 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 0, 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'R', 'L', 1, 0, '', '', true, 0, false);
         }
         $pdf->Ln();
         ++$i;
     }
     //$pdf->MultiCell(70, 15, ' 1. ' . $naziv1, 'LT', 'L', 1, 0, 10, '', true, 0, false);
     //$pdf->MultiCell(40, 15, $_POST['sn1'], 'T', 'L', 1, 0, 80, '', true, 0, false);
     //$pdf->MultiCell(60, 15, $opis1, 'TR', 'L', 1, 0, 120, '', true, 0, false);
     //$pdf->Ln();
     $pdf->MultiCell(70, 1, ' ', 'LB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(40, 1, ' ', 'B', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(60, 1, ' ', 'RB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Dodatna uputstva / komentari', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(170, 5, $comment, 'TRLB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Na servis predao', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Ime:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['name'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Datum i vreme prijema:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $date, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Email:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['email'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Kontrolni kod:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $randomcode, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Telefon:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['phone'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(120, 6, 'Pratite stanje VaŔeg uredjaja na servisu.<br>Posetite <b>http://proveraservisa.gamebox.co.rs/</b> i unesite VaŔ kontrolni kod<br />ili skenirajte <b>QR</b> kod pomocu VaŔeg mobilnog telefona', 0, 'L', 1, 0, 70, '', true, 0, true);
     $pdf->Ln();
     $pdf->Ln(3);
     $pdf->MultiCell(110, 10, "\n" . Mage::getStoreConfig('servisnilist/text/upozorenje'), 1, 'C', 1, 0, 50, '', true, 0, false);
     $pdf->Ln();
     if (count($post_device) == 1) {
         $pdf->Ln();
     }
     $pdf->Ln(5);
     $pdf->Image(Mage::getBaseDir('media') . '/pdf/cut-here.png', 3, '', 250, 3, '', '', '', false, 300, '', false, false, 0, true);
     $pdf->Ln(9);
     $x = $pdf->GetX();
     $y = $pdf->GetY();
     // bottom part
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(50, 8, 'SERVISNI LIST - REVERS', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->MultiCell(100, 0, 'GAMEBOX, Cara DuŔana 47, NiŔ - tel 018/514-666 - 060/514-666-0', 0, 'L', 1, 0, 80, '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 8);
     $pdf->Cell(70, 6, 'Naziv uredjaja', 0, 0, 'L', 0);
     $pdf->Cell(40, 6, 'Serijski broj', 0, 0, 'L', 0);
     $pdf->Cell(60, 6, 'Opis kvara', 0, 0, 'L', 0);
     $pdf->Ln();
     $i = 1;
     foreach ($post_device as $key => $post) {
         if ($i == 1) {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'LT', 'L', 1, 0, 10, '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 'T', 'L', 1, 0, 80, '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'TR', 'L', 1, 0, 120, '', true, 0, false);
         } else {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'L', 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 0, 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'R', 'L', 1, 0, '', '', true, 0, false);
         }
         $pdf->Ln();
         ++$i;
     }
     $pdf->MultiCell(70, 1, ' ', 'LB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(40, 1, ' ', 'B', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(60, 1, ' ', 'RB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Dodatna uputstva / komentari', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(170, 5, $comment, 'TRLB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Obracun', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 6, 'Materijal', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'j. mere', 0, 0, 'L', 0);
     $pdf->Cell(15, 6, 'kolicina', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'cena', 0, 0, 'L', 0);
     $pdf->Cell(25, 6, 'UKUPNO', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(15, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(25, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 6, 'Opis usluge', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'j. mere', 0, 0, 'L', 0);
     $pdf->Cell(15, 6, 'kolicina', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'cena', 0, 0, 'L', 0);
     $pdf->Cell(25, 6, 'UKUPNO', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(15, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(25, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(60, 6, 'SVEGA:', 'B', 'L', 1, 0, 120, $pdf->getY() + 1, true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Na servis predao', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Ime:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['name'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Datum i vreme prijema:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $date, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Email:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['email'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Kontrolni kod:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $randomcode, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Telefon:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['phone'], 0, 'L', 1, 0, 25, '', true, 0, false);
     //$pdf->Image(dirname(__FILE__) . '/bcimages/' . $randkey . '.png', 66, $pdf->getY() - 2, 100, 8, '', '', '', true, 300, '', false, false, 0, false);
     // $pdf->MultiCell(120, 6, 'Pratite stanje Vaseg uredjaja na servisu.<br>Posetite <b>http://bengazi.com/proveraservisa</b> i unesite Vas kontrolni kod' ,0, 'L', 1, 0, 70, '', true, 0, true);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Potpis:', 0, 'L', 1, 0, '', '', true, 0, false);
     // CODE 128 B
     // define barcode style
     $style1d = array('position' => 'S', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => '35', 'vpadding' => '30', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     $pdf->setXY(180, $y + 35);
     //155
     $pdf->StartTransform();
     $pdf->Rotate(90);
     $pdf->write1DBarcode($randomcode, 'C128B', '', '', '', 14, 0.5, $style1d, 'T');
     $pdf->StopTransform();
     // new style
     $styleQR = array('border' => false, 'padding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false);
     // QRCODE,H : QR-CODE Best error correction
     $pdf->write2DBarcode('http://proveraservisa.gamebox.co.rs/?kk=' . $randomcode, 'QRCODE,H', 184, 75, 50, 50, $styleQR, 'N');
     // QRCODE,H : QR-CODE Best error correction
     $pdf->write2DBarcode(Mage::getBaseUrl() . 'servisnilist/status/qr/slid/' . $customer_id, 'QRCODE,H', 184, $y + 65, 50, 50, $styleQR, 'N');
     // Close and output PDF document
     $pdf->IncludeJS('print();');
     // die('y');
     //ob_clean(); //stupid tcpdf need this
     $pdf->Output('trt.pdf', 'I');
     exit;
 }
Example #2
2
 public function testPdfOutput()
 {
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 027');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 027', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set a barcode on the page footer
     $pdf->setBarcode('2015-06-18 09:12:27');
     // set font
     $pdf->SetFont('helvetica', '', 11);
     // add a page
     $pdf->AddPage();
     // print a message
     $txt = "You can also export 1D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcodes directory.\n";
     $pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
     $pdf->SetY(30);
     // -----------------------------------------------------------------------------
     $pdf->SetFont('helvetica', '', 10);
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     // PRINT VARIOUS 1D BARCODES
     // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
     $pdf->Cell(0, 0, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1);
     $pdf->write1DBarcode('CODE 39', 'C39', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 39 + CHECKSUM
     $pdf->Cell(0, 0, 'CODE 39 + CHECKSUM', 0, 1);
     $pdf->write1DBarcode('CODE 39 +', 'C39+', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 39 EXTENDED
     $pdf->Cell(0, 0, 'CODE 39 EXTENDED', 0, 1);
     $pdf->write1DBarcode('CODE 39 E', 'C39E', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 39 EXTENDED + CHECKSUM
     $pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1);
     $pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 93 - USS-93
     $pdf->Cell(0, 0, 'CODE 93 - USS-93', 0, 1);
     $pdf->write1DBarcode('TEST93', 'C93', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // Standard 2 of 5
     $pdf->Cell(0, 0, 'Standard 2 of 5', 0, 1);
     $pdf->write1DBarcode('1234567', 'S25', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // Standard 2 of 5 + CHECKSUM
     $pdf->Cell(0, 0, 'Standard 2 of 5 + CHECKSUM', 0, 1);
     $pdf->write1DBarcode('1234567', 'S25+', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // Interleaved 2 of 5
     $pdf->Cell(0, 0, 'Interleaved 2 of 5', 0, 1);
     $pdf->write1DBarcode('1234567', 'I25', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // Interleaved 2 of 5 + CHECKSUM
     $pdf->Cell(0, 0, 'Interleaved 2 of 5 + CHECKSUM', 0, 1);
     $pdf->write1DBarcode('1234567', 'I25+', '', '', '', 18, 0.4, $style, 'N');
     // add a page ----------
     $pdf->AddPage();
     // CODE 128 AUTO
     $pdf->Cell(0, 0, 'CODE 128 AUTO', 0, 1);
     $pdf->write1DBarcode('CODE 128 AUTO', 'C128', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 128 A
     $pdf->Cell(0, 0, 'CODE 128 A', 0, 1);
     $pdf->write1DBarcode('CODE 128 A', 'C128A', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 128 B
     $pdf->Cell(0, 0, 'CODE 128 B', 0, 1);
     $pdf->write1DBarcode('CODE 128 B', 'C128B', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 128 C
     $pdf->Cell(0, 0, 'CODE 128 C', 0, 1);
     $pdf->write1DBarcode('0123456789', 'C128C', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // EAN 8
     $pdf->Cell(0, 0, 'EAN 8', 0, 1);
     $pdf->write1DBarcode('1234567', 'EAN8', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // EAN 13
     $pdf->Cell(0, 0, 'EAN 13', 0, 1);
     $pdf->write1DBarcode('1234567890128', 'EAN13', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // UPC-A
     $pdf->Cell(0, 0, 'UPC-A', 0, 1);
     $pdf->write1DBarcode('12345678901', 'UPCA', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // UPC-E
     $pdf->Cell(0, 0, 'UPC-E', 0, 1);
     $pdf->write1DBarcode('04210000526', 'UPCE', '', '', '', 18, 0.4, $style, 'N');
     // add a page ----------
     $pdf->AddPage();
     // 5-Digits UPC-Based Extension
     $pdf->Cell(0, 0, '5-Digits UPC-Based Extension', 0, 1);
     $pdf->write1DBarcode('51234', 'EAN5', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // 2-Digits UPC-Based Extension
     $pdf->Cell(0, 0, '2-Digits UPC-Based Extension', 0, 1);
     $pdf->write1DBarcode('34', 'EAN2', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // MSI
     $pdf->Cell(0, 0, 'MSI', 0, 1);
     $pdf->write1DBarcode('80523', 'MSI', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // MSI + CHECKSUM (module 11)
     $pdf->Cell(0, 0, 'MSI + CHECKSUM (module 11)', 0, 1);
     $pdf->write1DBarcode('80523', 'MSI+', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODABAR
     $pdf->Cell(0, 0, 'CODABAR', 0, 1);
     $pdf->write1DBarcode('123456789', 'CODABAR', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // CODE 11
     $pdf->Cell(0, 0, 'CODE 11', 0, 1);
     $pdf->write1DBarcode('123-456-789', 'CODE11', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // PHARMACODE
     $pdf->Cell(0, 0, 'PHARMACODE', 0, 1);
     $pdf->write1DBarcode('789', 'PHARMA', '', '', '', 18, 0.4, $style, 'N');
     $pdf->Ln();
     // PHARMACODE TWO-TRACKS
     $pdf->Cell(0, 0, 'PHARMACODE TWO-TRACKS', 0, 1);
     $pdf->write1DBarcode('105', 'PHARMA2T', '', '', '', 18, 2, $style, 'N');
     // add a page ----------
     $pdf->AddPage();
     // IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
     $pdf->Cell(0, 0, 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200', 0, 1);
     $pdf->write1DBarcode('01234567094987654321-01234567891', 'IMB', '', '', '', 15, 0.6, $style, 'N');
     $pdf->Ln();
     // POSTNET
     $pdf->Cell(0, 0, 'POSTNET', 0, 1);
     $pdf->write1DBarcode('98000', 'POSTNET', '', '', '', 15, 0.6, $style, 'N');
     $pdf->Ln();
     // PLANET
     $pdf->Cell(0, 0, 'PLANET', 0, 1);
     $pdf->write1DBarcode('98000', 'PLANET', '', '', '', 15, 0.6, $style, 'N');
     $pdf->Ln();
     // RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
     $pdf->Cell(0, 0, 'RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)', 0, 1);
     $pdf->write1DBarcode('SN34RD1A', 'RMS4CC', '', '', '', 15, 0.6, $style, 'N');
     $pdf->Ln();
     // KIX (Klant index - Customer index)
     $pdf->Cell(0, 0, 'KIX (Klant index - Customer index)', 0, 1);
     $pdf->write1DBarcode('SN34RDX1A', 'KIX', '', '', '', 15, 0.6, $style, 'N');
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // TEST BARCODE ALIGNMENTS
     // add a page
     $pdf->AddPage();
     // set a background color
     $style['bgcolor'] = array(255, 255, 240);
     $style['fgcolor'] = array(127, 0, 0);
     // Left position
     $style['position'] = 'L';
     $pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Center position
     $style['position'] = 'C';
     $pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Right position
     $style['position'] = 'R';
     $pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
     $style['fgcolor'] = array(0, 127, 0);
     $style['position'] = '';
     $style['stretch'] = false;
     // disable stretch
     $style['fitwidth'] = false;
     // disable fitwidth
     // Left alignment
     $style['align'] = 'L';
     $pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Center alignment
     $style['align'] = 'C';
     $pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Right alignment
     $style['align'] = 'R';
     $pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
     $style['fgcolor'] = array(0, 64, 127);
     $style['position'] = '';
     $style['stretch'] = false;
     // disable stretch
     $style['fitwidth'] = true;
     // disable fitwidth
     // Left alignment
     $style['cellfitalign'] = 'L';
     $pdf->write1DBarcode('LEFT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Center alignment
     $style['cellfitalign'] = 'C';
     $pdf->write1DBarcode('CENTER', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Right alignment
     $style['cellfitalign'] = 'R';
     $pdf->write1DBarcode('RIGHT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
     $style['fgcolor'] = array(127, 0, 127);
     // Left alignment
     $style['position'] = 'L';
     $pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Center alignment
     $style['position'] = 'C';
     $pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     $pdf->Ln(2);
     // Right alignment
     $style['position'] = 'R';
     $pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // TEST BARCODE STYLE
     // define barcode style
     $style = array('position' => '', 'align' => '', 'stretch' => true, 'fitwidth' => false, 'cellfitalign' => '', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 128), 'bgcolor' => array(255, 255, 128), 'text' => true, 'label' => 'CUSTOM LABEL', 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     // CODE 39 EXTENDED + CHECKSUM
     $pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1);
     $pdf->SetLineStyle(array('width' => 1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)));
     $pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 120, 25, 0.4, $style, 'N');
     $this->comparePdfs($pdf);
 }
Example #3
1
$pdf->SetFont('helvetica', '', 11);
// add a page
$pdf->AddPage();
// print a message
//$txt = "You can also export 1D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcodes directory.\n";
//$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
//$pdf->SetY(30);
// -----------------------------------------------------------------------------
$pdf->SetFont('helvetica', '', 10);
// define barcode style
$style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
// Standard 2 of 5
//$pdf->Cell(0, 0, 'PUNTO MODA', 0, 1);
//$pdf->write1DBarcode('TECHNO', 'S25', '', '', '', 18, 0.4, $style, 'N');
//$pdf->Ln();
// set a background color
//$style['bgcolor'] = array(255,255,240);
//$style['fgcolor'] = array(127,0,0);
$pdf->Cell(1, 1, 'PUNTO MODA', 0, 2, 'L');
$style['position'] = 'L';
$pdf->write1DBarcode('LEFT', 'C128A', 10, '', '', 20, 0.4, $style, 'N');
//$pdf->Ln();
//$pdf->Cell(1, 1, 'PUNTO MODA', 0, 2,'L');
//$style['position'] = 'L';
//$pdf->write1DBarcode('LEFT', 'C128A', 100, '', '', 20, 0.4, $style, 'N');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_027.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Example #4
0
 $pdf->Cell(6.4, 0.4, "" . $datos[$fila][6] . "", 0, 0, 'C');
 //distrito
 $pdf->Ln();
 //octava fila
 //$fila=$f;
 $pdf->Cell(6.4, 3.3, "", 0, 0, 'C');
 $pdf->Cell(0.8, 3.3, "", 0, 0, 'C');
 //$fila=$f+1;
 $pdf->Cell(6.4, 3.3, "", 0, 0, 'C');
 $pdf->Cell(0.8, 3.3, "", 0, 0, 'C');
 //$fila=$f+2;
 $pdf->Cell(6.4, 3.3, "", 0, 0, 'C');
 $pdf->Ln();
 //novena fila CODIGO DE BARRAS
 $fila = $f;
 $pdf->write1DBarcode("" . $datos[$fila][0] . "", "C39", '', '', 6.4, 0.5, 0.03, $style, 'M');
 $pdf->Cell(0.8, 0.7, " ", 0, 0, 'C');
 $fila = $f + 1;
 $pdf->write1DBarcode("" . $datos[$fila][0] . "", "C39", '', '', 6.4, 0.5, 0.03, $style, 'M');
 $pdf->Cell(0.8, 0.7, " ", 0, 0, 'C');
 $fila = $f + 2;
 $pdf->write1DBarcode("" . $datos[$fila][0] . "", "C39", '', '', 6.4, 0.5, 0.03, $style, 'M');
 $pdf->Cell(0.8, 0.7, " ", 0, 0, 'C');
 $pdf->Ln();
 if ($nfilas <= 3) {
     //fila margen
     $pdf->Cell(6.4, 0.8, "", 0, 0, 'C');
     $pdf->Cell(0.8, 0.8, "", 0, 0, 'C');
     $pdf->Cell(6.4, 0.8, "", 0, 0, 'C');
     $pdf->Cell(0.8, 0.8, "", 0, 0, 'C');
     $pdf->Cell(6.4, 0.8, "", 0, 0, 'C');
Example #5
0
 /**
  * see above - used for outputting barcodes of bundled products - smaller and no sku as text
  */
 public function write1DBarcode2($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = 0.4, $style = '', $align = 'T')
 {
     $this->SetX($this->GetX() + 4);
     $style = array('position' => 'S', 'border' => false, 'padding' => 1, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     parent::write1DBarcode($code, $type, $x, $y, $w, $h, $xres, $style, $align);
 }
Example #6
0
            $pdf->SetFillColorArray($colorized && is_numeric($letter) ? $aColors[$letter] : array(255, 255, 255));
            if ($textOrientation == 'vertical') {
                $pdf->Cell($hBox, $wBox, $letter, 1, 2, 'C', true, '', 0, true);
            } else {
                $pdf->Cell($wBox, $hBox, $letter, 1, 0, 'C', true, '', 0, true);
            }
        }
        if ($textOrientation == 'vertical') {
            $pdf->StopTransform();
        }
        // Print media name in a box of its own
        if ($tape != 'dlt') {
            $pdf->SetFontSize($fontSize);
            if ($textOrientation == 'vertical') {
                // begin at bottom left, and start a rotation
                $pdf->SetXY($posX + $radius + $wBox * 6, $posY + $hLabel);
                $pdf->StartTransform();
                $pdf->Rotate(90);
                $pdf->Cell($hBox, $wBox, strtoupper($tape), 1, 0, 'C', false, '', 0, true);
                $pdf->StopTransform();
            } else {
                $pdf->SetX($posX + $radius + $wBox * 6);
                $pdf->Cell($wBox, $hBox, strtoupper($tape), 1, 0, 'C', false, '', 0, true);
            }
            $txt .= strtoupper($tape);
        }
        // Finish with the actual barcode
        $pdf->write1DBarcode($txt, 'C39', $posX, $posY + $paddingTop, $wLabel, $hBarcode, '', $style);
    }
}
$pdf->Output('barcodes.pdf', 'D');
        $print = 1;
    }
    if ($end == $count) {
        $print = 0;
    }
    $row = $count / 3;
    $col = $count % 3;
    $pos[$row][$col] = $print;
}
//barcode height
$h = 11;
//column width
$w = 67.5;
foreach ($pos as $line) {
    if ($line[0]) {
        $pdf->write1DBarcode(($product->getBarcode() ? $product->getBarcode() : $product->getId()) . str_pad("", 5, "0", STR_PAD_LEFT), 'EAN13', '12.5', '', '', $h, 0.4, $style, 'T');
    }
    if ($line[1]) {
        $pdf->write1DBarcode(($product->getBarcode() ? $product->getBarcode() : $product->getId()) . str_pad("", 5, "0", STR_PAD_LEFT), 'EAN13', '80', '', '', $h, 0.4, $style, 'T');
    }
    if ($line[2]) {
        $pdf->write1DBarcode(($product->getBarcode() ? $product->getBarcode() : $product->getId()) . str_pad("", 5, "0", STR_PAD_LEFT), 'EAN13', '147.5', '', '', $h, 0.4, $style, 'T');
    }
    $pdf->write1DBarcode('4800529501110', 'EAN13', '500', '', '', $h, 0.4, $style, 'N');
    if ($line[0]) {
        $pdf->Cell($w, 0, $product->getName(), 0, 0);
    } else {
        $pdf->Cell($w, 0, '', 0, 0);
    }
    if ($line[1]) {
        $pdf->Cell($w, 0, $product->getName(), 0, 0);
Example #8
0
// set font
$pdf->SetFont('helvetica', '', 11);
// add a page
$pdf->AddPage();
// print a message
$txt = "You can also export 1D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcodes directory.\n";
$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
$pdf->SetY(30);
// -----------------------------------------------------------------------------
$pdf->SetFont('helvetica', '', 10);
// define barcode style
$style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
// PRINT VARIOUS 1D BARCODES
// CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
$pdf->Cell(0, 0, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1);
$pdf->write1DBarcode('CODE 39', 'C39', '', '', '', 18, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39 + CHECKSUM
$pdf->Cell(0, 0, 'CODE 39 + CHECKSUM', 0, 1);
$pdf->write1DBarcode('CODE 39 +', 'C39+', '', '', '', 18, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39 EXTENDED
$pdf->Cell(0, 0, 'CODE 39 EXTENDED', 0, 1);
$pdf->write1DBarcode('CODE 39 E', 'C39E', '', '', '', 18, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39 EXTENDED + CHECKSUM
$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1);
$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', '', 18, 0.4, $style, 'N');
$pdf->Ln();
// CODE 93 - USS-93
$pdf->Cell(0, 0, 'CODE 93 - USS-93', 0, 1);
Example #9
0
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set a barcode on the page footer
$pdf->setBarcode(date('Y-m-d H:i:s'));
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
$style = array('position' => 'S', 'border' => true, 'padding' => 4, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
// CODE 39
$pdf->write1DBarcode('CODE 39', 'C39', '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39  with checksum
$pdf->write1DBarcode('CODE 39 +', 'C39+', '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39 EXTENDED
$pdf->write1DBarcode('CODE 39 E', 'C39E', '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39 EXTENDED with checksum
$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// Interleaved 2 of 5
$pdf->write1DBarcode('12345678', 'I25', '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 128 A
$pdf->write1DBarcode('CODE 128 A', 'C128A', '', '', 80, 30, 0.4, $style, 'N');
Example #10
0
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
//initialize document
$pdf->AliasNbPages();
// add a page
$pdf->AddPage();
// ---------------------------------------------------------
// set a barcode on the page footer
$pdf->setBarcode("2008-06-10 19:37");
// set font
$pdf->SetFont("helvetica", "", 10);
$style = array("position" => "S", "border" => true, "padding" => 4, "fgcolor" => array(0, 0, 0), "bgcolor" => false, "text" => true, "font" => "helvetica", "fontsize" => 8, "stretchtext" => 4);
// CODE 39
$pdf->write1DBarcode("CODE 39", "C39", '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39  with checksum
$pdf->write1DBarcode("CODE 39 +", "C39+", '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39 EXTENDED
$pdf->write1DBarcode("CODE 39 E", "C39E", '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 39 EXTENDED with checksum
$pdf->write1DBarcode("CODE 39 E+", "C39E+", '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// Interleaved 2 of 5
$pdf->write1DBarcode("12345678", "I25", '', '', 80, 30, 0.4, $style, 'N');
$pdf->Ln();
// CODE 128 A
$pdf->write1DBarcode("CODE 128 A", "C128A", '', '', 80, 30, 0.4, $style, 'N');
    public function imprimeCupomEntrada()
    {
        $objEmpresa = new fla_empresas();
        global $path_relative;
        $arrEmpresa = array();
        $arrRotatividade = array();
        $objModelo = new fla_modelos();
        $objCliente = new fla_clientes();
        $arrEmpresa = $objEmpresa->buscaEmpresas($objEmpresa);
        $pdf = new TCPDF("P", PDF_UNIT, 'ETIQUETA', true, 'IBM850', false);
        //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf->SetMargins(0, 0, 0, true);
        //$pdf->SetMargins(PDF_MARGIN_LEFT,PDF_MARGIN_TOP,PDF_MARGIN_RIGHT);
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->AddPage();
        // $nom_prestador  = limitar($arrEmpresa[0]['nom_fantasia'],25);
        $nom_prestador = $arrEmpresa[0]['nom_fantasia'];
        $end_prestador = $arrEmpresa[0]['des_endereco'];
        $tel_prestador = $arrEmpresa[0]['num_telefone'];
        $tel_prestador = mascara_string("(##) ####-####", $tel_prestador);
        $horario_atendimento = "Horario de atendimento:\r\n07:00hrs as 19:00hrs";
        $multa = "A perda deste cupom implicara \r\nem multa de R\$ 10,00";
        $arrRotatividade = $this->buscaCarro($this);
        $cod_cartao = $arrRotatividade[0]['cod_cartao'];
        $hora_entrada = $arrRotatividade[0]['hor_entrada'];
        $dat_entrada = mostraData($arrRotatividade[0]['dat_cadastro']);
        $des_placa = strtoupper($arrRotatividade[0]['des_placa']);
        $objCliente->set_des_placa($des_placa);
        $arrCliente = $objCliente->buscaClientes($objCliente);
        if (!empty($arrCliente[0]['cod_modelo'])) {
            $objModelo->set_cod_modelo($arrCliente[0]['cod_modelo']);
            $arrModelo = $objModelo->buscaModelos($objModelo);
            $des_modelo = $arrModelo[0]['des_modelo'];
        } else {
            $des_modelo = 'Nao cadastrado';
        }
        $des_modelo = remove_acentuacao($des_modelo);
        $pdf->SetFont('times', 'B', 8);
        $pdf->Write($h = 0, $nom_prestador, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 10);
        $conteudo_cabecalho = sprintf("%s \r\nTelefone: %s\r\n\r\n", $end_prestador, $tel_prestador);
        $conteudo_cabecalho = iconv('UTF-8', 'IBM850', $conteudo_cabecalho);
        $pdf->Write($h = 0, $conteudo_cabecalho, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $style = array('position' => 'L', 'border' => false, 'padding' => 5, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 3, 'stretchtext' => 2);
        $pdf->write1DBarcode($cod_cartao, 'C128', '', '', 60, 18, 0.4, $style, 'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128A','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128B','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128C','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128B', '', '', 5, 5, 0.4, $style, 'N');
        $cod_cartao = iconv('UTF-8', 'IBM850', $cod_cartao);
        $pdf->Write($h = 0, 'Cartao: ' . $cod_cartao, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 12);
        $pdf->Write($h = 0, "Dia: {$dat_entrada} \r\nHorario: {$hora_entrada}", $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $conteudo_rodape = sprintf("\r\nVeiculo: %s\r\nPlaca: %s\r\n%s\r\n", $des_modelo, $des_placa, $horario_atendimento);
        $pdf->SetFont('times', 'B', 12);
        $conteudo_rodape = iconv('UTF-8', 'IBM850', $conteudo_rodape);
        $pdf->Write($h = 0, $conteudo_rodape, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 10);
        $multa = iconv('UTF-8', 'IBM850', $multa);
        $pdf->Write($h = 0, $multa, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        // write some JavaScript code
        $js = <<<EOD
\t\t\t\tthis.print({bUI: true, bSilent: false, bShrinkToFit: true}); 
EOD;
        // set javascript
        $pdf->IncludeJS($js);
        //$arquivo_cartao = $pdf->Output('CupomEntrada-'.$cod_cartao,"S");
        //var_dump(file_put_contents($path_relative.'cupons/CupomEntrada-'.$cod_cartao, $arquivo_cartao));
        //$arquivo = $path_relative.'cuponsEntrada/CupomEntrada-' . $cod_cartao.'.pdf';
        //$pdf->Output($path_relative.'cuponsEntrada/CupomEntrada-' . $cod_cartao.'.pdf',"F");
        $pdf->Output($path_relative . 'cuponsEntrada/CupomEntrada-' . $cod_cartao . '.pdf', "I");
        //$pdf->Output('CupomEntrada-' . $cod_cartao.'.pdf','I');
        //$comando = "C:\Sumatra\SumatraPDF.exe -print-to \"MP-2500 TH\" ".$arquivo;
        //exec($comando);
    }
Example #12
0
 public function showBarcode($data, $y)
 {
     $type = strtoupper($data['barcodetype']);
     $height = $data['height'];
     $width = $data['width'];
     $x = $data['x'];
     $y = $data['y'] + $y;
     $textposition = $data['textposition'];
     $code = $data['code'];
     $code = $this->analyse_expression($code);
     $modulewidth = $data['modulewidth'];
     if ($textposition == "" || $textposition == "none") {
         $withtext = false;
     } else {
         $withtext = true;
     }
     $style = array('border' => false, 'vpadding' => 'auto', 'hpadding' => 'auto', 'text' => $withtext, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
     //[2D barcode section]
     //DATAMATRIX
     //QRCODE,H or Q or M or L (H=high level correction, L=low level correction)
     // -------------------------------------------------------------------
     // PDF417 (ISO/IEC 15438:2006)
     /*
      The $type parameter can be simple 'PDF417' or 'PDF417' followed by a
              number of comma-separated options:
      'PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6'
      Possible options are:
          a  = aspect ratio (width/height);
                  e  = error correction level (0-8);
          Macro Control Block options:
          t  = total number of macro segments;
                  s  = macro segment index (0-99998);
                  f  = file ID;
                  o0 = File Name (text);
                  o1 = Segment Count (numeric);
                  o2 = Time Stamp (numeric);
                  o3 = Sender (text);
                  o4 = Addressee (text);
                  o5 = File Size (numeric);
                  o6 = Checksum (numeric).
      Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional.
              To use a comma character ',' on text options, replace it with the character 255: "\xff".
     */
     switch ($type) {
         case "PDF417":
             $this->pdf->write2DBarcode($code, 'PDF417', $x, $y, $width, $height, $style, 'N');
             break;
         case "DATAMATRIX":
             //$this->pdf->Cell( $width,10,$code);
             if (left($code, 3) == "QR:") {
                 $code = right($code, strlen($code) - 3);
                 $this->pdf->write2DBarcode($code, 'QRCODE', $x, $y, $width, $height, $style, 'N');
             } else {
                 $this->pdf->write2DBarcode($code, 'DATAMATRIX', $x, $y, $width, $height, $style, 'N');
             }
             break;
         case "CODE128":
             $this->pdf->write1DBarcode($code, 'C128', $x, $y, $width, $height, $modulewidth, $style, 'N');
             // $this->pdf->write1DBarcode($code, 'C128', $x, $y, $width, $height,"", $style, 'N');
             break;
         case "EAN8":
             $this->pdf->write1DBarcode($code, 'EAN8', $x, $y, $width, $height, $modulewidth, $style, 'N');
             break;
         case "EAN13":
             $this->pdf->write1DBarcode($code, 'EAN13', $x, $y, $width, $height, $modulewidth, $style, 'N');
             break;
         case "CODE39":
             $this->pdf->write1DBarcode($code, 'C39', $x, $y, $width, $height, $modulewidth, $style, 'N');
             break;
         case "CODE93":
             $this->pdf->write1DBarcode($code, 'C93', $x, $y, $width, $height, $modulewidth, $style, 'N');
             break;
     }
 }
Example #13
0
        <td align="center" ><strong><font color="#0A296B">Numero Tiquete:</font></strong><br/>{$num_tiquete}</td>  
        <td align="center" ><strong><font color="#0A296B">Estado Tiquete:</font></strong><br/>{$estado_tiquete}</td>   
        <td align="center" colspan="2"><strong><font size="12" color="#0A296B"></font></strong><font size="14" color="#FF0000"></font></td>  
    </tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
$pdf->SetFont('helvetica', '', 11);
// print a message
$pdf->SetFont('helvetica', '', 10);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => false, 'vpadding' => 30, 'hpadding' => 30, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 0.6, 'module_height' => 0.6);
$id_tiquete = $_POST["id_tiquete"];
// QRCODE,Q : QR-CODE Better error correction
$pdf->write2DBarcode('http://200.71.38.34/aplicacion5.php?opcion=13&confirmacion=' . $id_tiquete, 'QRCODE,Q', 96, 17, 2900, 40, $style, 'N');
$pdf->SetFont('helvetica', '', 10);
$style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
$doc_pasajero = $_POST["doc_pasajero"];
$pdf->Cell(0, 30, '', 0, 1);
$pdf->write1DBarcode("{$doc_pasajero}{$id_tiquete}", 'MSI+', '160', '28', '', 18, 0.4, $style, 'N');
$pdf->Ln();
//Start Graphic Transformation
$pdf->StartTransform();
// draw jpeg image to be clipped
$pdf->Image('images/home.png', 190, 11, 4, 4, '', 'http://200.71.38.34/html/aplicacion5.php?opcion=6', '', true, 70);
$pdf->Output('tiquete', 'I');
// close and output PDF document
//============================================================+
// END OF FILE
//============================================================+
Example #14
0
 /**
  * @return object
  * @throws SampleIDMissingException
  * @throws BaseReportTCPDFClassMissingException
  */
 public static function get_barcode_report()
 {
     if (class_exists("TCPDF")) {
         if ($_GET['sample_id']) {
             $sample_id = $_GET['sample_id'];
             if ($_GET['paper_size']) {
                 $paper_size_info_array = PaperSize::get_size_by_id($_GET['paper_size']);
             } else {
                 $paper_size_info_array = PaperSize::get_standard_size();
             }
             $format = array($paper_size_info_array['width'], $paper_size_info_array['height']);
             if ($paper_size_info_array['width'] >= $paper_size_info_array['height']) {
                 $orientation = "L";
             } else {
                 $orientation = "P";
             }
             $pdf = new TCPDF($orientation, "mm", $format, true, 'UTF-8', false);
             $pdf->SetCreator(PDF_CREATOR);
             $pdf->SetAuthor('Open-LIMS');
             $pdf->SetTitle('Sample Report');
             $pdf->setPrintHeader(false);
             $pdf->setPrintFooter(false);
             $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
             $pdf->SetMargins($paper_size_info_array['margin_left'], $paper_size_info_array['margin_top'], $paper_size_info_array['margin_right']);
             $pdf->SetAutoPageBreak(TRUE, $paper_size_info_array['margin_bottom']);
             $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
             $pdf->setLanguageArray($l);
             $pdf->AddPage();
             $page_width = $paper_size_info_array['width'] - $paper_size_info_array['margin_left'] - $paper_size_info_array['margin_right'];
             $page_height = $paper_size_info_array['height'] - $paper_size_info_array['margin_top'];
             $font_size = $page_height * 0.1;
             if ($page_width * 0.6 > $page_height) {
                 $barcode_height = $page_height - $font_size;
                 $barcode_width = null;
             } else {
                 $barcode_height = $page_width * 0.6;
                 $barcode_width = $page_width;
             }
             $print_sample_id = "S" . str_pad($sample_id, 8, '0', STR_PAD_LEFT);
             $style = array('position' => '', 'align' => 'C', 'stretch' => true, 'fitwidth' => false, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => $font_size, 'stretchtext' => 4);
             $pdf->write1DBarcode($print_sample_id, 'C128B', '', '', $barcode_width, $barcode_height, 0.2, $style, 'M');
             return $pdf;
         } else {
             throw new SampleIDMissingException();
         }
     } else {
         throw new BaseReportTCPDFClassMissingException();
     }
 }
 function viewMarbetes2()
 {
     // Include the main TCPDF library (search for installation path).
     require_once 'tcpdf/tcpdf.php';
     // create new PDF document
     $pdf = new TCPDF('P', PDF_UNIT, 'LETTER', true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Castellon S.R.L.');
     $pdf->SetTitle('Marbetes de documentos y expedientes');
     $pdf->SetSubject('Marbetes de documentos y expedientes');
     $pdf->SetKeywords('Marbetes, documentos y expedientes');
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(6, 7, 4);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     if (@file_exists(dirname(__FILE__) . 'tcpdf/lang/eng.php')) {
         require_once dirname(__FILE__) . 'tcpdf/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // add a page
     $pdf->AddPage();
     $pdf->Ln(14);
     // Set font
     $pdf->SetFont('helvetica', '', 10);
     $pdf->SetFont('helvetica', 'U', 18);
     // create columns content
     // Styles
     $style1 = array('position' => '', 'align' => '', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => 'L', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     $style2 = array('position' => '', 'align' => '', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => 'R', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'font' => 'helvetica', 'fontsize' => 8);
     // Parameters
     $where = "";
     $exp_id = $_REQUEST['exp_id'];
     $cue_id = $_REQUEST['cue_id'];
     $fil_id = $_REQUEST['fil_id'];
     $todos = $_REQUEST['tipoimpresion'];
     $ini = $_REQUEST['nro_inicial'];
     $fin = $_REQUEST['nro_final'];
     if ($_SESSION['ROL_COD'] != 'AA') {
         $where = " AND tab_expusuario.usu_id='" . $_SESSION['USU_ID'] . "'";
     }
     $n = 0;
     $vdoc = null;
     $v = null;
     $de = null;
     // fil_id
     if ($fil_id) {
         $sql = "SELECT\r\n                    tab_archivo.fil_id,\r\n                    (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'|| tab_expediente.exp_codigo||'.'||tab_archivo.fil_nro as codigo,\r\n                    tab_archivo.fil_nroejem,\r\n                    tab_archivo.fil_id,\r\n                    (SELECT SUM(tab_archivo.fil_nroejem::int) as cantidad\r\n                        FROM tab_archivo\r\n                        INNER JOIN tab_exparchivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n                        WHERE tab_exparchivo.exp_id = '{$exp_id}' \r\n                        AND tab_archivo.fil_estado = 1) as exp_nroejem\r\n                    FROM\r\n                    tab_fondo as f\r\n                    INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                    INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                    INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                    INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                    INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n                    INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n                    INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n                    INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n                    INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n                    INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n                    INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n                    WHERE\r\n                    f.fon_estado = 1\r\n                    AND tab_unidad.uni_estado = 1\r\n                    AND tab_tipocorr.tco_estado = 1\r\n                    AND tab_series.ser_estado = 1\r\n                    AND tab_expediente.exp_estado = 1\r\n                    AND tab_archivo.fil_estado = 1\r\n                    AND tab_exparchivo.exa_estado = 1\r\n                    AND tab_expusuario.eus_estado = 1\r\n                    AND tab_expediente.exp_id ='{$exp_id}'\r\n                    AND tab_archivo.fil_id = '{$fil_id}'    \r\n                    ORDER BY\r\n                    tab_tramite.tra_orden,\r\n                    tab_cuerpos.cue_orden,\r\n                    tab_archivo.fil_nro ";
         $tab_archivo = new Tab_archivo();
         $result = $tab_archivo->dbSelectBySQL($sql);
         $ini = 1;
         // New
         $n = 1;
         foreach ($result as $cant) {
             $s = 1;
             while ($s <= $cant->fil_nroejem) {
                 $v[$n] = $cant->codigo;
                 $vdoc[$n] = $cant->fil_id;
                 $n++;
                 $s++;
             }
         }
         $fin = $n - 1;
         $j = 1;
         $codigoizquierda = "";
         while ($j <= $fin) {
             $codigo = $v[$j];
             $fil_ids = $vdoc[$j];
             $pdf->SetFillColor(255, 255, 255);
             $pdf->SetTextColor(58, 35, 9);
             $tipo = "";
             $izq = 0;
             $lugar = 0;
             if ($j % 2 == 1) {
                 $izq = 106;
                 $lugar = 0;
             } else {
                 $izq = 100;
                 $lugar = 1;
             }
             if ($j == $fin) {
                 if ($j % 2 == 1) {
                     for ($k = 1; $k <= 2; $k++) {
                         if ($k == 1) {
                             $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                         } else {
                             $pdf->MultiCell(82, 0, '', 0, 'J', 1, 1, '', '', true, 0, false, true, 0);
                         }
                     }
                 } else {
                     $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                 }
             } else {
                 $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
             }
             if ($j % 2 == 0) {
                 for ($i = 1; $i <= 2; $i++) {
                     if ($i % 2 == 1) {
                         $tipo = "";
                         $style = $style1;
                         $pdf->write1DBarcode(str_pad($codigoizquierda, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                     } else {
                         $tipo = "N";
                         $style = $style2;
                         $pdf->write1DBarcode(str_pad($fil_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                     }
                 }
                 $pdf->Ln(11);
             } else {
                 if ($j == $fin) {
                     $pdf->write1DBarcode(str_pad($fil_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style1, "");
                 }
             }
             $j++;
             if ($j > 14) {
                 $pdf->SetMargins(6, 14, 4);
             }
             $codigoizquierda = $fil_ids;
         }
         //end foreach
         // exp_id
     } else {
         if ($exp_id) {
             $sql = "SELECT\r\n            tab_expediente.exp_id,\r\n            tab_archivo.fil_id,\r\n            (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'|| tab_expediente.exp_codigo as codigoexp,\r\n            (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'|| tab_expediente.exp_codigo||'.'||tab_archivo.fil_nro as codigo,\r\n            tab_archivo.fil_nroejem,\r\n            tab_archivo.fil_id,\r\n            (SELECT SUM(tab_archivo.fil_nroejem::int) as cantidad\r\n                FROM tab_archivo\r\n                INNER JOIN tab_exparchivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n                WHERE tab_exparchivo.exp_id = '{$exp_id}' \r\n                AND tab_archivo.fil_estado = 1) as exp_nroejem\r\n            FROM\r\n            tab_fondo as f\r\n            INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n            INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n            INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n            INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n            INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n            INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n            INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n            INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n            INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n            INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n            INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n            WHERE\r\n            f.fon_estado = 1\r\n            AND tab_unidad.uni_estado = 1\r\n            AND tab_tipocorr.tco_estado = 1\r\n            AND tab_series.ser_estado = 1\r\n            AND tab_expediente.exp_estado = 1\r\n            AND tab_archivo.fil_estado = 1\r\n            AND tab_exparchivo.exa_estado = 1\r\n            AND tab_expusuario.eus_estado = 1\r\n            AND tab_expediente.exp_id ='{$exp_id}'\r\n            {$where}\r\n            ORDER BY\r\n            f.fon_cod,\r\n            tab_unidad.uni_cod,\r\n            tab_series.ser_orden,\r\n            tab_series.ser_codigo,\r\n            tab_expediente.exp_codigo::int,\r\n            tab_archivo.fil_nro::int ";
             $tab_archivo = new Tab_archivo();
             $result = $tab_archivo->dbSelectBySQL($sql);
             if ($result) {
                 $ini = 1;
                 $n = 1;
                 $exp_id = 0;
                 foreach ($result as $cant) {
                     if ($exp_id != $cant->exp_id) {
                         // Exp
                         $v[$n] = $cant->codigoexp;
                         $vdoc[$n] = 'E' . $cant->exp_id;
                         $de[$n] = 'E';
                         $n++;
                         // Docs
                         $s = 1;
                         while ($s <= $cant->fil_nroejem) {
                             $v[$n] = $cant->codigo;
                             $vdoc[$n] = $cant->fil_id;
                             $de[$n] = 'D';
                             $n++;
                             $s++;
                         }
                         $exp_id = $cant->exp_id;
                     } else {
                         $s = 1;
                         while ($s <= $cant->fil_nroejem) {
                             $v[$n] = $cant->codigo;
                             $vdoc[$n] = $cant->fil_id;
                             $de[$n] = 'D';
                             $n++;
                             $s++;
                         }
                         $exp_id = $cant->exp_id;
                     }
                     $exp_id = $cant->exp_id;
                 }
                 $fin = $n - 1;
             } else {
                 $sql = "SELECT\r\n                        tab_expediente.exp_id,\r\n                        (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'|| tab_expediente.exp_codigo AS codigo\r\n                        FROM\r\n                        tab_fondo AS f\r\n                        INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                        INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                        INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                        INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                        WHERE\r\n                        f.fon_estado = 1 AND\r\n                        tab_unidad.uni_estado = 1 AND\r\n                        tab_tipocorr.tco_estado = 1 AND\r\n                        tab_series.ser_estado = 1 AND\r\n                        tab_expediente.exp_id={$exp_id}\r\n                        ORDER BY\r\n                        f.fon_cod,\r\n                        tab_unidad.uni_cod,\r\n                        tab_series.ser_orden,\r\n                        tab_series.ser_codigo,\r\n                        tab_expediente.exp_codigo::int ";
                 $tab_expediente = new Tab_expediente();
                 $result = $tab_archivo->dbSelectBySQL($sql);
                 $ini = 1;
                 $fin = 1;
                 $n = 1;
                 foreach ($result as $cant) {
                     $vdoc[$n] = 'E' . $cant->exp_id;
                     $v[$n] = $cant->codigo;
                     $de[$n] = 'E';
                     $n++;
                 }
             }
             // Print
             $j = 1;
             $codigoIzquierda = "";
             while ($j <= $fin) {
                 $exp_ids = $vdoc[$j];
                 $codigo = $v[$j];
                 $tipode = $de[$j];
                 $pdf->SetFillColor(255, 255, 255);
                 $pdf->SetTextColor(58, 35, 9);
                 $tipo = "";
                 $izq = 0;
                 $lugar = 0;
                 if ($j % 2 == 1) {
                     $izq = 106;
                     $lugar = 0;
                 } else {
                     $izq = 100;
                     $lugar = 1;
                 }
                 if ($j == $fin) {
                     // Impar
                     if ($j % 2 == 1) {
                         for ($k = 1; $k <= 2; $k++) {
                             if ($k == 1) {
                                 if ($tipode == 'E') {
                                     $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                                 } else {
                                     $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                                 }
                             } else {
                                 $pdf->MultiCell(100, 0, '', 0, 'J', 1, 1, '', '', true, 0, false, true, 0);
                             }
                         }
                     } else {
                         if ($tipode == 'E') {
                             $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                         } else {
                             $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                         }
                     }
                 } else {
                     if ($tipode == 'E') {
                         $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     } else {
                         $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     }
                 }
                 if ($j % 2 == 0) {
                     for ($i = 1; $i <= 2; $i++) {
                         if ($i % 2 == 1) {
                             $tipo = "";
                             $style = $style1;
                             $pdf->write1DBarcode(str_pad($codigoIzquierda, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                         } else {
                             $tipo = "N";
                             $style = $style2;
                             $pdf->write1DBarcode(str_pad($exp_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                         }
                     }
                     $pdf->Ln(10);
                 } else {
                     if ($j == $fin) {
                         $pdf->write1DBarcode(str_pad($exp_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style1, "");
                     }
                 }
                 $j++;
                 $codigoIzquierda = $exp_ids;
                 if ($j > 14) {
                     $pdf->SetMargins(6, 24, 4);
                 }
             }
         }
     }
     $pdf->Output('etiqueta_marbetes.pdf', 'I');
 }
 /**
  * 
  * Create a pdf with the labels
  *
  */
 function createPdf()
 {
     global $conf, $mysoc, $db, $langs;
     $langs->load("other");
     require_once DOL_DOCUMENT_ROOT . '/includes/tcpdf/tcpdf.php';
     require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php";
     require_once DOL_DOCUMENT_ROOT . "/core/lib/product.lib.php";
     $pdf = new TCPDF();
     $pdf->SetFont('dejavusans', '', 10);
     $lab_start = $conf->global->LAB_START;
     if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
         $PosY = 5 + floor($lab_start / 3) * 36;
     } else {
         $PosY = 4 + floor($lab_start / 3) * 37;
     }
     //$PosY=3;
     $PosX = 5 + $lab_start % 3 * 70;
     //$PosX=5;
     $Line = 5;
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     //First page
     $pdf->AddPage();
     $sql = "SELECT fk_product, qty, price_level";
     $sql .= " FROM " . MAIN_DB_PREFIX . "labelprint";
     $sql .= " WHERE entity=" . $conf->entity;
     $resql = $db->query($sql);
     if ($resql) {
         $num = $db->num_rows($resql);
         $i = 0;
         while ($i < $num) {
             $objp = $db->fetch_object($resql);
             $product = new Product($db);
             $product->fetch($objp->fk_product);
             $qty = $objp->qty;
             $n = 0;
             while ($n < $qty) {
                 //Position X
                 $PosXLabel = $PosX < 70 ? $PosX : $PosX - 3;
                 //Soc Name
                 $pdf->SetFont('dejavusans', 'B', 10);
                 $pdf->SetXY($PosXLabel, $PosY);
                 $pdf->SetFillColor(230, 230, 230);
                 if ($conf->global->LAB_COMP) {
                     $pdf->MultiCell(65, 5, dol_trunc($mysoc->nom, 25), 0, 'L');
                     $flag = 1;
                 } elseif ($conf->global->LAB_PROD_LABEL) {
                     $pdf->MultiCell(65, 5, dol_trunc($product->libelle, 25), 0, 'L');
                     $flag = 2;
                 } else {
                     $pdf->MultiCell(65, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 'L');
                     $flag = 3;
                 }
                 $pdf->SetFont('dejavusans', '', 10);
                 //Position Y
                 $PosYLabel = $PosY + $Line + 2;
                 //Product label
                 $pdf->SetXY($PosXLabel, $PosYLabel);
                 if ($flag == 1) {
                     if ($conf->global->LAB_PROD_LABEL) {
                         $pdf->Cell(25, 5, dol_trunc($product->libelle, 25), 0, 0, 'L');
                     } else {
                         $pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
                     }
                 }
                 if ($flag == 2) {
                     $pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
                 } else {
                     $pdf->Cell(25, 5, "", 0, 0, 'L');
                 }
                 //$pdf->Cell(25,5,dol_trunc($product->libelle,25),0,0,'L');
                 //$pdf->Write($Line,dol_trunc($product->libelle,25));
                 $PosYLabel = $PosYLabel + $Line + 2;
                 $pdf->SetXY($PosXLabel, $PosYLabel);
                 //Barcode
                 if ($conf->barcode->enabled) {
                     $product->fetch_barcode();
                     $pdf->write1DBarcode($product->barcode, $product->barcode_type_code, '', '', 35, 18, 0.4, $style, 'N');
                 }
                 //Price
                 $pdf->SetFont('dejavusans', 'B', 10);
                 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
                     $labelPrice = price($product->price_ttc);
                 } else {
                     $labelPrice = price($product->multiprices_ttc[$objp->price_level]);
                 }
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
                 $PosYLabel = $PosYLabel + $Line + 1;
                 $labelPrice = $langs->trans(currency_name($conf->currency));
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
                 $PosYLabel = $PosYLabel + $Line;
                 if ($conf->global->LAB_WEIGHT) {
                     $labelSet = $product->weight;
                     $labelSet .= " " . measuring_units_string($product->weight_units, "weight");
                 } elseif ($conf->global->LAB_LENGTH) {
                     $labelSet = $product->length;
                     $labelSet .= " " . measuring_units_string($product->length_units, "size");
                 } elseif ($conf->global->LAB_AREA) {
                     $labelSet = $product->surface;
                     $labelSet .= " " . measuring_units_string($product->surface_units, "surface");
                 } elseif ($conf->global->LAB_VOLUME) {
                     $labelSet = $product->volume;
                     $labelSet .= " " . measuring_units_string($product->volume_units, "volume");
                 } elseif ($conf->global->LAB_COUNTRY) {
                     $labelSet = getCountry($product->country_id, '', 0, $langs, 0);
                 }
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelSet, 0, 0, 'R');
                 $pdf->SetAutoPageBreak(false);
                 $PosX = $PosX + 70;
                 if ($PosX >= 200) {
                     $PosX = 5;
                     if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
                         $PosY = $PosY + 36;
                     } else {
                         $PosY = $PosY + 37;
                     }
                     if ($PosY >= 265) {
                         if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
                             $PosY = 5;
                         } else {
                             $PosY = 4;
                         }
                         $pdf->AddPage();
                     }
                 }
                 $n++;
             }
             $i++;
         }
     }
     ini_set('display_errors', 'Off');
     $buf = $pdf->Output("", "S");
     $len = strlen($buf);
     //$file_temp = ini_get("session.save_path")."/".dol_now().".pdf";
     $file_temp = DOL_DATA_ROOT . "/" . dol_now() . ".pdf";
     $gestor = fopen($file_temp, "w");
     fwrite($gestor, $buf);
     fclose($gestor);
     $url = dol_buildpath("/labelprint/download.php", 1) . "?file=" . $file_temp;
     print "<meta http-equiv='refresh' content='0;url=" . $url . "'>";
 }
        if ($print == $detailcount) {
            break;
        }
        $start += $qty[$print];
    }
    $row = $count / 3;
    $col = $count % 3;
    $pos[$row][$col] = $print;
}
//barcode height
$h = 11;
//column width
$w = 70;
foreach ($pos as $line) {
    if (array_key_exists(0, $line) and array_key_exists(0, $line) and $line[0] >= 0) {
        $pdf->write1DBarcode(MyBarcode::standardize($products[$line[0]]->getId() . str_pad($purchase->getPono(), 5, "0", STR_PAD_LEFT)), 'EAN13', '12.5', '', '', $h, 0.4, $style, 'T');
    }
    if (array_key_exists(1, $line) and array_key_exists(1, $line) and $line[1] >= 0) {
        $pdf->write1DBarcode(MyBarcode::standardize($products[$line[1]]->getId() . str_pad($purchase->getPono(), 5, "0", STR_PAD_LEFT)), 'EAN13', '82.5', '', '', $h, 0.4, $style, 'T');
    }
    if (array_key_exists(2, $line) and array_key_exists(2, $line) and $line[2] >= 0) {
        $pdf->write1DBarcode(MyBarcode::standardize($products[$line[2]]->getId() . str_pad($purchase->getPono(), 5, "0", STR_PAD_LEFT)), 'EAN13', '152.5', '', '', $h, 0.4, $style, 'T');
    }
    $pdf->write1DBarcode('4800529501110', 'EAN13', '500', '', '', $h, 0.4, $style, 'N');
    if (array_key_exists(0, $line) and array_key_exists(0, $line) and $line[0] >= 0) {
        $pdf->Cell($w, 0, html_entity_decode($products[$line[0]]->getName()), 0, 0);
    } else {
        $pdf->Cell($w, 0, '', 0, 0);
    }
    if (array_key_exists(1, $line) and array_key_exists(1, $line) and $line[1] >= 0) {
        $pdf->Cell($w, 0, html_entity_decode($products[$line[1]]->getName()), 0, 0);
Example #18
0
 function printVrsBarcodeLabelRecordSet($props, $barcodes, $start = 0)
 {
     $numx = $props['numx'];
     $numy = $props['numy'];
     $labelheight = $props['dimensions']['labelheight'];
     $labelwidht = $props['dimensions']['labelwidth'];
     $labelheader_pos = $props['dimensions']['labelheader_pos'];
     $labelbody_pos = $props['dimensions']['labelbody_pos'];
     $numlabels = $numx * $numy;
     $barcode_pos = $props['dimensions']['barcode_pos'];
     $barcodetext_pos = $props['dimensions']['barcodetext_pos'];
     set_time_limit(600);
     // create new PDF document
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Niels Klazenga');
     $pdf->SetTitle('MEL Label');
     $pdf->SetSubject('MEL Label');
     //set margins
     $pdf->SetMargins(5, 7.5, 5);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, 3);
     // remove default header/footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 9);
     // set cell padding
     $pdf->setCellPaddings(0, 0, 0, 0);
     // set cell margins
     $pdf->setCellMargins(0, 0, 0, 0);
     $barcodestyle = array('position' => '', 'padding' => 0, 'align' => 'C', 'stretch' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false);
     if ($start > 0) {
         $pdf->AddPage();
     }
     for ($i = 0; $i < count($barcodes); $i++) {
         $j = $i + $start;
         $offset = $j % ($numx * $numy);
         $x = $offset % $numx;
         $y = floor($offset / $numx);
         if ($j % $numlabels == 0) {
             $pdf->AddPage();
         }
         $pdf->MultiCell(55, 5, '<b>Victorian Reference Set</b>', 0, 'C', 0, 1, $barcodetext_pos['x'][$x], $barcode_pos['y'][$y] - 3, true, false, true);
         $vrsnumber = $barcodes[$i]['Barcode'];
         $pdf->write1DBarcode($vrsnumber, 'C39', $barcode_pos['x'][$x], $barcode_pos['y'][$y], 55, 8, 0.1, $barcodestyle, 'N');
         $pdf->MultiCell(55, 5, '<b>' . $vrsnumber . '</b>', 0, 'C', 0, 1, $barcodetext_pos['x'][$x], $barcodetext_pos['y'][$y] - 4, true, false, true);
         $pdf->MultiCell(55, 5, 'Duplicate of ' . $barcodes[$i]['MELNumber'], 0, 'C', 0, 1, $barcodetext_pos['x'][$x], $barcodetext_pos['y'][$y], true, false, true);
     }
     // move pointer to last page
     $pdf->lastPage();
     // ---------------------------------------------------------
     // Close and output PDF document
     $pdf->Output('mellabel.pdf', 'I');
 }
 function generarMYPDF_RME_ORDEN_MEDICA($atributosReceta, $labelCabecera, $labelPie, $datosCabecera, $datosDetalle, $datosPie, $modo, $nombreReporte, $parametros)
 {
     // create new PDF document
     $pdf = new TCPDF($parametros["PDF_PAGE_ORIENTATION"], PDF_UNIT, $parametros["PDF_PAGE_FORMAT"], true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('HMLO');
     $pdf->SetTitle('OrdenMedica');
     $pdf->SetSubject('HMLO');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     //        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 048', PDF_HEADER_STRING);
     // remove default header/footer
     $pdf->setPrintHeader($parametros["PRINT_HEADER"]);
     $pdf->setPrintFooter($parametros["PRINT_FOOTER"]);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins($parametros["PDF_MARGIN_LEFT"], $parametros["PDF_MARGIN_TOP"], $parametros["PDF_MARGIN_RIGHT"]);
     $pdf->SetHeaderMargin($parametros["PDF_MARGIN_HEADER"]);
     $pdf->SetFooterMargin($parametros["PDF_MARGIN_FOOTER"]);
     //set auto page breaks
     $pdf->SetAutoPageBreak($parametros["AUTO_PAGE_BREAK"], $parametros["PDF_MARGIN_BOTTOM"]);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //        $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
     //$pdf->Cell(10, 5, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1);
     $pdf->write1DBarcode($parametros["CODIGO_DE_BARRAS"], 'C39', 68, 137, 70, 8, 0.4, $style, 'N');
     //        $pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
     $pdf->SetFont('helvetica', '', 8);
     //======================================================================================================
     $sizeDatos = 6;
     $sizeTitulo = 8;
     $sizeSubtitulo = 6;
     $family = "helvetica";
     $styleNormal = "N";
     $styleNegrita = "B";
     /* =======================================        Obs       ============================================ */
     // width->0, height->1, top->2, left->3, color->4 TipoLetra=>5 EstiloLetra=>6 TamaƱoLetra=>6
     /* ===================================================================================================== */
     $lblCabecera = array();
     //        $lblDetalle=array();
     $lblPie = array();
     $styleCL = array();
     $styleCD = array();
     //        $styleDL=array();
     //        $styleDD=array();
     $stylePL = array();
     $stylePD = array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosReceta);
     $o_classGeneral->setLabelPie($labelPie, $atributosReceta);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $stylePL = $o_classGeneral->getStylePL();
     $stylePD = $o_classGeneral->getStylePD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     $lblPie = $o_classGeneral->getLblPie();
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================   Cabecera   =================================================== */
     if (is_array($lblCabecera) && !empty($lblCabecera) && $modo == 1) {
         foreach ($lblCabecera as $i => $value) {
             $isImg = end(explode(".", $value));
             if ($isImg == "jpg" || $isImg == "png" || $isImg == "gif") {
                 $filename = '../../../tcPDF/tcpdf/tcpdf/images/' . $lblCabecera[$i];
                 if (file_exists($filename)) {
                     $pdf->Image($filename, $styleCL[$i][3], $styleCL[$i][2], $styleCL[$i][0], $styleCL[$i][1], '', '', '', false, 300);
                 }
             } else {
                 $color = $styleCL[$i][4];
                 $pdf->SetTextColor($color[0], $color[1], $color[2]);
                 $pdf->SetFont($styleCL[$i][5], $styleCL[$i][6], $styleCL[$i][7]);
                 $pdf->MultiCell($styleCL[$i][0], $styleCL[$i][1], $lblCabecera[$i], 0, 'L', 0, 1, $styleCL[$i][3], $styleCL[$i][2], true);
             }
         }
     }
     if (is_array($datosCabecera) && !empty($datosCabecera)) {
         $indice = array_keys($datosCabecera);
         foreach ($indice as $val => $z) {
             $color = $styleCD[$z][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($styleCD[$z][5], $styleCD[$z][6], $styleCD[$z][7]);
             $pdf->MultiCell($styleCD[$z][0], $styleCD[$z][1], $datosCabecera[$z], 0, 'L', 0, 1, $styleCD[$z][3], $styleCD[$z][2], true);
         }
     }
     /* ===================================================================================================== */
     /* =====================================   Fin Cabecera   ============================================== */
     /* ===============================    espacio despues de la cabecera    ================================ */
     $pdf->writeHTML("<br>", true, false, false, false, '');
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================     Antecedentes     ========================================== */
     $cadenaAntecedentes = $RP . '<table width="700" border="1" cellpadding="3" cellspacing="0" bgcolor="#ffffff">
                             <tr>
                                 <td width="35" align="center"><strong><br>NRO</strong></td>
                                 <td align="center" width="250">
                                 <strong>PROCEDIMIENTOS</strong><br/>
                                  <strong>Y/O</strong><br/>
                                 <strong>INTERCONSULTAS</strong></td>
                                 <td align="center" width="160"><strong><br>SERVICIO</strong></td>
                                 <td  align="center" width="270"><strong><br>INDICACIONES</strong></td>
                                 </tr>
                                 <tr>
                                
                               </tr>';
     $orden = 0;
     foreach ($datosDetalle as $key => $value) {
         $orden++;
         $cadenaAntecedentes .= '<tr>
                                 <td><font size="6"><strong>' . $orden . '.</strong></font></td>
                                 <td><font size="6">' . utf8_encode($value[0]) . '</font></td>
                                 <td><font size="6">' . utf8_encode($value[4][0][0]) . '</font></td>
                               
                                 <td><font size="6">' . utf8_encode($value[3]) . '</font></td>
                               </tr>';
     }
     $cadenaAntecedentes .= '</table>';
     $cadenaAntecedentes .= '<table border="0" cellspacing="3" cellpadding="0"><tr><td width="685">Utilizado hasta el regl&oacute;n ....................... Inclusive </td></tr></table>';
     //echo $cadenaAntecedentes;
     $pdf->SetFont($family, $styleNormal, $sizeTitulo);
     $pdf->writeHTML($cadenaAntecedentes, true, false, false, false, '');
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================     Pie     =================================================== */
     if (is_array($lblPie) && !empty($lblPie) && $modo == 1) {
         foreach ($lblPie as $i => $value) {
             $color = $stylePL[$i][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($stylePL[$i][5], $stylePL[$i][6], $stylePL[$i][7]);
             $pdf->MultiCell($stylePL[$i][0], $stylePL[$i][1], $lblPie[$i], 0, 'L', 0, 1, $stylePL[$i][3], $stylePL[$i][2], true);
         }
     }
     if (is_array($datosPie) && !empty($datosPie)) {
         foreach ($datosPie as $i => $value) {
             $color = $stylePD[$i][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($stylePD[$i][5], $stylePD[$i][6], $stylePD[$i][7]);
             $pdf->MultiCell($stylePD[$i][0], $stylePD[$i][1], $datosPie[$i], 0, 'L', 0, 1, $stylePD[$i][3], $stylePD[$i][2], true);
         }
     }
     /* ===================================================================================================== */
     /* =====================================    Fin Pie    ================================================= */
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($nombreReporte, 'I');
     //============================================================+
     // END OF FILE
     //============================================================+
 }
Example #20
0
             $h = 10;
         }
         if ($i > 6) {
             $l = 76;
             $h = 10;
         }
         if ($i > 9) {
             $l = 110;
             $h = 10;
         }
         if ($i == 2 || $i == 5 || $i == 8 || $i == 11) {
             $h = 80;
         } elseif ($i == 3 || $i == 6 || $i == 9 || $i == 12) {
             $h = 150;
         }
         $pdf->write1DBarcode($row['kp_sampel_no'], 'C128', $h, $l);
         $pdf->Text($h - 1, $l - 4, $row['kp_sampel_no']);
         $pdf->Text($h - 1, $l + 12, $str1);
         $pdf->Text($h - 1, $l + 15, $str2);
         $pdf->Text($h - 1, $l + 18, $str3);
         $i++;
     }
 } elseif ($rows == 2) {
     $h = 10;
     $l = 42;
     while ($i <= $bil) {
         if ($i > 3) {
             $l = 76;
             $h = 10;
         }
         if ($i > 6) {
Example #21
0
     $pdf->SetX($x);
     $pdf->setCellPaddings(0, 0.5, 0, 0.5);
     $pdf->SetFont('dejavusans', 'B', 10, '', true);
     $cx = str_replace(" ", "\n", $b['callnumber']);
     $pdf->MultiCell($lwidth, 0, $cx, 1, 'C', 0, 1, '', '', true);
     //dc_YDown(1);
     if ($k == 0) {
         $lheight += $pdf->getLastH();
     }
 }
 if ($plbcode == 'Y') {
     $pl = true;
     dc_YDown(1);
     $pdf->SetX($x);
     $ty1 = $pdf->GetY();
     $pdf->write1DBarcode($b['barcode'], 'C39', '', '', $lwidth, 9, 0.4, $style, 'N');
     $ty2 = $pdf->GetY();
     //$pdf->Line($x,$ty1,$x+$lwidth,$ty1);
     //$pdf->Line($x,$ty1,$x,$ty2);
     $pdf->Line($x, $ty2, $x + $lwidth, $ty2);
     //$pdf->Line($x+60,$ty1,$x+60,$ty2);
     if ($k == 0) {
         $lheight += 10;
     }
 }
 // End of Print label >>
 if ($pl) {
     if ($k == 0) {
         $k = 1;
         $nrow = floor($dcPageH / $lheight);
     }
 function verRpte()
 {
     // Include the main TCPDF library (search for installation path).
     require_once 'tcpdf/tcpdf.php';
     // create new PDF document
     //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf = new TCPDF('P', PDF_UNIT, 'LETTER', true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Castellon S.R.L.');
     $pdf->SetTitle('Marbetes de documentos y expedientes');
     $pdf->SetSubject('Marbetes de documentos y expedientes');
     $pdf->SetKeywords('Marbetes, documentos y expedientes');
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default header data
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 027', PDF_HEADER_STRING);
     // set header and footer fonts
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     //$pdf->SetMargins(PDF_MARGIN_LEFT, 7, PDF_MARGIN_RIGHT);
     //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     //$pdf->SetMargins(5, 7, 5);
     $pdf->SetMargins(6, 7, 6);
     // Margin Header
     //        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     //        $pdf->SetHeaderMargin(10);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE);
     //$pdf->SetAutoPageBreak(FALSE);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     if (@file_exists(dirname(__FILE__) . 'tcpdf/lang/eng.php')) {
         require_once dirname(__FILE__) . 'tcpdf/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // ---------------------------------------------------------
     // set a barcode on the page footer
     //$pdf->setBarcode(date('Y-m-d H:i:s'));
     // set font
     // add a page
     $pdf->AddPage();
     //$pdf->SetFont('helvetica', '', 10);
     $pdf->SetFont('helvetica', 'U', 18);
     // create columns content
     //$pdf->Ln(6);
     $pdf->Ln(6);
     $style1 = array('position' => '', 'align' => '', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => 'L', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     $style2 = array('position' => '', 'align' => '', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => 'R', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'font' => 'helvetica', 'fontsize' => 8);
     // Tipo de reporte
     $tiporeporte = $_REQUEST['tiporeporte'];
     // Filtro seccion
     $uni_id = $_REQUEST['uni_id'];
     $ser_id = $_REQUEST['ser_id'];
     // Nuevo c&oacute;digo
     $where = "";
     // Resultset
     $result = null;
     $kl = 0;
     $v2[$kl] = 0;
     $doxexp[$kl] = 0;
     $de[$kl] = 0;
     $n = 0;
     $where = "";
     if ($ser_id) {
         $where .= " AND tab_series.ser_id = '{$ser_id}' ";
     }
     if ($_SESSION["ROL_COD"] != 'AA') {
         $where .= " AND tab_expusuario.usu_id= '" . $_SESSION["USU_ID"] . "'";
     }
     // ************
     // Series
     // ************
     if ($uni_id != "") {
         // Expedientes
         $sql_marbete = "SELECT\r\n                tab_expediente.exp_id,\r\n                tab_series.ser_orden,\r\n                tab_series.ser_codigo,\r\n                tab_expediente.exp_codigo,\r\n                tab_expisadg.exp_titulo,\r\n                tab_expediente.exp_nrocaj\r\n                FROM\r\n                tab_usuario\r\n                INNER JOIN tab_expusuario ON tab_usuario.usu_id = tab_expusuario.usu_id\r\n                INNER JOIN tab_expediente ON tab_expusuario.exp_id = tab_expediente.exp_id\r\n                INNER JOIN tab_expfondo ON tab_expediente.exp_id = tab_expfondo.exp_id\r\n                INNER JOIN tab_series ON tab_expediente.ser_id = tab_series.ser_id                \r\n                INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n                INNER JOIN tab_unidad ON tab_unidad.uni_id = tab_series.uni_id\r\n                INNER JOIN tab_fondo ON tab_fondo.fon_id = tab_unidad.fon_id\r\n                INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                WHERE tab_fondo.fon_estado = 1\r\n                AND tab_unidad.uni_estado = 1\r\n                AND tab_series.ser_estado = 1\r\n                AND tab_tipocorr.tco_estado = 1\r\n                AND tab_expediente.exp_estado = 1\r\n                AND tab_expisadg.exp_estado = 1\r\n                AND tab_expfondo.exf_estado = 1\r\n                AND tab_expusuario.eus_estado = 1\r\n                AND tab_unidad.uni_id = '{$uni_id}'\r\n                {$where}\r\n                ORDER BY \r\n                tab_fondo.fon_cod,\r\n                tab_unidad.uni_cod,\r\n                tab_series.ser_orden, \r\n                tab_series.ser_codigo, \r\n                tab_expediente.exp_codigo::int ";
         // INNER JOIN tab_usu_serie ON tab_series.ser_id = tab_usu_serie.ser_id
         $tab_usuario = new Tab_usuario();
         $rows_expedientes = $tab_usuario->dbSelectBySQL($sql_marbete);
         $kl = 0;
         $tarchivo = new tab_archivo();
         foreach ($rows_expedientes as $rows) {
             $x = new Tab_archivo();
             $sqlcantidad = "SELECT\r\n                            COUNT(tab_archivo.fil_id) as cantidad\r\n                            FROM\r\n                            tab_exparchivo\r\n                            INNER JOIN tab_archivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n                            WHERE\r\n                            tab_exparchivo.exp_id = '" . $rows->exp_id . "'\r\n                            AND tab_exparchivo.exa_estado = 1 ";
             $cantidad_documentos = $x->dbSelectBySQL($sqlcantidad);
             $ct = $cantidad_documentos[0]->cantidad;
             if ($ct == 0) {
                 // Series
                 $sqlsoloexpedientes = "SELECT\r\n                            (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'||\r\n                            tab_expediente.exp_codigo AS codigo,\r\n                            tab_expediente.exp_nroejem,\r\n                            tab_expediente.exp_id\r\n                            FROM\r\n                            tab_fondo AS f\r\n                            INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                            INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                            INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                            INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                            WHERE\r\n                            f.fon_estado = 1 AND\r\n                            tab_unidad.uni_estado = 1 AND\r\n                            tab_tipocorr.tco_estado = 1 AND\r\n                            tab_series.ser_estado = 1 AND\r\n                            tab_expediente.exp_id={$rows->exp_id}\r\n                            ORDER BY \r\n                            f.fon_cod,\r\n                            tab_unidad.uni_cod,\r\n                            tab_series.ser_orden, \r\n                            tab_series.ser_codigo, \r\n                            tab_expediente.exp_codigo::int ";
                 $tab_fondo = new Tab_fondo();
                 $rows_marb = $tab_fondo->dbSelectBySQL($sqlsoloexpedientes);
                 $result = $tab_fondo->dbSelectBySQL($sqlsoloexpedientes);
                 foreach ($rows_marb as $list) {
                     $m = $list->exp_nroejem;
                     for ($n = 1; $n <= $m; $n++) {
                         $v2[$kl] = $list->codigo;
                         $doxexp[$kl] = 'E' . $list->exp_id;
                         $de[$kl] = 'e';
                         $kl++;
                     }
                 }
             } else {
                 // Documentos
                 $sqldocumentos = "SELECT\r\n                            tab_expediente.exp_id,\r\n                            tab_archivo.fil_id,\r\n                            (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'||\r\n                            tab_expediente.exp_codigo as codigoexp,                            \r\n                            (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'||\r\n                            tab_expediente.exp_codigo||'.'||tab_archivo.fil_nro as codigo,\r\n                            tab_archivo.fil_nroejem,\r\n                            tab_archivo.fil_id,\r\n                            (NULLIF(tab_archivo.fil_codigo,'')::int) as correlativo\r\n                            FROM\r\n                            tab_fondo as f\r\n                            INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                            INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                            INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                            INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                            INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n                            INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n                            INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n                            INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n                            INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n                            INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n                            INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n                            WHERE\r\n                            f.fon_estado = 1 AND\r\n                            tab_unidad.uni_estado = 1 AND\r\n                            tab_tipocorr.tco_estado = 1 AND\r\n                            tab_series.ser_estado = 1 AND\r\n                            tab_expediente.exp_estado = 1 AND\r\n                            tab_archivo.fil_estado = 1 AND\r\n                            tab_exparchivo.exa_estado = 1 AND\r\n                            tab_expusuario.eus_estado = 1 AND\r\n                            tab_expediente.exp_id ='{$rows->exp_id}' \r\n                            ORDER BY \r\n                            f.fon_cod,\r\n                            tab_unidad.uni_cod,\r\n                            tab_series.ser_orden, \r\n                            tab_series.ser_codigo, \r\n                            tab_expediente.exp_codigo::int, \r\n                            tab_archivo.fil_nro::int ";
                 $result_documentos = $tarchivo->dbSelectBySQL($sqldocumentos);
                 $result = $tarchivo->dbSelectBySQL($sqldocumentos);
                 $exp_id = 0;
                 foreach ($result_documentos as $list2) {
                     if ($exp_id != $list2->exp_id) {
                         // Exp
                         $v2[$kl] = $list2->codigoexp;
                         $doxexp[$kl] = 'E' . $list2->exp_id;
                         $de[$kl] = 'e';
                         $kl++;
                         // Doc
                         $m = $list2->fil_nroejem;
                         for ($n = 1; $n <= $m; $n++) {
                             $v2[$kl] = $list2->codigo;
                             $doxexp[$kl] = $list2->fil_id;
                             $de[$kl] = 'd';
                             $kl++;
                         }
                         $exp_id = $list2->exp_id;
                     } else {
                         $m = $list2->fil_nroejem;
                         for ($n = 1; $n <= $m; $n++) {
                             $v2[$kl] = $list2->codigo;
                             $doxexp[$kl] = $list2->fil_id;
                             $de[$kl] = 'd';
                             $kl++;
                         }
                         $exp_id = $list2->exp_id;
                     }
                 }
             }
         }
         // end row expedientes
         //            if ($kl < 1) {
         //                echo "Esta Serie no tiene Marbetes";
         //                exit();
         //            }
     }
     //        else {
     //            $sqlnoexpedientes = "SELECT
     //                        (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'||
     //                        tab_expediente.exp_codigo AS codigo,
     //                        tab_expediente.exp_nroejem,
     //                        tab_expediente.exp_id
     //                        FROM
     //                        tab_fondo AS f
     //                        INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id
     //                        INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id
     //                        INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id
     //                        INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id
     //                        WHERE
     //                        f.fon_estado = 1 AND
     //                        tab_unidad.uni_estado = 1 AND
     //                        tab_tipocorr.tco_estado = 1 AND
     //                        tab_series.ser_estado = 1 AND
     //                        tab_expediente.exp_id=$exp_id";
     //            $tab_fondo = new Tab_fondo();
     //            $rows_marb = $tab_fondo->dbSelectBySQL($sqlnoexpedientes);
     //            $result = $tab_fondo->dbSelectBySQL($sqlnoexpedientes);
     //        }
     $t = 1;
     $numero = 0;
     $j = 1;
     // **********************
     // Todos los documentos
     // **********************
     $cantidad_ejem = 0;
     $cantidad_ejem2 = $kl;
     $n = $kl;
     if ($cantidad_ejem == 1) {
         $j = 1;
         $tip = 1;
         $cantidad_ejem2 = 1;
     } else {
         $j = 1;
         $tip = 2;
     }
     $l = 0;
     $codigoizquierda = "";
     while ($j <= $n) {
         //                $codigo = $v[$l];
         //                $fil_ids = $vdoc[$l];
         //
         $codigo = $v2[$l];
         $fil_ids = $doxexp[$l];
         $tipode = $de[$l];
         $l++;
         $pdf->SetFillColor(255, 255, 255);
         $pdf->SetTextColor(58, 35, 9);
         $tipo = "";
         $izq = 0;
         $lugar = 0;
         if ($j % 2 == 1) {
             $izq = 104;
             $lugar = 0;
         } else {
             $izq = 100;
             //
             $lugar = 1;
         }
         if ($fil_ids) {
             // Grid Code Document
             if ($j == $cantidad_ejem2) {
                 if ($j % 2 == 1) {
                     //                    if ($tipode=='e'){
                     //                        $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     //                    }else{
                     //                        $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     //                    }
                     //
                     for ($k = 1; $k <= 2; $k++) {
                         if ($k == 1) {
                             if ($tipode == 'e') {
                                 // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
                                 // write the first column
                                 $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                             } else {
                                 // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
                                 $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                             }
                         } else {
                             $pdf->MultiCell(100, 0, '', 0, 'J', 1, 1, '', '', true, 0, false, true, 0);
                         }
                     }
                 } else {
                     if ($tipode == 'e') {
                         $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     } else {
                         $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     }
                 }
             } else {
                 if ($tipode == 'e') {
                     $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                 } else {
                     $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                 }
             }
         }
         // Bar Code
         if ($j % 2 == 0) {
             for ($i = 1; $i <= $tip; $i++) {
                 if ($i % 2 == 1) {
                     $tipo = "";
                     $style = $style1;
                     $pdf->write1DBarcode(str_pad($codigoizquierda, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                 } else {
                     $tipo = "N";
                     $style = $style2;
                     $pdf->write1DBarcode(str_pad($fil_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                 }
             }
             //*************************
             // New line for new bar code
             //*************************
             $pdf->Ln(12);
             //                        // Count lines
             //                        if (j!=14){
             //                            $pdf->Ln(11);
             //                        }else{
             //                            $pdf->Ln(20);
             //                        }
         } else {
             if ($j == $cantidad_ejem2) {
                 $pdf->write1DBarcode(str_pad($fil_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style1, "");
             }
         }
         $j++;
         if ($j > 14) {
             //$pdf->SetMargins(PDF_MARGIN_LEFT, 14, PDF_MARGIN_RIGHT);
             //$pdf->SetMargins(5, 14, 5);
             $pdf->SetMargins(6, 14, 6);
         }
         $t++;
         $codigoizquierda = $fil_ids;
     }
     //end foreach
     $pdf->Output('listado_marbetes.pdf', 'I');
 }