/** * Verifica se ja existe uma nota com o numero e se tem AIDOF [Json] * * @return boolean */ public function emissaoManualSaidaVerificarDocumentoPrestadorEventualAction() { parent::noLayout(); $sTipoDocumento = $this->getRequest()->getParam('tipo_documento_descricao', NULL); $sNumeroDocumento = $this->getRequest()->getParam('s_nota', NULL); $sSerieDocumento = $this->getRequest()->getParam('s_serie_nota', NULL); $iIdDocumento = $this->getRequest()->getParam('id', NULL); if ($sTipoDocumento && $sNumeroDocumento) { $lNotaEmitida = Contribuinte_Model_DmsNota::checarNotaEmitidaPrestadorEventual($this->oContribuinte, $sTipoDocumento, $sNumeroDocumento, $sSerieDocumento, $iIdDocumento); if ($lNotaEmitida) { $sMensagemErro = $this->translate->_('Já existe um documento com o número %s'); $aRetornoJson['status'] = FALSE; $aRetornoJson['error'][] = sprintf($sMensagemErro, $sNumeroDocumento); echo $this->getHelper('json')->sendJson($aRetornoJson); return FALSE; } } return TRUE; }