Files

149 lines
4.4 KiB
PHP
Raw Permalink Normal View History

<?php
require_once __DIR__.'/auth_guard.php';
include '../config.php';
session_name($CFG->sessionname);
session_start();
if(!isset($_SESSION['usersession'])){
header("Location: ".$CFG->wwwroot);
}
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
?>
<div class="col-12 text-primary mt-3">
<h1>Reporte de cumplimiento detalle por curso</h1>
</div>
<div class="col-12 text-left my-5">
<a target="_blank" href="reporteExportCursos.php?key=<?php echo generateRandomString(); ?>" class="p-3 btn-primary text-white btn-descarga" >Descargar Reporte</a>
</div>
<div class="col-12">
<table class="table table-striped table-bordered" style="width:100%" id="estafetatable1">
<thead>
<tr>
<th>Número de empleado</th>
<th>Nombre(s)</th>
<th>Apellidos</th>
<th>Centro de trabajo</th>
<th>Distrito</th>
<th>Nombre del curso</th>
<th>Nombre del tema</th>
<th>Calificación</th>
<th>Fecha</th>
</tr>
</thead>
<tbody>
<tr class="text-center"><td colspan="9">Procesando...</td></tr>
</tbody>
<tfoot>
<tr>
<th>Número de empleado</th>
<th>Nombre(s)</th>
<th>Apellidos</th>
<th>Centro de trabajo</th>
<th>Distrito</th>
<th>Nombre del curso</th>
<th>Nombre del tema</th>
<th>Calificación</th>
<th>Fecha</th>
</tr>
</tfoot>
</table>
</div>
<script type="text/javascript">
extractData();
function extractData(){
$(".layer-load").show();
var dataSet = [];
$.ajax({
url: 'reporte_getCurso.php'
})
.done(function (data) {
var _data = JSON.parse(data);
$.each(_data.data, function (index, val) {
dataSet[index] = [val['numempl'],val['nomempl'],val['apellido'],val['nomcentro'],val['nomdistrito'],val['catnom'],val['nombre'],val['calificacion'],val['fecha']];
});
$('#estafetatable1 tbody').empty();
$('#estafetatable1').DataTable({
//dom: "Bfrtip",
//buttons: [
//{
//extend: 'excel',
//text: 'Exportar a Excel'
//},
//],
"language": {
"url": "../json/Spanish.json"
},
'order': [
[0, 'desc'],
[8, 'asc']
],
"responsive": true,
data: dataSet,
columns: [
{ title: "Número de empleado" },
{ title: "Nombre(s)" },
{ title: "Apellidos" },
{ title: "Centro de trabajo" },
{ title: "Distrito" },
{ title: "Nombre del curso" },
{ title: "Nombre del tema" },
{ title: "Calificación" },
{ title: "Fecha" },
]
});
$("#estafetatable1").show();
$(".layer-load").hide();
})
.fail(function () {
})
.always(function () {
});
}
/*
var table = $('#estafetatable1').DataTable({
responsive: true,
"language": {
"url": "../json/Spanish.json"
},
"initComplete": function (settings, json) {
$('div.load').remove();
$(".nooverflow").removeClass('nooverflow');
$("#estafetatable1").show();
},
columnDefs: [
{ targets: 'no-sort', orderable: false }
],
"processing": true,
"serverSide": true,
"ajax": {
url: "reporte_getDataDetalle.php",
type: "post"
}
});
*/
</script>