diff --git a/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php b/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php
index 15e4109b..cf98966d 100644
--- a/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php
+++ b/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php
@@ -141,7 +141,11 @@ var editor_lineas = new $.fn.dataTable.Editor( {
fields: [
{
name: "cantidad",
-
+ attr: {
+ type: "text",
+ name : "cantidad",
+ class :"autonumeric"
+ }
}, {
name: "descripcion",
type: "textarea",
@@ -152,10 +156,18 @@ var editor_lineas = new $.fn.dataTable.Editor( {
}, {
name: "precio_unidad",
attr: {
+ type: "text",
+ name : "precio_unidad",
+ class :"autonumeric",
style: "min-width: 65px;"
}
}, {
name: "iva",
+ attr: {
+ type: "text",
+ name : "iva",
+ class :"autonumeric"
+ }
}, {
name: "pedido_linea_impresion_id",
type: "hidden"
@@ -174,7 +186,37 @@ var editor_lineas = new $.fn.dataTable.Editor( {
var old_cantidad = 0;
+editor_lineas.on('open', (event) => {
+ $("input.autonumeric").each(function () {
+ let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
+ if (autoNumericInstance) {
+ autoNumericInstance.remove()
+ }
+ new AutoNumeric(this, {
+ decimalCharacter: ",",
+ digitGroupSeparator: ".",
+ allowDecimalPadding : 'floats',
+ decimalPlaces: 2,
+ unformatOnSubmit: true,
+ });
+ })
+ })
+ editor_lineas.on('preSubmit', (e, d, type) => {
+ if (d.data) {
+ Object.keys(d.data).forEach(function (key) {
+ // Find all elements with class .autonumeric
+ $("input.autonumeric").each(function () {
+ let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
+ if (autoNumericInstance) {
+ // Get raw value and update the corresponding field
+ let rawValue = autoNumericInstance.getNumericString();
+ d.data[key][this.name] = rawValue; // Ensure the correct name attribute is used
+ }
+ });
+ });
+ }
+ })
editor_lineas.on( 'preEdit', function ( e, json, data, id ) {
old_cantidad = data.cantidad;
@@ -239,7 +281,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
{data: "pedido_linea_impresion_id"},
{data: "pedido_maquetacion_id"},
{data: "pedido_id"},
- {data: "cantidad"},
+ {data: "cantidad",render : (d) => `${d}`},
{
data: "descripcion",
render: function (data, type, row, meta) {
@@ -324,11 +366,11 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
}
}
},
- {data: "precio_unidad"},
- {data: "iva"},
- {data: "base"},
- {data: "total_iva"},
- {data: "total"},
+ {data: "precio_unidad",render : (d) => `${d}`},
+ {data: "iva",render : (d) => `${d}`},
+ {data: "base",render : (d) => `${d}`},
+ {data: "total_iva",render : (d) => `${d}`},
+ {data: "total",render : (d) => `${d}`},
],
order: [[1, "asc"]],
dom: 't',
diff --git a/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php b/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php
index 3e2a82ea..2741c977 100644
--- a/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php
+++ b/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php
@@ -160,9 +160,9 @@
{ 'data': 'numero' },
{ 'data': 'fecha_factura_at' },
{ 'data': 'cliente' },
- { 'data': 'base' },
- { 'data': 'total' },
- { 'data': 'pendiente' },
+ { 'data': 'base' ,render : (d) => `${d}`},
+ { 'data': 'total',render : (d) => `${d}`},
+ { 'data': 'pendiente',render : (d) => `${d}` },
{ 'data': 'creditoAsegurado' ,
render: function(data, type, row, meta) {
switch(data){