terminado

This commit is contained in:
2025-04-24 12:01:06 +02:00
parent 616c12002e
commit 3838bcb536
5 changed files with 204 additions and 73 deletions

View File

@ -186,10 +186,10 @@ var editor_lineas = new $.fn.dataTable.Editor( {
{
name: "cantidad",
attr: {
type: "text",
name : "cantidad",
class :"autonumeric"
}
type: "text",
name : "cantidad",
class :"autonumeric"
}
}, {
name: "descripcion",
type: "textarea",
@ -199,11 +199,21 @@ var editor_lineas = new $.fn.dataTable.Editor( {
}
}, {
name: "iva",
type: "select",
options: [
{ label: "4%", value: 4 },
{ label: "21%", value: 21 }
],
attr: {
type: "text",
name : "iva",
class :"autonumeric"
}
class: "autonumeric"
}
}, {
name: "base",
attr: {
type: "text",
name : "total",
class :"autonumeric"
}
}, {
name: "pedido_linea_impresion_id",
type: "hidden"
@ -213,9 +223,6 @@ var editor_lineas = new $.fn.dataTable.Editor( {
}, {
name: "id",
type: "hidden"
}, {
name: "base",
type: "hidden"
},
]
} );
@ -480,7 +487,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
return sum;
}, 0);
const totalTotal = table.column(10).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
let totalTotal = table.column(10).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
autoNumericSubtotal.set(totalSubtotal);
autoNumericIVA_4.set(totalIVA_4);
@ -488,6 +495,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
$('#total-iva-sum-4').closest('tr').addClass('d-none');
}
else{
totalTotal += totalIVA_4;
$('#total-iva-sum-4').closest('tr').removeClass('d-none');
}
autoNumericIVA_21.set(totalIVA_21);
@ -495,6 +503,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
$('#total-iva-sum-21').closest('tr').addClass('d-none');
}
else{
totalTotal += totalIVA_21;
$('#total-iva-sum-21').closest('tr').removeClass('d-none');
}
autoNumericTotal.set(totalTotal);

View File

@ -73,6 +73,45 @@ const actionBtns_pagos = function(data) {
<?php endif; ?>
}
$(document).on('click', '.btn-delete-pago', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
asyncConfirmDialogWithParams(
"Borrar Linea de pagos",
"¿Está seguro de borrar la línea? Esta acción no se puede deshacer.",
deleteConfirmedLineaPago, function(){}, [dataId, row])
}
});
function deleteConfirmedLineaPago(params){
var factura_linea_id = params[0];
var row = params[1];
const row_data = tablePagos.row($(row)).data();
const tabla = tablePagos;
if(row_data.id != null){
var url = '<?= route_to('deleteLineaPago') ?>';
$.ajax({
url: url,
method: 'POST',
data: {
factura_id: <?= $facturaEntity->id ?>,
pago_id: row_data.id,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
}
}).done((data, textStatus, jqXHR) => {
tabla.clearPipeline().draw();
$('#tableOfLineasFactura').DataTable().clearPipeline().draw();
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
}
const editor_pagos = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPagosFacturas') ?>",