mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
arreglado el tema de las facturas rectificadas/rectificativas
This commit is contained in:
@ -833,9 +833,18 @@ class Facturas extends \App\Controllers\BaseResourceController
|
||||
|
||||
if ((strpos($numero, "REC ") === 0)) {
|
||||
$data['estado_pago'] = 'pagada';
|
||||
|
||||
}
|
||||
|
||||
$this->model->update($factura_id, $data);
|
||||
|
||||
if ((strpos($numero, "REC ") === 0)) {
|
||||
|
||||
$this->model->where('numero', $factura->factura_rectificada_id)->set([
|
||||
'factura_rectificativa_id' => $numero,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
])->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ class FacturasLineas extends \App\Controllers\BaseResourceController
|
||||
Field::inst('id'),
|
||||
Field::inst('base'),
|
||||
Field::inst('total_iva'),
|
||||
Field::inst('total'),
|
||||
Field::inst('total')->set(Field::SET_BOTH),
|
||||
Field::inst('cantidad')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
@ -126,19 +126,6 @@ class FacturasLineas extends \App\Controllers\BaseResourceController
|
||||
'message' => lang('Facturas.validation.requerido')
|
||||
)
|
||||
),
|
||||
Field::inst('total')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
'message' => lang('Facturas.validation.numerico')
|
||||
)
|
||||
)
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('Facturas.validation.requerido')
|
||||
)
|
||||
),
|
||||
Field::inst('pedido_linea_impresion_id')
|
||||
->setFormatter(function ($val, $data, $opts) {
|
||||
return $val === '' ? null : $val;
|
||||
@ -157,7 +144,7 @@ class FacturasLineas extends \App\Controllers\BaseResourceController
|
||||
$values['total'],
|
||||
$values['iva'],
|
||||
$values['cantidad'],
|
||||
$values['old_cantidad'],
|
||||
$values['old_cantidad'],
|
||||
$values['base']
|
||||
);
|
||||
$editor
|
||||
@ -183,7 +170,7 @@ class FacturasLineas extends \App\Controllers\BaseResourceController
|
||||
$values['total'],
|
||||
$values['iva'],
|
||||
$values['cantidad'],
|
||||
$values['old_cantidad'],
|
||||
$values['old_cantidad'],
|
||||
$values['base']
|
||||
);
|
||||
$editor
|
||||
@ -256,14 +243,13 @@ class FacturasLineas extends \App\Controllers\BaseResourceController
|
||||
$values['base'] = $base;
|
||||
$values['total_iva'] = $total_iva;
|
||||
$values['total'] = $total;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
// se pasa la base y el iva
|
||||
$total_iva = round($base_input * $iva / 100, 2);
|
||||
$total = round($base_input + $total_iva, 2);
|
||||
|
||||
|
||||
$values = [];
|
||||
$values['base'] = $base_input;
|
||||
$values['base'] = (float) $base_input;
|
||||
$values['total_iva'] = $total_iva;
|
||||
$values['total'] = $total;
|
||||
|
||||
|
||||
@ -96,13 +96,12 @@
|
||||
|
||||
<div class="row mb-2">
|
||||
|
||||
<div <?= ($facturaEntity->serie_id == 7 || $facturaEntity->serie_id == 9 || $facturaEntity->factura_rectificada_id != null) ? "":"style='display:none;'" ?> class="col-md-12 col-lg-2 px-4 factura-R">
|
||||
<div <?= ($facturaEntity->serie_id == 7 || $facturaEntity->serie_id == 9 || $facturaEntity->factura_rectificativa_id != null) ? "":"style='display:none;'" ?> class="col-md-12 col-lg-2 px-4 factura-R">
|
||||
<div class="mb-1">
|
||||
<label for="facturaR" class="form-label factura-R">
|
||||
<?= ($facturaEntity->factura_rectificada_id != null) ? lang('Facturas.facturaRectificada') : lang('Facturas.facturaRectificativa') ?>:
|
||||
<?= ($facturaEntity->serie_id == 7 || $facturaEntity->serie_id == 9) ? lang('Facturas.facturaRectificada') : lang('Facturas.facturaRectificativa') ?>:
|
||||
</label>
|
||||
<input <?= ($facturaEntity->estado!='borrador')? "disabled":"" ?> id="facturaR" name="<?= ($facturaEntity->factura_rectificada_id != null) ? 'factura_rectificada_id' : 'factura_rectificativa_id' ?>" tabindex="" maxLength="25" class="form-control update-cabecera factura-R"
|
||||
|
||||
<input <?= ($facturaEntity->estado!='borrador')? "disabled":"" ?> id="facturaR" name="<?= ($facturaEntity->serie_id == 7 || $facturaEntity->serie_id == 9) ? 'factura_rectificada_id' : 'factura_rectificativa_id' ?>" tabindex="" maxLength="25" class="form-control update-cabecera factura-R"
|
||||
<?php if($facturaEntity->factura_rectificada_id == null && $facturaEntity->factura_rectificativa_id == null): ?>
|
||||
value=""
|
||||
<?php else: ?>
|
||||
|
||||
@ -211,7 +211,7 @@ var editor_lineas = new $.fn.dataTable.Editor( {
|
||||
name: "base",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "total",
|
||||
name : "base",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
@ -224,6 +224,10 @@ var editor_lineas = new $.fn.dataTable.Editor( {
|
||||
name: "id",
|
||||
type: "hidden"
|
||||
},
|
||||
{
|
||||
name: "total",
|
||||
type: "hidden"
|
||||
}
|
||||
]
|
||||
} );
|
||||
|
||||
@ -279,7 +283,8 @@ editor_lineas.on( 'preEdit', function ( e, json, data, id ) {
|
||||
|
||||
editor_lineas.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
tableLineas.clearPipeline();
|
||||
tableLineas.draw();
|
||||
});
|
||||
|
||||
editor_lineas.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
@ -495,7 +500,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
||||
$('#total-iva-sum-4').closest('tr').addClass('d-none');
|
||||
}
|
||||
else{
|
||||
totalTotal += totalIVA_4;
|
||||
//totalTotal += totalIVA_4;
|
||||
$('#total-iva-sum-4').closest('tr').removeClass('d-none');
|
||||
}
|
||||
autoNumericIVA_21.set(totalIVA_21);
|
||||
@ -503,17 +508,18 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
||||
$('#total-iva-sum-21').closest('tr').addClass('d-none');
|
||||
}
|
||||
else{
|
||||
totalTotal += totalIVA_21;
|
||||
//totalTotal += totalIVA_21;
|
||||
$('#total-iva-sum-21').closest('tr').removeClass('d-none');
|
||||
}
|
||||
autoNumericTotal.set(totalTotal);
|
||||
|
||||
var total_pagos = autoNumericTotalCobrado.getNumber();
|
||||
var pendientePago = totalTotal - total_pagos;
|
||||
|
||||
if (isNaN(pendientePago)) pendientePago = 0;
|
||||
|
||||
autoNumericPendientePago.set(pendientePago);
|
||||
if(!(<?= $facturaEntity->serie_id ?> == 7 || <?= $facturaEntity->serie_id ?> == 9)){
|
||||
var total_pagos = autoNumericTotalCobrado.getNumber();
|
||||
var pendientePago = totalTotal - total_pagos;
|
||||
if (isNaN(pendientePago)) pendientePago = 0;
|
||||
autoNumericPendientePago.set(pendientePago);
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '<?= route_to('updateFacturaTotales', $facturaEntity->id) ?>',
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
|
||||
<?= view("themes/vuexy/form/facturas/_facturaCabeceraItems") ?>
|
||||
<?php if($facturaEntity->estado =='borrador') : ?>
|
||||
<?php if($facturaEntity->estado =='borrador' && !($facturaEntity->serie_id == 7 || $facturaEntity->serie_id == 9)) : ?>
|
||||
<?= view("themes/vuexy/form/facturas/_addPedidosItems") ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user