Пример #1
0
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (isset($this->Request['barcode'])) {
         $objCode = new pi_barcode();
         $objCode->setSize(50);
         $objCode->hideCodeType();
         $objCode->setColors('#000000');
         $objCode->setSize(80);
         $param = Prado::getApplication()->getParameters();
         $objCode->setType($param['barcodetype']);
         $objCode->setCode($this->Request['code']);
         $objCode->setFiletype('PNG');
         $objCode->showBarcodeImage();
         exit;
     }
 }
Пример #2
0
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!$this->isPostBack) {
         $this->id->Value = $this->Request['id'];
         $this->setData();
         $this->onTypeChanged(NULL, NULL);
     }
     if (isset($this->Request['barcode'])) {
         $objCode = new pi_barcode();
         $objCode->setSize(50);
         $objCode->hideCodeType();
         $objCode->setColors('#000000');
         $objCode->setSize(80);
         $param = Prado::getApplication()->getParameters();
         $objCode->setType($param['barcodetype']);
         $objCode->setCode($this->Request['code']);
         $objCode->setFiletype('PNG');
         $objCode->showBarcodeImage();
         exit;
     }
 }
Пример #3
0
 protected function onPrint()
 {
     $param = Prado::getApplication()->getParameters();
     $nbreOfColumn = $param['barcodeprintcolumn'];
     $orderOfColumn = $param['orderprintcolumn'];
     parent::onPrint();
     $this->pdf->AddPage();
     $type = $this->Request['f1'];
     //type
     $typeText = '';
     switch ($type) {
         case '0':
             break;
         case 'leave':
             $typeText = " - " . Prado::localize("Leave");
             break;
         case 'absence':
             $typeText = " - " . Prado::localize("Absence");
             break;
         case 'overtime':
             $typeText = " - " . Prado::localize("Overtime");
             break;
         case 'load':
             $typeText = " - " . Prado::localize("Load");
             break;
     }
     $this->pdf->SetFont('Arial', '', 11);
     $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of time code') . $typeText), 0, 0, 'L');
     $this->pdf->Ln(10);
     $this->pdf->setDefaultFont();
     if ($type == '0') {
         $cmd = $this->db->createCommand("SELECT * FROM hr_timux_timecode ORDER BY {$orderOfColumn}");
     } else {
         $cmd = $this->db->createCommand("SELECT * FROM hr_timux_timecode WHERE type=:type ORDER BY {$orderOfColumn}");
         $cmd->bindValue(":type", $type);
     }
     $data = $cmd->query();
     $timeCode = $data->readAll();
     while (count($timeCode) % $nbreOfColumn > 0) {
         $timeCode[] = array('name' => '', 'abbreviation' => '');
     }
     $i = 0;
     $j = 0;
     $x = 10;
     $y = 38;
     $width = 190 / $nbreOfColumn;
     foreach ($timeCode as $tc) {
         $this->pdf->Cell($width, 6, utf8_decode($tc['name']), 'LTR');
         $objCode = new pi_barcode();
         $objCode->setSize(20);
         $objCode->hideCodeType();
         $objCode->setColors('#000000');
         $objCode->setSize(30);
         $param = Prado::getApplication()->getParameters();
         if ($tc['abbreviation'] != '') {
             $objCode->setType($param['barcodetype']);
             $objCode->setCode($tc['abbreviation']);
             $objCode->setFiletype('PNG');
             $objCode->writeBarcodeFile('./tmp/bctc' . $i . '.png');
             $this->pdf->Image('./tmp/bctc' . $i . '.png', $x, $y);
             $x += 93;
         }
         $i++;
         if ($i % $nbreOfColumn == 0) {
             $this->pdf->Ln();
             for ($c = 0; $c < $nbreOfColumn; $c++) {
                 $this->pdf->Cell($width, 20, '', 'LRB');
             }
             $j++;
             if ($j % 9 == 0) {
                 $this->pdf->AddPage();
                 $x = 15;
                 $y = 38;
                 $this->pdf->SetFont('Arial', '', 11);
                 $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of time code')), 0, 0, 'L');
                 $this->pdf->Ln(10);
                 $this->pdf->setDefaultFont();
             } else {
                 $this->pdf->Ln();
                 $y += 26;
                 $x = 10;
             }
         }
     }
     $this->pdf->render();
     $i = 0;
 }
Пример #4
0
/**
* Compatibilit� avec les versions precedentes
* 
* si appel direct de la biblioth�que, g�n�rer l'image a la vol�e
*/
if (strpos($_SERVER['PHP_SELF'], 'pi_barcode.php')) {
    $height = 80;
    $width = 0;
    $readable = 'N';
    $showtype = 'N';
    $color = '#000000';
    $bgcolor = '#FFFFFF';
    $zoom = 1;
    extract($_GET);
    // ***** Cr�ation de l'objet
    $objCode = new pi_barcode();
    $type = strtoupper($type);
    // ***** Hauteur / Largeur
    if (isset($height) || isset($width)) {
        $objCode->setSize($height, $width);
    }
    // ***** Autres arguments
    if ($readable == 'N') {
        $objCode->setText('');
    }
    if ($showtype == 'N') {
        $objCode->hideCodeType();
    }
    if ($color) {
        if ($bgcolor) {
            $objCode->setColors($color, $bgcolor);