public function gerarPdfAction() { $data = $this->getDataPdf(); $registry = \Zend_Registry::get('configs'); $options = array('path' => $registry['folder']['pdf']); $file = $this->_pdfName; $controller = $this->getFrontController()->getRequest()->getControllerName(); \Core_Doc_Factory::setFilePath(APPLICATION_PATH . '/layouts/pdf/' . $controller); \Core_Doc_Factory::write('pdf', array('data' => $data), $options['path'], $file); $this->_helper->download($file, $options); }
public function printDespachoAction() { $this->_helper->layout()->disableLayout(); $data = $this->_getAllParams(); $id = (int) $data['id']; if (!$id) { throw new Exception(\Core_Registry::getMessage()->translate('MN132')); } $data = $this->getService()->findBy(array('sqDespachoInterlocutorio' => $id)); $args = $this->getService()->find($id); $sqArtefato = $args->getSqArtefato()->getSqArtefato(); // $entityArtefato = $this->getService('VwConsultaArtefato')->findBy( // array('sqArtefato' => $sqArtefato) // ); $entityArtefato = $this->getService('Artefato')->find($sqArtefato); $options = array('fname' => sprintf('Despacho-%d.pdf', $id), 'path' => APPLICATION_PATH . '/modules/artefato/views/scripts/despacho-interlocutorio/'); \Core_Doc_Factory::setFilePath($options['path']); \Core_Doc_Factory::download('print-despacho', array('data' => $data, 'entityArtefato' => $entityArtefato, 'dtFormatPrint' => self::T_ARTEFATO_DESPACHO_INTERLOCUTORIO_DATE_TIME_PT_BR), $options['fname']); }
public function printHistoricAction() { $this->_helper->layout()->disableLayout(); $sqArtefato = (int) $this->getRequest()->getParam('sqArtefato'); if (!$sqArtefato) { throw new Exception(\Core_Registry::getMessage()->translate('MN132')); } $params = array('sqArtefato' => $sqArtefato); $dto = Core_Dto::factoryFromData($params, 'search'); $data = $this->getService('Artefato')->getHistoricoByArtefato($dto); $options = array('fname' => sprintf('Historico-' . date('YmdHis') . '-%d.pdf', $sqArtefato), 'path' => APPLICATION_PATH . '/modules/artefato/views/scripts/visualizar-artefato'); $logo = current(explode('application', __FILE__)) . 'public' . DIRECTORY_SEPARATOR . ltrim(self::T_VISUALIZAR_ARTEFATO_IMG_LOGO_PATH, DIRECTORY_SEPARATOR); \Core_Doc_Factory::setFilePath($options['path']); \Core_Doc_Factory::download('print-historic', array('data' => $data, 'logo' => $logo, 'entityArtefato' => $this->getService('Artefato')->find($sqArtefato)), $options['fname'], 'Pdf', 'L'); }
/** * Retorna o download com o Modelo de Minuta */ public function downloadModeloAction() { $codigo = $this->_getParam('codigo'); $registry = \Zend_Registry::get('configs'); $options = array('path' => $registry['folder']['modeloMinuta']); $dtoEntity = Core_Dto::factoryFromData(array('sqModeloDocumento' => $codigo), 'entity', array('entity' => 'Sgdoce\\Model\\Entity\\ModeloDocumento')); $entityModelo = $this->getService()->find($codigo); $entityArray = $this->getService()->findModelo($dtoEntity); $dtoSearch = Core_Dto::factoryFromData(array('sqPadraoModeloDocumento' => $entityArray['sqPadraoModeloDocumento'], 'sqModeloDocumento' => $entityArray['sqModeloDocumento']), 'search'); $arrayGrupo = $this->getService('PadraoModeloDocumentoCampo')->listItensPadraoModeloDocCampos($dtoSearch); $file = "{$entityArray['noPadraoModeloDocumento']}.pdf"; \Core_Doc_Factory::setFilePath(APPLICATION_PATH . '/modules/modelo-minuta/views/scripts/modelo-minuta'); switch ($entityArray['sqPadraoModeloDocumento']) { case 1: \Core_Doc_Factory::write('padraoAta', array('data' => $arrayGrupo, 'entity' => $entityModelo), $options['path'], $file); break; case 2: \Core_Doc_Factory::write('padraoGeral', array('data' => $arrayGrupo, 'entity' => $entityModelo), $options['path'], $file); break; case 3: \Core_Doc_Factory::write('padraoOficio', array('data' => $arrayGrupo, 'entity' => $entityModelo), $options['path'], $file); break; } $this->_helper->download($file, $options); }
public function setPathDoc($data, $path, $noArquivo) { \Core_Doc_Factory::setFilePath(APPLICATION_PATH . '/modules/auxiliar/views/scripts/pessoa-juridica'); \Core_Doc_Factory::write('doc-matriz-filial', $data, $path, $noArquivo); }
/** * Método que prepara o documento com os dados * @param \Core_Dto_Entity $dtoEntityPessoa * @param \Core_Dto_Entity $dtoEntityModelo * @param boolean $view * @return string $file */ public function doc($dtoEntityArtefato, $dtoEntityModelo, $view) { $registry = \Zend_Registry::get('configs'); $options = array('path' => $registry['folder']['visualizaMinuta']); // inicio consultas dos dados de todos 'pessoa_funcao' envolvidas na minuta $arrOrigem = $this->getEntityManager()->getRepository('app:ArtefatoMinuta')->getPessoaOrigemArtefato($dtoEntityArtefato); $arrDestino = $this->getEntityManager()->getRepository('app:ArtefatoMinuta')->getPessoaDestinatarioArtefato($dtoEntityArtefato); $arrInteressado = $this->getEntityManager()->getRepository('app:PessoaInteressadaArtefato')->getPessoaInteressadaArtefato($dtoEntityArtefato); $arrAssinatura = $this->getEntityManager()->getRepository('app:ArtefatoMinuta')->getPessoaAssinaturaArtefato($dtoEntityArtefato); $arrRodape = $this->getEntityManager()->getRepository('app:PessoaArtefato')->getPessoaArtefatoRodape($dtoEntityArtefato); // fim consultas dos dados de todos 'pessoa_funcao' envolvidas na minuta $objModeloMinuta = $this->getServiceLocator()->getService('modeloMinuta')->findModelo($dtoEntityModelo); $arrCampo = $this->getCamposModelo($objModeloMinuta['sqModeloDocumento']); $entityArtefato = $this->getEntityManager()->getRepository('app:Artefato')->find($dtoEntityArtefato->getSqArtefato()); // barcode do numero da digital $config = new \Zend_Config(array('barcode' => 'Code25interleaved', 'barcodeParams' => array('text' => str_replace(array('E', '-'), '', $arrOrigem['nuDigital']), 'drawText' => FALSE, 'barHeight' => 50, 'barWidth' => 60), 'renderer' => 'image', 'rendererParams' => array('imageType' => 'gif'))); $path = current(explode('application', __DIR__)) . 'data' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'documento' . DIRECTORY_SEPARATOR; $imgBarcode = $path . 'barcode.jpg'; if (file_exists($imgBarcode)) { unlink($imgBarcode); } $renderer = \Zend_Barcode::factory($config)->draw(); imagejpeg($renderer, $imgBarcode); imagedestroy($renderer); $arrOrigem['bar_code'] = $imgBarcode; // path para o arquivo utilizado como referencia para criacao do pdf \Core_Doc_Factory::setFilePath(APPLICATION_PATH . '/modules/artefato/views/scripts/visualizar-caixa-minuta'); $file = "{$objModeloMinuta['noPadraoModeloDocumento']}.pdf"; $data = array('arrOrigem' => $arrOrigem, 'arrDestino' => $arrDestino, 'arrInteressado' => $arrInteressado, 'arrAssinatura' => $arrAssinatura, 'arrRodape' => $arrRodape, 'arrCampo' => $arrCampo, 'viewFor' => $view, 'entity' => $entityArtefato); // retorna os dados para a controller para renderizar no phtml e não sno pdf.. if ($view) { return $data; } return $this->gerarDoc($objModeloMinuta['sqPadraoModeloDocumento'], $data, $options, $file); }
/** * * @param string $phtml * @param array $params * @param string $fname * @param string $path * * @return binary */ public function gerar($phtml, $fname, $path) { \Core_Doc_Factory::setFilePath($path); return \Core_Doc_Factory::download($phtml, $this->getParams(), $fname); }
public function _generateTerm($type) { # dispensa o uso do template $this->getHelper('layout')->disableLayout(); $params = $this->_getAllParams(); $anexado = null; if (is_array($params['child'])) { $anexado = array(); foreach ($params['child'] as $item) { $anexado[] = $this->getService('Artefato')->find((int) $item); } } else { $anexado = $this->getService('Artefato')->find((int) $params['child']); } $anexador = $this->getService('Artefato')->find((int) $params['parent']); $despacho = $this->getService('DespachoInterlocutorio')->find((int) $params['despacho']); $assinante = $this->getService('VwPessoa')->find((int) $params['assinante']); $noCargoFuncao = null; if ($params['cargo']) { $cargoFuncao = $this->getService('Cargo')->find((int) $params['cargo']); $noCargoFuncao = $cargoFuncao->getNoCargo(); } else { if ($params['funcao']) { $cargoFuncao = $this->getService('Funcao')->find((int) $params['funcao']); $noCargoFuncao = $cargoFuncao->getNoFuncao(); } } $options = array('fname' => sprintf('Termo%s-%s.pdf', ucfirst($type), date('YmdHis')), 'path' => APPLICATION_PATH . '/modules/artefato/views/scripts/vinculo/'); $logo = current(explode('application', __FILE__)) . 'public' . DIRECTORY_SEPARATOR . ltrim(self::T_ICMBIO_IMAGE_LOGO_PATH, DIRECTORY_SEPARATOR); \Core_Doc_Factory::setFilePath($options['path']); $vData = array('data' => (object) array('tipoOperacao' => self::$T_DIC_ACTION[$params['tOper']], 'unidadeBase' => \Core_Integration_Sica_User::getUserUnitName(), 'unidadeAtendida' => $despacho->getSqUnidadeAssinatura()->getNoUnidadeOrg(), 'processoAnexador' => $anexador, 'processoAnexado' => $anexado, 'despacho' => str_pad((int) $params['despacho'], 8, '0', \STR_PAD_LEFT), 'assinante' => $assinante->getNoPessoa(), 'cargoFuncao' => $noCargoFuncao, 'dataExtenso' => \Zend_Date::now()->get("dd 'de' MMMM 'de' yyyy")), 'logo' => $logo); \Core_Doc_Factory::download(sprintf('termo-%s-anexacao-doc', $type), $vData, $options['fname']); }
public function printAction() { $this->_helper->layout()->disableLayout(); $data = $this->_getAllParams(); $sqArtefato = (int) $data['sqArtefato']; if (!$sqArtefato) { throw new Exception(\Core_Registry::getMessage()->translate('MN132')); } $digitalOrNumProcesso = NULL; $artefato = $this->getService('Artefato')->find($sqArtefato); if ($artefato->getSqTipoArtefatoAssunto()->getSqTipoArtefato()->getSqTipoArtefato() == \Core_Configuration::getSgdoceTipoArtefatoProcesso()) { $digitalOrNumProcesso = $this->getService('Processo')->formataProcessoAmbitoFederal($artefato); } else { $digitalOrNumProcesso = $artefato->getNuDigital()->getNuEtiqueta(); $digitalOrNumProcesso = strlen($digitalOrNumProcesso) < 7 ? str_pad($digitalOrNumProcesso, 7, '0', STR_PAD_LEFT) : $digitalOrNumProcesso; } $data = $this->getService()->findBy(array('sqArtefato' => $sqArtefato), array('dtComentario' => 'DESC')); $options = array('fname' => sprintf('Comentario-%d.pdf', $sqArtefato), 'path' => APPLICATION_PATH . '/modules/artefato/views/scripts/comentario'); $logo = current(explode('application', __FILE__)) . 'public' . DIRECTORY_SEPARATOR . ltrim(self::T_ARTEFATO_COMENTARIO_IMG_LOGO_PATH, DIRECTORY_SEPARATOR); \Core_Doc_Factory::setFilePath($options['path']); \Core_Doc_Factory::download('print', array('data' => $data, 'logo' => $logo, 'nuArtefato' => $digitalOrNumProcesso, 'dtFormatPrint' => self::T_ARTEFATO_COMENTARIO_DATE_TIME_PT_BR), $options['fname']); }
/** * @return void */ public function printGuiaAction() { $this->_helper->layout()->disableLayout(); $params = $this->_getAllParams(); $arrSqArtefato = explode('|', $params['data']); //recupera o ultimo tramite de um dos documentos tramitados pois são todos iguais $entityUltimoTramite = $this->getService('VwUltimoTramiteArtefato')->find($arrSqArtefato[0]); //@TODO: TESTAR PRA VER SE DA PRA PEGAR O SQ_ENDERECO DA $entityUltimoTramite $enderecoDestino = NULL; /* $entEndereco = $this->getService('VwEndereco')->find($params['endereco']); $enderecoDestino = ''; if ($entEndereco) { $nuEndereco = $entEndereco->getNuEndereco(); $enderecoDestino = $entEndereco->getNoBairro(); $enderecoDestino .= ', ' . $entEndereco->getTxEndereco(); $enderecoDestino .= ', ' . (is_null($nuEndereco) ? 'S/N': 'Nº ' . $nuEndereco ); $enderecoDestino .= ', ' . $entEndereco->getTxComplemento(); $enderecoDestino = rtrim(trim($enderecoDestino),','); }*/ $objZSN = new \Zend_Session_Namespace("TramiteTxEndereco"); if (isset($objZSN->txEndereco)) { $enderecoDestino = $objZSN->txEndereco; $objZSN->unsetAll(); } $data = $this->getService()->getArtefatoGuia($arrSqArtefato); $options = array('fname' => sprintf('Guia-%d.pdf', date('YmdHis')), 'path' => APPLICATION_PATH . '/modules/artefato/views/scripts/tramite/'); $logo = current(explode('application', __FILE__)) . 'public' . DIRECTORY_SEPARATOR . ltrim(self::IMG_LOGO_PATH, DIRECTORY_SEPARATOR); \Core_Doc_Factory::setFilePath($options['path']); $viewParams = array('data' => $data, 'logo' => $logo, 'entityUTA' => $entityUltimoTramite, 'endereco' => $enderecoDestino, 'maskNumber' => new \Core_Filter_MaskNumber()); \Core_Doc_Factory::download('print-guia', $viewParams, $options['fname']); }