mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
pagos en borrador
This commit is contained in:
@ -230,6 +230,10 @@ class Facturas extends \App\Controllers\BaseResourceController
|
|||||||
$factura->updated_by = $userModel->getFullName($factura->user_updated_id);
|
$factura->updated_by = $userModel->getFullName($factura->user_updated_id);
|
||||||
$factura->created_at_footer = $factura->created_at ? date(' H:i d/m/Y', strtotime($factura->created_at)) : '';
|
$factura->created_at_footer = $factura->created_at ? date(' H:i d/m/Y', strtotime($factura->created_at)) : '';
|
||||||
$factura->updated_at_footer = $factura->updated_at ? date(' H:i d/m/Y', strtotime($factura->updated_at)) : '';
|
$factura->updated_at_footer = $factura->updated_at ? date(' H:i d/m/Y', strtotime($factura->updated_at)) : '';
|
||||||
|
|
||||||
|
$factura->showDeleteButton = model('App\Models\Facturas\FacturaPagoModel')
|
||||||
|
->where('factura_id', $factura->id)->countAllResults() == 0;
|
||||||
|
|
||||||
$this->viewData['facturaEntity'] = $factura;
|
$this->viewData['facturaEntity'] = $factura;
|
||||||
|
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Facturas.factura') . ' ' . lang('Basic.global.edit3');
|
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Facturas.factura') . ' ' . lang('Basic.global.edit3');
|
||||||
|
|||||||
@ -121,6 +121,7 @@ $('#addNewPedidoImpresion').on('click', function(){
|
|||||||
$('#pedidoImpresion').val(null).trigger('change');
|
$('#pedidoImpresion').val(null).trigger('change');
|
||||||
// Se actualiza la tabla de lineas de factura
|
// Se actualiza la tabla de lineas de factura
|
||||||
$('#tableOfLineasFactura').DataTable().clearPipeline().draw();
|
$('#tableOfLineasFactura').DataTable().clearPipeline().draw();
|
||||||
|
$('#tableOfLineasPagos').DataTable().clearPipeline().draw();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -455,14 +455,9 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
|||||||
autoNumericIVA.set(totalIVA);
|
autoNumericIVA.set(totalIVA);
|
||||||
autoNumericTotal.set(totalTotal);
|
autoNumericTotal.set(totalTotal);
|
||||||
|
|
||||||
<?php if($facturaEntity->estado == 'borrador') :?>
|
var total_pagos = autoNumericTotalCobrado.getNumber();
|
||||||
var pendientePago = totalTotal;
|
var pendientePago = totalTotal - total_pagos;
|
||||||
var total_pagos = 0;
|
|
||||||
<?php else: ?>
|
|
||||||
var total_pagos = autoNumericTotalCobrado.getNumber();
|
|
||||||
var pendientePago = totalTotal - total_pagos;
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
if (isNaN(pendientePago)) pendientePago = 0;
|
if (isNaN(pendientePago)) pendientePago = 0;
|
||||||
|
|
||||||
autoNumericPendientePago.set(pendientePago);
|
autoNumericPendientePago.set(pendientePago);
|
||||||
@ -522,6 +517,8 @@ function deleteConfirmedLinea(params){
|
|||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||||
}
|
}
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
|
tablelineas.clearPipeline().footerCallback().draw();
|
||||||
|
$('#tableOfLineasPagos').DataTable().clearPipeline().footerCallback().draw();
|
||||||
|
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
|
|||||||
@ -185,6 +185,7 @@ editor_pagos.on( 'postSubmit', function ( e, json, data, action ) {
|
|||||||
yeniden(json.<?= csrf_token() ?>);
|
yeniden(json.<?= csrf_token() ?>);
|
||||||
tablePagos.clearPipeline();
|
tablePagos.clearPipeline();
|
||||||
tablePagos.draw();
|
tablePagos.draw();
|
||||||
|
updateFooterLineas(tableLineas);
|
||||||
});
|
});
|
||||||
|
|
||||||
const autoNumericTotalCobrado = new AutoNumeric('#totalCobrado-sum', 0, {
|
const autoNumericTotalCobrado = new AutoNumeric('#totalCobrado-sum', 0, {
|
||||||
@ -340,13 +341,8 @@ var tablePagos = $('#tableOfLineasPagos').DataTable({
|
|||||||
function updateFooterLineas(table){
|
function updateFooterLineas(table){
|
||||||
|
|
||||||
// Assuming pendiente de pago is totalTotal - totalIVA for this example
|
// Assuming pendiente de pago is totalTotal - totalIVA for this example
|
||||||
<?php if($facturaEntity->estado == 'borrador') :?>
|
var total_pagos = autoNumericTotalCobrado.getNumber();
|
||||||
var pendientePago = autoNumericTotal.getNumber();
|
var pendientePago = autoNumericTotal.getNumber() - total_pagos;
|
||||||
var total_pagos = 0;
|
|
||||||
<?php else: ?>
|
|
||||||
var total_pagos = autoNumericTotalCobrado.getNumber();
|
|
||||||
var pendientePago = autoNumericTotal.getNumber() - total_pagos;
|
|
||||||
<?php endif; ?>
|
|
||||||
// Se comprueba si pendientePago es un numero o NAN
|
// Se comprueba si pendientePago es un numero o NAN
|
||||||
if(isNaN(pendientePago)){
|
if(isNaN(pendientePago)){
|
||||||
pendientePago = 0;
|
pendientePago = 0;
|
||||||
@ -363,10 +359,10 @@ function updateFooterLineas(table){
|
|||||||
pendiente: pendientePago
|
pendiente: pendientePago
|
||||||
}
|
}
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
if($('#pendiente-pago').html() == '0.00'){
|
if(autoNumericPendientePago.getNumber() == 0){
|
||||||
$('#addPagoRow').hide();
|
$('#addPagoRow').hide();
|
||||||
} else {
|
} else {
|
||||||
$('#validarFactura').show();
|
$('#addPagoRow').show();
|
||||||
}
|
}
|
||||||
if(data.estado_pago == 'pagada'){
|
if(data.estado_pago == 'pagada'){
|
||||||
$('#estado_pago_text').text('<?= lang('Facturas.pagada') ?>');
|
$('#estado_pago_text').text('<?= lang('Facturas.pagada') ?>');
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?= view("themes/vuexy/form/facturas/_facturaLineasItems") ?>
|
<?= view("themes/vuexy/form/facturas/_facturaLineasItems") ?>
|
||||||
<?php if($facturaEntity->estado !='borrador' && (strpos($facturaEntity->numero, "REC ") !== 0) ) : ?>
|
<?php if((strpos($facturaEntity->numero, "REC ") !== 0) ) : ?>
|
||||||
<?= view("themes/vuexy/form/facturas/_pagosFacturasItems") ?>
|
<?= view("themes/vuexy/form/facturas/_pagosFacturasItems") ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if($facturaEntity->estado !='borrador' && (strpos($facturaEntity->numero, "REC ") === 0) ) : ?>
|
<?php if($facturaEntity->estado !='borrador' && (strpos($facturaEntity->numero, "REC ") === 0) ) : ?>
|
||||||
@ -38,6 +38,9 @@
|
|||||||
name="validarFactura"
|
name="validarFactura"
|
||||||
value="<?= lang("Facturas.validarFactura") ?>"
|
value="<?= lang("Facturas.validarFactura") ?>"
|
||||||
/>
|
/>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if($facturaEntity->showDeleteButton == true && $facturaEntity->estado !='validada') : ?>
|
||||||
<input type="button"
|
<input type="button"
|
||||||
class="btn btn-danger float-start me-sm-3 me-1"
|
class="btn btn-danger float-start me-sm-3 me-1"
|
||||||
id="borrarFactura"
|
id="borrarFactura"
|
||||||
|
|||||||
Reference in New Issue
Block a user