/** * Busca a aliquota por servico [Json] */ public function emissaoManualBuscarDadosServicoAction() { try { // Perfil do usuario $iIdPerfil = $this->oUsuario->getPerfil()->getId(); $iIdServico = $this->getParam('id_servico'); $aRetornoJson = array(); // Ignora se for prestador eventual if ($iIdPerfil != 6) { $aServicos = Contribuinte_Model_Servico::getByIm($this->oContribuinte->getInscricaoMunicipal(), FALSE); if (is_array($aServicos)) { foreach ($aServicos as $oServico) { if ($oServico->attr('cod_atividade') == $iIdServico) { $aRetornoJson = array('item_servico' => $oServico->attr('desc_item_servico'), 'cod_item_servico' => $oServico->attr('cod_item_servico'), 'estrut_cnae' => $oServico->attr('estrut_cnae'), 'deducao' => $oServico->attr('deducao'), 'aliq' => DBSeller_Helper_Number_Format::toMoney($oServico->attr('aliq'))); break; } } } } echo $this->getHelper('json')->sendJson($aRetornoJson); } catch (Exception $e) { $aRetorno['erro'] = TRUE; if ($e->getCode() == Global_Lib_Model_WebService::CODIGO_ERRO_CONSULTA_WEBSERVICE) { $aRetorno['mensagem'] = "E-cidade temporariamente insdisponível. Emissão bloqueada!"; } else { $aRetorno['mensagem'] = $e->getMessage(); } echo $this->getHelper('json')->sendJson($aRetorno); } }