mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/flujo_facturas_precio' into 'main'
reflejado diferentes ivas en total de factura See merge request jjimenez/safekat!699
This commit is contained in:
@ -1595,7 +1595,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
$presupuestoServiciosExtraModel = model('App\Models\Presupuestos\PresupuestoServiciosExtraModel');
|
$presupuestoServiciosExtraModel = model('App\Models\Presupuestos\PresupuestoServiciosExtraModel');
|
||||||
foreach ($presupuestoServiciosExtraModel->where('presupuesto_id', $presupuesto->id)->findAll() as $servicioExtra) {
|
foreach ($presupuestoServiciosExtraModel->where('presupuesto_id', $presupuesto->id)->findAll() as $servicioExtra) {
|
||||||
$servicioExtra->presupuesto_id = $new_id;
|
$servicioExtra->presupuesto_id = $new_id;
|
||||||
$presupuestoServiciosExtraModel->insert($preimpresion);
|
$presupuestoServiciosExtraModel->insert($servicioExtra);
|
||||||
}
|
}
|
||||||
|
|
||||||
$presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
$presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||||
|
|||||||
@ -35,9 +35,15 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="d-none">
|
||||||
<td colspan="8" style="text-align:right">I.V.A.:</td>
|
<td colspan="8" style="text-align:right">IVA (4%):</td>
|
||||||
<td class="autonumeric text-end" id="total-iva-sum"></td>
|
<td class="autonumeric text-end" id="total-iva-sum-4"></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="d-none">
|
||||||
|
<td colspan="8" style="text-align:right">IVA (21%):</td>
|
||||||
|
<td class="autonumeric text-end" id="total-iva-sum-21"></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -124,17 +130,26 @@ const actionBtns = function(data) {
|
|||||||
|
|
||||||
const autoNumericSubtotal = new AutoNumeric('#subtotal-sum', 0, {
|
const autoNumericSubtotal = new AutoNumeric('#subtotal-sum', 0, {
|
||||||
decimalPlaces: 2,
|
decimalPlaces: 2,
|
||||||
digitGroupSeparator: ',',
|
digitGroupSeparator: '.',
|
||||||
decimalCharacter: '.',
|
decimalCharacter: ',',
|
||||||
unformatOnSubmit: true,
|
unformatOnSubmit: true,
|
||||||
decimalPlacesShownOnFocus: 2,
|
decimalPlacesShownOnFocus: 2,
|
||||||
decimalPlacesShownOnBlur: 2,
|
decimalPlacesShownOnBlur: 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
const autoNumericIVA = new AutoNumeric('#total-iva-sum', 0, {
|
const autoNumericIVA_4 = new AutoNumeric('#total-iva-sum-4', 0, {
|
||||||
decimalPlaces: 2,
|
decimalPlaces: 2,
|
||||||
digitGroupSeparator: ',',
|
digitGroupSeparator: '.',
|
||||||
decimalCharacter: '.',
|
decimalCharacter: ',',
|
||||||
|
unformatOnSubmit: true,
|
||||||
|
decimalPlacesShownOnFocus: 2,
|
||||||
|
decimalPlacesShownOnBlur: 2,
|
||||||
|
});
|
||||||
|
|
||||||
|
const autoNumericIVA_21 = new AutoNumeric('#total-iva-sum-21', 0, {
|
||||||
|
decimalPlaces: 2,
|
||||||
|
digitGroupSeparator: '.',
|
||||||
|
decimalCharacter: ',',
|
||||||
unformatOnSubmit: true,
|
unformatOnSubmit: true,
|
||||||
decimalPlacesShownOnFocus: 2,
|
decimalPlacesShownOnFocus: 2,
|
||||||
decimalPlacesShownOnBlur: 2,
|
decimalPlacesShownOnBlur: 2,
|
||||||
@ -142,8 +157,8 @@ const autoNumericIVA = new AutoNumeric('#total-iva-sum', 0, {
|
|||||||
|
|
||||||
const autoNumericTotal = new AutoNumeric('#total-sum', 0, {
|
const autoNumericTotal = new AutoNumeric('#total-sum', 0, {
|
||||||
decimalPlaces: 2,
|
decimalPlaces: 2,
|
||||||
digitGroupSeparator: ',',
|
digitGroupSeparator: '.',
|
||||||
decimalCharacter: '.',
|
decimalCharacter: ',',
|
||||||
unformatOnSubmit: true,
|
unformatOnSubmit: true,
|
||||||
decimalPlacesShownOnFocus: 2,
|
decimalPlacesShownOnFocus: 2,
|
||||||
decimalPlacesShownOnBlur: 2,
|
decimalPlacesShownOnBlur: 2,
|
||||||
@ -151,8 +166,8 @@ const autoNumericTotal = new AutoNumeric('#total-sum', 0, {
|
|||||||
|
|
||||||
const autoNumericPendientePago = new AutoNumeric('#pendiente-pago', 0, {
|
const autoNumericPendientePago = new AutoNumeric('#pendiente-pago', 0, {
|
||||||
decimalPlaces: 2,
|
decimalPlaces: 2,
|
||||||
digitGroupSeparator: ',',
|
digitGroupSeparator: '.',
|
||||||
decimalCharacter: '.',
|
decimalCharacter: ',',
|
||||||
unformatOnSubmit: true,
|
unformatOnSubmit: true,
|
||||||
decimalPlacesShownOnFocus: 2,
|
decimalPlacesShownOnFocus: 2,
|
||||||
decimalPlacesShownOnBlur: 2,
|
decimalPlacesShownOnBlur: 2,
|
||||||
@ -448,11 +463,38 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
|||||||
const table = this.api();
|
const table = this.api();
|
||||||
|
|
||||||
const totalSubtotal = table.column(8).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
|
const totalSubtotal = table.column(8).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
|
||||||
const totalIVA = table.column(9).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
|
|
||||||
|
const data_table = table.rows().data();
|
||||||
|
const totalIVA_4 = data_table.reduce((sum, row) => {
|
||||||
|
if (parseInt(row['iva']) === 4) {
|
||||||
|
return sum + parseFloat(row['total_iva']) || 0;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}, 0);
|
||||||
|
const totalIVA_21 = data_table.reduce((sum, row) => {
|
||||||
|
if (parseInt(row['iva']) === 21) {
|
||||||
|
return sum + parseFloat(row['total_iva']) || 0;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
const totalTotal = table.column(10).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
|
const totalTotal = table.column(10).data().reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
|
||||||
|
|
||||||
autoNumericSubtotal.set(totalSubtotal);
|
autoNumericSubtotal.set(totalSubtotal);
|
||||||
autoNumericIVA.set(totalIVA);
|
autoNumericIVA_4.set(totalIVA_4);
|
||||||
|
if(totalIVA_4 == 0){
|
||||||
|
$('#total-iva-sum-4').closest('tr').addClass('d-none');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#total-iva-sum-4').closest('tr').removeClass('d-none');
|
||||||
|
}
|
||||||
|
autoNumericIVA_21.set(totalIVA_21);
|
||||||
|
if(totalIVA_21 == 0){
|
||||||
|
$('#total-iva-sum-21').closest('tr').addClass('d-none');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#total-iva-sum-21').closest('tr').removeClass('d-none');
|
||||||
|
}
|
||||||
autoNumericTotal.set(totalTotal);
|
autoNumericTotal.set(totalTotal);
|
||||||
|
|
||||||
var total_pagos = autoNumericTotalCobrado.getNumber();
|
var total_pagos = autoNumericTotalCobrado.getNumber();
|
||||||
|
|||||||
@ -190,6 +190,11 @@
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success:function(response){
|
success:function(response){
|
||||||
|
|
||||||
|
if(response.error){
|
||||||
|
console.error(response.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
token=response.<?= csrf_token() ?>;
|
token=response.<?= csrf_token() ?>;
|
||||||
yeniden(token);
|
yeniden(token);
|
||||||
// redirect
|
// redirect
|
||||||
|
|||||||
@ -399,7 +399,9 @@ class PresupuestoAdminEdit {
|
|||||||
self.tipo_impresion.val(response.data.tipo_impresion);
|
self.tipo_impresion.val(response.data.tipo_impresion);
|
||||||
self.POD.val(response.data.POD);
|
self.POD.val(response.data.POD);
|
||||||
|
|
||||||
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(response.data.total_aceptado_revisado);
|
const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ?
|
||||||
|
response.data.total_aceptado_revisado : response.data.resumen.total_aceptado;
|
||||||
|
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(totalAceptadoRevisado);
|
||||||
|
|
||||||
$('#aprobado_by_at').html(response.data.aprobado_by_at);
|
$('#aprobado_by_at').html(response.data.aprobado_by_at);
|
||||||
|
|
||||||
|
|||||||
@ -414,6 +414,9 @@ class Resumen {
|
|||||||
if (total_aceptado_revisado && total_aceptado_revisado != 0) {
|
if (total_aceptado_revisado && total_aceptado_revisado != 0) {
|
||||||
data.total_aceptado_revisado = total_aceptado_revisado;
|
data.total_aceptado_revisado = total_aceptado_revisado;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
data.total_aceptado_revisado = data.total_aceptado;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user