%s %s %s %s '; $query = "select b.fila, cast(a.calldate as date) as data, calldate::time as hora, a.src as origem, param3::integer as tempo from ast_bilhetes a, ast_eventos_dacs b where b.uid2 = a.uniqueid and b.evento = 'ABANDON' and a.lastapp <> 'Transferred Call' and cast(a.calldate as date) = now()::date and b.fila = '$dac' order by 1, 3 desc"; $result = pg_query($dbcon, $query); $numrow = 0; $linhas = ""; $duracaoTotal = ''; while ($row = pg_fetch_array($result)) { $linhas .= sprintf($linha, FormataDBDataHora($row["data"]), $row["hora"], $row["origem"], SecondToStrTime($row["tempo"])); $duracaoTotal += $row["tempo"]; $numrow++; } $duracaoTotal = SecondToStrTime($duracaoTotal); $linha = " Total $numrow $duracaoTotal "; $linhas .= $linha; $smarty->assign('linhas', $linhas); GetTemplate($smarty, $nomeTpl); ?>