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'); }
/** * * @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']); }