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
0
 public function prepareDownloadImagePdf($filename, $newfilename, $firstname, $lastname, $title, $description, $code, $date_end)
 {
     // calculate date
     $currentDate = new DateTime();
     $currentDate->modify('+ ' . $date_end . ' month');
     $date_end = $currentDate->format('Y-m-d');
     $this->load->model('tool/image');
     require_once DIR_SYSTEM . 'library/tcpdf/tcpdf.php';
     $pdf = new TCPDF();
     // disable auto-page-break
     $pdf->SetAutoPageBreak(false, 0);
     // set image 1
     $pdf->AddPage();
     $pdf->Image(DIR_IMAGE . $filename, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
     $pdf->setPageMark();
     /*if(stripos('.pdf',$newfilename)===false)
       {
           $t = explode('.',$newfilename);
           array_pop($t);
           $newfilename = implode('.',$t).'.pdf';
       }*/
     $pdf->SetFont('times', '', 13);
     $pdf->SetTextColor(50, 50, 50);
     for ($i = 0; $i <= 16; $i++) {
         $pdf->Ln(10);
     }
     $pdf->setCellPaddings(90);
     $pdf->Ln(10);
     $pdf->Write(0, $firstname . ' ' . $lastname);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Write(0, $title);
     $pdf->Ln(10);
     $pdf->SetFont('times', '', 11);
     $pdf->Write(0, $description);
     $pdf->setCellPaddings(70);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->SetFont('times', '', 7);
     $pdf->Write(0, 'Beauty Center Billstedt');
     $pdf->Ln(4);
     $pdf->SetFont('times', 'B', 9);
     $pdf->Write(0, '#' . $code);
     $pdf->Ln(4);
     $pdf->SetFont('times', '', 9);
     $pdf->Write(0, 'Gültig bis:: ' . $date_end);
     $pdf->Output(DIR_IMAGE . $newfilename, 'F');
 }
Example #3
0
/* dc_YDown() */
function dc_YDown($a = 0)
{
    global $pdf;
    $pdf->SetY($pdf->GetY() + $a);
    // Line break 2mm
    return $pdf->GetY();
}
// set JPEG quality
$pdf->setJPEGQuality(75);
// Image method signature:
// 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)
// set font
$pdf->SetFont('dejavusans', '', 11, '', true);
// set cell padding
$pdf->setCellPaddings(0, 0, 0, 0.5);
//$left='', $top='', $right='', $bottom='')
// set cell margins
$pdf->setCellMargins(0, 0, 0, 0);
// set color for background
$pdf->SetFillColor(255, 255, 255);
// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
// START //////////////////////////
// Queries:
//$t=dbSel("*","catalog","W/`dcid`='$dcid' LIMIT 0,1");
//$ndata=mysql_num_rows($t);
//$r=dbFA($t);
// add a page
$pdf->AddPage();
// define barcode style
$style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => false, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 7, 'stretchtext' => 3);
Example #4
0
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetHeaderMargin(1);
$pdf->SetMargins(10, 47, 10);
$pdf->SetFooterMargin(7);
$pdf->SetAutoPageBreak(TRUE, 15);
//$pdf->setFontSubsetting(true);
$pdf->SetFont('Helvetica', '', 8, '', true);
$pdf->setPrintHeader(true);
//no imprime la cabecera ni la linea
$pdf->setPrintFooter(true);
// imprime el pie ni la linea
$pdf->SetHeaderData('img1.png', 180, "", "", array(0, 64, 255), array(0, 64, 128));
$pdf->AddPage();
// set cell padding
$pdf->setCellPaddings(0, 0, 2, 0);
// set cell margins
$pdf->setCellMargins(0.5, 0.5, 0.5, 0.5);
//*************
ob_end_clean();
//rompimiento de pagina
//*************
$cadena = '';
//$cadena .= '<center><div><img src="img10.png" alt="attribute" width="500" height="150" border="0" ></div></center>';
$cadena .= $_SESSION['encabezado_tabla'];
$cadena .= $_SESSION['cuerpo_tabla'];
foreach ($mis_pines as $p) {
    $uni = substr($p['u'], 0, -6);
    switch ($uni) {
        case "uvsf":
            if ($p['fecha_de_creacion_pin'] != '') {
Example #5
0
// 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 default font subsetting mode
$pdf->setFontSubsetting(true);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 12);
// add a page
// set cell padding
$pdf->setCellPaddings(1, 1, 1, 1);
// set cell margins
$pdf->setCellMargins(0, 1, 0, 1);
// set font color
$pdf->SetTextColor(50, 50, 50);
$pdf->SetFillColor(238, 238, 238);
$pdf->AddPage();
//	 Transparancy Image Stamp
//	if(!empty($dx_invoice_stamp_img)){
//		$pdf->Image($dx_invoice_stamp_img, 18, 15, 16, '', '', 'http://Dxinvoice.com', '', false, 300);
//	}
// Transparancy Image Stamp
if (!empty($dx_invoice_stamp_img)) {
    $pdf->Image($dx_invoice_stamp_img, $dx_stamp_position, 130, 30, '', '', '', '', false, 300);
}
//if(!empty($dx_invoice_signature_img))
Example #6
0
function showPdf($idReg = "")
{
    global $db;
    // Oficina
    //$sesIdOficina = $_SESSION[sesIdOficina];
    //$oficina = getValueTable("oficina","OFICINA","id_oficina",$sesIdOficina);
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', false, 'ISO-8859-1', false);
    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('Nicola Asuni');
    $pdf->SetTitle('TCPDF Example 009');
    $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.' 009', 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);
    // $pdf->SetFooterMargin(3);
    $pdf->setPageOrientation('P', '', 1);
    //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 some language dependent data:
    $lg = array();
    $lg['a_meta_charset'] = 'ISO-8859-1';
    $lg['a_meta_dir'] = 'ltr';
    $lg['a_meta_language'] = 'es';
    $lg['w_page'] = 'page';
    //set some language-dependent strings
    $pdf->setLanguageArray($lg);
    // -------------------------------
    // CONSULTA DE DATOS
    // -------------------------------
    $sql = "select * from SALIDA where id_salida='{$idReg}'";
    $db->query($sql);
    while ($db->next_record()) {
        $docu = $db->f(doc_tipo);
        $docuRef = $db->f(doc_ref);
        $docTipo = $db->f(doc_tipo);
        //$entSal= $db->f('ent_sal');
        $idSal = $idReg;
        $eir = $db->f(eir);
        $idOficina = $db->f(id_oficina);
        //$idCliente = $db->f('id_cliente');
        //$cliente = getValueTable("cliente","CLIENTE","id_cliente",$idCliente);
        $cliente = $db->f('consig');
        $idConte = $db->f('id_contenedor');
        $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte);
        if (preg_match("/(\\w{4})(\\d{7})/", $conte, $parts)) {
            $conteL = $parts[1];
            $conteN = $parts[2];
        }
        $maniStPago = $db->f(mani_st_pago);
        if ($maniStPago == "M") {
            $pagaManiobras = "MERCHANT";
        } elseif ($maniStPago == "C") {
            $pagaManiobras = "CARRIER";
        }
        $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte);
        $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq);
        $bkg = $db->f('bkg');
        $clase = $db->f('clase');
        $clase = "CLASE: {$clase} ";
        $damage = $db->f('damage');
        $sello = $db->f('sello');
        $nota = $db->f('nota');
        //$idTrans = $db->f('id_transporte');
        //$transp = getValueTable("transporte","TRANSPORTE","id_transporte",$idTrans);
        $transp = $db->f('transportista');
        $conteP1 = substr($conte, 0, 4);
        $conteP2 = substr($conte, 4, 10);
        if (preg_match("/(\\d+)(\\d)\$/", $conteP2, $parts)) {
            $conteP2 = $parts[1] . "-" . $parts[2];
        }
        $idNav = $db->f('id_naviera');
        $naviera = getValueTable("naviera", "NAVIERA", "id_naviera", $idNav);
        $placas = $db->f('placas');
        // $idOperador = $db->f('id_operador');
        //$operador = getValueTable("operador","OPERADOR","id_operador",$idOperador);
        $operador = $db->f('operador');
        $capFec = $db->f('cap_fec');
        $entSalTx = "SALIDA";
        $tipoMani = $db->f('tipo_mani');
        $noRecibo = $db->f('recibo');
        if ($tipoMani == "D") {
            $tipoManiTx = "MANIOBRA DE DESCARGA";
        }
        if ($tipoMani == "C") {
            $tipoManiTx = "MANIOBRA DE CARGA";
        }
        $maniCosto = $db->f('mani_costo');
        $repaCosto = $db->f('repa_costo');
        $sumaCpto = $maniCosto + $repaCosto;
        $montoLetra = traducirCifra($sumaCpto);
        $capIdUsr = $db->f('cap_id_usr');
        $capFec = $db->f('cap_fec');
        $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr);
        $modFec = $db->f('mod_fec');
        $consig = $db->f('consig');
    }
    // ------------------------------
    // DAÑOS
    // ------------------------------
    $sql = "select * from REL_NOME_SAL_PLUS ";
    $sql .= "where id_salida='{$idSal}' ";
    $dano = "";
    $db->query($sql);
    while ($db->next_record()) {
        $idRelNome = $db->f(id_rel_nome);
        $idNome = $db->f(id_nome);
        $idUbica = $db->f(id_ubicacion);
        $idDime = $db->f(id_dimension);
        $nome = getValueTable("nombre", "NOMENCLATURA", "id_nome", $idNome);
        $nomeCode = getValueTable("codigo", "NOMENCLATURA", "id_nome", $idNome);
        $ubica = getValueTable("ubicacion", "UBICACION", "id_ubicacion", $idUbica);
        $dimen = getValueTable("dimension", "DIMENSION", "id_dimension", $idDime);
        $dano .= "{$nome} ({$nomeCode}) : {$ubica} : {$dimen}\n";
    }
    $dano = nl2br($dano);
    // ---------------------------------------------------------
    // DATOS DEL RECIBO
    // ---------------------------------------------------------
    if ($noRecibo > 0) {
        $subTotal = $maniCosto + $repaCosto;
        $total = $subTotal;
        $subTotal = number_format($subTotal, 2);
        $total = number_format($total, 2);
        $datoRecibo = "\n        <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">    \n        <tr>\n        <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES OPEMANTRA</b></td>\n        <td>\n        <table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" align=\"center\">    \n        <tr>\n        <td bgcolor=\"black\"><b><font color=\"white\">FOLIO</font></b></td>\n        </tr>\n        <tr>\n        <td><font color=\"red\"><b>No. {$noRecibo}</b></font></td>\n        </tr>\n        </table>\n        </td>\n        </tr>    \n        <tr>\n        <td><b>FECHA</b></td>\n        <td><b>No.R.I.E.</b></td>                \n        <td></td>\n        <td><b>CONTENEDOR</b></td>\n        <td><b>TIPO</b></td>\n        </tr>\n        <tr>\n        <td>{$capFec}</td>        \n        <td>{$idReg}</td>\n        <td></td>\n        <td>{$conteL}{$conteN}</td>\n        <td>{$equipo}</td>\n        </tr>    \n        <tr>\n        <td><b>CONCEPTO</b></td>                \n        <td><b>TRANSPORTISTA</b></td>        \n        <td><b>OPERADOR</b></td>\n        <td colspan=\"2\"><b>OBSERVACIONES</b></td>        \n        </tr>             \n        <tr>    \n        <td>{$tipoManiTx}</td>        \n        <td>{$transp}</td>\n        <td>{$operador}</td> \n        <td colspan=\"2\">{$docu} {$docuRef} / {$nota}</td>               \n        </tr>\n        </table>\n        <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n        <tr>\n        <td ><b>FIRMA OPERADOR</b></td>\n        <td ><b>FIRMA DEL DEPOSITO</b></td>\n        <td>\n        <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n        <tr>\n        <td align=\"right\"><b>MANIOBRA \$</b></td>\n        <td align=\"right\">{$maniCosto}</td>\n        </tr>\n        <tr>\n        <td align=\"right\"><b>REPARACIONES \$</b></td>\n        <td align=\"right\">{$repaCosto}</td>\n        </tr>            \n        <tr>\n        <td align=\"right\"><b>TOTAL \$</b></td>\n        <td align=\"right\">{$total}</td>\n        </tr>\n        </table>\n        </td>\n        </tr>\n        ";
        if ($docTipo == "EFECTIVO") {
            $datoRecibo .= "\n            <tr>  \n            <td colspan=\"3\" align=\"right\">RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 </td>\n            </tr>\n            ";
        }
        $datoRecibo .= "</table>";
    }
    // -------------------------------------------------------------------
    $pdf->AddPage();
    // Logo
    $pdf->setJPEGQuality(100);
    $pdf->Image('../images/logo.jpg', 13, 4, 60, 30, '', '', '', false);
    //$pdf->Image('../images/nome.jpg', 15, 145, 185, 120,'','','',false);
    // set cell padding
    $pdf->setCellPaddings(1, 1, 1, 1);
    // set cell margins
    $pdf->setCellMargins(1, 1, 1, 1);
    // Encabezado
    $pdf->SetFillColor(197, 197, 197);
    // Trebol
    $pdf->SetFont('helvetica', '', 14);
    $pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true);
    //$txt="Av. ";
    $pdf->SetFont('helvetica', '', 7);
    $pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true);
    $pdf->SetFont('helvetica', '', 12);
    $tbl = <<<EOD
<table cellspacing="0" cellpadding="3" border="0" align="center">
    <tr bgcolor="#cacaca">
        <th>FOLIO</th>
    </tr>
    <tr>    \t
    \t<td><font color="red">S {$eir}</font></td>
    </tr>
</table>
EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    $txt = "RECIBO DE INTERCAMBIO DE EQUIPO (R.I.E)";
    $pdf->SetFont('helvetica', 'B', 12);
    $pdf->MultiCell(100, 4, $txt, 0, 'C', 0, 0, 60, 37, true);
    $pdf->SetFont('helvetica', '', 8);
    $tbl = <<<EOD
<br><br><br>
<table cellspacing="0" cellpadding="3" border="0" align="center">
    <tr>
        <th><b>CONTENEDOR</b></th>
        <th><b>CARACTERISTICAS FISICAS</b></th>
        <td><b>CLIENTE</b></td>
        <td><b>PAGA MANIOBRAS</b></td>
    </tr>
    <tr>
    \t<td>{$conteL}{$conteN}</td>
    \t<td>{$equipo} / {$damage} </td>
    \t<td>{$consig}</td>
        <td>{$pagaManiobras}</td>
    </tr>
    <tr bgcolor="#cacaca">
    \t<th colspan="4"><b>{$entSalTx}</b></th>
    </tr>
    <tr>
    \t<td><b>NAVIERA</b></td>
    \t<td><b>FECHA Y HORA</b></td>
        <td><b>BOOKING / BL</b></td>        
    \t<td><b>ESTADO FISICO</b></td>    \t
    </tr>
    <tr>
    \t<td>{$naviera}</td>
    \t<td>{$capFec}</td>
        <td>{$bkg}</td>        
    \t<td>{$clase}</td>    \t
    </tr>    
    <tr>
    \t<td><b>TRANSPORTISTA</b></td>        
        <td><b>OPERADOR</b></td>
        <td><b>PLACAS</b></td>                
    \t<td><b>SELLO</b></td>    \t    \t
    </tr>\t
    <tr>
    \t<td>{$transp}</td>
        <td>{$operador}</td>
        <td>{$placas}</td>
        <td>{$sello}</td>
    </tr>            
    <tr >
    \t<td colspan="2"><b>OBSERVACIONES</b></td>    \t
        <td colspan="2"><b>DANOS</b></td>
    </tr>    
    <tr >
        <td colspan="2">{$nota}</td>
    \t<td colspan="2">{$dano}</td>
    </tr>
    <tr>
        <td><b>OPERADOR<br><br><br>Nombre y Firma</b></td>
        <td><b>INSPECTOR<br><br><br>Nombre y Firma</b></td>
        <td colspan="2">EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.</td>
    </tr>
    <tr bgcolor="#cacaca">
        <td colspan="4"><i>Capturo: {$capUsr}<br>Fecha captura: {$modFec} </i></td>
    </tr>
</table>
<br><br><br>
<!-- {$datoRecibo} -->


EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    /*
    ($noRecibo>0)?$corY=180:$corY=125;
    $txt="OPERADOR\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(40,10,$txt, 0, 'C',0, 0, 15, $corY,true);
    $txt="INSPECTOR\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(30, 10,$txt, 0, 'C',0, 0, 55, $corY,true);
    $txt="EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS. Solicitarla al correo: factu@demo.com.mx";
    $pdf->MultiCell(105, 10,$txt, 0, 'L',0, 0, 95, $corY,true);
    
    
    $txt="EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO
          PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.
          Solicitarla al correo: facturacionpatios@demo.com.mx";
    */
    //($noRecibo>0)?$corY=200:$corY=125;
    //$pdf->MultiCell(185, 10,$txt, 1, 'C',0, 0, 15, 200,true);
    //Close and output PDF document
    $pdf->Output('eirSalida.pdf', 'I');
}
Example #7
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 (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
    require_once dirname(__FILE__) . '/lang/eng.php';
    $pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 10);
// add a page
$pdf->AddPage();
// set cell padding
$pdf->setCellPaddings(1, 1, 1, 1);
// set cell margins
$pdf->setCellMargins(1, 1, 1, 1);
// set color for background
$pdf->SetFillColor(255, 255, 127);
// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
// set some text for example
$txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
//$final = $pdf->write2DBarcode('7024736019|3|2104002021751|2015-10-02|30.50|30.50|15451254|0|0|0|0', 'QRCODE,L', '', '', 30, 30, '', 'N');
// Multicell test
$pdf->MultiCell(55, 5, '[LEFT] ' . $txt, 1, 'L', 1, 0, '', '', true);
$pdf->MultiCell(55, 5, '[RIGHT] ' . $txt, 1, 'R', 0, 1, '', '', true);
$pdf->MultiCell(55, 5, '[CENTER] ' . $txt, 1, 'C', 0, 0, '', '', true);
$pdf->MultiCell(55, 5, '[JUSTIFY] ' . $txt . "\n", 1, 'J', 1, 2, '', '', true);
$pdf->MultiCell(55, 5, '[DEFAULT] ' . $txt, 1, '', 0, 1, '', '', true);
$pdf->Ln(4);
Example #8
0
$cy=dc_YDown($a);
$pdf->Line($x1,$cy,$x2,$cy);
$cy=dc_YDown($b);
}

// set JPEG quality
$pdf->setJPEGQuality(75);

// Image method signature:
// 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)

// set font
$pdf->SetFont(mydeffont, '', 11, '', true);

// set cell padding
$pdf->setCellPaddings(0, 0, 0, 0.5); //$left='', $top='', $right='', $bottom='')

// set cell margins
$pdf->setCellMargins(0, 0, 0, 0);

// set color for background
$pdf->SetFillColor(255, 255, 255);

// 1. Parameter: sesuaikan dg parameter di Page Selection Bar >> Edit
$cid=gets('token');
$lap_cetak=gets('lap_cetak',0);
$lap_tglcetak=gets('lap_tglcetak',0);
$lap_sum=gets('lap_sum',0);

// 2. Queries: samakan dg Query >> Edit
$t=mysql_query("SELECT * FROM pus_stockhist WHERE replid='$cid'");
Example #9
0
 function addressLabelPDF($outputformat)
 {
     $pdf = new TCPDF('L', '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->SetTopMargin(7.5);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, 0);
     // remove default header/footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // ---------------------------------------------------------
     // set font
     if ($outputformat == 3) {
         $pdf->SetFont('helvetica', '', 12);
     } else {
         $pdf->SetFont('helvetica', '', 14);
     }
     // set cell padding
     $pdf->setCellPaddings(0, 0, 0, 0);
     // set cell margins
     $pdf->setCellMargins(0, 0, 0, 0);
     $pdf->addPage();
     if ($outputformat == 3) {
         $x = 135;
         $y = 40;
     } else {
         $x = 165;
         $y = 30;
     }
     $this->Address();
     $pdf->MultiCell(100, 5, $this->loan->ShippedTo, 0, 'L', 0, 1, $x, $y, true, false, true);
     // move pointer to last page
     $pdf->lastPage();
     // ---------------------------------------------------------
     //Close and output PDF document
     $pdf->Output('mellabel.pdf', 'I');
 }
Example #10
0
    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 005');
        $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 . ' 005', 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 font
        $pdf->SetFont('times', '', 10);
        // add a page
        $pdf->AddPage();
        // set cell padding
        $pdf->setCellPaddings(1, 1, 1, 1);
        // set cell margins
        $pdf->setCellMargins(1, 1, 1, 1);
        // set color for background
        $pdf->SetFillColor(255, 255, 127);
        // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
        // set some text for example
        $txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
        // Multicell test
        $pdf->MultiCell(55, 5, '[LEFT] ' . $txt, 1, 'L', 1, 0, '', '', true);
        $pdf->MultiCell(55, 5, '[RIGHT] ' . $txt, 1, 'R', 0, 1, '', '', true);
        $pdf->MultiCell(55, 5, '[CENTER] ' . $txt, 1, 'C', 0, 0, '', '', true);
        $pdf->MultiCell(55, 5, '[JUSTIFY] ' . $txt . "\n", 1, 'J', 1, 2, '', '', true);
        $pdf->MultiCell(55, 5, '[DEFAULT] ' . $txt, 1, '', 0, 1, '', '', true);
        $pdf->Ln(4);
        // set color for background
        $pdf->SetFillColor(220, 255, 220);
        // Vertical alignment
        $pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - TOP] ' . $txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'T');
        $pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - MIDDLE] ' . $txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'M');
        $pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - BOTTOM] ' . $txt, 1, 'J', 1, 1, '', '', true, 0, false, true, 40, 'B');
        $pdf->Ln(4);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // set color for background
        $pdf->SetFillColor(215, 235, 255);
        // set some text for example
        $txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.

Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.';
        // print a blox of text using multicell()
        $pdf->MultiCell(80, 5, $txt . "\n", 1, 'J', 1, 1, '', '', true);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // AUTO-FITTING
        // set color for background
        $pdf->SetFillColor(255, 235, 235);
        // Fit text on cell by reducing font size
        $pdf->MultiCell(55, 60, '[FIT CELL] ' . $txt . "\n", 1, 'J', 1, 1, 125, 145, true, 0, false, true, 60, 'M', true);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // CUSTOM PADDING
        // set color for background
        $pdf->SetFillColor(255, 255, 215);
        // set font
        $pdf->SetFont('helvetica', '', 8);
        // set cell padding
        $pdf->setCellPaddings(2, 4, 6, 8);
        $txt = "CUSTOM PADDING:\nLeft=2, Top=4, Right=6, Bottom=8\nLorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue.\n";
        $pdf->MultiCell(55, 5, $txt, 1, 'J', 1, 2, 125, 210, true);
        // move pointer to last page
        $pdf->lastPage();
        $this->comparePdfs($pdf);
    }
Example #11
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');
 }
Example #12
0
 public function PostAction()
 {
     $rma_ids = $this->getRequest()->getParam('povratnica');
     if (!count($rma_ids)) {
         exit;
     }
     $broj_povratnice = Mage::helper('rma')->getBrojPovratnice();
     $dobavljac = Mage::getModel('rma/rmadevices')->load($rma_ids[0])->getSupplier();
     require_once Mage::getBaseDir('lib') . '/tcpdf/tcpdf.php';
     // create new PDF document
     $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(150, 0, 'BENGAZI DOO NIŠ, KRFSKA 18', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(100, 0, 'PIB: 104028469', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(100, 0, 'šifra delatnosti: 4666', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(100, 0, 'TR: 160-214265-03 / Banca Intesa a.d.', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 16);
     $pdf->MultiCell(100, 0, 'Povratnica na servis ' . date("Y") . "/" . $broj_povratnice, 0, 'L', 1, 0, 65, '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(100, 6, 'Niš, ' . date("j.n.Y"), 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $dobavljac, 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->MultiCell(20, 8, "Redni broj", 'TL', 'C', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(70, 8, "Naziv artikla", 'LT', 'C', 1, 0, 30, '', true, 0, false);
     $pdf->MultiCell(20, 8, "jm", 'LT', 'C', 1, 0, 100, '', true, 0, false);
     $pdf->MultiCell(20, 8, "kolicina", 'LT', 'C', 1, 0, 120, '', true, 0, false);
     $pdf->MultiCell(60, 8, "Opis kvara", 'LTR', 'C', 1, 0, 140, '', true, 0, false);
     $pdf->Ln();
     foreach ($rma_ids as $pos => $rbr) {
         $rma = Mage::getModel('rma/rmadevices')->load($rbr);
         $sn = $rma->getSerial() ? ' sn: ' . $rma->getSerial() : '';
         $pdf->MultiCell(20, 8, $pos + 1, 'TL', 'C', 1, 0, '', '', true, 0, false);
         $pdf->MultiCell(70, 8, $rma->getName() . $sn, 'LT', 'C', 1, 0, 30, '', true, 0, false);
         $pdf->MultiCell(20, 8, "kom", 'LT', 'C', 1, 0, 100, '', true, 0, false);
         $pdf->MultiCell(20, 8, "1", 'LT', 'C', 1, 0, 120, '', true, 0, false);
         $pdf->MultiCell(60, 8, $rma->getDescription(), 'LTR', 'C', 1, 0, 140, '', true, 0, false);
         $pdf->Ln();
         $rma->setDocumentId($broj_povratnice)->save();
     }
     $pdf->MultiCell(190, 8, "", 'T', 'C', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->MultiCell(50, 5, "", 'B', 'C', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(20, 2, "mp", 0, 'C', 1, 0, 100, '', true, 0, false);
     $pdf->MultiCell(50, 5, "Predrag Stevanovic", 'B', 'C', 1, 0, 150, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(50, 10, "robu primio", 0, 'C', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 10, "robu predao", 0, 'C', 1, 0, 150, '', true, 0, false);
     // Close and output PDF document
     $pdf->IncludeJS("print();");
     //ob_clean(); //stupid tcpdf need this
     $pdf->Output(Mage::getBaseDir('media') . '/rma_pdf/' . $broj_povratnice . "-" . $dobavljac . '.pdf', 'FI');
     exit;
 }