Id |
Ramal |
Bina |
Contexto |
Dispositivo |
Dep |
Ações |
0) {
$tpParcial = 0;
} else {
$tpParcial = 2;
}
}
if ((!empty($filtro)) && ($tpParcial == 0)) {
$compl = " where (nome ilike '%$filtro%' or callerid ilike '%$filtro%')";
} else if ((!empty($filtro)) && ($tpParcial == 1)) {
$params = explode(",", $filtro);
$compl = "";
foreach ($params as $param) {
//$param = trim(str_replace("'", "", $param));
$dado .= empty($dado) ? "'$param'" : ",'$param'";
}
$compl = " where (nome in($dado) or callerid in($dado))";
} else if ((!empty($filtro)) && ($tpParcial == 2)) {
$params = explode("-", $filtro);
$compl = "";
$ini = $params[0];
$fim = $params[1];
$qtd1 = strlen($ini) - strlen(ltrim($ini, "0"));
$qtd2 = strlen($fim) - strlen(ltrim($fim, "0"));
if ($qtd1 >= 1) {
$ini1 = '-' . $qtd1;
} else {
$ini1 = $ini;
}
if ($qtd2 >= 1) {
$fim1 = '-' . $qtd2;
} else {
$fim1 = $fim;
}
$compl = " where nome between '$ini' and '$fim' and ramal between '$ini1' and '$fim1'";
} else {
$compl = "";
}
$query = "drop table if exists ramal_iax;
create temporary table ramal_iax(
id integer,
nome character varying(100),
context character varying(100),
dispositivo character varying(250),
saldo_prepago numeric(12,4),
habilita_prepago integer,
callerid character varying(100),
ramal integer
);
insert into ramal_iax (id,nome, context,dispositivo, saldo_prepago, habilita_prepago,callerid,ramal)
SELECT id,nome, context,dispositivo, saldo_prepago, habilita_prepago,identificador,
cast(case when (length(nome) - length(ltrim(nome,'0'))) >= 1 then '-'||(length(nome) - length(ltrim(nome,'0')))::int--||nome
else nome
end as int)
FROM pbx_iax_pbx;
select * from ramal_iax $compl order by ramal asc,nome asc ";
$params = "&pbxRequest=1&numRamal=$filtro";
$links = PaginaDados($idProg, $query, $params, $regPagina, $offSet, $pagMostra, true);
$query .= " limit $regPagina offset $offSet";
$result = pg_query($dbcon, $query);
$z = 0;
while ($dados = pg_fetch_array($result)) {
$totaldep = GetTotalDependencias('ramal', $dados['nome']);
$opcao = 'ramal';
$acao = $dados['nome'];
$recursoTipo = 'Ramal';
$nomeRecurso = $dados['nome'];
$dep = GetLinkDependenciaRecurso($opcao, $acao, $recursoTipo, $nomeRecurso, $totaldep);
?>
|
|
|
|
|
|
|
Não foram encontrados registros |
|
|