Browse Source

ajuste para que a soma dos valores em porcentagem do tempo de atendimento, tempo livre e tempo em pausa sejam sempre igual a 100%

master
douglas.strappasson 1 year ago
parent
commit
5dbca60941
  1. 29
      relatorios/callcenter/geral/desempenhoOperacao.php

29
relatorios/callcenter/geral/desempenhoOperacao.php

@ -252,12 +252,14 @@
$agt_pausa = $data[$row['data']]['tempo_pausa'];
$livre = $agt_duracaoseg - ($agt_pausa + $tempo_calc);
$row['conexoes'] = ($data[$row['data']]['conexoes'] ? $data[$row['data']]['conexoes'] : 0);
$row['agtAtend'] = $agt_duracaoseg ? round($tempo_calc / ($agt_duracaoseg / 100), 2) : 0;
$row['agtLivre'] = $agt_duracaoseg ? round($livre / ($agt_duracaoseg / 100), 2) : 0;
$row['agtPausa'] = $agt_duracaoseg ? round($agt_pausa / ($agt_duracaoseg / 100), 2) : 0;
$residualPercentage = ($row['agtAtend'] + $row['agtLivre'] + $row['agtPausa']) - 100;
$row['agtLivre'] = $this->adjustPercentageResidual($residualPercentage, $row['agtLivre']);
$x++;
$linha = array();
foreach ($dadosField as $key) {
@ -357,6 +359,9 @@
$row['agtLivre'] = $agt_duracaoseg ? round($livre / ($agt_duracaoseg / 100), 2) : 0;
$row['agtPausa'] = $agt_duracaoseg ? round($agt_pausa / ($agt_duracaoseg / 100), 2) : 0;
$residualPercentage = ($row['agtAtend'] + $row['agtLivre'] + $row['agtPausa']) - 100;
$row['agtLivre'] = $this->adjustPercentageResidual($residualPercentage, $row['agtLivre']);
// Formata linha de dados.
$linha = array('DADOS');
foreach ($dadosField as $key) {
@ -511,6 +516,9 @@
$row['agtLivre'] = $agt_duracaoseg ? round($livre / ($agt_duracaoseg / 100), 2) : 0;
$row['agtPausa'] = $agt_duracaoseg ? round($agt_pausa / ($agt_duracaoseg / 100), 2) : 0;
$residualPercentage = ($row['agtAtend'] + $row['agtLivre'] + $row['agtPausa']) - 100;
$row['agtLivre'] = $this->adjustPercentageResidual($residualPercentage, $row['agtLivre']);
$linha = "<tr>";
foreach ($dadosField as $key => $value) {
$linha .= sprintf("<td %s>%s</td>", $value, $row["$key"]);
@ -584,6 +592,10 @@
$dados[$x]['agtAtend'] = $agt_duracaoseg ? round($tempo_calc / ($agt_duracaoseg / 100), 2) : 0;
$dados[$x]['agtLivre'] = $agt_duracaoseg ? round($livre / ($agt_duracaoseg / 100), 2) : 0;
$dados[$x]['agtPausa'] = $agt_duracaoseg ? round($agt_pausa / ($agt_duracaoseg / 100), 2) : 0;
$residualPercentage = ($dados[$x]['agtAtend'] + $dados[$x]['agtLivre'] + $dados[$x]['agtPausa']) - 100;
$dados[$x]['agtLivre'] = $this->adjustPercentageResidual($residualPercentage, $dados[$x]['agtLivre']);
$dados[$x]["data"] = $row["data"];
$dados[$x]["conexoes"] = $row["conexoes"];
$dados[$x]["oferecidas"] = $row["oferecidas"];
@ -662,6 +674,19 @@
$this->___dataRel = array($table1, $table2);
}
private function adjustPercentageResidual($residualPercentage, $percentForAdjustment)
{
if ($residualPercentage > 0){
$adjustedPercentage = $percentForAdjustment - $residualPercentage;
} else if ($residualPercentage < 0) {
$adjustedPercentage = $percentForAdjustment + ($residualPercentage * -1);
} else {
$adjustedPercentage = $percentForAdjustment;
}
return $adjustedPercentage;
}
public function ExecutaRelatorio() {
global $jsStartup, $jsJQuery, $smarty;
try {

Loading…
Cancel
Save