Ejemplo n.º 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;
 }
Ejemplo n.º 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 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);
     // 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);
     // -------------------------------------------------------------------
     // add a page
     $pdf->AddPage();
     // 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)
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // Example of Image from data stream ('PHP rules')
     $imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
     // The '@' character is used to indicate that follows an image data stream and not an image file name
     $pdf->Image('@' . $imgdata);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // Image example with resizing
     $pdf->Image('./tests/images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // test fitbox with all alignment combinations
     $horizontal_alignments = array('L', 'C', 'R');
     $vertical_alignments = array('T', 'M', 'B');
     $x = 15;
     $y = 35;
     $w = 30;
     $h = 30;
     // test all combinations of alignments
     for ($i = 0; $i < 3; ++$i) {
         $fitbox = $horizontal_alignments[$i] . ' ';
         $x = 15;
         for ($j = 0; $j < 3; ++$j) {
             $fitbox[1] = $vertical_alignments[$j];
             $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 128));
             $pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
             $x += 32;
             // new column
         }
         $y += 32;
         // new row
     }
     $x = 115;
     $y = 35;
     $w = 25;
     $h = 50;
     for ($i = 0; $i < 3; ++$i) {
         $fitbox = $horizontal_alignments[$i] . ' ';
         $x = 115;
         for ($j = 0; $j < 3; ++$j) {
             $fitbox[1] = $vertical_alignments[$j];
             $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
             $pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
             $x += 27;
             // new column
         }
         $y += 52;
         // new row
     }
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // Stretching, position and alignment example
     $pdf->SetXY(110, 200);
     $pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
     $pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
     $this->comparePdfs($pdf);
 }
Ejemplo n.º 3
2
function student_kolizijapdf()
{
    global $userid;
    require_once 'lib/tcpdf/tcpdf.php';
    $semestar = intval($_REQUEST['semestar']);
    if ($semestar == 1) {
        $tekst_semestar = "zimskom";
    } else {
        $tekst_semestar = "ljetnjem";
    }
    // Prikupljam podatke iz baze
    // Za koju godinu se prijavljuje?
    $q1 = myquery("select id, naziv from akademska_godina where aktuelna=1");
    $q2 = myquery("select id, naziv from akademska_godina where id>" . mysql_result($q1, 0, 0) . " order by id limit 1");
    if (mysql_num_rows($q2) < 1) {
        //	nicemessage("U ovom trenutku nije aktiviran upis u sljedeću akademsku godinu.");
        //	return;
        // Pretpostavljamo da se upisuje u aktuelnu?
        $zagodinu = mysql_result($q1, 0, 0);
        $agnaziv = mysql_result($q1, 0, 1);
        $q3 = myquery("select id from akademska_godina where id<{$zagodinu} order by id desc limit 1");
        $proslagodina = mysql_result($q3, 0, 0);
    } else {
        $proslagodina = mysql_result($q1, 0, 0);
        $zagodinu = mysql_result($q2, 0, 0);
        $agnaziv = mysql_result($q2, 0, 1);
    }
    // Koji je odsjek?
    $q4 = myquery("select s.id, s.naziv, i.naziv, ss.semestar from studij as s, student_studij as ss, institucija as i where ss.student={$userid} and ss.studij=s.id and s.institucija=i.id and ss.akademska_godina={$proslagodina} order by semestar desc limit 1");
    if (mysql_num_rows($q4) < 1) {
        // Očito da su aktuelna i prošla godina loše određene
        $q4 = myquery("select s.id, s.naziv, i.naziv, ss.semestar, ss.akademska_godina from studij as s, student_studij as ss, institucija as i where ss.student={$userid} and ss.studij=s.id and s.institucija=i.id order by akademska_godina desc, semestar desc limit 1");
        if (mysql_num_rows($q4) < 1) {
            biguglyerror("Nikada niste bili nas student!");
            return;
        }
        $proslagodina = mysql_result($q4, 0, 4);
        if (mysql_num_rows($q2) < 1) {
            biguglyerror("Nije kreirana nova akademska godina u koju se upisujete.");
            print "Kontaktirajte administratora.";
            return;
        }
        $q2 = myquery("select id, naziv from akademska_godina where id>{$proslagodina} order by id limit 1");
        $zagodinu = mysql_result($q2, 0, 0);
        $agnaziv = mysql_result($q2, 0, 1);
    }
    $studij = mysql_result($q4, 0, 0);
    $studij_naziv = mysql_result($q4, 0, 1);
    $institucija_naziv = mysql_result($q4, 0, 2);
    $godina_studija = ceil(mysql_result($q4, 0, 3) / 2);
    // Da li je student popunio ugovor za drugi odsjek?
    $tekst_mijenja = "";
    $q7 = myquery("select s.id, s.naziv, i.naziv from studij as s, ugovoroucenju as uou, institucija as i where uou.student={$userid} and uou.studij=s.id and s.institucija=i.id and uou.akademska_godina={$zagodinu}");
    if (mysql_num_rows($q7) > 1 && $studij != mysql_result($q7, 0, 0)) {
        $institucija_naziv = mysql_result($q7, 0, 2);
        $tekst_mijenja = "predao sam zahtjev za promjenu studija na " . mysql_result($q7, 0, 1) . ". S tim u vezi, ";
    }
    // Zapis u tabeli kolizija
    $predmeti_kolizija = $predmeti_ects = array();
    $q10 = myquery("select p.id, p.naziv, p.ects from kolizija as k, predmet as p where k.student={$userid} and k.akademska_godina={$zagodinu} and k.semestar={$semestar} and k.predmet=p.id");
    if (mysql_num_rows($q10) < 1) {
        biguglyerror("Vi niste popunili Zahtjev za koliziju za {$agnaziv} godinu!");
        print "Ako je ovo greska, kontaktirajte administratora.";
        return;
    }
    while ($r10 = mysql_fetch_row($q10)) {
        $predmeti_kolizija[$r10[0]] = $r10[1];
        $predmeti_ects[$r10[0]] = $r10[2];
    }
    if ($semestar == 1) {
        $s2 = 1;
    } else {
        $s2 = 0;
    }
    // Predmeti koje nije polozio
    $predmeti_prenos = array();
    $q20 = myquery("select p.id, p.naziv, p.ects from student_predmet as sp, ponudakursa as pk, predmet as p where sp.student={$userid} and sp.predmet=pk.id and pk.predmet=p.id and pk.akademska_godina={$proslagodina} and pk.semestar MOD 2={$s2} and pk.semestar<{$godina_studija}*2+1 and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id and ko.ocjena != 5)=0");
    while ($r20 = mysql_fetch_row($q20)) {
        if (array_key_exists($r20[0], $predmeti_kolizija)) {
            continue;
        }
        $predmeti_prenos[$r20[0]] = $r20[1];
        $predmeti_ects[$r20[0]] = $r20[2];
    }
    // Podaci o studentu
    $q30 = myquery("select ime, prezime, brindexa, spol from osoba where id={$userid}");
    $ime = mysql_result($q30, 0, 0);
    $prezime = mysql_result($q30, 0, 1);
    $brindexa = mysql_result($q30, 0, 2);
    $spol = mysql_result($q30, 0, 3);
    if ($spol == "") {
        $spol = spol(mysql_result($q30, 0, 0));
    }
    if ($spol == "M") {
        $student = "student";
        $polozio = "položio";
    } else {
        $student = "studentica";
        $polozio = "položila";
    }
    ?>
<html>
<head>
<title>Zahtjev za koliziju</title>
</head>
<body>
<p>Univerzitet u Sarajevu<br>
Elektrotehnički fakultet Sarajevo<br>
<?php 
    echo $institucija_naziv;
    ?>
</p>

<p>&nbsp;</p>

<p>Student: <?php 
    echo "{$ime} {$prezime} ({$brindexa})";
    ?>
</p>

<p>&nbsp;</p>

<p><b>Predmet: ZAHTJEV ZA KOLIZIJU</b></p>

<p>&nbsp;</p>

<p>Ja, <?php 
    echo "{$ime} {$prezime}";
    ?>
, <?php 
    echo $student;
    ?>
 studija <?php 
    echo $studij_naziv;
    ?>
, <?php 
    echo $godina_studija;
    ?>
. godina, broj indexa <?php 
    echo $brindexa;
    ?>
, <?php 
    echo $tekst_mijenja;
    ?>
 molim Vas da mi u skladu sa Zakonom o visokom obrazovanju Kantona Sarajevo, u <?php 
    echo $tekst_semestar;
    ?>
 semestru akademske <?php 
    echo $agnaziv;
    ?>
 godine odobrite slušanje sljedećih predmeta sa <?php 
    echo $godina_studija + 1;
    ?>
. godine studija u koliziji:</p>

<ul>
<?php 
    foreach ($predmeti_kolizija as $id => $predmet) {
        print "<li>{$predmet} (" . $predmeti_ects[$id] . " ECTS)</li>\n";
    }
    ?>
</ul>

<p>&nbsp;</p>

<p>Obzirom da sa <?php 
    echo $godina_studija;
    ?>
. godine studija nisam <?php 
    echo $polozio;
    ?>
 sljedeće predmete:</p>

<ul>
<?php 
    foreach ($predmeti_prenos as $id => $predmet) {
        print "<li>{$predmet} (" . $predmeti_ects[$id] . " ECTS)</li>\n";
    }
    ?>
</ul>

te da se jedan predmet prenosi, nije prekoračen maksimalan broj od 30 ECTS kredita po semestru.</p>

<p>&nbsp;</p>

<p>U nadi da ćete udovoljiti mom zahtjevu,</p>

<p>&nbsp;</p>

<table border="0"><tr><td width="100%">&nbsp;</td><td align="right"><p>&nbsp;</p><p>_____________________________________</p></td></tr>
<tr><td width="100%">&nbsp;</td><td align="center"><?php 
    echo "{$ime} {$prezime}";
    ?>
</td></tr></table>
</body>
</html>
<?php 
    return;
    $q5 = myquery("select uu.id, s.id, s.naziv, s.naziv_en, uu.semestar, s.tipstudija from ugovoroucenju as uu, studij as s where uu.student={$userid} and uu.akademska_godina={$zagodinu} and uu.studij=s.id order by semestar desc limit 1");
    if (mysql_num_rows($q5) < 1) {
        niceerror("Nije kreiran ugovor o učenju za studenta.");
        return;
    }
    $ugovorid = mysql_result($q5, 0, 0);
    $studij = mysql_result($q5, 0, 1);
    $studijbos = mysql_result($q5, 0, 2);
    $studijbos = substr($studijbos, 0, strpos($studijbos, "(") - 1);
    $studijeng = mysql_result($q5, 0, 3);
    $sem2 = mysql_result($q5, 0, 4);
    $tipstudija = mysql_result($q5, 0, 5);
    $sem1 = $sem2 - 1;
    $godina = $sem2 / 2;
    // Ostali podaci o osobi
    $q10 = myquery("select ime, prezime, brindexa from osoba where id={$userid}");
    $imeprezime = mysql_result($q10, 0, 0) . " " . mysql_result($q10, 0, 1);
    $brindexa = mysql_result($q10, 0, 2);
    // Najnoviji plan za odabrani studij
    $q6 = myquery("select godina_vazenja from plan_studija where studij={$studij} order by godina_vazenja desc limit 1");
    if (mysql_num_rows($q6) < 1) {
        niceerror("Nepostojeći studij");
        return;
    }
    $najnoviji_plan = mysql_result($q6, 0, 0);
    // Da li je ponovac?
    $q20 = myquery("select semestar from student_studij where student={$userid} and studij={$studij} and akademska_godina={$proslagodina} order by semestar desc limit 1");
    if ($sem1 > mysql_result($q20, 0, 0)) {
        $ponovac = 0;
    } else {
        $ponovac = 1;
    }
    // Odredjujemo da li ima prenesenih predmeta
    // TODO: ovo sada ne radi za izborne predmete
    $q20 = myquery("select p.sifra, p.naziv, p.ects, ps.semestar from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and (ps.semestar=" . ($sem1 - 1) . " or ps.semestar=" . ($sem1 - 2) . ") and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    if (mysql_num_rows($q20) > 1) {
        niceerror("Nemate uslove za upis {$godina}. godine studija");
        print "Sačekajte da prikupite uslov ili popunite Ugovor za prethodnu godinu studija.";
        return;
    }
    if (mysql_num_rows($q20) == 1) {
        $ima_preneseni = 1;
        $preneseni_sifra = mysql_result($q20, 0, 0);
        $preneseni_naziv = mysql_result($q20, 0, 1);
        $preneseni_ects = mysql_result($q20, 0, 2);
        $preneseni_semestar = mysql_result($q20, 0, 3);
    } else {
        $ima_preneseni = 0;
    }
    // Privremeni hack za master
    if ($tipstudija == 3) {
        $mscfile = "-msc";
    } else {
        if ($tipstudija == 2) {
            $mscfile = "";
        }
    }
    // Ako čovjek upisuje prvu godinu nečeka (mastera), broj indexa je netačan!
    if ($godina == 1) {
        $brindexa = "";
    }
    // ----- Pravljenje PDF dokumenta
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator("Zamger");
    $pdf->SetTitle('Domestic Learning Agreement / Ugovor o ucenju');
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(0, 0, 0);
    //set auto page breaks
    $pdf->SetAutoPageBreak(false);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333);
    $pdf->setJPEGQuality(100);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('freesans', 'B', 9);
    $pdf->SetHeaderData("", 0, "", "");
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    // add a page
    $pdf->AddPage();
    //	$pdf->Image("images/content/150dpi/ETF-Domestic-contract-PGS-ALL-0.png",210,297,0,0,'','','',true,150);
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-0.png", 0, 0, 210, 0, '', '', '', true, 150);
    $pdf->SetXY(175, 34);
    $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
    $pdf->SetXY(175, 42);
    $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
    $pdf->SetXY(175, 50);
    $pdf->Cell(23, 0, $sem1 . ". & " . $sem2, 0, 0, 'C');
    $pdf->SetXY(70, 48);
    $pdf->Cell(100, 0, $studijeng, 0, 0);
    $pdf->SetXY(70, 52);
    $pdf->Cell(100, 0, $studijbos, 0, 0);
    $pdf->SetXY(70, 62);
    $pdf->Cell(100, 0, $imeprezime);
    $pdf->SetXY(70, 69);
    $pdf->Cell(100, 0, $brindexa);
    // PRVI SEMESTAR
    $pdf->AddPage();
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-1.png", 0, 0, 210);
    $pdf->SetXY(175, 34);
    $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
    $pdf->SetXY(175, 42);
    $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
    $pdf->SetXY(175, 50);
    $pdf->Cell(23, 0, $sem1 . ".", 0, 0, 'C');
    $pdf->SetXY(70, 48);
    $pdf->Cell(100, 0, $studijeng, 0, 0);
    $pdf->SetXY(70, 52);
    $pdf->Cell(100, 0, $studijbos, 0, 0);
    $pdf->SetXY(70, 62);
    $pdf->Cell(100, 0, $imeprezime);
    $pdf->SetXY(70, 69);
    $pdf->Cell(100, 0, $brindexa);
    // Spisak obaveznih predmeta na neparnom semestru
    // Ako je ponovac, ne prikazujemo predmete koje je polozio
    if ($ponovac == 1) {
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem1} and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        // Ako nije, trebamo prikazati one koje je položio u koliziji
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem1} and ps.obavezan=1 and ps.predmet=p.id");
    }
    $ykoord = 95;
    $ects = 0;
    while ($r100 = mysql_fetch_row($q100)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r100[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r100[1]);
        $e = "{$r100['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r100[2];
    }
    // Da li je prenesen predmet na neparnom semestru?
    if ($ima_preneseni && $preneseni_semestar % 2 == 1) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $preneseni_sifra);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $preneseni_naziv);
        $e = "{$preneseni_ects}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $preneseni_ects;
    }
    // Spisak izbornih predmeta
    if ($ponovac == 1) {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem1} and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem1}");
    }
    $ykoord = 123;
    while ($r110 = mysql_fetch_row($q110)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r110[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r110[1]);
        $e = "{$r110['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r110[2];
    }
    // Suma ects
    if (!strchr($ects, ".")) {
        $ects .= ".0";
    }
    $pdf->SetXY(170, 135);
    $pdf->Cell(100, 0, $ects);
    // DRUGI SEMESTAR
    $pdf->AddPage();
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-2.png", 0, 0, 210);
    $pdf->SetXY(175, 34);
    $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
    $pdf->SetXY(175, 42);
    $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
    $pdf->SetXY(175, 50);
    $pdf->Cell(23, 0, $sem2 . ".", 0, 0, 'C');
    $pdf->SetXY(70, 48);
    $pdf->Cell(100, 0, $studijeng, 0, 0);
    $pdf->SetXY(70, 52);
    $pdf->Cell(100, 0, $studijbos, 0, 0);
    $pdf->SetXY(70, 62);
    $pdf->Cell(100, 0, $imeprezime);
    $pdf->SetXY(70, 69);
    $pdf->Cell(100, 0, $brindexa);
    // Spisak obaveznih predmeta na parnom semestru
    if ($ponovac == 1) {
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem2} and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem2} and ps.obavezan=1 and ps.predmet=p.id");
    }
    $ykoord = 95;
    $ects = 0;
    while ($r100 = mysql_fetch_row($q100)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r100[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r100[1]);
        $e = "{$r100['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r100[2];
    }
    // Da li je prenesen predmet na parnom semestru?
    if ($ima_preneseni && $preneseni_semestar % 2 == 0) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $preneseni_sifra);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $preneseni_naziv);
        $e = "{$preneseni_ects}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $preneseni_ects;
    }
    // Spisak izbornih predmeta
    if ($ponovac == 1) {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem2} and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem2}");
    }
    $ykoord = 123;
    while ($r110 = mysql_fetch_row($q110)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r110[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r110[1]);
        $e = "{$r110['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r110[2];
    }
    // Suma ects
    if (!strchr($ects, ".")) {
        $ects .= ".0";
    }
    $pdf->SetXY(170, 135);
    $pdf->Cell(100, 0, $ects);
    // ---------------------------------------------------------
    //Close and output PDF document
    $pdf->Output('ugovor_o_ucenju.pdf', 'I');
    //============================================================+
    // END OF FILE
    //============================================================+
}
Ejemplo n.º 4
1
 function createPdfFromImage($arrImagename, $strFilename)
 {
     $this->load->library('tcpdf/TCPDF');
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
         require_once dirname(__FILE__) . '/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // -------------------------------------------------------------------
     $pdf->AddPage();
     $pdf->setJPEGQuality(75);
     $imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
     $pdf->Image('@' . $imgdata);
     $intY = 25;
     foreach ($arrImagename as $intkey => $oneImage) {
         if ($intkey % 2 == 0 && $intkey != 0) {
             $intY = 25;
             $pdf->AddPage();
         }
         $pdf->Image($oneImage, 10, $intY, 180, 103, 'png', '', 'C', true, 150, '', false, false, 1, false, false, false);
         $intY += 125;
     }
     $pdf->Output($strFilename . '.pdf', 'I');
 }
Ejemplo n.º 5
1
function izvjestaj_prijemni_brzi_unos()
{
    require_once 'lib/tcpdf/tcpdf.php';
    $termin = intval($_REQUEST['termin']);
    $osoba = intval($_REQUEST['osoba']);
    $q10 = myquery("select ime, prezime, imeoca, jmbg from osoba where id={$osoba}");
    if (mysql_num_rows($q10) < 1) {
        biguglyerror("Nepostojeća osoba");
        zamgerlog("nepostojeca osoba {$osoba}", 3);
        return;
    }
    $ime = mysql_result($q10, 0, 0);
    $prezime = mysql_result($q10, 0, 1);
    $imeoca = mysql_result($q10, 0, 2);
    $jmbg = mysql_result($q10, 0, 3);
    $q20 = myquery("select sifra, jezik from prijemni_obrazac where osoba={$osoba} and prijemni_termin={$termin}");
    if (mysql_num_rows($q20) < 1) {
        biguglyerror("Ne postoji obrazac za ovu osobu");
        zamgerlog("za osobu u{$osoba} ne postoji obrazac na terminu {$termin}", 3);
        return;
    }
    $sifra = mysql_result($q20, 0, 0);
    $jezik = mysql_result($q20, 0, 1);
    $datum = date("d. m. Y.");
    $vrijeme = date("h:i");
    // ----- Pravljenje PDF dokumenta
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator("Zamger");
    $pdf->SetTitle('Sifra kandidata i pregled vaznijih datuma');
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(0, 0, 0);
    //set auto page breaks
    $pdf->SetAutoPageBreak(false);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333);
    $pdf->setJPEGQuality(100);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('freesans', '', 48);
    $pdf->SetHeaderData("", 0, "", "");
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    // add a page
    $pdf->AddPage();
    //	$pdf->Image("images/content/150dpi/ETF-Domestic-contract-PGS-ALL-0.png",210,297,0,0,'','','',true,150);
    if ($jezik == "en") {
        $pdf->Image("images/content/150dpi/obrazac_sa_sifrom_en.png", 0, 0, 210, 0, '', '', '', true, 150);
        $en_offset = 7;
    } else {
        $pdf->Image("images/content/150dpi/obrazac_sa_sifrom.png", 0, 0, 210, 0, '', '', '', true, 150);
        $en_offset = 0;
    }
    $pdf->SetXY(130, 15);
    $pdf->Cell(23, 0, $sifra, 0, 0, 'C');
    $pdf->SetFont('freesans', '', 16);
    $pdf->SetXY(80, 62 + $en_offset);
    $pdf->Cell(23, 0, "{$ime} ({$imeoca}) {$prezime}");
    $pdf->SetXY(80, 73 + $en_offset);
    $pdf->Cell(23, 0, $jmbg);
    $pdf->SetFont('freesans', '', 14);
    $pdf->SetXY(40, 113 + $en_offset);
    $pdf->Cell(23, 0, $datum);
    $pdf->SetXY(130, 113 + $en_offset);
    $pdf->Cell(23, 0, $vrijeme);
    // ---------------------------------------------------------
    //Close and output PDF document
    $pdf->Output('obrazac_sa_sifrom.pdf', 'I');
    //============================================================+
    // END OF FILE
    //============================================================+
}
Ejemplo n.º 6
1
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'] = 'en';
    $lg['w_page'] = 'page';
    //set some language-dependent strings
    $pdf->setLanguageArray($lg);
    // -------------------------------
    // CONSULTA DE DATOS
    // -------------------------------
    $sql = "select * from INVENTARIO where id_inventario='{$idReg}'";
    $db->query($sql);
    while ($db->next_record()) {
        $entSal = $db->f('ent_sal');
        $eir = $db->f(eir);
        //$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];
        }
        $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');
        if ($entSal == "E") {
            $entSalTx = "INVENTARIO";
        }
        if ($entSal == "S") {
            $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');
        $montoLetra = traducirCifra($maniCosto);
        $capIdUsr = $db->f('cap_id_usr');
        $capFec = $db->f('cap_fec');
        $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr);
    }
    // ------------------------------
    // DAÑOS
    // ------------------------------
    $sql = "select * from REL_NOME ";
    $sql .= "where id_inventario='{$idReg}' ";
    $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) {
        $datoRecibo = "\n            <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">    \n            <tr>\n            <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES</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\">{$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=\"left\">{$maniCosto}</td>\n            </tr>\n            <tr>\n            <td align=\"right\"><b>SUBTOTAL \$</b></td>\n            <td align=\"left\">{$maniCosto}</td>\n            </tr>\n            <tr>\n            <td align=\"right\"><b>IVA \$</b></td>\n            <td align=\"left\">{$maniIva}</td>\n            </tr>\n            <tr>\n            <td align=\"right\"><b>TOTAL \$</b></td>\n            <td align=\"left\">{$maniCosto}</td>\n            </tr>\n            </table>\n            </td>\n            </tr>\n            <tr>\n            <td colspan=\"3\" align=\"left\">RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 </td>\n            </tr>\n            </table> \n            ";
    }
    // -------------------------------------------------------------------
    $pdf->AddPage();
    // Logo
    $pdf->setJPEGQuality(100);
    $pdf->Image('../images/logo_color.jpg', 13, 4, 25, 25, '', '', '', false);
    //$pdf->Image('../images/nome.jpg', 15, 140, 185, 96,'','','',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);
    if ($sesIdOficina == 1) {
        $txt = "ALMARTCON, S.A. DE C.V.\n\"El Trébol\"";
        $pdf->SetFont('helvetica', '', 14);
        $pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true);
        $txt = "Direccion, Guatemala \nTels.: 505-2350-0976 Cel. 505-8635-0708";
        $pdf->SetFont('helvetica', '', 7);
        $pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true);
    }
    /*        elseif( $sesIdOficina==3 ){
                $txt = "TRANSPORTES MALEJA, S.A. DE C.V.\n\"El Pino\"";
                $pdf->SetFont('helvetica', '', 14);
                $pdf->MultiCell(65, 4,$txt, 0, 'L',0, 0, 40, 10,true);            
                $txt="Carretera Querétaro San Luis Potosí Km.28\nCol.Buenavista Santa Rosa Jauregui\nQueretaro, QRO.";
                $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="1" align="center">
    <tr bgcolor="#cacaca">
        <th>FOLIO</th>
    </tr>
    <tr>    \t
    \t<td><font color="red">{$entSal} {$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="1" align="center">
    <tr>
        <th><b>CLIENTE</b></th>
        <th><b>MARCA</b></th>
        <th><b>NUMERO</b></th>
        <th><b>CARACTERISTICAS FISICAS</b></th>        
    </tr>
    <tr>    \t
    \t<td>{$cliente}</td>
    \t<td>{$conteL}</td>
    \t<td>{$conteN}</td>
    \t<td>{$equipo} / {$damage} </td>    \t
    </tr>
    <tr bgcolor="#cacaca">
    \t<th colspan="4"><b>{$entSalTx}</b></th>
    </tr>
    <tr>
    \t<td><b>ENTREGADO POR :</b></td>
    \t<td><b>FECHA Y HORA</b></td>
        <td><b>BOOKING</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 colspan="4"><i>Capturo: {$capUsr}<br>Fecha captura: {$capFec} </i></td>
    </tr>
</table>
<br><br><br>
{$datoRecibo}   


EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    $noRecibo > 0 ? $corY = 180 : ($corY = 105);
    $txt = "POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 15, $corY, true);
    $txt = "POR DEPOSITO\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(30, 10, $txt, 1, 'C', 0, 0, 55, $corY, true);
    $txt = "AUTO. DE REPARACION\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 85, $corY, true);
    $txt = "POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 125, $corY, true);
    $txt = "POR DEPOSITO\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(35, 10, $txt, 1, 'C', 0, 0, 165, $corY, true);
    //Close and output PDF document
    $pdf->Output('example_eir.pdf', 'I');
}
Ejemplo n.º 7
1
function student_ugovoroucenjupdf()
{
    global $userid;
    require_once 'lib/tcpdf/tcpdf.php';
    // Prikupljam podatke iz baze
    // Za koju godinu se prijavljuje?
    $q1 = myquery("select id, naziv from akademska_godina where aktuelna=1");
    $q2 = myquery("select id, naziv from akademska_godina where id>" . mysql_result($q1, 0, 0) . " order by id limit 1");
    if (mysql_num_rows($q2) < 1) {
        //	nicemessage("U ovom trenutku nije aktiviran upis u sljedeću akademsku godinu.");
        //	return;
        // Pretpostavljamo da se upisuje u aktuelnu?
        $zagodinu = mysql_result($q1, 0, 0);
        $agnaziv = mysql_result($q1, 0, 1);
        $q3 = myquery("select id from akademska_godina where id<{$zagodinu} order by id desc limit 1");
        $proslagodina = mysql_result($q3, 0, 0);
    } else {
        $proslagodina = mysql_result($q1, 0, 0);
        $zagodinu = mysql_result($q2, 0, 0);
        $agnaziv = mysql_result($q2, 0, 1);
    }
    // Zapis u tabeli ugovoroucenju
    $q5 = myquery("select uu.id, s.id, s.naziv, s.naziv_en, uu.semestar, s.tipstudija from ugovoroucenju as uu, studij as s where uu.student={$userid} and uu.akademska_godina={$zagodinu} and uu.studij=s.id order by semestar desc limit 1");
    if (mysql_num_rows($q5) < 1) {
        niceerror("Nije kreiran ugovor o učenju za studenta.");
        return;
    }
    $ugovorid = mysql_result($q5, 0, 0);
    $studij = mysql_result($q5, 0, 1);
    $studijbos = mysql_result($q5, 0, 2);
    $studijbos = substr($studijbos, 0, strpos($studijbos, "(") - 1);
    $studijeng = mysql_result($q5, 0, 3);
    $sem2 = mysql_result($q5, 0, 4);
    $tipstudija = mysql_result($q5, 0, 5);
    $sem1 = $sem2 - 1;
    $godina = $sem2 / 2;
    // Ostali podaci o osobi
    $q10 = myquery("select ime, prezime, brindexa from osoba where id={$userid}");
    $imeprezime = mysql_result($q10, 0, 0) . " " . mysql_result($q10, 0, 1);
    $brindexa = mysql_result($q10, 0, 2);
    // Odabir plana studija
    $plan_studija = 0;
    $q5a = myquery("SELECT studij, plan_studija FROM student_studij WHERE student={$userid} AND akademska_godina<={$zagodinu} ORDER BY akademska_godina DESC LIMIT 1");
    if (mysql_num_rows($q5a) > 0 && $studij == mysql_result($q5a, 0, 0)) {
        $plan_studija = mysql_result($q5a, 0, 1);
    }
    if ($plan_studija == 0) {
        // Student nije prethodno studirao na istom studiju ili plan studija nije bio definisan
        // Uzimamo najnoviji plan za odabrani studij
        $q6 = myquery("select godina_vazenja from plan_studija where studij={$studij} order by godina_vazenja desc limit 1");
        if (mysql_num_rows($q6) < 1) {
            niceerror("Nepostojeći studij");
            return;
        }
        $plan_studija = mysql_result($q6, 0, 0);
    }
    // Da li je ponovac (ikada slušao isti tip studija)?
    $q20 = myquery("select ss.semestar from student_studij as ss, studij as s, tipstudija as ts where ss.student={$userid} and ss.akademska_godina<={$proslagodina} and ss.studij=s.id and s.tipstudija={$tipstudija} order by semestar desc limit 1");
    if (mysql_num_rows($q20) < 1) {
        /*niceerror("Ne možete popunjavati ugovor o učenju ako prvi put slušate prvu godinu studija.");
        	return;*/
        // Zašto ne bismo dozvolili?
        $ponovac = 0;
    } else {
        if ($sem1 > mysql_result($q20, 0, 0)) {
            $ponovac = 0;
        } else {
            $ponovac = 1;
        }
    }
    // Odredjujemo da li ima prenesenih predmeta
    // TODO: ovo sada ne radi za izborne predmete
    $q20 = myquery("select p.sifra, p.naziv, p.ects, ps.semestar from predmet as p, plan_studija as ps where ps.godina_vazenja={$plan_studija} and ps.studij={$studij} and (ps.semestar=" . ($sem1 - 1) . " or ps.semestar=" . ($sem1 - 2) . ") and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    if (mysql_num_rows($q20) > 1) {
        niceerror("Nemate uslove za upis {$godina}. godine studija");
        print "Sačekajte da prikupite uslov ili popunite Ugovor za prethodnu godinu studija.";
        return;
    }
    if (mysql_num_rows($q20) == 1) {
        $ima_preneseni = 1;
        $preneseni_sifra = mysql_result($q20, 0, 0);
        $preneseni_naziv = mysql_result($q20, 0, 1);
        $preneseni_ects = mysql_result($q20, 0, 2);
        $preneseni_semestar = mysql_result($q20, 0, 3);
    } else {
        $ima_preneseni = 0;
    }
    // Privremeni hack za master
    if ($tipstudija == 3) {
        $mscfile = "-msc";
    } else {
        if ($tipstudija == 2) {
            $mscfile = "";
        }
    }
    // Ako čovjek upisuje prvu godinu mastera, broj indexa je netačan!
    if ($godina == 1 && $tipstudija == 3) {
        $brindexa = "";
    }
    // ----- Pravljenje PDF dokumenta
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator("Zamger");
    $pdf->SetTitle('Domestic Learning Agreement / Ugovor o ucenju');
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(0, 0, 0);
    //set auto page breaks
    $pdf->SetAutoPageBreak(false);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333);
    $pdf->setJPEGQuality(100);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('freesans', 'B', 9);
    $pdf->SetHeaderData("", 0, "", "");
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    // add a page
    $pdf->AddPage();
    //	$pdf->Image("images/content/150dpi/ETF-Domestic-contract-PGS-ALL-0.png",210,297,0,0,'','','',true,150);
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-0.png", 0, 0, 210, 0, '', '', '', true, 150);
    $pdf->SetXY(175, 34);
    $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
    $pdf->SetXY(175, 42);
    $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
    $pdf->SetXY(175, 50);
    $pdf->Cell(23, 0, $sem1 . ". & " . $sem2, 0, 0, 'C');
    $pdf->SetXY(70, 48);
    $pdf->Cell(100, 0, $studijeng, 0, 0);
    $pdf->SetXY(70, 52);
    $pdf->Cell(100, 0, $studijbos, 0, 0);
    $pdf->SetXY(70, 62);
    $pdf->Cell(100, 0, $imeprezime);
    $pdf->SetXY(70, 69);
    $pdf->Cell(100, 0, $brindexa);
    // PRVI SEMESTAR
    $pdf->AddPage();
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-1.png", 0, 0, 210);
    $pdf->SetXY(175, 34);
    $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
    $pdf->SetXY(175, 42);
    $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
    $pdf->SetXY(175, 50);
    $pdf->Cell(23, 0, $sem1 . ".", 0, 0, 'C');
    $pdf->SetXY(70, 48);
    $pdf->Cell(100, 0, $studijeng, 0, 0);
    $pdf->SetXY(70, 52);
    $pdf->Cell(100, 0, $studijbos, 0, 0);
    $pdf->SetXY(70, 62);
    $pdf->Cell(100, 0, $imeprezime);
    $pdf->SetXY(70, 69);
    $pdf->Cell(100, 0, $brindexa);
    // Spisak obaveznih predmeta na neparnom semestru
    // Ako je ponovac, ne prikazujemo predmete koje je polozio
    if ($ponovac == 1) {
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$plan_studija} and ps.studij={$studij} and ps.semestar={$sem1} and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        // Ako nije, trebamo prikazati one koje je položio u koliziji
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$plan_studija} and ps.studij={$studij} and ps.semestar={$sem1} and ps.obavezan=1 and ps.predmet=p.id");
    }
    $ykoord = 95;
    $ects = 0;
    while ($r100 = mysql_fetch_row($q100)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r100[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r100[1]);
        $e = "{$r100['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r100[2];
    }
    // Da li je prenesen predmet na neparnom semestru?
    if ($ima_preneseni && $preneseni_semestar % 2 == 1) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $preneseni_sifra);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $preneseni_naziv);
        $e = "{$preneseni_ects}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $preneseni_ects;
    }
    // Spisak izbornih predmeta
    if ($ponovac == 1) {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem1} and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem1}");
    }
    $ykoord = 123;
    while ($r110 = mysql_fetch_row($q110)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r110[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r110[1]);
        $e = "{$r110['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r110[2];
    }
    // Suma ects
    if (!strchr($ects, ".")) {
        $ects .= ".0";
    }
    $pdf->SetXY(170, 135);
    $pdf->Cell(100, 0, $ects);
    // DRUGI SEMESTAR
    $pdf->AddPage();
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-2.png", 0, 0, 210);
    $pdf->SetXY(175, 34);
    $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
    $pdf->SetXY(175, 42);
    $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
    $pdf->SetXY(175, 50);
    $pdf->Cell(23, 0, $sem2 . ".", 0, 0, 'C');
    $pdf->SetXY(70, 48);
    $pdf->Cell(100, 0, $studijeng, 0, 0);
    $pdf->SetXY(70, 52);
    $pdf->Cell(100, 0, $studijbos, 0, 0);
    $pdf->SetXY(70, 62);
    $pdf->Cell(100, 0, $imeprezime);
    $pdf->SetXY(70, 69);
    $pdf->Cell(100, 0, $brindexa);
    // Spisak obaveznih predmeta na parnom semestru
    if ($ponovac == 1) {
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$plan_studija} and ps.studij={$studij} and ps.semestar={$sem2} and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$plan_studija} and ps.studij={$studij} and ps.semestar={$sem2} and ps.obavezan=1 and ps.predmet=p.id");
    }
    $ykoord = 95;
    $ects = 0;
    while ($r100 = mysql_fetch_row($q100)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r100[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r100[1]);
        $e = "{$r100['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r100[2];
    }
    // Da li je prenesen predmet na parnom semestru?
    if ($ima_preneseni && $preneseni_semestar % 2 == 0) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $preneseni_sifra);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $preneseni_naziv);
        $e = "{$preneseni_ects}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $preneseni_ects;
    }
    // Spisak izbornih predmeta
    if ($ponovac == 1) {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem2} and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0");
    } else {
        $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem2}");
    }
    $ykoord = 123;
    while ($r110 = mysql_fetch_row($q110)) {
        $pdf->SetXY(13, $ykoord);
        $pdf->Cell(100, 0, $r110[0]);
        $pdf->SetXY(50, $ykoord);
        $pdf->Cell(100, 0, $r110[1]);
        $e = "{$r110['2']}";
        if (!strchr($e, ".")) {
            $e .= ".0";
        }
        $pdf->SetXY(170, $ykoord);
        $pdf->Cell(100, 0, $e);
        $ykoord += 4;
        $ects += $r110[2];
    }
    // Suma ects
    if (!strchr($ects, ".")) {
        $ects .= ".0";
    }
    $pdf->SetXY(170, 135);
    $pdf->Cell(100, 0, $ects);
    // ---------------------------------------------------------
    //Close and output PDF document
    $pdf->Output('ugovor_o_ucenju.pdf', 'I');
    //============================================================+
    // END OF FILE
    //============================================================+
}
Ejemplo n.º 8
0
 static function printTicket($ticket_html, $order)
 {
     ob_end_clean();
     $config = JComponentHelper::getParams('com_bookpro');
     $page_ticket = "<h1 color='Red'> Wellcome to tcpdf </h1>";
     $page_ticket = $ticket_html;
     // create new PDF document
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $order_number = $order->order_number;
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Joombooking');
     $pdf->SetTitle('Travel Ticket ' . $order_number);
     $pdf->SetSubject('Travel Ticket');
     $pdf->SetKeywords('TCPDF, PDF, ticket, travel, booking');
     // set default header data
     //$pdf->SetHeaderData($config->get('company_logo'),50, $config->get('company_name'), "Ticket \n www.");
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     //$pdf->setHeaderMargin(10);
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     //$pdf->SetMargins(30, 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
     $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('times', '', 11);
     // add a page
     $pdf->AddPage();
     // set JPEG quality
     $pdf->setJPEGQuality(75);
     $style['position'] = 'R';
     /*
      *     $type type of barcode (see tcpdf_barcodes_1d.php for supported formats).
      *      
      */
     //$pdf->write1DBarcode($order_number, 'C128B','', '', '', 10, 0.4, $style, 'M');
     // create some HTML content
     //$pdf->writeHTML($htmlcontent, true, 0, true, 0);
     //$pdf->WriteHTML(file_get_contents('test.html'));
     $pdf->WriteHTML($page_ticket);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // reset pointer to the last page
     $pdf->lastPage();
     // ---------------------------------------------------------
     //Close and output PDF document
     ob_end_clean();
     $pdf->Output($order->name . '.pdf', 'I');
     //Should use variable to make file name
     ob_end_flush();
 }
Ejemplo n.º 9
0
 public function render(\TCPDF $pdf, $width = null)
 {
     $image = $this->_obj->getContent();
     $imgSize = getimagesize(Core::$basePath . $image);
     $height = $pdf->pixelsToUnits($imgSize[1]);
     $width = $pdf->pixelsToUnits($imgSize[0]);
     $pdf->setJPEGQuality(75);
     if ($this->_obj->getParameter('pos_x') || $this->_obj->getParameter('pos_y')) {
         $currentY = $pdf->getY();
         $currentAPB = $pdf->getAutoPageBreak();
         $currentMB = $pdf->getMargins();
         $currentMB = $currentMB['bottom'];
         $pdf->setAutoPageBreak(false, 0);
         $pdf->write('');
     }
     $pdf->Image(Core::$basePath . $image, $this->_obj->getParameter('pos_x') ? $pdf->pixelsToUnits($this->_obj->getParameter('pos_x')) : null, $this->_obj->getParameter('pos_y') ? $pdf->pixelsToUnits($this->_obj->getParameter('pos_y')) : null, $width * $this->_obj->getParameter('ratio'), $height * $this->_obj->getParameter('ratio'), null, $this->_obj->getParameter('link'), 'N');
     if (isset($currentY)) {
         $pdf->setY($currentY);
         $pdf->setAutoPageBreak($currentAPB, $currentMB);
     }
 }
Ejemplo n.º 10
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');
}
Ejemplo n.º 11
0
            $TRANSACTION_ID = mysql_real_escape_string($_GET['MNT_TRANSACTION_ID']);
            $q_gos = "SELECT * FROM payment WHERE payment_id = \"" . $TRANSACTION_ID . "\" AND payment_confirm= \"1\" LIMIT 1";
            $res_gos = mysql_query($q_gos);
            if (mysql_num_rows($res_gos) > 0) {
                $row_gos = mysql_fetch_array($res_gos);
                require_once $up_way . 'dir/modules/tcpdf/config/lang/rus.php';
                require_once $up_way . 'dir/modules/tcpdf/tcpdf.php';
                // PDF_PAGE_FORMAT - A4
                // PDF_PAGE_ORIENTATION
                // PDF_UNIT - mm
                $pdf = new TCPDF('P', 'mm', array(108, 200), true, 'UTF-8', false);
                $pdf->SetTitle('Transaction ID Ref ' . $TRANSACTION_ID);
                // remove default header/footer
                $pdf->setPrintHeader(false);
                $pdf->setPrintFooter(false);
                $pdf->setJPEGQuality(100);
                $pdf->SetMargins(10, 10, true);
                // add a page
                $pdf->AddPage();
                $pdf->SetFont('arial', '', 8);
                $strContent = '<div style="border:1px dashed #aaa;"><br/><span style="text-align:center">НКО «МОНЕТА.РУ» (ООО)</span><br/>
				<span style="text-align:center">424000, Российская Федерация,</span><br/>
				<span style="text-align:center">Республика Марий Эл, г. Йошкар-Ола,</span><br/>
				<span style="text-align:center">ул. Гоголя, д. 2, строение "А"</span><br/>
				<span style="text-align:center">тел./факс: 8 (495) 743-49-85,</span><br/>
				<span style="text-align:center;">e-mail: helpdesk.support@moneta.ru</span><br/>
				<div style="text-align:center;border-top:1px solid #aaa;border-bottom:1px solid #aaa;height:100px"><br/>
				<b>Квитанция об оплате</b><br/>
				</div><br/>
				<span style="text-align:left;">&nbsp;&nbsp;Номер операции: ' . $row_gos['MNT_OPERATION_ID'] . '</span><br/>
				<span style="text-align:left;">&nbsp;&nbsp;Дата и время: ' . $row_gos['payment_date'] . '</span><br/><br/>
Ejemplo n.º 12
0
function showPdf($idReg = "")
{
    global $db;
    // -------------------------------
    // CONSULTA DE DATOS
    // -------------------------------
    $sql = "select * from ENTRADA where id_entrada='{$idReg}'";
    $db->query($sql);
    while ($db->next_record()) {
        $entSal = $db->f('ent_sal');
        //$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];
        }
        $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte);
        $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq);
        $bkg = $db->f('bkg');
        $clase = $db->f('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');
        if ($entSal == "E") {
            $entCapFec = $db->f('cap_fec');
            $entTrans = $transp;
            $entOpera = $operador;
            $entPlacas = $placas;
            $entClase = "CLASE : {$clase}";
            $entDamage = $damage;
            $entSello = $sello;
            $entNota = $nota;
        }
        if ($entSal == "S") {
            $salCapFec = $db->f('cap_fec');
            $salTrans = $transp;
            $salOpera = $operador;
            $salPlacas = $placas;
            $salClase = "CLASE : {$clase}";
            $salDamage = $damage;
            $salSello = $sello;
            $salNota = $nota;
        }
    }
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, '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);
    // -------------------------------------------------------------------
    $pdf->AddPage();
    // Logo
    $pdf->setJPEGQuality(100);
    $pdf->Image('../images/logo_color.jpg', 13, 4, 25, 25, '', '', '', false);
    $pdf->Image('../images/nome.jpg', 15, 140, 185, 96, '', '', '', false);
    // set cell padding
    //$pdf->setCellPaddings(1, 1, 1, 1);
    // set cell margins
    //$pdf->setCellMargins(1, 1, 1, 1);
    $pdf->SetFillColor(197, 197, 197);
    // set font
    $txt = "TRANSPORTES MALEJA, S.A. DE C.V.";
    $pdf->SetFont('aefurat', '', 14);
    $pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true);
    // set font
    $txt = "Av. San Pablo s/n esq. Benito Juarez \nCol.San Pablo Xalpa Municipio Tlalnepantla \nC.P. 54090 Edo. de Mexico \nTels.: 5319-9375 5319-9228";
    $pdf->SetFont('pdfahelvetica', '', 7);
    $pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true);
    $pdf->SetFont('pdfahelvetica', '', 12);
    $tbl = <<<EOD
<table cellspacing="0" cellpadding="3" border="1" align="center">
    <tr bgcolor="#cacaca">
        <th>FOLIO</th>
    </tr>
    <tr>    \t
    \t<td>{$idReg}</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="1" align="center">
    <tr>
        <th><b>CLIENTE</b></th>
        <th><b>MARCA</b></th>
        <th><b>NUMERO</b></th>
        <th><b>CARACTERISTICAS FISICAS</b></th>
        <th><b>LOCALIZACION</b></th>
    </tr>
    <tr>    \t
    \t<td>{$cliente}</td>
    \t<td>{$conteL}</td>
    \t<td>{$conteN}</td>
    \t<td>{$equipo}</td>
    \t<td>{$localizacion}</td>
    </tr>
    <tr bgcolor="#cacaca">
    \t<th colspan="3"><b>ENTRADA</b></th>
    \t<th colspan="2"><b>SALIDA</b></th>    \t
    </tr>
    <tr>
    \t<td><b>ENTREGADO POR :</b></td>
    \t<td><b>FECHA Y HORA</b></td>
    \t<td><b>AUTORIZACION</b></td>
    \t<td><b>FECHA Y HORA</b></td>
    \t<td><b>DESTINO</b></td>
    </tr>
    <tr>
    \t<td>{$naviera}</td>
    \t<td>{$entCapFec}</td>
    \t<td>{$bkg}</td>
    \t<td>{$salCapFec}</td>
    \t<td>&nbsp;</td>
    </tr>
    <tr>
    \t<td><b>TRANSPORTISTA</b></td>
    \t<td><b><b>CARTA PORTE</b></b></td>
    \t<td><b>-</b></td>
    \t<td><b>TRANSPORTISTA</b></td>
    \t<td><b>CARTA PORTE</b></td>
    </tr>
    <tr>
    \t<td>{$entTrans}</td>
    \t<td>-</td>
    \t<td>-</td>
    \t<td>{$salTrans}</td>
    \t<td>-</td>
    </tr>
    <tr>
    \t<td><b>OPERADOR</b></td>
    \t<td><b>PLACAS</b></td>    \t
    \t<td><b>-</b></td>    \t
    \t<td><b>OPERADOR</b></td>
    \t<td><b>PLACAS</b></td>    
    </tr>\t
    <tr>
    \t<td>{$entOpera}</td>
    \t<td>{$entPlacas}</td>
    \t<td>-</td>
    \t<td>{$salOpera}</td>
    \t<td>{$salPlacas}</td>
    </tr>
    <tr>
    \t<td><b>ESTADO FISICO</b></td>
    \t<td></td>
    \t<td></td>
    \t<td><b>ESTADO FISICO</b></td>
    \t<td></td>
    </tr>    
    <tr>
    \t<td>{$entClase}</td>
    \t<td>{$entDamage}</td>
    \t<td>-</td>
\t   \t<td>{$salClase}</td>
    \t<td>{$salDamage}</td>
    </tr>    
    <tr>
    \t<td colspan="3"><b>NO.SELLO</b></td>
    \t<td colspan="2"><b>NO.SELLO</b></td>
    </tr>    
    <tr>
    \t<td colspan="3">{$entSello}</td>
    \t<td colspan="2">{$salSello}</td>
    </tr>    
    <tr>
    \t<td colspan="3"><b>OBSERVACIONES</b></td>
    \t<td colspan="2"><b>OBSERVACIONES</b></td>
    </tr>    
    <tr>
    \t<td colspan="3">{$entNota}</td>
    \t<td colspan="2">{$salNota}</td>
    </tr>    
</table>
EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    $txt = "POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 15, 255, true);
    $txt = "POR DEPOSITO\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(30, 10, $txt, 1, 'C', 0, 0, 55, 255, true);
    $txt = "AUTO. DE REPARACION\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 85, 255, true);
    $txt = "POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 125, 255, true);
    $txt = "POR DEPOSITO\n\n\nNOMBRE Y FIRMA";
    $pdf->MultiCell(35, 10, $txt, 1, 'C', 0, 0, 165, 255, true);
    //Close and output PDF document
    $pdf->Output('example_eir.pdf', 'I');
}
Ejemplo n.º 13
0
 /**
  * Convert html to tcpdf.
  *
  * @param $paper_size
  * @param $orientation
  * @param $margins
  * @param $html
  * @param $output
  * @param $fileName
  * @param $stationery_path
  */
 public static function _html2pdf_tcpdf($paper_size, $orientation, $margins, $html, $output, $fileName, $stationery_path)
 {
     // Documentation on the TCPDF library can be found at: http://www.tcpdf.org
     // This function also uses the FPDI library documented at: http://www.setasign.com/products/fpdi/about/
     // Syntax borrowed from https://github.com/jake-mw/CDNTaxReceipts/blob/master/cdntaxreceipts.functions.inc
     require_once 'tcpdf/tcpdf.php';
     require_once 'FPDI/fpdi.php';
     // This library is only in the 'packages' area as of version 4.5
     $paper_size_arr = array($paper_size[2], $paper_size[3]);
     $pdf = new TCPDF($orientation, 'pt', $paper_size_arr);
     $pdf->Open();
     if (is_readable($stationery_path)) {
         $pdf->SetStationery($stationery_path);
     }
     $pdf->SetAuthor('');
     $pdf->SetKeywords('CiviCRM.org');
     $pdf->setPageUnit($margins[0]);
     $pdf->SetMargins($margins[4], $margins[1], $margins[2], TRUE);
     $pdf->setJPEGQuality('100');
     $pdf->SetAutoPageBreak(TRUE, $margins[3]);
     $pdf->AddPage();
     $ln = TRUE;
     $fill = FALSE;
     $reset_parm = FALSE;
     $cell = FALSE;
     $align = '';
     // output the HTML content
     $pdf->writeHTML($html, $ln, $fill, $reset_parm, $cell, $align);
     // reset pointer to the last page
     $pdf->lastPage();
     // close and output the PDF
     $pdf->Close();
     $pdf_file = 'CiviLetter' . '.pdf';
     $pdf->Output($pdf_file, 'D');
     CRM_Utils_System::civiExit(1);
 }
Ejemplo n.º 14
0
function izvjestaj_prijave()
{
    require_once 'lib/tcpdf/tcpdf.php';
    global $userid, $conf_files_path;
    // Poslani parametar
    $ispit_termin = intval($_GET['ispit_termin']);
    $predmet = intval($_GET['predmet']);
    $ag = intval($_GET['ag']);
    $student = intval($_GET['student']);
    $nasa_slova = array("č" => "c", "ć" => "c", "đ" => "d", "š" => "s", "ž" => "z", "Č" => "C", "Ć" => "C", "Đ" => "D", "Š" => "S", "Ž" => "Z");
    // Odredjujemo filename
    if ($ispit_termin > 0) {
        $q5 = myquery("select p.id, p.naziv, UNIX_TIMESTAMP(it.datumvrijeme), i.akademska_godina from predmet as p, ispit as i, ispit_termin as it where it.id={$ispit_termin} and it.ispit=i.id and i.predmet=p.id");
        $predmet = mysql_result($q5, 0, 0);
        $ag = mysql_result($q5, 0, 3);
        $filename = "prijave-" . strtr(mysql_result($q5, 0, 1), $nasa_slova) . "-" . date("d-m-Y", mysql_result($q5, 0, 2)) . ".pdf";
    } else {
        if ($predmet > 0) {
            $q5 = myquery("select naziv from predmet where id={$predmet}");
            $filename = "prijave-" . strtr(mysql_result($q5, 0, 0), $nasa_slova) . ".pdf";
        } else {
            $filename = "prijave.pdf";
        }
    }
    $upit = "SELECT o.id, o.ime, o.prezime, o.brindexa, pk.semestar, s.naziv, p.naziv, ag.naziv, ";
    // slijedi datum
    // Stampaj sve studente na terminu
    if ($ispit_termin > 0) {
        // Uzimamo datum termina
        $upit .= "UNIX_TIMESTAMP(it.datumvrijeme) from osoba as o, ispit_termin as it, student_ispit_termin as sit, student_predmet as sp, ponudakursa as pk, ispit as i, studij as s, predmet as p, akademska_godina as ag where sit.ispit_termin=it.id and sit.student=o.id and it.id={$ispit_termin} and o.id=sp.student and sp.predmet=pk.id and it.ispit=i.id and i.predmet=pk.predmet and i.akademska_godina=pk.akademska_godina and pk.studij=s.id and pk.predmet=p.id and pk.akademska_godina=ag.id order by o.prezime, o.ime";
    } else {
        if ($predmet <= 0 || $ag <= 0) {
            biguglyerror("Neispravni parametri");
            print "Da li je moguće da ste odabrali neispravan ili nepostojeći predmet?";
            return;
            // Stampaj jednog studenta
        } else {
            if ($student > 0) {
                // Uzecemo danasnji datum
                $upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id={$student} and sp.student={$student} and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id";
                // Sve studente koji nemaju ocjenu
            } else {
                if ($_GET['tip'] == "bez_ocjene" || $_GET['tip'] == "uslov") {
                    // Naknadno provjeravamo da li ima uslov
                    // Uzecemo danasnji datum
                    $upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id=sp.student and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id and (select count(*) from konacna_ocjena as ko where ko.student=o.id and ko.predmet={$predmet})=0 order by o.prezime, o.ime";
                    // Sve studente koji imaju ocjenu
                } else {
                    if ($_GET['tip'] == "sa_ocjenom") {
                        // Uzecemo danasnji datum
                        $upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id=sp.student and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id and (select count(*) from konacna_ocjena as ko where ko.student=o.id and ko.predmet={$predmet})>0 order by o.prezime, o.ime";
                        // Sve studente na predmetu
                    } else {
                        if ($_GET['tip'] == "sve") {
                            // Uzecemo danasnji datum
                            $upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id=sp.student and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id order by o.prezime, o.ime";
                            // Ovo se može desiti ako se klikne na prikaz pojedinačnog studenta, a nijedan student nije izabran
                            // (npr. ako nijedan student ne sluša predmet)
                        } else {
                            biguglyerror("Neispravni parametri");
                            print "Da li je moguće da ovaj predmet ne sluša niti jedan student?";
                            return;
                        }
                    }
                }
            }
        }
    }
    // PDF inicijalizacija
    $pdf = new TCPDF('P', 'mm', 'a5', true, 'UTF-8', false);
    $pdf->SetCreator("Zamger");
    $pdf->SetTitle('Printanje prijava');
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    $pdf->SetMargins(0, 0, 0);
    $pdf->SetAutoPageBreak(false);
    $pdf->setLanguageArray($l);
    $pdf->SetFont('freesans', 'B', 9);
    $pdf->SetHeaderData("", 0, "", "");
    $pdf->SetPrintHeader(false);
    $pdf->setFooterMargin($fm = 0);
    $pdf->SetPrintFooter(false);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333);
    $pdf->setJPEGQuality(100);
    // Izvršenje upita
    $q10 = myquery($upit);
    while ($r10 = mysql_fetch_row($q10)) {
        $student = $r10[0];
        $imeprezime = $r10[1] . " " . $r10[2];
        $brind = $r10[3];
        $godStudija = intval(($r10[4] + 1) / 2);
        $odsjek = $r10[5];
        $nazivPr = $r10[6];
        $skolskaGod = $r10[7];
        //	$NastavnikSl=$r10[9];
        $datumIspita = date("d. m. Y.", $r10[8]);
        //	$NastavnikPr=$r10[8];
        //	$datumPrijave=$r10[12];
        $datumPrijave = $datumIspita;
        //	$datumPolaganja=$r10[10];
        $datumPolaganja = $datumIspita;
        //	$datumUsmenog=$r10[13];
        $datumUsmenog = $datumIspita;
        //	$datumDrPar=$r10[14];
        // Ispis nastavnika
        $q33 = myquery("select osoba from angazman where predmet={$predmet} and akademska_godina={$ag} and angazman_status=1");
        if (mysql_num_rows($q33) == 1) {
            // Ako imaju dva odgovorna nastavnika, ne znam kojeg da stavim
            $id_nastavnika = mysql_result($q33, 0, 0);
            $nastavnik = tituliraj($id_nastavnika, $sa_akademskim_zvanjem = false);
        } else {
            $nastavnik = "";
        }
        // Da li ima uslov?
        if ($_GET['tip'] == "uslov") {
            // Dva parcijalna ispita
            $q35 = myquery("select count(*) from ispitocjene as io, ispit as i, komponenta as k where io.student={$student} and io.ispit=i.id and i.predmet={$predmet} and i.akademska_godina={$ag} and i.komponenta=k.id and k.tipkomponente=1 and io.ocjena>=k.prolaz");
            $parcijalnih = mysql_result($q35, 0, 0);
            // Integralni ispiti
            $q37 = myquery("select count(*) from ispitocjene as io, ispit as i, komponenta as k where io.student={$student} and io.ispit=i.id and i.predmet={$predmet} and i.akademska_godina={$ag} and i.komponenta=k.id and k.tipkomponente=2 and io.ocjena>=k.prolaz");
            $integralnih = mysql_result($q37, 0, 0);
            if ($integralnih == 1 || $parcijalnih == 2) {
                // FIXME: ovo radi samo za ETF Bologna standard
                kreirajPrijavu($pdf, $imeprezime, $brind, $godStudija, $odsjek, $nazivPr, $skolskaGod, $datumIspita, $nastavnik);
            }
        } else {
            // Da li je student polozio predmet?
            $q40 = myquery("select ocjena, UNIX_TIMESTAMP(datum_u_indeksu), datum_provjeren from konacna_ocjena where student={$student} and predmet={$predmet}");
            if (mysql_num_rows($q40) > 0) {
                $ocjena = mysql_result($q40, 0, 0);
                $datum_provjeren = mysql_result($q40, 0, 2);
                if ($datum_provjeren) {
                    $datumIspita = $datumPrijave = $datumPolaganja = $datumUsmenog = date("d. m. Y.", mysql_result($q40, 0, 1));
                }
            } else {
                $ocjena = 0;
            }
            kreirajPrijavu($pdf, $imeprezime, $brind, $godStudija, $odsjek, $nazivPr, $skolskaGod, $datumIspita, $ocjena, $nastavnik);
            //		print "$pdf, $imeprezime, $brind, $godStudija, $odsjek, $nazivPr, $skolskaGod, $datumIspita ($r10[8]), $ocjena, $nastavnik<br>\n";
        }
    }
    $pdf->Output($filename, 'I');
}
Ejemplo n.º 15
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;
 }
Ejemplo n.º 16
0
/**
 * 图片
 */
function pdf_seven()
{
    require_once 'tcpdf.php';
    // 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 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);
    // 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);
    }
    // -------------------------------------------------------------------
    // add a page
    $pdf->AddPage();
    // 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)
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // Example of Image from data stream ('PHP rules')
    $imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
    // The '@' character is used to indicate that follows an image data stream and not an image file name
    $pdf->Image('@' . $imgdata);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // Image example with resizing
    $pdf->Image('examples/images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // test fitbox with all alignment combinations
    $horizontal_alignments = array('L', 'C', 'R');
    $vertical_alignments = array('T', 'M', 'B');
    $x = 15;
    $y = 35;
    $w = 30;
    $h = 30;
    // test all combinations of alignments
    for ($i = 0; $i < 3; ++$i) {
        $fitbox = $horizontal_alignments[$i] . ' ';
        $x = 15;
        for ($j = 0; $j < 3; ++$j) {
            $fitbox[1] = $vertical_alignments[$j];
            $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 128));
            $pdf->Image('examples/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
            $x += 32;
            // new column
        }
        $y += 32;
        // new row
    }
    $x = 115;
    $y = 35;
    $w = 25;
    $h = 50;
    for ($i = 0; $i < 3; ++$i) {
        $fitbox = $horizontal_alignments[$i] . ' ';
        $x = 115;
        for ($j = 0; $j < 3; ++$j) {
            $fitbox[1] = $vertical_alignments[$j];
            $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
            $pdf->Image('examples/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
            $x += 27;
            // new column
        }
        $y += 52;
        // new row
    }
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // Stretching, position and alignment example
    $pdf->SetXY(110, 200);
    $pdf->Image('examples/images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
    $pdf->Image('examples/images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
    // -------------------------------------------------------------------
    //饼状图
    // add a page
    $pdf->AddPage();
    $pdf->Write(0, 'Example of PieSector() method.');
    $xc = 105;
    $yc = 100;
    $r = 50;
    $pdf->SetFillColor(0, 0, 255);
    $pdf->PieSector($xc, $yc, $r, 20, 120, 'FD', false, 0, 2);
    $pdf->SetFillColor(0, 255, 0);
    $pdf->PieSector($xc, $yc, $r, 120, 250, 'FD', false, 0, 2);
    $pdf->SetFillColor(255, 0, 0);
    $pdf->PieSector($xc, $yc, $r, 250, 20, 'FD', false, 0, 2);
    // write labels
    $pdf->Text(105, 65, 'BLUE11');
    $pdf->Text(60, 95, 'GREEN');
    $pdf->Text(120, 115, 'RED');
    //二维码
    // add a page
    $pdf->AddPage();
    // print a message
    $txt = "You can also export 2D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcode directory.\n";
    $pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // set style for barcode
    $style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
    // write RAW 2D Barcode
    $code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
    $pdf->write2DBarcode($code, 'RAW', 80, 30, 30, 20, $style, 'N');
    // write RAW2 2D Barcode
    $code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
    $pdf->write2DBarcode($code, 'RAW2', 80, 60, 30, 20, $style, 'N');
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // set style for barcode
    $style = array('border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
    // QRCODE,L : QR-CODE Low error correction
    $pdf->write2DBarcode('你好!哈哈', 'QRCODE,L', 20, 30, 50, 50, $style, 'N');
    $pdf->Text(20, 25, 'QRCODE L');
    // QRCODE,M : QR-CODE Medium error correction
    $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', 20, 90, 50, 50, $style, 'N');
    $pdf->Text(20, 85, 'QRCODE M');
    // QRCODE,Q : QR-CODE Better error correction
    $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,Q', 20, 150, 50, 50, $style, 'N');
    $pdf->Text(20, 145, 'QRCODE Q');
    // QRCODE,H : QR-CODE Best error correction
    $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 20, 210, 50, 50, $style, 'N');
    $pdf->Text(20, 205, 'QRCODE H');
    // -------------------------------------------------------------------
    // 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".
    */
    $pdf->write2DBarcode('www.tcpdf.org', 'PDF417', 80, 90, 0, 30, $style, 'N');
    $pdf->Text(80, 85, 'PDF417 (ISO/IEC 15438:2006)');
    // -------------------------------------------------------------------
    // DATAMATRIX (ISO/IEC 16022:2006)
    $pdf->write2DBarcode('http://www.tcpdf.org', 'DATAMATRIX', 80, 150, 50, 50, $style, 'N');
    $pdf->Text(80, 145, 'DATAMATRIX (ISO/IEC 16022:2006)');
    // -------------------------------------------------------------------
    // new style
    $style = array('border' => 2, 'padding' => 'auto', 'fgcolor' => array(0, 0, 255), 'bgcolor' => array(255, 255, 64));
    // QRCODE,H : QR-CODE Best error correction
    $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 80, 210, 50, 50, $style, 'N');
    $pdf->Text(80, 205, 'QRCODE H - COLORED');
    // new style
    $style = array('border' => false, 'padding' => 0, 'fgcolor' => array(128, 0, 0), 'bgcolor' => false);
    // QRCODE,H : QR-CODE Best error correction
    $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 140, 210, 50, 50, $style, 'N');
    $pdf->Text(140, 205, 'QRCODE H - NO PADDING');
    //Close and output PDF document
    $pdf->Output('example.pdf', 'I');
}
Ejemplo n.º 17
0
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Print a table
/* 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");
Ejemplo n.º 18
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'] = 'en';
    $lg['w_page'] = 'page';
    //set some language-dependent strings
    $pdf->setLanguageArray($lg);
    // -------------------------------
    // CONSULTA DE DATOS
    // -------------------------------
    $sql = "select * from PENSION where id_pension='{$idReg}'";
    $db->query($sql);
    while ($db->next_record()) {
        $noRecibo = $db->f(id_pension);
        $entFec = $db->f(ent_fec);
        $salFec = $db->f(sal_fec);
        $idConte = $db->f(id_contenedor);
        $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte);
        $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte);
        $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq);
        $concepto = $db->f(concepto);
        $operador = $db->f(operador);
        $placas = $db->f(placas);
        $monto = $db->f(monto);
        $montoLetra = traducirCifra($monto);
        $idOficina = $db->f(id_oficina);
        $transporte = $db->f(transporte);
        $metPago = $db->f(met_pago);
    }
    // ---------------------------------------------------------
    // DATOS DEL RECIBO
    // ---------------------------------------------------------
    $datoRecibo = "\n\n    <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">    \n    <tr>\n    <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES TMA</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>ENTRADA</b></td>\n    <td><b>SALIDA</b></td>                \n    <td><b>TRANSPORTE</b></td>\n    <td><b>CONTENEDOR</b></td>\n    <td><b>TIPO</b></td>\n    </tr>\n    <tr>\n    <td>{$entFec}</td>        \n    <td>{$salFec}</td>\n    <td>{$transporte}</td>\n    <td>{$conte}</td>\n    <td>{$equipo}</td>\n    </tr>    \n    <tr>            \n    <td colspan=\"2\"><b>OPERADOR</b></td>        \n    <td><b>PLACAS</b></td>            \n    <td colspan=\"2\"><b>OBSERVACIONES</b></td>        \n    </tr>             \n    <tr>                \n    <td colspan=\"2\">{$operador}</td>\n    <td>{$placas}</td> \n    <td colspan=\"2\">{$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>{$concepto} \$</b></td>\n    <td align=\"right\">{$monto}</td>\n    </tr>                                \n    <tr>\n    <td align=\"right\"><b>SUBTOTAL \$</b></td>\n    <td align=\"right\">{$monto}</td>\n    </tr>                                \n    <tr>\n    <td align=\"right\"><b>TOTAL \$</b></td>\n    <td align=\"right\">{$monto}</td>\n    </tr>                                \n    </table>\n    </td>\n    </tr>\n    <tr>\n    <td colspan=\"3\" align=\"center\">\n    RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100<br> \n    <b>Metodo de pago :</b> {$metPago}<br>\n    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>\n    EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO<br>\n    PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.<br>\n    Solicitarla al correo: facturacionpatios@demo.com.mx<br>\n    </td>\n    </tr>\n    </table> \n\n    <br><br><br><br><br><br>\n    <center>---------------------------------- RECIBO PARA VIGILANCIA ---------------------------------- </center>            \n    <br><br><br><br><br>\n\n    <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">    \n    <tr>\n    <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES</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>ENTRADA</b></td>\n    <td><b>SALIDA</b></td>                \n    <td><b>TRANSPORTE</b></td>\n    <td><b>CONTENEDOR</b></td>\n    <td><b>TIPO</b></td>\n    </tr>\n    <tr>\n    <td>{$entFec}</td>        \n    <td>{$salFec}</td>\n    <td>{$transporte}</td>\n    <td>{$conte}</td>\n    <td>{$equipo}</td>\n    </tr>    \n    <tr>            \n    <td colspan=\"2\"><b>OPERADOR</b></td>        \n    <td><b>PLACAS</b></td>            \n    <td colspan=\"2\"><b>OBSERVACIONES</b></td>        \n    </tr>             \n    <tr>                \n    <td colspan=\"2\">{$operador}</td>\n    <td>{$placas}</td> \n    <td colspan=\"2\">{$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>{$concepto} \$</b></td>\n    <td align=\"right\">{$monto}</td>\n    </tr>                                \n    <tr>\n    <td align=\"right\"><b>SUBTOTAL \$</b></td>\n    <td align=\"right\">{$monto}</td>\n    </tr>                                \n    <tr>\n    <td align=\"right\"><b>TOTAL \$</b></td>\n    <td align=\"right\">{$monto}</td>\n    </tr>                                \n    </table>\n    </td>\n    </tr>\n    <tr>\n    <td colspan=\"3\" align=\"center\">\n    RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 <br>\n    <b>Metodo de pago :</b> {$metPago}<br>\n    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>\n    EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO<br>\n    PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.<br>\n    Solicitarla al correo: facturacionpatios@demo.com.mx<br>\n    </td>\n    </tr>\n    </table> \n\n    ";
    // -------------------------------------------------------------------
    $pdf->AddPage();
    // Logo
    $pdf->setJPEGQuality(100);
    $pdf->Image('../images/logo_color.jpg', 13, 4, 25, 25, '', '', '', false);
    //$pdf->Image('../images/nome.jpg', 15, 140, 185, 96,'','','',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);
    if ($idOficina == 1) {
        $txt = "ALMARTCON S.A. DE C.V.\n\"El Trébol\"";
        $pdf->SetFont('helvetica', '', 14);
        $pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true);
        $txt = "Direccion, Guatemala \\Tel. 505-2350-0976 Cel. 505-8635-0708";
        $pdf->SetFont('helvetica', '', 7);
        $pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true);
    }
    /*    elseif( $idOficina==2 ){
            $txt = "ALMARTCON S.A DE C.V.\n\"El Arbol\"";
            $pdf->SetFont('helvetica', '', 14);
            $pdf->MultiCell(65, 4,$txt, 0, 'L',0, 0, 40, 10,true);            
            $txt="Av. Refinería Azcapotzalco S/N \nEsq. Ferrocarriles Nacionales.\nMéxico D.F.";
            $pdf->SetFont('helvetica', '', 7);
            $pdf->MultiCell(60, 4,$txt, 0, 'C',0, 0, 105, 10,true);
        }
        elseif( $idOficina==3 ){
            $txt = "TRANSPORTES MALEJA S.A DE C.V.\n\"El Pino\"";
            $pdf->SetFont('helvetica', '', 14);
            $pdf->MultiCell(65, 4,$txt, 0, 'L',0, 0, 40, 10,true);            
            $txt="Carretera Querétaro San Luis Potosí Km.28\nCol.Buenavista Santa Rosa Jauregui\nQueretaro, QRO.";
            $pdf->SetFont('helvetica', '', 7);
            $pdf->MultiCell(60, 4,$txt, 0, 'C',0, 0, 105, 10,true);
        }
      */
    $pdf->SetFont('helvetica', '', 12);
    //$tbl = <<<EOD  EOD;
    //$pdf->writeHTML($tbl, true, false, false, false, '');
    $txt = "RECIBO";
    $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>
{$datoRecibo}          
EOD;
    //$tbl = "$datoRecibo";
    $pdf->writeHTML($tbl, true, false, false, false, '');
    $txt = "EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO\n    PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.\n    Solicitarla al correo: facturacionpatios@demo.com.mx";
    $noRecibo > 0 ? $corY = 200 : ($corY = 125);
    //$pdf->MultiCell(185, 4,$txt, 1, 'C',0, 0, 16, 109,true);
    /*
    ($noRecibo>0)?$corY=180:$corY=105;
    $txt="POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA";	
    $pdf->MultiCell(40,10,$txt, 1, 'C',0, 0, 15, $corY,true);
    $txt="POR DEPOSITO\n\n\nNOMBRE Y FIRMA";	
    $pdf->MultiCell(30, 10,$txt, 1, 'C',0, 0, 55, $corY,true);
    $txt="AUTO. DE REPARACION\n\n\nNOMBRE Y FIRMA";	
    $pdf->MultiCell(40, 10,$txt, 1, 'C',0, 0, 85, $corY,true);
    $txt="POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA";	
    $pdf->MultiCell(40, 10,$txt, 1, 'C',0, 0, 125, $corY,true);
    $txt="POR DEPOSITO\n\n\nNOMBRE Y FIRMA";	
    $pdf->MultiCell(35, 10,$txt, 1, 'C',0, 0, 165, $corY,true);
    */
    //Close and output PDF document
    $pdf->Output('reciboPension.pdf', 'I');
}