TransWar File Browser

Path: C:\

<?php
session_start();
date_default_timezone_set('America/Sao_Paulo');
$dateadded = date("d/m/Y  --  G:i"); 
$hoje = date("d/m/Y"); 
ini_set('max_execution_time',259200); 
include_once("API02.php");
$grupo='17';$ds_grupo="CRODA";
if ($grupo<>"nulo"){$logo='grupo_'.$grupo.'.png';} else {if($empresa<>"nulo"){$logo='empresa_'.$empresa.'.png';} else{$logo='logo.png';}}
$inicio   = $_SESSION['inicio'];
$json     = $_SESSION['json']; 
$coleta   = $_SESSION['coleta'];
$alerta2  = json_decode($coleta, true);
$div2='';$al='';$pe='';$fr='';
$bb=count($alerta2['rows']);
foreach ($alerta2['rows'] as $lin2) {
  if ($lin2['c'][2]['v']==146 and $lin2['c'][3]['v']<>0){$pe='Pendente';}
  if ($lin2['c'][2]['v']==149 and $lin2['c'][3]['v']<>0){$al='Alocada';}
  if ($al<>''){if ($pe<>''){$fr=' Pendente/Alocada ';}else{$fr=' Alocada ';}}else{if ($pe<>''){$fr=' Pendente ';}else{$fr='';}}
  if ($fr<>''){$div2='<img src="images/atenção.png" width="30" height="30" class="alerta"></img>&nbsp;&nbsp;Coleta'.$fr.'na data LIMITE.';}
}
$matriz = file_get_contents('upload/matriz.json');
$principal=json_decode($matriz, true);
$oc=count($principal);
$x2=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='red')
  { $x2++;$red[$x2]=$principal[$x]['id'];}
}
$x3=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='green')
  { $x3++;$green[$x3]=$principal[$x]['id'];}
}
$x4=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='Peru')
  { $x4++;$peru[$x4]=$principal[$x]['id'];}
}
$x5=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='blue')
  { $x5++;$blue[$x5]=$principal[$x]['id'];}
}
$x6=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='Gold')
  { $x6++;$gold[$x6]=$principal[$x]['id'];}
}
$x7=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='Grey')
  { $x7++;$gray[$x7]=$principal[$x]['id'];}
}
$tot_red2=0;for ($q=0; $q < $bb; $q++){if ($alerta2['rows'][$q]['c'][1]['v']<>0){
  for ($x=1;$x<=$x2;$x++){if($red[$x]==$alerta2['rows'][$q]['c'][2]['v']){$tot_red2=$tot_red2+$alerta2['rows'][$q]['c'][1]['v'];}}}} 
$tot_green2=0;for ($q=0; $q < $bb; $q++){if ($alerta2['rows'][$q]['c'][1]['v']<>0){
  for ($x=1;$x<=$x3;$x++){if($green[$x]==$alerta2['rows'][$q]['c'][2]['v']){$tot_green2=$tot_green2+$alerta2['rows'][$q]['c'][1]['v'];}}}} 
$tot_peru2=0;for ($q=0; $q < $bb; $q++){if ($alerta2['rows'][$q]['c'][1]['v']<>0){
  for ($x=1;$x<=$x4;$x++){if($peru[$x]==$alerta2['rows'][$q]['c'][2]['v']){$tot_peru2=$tot_peru2+$alerta2['rows'][$q]['c'][1]['v'];}}}} 
$tot_blue2=0;for ($q=0; $q < $bb; $q++){if ($alerta2['rows'][$q]['c'][1]['v']<>0){
  for ($x=1;$x<=$x5;$x++){if($blue[$x]==$alerta2['rows'][$q]['c'][2]['v']){$tot_blue2=$tot_blue2+$alerta2['rows'][$q]['c'][1]['v'];}}}} 
$tot_gold2=0;for ($q=0; $q < $bb; $q++){if ($alerta2['rows'][$q]['c'][1]['v']<>0){
  for ($x=1;$x<=$x6;$x++){if($gold[$x]==$alerta2['rows'][$q]['c'][2]['v']){$tot_gold2=$tot_gold2+$alerta2['rows'][$q]['c'][1]['v'];}}}} 
$tot_gray2=0;for ($q=0; $q < $bb; $q++){if ($alerta2['rows'][$q]['c'][1]['v']<>0){
  for ($x=1;$x<=$x7;$x++){if($gray[$x]==$alerta2['rows'][$q]['c'][2]['v']){$tot_gray2=$tot_gray2+$alerta2['rows'][$q]['c'][1]['v'];}}}} 
$slices2="slices: {";$data2="[['Tôpico', 'Fatia'],";$ix=0;
if ($tot_red2<>0){$data2=$data2."['NÃO REALIZADO',".$tot_red2."],";$slices2=$slices2.$ix.":{color:'red'},";$ix++;}
if ($tot_green2<>0){$data2=$data2."['SERVIÇO REALIZADO',".$tot_green2."],";$slices2=$slices2.$ix.":{color:'green'},";$ix++;}
if ($tot_peru2<>0){$data2=$data2."['ALOCADO / LIBERADO',".$tot_peru2."],";$slices2=$slices2.$ix.":{color:'Peru'},";$ix++;}
if ($tot_blue2<>0){$data2=$data2."['CHEGADA NO LOCAL',".$tot_blue2."],";$slices2=$slices2.$ix.":{color:'blue'},";$ix++;}
if ($tot_gold2<>0){$data2=$data2."['EM ROTA DE COLETA',".$tot_gold2."],";$slices2=$slices2.$ix.":{color:'Gold'},";$ix++;}
if ($tot_gray2<>0){$data2=$data2."['PENDENTE',".$tot_gray2."],";$slices2=$slices2.$ix.":{color:'Grey'},";$ix++;}
$data2=$data2.']';
$slices2=$slices2.'}';
?>
<!DOCTYPE html>
<html lang='pt-br'>
  <head>
    <meta charset="utf-8"/>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
    <title>Situação Atual</title>
    <link rel="icon" type="image/png" href="images/favicon.ico">
    <link href="css/estilo.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="css/redmond/jquery-ui-1.10.1.custom.css" />
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="css/theme.css" rel="stylesheet">
    <link href="css/signin.css" rel="stylesheet">
    <script src='js/jquery-3.3.1.min.js'></script>
    <script src='js/jquery-ui.js' type='text/javascript'></script>
    <script src="js/ui.datepicker-pt-BR.js"></script>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <!--Load the AJAX API-->
    <script type="text/javascript">
        function selectAuto() {
          var serializeDados = $('#form_um').serialize();
          var topping = 'Tudo';
          $.ajax({
              url: "API06.php?Topico="+topping,
              dataType: "html",
              type: 'POST',
              data: serializeDados,
              success: function(data, textStatus) {
              $('#aqui2').html(data);  
              },
          });
        }
    
      // Load the Visualization API and the piechart package.
      google.charts.load('current', {'packages':['corechart']});
        
      // Set a callback to run when the Google Visualization API is loaded.
        
      google.charts.setOnLoadCallback(drawChart2);

      function drawChart2() {
        var serializeDados = $('#form_um').serialize();
              
          // Create our data table out of JSON data loaded from server.
        var data = new google.visualization.arrayToDataTable(<?php  echo $data2; ?>);
        var options = { titleTextStyle: { fontName: 'Arial',
                                          fontSize: 18,
                                          bold: true,
                                          italic: true,
                                          // The color of the text.
                                          color: '#871b47',
                                          // The color of the text outline.
                                          auraColor: '#d799ae',
                                          // The transparency of the text.
                                          opacity: 0.8
                                        },
                        title:'SITUAÇÃO DAS COLETAS',
                        backgroundColor:'#E6E6E6',
                        width:515,
                        height:350,
                        is3D: true,
                        tooltip:{trigger:'both'},
                        <?php  echo $slices2; ?>
                      };

        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.PieChart(document.getElementById('chart_coleta'));

        function selectHandler() {
          var selectedItem = chart.getSelection()[0];
          if (selectedItem) {
            var topping = data.getValue(selectedItem.row, 0);
            $.ajax({
                url: "API06.php?Topico="+topping,
                dataType: "html",
                type: 'POST',
                data: serializeDados,
                success: function(data, textStatus) {
                $('#aqui2').html(data);  
                },
            });
            }
        }

        google.visualization.events.addListener(chart, 'select', selectHandler);    
        chart.draw(data, options);
      }
    </script>
  </head>
<body role="document" onLoad="selectAuto();">
  <div class="container">   
    <form action="" method="post" id="form_um">    
      <input type='hidden' name='result' value='<?php echo htmlentities($json, ENT_QUOTES, 'UTF-8');?>' />
      <input type='hidden' name='coleta' id='coleta' value='<?php echo htmlentities($coleta, ENT_QUOTES, 'UTF-8');?>' />
      <input id='inicio' name='inicio' type='hidden' value="<?php echo $inicio; ?>" /> 
    </form>
    <div class="container">   
      <table width="100%"> 
        <tr> 
          <td width="30%" align="center">
            <img src="images/logo03.png" width="300" height="88"/>
          </td> 
          <td width="40%" align="center">
            <div class="page-header">
              <h2><span class="label label-primary">&nbsp;&nbsp;TORRE DE CONTROLE&nbsp;&nbsp;</span></h2>
            </div>
          </td>
          <td width="30%" align="center">
            <img src="<?php echo 'images/'.$logo; ?>" width="300" height="88"/>
          </td> 
        </tr> 
        <tr height="30"  background="images/top-menubg.gif" > 
          <td>&nbsp;&nbsp;<?php echo $dateadded; ?></td>
          <td align='center'><strong><?php echo 'Base de Dados a partir de: '.$inicio; ?></strong></td>
          <td align='right'>Usuário:&nbsp;<?php echo utf8_encode($_SESSION['usuarioNome']); ?>&nbsp;&nbsp;</td> 
        </tr> 
      </table>
      <table width="100%">
        <tr>
          <td align="center" width="80%">
            <div id="chart_coleta"></div>
          </td>
          <td align="left" width="20%">
            <form method="post" action="main.php" >
              <input type="submit" class="button2" value="Sair"/>
            </form>
            <form method="post" action="" >
              <input type="submit" class="button2" value="Tudo"/>
            </form>
          </td> 
        </tr>
        <tr>
          <td width="80%">
            <div align="center" style="color: red;"><?php echo $div2; ?></div>
          </td>
          <td width="20%">
            <br>
          </td>
        </tr>
        <tr><td colspan='2'><br /></td></tr>
        <tr>
          <td colspan='2'>
            <div id="aqui2"></div>
          </td>
        </tr>
     </table>
    </div>
  </div>
</body>
<p class="copyright" align="center">&copy; Copyright 2020 TransWar - Todos os direitos reservados. Versão 1.0</p> 
</html>