mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into feat/sk-31
This commit is contained in:
@ -120,8 +120,7 @@ $('#addNewPedidoImpresion').on('click', function(){
|
||||
// se ajustan el ancho de las columnas
|
||||
$('#pedidoImpresion').val(null).trigger('change');
|
||||
// Se actualiza la tabla de lineas de factura
|
||||
tableLineas.clearPipeline();
|
||||
$('#tableOfLineasFactura').DataTable().columns.adjust().draw();
|
||||
$('#tableOfLineasFactura').DataTable().clearPipeline().draw();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -17,12 +17,12 @@
|
||||
<th>id</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th><?= lang('Facturas.unidades') ?></th>
|
||||
<th><?= lang('Facturas.concepto') ?></th>
|
||||
<th><?= lang('Facturas.precioUnidad') ?></th>
|
||||
<th><?= lang('Facturas.iva') ?></th>
|
||||
<th><?= lang('Facturas.subtotal') ?></th>
|
||||
<th ></th>
|
||||
<th style="width: 10%;"><?= lang('Facturas.unidades') ?></th>
|
||||
<th ><?= lang('Facturas.concepto') ?></th>
|
||||
<th style="width: 10%;"><?= lang('Facturas.precioUnidad') ?></th>
|
||||
<th style="width: 10%;"><?= lang('Facturas.iva') ?></th>
|
||||
<th style="width: 10%;"><?= lang('Facturas.subtotal') ?></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@ -395,6 +395,10 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
||||
}
|
||||
|
||||
],
|
||||
drawCallback: function() {
|
||||
$(this.api().table().container()).find('table').css('width', '100%');
|
||||
this.api().columns.adjust();
|
||||
},
|
||||
footerCallback: function (row, data, start, end, display) {
|
||||
updateFooterLineas(this.api());
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
<?php endif; ?>
|
||||
<?= view("themes/vuexy/components/chat_internal_factura",data:["modelId" =>$facturaEntity->id,"type" => "factura"]) ?>
|
||||
|
||||
<div class="pt-4">
|
||||
<div class="container-fluid pt-4">
|
||||
<?php if($facturaEntity->estado =='borrador') : ?>
|
||||
<input type="button"
|
||||
class="btn btn-success float-start me-sm-3 me-1"
|
||||
|
||||
@ -1,301 +1,143 @@
|
||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?=$this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?=$this->section('content'); ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?=lang('Facturas.facturasList') ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<h3 class="card-title"><?= lang('Facturas.facturasList') ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
|
||||
<table id="tableOfFacturas" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Facturas.idFactura') ?></th>
|
||||
<th><?= lang('Facturas.numeroFactura') ?></th>
|
||||
<th><?= lang('Facturas.fechaFactura') ?></th>
|
||||
<th><?= lang('Facturas.cliente') ?></th>
|
||||
<th><?= lang('Facturas.base') ?></th>
|
||||
<th><?= lang('Facturas.total') ?></th>
|
||||
<th><?= lang('Facturas.pendiente') ?></th>
|
||||
<input type="hidden" id="cliente_id" value="<?= $cliente_id ?>">
|
||||
|
||||
<table id="tableOfFacturas" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Facturas.idFactura') ?></th>
|
||||
<th><?= lang('Facturas.numeroFactura') ?></th>
|
||||
<th><?= lang('Facturas.fechaFactura') ?></th>
|
||||
<?php if ($cliente_id == -1): ?>
|
||||
<th style="width: 20%;"><?= lang('Facturas.cliente') ?></th>
|
||||
<?php endif; ?>
|
||||
<th><?= lang('Facturas.base') ?></th>
|
||||
<th><?= lang('Facturas.total') ?></th>
|
||||
<th><?= lang('Facturas.pendiente') ?></th>
|
||||
<?php if ($cliente_id == -1): ?>
|
||||
<th><?= lang('Facturas.credito') ?></th>
|
||||
<th><?= lang('Facturas.estado') ?></th>
|
||||
<th><?= lang('Facturas.estadoPago') ?></th>
|
||||
<th><?= lang('Facturas.formaPago') ?></th>
|
||||
<th><?= lang('Facturas.vencimiento') ?></th>
|
||||
<th><?= lang('Facturas.dias') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php endif; ?>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><input type="text" class="form-control factura-filter" name="numero"></th>
|
||||
<th><input id="fechaFactura" type="text" class="form-control factura-filter"
|
||||
name="fecha_factura_at"></th>
|
||||
</th>
|
||||
<?php if ($cliente_id == -1): ?>
|
||||
<th><input type="text" class="form-control factura-filter" name="cliente"></th>
|
||||
<?php endif; ?>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<?php if ($cliente_id == -1): ?>
|
||||
<th>
|
||||
<select class="form-control factura-filter-select" name="creditoAsegurado">
|
||||
<option value=""><?= lang('Facturas.todos')?></option>
|
||||
<option value="0"><?= lang('Basic.global.no') ?></option>
|
||||
<option value="1"><?= lang('Basic.global.yes') ?></option>
|
||||
</select>
|
||||
</th>
|
||||
<th>
|
||||
<select class="form-control factura-filter-select" name="estado">
|
||||
<option value=""><?= lang('Facturas.todos')?></option>
|
||||
<option value="borrador"><?= lang('Facturas.borrador') ?></option>
|
||||
<option value="validada"><?= lang('Facturas.validada') ?></option>
|
||||
</select>
|
||||
</th>
|
||||
<th>
|
||||
<select class="form-control factura-filter-select" name="estado_pago">
|
||||
<option value=""><?= lang('Facturas.todos')?></option>
|
||||
<option value="pendiente"><?= lang('Facturas.pendiente') ?></option>
|
||||
<option value="pagada"><?= lang('Facturas.pagada') ?></option>
|
||||
<option value="insolvente"><?= lang('Facturas.insolvente') ?></option>
|
||||
</select>
|
||||
</th>
|
||||
<th>
|
||||
<select class="form-control factura-filter-select" name="forma_pago">
|
||||
<option value=""><?= lang('Facturas.todos')?></option>
|
||||
<option value="cheque"><?= lang('Facturas.cheque') ?></option>
|
||||
<option value="compensada"><?= lang('Facturas.compensada') ?></option>
|
||||
<option value="confirming"><?= lang('Facturas.confirming') ?></option>
|
||||
<option value="giroDomiciliado"><?= lang('Facturas.giroDomiciliado') ?></option>
|
||||
<option value="pagare"><?= lang('Facturas.pagare') ?></option>
|
||||
<option value="transferencia"><?= lang('Facturas.transferencia') ?></option>
|
||||
</select>
|
||||
</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<?php endif; ?>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!--//.card-body -->
|
||||
<div class="card-footer">
|
||||
|
||||
|
||||
</div><!--//.card-footer -->
|
||||
</div><!--//.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?=$this->section('additionalInlineJs') ?>
|
||||
|
||||
const lastColNr = $('#tableOfFacturas').find("tr:first th").length - 1;
|
||||
const actionBtns = function(data) {
|
||||
if(data.estado == 'borrador'){
|
||||
return `
|
||||
<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
</div>
|
||||
</td>`;
|
||||
}
|
||||
else{
|
||||
return `
|
||||
<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
</div>
|
||||
</td>`;
|
||||
}
|
||||
};
|
||||
|
||||
theTable = $('#tableOfFacturas').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
pageLength: 250,
|
||||
lengthChange: true,
|
||||
"dom": 'lfBrtip',
|
||||
buttons: [
|
||||
{
|
||||
text: 'Exportar Excel Contaplus',
|
||||
action: function (e, dt, button, config) {
|
||||
var searchValue = theTable.search(); // Captura el valor del campo de búsqueda
|
||||
var ajaxParams = theTable.ajax.params(); // Captura otros parámetros de la tabla
|
||||
|
||||
console.log(searchValue);
|
||||
|
||||
/*
|
||||
$.ajax({
|
||||
url: '/ruta/exportarExcel', // URL del servidor para manejar la exportación
|
||||
type: 'POST',
|
||||
data: {
|
||||
search: searchValue,
|
||||
extraParams: ajaxParams
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob' // Para manejar la descarga del archivo
|
||||
},
|
||||
success: function(blob, status, xhr) {
|
||||
// Crear un enlace temporal para descargar el archivo
|
||||
var link = document.createElement('a');
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
link.href = url;
|
||||
link.download = 'datos_personalizados.xlsx';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Exportar Lineas a Excel',
|
||||
action: function (e, dt, button, config) {
|
||||
var searchValue = theTable.search(); // Captura el valor del campo de búsqueda
|
||||
var ajaxParams = theTable.ajax.params(); // Captura otros parámetros de la tabla
|
||||
|
||||
console.log(searchValue);
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Exportar Girosgit ',
|
||||
action: function (e, dt, button, config) {
|
||||
var searchValue = theTable.search(); // Captura el valor del campo de búsqueda
|
||||
var ajaxParams = theTable.ajax.params(); // Captura otros parámetros de la tabla
|
||||
|
||||
console.log(searchValue);
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
stateSave: true,
|
||||
order: [[0, 'asc']],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfFacturas') ?>',
|
||||
method: 'POST',
|
||||
data: function(d, settings){
|
||||
d.cliente_id = "<?= $cliente_id ?>";
|
||||
},
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr]
|
||||
}
|
||||
],
|
||||
columns : [
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'numero' },
|
||||
{ 'data': 'fecha_factura_at' },
|
||||
{ 'data': 'cliente' },
|
||||
{ 'data': 'base' ,render : (d) => `<span class="autonumeric">${d}</span>`},
|
||||
{ 'data': 'total',render : (d) => `<span class="autonumeric">${d}</span>`},
|
||||
{ 'data': 'pendiente',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'creditoAsegurado' ,
|
||||
render: function(data, type, row, meta) {
|
||||
switch(data){
|
||||
case "0":
|
||||
return '<?= lang('Basic.global.no') ?>';
|
||||
break;
|
||||
|
||||
case "1":
|
||||
return '<?= lang('Basic.global.yes') ?>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return '--'; // Debug
|
||||
break;
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
{ 'data': 'estado',
|
||||
render: function(data, type, row, meta) {
|
||||
switch(data){
|
||||
case "borrador":
|
||||
return '<?= lang('Facturas.borrador') ?>';
|
||||
break;
|
||||
|
||||
case "validada":
|
||||
return '<?= lang('Facturas.validada') ?>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return '--'; // Debug
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
{ 'data': 'estado_pago',
|
||||
render: function(data, type, row, meta) {
|
||||
switch(data){
|
||||
case "pendiente":
|
||||
return '<?= lang('Facturas.pendiente') ?>';
|
||||
break;
|
||||
|
||||
case "pagada":
|
||||
return '<?= lang('Facturas.pagada') ?>';
|
||||
break;
|
||||
|
||||
case "insolvente":
|
||||
return '<?= lang('Facturas.insolvente') ?>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return '--'; // Debug
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
{ 'data': 'forma_pago',
|
||||
render: function(data, type, row, meta) {
|
||||
switch(data){
|
||||
case "cheque":
|
||||
return '<?= lang('Facturas.cheque') ?>';
|
||||
break;
|
||||
|
||||
case "compensada":
|
||||
return '<?= lang('Facturas.compensada') ?>';
|
||||
break;
|
||||
|
||||
case "confirming":
|
||||
return '<?= lang('Facturas.confirming') ?>';
|
||||
break;
|
||||
|
||||
case "giroDomiciliado":
|
||||
return '<?= lang('Facturas.giroDomiciliado') ?>';
|
||||
break;
|
||||
|
||||
case "pagare":
|
||||
return '<?= lang('Facturas.pagare') ?>';
|
||||
break;
|
||||
|
||||
case "transferencia":
|
||||
return '<?= lang('Facturas.transferencia') ?>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return data; // Debug
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
{ 'data': 'vencimiento' },
|
||||
{ 'data': 'dias_vencimiento' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
if(<?= $cliente_id ?> != -1){
|
||||
theTable.column(3).visible(false);
|
||||
theTable.column(7).visible(false);
|
||||
theTable.column(8).visible(false);
|
||||
theTable.column(9).visible(false);
|
||||
theTable.column(10).visible(false);
|
||||
theTable.column(11).visible(false);
|
||||
theTable.column(12).visible(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
var url = '<?= route_to('editarFactura', ':id') ?>';
|
||||
url = url.replace(':id', `${$(this).attr('data-id')}` );
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<?=$this->endSection() ?>
|
||||
window.datepickerLang = <?= $datepickerLang; ?>;
|
||||
window.datepickerLocale ='<?= $datepickerLocale; ?>';
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet"
|
||||
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<link rel="stylesheet"
|
||||
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/fixedheader/fixedHeader.dataTables.min.css") ?>">
|
||||
<link rel="stylesheet"
|
||||
href="<?= site_url('themes/vuexy/vendor/libs/bootstrap-daterangepicker/bootstrap-daterangepicker.css') ?>" />
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
<?=$this->endSection() ?>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/moment/moment.js') ?>"></script>
|
||||
<script
|
||||
src="<?= site_url('themes/vuexy/vendor/libs/bootstrap-daterangepicker/bootstrap-daterangepicker.js') ?>"></script>
|
||||
<script
|
||||
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script
|
||||
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
|
||||
<script type="module" src="<?= site_url("assets/js/safekat/pages/facturas/facturasList.js") ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -10,7 +10,11 @@
|
||||
<div id="accordionAlbaranesTip" class="accordion-collapse collapse show" data-bs-parent="#accordioAlbaranes">
|
||||
<div class="accordion-body">
|
||||
|
||||
|
||||
<div id='alert-albaranes' class="alert alert-warning d-flex align-items-baseline d-none" role="alert">
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 id='error-albaranes' class="alert-heading mb-2"></h5>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bonotes_albaranes" class="col-12 d-flex flex-row-reverse mt-4 gap-2">
|
||||
<div id="generar_albaranes" class="btn mt-3 btn-success waves-effect waves-light ml-2">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.generarAlbaranes') ?></span>
|
||||
@ -31,6 +35,8 @@
|
||||
|
||||
<?=$this->section('additionalInlineJs') ?>
|
||||
|
||||
|
||||
|
||||
$('#generar_albaranes').on('click', function(){
|
||||
|
||||
var lineasPedido = $('#tableOfLineasPedido').DataTable();
|
||||
@ -51,6 +57,7 @@ $('#generar_albaranes').on('click', function(){
|
||||
generarAlbaran(item);
|
||||
});
|
||||
}
|
||||
calcular_cantidades_albaranes();
|
||||
}
|
||||
});
|
||||
})
|
||||
@ -163,7 +170,7 @@ function generarAlbaran(item){
|
||||
`;
|
||||
|
||||
const table = $('<table>',
|
||||
{ id: 'tablaAlbaran' + item.albaran.id, width:'100%', class: 'table table-responsive table-striped table-hover' })
|
||||
{ id: 'tablaAlbaran' + item.albaran.id, width:'100%', class: 'table table-responsive table-striped table-hover table-albaran' })
|
||||
.css({
|
||||
'width': '100%',
|
||||
}).append(
|
||||
@ -238,7 +245,6 @@ function generarAlbaran(item){
|
||||
$('#bonotes_albaranes').before(accordion);
|
||||
|
||||
|
||||
|
||||
const datatableAlbaran = new DataTable('#tablaAlbaran' + item.albaran.id,{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
@ -264,7 +270,7 @@ function generarAlbaran(item){
|
||||
var input = $('<input>', {
|
||||
id: 'cantidad_' + row.id,
|
||||
name: 'cantidad_' + row.id,
|
||||
class: 'lp-cell lp-input albaran_linea',
|
||||
class: 'lp-cell lp-input albaran_linea cantidad-albaran',
|
||||
albaran: item.albaran.numero_albaran,
|
||||
type: 'text',
|
||||
value: data,
|
||||
@ -434,38 +440,6 @@ function generarAlbaran(item){
|
||||
}
|
||||
|
||||
},
|
||||
footerCallback: function (row, data, start, end, display) {
|
||||
|
||||
/*
|
||||
let api = this.api();
|
||||
var numColumns = api.columns().count();
|
||||
|
||||
if(item.albaran.mostrar_precios == 1){
|
||||
|
||||
// Remove the formatting to get integer data for summation
|
||||
let intVal = function (i) {
|
||||
return typeof i === 'string'
|
||||
? i.replace(/[\$,]/g, '') * 1
|
||||
: typeof i === 'number'
|
||||
? i
|
||||
: 0;
|
||||
};
|
||||
|
||||
// Total over all pages
|
||||
total = api
|
||||
.column(9)
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Update footer
|
||||
api.column(numColumns-1).footer().innerHTML =
|
||||
'Total: ' + total.toFixed(2);
|
||||
}
|
||||
else{
|
||||
api.column(numColumns-1).footer().innerHTML = '';
|
||||
}
|
||||
*/
|
||||
},
|
||||
});
|
||||
|
||||
// Añadir la nueva fila a la tabla
|
||||
@ -474,6 +448,17 @@ function generarAlbaran(item){
|
||||
datatableAlbaran.row.add(linea).draw();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).on('change', '#tablaAlbaran' + item.albaran.id + ' .cantidad-albaran', function(){
|
||||
let table = $('#tablaAlbaran' + item.albaran.id).DataTable();
|
||||
let row = $(this).closest('tr'); // Encuentra la fila actual
|
||||
let rowIndex = table.row(row).index(); // Obtiene el índice de la fila
|
||||
let newValue = $(this).val(); // Obtiene el nuevo valor del input
|
||||
// Actualiza el DataTable
|
||||
table.cell(rowIndex, 2).data(newValue);
|
||||
calcular_cantidades_albaranes();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('click', '.accordion-button', function(){
|
||||
@ -712,7 +697,6 @@ $(document).on('click', '.imprimir-albaran', function(){
|
||||
|
||||
var albaran_id = $(this).attr('id').split('_').slice(-1)[0];
|
||||
|
||||
//NACHO AQUI
|
||||
window.open('<?= site_url('print-albaran/generar/') ?>' + albaran_id, '_blank');
|
||||
|
||||
});
|
||||
@ -726,7 +710,37 @@ $.ajax({
|
||||
Object.values(response.data).forEach(function(item){
|
||||
generarAlbaran(item);
|
||||
});
|
||||
|
||||
calcular_cantidades_albaranes();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function calcular_cantidades_albaranes(){
|
||||
let cantidad_albaranes = 0;
|
||||
const tablas = $('.table.table-albaran');
|
||||
for(var i = 0; i < tablas.length; i++){
|
||||
var table = $(tablas[i]).DataTable();
|
||||
table.rows().every(function(){
|
||||
cantidad_albaranes += parseInt(this.data().cantidad) || 0;
|
||||
});
|
||||
}
|
||||
check_cantidad_albaranes(cantidad_albaranes);
|
||||
}
|
||||
|
||||
function check_cantidad_albaranes(unidades_albaranes){
|
||||
if(unidades_albaranes != parseInt($('#total_tirada').val()) ){
|
||||
$('#alert-albaranes').removeClass('d-none');
|
||||
$('#error-albaranes').
|
||||
html('<?= lang('Pedidos.validation.errorCantidadAlbaranes') ?>'
|
||||
.replace('{0}', unidades_albaranes)
|
||||
.replace('{1}', $('#total_tirada').val()));
|
||||
}
|
||||
else{
|
||||
$('#alert-albaranes').addClass('d-none');
|
||||
$('#error-albaranes').html('');
|
||||
}
|
||||
}
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
@ -152,6 +152,12 @@
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.cancelar') ?></span>
|
||||
<i class="ti ti-circle-x ti-xs"></i>
|
||||
</div>
|
||||
<?php if ($pedidoEntity->estado == 'validacion' && auth()->user()->can('pedidos-gestion.toprod')) : ?>
|
||||
<div id="button-pedido-to-prod" data-id="<?= $pedidoEntity->id ?>" class="buton-estado btn mt-3 btn-primary waves-effect waves-light ml-2">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang("Produccion.btn_pedido_produccion_accion") ?></span>
|
||||
<i class="ti ti-building-factory-2 ti-xs"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@ -10,12 +10,19 @@
|
||||
<div id="accordionFacturasTip" class="accordion-collapse collapse show" data-bs-parent="#accordioFacturas">
|
||||
<div class="accordion-body">
|
||||
|
||||
<?php if ($pedidoEntity->estado == 'finalizado') : ?>
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="button" class="btn btn-primary btn-md" id="add-factura" ><span><?= lang("Pedidos.addFactura") ?><i class="ti ti-receipt-2 ti-xs"></i></span></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<table id="tableOfFacturas" class="table table-striped table-hover" style="width: 100%;grid-template-columns: 1fr 1fr 6fr 1fr 1fr 1fr;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="max-width:60px;"></th>
|
||||
<th>ID</th>
|
||||
<th><?= lang('Facturas.numeroFactura') ?></th>
|
||||
<th><?= lang('Facturas.ejemplares') ?></th>
|
||||
<th><?= lang('Facturas.serieFacturacion') ?></th>
|
||||
<th><?= lang('Facturas.estado') ?></th>
|
||||
<th><?= lang('Facturas.fechaFactura') ?></th>
|
||||
@ -43,7 +50,7 @@ const actionBtns_facturas = function(data) {
|
||||
</td>`;
|
||||
};
|
||||
|
||||
tablaFacturasPedido = $('#tableOfFacturas').DataTable({
|
||||
window.tablaFacturasPedido = $('#tableOfFacturas').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: true,
|
||||
@ -75,6 +82,7 @@ tablaFacturasPedido = $('#tableOfFacturas').DataTable({
|
||||
{ 'data': actionBtns_facturas },
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'numero' },
|
||||
{ 'data': 'ejemplares'},
|
||||
{ 'data': 'serie' },
|
||||
{ 'data': 'estado',
|
||||
render: function(data, type, row, meta) {
|
||||
|
||||
@ -96,6 +96,10 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
||||
orderable: false,
|
||||
},
|
||||
],
|
||||
drawCallback: function(){
|
||||
$(this.api().table().container()).find('table').css('width', '100%');
|
||||
this.api().columns.adjust();
|
||||
},
|
||||
footerCallback: function (row, data, start, end, display) {
|
||||
let api = this.api();
|
||||
|
||||
@ -124,7 +128,7 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
||||
|
||||
|
||||
$(document).on('click', '.btn-view', function(e) {
|
||||
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')): ?>
|
||||
<?php if (!auth()->user()->inGroup('cliente-admin') && !auth()->user()->inGroup('cliente-editor')): ?>
|
||||
var url = '<?= route_to('editarPresupuestoAdmin', ':id') ?>';
|
||||
<?php else: ?>
|
||||
var url = '<?= route_to('editarPresupuestoCliente2', ':id') ?>';
|
||||
|
||||
@ -31,11 +31,6 @@
|
||||
<div class="pt-4">
|
||||
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
</div><!-- /.card-footer -->
|
||||
<?php if ($pedidoEntity->estado == 'finalizado') : ?>
|
||||
<div class="pt-4">
|
||||
<button type="button" class="btn btn-primary btn-md" id="button-pedido-to-prod" data-id="<?= $pedidoEntity->id ?>"><span> <i class="ti ti-building-factory-2 ti-xs"></i> <?= lang("Produccion.btn_pedido_produccion_accion") ?> </span></button>
|
||||
</div><!-- /.card-footer -->
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid d-flex flex-md-row flex-column justify-content-between align-items-md-center gap-1 container-p-x py-3">
|
||||
@ -70,6 +65,7 @@
|
||||
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/pedidos.css') ?>">
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -89,4 +85,6 @@
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
|
||||
<script type="module" src="<?= site_url("assets/js/safekat/pages/pedidos/pedidos.js") ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -143,6 +143,7 @@
|
||||
<div class="mb-3">
|
||||
<label for="clienteId" class="form-label">
|
||||
<?= lang('Presupuestos.clienteId') ?>*
|
||||
<a id="openCliente" href="javascript(void)" target="_blank" ><i class="ti ti-file-search ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
</label>
|
||||
<select id="clienteId" name="cliente_id" class="form-control select2bs2" style="width: 100%;">
|
||||
</select>
|
||||
|
||||
@ -5,9 +5,11 @@
|
||||
|
||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
||||
<h5 class="mb-1 "> Precio unidad: <span id="resumenPrecioU"></span> €</h5>
|
||||
<h4 class="mb-1 "> Total base: <span id="resumenTotalBase"></span> €</h>
|
||||
<h4 class="mb-1 "> Iva (<span id="resumenIvaPorcentaje"></span>%): <span id="resumenIva"></span> €</h>
|
||||
<h3 class="mt-3 mb-1 fw-bold"> Total: <span id="resumenTotal"></span> €</h>
|
||||
<h4 class="mb-1 "> Total base: <span id="resumenTotalBase"></span> €</h4>
|
||||
<h4 class="mb-1 "> Envío: <span id="resumenTotalEnvio"></span> €</h4>
|
||||
<h4 class="mb-1 "> Total antes de I.V.A: <span id="resumenTotalAntesIVA"></span> €</h4>
|
||||
<h4 class="mb-1 "> Iva (<span id="resumenIvaPorcentaje"></span>%): <span id="resumenIva"></span> €</h4>
|
||||
<h3 class="mt-3 mb-1 fw-bold"> Total: <span id="resumenTotal"></span> €</h3>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div id="divFormaCubierta" class="col-sm-12 mb-3 d-flex flex-column align-items-center">
|
||||
|
||||
@ -86,13 +86,13 @@
|
||||
<label class="form-label"><?= lang('Tickets.prioridad') ?></label>
|
||||
<select id="prioridad" name="prioridad" class="form-control">
|
||||
<option value="baja" <?= $ticket->prioridad == 'baja' ? ' selected' : '' ?>>
|
||||
<?= lang('Tickets.alta') ?>
|
||||
<?= lang('Tickets.baja') ?>
|
||||
</option>
|
||||
<option value="media" <?= $ticket->prioridad == 'media' ? ' selected' : '' ?>>
|
||||
<?= lang('Tickets.media') ?>
|
||||
</option>
|
||||
<option value="alta" <?= $ticket->prioridad == 'alta' ? ' selected' : '' ?>>
|
||||
<?= lang('Tickets.baja') ?>
|
||||
<?= lang('Tickets.alta') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -23,27 +23,23 @@ if (auth()->user()->can('presupuesto.menu')) {
|
||||
</a>
|
||||
<ul class="menu-sub">
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestoadmin/list/1") ?>"
|
||||
class="menu-link">
|
||||
<a href="<?= site_url("presupuestoadmin/list/1") ?>" class="menu-link">
|
||||
<?= lang("App.menu_libros_fresasdo_tapa_dura") ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestoadmin/list/2") ?>"
|
||||
class="menu-link">
|
||||
<a href="<?= site_url("presupuestoadmin/list/2") ?>" class="menu-link">
|
||||
<?= lang("App.menu_libros_fresasdo_tapa_blanda") ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestoadmin/list/3") ?>"
|
||||
class="menu-link">
|
||||
<a href="<?= site_url("presupuestoadmin/list/3") ?>" class="menu-link">
|
||||
<?= lang("App.menu_libros_cosido_tapa_dura") ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestoadmin/list/4") ?>"
|
||||
class="menu-link">
|
||||
<a href="<?= site_url("presupuestoadmin/list/4") ?>" class="menu-link">
|
||||
<?= lang("App.menu_libros_cosido_tapa_blanda") ?>
|
||||
</a>
|
||||
</li>
|
||||
@ -59,8 +55,7 @@ if (auth()->user()->can('presupuesto.menu')) {
|
||||
</li>
|
||||
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestoadmin/list/6") ?>"
|
||||
class="menu-link">
|
||||
<a href="<?= site_url("presupuestoadmin/list/6") ?>" class="menu-link">
|
||||
<?= lang("App.menu_libros_espiral_tapa_blanda") ?>
|
||||
</a>
|
||||
</li>
|
||||
@ -96,7 +91,8 @@ if (auth()->user()->can('presupuesto.menu')) {
|
||||
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestos/tarjetascomerciales") ?>" class="menu-link">
|
||||
<div data-i18n="<?= lang("App.menu_tarjetas_comerciales") ?>"><?= lang("App.menu_tarjetas_comerciales") ?></div>
|
||||
<div data-i18n="<?= lang("App.menu_tarjetas_comerciales") ?>">
|
||||
<?= lang("App.menu_tarjetas_comerciales") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@ -119,18 +115,21 @@ if (auth()->user()->can('presupuesto.menu')) {
|
||||
<ul class="menu-sub">
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestos/dipticos") ?>" class="menu-link">
|
||||
<div data-i18n="<?= lang("App.menu_folleto_diptico") ?>"><?= lang("App.menu_folleto_diptico") ?></div>
|
||||
<div data-i18n="<?= lang("App.menu_folleto_diptico") ?>"><?= lang("App.menu_folleto_diptico") ?>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestos/tripticos") ?>" class="menu-link">
|
||||
<div data-i18n="<?= lang("App.menu_folleto_triptico") ?>"><?= lang("App.menu_folleto_triptico") ?></div>
|
||||
<div data-i18n="<?= lang("App.menu_folleto_triptico") ?>">
|
||||
<?= lang("App.menu_folleto_triptico") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("presupuestos/cuadripticos") ?>" class="menu-link">
|
||||
<div data-i18n="<?= lang("App.menu_folleto_cuadriptico") ?>"><?= lang("App.menu_folleto_cuadriptico") ?></div>
|
||||
<div data-i18n="<?= lang("App.menu_folleto_cuadriptico") ?>">
|
||||
<?= lang("App.menu_folleto_cuadriptico") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -140,8 +139,13 @@ if (auth()->user()->can('presupuesto.menu')) {
|
||||
<div data-i18n="<?= lang("App.menu_calendarios") ?>"><?= lang("App.menu_calendarios") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("/importador") ?>" class="menu-link">
|
||||
<?= lang("App.menu_presupuesto_importador") ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
Reference in New Issue
Block a user