public function listEtiquetaPorNumero(\Core_Dto_Search $objDTOSearch, $withNUP = FALSE)
 {
     $arrDigitais = $this->_getRepository()->listEtiquetasPorNumero($objDTOSearch);
     $arrDigitaisAC = array();
     $filter = new \Core_Filter_MaskNumber(array('mask' => '9999999.99999999/9999-99'));
     foreach ($arrDigitais as $key => $arrDigital) {
         $etiqueta = !$arrDigital['nuNupSiorg'] ? "{$arrDigital['nuEtiqueta']}" : !$withNUP ? "{$arrDigital['nuEtiqueta']}" : "{$arrDigital['nuEtiqueta']} - {$filter->filter($arrDigital['nuNupSiorg'])}";
         $arrDigitaisAC[$arrDigital['nuEtiqueta']] = $etiqueta;
     }
     return $arrDigitaisAC;
 }
Exemple #2
0
 /**
  * @return string
  */
 protected function mask($nuArtefato)
 {
     $objMask = new \Core_Filter_MaskNumber();
     $mask = null;
     switch (strlen($nuArtefato)) {
         case 21:
             $mask = Processo::T_MASK_21_DIGITS;
             break;
         case 17:
             $mask = Processo::T_MASK_17_DIGITS;
             break;
         case 15:
             $mask = Processo::T_MASK_15_DIGITS;
             break;
     }
     if (!is_null($mask)) {
         $objMask->setMask($mask);
         return $objMask->filter($nuArtefato);
     }
     return $nuArtefato;
 }
 /**
  * @return void
  * @param integer $linha
  */
 private function _gerarLinha()
 {
     $yRec = 1.6;
     $xRec = 1.6;
     $yImagem = $yRec + 0.3;
     $xImagem = $xRec + 0.3;
     $yHeader = $yRec + 0.5;
     $xHeader = $xRec + 1.8;
     $yTexto = $yRec + 1.5;
     $xTexto = $xRec + 0.3;
     $hRec = 6;
     // Linhas para interessados, cada caracter ocupa em média 1.51cm
     // A etiqueta possui 11.4cm para escrita na horizontal, que seria igual a 75 caracteres.
     $listLinhasInteressados = array();
     $llinhaInteressados = 0;
     $lchar = 75;
     $lstop = false;
     $this->_txInteressado = "Interessados: " . $this->_txInteressado;
     if (strlen($this->_txInteressado) > $lchar) {
         if ($llinhaInteressados == count($listLinhasInteressados)) {
             $lchar = 75;
             $lstop = true;
         }
         $listInteressados = explode(",", $this->_txInteressado);
         $txInteressadoLinha = "";
         foreach ($listInteressados as $key => $txInteressado) {
             $txInteressadoLinha .= $txInteressado;
             $endValue = end($listInteressados);
             if (strlen($txInteressadoLinha) < $lchar) {
                 if ($lstop && $endValue != $txInteressado) {
                     $txInteressadoLinha .= " e outros";
                 }
                 $listLinhasInteressados[] = $txInteressadoLinha;
                 $txInteressadoLinha = "";
             } else {
                 if (!$lstop && $endValue != $txInteressado) {
                     $txInteressadoLinha .= ", ";
                 } else {
                     $listWordsInteressado = explode(' ', $txInteressadoLinha);
                     $txLinhaDoInteressadoLen = "";
                     $txLinhaDoInteressadoTex = "";
                     foreach ($listWordsInteressado as $key => $word) {
                         $txLinhaDoInteressadoLen .= $word . " ";
                         if (strlen($txLinhaDoInteressadoLen) < $lchar) {
                             $txLinhaDoInteressadoTex .= $word . " ";
                             if ($listWordsInteressado[$key] == end($listWordsInteressado)) {
                                 $txLinhaDoInteressadoTex = rtrim($txLinhaDoInteressadoTex);
                                 $listLinhasInteressados[] = $txLinhaDoInteressadoTex;
                                 $txLinhaDoInteressadoTex = "";
                                 $txLinhaDoInteressadoLen = "";
                             }
                         } else {
                             $listLinhasInteressados[] = $txLinhaDoInteressadoTex;
                             $txLinhaDoInteressadoTex = "";
                             $txLinhaDoInteressadoLen = "";
                         }
                     }
                 }
             }
             if ($lstop) {
                 break;
             }
         }
     } else {
         $listLinhasInteressados[] = $this->_txInteressado;
     }
     // linhas para assunto complementar
     $listLinhasAssuntoCompl = array();
     $llinhaAssunto = 1;
     $lchar = 75;
     $lstop = false;
     $txAssuntoComplLabel = "Assunto Complementar: ";
     if (strlen($this->_txAssuntoComplementar) > 0) {
         $this->_txAssuntoComplementar = mb_strtoupper($this->_txAssuntoComplementar, 'UTF-8');
         $this->_txAssuntoComplementar = preg_replace('/\\s+/', " ", $this->_txAssuntoComplementar);
         $this->_txAssuntoComplementar = $txAssuntoComplLabel . $this->_txAssuntoComplementar;
     }
     if (strlen($this->_txAssuntoComplementar) > $lchar) {
         $listWords = explode(" ", $this->_txAssuntoComplementar);
         $totalWords = count($listWords) - 1;
         $linhaAssunto = "";
         foreach ($listWords as $key => $word) {
             $lenlinha = strlen($linhaAssunto);
             $lenword = strlen($word);
             $endvalue = end($listWords);
             $lcharC = $lchar;
             if ($key == 0) {
                 $lcharC = $lchar - strlen($txAssuntoComplLabel);
             }
             if ($lenlinha + $lenword <= $lcharC) {
                 $linhaAssunto .= " " . $word;
             } else {
                 $listLinhasAssuntoCompl[] = utf8_decode($linhaAssunto);
                 $linhaAssunto = " " . $word;
             }
             if ($key == $totalWords && $endvalue == $word) {
                 $listLinhasAssuntoCompl[] = utf8_decode($linhaAssunto);
             }
         }
     } else {
         if (strlen($this->_txAssuntoComplementar) > 0) {
             $listLinhasAssuntoCompl[] = utf8_decode($this->_txAssuntoComplementar);
         }
     }
     // POSICIONAMENTO DO QUADRO
     $totYTex = $yTexto + 0.35 * (12 + count($listLinhasInteressados) + count($listLinhasAssuntoCompl));
     $diffHRec = ($totYTex - ($hRec + $yRec)) / 2;
     $yHeader -= ($totYTex - ($hRec + $yRec)) / 2;
     $yRec -= $diffHRec + 0.15;
     $xImagem -= ($totYTex - ($hRec + $yRec)) / 2 - 0.2;
     $yTexto = $yHeader + count($this->_listTxHeader) * 0.35;
     $this->_pdf->Image($this->_flLogo, $yImagem, $xImagem, 1);
     foreach ($this->_listTxHeader as $txHeader) {
         $this->_pdf->SetFont('Arial', 'B', 8);
         $this->_pdf->Text($xHeader, $yHeader, utf8_decode($txHeader));
         $yHeader += 0.35;
     }
     if (!is_null($this->getCoAmbitoProcesso()) && $this->getCoAmbitoProcesso() != 'F') {
         $nuEtiqueta = $this->_nuArtefato;
     } else {
         $nuEtiqueta = $this->_maskNumber->filter($this->_nuArtefato);
     }
     $this->_pdf->SetFont("Arial", "B", 8);
     $yTexto += 0.5;
     $labelNrProcesso = utf8_decode("Número do Processo: ");
     $this->_pdf->Text($xTexto, $yTexto, $labelNrProcesso . $nuEtiqueta);
     $yTexto += 0.35;
     $this->_pdf->Text($xTexto, $yTexto, utf8_decode("Autuação: ") . $this->_dtAutuacao);
     foreach ($listLinhasInteressados as $key => $txLinhaInteressado) {
         if ($txLinhaInteressado != end($listLinhasInteressados)) {
             $txLinhaInteressado .= " ";
         } else {
             $txLinhaInteressado .= ".";
         }
         $yTexto += 0.35;
         $this->_pdf->Text($xTexto, $yTexto, utf8_decode($txLinhaInteressado));
     }
     $yTexto += 0.35;
     $this->_pdf->Text($xTexto, $yTexto, "Assunto: " . utf8_decode($this->_txAssunto));
     $this->_pdf->SetFont("Arial", "B", 7);
     if (count($listLinhasAssuntoCompl)) {
         foreach ($listLinhasAssuntoCompl as $txLinhaAssuntoCompl) {
             $yTexto += 0.35;
             $this->_pdf->Text($xTexto, $yTexto, trim($txLinhaAssuntoCompl));
         }
     }
     // Dados da Digital
     $this->_pdf->SetFont("Arial", "B", 8);
     $yTexto += 0.35;
     $digital = $this->getDocumentoAutuado();
     if ($digital instanceof \Sgdoce\Model\Entity\Artefato) {
         $nuDigital = $digital->getNuDigital()->getNuEtiqueta();
         if (strlen($nuDigital) <= 7) {
             $nuDigital = str_pad($nuDigital, 7, "0", STR_PAD_LEFT);
         }
         $nuDigitalLinha = "Digital: " . $nuDigital;
         $tipoDocumentoLinha = " Tipo: " . $digital->getSqTipoDocumento()->getNoTipoDocumento();
         $nuArtefatoLinha = "Número: " . $digital->getNuArtefato();
         if (strlen($nuDigitalLinha . $tipoDocumentoLinha . $nuArtefatoLinha) > 68) {
             $text = $nuDigitalLinha . $tipoDocumentoLinha;
             $text = utf8_decode($text);
             $this->_pdf->Text($xTexto, $yTexto, $text);
             $yTexto += 0.35;
             $text = $nuArtefatoLinha;
             $text = utf8_decode($text);
             $this->_pdf->Text($xTexto, $yTexto, $text);
         } else {
             $text = $nuDigitalLinha . $tipoDocumentoLinha . " - " . $nuArtefatoLinha;
             $text = utf8_decode($text);
             $this->_pdf->Text($xTexto, $yTexto, $text);
         }
     }
     $yTexto += 0.2;
     $this->_pdf->Code128($xTexto + 1.8, $yTexto, $this->_nuArtefato, 7.9, 0.9);
     $yTexto += 1.25;
     $this->_pdf->SetFont("Arial", "", 9);
     $this->_pdf->Text($xTexto + 3.8, $yTexto, $nuEtiqueta);
     $this->_pdf->Rect($xRec, $yRec, 11.8, $hRec + $diffHRec * 0.6);
 }
Exemple #4
0
 public function formataProcessoAmbitoFederal(\Sgdoce\Model\Entity\Artefato $entityArtefato)
 {
     $maskNumberFilter = new \Core_Filter_MaskNumber();
     $nuProcesso = $entityArtefato->getNuArtefato();
     if (self::T_TIPO_AMBITO_PROCESSO_FEDERAL == $entityArtefato->getSqArtefatoProcesso()->getCoAmbitoProcesso()) {
         $mask = null;
         switch (strlen($nuProcesso)) {
             case 21:
                 $mask = self::T_MASK_21_DIGITS;
                 break;
             case 17:
                 $mask = self::T_MASK_17_DIGITS;
                 break;
             case 15:
                 $mask = self::T_MASK_15_DIGITS;
                 break;
         }
         if (!is_null($mask)) {
             $maskNumberFilter->setMask($mask);
             $nuProcesso = $maskNumberFilter->filter($nuProcesso);
         }
     }
     return $nuProcesso;
 }
Exemple #5
0
 public function findDataInstitucional($codigo)
 {
     $result = $this->_getRepository('app:PessoaFisica')->findDataInstitucional($codigo);
     if (!isset($result['nuCpf'], $result['nuDdd'], $result['nuTelefone'], $result['txEmail'])) {
         $this->getMessaging()->addInfoMessage('MN121');
     }
     $filter = new \Core_Filter_MaskNumber(array('mask' => 'cpf'));
     $result['nuCpf'] = $filter->filter($result['nuCpf']);
     return $result;
 }
Exemple #6
0
 /**
  * @return void
  * @param integer $linha
  */
 private function _gerarLinhasComNUP($linha)
 {
     switch ($linha) {
         case 1:
             $yImagem = 1.8;
             $yTexto = $yImagem - 0.1;
             break;
         case 2:
             $yImagem = 3.8;
             $yTexto = $yImagem - 0.1;
             break;
         case 3:
             $yImagem = 6.0;
             $yTexto = $yImagem - 0.1;
             break;
         case 4:
             $yImagem = 8.1;
             $yTexto = $yImagem - 0.1;
             break;
         case 5:
             $yImagem = 10.3;
             $yTexto = $yImagem - 0.1;
             break;
         case 6:
             $yImagem = 12.3;
             $yTexto = $yImagem - 0.1;
             break;
         case 7:
             $yImagem = 14.5;
             $yTexto = $yImagem - 0.1;
             break;
         case 8:
             $yImagem = 16.5;
             $yTexto = $yImagem - 0.1;
             break;
         case 9:
             $yImagem = 18.7;
             $yTexto = $yImagem - 0.1;
             break;
         case 10:
             $yImagem = 20.8;
             $yTexto = $yImagem - 0.1;
             break;
         case 11:
             $yImagem = 22.9;
             $yTexto = $yImagem - 0.1;
             break;
         case 12:
             $yImagem = 25.0;
             $yTexto = $yImagem - 0.1;
             break;
         case 13:
             $yImagem = 27.2;
             $yTexto = $yImagem - 0.1;
             break;
     }
     $xImagemNup = 0.9;
     $xImagemEtiqueta = 1.9;
     $xTextoNup = 0.8;
     $xTextoEtiqueta = 2.35;
     $xTextoRotated = 0.65;
     $widthBarcodeDigital = 2;
     $widthBarcodeNup = 3;
     $heigthBarcode = 0.4;
     for ($ws = 1; $ws <= 5; $ws++) {
         if (isset($this->_digitais[$this->_count])) {
             $nuEtiqueta = $this->_digitais[$this->_count]['nuEtiqueta'];
             $nuNUP = $this->_digitais[$this->_count]['nuNupSiorg'];
             $nuNUPMask = $this->_maskNumber->filter($nuNUP);
             if ($ws != 5) {
                 $this->_rotatedText($xTextoRotated, $yTexto + 1.2, $this->_textoEtiqueta, 90);
                 $this->_pdf->Text($xTextoNup, $yTexto, $nuNUPMask);
                 $this->_pdf->Code128($xImagemNup, $yImagem, $nuNUP, $widthBarcodeNup, $heigthBarcode);
                 $this->_pdf->Code128($xImagemEtiqueta, $yImagem + 0.5, $nuEtiqueta, $widthBarcodeDigital, $heigthBarcode);
                 $this->_pdf->Text($xTextoEtiqueta, $yTexto + 1.2, $nuEtiqueta);
                 $this->_count++;
                 if ($ws != 4) {
                     if ($ws == 1) {
                         $xImagemNup = $xImagemNup + 4.1;
                         $xImagemEtiqueta = $xImagemEtiqueta + 4.1;
                         $xTextoNup = $xTextoNup + 4.1;
                         $xTextoEtiqueta = $xTextoEtiqueta + 4.1;
                         $xTextoRotated = $xTextoRotated + 4.1;
                     } else {
                         if ($ws != 2) {
                             $xImagemNup = $xImagemNup + 4.1;
                             $xImagemEtiqueta = $xImagemEtiqueta + 4.1;
                             $xTextoNup = $xTextoNup + 4.1;
                             $xTextoEtiqueta = $xTextoEtiqueta + 4.1;
                             $xTextoRotated = $xTextoRotated + 4.1;
                         } else {
                             //3º Coluna de etiqueta
                             $xImagemNup = $xImagemNup + 4.1;
                             $xImagemEtiqueta = $xImagemEtiqueta + 4.1;
                             $xTextoNup = $xTextoNup + 4.1;
                             $xTextoEtiqueta = $xTextoEtiqueta + 4.1;
                             $xTextoRotated = $xTextoRotated + 4.1;
                         }
                     }
                 }
             } else {
                 $xImagemNup = $xImagemNup + 4.1;
                 $xImagemEtiqueta = $xImagemEtiqueta + 4.1;
                 $xTextoNup = $xTextoNup + 4.1;
                 $xTextoEtiqueta = $xTextoEtiqueta + 4.1;
                 $xTextoRotated = $xTextoRotated + 4.1;
                 $yImagem = $yImagem;
                 $this->_rotatedText($xTextoRotated, $yTexto + 1.2, $this->_textoEtiqueta, 90);
                 $this->_pdf->Text($xTextoNup, $yTexto, $nuNUPMask);
                 $this->_pdf->Code128($xImagemNup, $yImagem, $nuNUP, $widthBarcodeNup, $heigthBarcode);
                 $this->_pdf->Code128($xImagemEtiqueta, $yImagem + 0.5, $nuEtiqueta, $widthBarcodeDigital, $heigthBarcode);
                 $this->_pdf->Text($xTextoEtiqueta, $yTexto + 1.2, $nuEtiqueta);
                 $this->_count++;
             }
         }
     }
 }
 /**
  * Get nuNupSiorg
  *
  * @return string
  */
 public function getNuNupSiorg($withMask = FALSE)
 {
     if ($withMask) {
         $filter = new \Core_Filter_MaskNumber(array('mask' => 'nup'));
         return $filter->filter($this->nuNupSiorg);
     }
     return $this->nuNupSiorg;
 }