Commit 13a75ffd by Billy Larru

montos de policias arreglado

parent fbd03f73
function getColumns() { function getColumns() {
let columns = [ let columns = [
{ {
title: `N°`, title: `N°`,
data: `id`, data: `id`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `POLICIA`, title: `POLICIA`,
data: `policia_nombres`, data: `policia_nombres`,
className: `text-center`, className: `text-center`,
}, },
{ {
title: `SEDE`, title: `SEDE`,
data: `sede_descripcion`, data: `sede_descripcion`,
className: `text-center`, className: `text-center`,
}, },
{ {
title: `HORARIO`, title: `HORARIO`,
data: `horario`, data: `horario`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `FECHA ENTRADA`, title: `FECHA ENTRADA`,
data: `fecha_entrada`, data: `fecha_entrada`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `MARC. ENTRADA`, title: `MARC. ENTRADA`,
data: `marcacion_entrada`, data: `marcacion_entrada`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `MARC. SALIDA`, title: `MARC. SALIDA`,
data: `marcacion_salida`, data: `marcacion_salida`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `FECHA SALIDA`, title: `FECHA SALIDA`,
data: `fecha_salida`, data: `fecha_salida`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `ROL`, title: `ROL`,
data: `tiporol_descripcion`, data: `tiporol_descripcion`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `COSTO HORA`, title: `COSTO HORA`,
data: `costo_hora`, data: `costo_hora`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `TIEMPO LABORADO`, title: `TIEMPO LABORADO`,
data: `tiempo_laborado`, data: `tiempo_laborado`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `MONTO`, title: `MONTO`,
data: `monto`, data: `monto`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `DCTO POR NO MARCAR`, title: `DCTO POR NO MARCAR`,
data: `descuento_no_marco`, data: `descuento_no_marco`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `TIEMPO EXTRA`, title: `TIEMPO EXTRA`,
data: `tiempo_extra`, data: `tiempo_extra`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `MONTO EXTRAS`, title: `MONTO EXTRAS`,
data: `monto_extras`, data: `monto_extras`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `ESTADO EXTRAS`, title: `ESTADO EXTRAS`,
data: `estado_extras`, data: `estado_extras`,
className: 'text-center' className: 'text-center'
}, },
{ {
title: `MONTO TOTAL`, title: `MONTO TOTAL`,
data: `monto_total`, data: `monto_total`,
className: 'text-center' className: 'text-center'
}, },
]; ];
return columns; return columns;
}
function getColumnDefs() {
let columnDefs = [
{orderable: false, width: '3%', targets: 0, className: "text-center"},
{orderable: false, width: '10%', targets: 1, className: "text-center"},
{orderable: false, width: '30%', targets: 2, className: "text-center"},
{orderable: false, width: '7%', targets: 3, className: "text-center"},
{orderable: false, width: '7%', targets: 4, className: "text-center"},
{orderable: false, width: '3%', targets: 5, className: "text-center"},
{orderable: false, width: '10%', targets: 6, className: "text-center"},
{orderable: false, width: '30%', targets: 7, className: "text-center"},
{orderable: false, width: '7%', targets: 8, className: "text-center"},
{orderable: false, width: '7%', targets: 9, className: "text-center"},
{orderable: false, width: '3%', targets: 10, className: "text-center"},
{orderable: false, width: '10%', targets: 11, className: "text-center"},
{orderable: false, width: '30%', targets: 12, className: "text-center"},
{orderable: false, width: '7%', targets: 13, className: "text-center"},
{orderable: false, width: '7%', targets: 14, className: "text-center"},
{orderable: false, width: '7%', targets: 15, className: "text-center"},
{orderable: false, width: '7%', targets: 16, className: "text-center"},
{orderable: false, width: '7%', targets: 17, className: "text-center"},
];
return columnDefs;
} }
function listarPolicias(selectorName) { function listarPolicias(selectorName) {
axios.get(URI_POLICIAS).then((result) => { ajaxWebService.get(URI_POLICIAS).then((result) => {
let policias = result.data; let policias = result.data;
policias = _.orderBy(policias, p => p.nombres); policias = _.orderBy(policias, p => p.nombres);
let html = `<option value="">[TODOS]</option>`; let html = `<option value="">[TODOS]</option>`;
policias.forEach(p => html += `<option documento_identidad="${p.dni}" value="${p.id}">${p.nombres}</option>`); policias.forEach(p => html += `<option documento_identidad="${p.dni}" value="${p.id}">${p.nombres}</option>`);
$(`${selectorName}`).html(html); $(`${selectorName}`).html(html);
$('.select-search').select2(); $('.select-search').select2();
}); });
} }
function listarSedes(selectorName) { function listarSedes(selectorName) {
axios.get(URI_SEDES).then((result) => { ajaxWebService.get(URI_SEDES).then((result) => {
let sedes = result.data; let sedes = result.data;
sedes = _.orderBy(sedes, s => s.descripcion); sedes = _.orderBy(sedes, s => s.descripcion);
let html = `<option value="">[TODOS]</option>`; let html = `<option value="">[TODOS]</option>`;
sedes.forEach(sede => html += `<option value="${sede.codigo}">${sede.descripcion}</option>`); sedes.forEach(sede => html += `<option value="${sede.codigo}">${sede.descripcion}</option>`);
$(`${selectorName}`).html(html); $(`${selectorName}`).html(html);
}); });
} }
function defaultConfigDateRangePicker(selectorName) { function defaultConfigDateRangePicker(selectorName) {
$(selectorName).daterangepicker({ $(selectorName).daterangepicker({
"autoApply": true, "autoApply": true,
"locale": { "locale": {
"format": "DD/MM/YYYY", "format": "DD/MM/YYYY",
"separator": " - ", "separator": " - ",
"applyLabel": "Apply", "applyLabel": "Apply",
"cancelLabel": "Cancel", "cancelLabel": "Cancel",
"fromLabel": "From", "fromLabel": "From",
"toLabel": "To", "toLabel": "To",
"customRangeLabel": "Custom", "customRangeLabel": "Custom",
"weekLabel": "W", "weekLabel": "W",
"daysOfWeek": [ "daysOfWeek": [
"Do", "Do",
"Lu", "Lu",
"Ma", "Ma",
"Mi", "Mi",
"Ju", "Ju",
"Vi", "Vi",
"Sa" "Sa"
], ],
"monthNames": [ "monthNames": [
"Enero", "Enero",
"Febrero", "Febrero",
"Marzo", "Marzo",
"Abril", "Abril",
"Mayo", "Mayo",
"Junio", "Junio",
"Julio", "Julio",
"Agosto", "Agosto",
"Setiembre", "Setiembre",
"Octubre", "Octubre",
"Noviembre", "Noviembre",
"Diciembre" "Diciembre"
], ],
"firstDay": 1 "firstDay": 1
}, },
"startDate": "17/08/2018", "startDate": "17/08/2018",
"endDate": "23/08/2018" "endDate": "23/08/2018"
}, function (start, end, label) { }, function (start, end, label) {
// console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')'); // console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
}); });
$(selectorName).datepicker('setDate', 'now'); $(selectorName).datepicker('setDate', 'now');
} }
function mostrarReporte(objParams = {}) { function mostrarReporte(objParams = {}) {
axios.get(URI_POLICIA_REPORTE_MONTOS, objParams).then((response) => { ajaxWebService.get(URI_POLICIA_REPORTE_MONTOS, objParams).then((response) => {
response.data = formatResponse(response); let columns = getColumns();
let columns = getColumns();
let columnDefs = getColumnDefs();
let wrapsNameDatatable = `divDatatable`; let wrapsNameDatatable = `divDatatable`;
let classNameForDatatable = `display table table-bordered`; let classNameForDatatable = `display table table-bordered`;
let footer = false;
makeDatatable( makeDatatable(
{ wrapsNameDatatable,
data: response.data.data, {
columns, data: response.data,
columnDefs, columns
wrapsNameDatatable, },
classNameForDatatable, classNameForDatatable,
footer );
} });
);
});
} }
function verReporte() {
debugger
let rango_fechas = $("#dpRangoFechas").val();
let split_fechas = rango_fechas.split("-").map(f => f.trim());
let fecha_inicio = split_fechas[0];
let policia_nombres = $("#cboPoliciasFiltro option:selected").text();
let sede_descripcion = $("#cboSedesFiltro option:selected").text();
policia_nombres = policia_nombres.includes("TODOS") ? "" : policia_nombres
sede_descripcion = sede_descripcion.includes("TODOS") ? "" : sede_descripcion
let params = cleanQueryParams({
fecha_entrada: fecha_inicio,
policia_nombres,
sede_descripcion
});
mostrarReporte({params});
}
$().ready(function () { $().ready(function () {
defaultConfigDataTable(); listarPolicias("#cboPoliciasFiltro");
listarPolicias("#cboPoliciasFiltro"); listarSedes("#cboSedesFiltro");
listarSedes("#cboSedesFiltro"); defaultConfigDateRangePicker("#dpRangoFechas");
defaultConfigDateRangePicker("#dpRangoFechas"); $("#btnVerTodos").click(mostrarReporte);
$("#btnVerTodos").click(mostrarReporte); $("#btnVerReporte").click(verReporte);
}); });
\ No newline at end of file
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<div class="text-center"> <div class="text-center">
<button class="btn btn-primary" id="btnVerRoles"><i class="icon-eye4"></i> Ver reporte</button>&nbsp; <button class="btn btn-primary" id="btnVerReporte"><i class="icon-eye4"></i> Ver reporte</button>&nbsp;
<button class="btn btn-primary" id="btnVerTodos"><i class="icon-eye4"></i> Ver Todos</button>&nbsp; <button class="btn btn-primary" id="btnVerTodos"><i class="icon-eye4"></i> Ver Todos</button>&nbsp;
</div> </div>
</div> </div>
...@@ -71,12 +71,10 @@ ...@@ -71,12 +71,10 @@
<%@include file="templates/footer-body.jsp"%> <%@include file="templates/footer-body.jsp"%>
<!--js de la pagina--> <!--js de la pagina-->
<script src="../plantilla/assets/js/plugins/tables/datatables/datatables.min.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/core/libraries/jquery_ui/interactions.min.js"></script> <script src="../plantilla/assets/js/core/libraries/jquery_ui/interactions.min.js"></script>
<script src="../plantilla/assets/js/core/libraries/jquery_ui/widgets.min.js"></script> <script src="../plantilla/assets/js/core/libraries/jquery_ui/widgets.min.js"></script>
<script src="../js/lib/sweetalert2.min.js" type="text/javascript"></script> <script src="../js/lib/sweetalert2.min.js" type="text/javascript"></script>
<script src="../js/lib/lodash.js" type="text/javascript"></script> <script src="../js/lib/lodash.js" type="text/javascript"></script>
<script src="../js/lib/axios.min.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/forms/inputs/formatter.min.js"></script> <script src="../plantilla/assets/js/plugins/forms/inputs/formatter.min.js"></script>
<script src="../plantilla/assets/js/plugins/forms/selects/select2.min.js"></script> <script src="../plantilla/assets/js/plugins/forms/selects/select2.min.js"></script>
<script src="../plantilla/assets/js/plugins/ui/moment/moment.min.js"></script> <script src="../plantilla/assets/js/plugins/ui/moment/moment.min.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment