$inicio |
$fim |
$motivo |
$displayTempo |
";
$buffDados[] = $linha;
$linhas .= $linha;
}
$displayTempo = SecondToStrTime($somaTempo);
$linha = "
Quantidade |
$qtPausa |
Tempo |
$displayTempo |
";
$buffDados[] = $linha;
$linhas .= $linha;
$_SESSION["SSlinhasPausasDiscador"] = $buffDados;
//agrupado
$linhaAgrup = "";
foreach ($soma_tempo as $key => $value) {
$motivo = $key;
$tempo = $value;
$qtAgrup = $soma_quant[$key];
$displayTempoAgrup = SecondToStrTime($tempo);
$tmpMed = !$qtAgrup ? 0 : round($tempo / $qtAgrup);
$displayTempoMed = SecondToStrTime($tmpMed);
$linhaAgrup .= "
$motivo |
$qtAgrup |
$displayTempoAgrup |
$displayTempoMed |
";
}
$_SESSION["SSlinhasPausasDiscadorAgp"] = $linhaAgrup;
//Atualiza template
$smarty->assign("dacs", $dacs);
$smarty->assign("agente", $agente);
$smarty->assign("listas", $listas);
$smarty->assign('dataIni', $dataIni);
$smarty->assign('dataFim', $dataFim);
$smarty->assign("linha", $linhas);
$smarty->assign("linhaAgrupado", $linhaAgrup);
$smarty->assign("imp", $imp);
//Seta o template
GetTemplate($smarty, $templateName);
function GetQuery($cmpId, $matricula) {
$idSessao = session_id();
$ret = "select a.matricula, a.inicio_operacao, a.final_oepracao, c.apelido, a.operacao, case when(operacao = 'atendimento')then tempo_operacao else extract(epoch from ((a.final_oepracao - a.inicio_operacao))) end as tempo_operacao
from pbx_desempenho_discador a, pbx_usuarios c
where c.matricula = a.matricula
and id_dac = '$cmpId'
and a.id_sessao = '$idSessao'
and a.matricula = case when('$matricula' = '0')then a.matricula else '$matricula' end
and a.operacao <> 'livre'
order by 1, 2";
return $ret;
}
?>