/**
  * Tela para o relatório evolutivo da arrecadação mês a mês por declarante por regime de competência
  */
 public function consultaAction()
 {
     $oForm = new Fiscal_Form_RelatorioWebservice();
     $this->view->form = $oForm;
     $this->view->headScript()->offsetSetFile(50, $this->view->baseUrl('/fiscal/js/relatorios/script-compartilhado.js'));
     if ($this->getRequest()->isPost()) {
         $aRetornoJson = array();
         try {
             $aParametros = $this->getRequest()->getParams();
             $iIdAcao = $aParametros['ambiente'];
             if ($aParametros['ambiente'] == 51) {
                 $sAmbiente = 'Homologação';
             } else {
                 if ($aParametros['ambiente'] == 52) {
                     $sAmbiente = 'Produção';
                 }
             }
             $aContribuinte = Administrativo_Model_UsuarioContribuinte::getContribuinteByAcao($iIdAcao);
             if (count($aContribuinte) == 0) {
                 throw new Exception('Nenhum registro encontrado!');
             }
             $oPdf = new Fiscal_Model_RelatorioWebservice();
             $sNomeArquivo = 'contribuinte_webs_' . date('YmsdHis') . '.pdf';
             $sCaminhoArquivo = TEMP_PATH . '/' . $sNomeArquivo;
             $oPdf->Open($sCaminhoArquivo);
             $oPdf->setAmbiente($sAmbiente);
             $oPdf->gerarPdf($aContribuinte, $sAmbiente);
             $oPdf->Output();
             $aRetornoJson = array('status' => TRUE, 'url' => $this->view->baseUrl("/fiscal/relatorio-webservice/download/arquivo/{$sNomeArquivo}"), 'success' => $this->translate->_('Relatório gerado com sucesso.'));
         } catch (Exception $oErro) {
             $aRetornoJson['status'] = FALSE;
             $aRetornoJson['error'][] = $this->translate->_($oErro->getMessage());
         }
         echo $this->getHelper('json')->sendJson($aRetornoJson);
     }
 }