get_variable('CLIENTEDOC',true); $clientePendencia = VerificaPendencia($CPF_CNPJ); if(substr($clientePendencia, 0,4) == "Erro"){ $agi->exec_goto(GetAnuncio('REDIRECIONA_ATENDIMENTO')); } if($clientePendencia == 'Adimplente'){ $agi->exec_goto(GetAnuncio('REDIR_VERIFICA_PARADA')); } if($clientePendencia == 'Inadimplente'){ $agi->exec_goto(GetAnuncio('CLIENTE_INADIMPLENTE')); } if($clientePendencia == 'Bloqueado'){ $agi->exec_goto(GetAnuncio('CLIENTE_BLOQUEADO')); } } catch (Exception $ex) { $reg_msg = $ex->getMessage(); $reg_status_exec = 'Er'; __logStr("Verifica Pendencia", $reg_msg, $scrpt, true); } @AtualizaIntegracao($uid, $reg_retorno, $reg_msg, $reg_status_exec, $retorno_cliente); if (!$dadosIntegra) @grava_dadosIntegra($reg_retorno); function VerificaPendencia($CPFCNPJ){ if(empty($CPFCNPJ)){ throw new Exception("Erro - CPF deve ser informado!"); } try{ $sql = "SELECT nome_cliente, cpf_cnpj, status_cliente, quant_faturas, valor_faturas " . "FROM pbx_homologa_itgc WHERE cpf_cnpj = '{$CPFCNPJ}'"; $resultado = pg_query(ConnectPG(), $sql); $retornoStatus = pg_fetch_assoc($resultado); if(!$retornoStatus){ throw new Exception("Erro - erro ao consultar a base de dados!"); } return $retornoStatus; } catch (Exception $ex) { return $ex->getMessage(); } } ?>