<?php 
    /*-------------------------
    Autor: Amner Saucedo Sosa
    Web: www.abisoftgt.net
    E-Mail: waptoing7@gmail.com
    ---------------------------*/
    $active14="active";
    include "header.php";
    include "sidebar.php";
    $id=$_SESSION['admin_id'];
    $registrados1=mysqli_query($con, "select * from tickets where asigned_id=$id");
    $prioridad=mysqli_query($con, "select * from area where priority_id=$id");

    $registrados=mysqli_query($con, "select * from tickets where status_id=1");
    $asignados=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0");
    $cancelados=mysqli_query($con, "select * from tickets where status_id=3");
    $atendidos=mysqli_query($con, "select * from tickets where status_id=4");



    $sesion_id=$_SESSION['admin_id'];
//AQUÍ HACEMOS LA CONSULTA EN LA BASE DE DATOS DE LOS TICKETS ASIGNADOS, PAUSADOS Y ATENDIDOS DE CADA AGENTE UTILIZANDO SU ID DE LA BASE DE DATOS.
//IDS POR NOMBRE:
// ID 11 - ROMARIO HERNANDEZ
// ID 12 - MARIO MAZCORRO
// ID 13 - HOMERO RÍOS
// ID 14 - NERI MORENO
// 1D 15 - 
// ID 16 - 
// ID 17 - JUAN PEDRAZA
// ID 18 - ANDREA MONTALVO
// ID 19 - 
// ID 20 - ERICKA OLVERA
// ID 21 - ROBERTO NAVARRETE
// ID 22 - EDUARDO GARCÍA
// ID 24 - PAMELA CARRILLO
    $asignados_11=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=11");
    $cancelados_11=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=11");
    $atendidos_11=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=11");

    $asignados_12=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=12");
    $cancelados_12=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=12");
    $atendidos_12=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=12");

    $asignados_13=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=13");
    $cancelados_13=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=13");
    $atendidos_13=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=13");

    $asignados_14=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=14");
    $cancelados_14=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=14");
    $atendidos_14=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=14");

    $asignados_17=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=17");
    $cancelados_17=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=17");
    $atendidos_17=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=17");

    $asignados_18=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=18");
    $cancelados_18=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=18");
    $atendidos_18=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=18");

    $asignados_20=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=20");
    $cancelados_20=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=20");
    $atendidos_20=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=20");

    $asignados_21=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=21");
    $cancelados_21=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=21");
    $atendidos_21=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=21");

    $asignados_22=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=22");
    $cancelados_22=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=22");
    $atendidos_22=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=22");

    $asignados_23=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=23");
    $cancelados_23=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=23");
    $atendidos_23=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=23");

    $asignados_24=mysqli_query($con, "select * from tickets where status_id=2 && asigned_id!=0 && asigned_id=24");
    $cancelados_24=mysqli_query($con, "select * from tickets where status_id=3 && asigned_id=24");
    $atendidos_24=mysqli_query($con, "select * from tickets where status_id=4 && asigned_id=24");


    $agente11=mysqli_query($con, "select * from user where id=11");
    $r=mysqli_fetch_array($agente11);
    $kiname11=$r['name'];
    $kilastname11=$r['lastname'];

    $agente12=mysqli_query($con, "select * from user where id=12");
    $r=mysqli_fetch_array($agente12);
    $kiname12=$r['name'];
    $kilastname12=$r['lastname'];

    $agente13=mysqli_query($con, "select * from user where id=13");
    $r=mysqli_fetch_array($agente13);
    $kiname13=$r['name'];
    $kilastname13=$r['lastname'];

    $agente14=mysqli_query($con, "select * from user where id=14");
    $r=mysqli_fetch_array($agente14);
    $kiname14=$r['name'];
    $kilastname14=$r['lastname'];

    $agente17=mysqli_query($con, "select * from user where id=17");
    $r=mysqli_fetch_array($agente17);
    $kiname17=$r['name'];
    $kilastname17=$r['lastname'];

    $agente18=mysqli_query($con, "select * from user where id=18");
    $r=mysqli_fetch_array($agente18);
    $kiname18=$r['name'];
    $kilastname18=$r['lastname'];

    $agente20=mysqli_query($con, "select * from user where id=20");
    $r=mysqli_fetch_array($agente20);
    $kiname20=$r['name'];
    $kilastname20=$r['lastname'];

    $agente21=mysqli_query($con, "select * from user where id=21");
    $r=mysqli_fetch_array($agente21);
    $kiname21=$r['name'];
    $kilastname21=$r['lastname'];

    $agente22=mysqli_query($con, "select * from user where id=22");
    $r=mysqli_fetch_array($agente22);
    $kiname22=$r['name'];
    $kilastname22=$r['lastname'];

    $agente23=mysqli_query($con, "select * from user where id=23");
    $r=mysqli_fetch_array($agente23);
    $kiname23=$r['name'];
    $kilastname23=$r['lastname'];

    $agente24=mysqli_query($con, "select * from user where id=24");
    $r=mysqli_fetch_array($agente24);
    $kiname24=$r['name'];
    $kilastname24=$r['lastname'];


?>
        

<!-- Total-->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->

    <!-- Main content -->
    <section class="content-header">
        
      <!-- Info boxes -->
            <h1>Global</h1>
      <div class="row">
        <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
          <a href="mistickets.php">
            <span class="info-box-icon bg-blue"><i class="fa fa-glass"></i></span>

            </a>
            <div class="info-box-content">
              <span class="info-box-text">Registrados</span>
              <span class="info-box-number"><?php echo mysqli_num_rows($registrados) ?></span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->



        <!-- fix for small devices only -->
        <div class="clearfix visible-sm-block"></div>

        <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
          <a href="mistickets.php">
            <span class="info-box-icon bg-yellow"><i class="fa fa-rocket"></i></span>
        </a>
            <div class="info-box-content">
              <span class="info-box-text">Asignados</span>
              <span class="info-box-number"><?php echo mysqli_num_rows($asignados) ?></span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
        <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
          <a href="mistickets.php">
            <span class="info-box-icon bg-red"><i class="fa fa-ban"></i></span>
            </a>
            <div class="info-box-content">
              <span class="info-box-text">Pausados</span>
              <span class="info-box-number"><?php echo mysqli_num_rows($cancelados) ?></span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
                <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
          <a href="mistickets.php">
            <span class="info-box-icon bg-green"><i class="fa fa-flask"></i></span>
        </a>
            <div class="info-box-content">
              <span class="info-box-text">Solucionados</span>
              <span class="info-box-number"><?php echo mysqli_num_rows($atendidos) ?></span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
        
                        
                        
        <table class="table table-bordered table-striped table-hover">
        <tr style="color: #FFF; background-color: #34495e">
            <th style="width:21%; text-align: center; font-size:25px">AGENTE</th>
            <th style="width:21%; text-align: center; font-size:25px">ASIGNADOS</th>
            <th style="width:21%; text-align: center; font-size:25px">PAUSADOS</th>
            <th style="width:21%; text-align: center; font-size:25px">SOLUCIONADOS</th>
        </tr>

        <tr>
            <!--AGENTE ID 11-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname11. " ". $kilastname11; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_11) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_11) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_11) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 12-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname12. " ". $kilastname12; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_12) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_12) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_12) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 13-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname13. " ". $kilastname13; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_13) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_13) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_13) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 14-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname14. " ". $kilastname14; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_14) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_14) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_14) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 17-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname17. " ". $kilastname17; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_17) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_17) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_17) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 18-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname18. " ". $kilastname18; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_18) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_18) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_18) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 20-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname20. " ". $kilastname20; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_20) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_20) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_20) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 21-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname21. " ". $kilastname21; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_21) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_21) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_21) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 22-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname22. " ". $kilastname22; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_22) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_22) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_22) ?></td>
        </tr>
        <tr>
            <!--AGENTE ID 24-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo " ". $kiname24. " ". $kilastname24; ?></td>
            <!--ASIGNADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($asignados_24) ?></td>
            <!--PAUSADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($cancelados_24) ?></td>
            <!--SOLUCIONADOS-->
            <td style="text-align: center; vertical-align: middle; font-size:15px"><?php echo mysqli_num_rows($atendidos_24) ?></td>
        </tr>
        </table>
        
    </section>


</div>
<script language="javascript">
setInterval(function(){
   window.location.reload(1);
}, 60000);
</script>

  