コード例 #1
0
 /**
  * Método que retorna a quantidade de Notas Emitidas
  *
  * @param  integer $iInscricaoMunicipal
  * @param  integer $iTipoNota
  * @param  string  $sGrupoNota
  * @throws Exception
  * @return integer
  */
 public function getQuantidadesNotasEmissao($iInscricaoMunicipal, $iTipoNota = NULL, $sGrupoNota = NULL)
 {
     if (!$iInscricaoMunicipal) {
         throw new Zend_Exception('Informe uma Inscrição Municipal.');
     }
     if (!$iTipoNota && !$sGrupoNota) {
         throw new Zend_Exception('Informe o Tipo de Nota ou Grupo de Nota.');
     }
     if ($iTipoNota) {
         $oWebService = new WebService_Model_Ecidade();
         $aFiltro = array('inscricao_municipal' => $iInscricaoMunicipal, 'tipo_nota' => $iTipoNota);
         $aCampos = array('quantidade_notas_liberadas');
         $aRetorno = $oWebService::consultar('getQuantidadeNotasLiberadas', array($aFiltro, $aCampos));
     } else {
         $oWebService = new WebService_Model_Ecidade();
         $aFiltro = array('inscricao_municipal' => $iInscricaoMunicipal, 'grupo_nota' => $sGrupoNota);
         $aCampos = array('quantidade_notas_liberadas');
         $aRetorno = $oWebService::consultar('getQuantidadeAidofsLiberadasPorGrupoDocumento', array($aFiltro, $aCampos));
     }
     if (is_array($aRetorno)) {
         $iQuantidadeNotasEmitidas = Contribuinte_Model_DmsNota::getQuantidadeNotasEmitidas($iInscricaoMunicipal, $iTipoNota);
         return $aRetorno[0]->quantidade_notas_liberadas - $iQuantidadeNotasEmitidas;
     }
     DBSeller_Plugin_Notificacao::addAviso('Aidof01', "Não houve retorno do WebService do E-Cidade!");
     return 0;
 }