<?php
if (!isset($_SESSION['nombre'])) {
  header("Location: login");
}else{
  if ($_SESSION['escritorio']==1) {
    require_once "./modelos/Escritorio.php";
    
    $consulta = new Escritorio();
    $rsptac   = $consulta->totalcomprayear();
    $regc     =$rsptac->fetch_object();
    $totalc   =$regc->total_compra;

    $rsptav   = $consulta->totalventayear();
    $regv     =$rsptav->fetch_object();
    $totalv   =$regv->total_venta;

    $rsptacp   = $consulta->totalcuentasporpagar();
    $regcp     =$rsptacp->fetch_object();
    $totalcp   =$regcp->cuentasporpagar;

    $rsptacc   = $consulta->totalcuentasporcobrar();
    $regcc     =$rsptacc->fetch_object();
    $totalcc   =$regcc->cuentasporcobrar;

    $rsptaiu   = $consulta->totalinventariounidades();
    $regiu     =$rsptaiu->fetch_object();
    $totaliu   =number_format($regiu->total_cajas, 0, '.', '');
    //$totaliu   =$regiu->total_cajas;

    $rsptaim   = $consulta->totalinventariomonto();
    $regim     =$rsptaim->fetch_object();
    $totalim   =number_format($regim->total_inventario, 2, '.', '');
    //obtener valores para cargar al grafico de barras
    $compras10 = $consulta->comprasultimos_10dias();
    $fechasc='';
    $totalesc='';
    while ($regfechac=$compras10->fetch_object()) {
      $fechasc=$fechasc.'"'.$regfechac->fecha.'",';
      $totalesc=$totalesc.$regfechac->total.',';
    }
    //quitamos la ultima coma
    $fechasc=substr($fechasc, 0, -1);
    $totalesc=substr($totalesc, 0,-1);
    //obtener valores para cargar al grafico de barras
    $ventas12 = $consulta->ventasultimos_12meses ();
    $fechasv='';
    $totalesv='';
    while ($regfechav=$ventas12->fetch_object()) {
      $fechasv=$fechasv.'"'.$regfechav->fecha.'",';
      $totalesv=$totalesv.$regfechav->total.',';
    }
    //quitamos la ultima coma
    $fechasv=substr($fechasv, 0, -1);
    $totalesv=substr($totalesv, 0,-1);

    //buscamos los producto de mes anterior y en curso
    $compras10 = $consulta->comprasultimos_10dias();
    $fechasc='';
    $totalesc='';
    while ($regfechac=$compras10->fetch_object()) {
      $fechasc=$fechasc.'"'.$regfechac->fecha.'",';
      $totalesc=$totalesc.$regfechac->total.',';
    }

    ?>
    <!-- Main content -->
    <section class="content">

                    <!-- Default box -->
                    <div class="row">
                      <div class="col-md-12">
                    <div class="box">
              <div class="box-header with-border">
                <h1 align='center'><?php echo $_SESSION['nombre_empresa'] ?></h1>
                <h2 align='center'> Información Relevante del Negocio <small></small> </h2>
                <!-- <div id="al"></div>
                <div id="texto"></div> -->
               <p><br></p>
              </div>
              <!--box-header-->
              <!--centro-->
              <!-- VENTA Y INGRESOS -->
              <div class="panel-body">
                <div class="box box-primary">
                  <div class="box-header with-border">		
                    <h3 align='center' ></h3>
                  </div>
                  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                  </div>
                  <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class="info-box bg-yellow">
                      <span class="info-box-icon" style="height: 105px;padding-top:10px;"><i class="fa fa-shopping-cart"></i></span>

                      <div class="info-box-content">
                        <span class="info-box-text" style="text-align:center">TOTAL COMPRAS DEL AÑO</span>
                        <span class="info-box-number" style="text-align:center;font-size: 30px"><sup style="font-size: 15px">US$ </sup><?php echo number_format($totalc,2,',','.'); ?></span>

                        <div class="progress">
                          <div class="progress-bar" style="width: 100%"></div>
                        </div>
                            <span class="progress-description" style="text-align:center">
                            <a href="ingreso" style="color:#F4F6F6">Compras <i class="fa fa-arrow-circle-right"></i></a>
                             <!-- <a href="ingreso">Compras <i class="fa fa-arrow-circle-right"></i></a>    -->
                            </span>
                      </div>
                      <!-- /.info-box-content -->
                    </div>
                    <!-- /.info-box -->
                  </div>
                  <!-- /.col -->

                  <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class="info-box bg-green">
                      <span class="info-box-icon" style="height: 105px;padding-top:10px;" valign="middle"><i class="fa fa-line-chart"></i></span>

                      <div class="info-box-content">
                        <span class="info-box-text" style="text-align:center">TOTAL VENTAS DEL AÑO</span>
                        <span class="info-box-number" style="text-align:center;font-size: 30px"><sup style="font-size: 15px">US$ </sup><?php echo number_format($totalv,2,',','.'); ?></span>

                        <div class="progress">
                          <div class="progress-bar" style="width: 100%"></div>
                        </div>
                            <span class="progress-description" style="text-align:center">
                            <a href="ventan" style="color:#F4F6F6">Ventas <i class="fa fa-arrow-circle-right"></i></a>
                             <!-- <a href="ingreso">Compras <i class="fa fa-arrow-circle-right"></i></a>    -->
                            </span>
                      </div>
                      <!-- /.info-box-content -->
                    </div>
                    <!-- /.info-box -->
                  </div>
                  <!-- /.col -->

                
                  <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                    <div class="box box-primary">
                      <div class="box-header with-border">
                      <!--  Compras de los últimos 10 dias -->
                      
                      </div>
                      <div class="box-body">
                        <canvas id="compras" width="400" height="300"></canvas>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                    <div class="box box-primary">
                      <div class="box-header with-border">
                        <!-- Ventas de los últimos 12 meses -->
                      </div>
                      <div class="box-body">
                        <canvas id="ventas" width="400" height="300"></canvas>
                      </div>
                    </div>
                  </div>
                </div>  
              </div>

             <!-- <div class="panel-body">
                
              </div>
               FIN VENTA Y INGRESOS -->

              <!-- VENTA Y INGRESOS -->
              <div class="panel-body">
                <div class="box box-success">
                  <div class="box-header with-border">		
                    <h3 align='center' ></h3>
                  </div>
               

                  <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class="info-box bg-red">
                      <span class="info-box-icon" style="height: 105px;padding-top:10px;" valign="middle"><i class="fa fa-money"></i></span>

                      <div class="info-box-content">
                        <span class="info-box-text" style="text-align:center">TOTAL CUENTAS X PAGAR</span>
                        <span class="info-box-number" style="text-align:center;font-size: 30px"><sup style="font-size: 15px">US$ </sup><?php echo number_format( $totalcp,2,',','.'); ?></span>

                        <div class="progress">
                          <div class="progress-bar" style="width: 100%"></div>
                        </div>
                            <span class="progress-description" style="text-align:center">
                            <a href="estadocuentaproveedor" style="color:#F4F6F6">Estado de Cuentas <i class="fa fa-arrow-circle-right"></i></a>
                             <!-- <a href="ingreso">Compras <i class="fa fa-arrow-circle-right"></i></a>    -->
                            </span>
                      </div>
                      <!-- /.info-box-content -->
                    </div>
                    <!-- /.info-box -->
                  </div>
                  <!-- /.col -->


                  <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class="info-box bg-blue">
                      <span class="info-box-icon" style="height: 105px;padding-top:10px;" valign="middle"><i class="fa fa-bank"></i></span>

                      <div class="info-box-content">
                        <span class="info-box-text" style="text-align:center">TOTAL CUENTAS POR COBRAR</span>
                        <span class="info-box-number" style="text-align:center;font-size: 30px"><sup style="font-size: 15px">US$ </sup><?php echo number_format( $totalcc,2,',','.'); ?></span>

                        <div class="progress">
                          <div class="progress-bar" style="width: 100%"></div>
                        </div>
                            <span class="progress-description" style="text-align:center">
                            <a href="estadocuentacliente" style="color:#F4F6F6">Estado de Cuentas <i class="fa fa-arrow-circle-right"></i></a>
                             <!-- <a href="ingreso">Compras <i class="fa fa-arrow-circle-right"></i></a>    -->
                            </span>
                      </div>
                      <!-- /.info-box-content -->
                    </div>
                    <!-- /.info-box -->
                  </div>
                  <!-- /.col -->


                  <div class="col-lg-6 col-xs-6">
                    <div class="box box-success">
                      <div class="box-header with-border">		
                        <h3 align='center' >Pagos Pendientes a Proveedores  (últimos 10 más antiguos)  </h3>
                      </div>
                      <!-- /.box-header -->
                      <div class="box-body">
                        <table id="example1" class="table table-bordered table-striped">
                          <thead>
                          <tr style="color:#F4F6F6;text-align:center;background-color:#2f7688">
                            <td style="text-align:center">FECHA</td>
                            <td style="text-align:center">PROVEEDOR</td>
                            <td style="text-align:center">MONTO (US$)</td>
                            
                          </tr>
                          </thead>
                          <tbody>
                          <?php
                          //Calculamos totales
                          
                          $totalesc         =0;
                          $filas            =[];
                          $columnas         =[];
                          $rsptacaja10      = $consulta->cuentasporpagarmasvieja();  
                        
                          while ($regvcaja10=$rsptacaja10->fetch_object()) { 
                            $columnas[0]= $regvcaja10->fechamasantigua;
                            $columnas[1]= $regvcaja10->nombre;
                            $columnas[2]= number_format($regvcaja10->saldo,2,',','.');
                            $filas[]    = $columnas;  
                            $totalesc   = $totalesc +$regvcaja10->saldo;
                          }
                          $columnas[0]= 'TOTAL';
                          $columnas[1]= ''; 
                          $columnas[2]= number_format($totalesc,0,',','.');
                          $filas[]    = $columnas; 

                          $arrLength = count($filas); 
                          $colum     = $filas[$arrLength-1];
                          ?> 
                          <tr>
                           
                            <td style="color:#404040;text-align:center;background-color:#e5b760"  colspan="2"><?php echo $colum[0]; ?></td>
                            <td style="color:#404040;text-align:right;background-color:#e5b760"><?php echo number_format($totalesc,2,',','.'); ?></td>
                              
                           
                            
                          </tr>
                          <?php
                          for($i = 0; $i < $arrLength-1; $i++) {
                            $colum     = $filas[$i];
                          ?> 
                            <tr>
                            <td style="text-align:center;" valign="middle"><?php echo $colum[0]; ?></td>
                            <td style="text-align:left;" valign="middle"><?php echo $colum[1]; ?></td>
                            <td style="text-align:right;" valign="middle" ><?php echo $colum[2]; ?></td> 
                          
                            </tr> 
                          <?php
                            } 
                          ?> 
                          </tbody>






                          
                        </table>
                      </div>
                      <!-- /.box-body -->
                    </div>  
                  </div>            
                  <div class="col-lg-6 col-xs-6">
                    <div class="box box-success">
                      <div class="box-header with-border">		
                        <h3 align='center'>Clientes con Deudas Pendientes (últimas 10 más antiguas)</h3>
                      </div>
                      <!-- /.box-header -->
                      <div class="box-body">
                        <table id="example1" class="table table-bordered table-striped">
                          <thead>
                          <tr style="color:#F4F6F6;text-align:center;background-color:#2f7688">
                            <td style="text-align:center">FECHA</td>
                            <td style="text-align:center">CLIENTE</td>
                            <td style="text-align:center">MONTO (US$)</td>
                            
                          </tr>
                          </thead>
                          <tbody>
                          <?php
                          //Calculamos totales
                          
                          $totalesc         =0;
                          $filas            =[];
                          $columnas         =[];
                          $rsptacaja10      = $consulta->cuentasporcobrarmasvieja();  
                        
                          while ($regvcaja10=$rsptacaja10->fetch_object()) { 
                            $columnas[0]= $regvcaja10->fecha;
                            $columnas[1]= $regvcaja10->nombre;
                            $columnas[2]=number_format($regvcaja10->saldod,2,',','.');
                            $filas[]  = $columnas;  
                            $totalesc = $totalesc +$regvcaja10->saldod;
                          }
                          $columnas[0]= 'TOTAL';
                          $columnas[1]= ''; 
                          $columnas[2]= number_format($totalesc,0,',','.');
                          $filas[]    = $columnas; 

                          $arrLength = count($filas); 
                          $colum     = $filas[$arrLength-1];
                          ?> 
                          <tr>
                           
                            <td style="color:#404040;text-align:center;background-color:#e5b760" colspan="2"><?php echo $colum[0]; ?></td>
                            <td style="color:#404040;text-align:right;background-color:#e5b760"><?php echo number_format($totalesc,2,',','.'); ?></td>
                            
                          </tr>
                          <?php
                          for($i = 0; $i < $arrLength-1; $i++) {
                            $colum     = $filas[$i];
                          ?> 
                            <tr>
                            <td style="text-align:center;" valign="middle"><?php echo $colum[0]; ?></td>
                            <td style="text-align:left;" valign="middle"><?php echo $colum[1]; ?></td>
                            <td style="text-align:right;" valign="middle" ><?php echo $colum[2]; ?></td> 
                          
                            </tr> 
                          <?php
                            } 
                          ?> 
                          </tbody>
                         
                        </table>
                      </div>
                      <!-- /.box-body -->
                    </div>
                  </div>
                </div>  
              </div>

               <!-- Movimientos de cuentas por cobrar y cuentas por pagar-->
              
              <!-- /.box -->

              <div class="panel-body">
                <div class="box box-info">
                  <div class="box-header with-border">		
                    <h3 align='center' ></h3>
                  </div>

               

                  <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class="info-box bg-aqua">
                      <span class="info-box-icon" style="height: 90px;padding-top:5px;" valign="middle"><i class="fa fa-barcode"></i></span>

                      <div class="info-box-content">
                        <span class="info-box-text" style="text-align:center">INVENTARIO TOTAL DE CAJAS</span>
                        <span class="info-box-number" style="text-align:center;font-size: 30px"><sup style="font-size: 15px">CAJAS </sup><?php echo number_format( $totaliu,0,',','.'); ?></span>

                      <!--  <div class="progress">
                          <div class="progress-bar" style="width: 100%"></div>
                        </div>
                            <span class="progress-description" style="text-align:center">
                            <a href="estadocuentaproveedor" style="color:#F4F6F6">Estado de Cuentas <i class="fa fa-arrow-circle-right"></i></a>
                              <a href="ingreso">Compras <i class="fa fa-arrow-circle-right"></i></a>    
                            </span>-->
                      </div>
                      <!-- /.info-box-content -->
                    </div>
                    <!-- /.info-box -->
                  </div>
                  <!-- /.col -->


                  <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class="info-box bg-blue">
                      <span class="info-box-icon" style="height: 90px;padding-top:5px;" valign="middle"><i class="fa fa-calculator"></i></span>

                      <div class="info-box-content">
                        <span class="info-box-text" style="text-align:center">INVENTARIO TOTAL EN $</span>
                        <span class="info-box-number" style="text-align:center;font-size: 30px"><sup style="font-size: 15px">US$ </sup><?php echo number_format( $totalim,2,',','.'); ?></span>

                     <!--   <div class="progress">
                          <div class="progress-bar" style="width: 100%"></div>
                        </div>
                            <span class="progress-description" style="text-align:center">
                            <a href="estadocuentacliente" style="color:#F4F6F6">Estado de Cuentas <i class="fa fa-arrow-circle-right"></i></a>
                              <a href="ingreso">Compras <i class="fa fa-arrow-circle-right"></i></a>   
                            </span> -->
                      </div>
                      <!-- /.info-box-content -->
                    </div>
                    <!-- /.info-box -->
                  </div>
                  <!-- /.col -->
                  
                  <div class="col-lg-12 col-xs-12">
                    <div class="box box-info">
                      <div class="box-header with-border" align='center'>		
                        <h3 >INVENTARIO POR PRODUCTOS</h3>
                      </div>
                      <!-- /.box-header -->
                      <div class="box-body">
                        <table id="example1" class="table table-bordered table-striped">
                          <thead>
                          <?php  
                          $na1 ='';
                          $na2 ='';
                          $na3 ='';
                          $na4 ='';
                          $na5 ='';
                          $rsptaalmacenesn  = $consulta->almacenes();
                          $nro =1;  
                          while ($regalmn=$rsptaalmacenesn->fetch_object()) {
                            if ($nro==1){
                              $na1 = $regalmn->nombre;
                            }
                            if ($nro==2){
                              $na2 = $regalmn->nombre;
                            }
                            if ($nro==3){
                              $na3 = $regalmn->nombre;
                            }
                            if ($nro==4){
                              $na4 = $regalmn->nombre;
                            }
                            if ($nro==5){
                              $na5 = $regalmn->nombre;
                            }
                            $nro = $nro + 1;
                          } 
                          $na1 = 'PRECIO X UNIDAD';
                          $na2 = 'TOTAL UNIDADES';
                          $na3 = 'MONTO (US$)';

                          //Calculamos totales
                          $total1           =0;
                          $total2           =0;
                          $filas            =[];
                          $columnas         =[];
                          $rsptaalmacenesp  = $consulta->stockporalmacen(); 
                         
                          while ($regalmp=$rsptaalmacenesp->fetch_object()) { 
                            $columnas[0]= $regalmp->nombre;
                            $columnas[1]= number_format($regalmp->preciod,2,',','.'); 
                            $columnas[2]= number_format($regalmp->almacen1,0,',','.');
                            $columnas[3]= number_format($regalmp->almacen1p,2,',','.'); 
                            $filas[]  = $columnas;  
                            $total1 =$total1 +$regalmp->almacen1;
                            $total2 =$total2 +$regalmp->almacen1p;
                          }
                          $columnas[0]= 'TOTALES';
                          $columnas[1]= '--'; 
                          $columnas[2]= number_format($total1,0,',','.');
                          $columnas[3]= number_format($total2,2,',','.'); 
                          $filas[]  = $columnas;  

                          ?>
                          <tr  style="color:#F4F6F6;text-align:center;background-color:#2f7688">
                            <td style="text-align:center">PRODUCTOS</td>
                            <td style="text-align:center"><?php echo $na1; ?></td>
                            <td style="text-align:center"><?php echo $na2; ?></td>
                            <td style="text-align:center"><?php echo $na3; ?></td>
                            </thead>
                          <tbody>
                          <?php  
                          $arrLength = count($filas); 
                          $colum     = $filas[$arrLength-1];
                          ?> 
                          <tr>
                            <td style="color:#404040;text-align:center;background-color:#e5b760"><?php echo $colum[0]; ?></td>
                            <td style="color:#404040;text-align:center;background-color:#e5b760"><?php echo $colum[1]; ?></td>
                            <td style="color:#404040;text-align:center;background-color:#e5b760"><?php echo $colum[2]; ?></td>
                            <td style="color:#404040;text-align:right;background-color:#e5b760"><?php echo $colum[3]; ?></td>
                          </tr>
                          <?php
                          for($i = 0; $i < $arrLength-1; $i++) {
                            $colum     = $filas[$i];
                          ?> 
                            <tr>
                              <td style="text-align:left;" valign="middle"><?php echo $colum[0]; ?></td>
                              <td style="text-align:center;" valign="middle"><?php echo $colum[1]; ?></td> 
                              <td style="text-align:center;" valign="middle"><?php echo $colum[2]; ?></td>
                              <td style="text-align:right;" valign="middle"><?php echo $colum[3]; ?></td> 
                             
                            </tr> 
                          <?php
                          } 
                          ?> 
                          </tbody>
                          
                        </table>
                      </div>
                      <!-- /.box-body -->
                    </div>
                  </div>


                </div>              
              </div>
              <!--fin centro-->
                <!--<Inventario por Almacen-->     
        
        <!-- /.box -->         
          </div>
          </div>
          </div>
          <!-- /.box -->

    </section>
    <!-- /.content -->
  </div>
  <?php 
  }else{
  require 'vistas/contenidos/noacceso-view.php'; 
  }
  ?>
      </div>
        <!-- /.content-wrapper -->
        <!-- Main Footer -->
        <?php include "vistas/modulos/mainfooter.php";?>
    </div>
    <!-- ./wrapper -->
    <!-- REQUIRED JS SCRIPTS -->
    <?php include "vistas/modulos/script.php";?>
    
</body>
</html>
  <script>
 /* */     
      let delayed;
      let labeles = [<?php echo $fechasc ?>];
      let data = {
          labels :labeles,
          datasets: [{
              label: '# Compras en $ de los últimos 10 dias',
              data: [<?php echo $totalesc ?>],
              backgroundColor: 'rgb(253, 111, 39)',
          }]

      };

      let config = {
          type: 'bar',
          data: data,
          options: {
            animation:{
              onComplete: () =>{
                delayed:true;
              },
              delay: (context) => {
                let delay = 0;
                console.log(context);
                if(context.type==='data' && context.mode ==='default'){ 
                  delay= context.dataIndex * 300 + context.datasetIndex * 100;
                }
                return delay;
              },
              backgroundColor: {
                type: 'color',
                duration: 5000,
                easing: 'linear',
                from: 'rgb(253, 111, 39)',
                to: 'rgb(253, 187, 154)',
                loop: true
              }
            },
            scales: {
                x: {
                    stacked: true,
                },
                y: {
                    stacked: true
                }
            }
          }
      };

    
    const myChart = new Chart(
      document.getElementById('compras'),
      config
    ); 


    /** Grafico dos */
    let delayed1;
    let labeles1 = [<?php echo $fechasv ?>];
    let data1 = {
          labels :labeles1,
          datasets: [{
            label: '# Ventas en $ de los últimos 12 meses',
            data: [<?php echo $totalesv ?>],
            backgroundColor: 'rgb(21, 171, 31)',
          }]

    };
    let config1 = {
          type: 'bar',
          data: data1,
          options: {
            animation:{
              onComplete: () =>{
                delayed1:true;
              },
              delay: (context) => {
                let delay1 = 0;
                //console.log(context);
                if(context.type==='data' && context.mode ==='default'){ 
                  delay1= context.dataIndex * 300 + context.datasetIndex * 100;
                }
                return delay1;
              },
              backgroundColor: {
                type: 'color',
                duration: 5000,
                easing: 'linear',
                from: 'rgb(21, 171, 31)',
                to: 'rgb(22, 96, 197)',
                loop: true
              }
            },
            scales: {
                x: {
                    stacked: true,
                },
                y: {
                    stacked: true
                }
            }
          }
    };

    // render init block
    const myChart1 = new Chart(
      document.getElementById('ventas'),
      config1
    );



      /* const graph = document.querySelector("#compras");
      new Chart(graph, config); */


    /*  var ctx = document.getElementById("compras").getContext('2d');
      var compras = new Chart(ctx, {
          type: 'bar',
          data: {
              labels: [<?php echo $fechasc ?>],
              datasets: [{
                  label: '# Compras en $ de los últimos 10 dias',
                  data: [<?php echo $totalesc ?>],
                   backgroundColor: [
                      'rgba(255, 99, 132, 0.2)',
                      'rgba(54, 162, 235, 0.2)',
                      'rgba(255, 206, 86, 0.2)',
                      'rgba(75, 192, 192, 0.2)',
                      'rgba(153, 102, 255, 0.2)',
                      'rgba(255, 159, 64, 0.2)',
                      'rgba(255, 99, 132, 0.2)',
                      'rgba(54, 162, 235, 0.2)',
                      'rgba(255, 206, 86, 0.2)',
                      'rgba(75, 192, 192, 0.2)'
                  ],
                  borderColor: [
                      'rgba(255,99,132,1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(255, 206, 86, 1)',
                      'rgba(75, 192, 192, 1)',
                      'rgba(153, 102, 255, 1)',
                      'rgba(255, 159, 64, 1)',
                      'rgba(255,99,132,1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(255, 206, 86, 1)',
                      'rgba(75, 192, 192, 1)'
                  ], 
                  backgroundColor: [
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                  ],
                  borderColor: [
                      'rgba(255,99,132,1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(255, 206, 86, 1)',
                      'rgba(75, 192, 192, 1)',
                      'rgba(153, 102, 255, 1)',
                      'rgba(255, 159, 64, 1)',
                      'rgba(255,99,132,1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(255, 206, 86, 1)',
                      'rgba(75, 192, 192, 1)'
                  ],
                  borderWidth: 1
                  borderColor: 'rgba(248, 37, 37, 0.8)',
                  backgroundColor: 'rgba(255,0,0,0.29)',
                  order:1,
                  animations: {
                      borderWidth: {
                          duration: 1000,
                          easing: 'linear',
                          from: 10,
                          to: 1,
                          loop: true
                      }
                  }
                    }]
          },
          options: {
              scales: {
                  yAxes: [{
                      ticks: {
                          beginAtZero:true
                      }
                  }]
              }
          }
      });*/
    /*  var ctx = document.getElementById("ventas").getContext('2d');
      var ventas = new Chart(ctx, {
          type: 'bar',
          data: {
              labels: [<?php echo $fechasv ?>],
              datasets: [{
                  label: '# Ventas en $ de los últimos 12 meses',
                  data: [<?php echo $totalesv ?>],
                   backgroundColor: [
                      'rgba(255, 99, 132, 0.2)',
                      'rgba(54, 162, 235, 0.2)',
                      'rgba(255, 206, 86, 0.2)',
                      'rgba(75, 192, 192, 0.2)',
                      'rgba(153, 102, 255, 0.2)',
                      'rgba(255, 159, 64, 0.2)',
                      'rgba(255, 99, 132, 0.2)',
                      'rgba(54, 162, 235, 0.2)',
                      'rgba(255, 206, 86, 0.2)',
                      'rgba(75, 192, 192, 0.2)',
                      'rgba(153, 102, 255, 0.2)',
                      'rgba(255, 159, 64, 0.2)'
                  ], 
                  backgroundColor: [
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                      'rgb(75, 192, 192)',
                      'rgb(54, 162, 235)',
                  ],
                  borderColor: [
                      'rgba(255,99,132,1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(255, 206, 86, 1)',
                      'rgba(75, 192, 192, 1)',
                      'rgba(153, 102, 255, 1)',
                      'rgba(255, 159, 64, 1)',
                      'rgba(255,99,132,1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(255, 206, 86, 1)',
                      'rgba(75, 192, 192, 1)',
                      'rgba(153, 102, 255, 1)',
                      'rgba(255, 159, 64, 1)'
                  ],
                  borderWidth: 1,
                  animations: {
                    borderWidth: {
                    duration: 1000,
                    easing: 'linear',
                    from: 10,
                    to: 1,
                    loop: true
                      }
                  }
              }]
          },
          options: {
              scales: {
                  yAxes: [{
                      ticks: {
                          beginAtZero:true
                      }
                  }]
              }
          }
      });*/

    //https://s3.amazonaws.com/dolartoday/data.json
    /* $.getJSON("https://s3.amazonaws.com/dolartoday/data.json",function(data){
      console.log(data)
      $('#texto').html('Transferencia: '+data.USD.transferencia+ '<br> Sicad: ' + data.USD.sicad2);
      $('#al').html('DolarToday al: '+data._timestamp.fecha);
    });  */

  </script>
<?php 
}
ob_end_flush();
?>

