function grafica(){
    let inicio=0;
    let pen=0;
    $.ajax({
        url: 'back-end/informes.php',
        type: 'GET',
        data: {inicio},
        success:function(response){
            const data = JSON.parse(response);
            $('#pendientes').html(data.pendientes);
            $('#entregados').html(data.entregados);
            $('#entregap').html(data.parcial);
            $('#noentrega').html(data.noentregados);
            
            pen = data.pendientes;
            var noent= data.noentregados;
            var par = data.parcial;
            var ent = data.entregados;
            var total = data.total;
            
            $('#total').html(total);
            
            var oilCanvas = document.getElementById("oilChart");
    
            Chart.defaults.global.defaultFontFamily = "Nunito";
            Chart.defaults.global.defaultFontSize = 12;
            
            var oilData = {
                labels: [
                    "Entregados",
                    "Entregados Parcial",
                    "No Entregados",
                    "Pendientes"
                ],
                datasets: [
                    {
                        data: [ent, par, noent, pen],
                        backgroundColor: [
                            "#1cc88a",
                            "#f6c23e",
                            "#e74a3b",
                            "#4e73df"
                        ]
                    }]
            };
            
            var pieChart = new Chart(oilCanvas, {
              type: 'doughnut',
              data: oilData
            });
            
            
        }
    }); 
}

function initMap() {
  const map = new google.maps.Map(document.getElementById("Mapa"), {
    zoom: 11, 
    center: { lat: 4.6470094, lng: -74.1378336 },
  });
  // Create an array of alphabetical characters used to label the markers.
  const labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  // Add some markers to the map.
  // Note: The code uses the JavaScript Array.prototype.map() method to
  // create an array of markers based on a given "locations" array.
  // The map() method here has nothing to do with the Google Maps API.
  const markers = locations.map((location, i) => {
    return new google.maps.Marker({
      position: location,
      label: labels[i % labels.length],
    });
  });
  // Add a marker clusterer to manage the markers.
  new MarkerClusterer(map, markers, {
    imagePath:
      "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",
  });
}
const locations = [
  { lat: 4.6346949, lng: -74.0762881 },
  { lat: 4.6347002, lng: -74.0784768 },
  { lat: 4.6342725, lng: -74.0775541 },
  { lat: 4.6489014, lng: -74.1322712 },
  { lat: 4.6448806, lng: -74.1365627 },
  { lat: 4.6587929, lng: -74.1313485 },
  { lat: 4.6632199, lng: -74.1298465 },
  { lat: 4.7197211, lng: -74.0845279 },
  { lat: 4.6993574, lng: -74.1340262 },
  { lat: 4.7124439, lng: -74.1462503 },
  { lat: 4.7375542, lng: -74.068358 }
];

function listado_guias(){
        let fd= $('#f_desde').val();
        let fh = $('#f_hasta').val();
        let baseUrl = 'back-end/info01_excel.php?fd='+fd+'&fh='+fh;
        document.getElementById('url_excel').setAttribute('href', baseUrl);
        console.log(baseUrl);
        let page3 = 0;
        $.ajax({
            url: 'back-end/informes.php',
            type: 'GET',
            data:{fd,fh,page3},
            success: function(response){
                //console.log(response);
            }
        })
}

function aplicar_filtros(){
    listado_guias()
    
}


//Pasar la fecha
var fecha = new Date(); //Fecha actual
var mes = fecha.getMonth()+1; //obteniendo mes
var dia = fecha.getDate(); //obteniendo dia
var ano = fecha.getFullYear(); //obteniendo a単o
if(dia<10)
    dia='0'+dia; //agrega cero si el menor de 10
if(mes<10)
    mes='0'+mes //agrega cero si el menor de 10 f_exp_mat
    $('#f_desde').val(ano+"-"+mes+"-"+dia)
    $('#f_hasta').val(ano+"-"+mes+"-"+dia)