if($listaleft == 1) {
$mysql = "select nomeequipo as saida,sum(quantidade) as total from ".$tbfull." where tipoinfo = 'PRC' and ano = ".$anoatual." and mes = ".$mesatual.$filtroadicional.$filtrocnpj." group by nomeequipo";
$valormetar = pegacampo($tbfull,"sum(quantidade)","tipoinfo = 'PRC' and ano = ".$anoatual." and mes = ".$mesatual.$filtroadicional.$filtrocnpj)*1;
}
if($listaleft == 2) {
$mysql = "select concat(nomeequipo,' ',nomeciclo) as saida,sum(quantidade) as total from ".$tbfull." where tipoinfo = 'PRC' and ano = ".$anoatual." and mes = ".$mesatual.$filtroadicional.$filtrocnpj." group by concat(nomeequipo,' ',nomeciclo)";
$valormetar = pegacampo($tbfull,"sum(quantidade)","tipoinfo = 'PRC' and ano = ".$anoatual." and mes = ".$mesatual.$filtrocnpj.$filtroadicional)*1;
}
if($listaleft == 3) {
$mysql = "select nomeequipo as saida,sum(elementos) as total from ".$tbfull." where tipoinfo = 'PRC' and ano = ".$anoatual." and mes = ".$mesatual.$filtroadicional.$filtrocnpj." group by nomeequipo";
$valormetar = pegacampo($tbfull,"sum(elementos)","tipoinfo = 'PRC' and ano = ".$anoatual." and mes = ".$mesatual.$filtroadicional.$filtrocnpj)*1;
}
if($listaleft == 4) {
$mysql = "select a.cnpj, b.nome as saida,count(distinct computador) as total from siresbd_press_log as a inner join siresbd_press_clientes as b on a.cnpj = b.cnpj where year(datahora) = ".$anoatual." and month(datahora) = ".$mesatual.$filtrocnpj." group by a.cnpj, b.nome ";
$valormetar = pegacampo("siresbd_press_log as a inner join siresbd_press_clientes as b on a.cnpj = b.cnpj","count(distinct CONCAT(nome,computador))"," year(datahora) = ".$anoatual." and month(datahora) = ".$mesatual.$filtrocnpj)*1;
}
if($listaleft == 5) {
$mysql = "select a.cnpj, b.nome as saida,count(distinct IpAcesso) as total from siresbd_press_log as a inner join siresbd_press_clientes as b on a.cnpj = b.cnpj where year(datahora) = ".$anoatual." and month(datahora) = ".$mesatual.$filtrocnpj." group by a.cnpj, b.nome ";
$valormetar = pegacampo("siresbd_press_log as a inner join siresbd_press_clientes as b on a.cnpj = b.cnpj","count(distinct CONCAT(nome,IpAcesso))"," year(datahora) = ".$anoatual." and month(datahora) = ".$mesatual.$filtrocnpj)*1;
}
$ressqlx = mysqli_query($dbextra,$mysql);
while ($mascara = mysqli_fetch_array($ressqlx)) {
if ($valormetar == 0) {
$metax = 100;
} else {
$metax = intval(100*$mascara[total] / ($valormetar));
}
?>
if($listaleft > 3) { ?>