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->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->showDeleteButton = model('App\Models\Facturas\FacturaPagoModel')
|
||||
->where('factura_id', $factura->id)->countAllResults() == 0;
|
||||
|
||||
$this->viewData['facturaEntity'] = $factura;
|
||||
|
||||
$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');
|
||||
// Se actualiza la tabla de lineas de factura
|
||||
$('#tableOfLineasFactura').DataTable().clearPipeline().draw();
|
||||
$('#tableOfLineasPagos').DataTable().clearPipeline().draw();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -455,13 +455,8 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
||||
autoNumericIVA.set(totalIVA);
|
||||
autoNumericTotal.set(totalTotal);
|
||||
|
||||
<?php if($facturaEntity->estado == 'borrador') :?>
|
||||
var pendientePago = totalTotal;
|
||||
var total_pagos = 0;
|
||||
<?php else: ?>
|
||||
var total_pagos = autoNumericTotalCobrado.getNumber();
|
||||
var pendientePago = totalTotal - total_pagos;
|
||||
<?php endif; ?>
|
||||
|
||||
if (isNaN(pendientePago)) pendientePago = 0;
|
||||
|
||||
@ -522,6 +517,8 @@ function deleteConfirmedLinea(params){
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
tablelineas.clearPipeline().footerCallback().draw();
|
||||
$('#tableOfLineasPagos').DataTable().clearPipeline().footerCallback().draw();
|
||||
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
|
||||
@ -185,6 +185,7 @@ editor_pagos.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
tablePagos.clearPipeline();
|
||||
tablePagos.draw();
|
||||
updateFooterLineas(tableLineas);
|
||||
});
|
||||
|
||||
const autoNumericTotalCobrado = new AutoNumeric('#totalCobrado-sum', 0, {
|
||||
@ -340,13 +341,8 @@ var tablePagos = $('#tableOfLineasPagos').DataTable({
|
||||
function updateFooterLineas(table){
|
||||
|
||||
// Assuming pendiente de pago is totalTotal - totalIVA for this example
|
||||
<?php if($facturaEntity->estado == 'borrador') :?>
|
||||
var pendientePago = autoNumericTotal.getNumber();
|
||||
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
|
||||
if(isNaN(pendientePago)){
|
||||
pendientePago = 0;
|
||||
@ -363,10 +359,10 @@ function updateFooterLineas(table){
|
||||
pendiente: pendientePago
|
||||
}
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
if($('#pendiente-pago').html() == '0.00'){
|
||||
if(autoNumericPendientePago.getNumber() == 0){
|
||||
$('#addPagoRow').hide();
|
||||
} else {
|
||||
$('#validarFactura').show();
|
||||
$('#addPagoRow').show();
|
||||
}
|
||||
if(data.estado_pago == 'pagada'){
|
||||
$('#estado_pago_text').text('<?= lang('Facturas.pagada') ?>');
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<?= 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") ?>
|
||||
<?php endif; ?>
|
||||
<?php if($facturaEntity->estado !='borrador' && (strpos($facturaEntity->numero, "REC ") === 0) ) : ?>
|
||||
@ -38,6 +38,9 @@
|
||||
name="validarFactura"
|
||||
value="<?= lang("Facturas.validarFactura") ?>"
|
||||
/>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($facturaEntity->showDeleteButton == true && $facturaEntity->estado !='validada') : ?>
|
||||
<input type="button"
|
||||
class="btn btn-danger float-start me-sm-3 me-1"
|
||||
id="borrarFactura"
|
||||
|
||||
Reference in New Issue
Block a user