mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
commit para mergear antes de ramas nuevas
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>id</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
@ -86,7 +87,7 @@ const actionBtns = function(data) {
|
||||
<div class="row mb-2">
|
||||
<div class="btn-group btn-group-sm"><span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></a>
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>`;
|
||||
@ -97,7 +98,7 @@ const actionBtns = function(data) {
|
||||
<div class="row mb-2">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></a>
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -107,7 +108,7 @@ const actionBtns = function(data) {
|
||||
}
|
||||
};
|
||||
|
||||
var editor = new $.fn.dataTable.Editor( {
|
||||
var editor_lineas = new $.fn.dataTable.Editor( {
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfLineasFacturas') ?>",
|
||||
headers: {
|
||||
@ -121,28 +122,14 @@ var editor = new $.fn.dataTable.Editor( {
|
||||
name: "unidades",
|
||||
|
||||
}, {
|
||||
name: "concepto",
|
||||
type: "textarea"
|
||||
name: "concepto"
|
||||
}, {
|
||||
name: "precio_unidad",
|
||||
|
||||
}, {
|
||||
name: "iva",
|
||||
|
||||
}, {
|
||||
"name": "factura_id",
|
||||
"type": "hidden"
|
||||
}, {
|
||||
"name": "pedido_linea_impresion_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "pedido_maquetacion_id",
|
||||
"type": "hidden"
|
||||
},
|
||||
}
|
||||
]
|
||||
} );
|
||||
|
||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||
editor_lineas.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
d.data[0]['factura_id'] = <?= $facturaEntity->id ?>;
|
||||
}
|
||||
@ -154,12 +141,12 @@ editor.on( 'preSubmit', function ( e, d, type ) {
|
||||
});
|
||||
|
||||
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
editor_lineas.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
|
||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
editor_lineas.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
|
||||
tableLineas.clearPipeline();
|
||||
tableLineas.draw();
|
||||
@ -168,7 +155,7 @@ editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfLineasFactura').on( 'click', 'tbody span.edit', function (e) {
|
||||
editor.inline(
|
||||
editor_lineas.inline(
|
||||
tableLineas.cells(this.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
||||
@ -189,11 +176,41 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
||||
scrollX: true,
|
||||
columns: [
|
||||
{data: null, render: actionBtns},
|
||||
{data: "id"},
|
||||
{data: "pedido_linea_impresion_id"},
|
||||
{data: "pedido_maquetacion_id"},
|
||||
{data: "pedido_id"},
|
||||
{data: "unidades"},
|
||||
{data: "concepto"},
|
||||
{
|
||||
data: "concepto",
|
||||
render: function (data, type, row, meta) {
|
||||
|
||||
// se convierten a float data.total_aceptado y subtotal
|
||||
var total_aceptado = parseFloat(row.total_aceptado);
|
||||
var subtotal = parseFloat(row.subtotal);
|
||||
|
||||
var error_text = '';
|
||||
if(total_aceptado != subtotal){
|
||||
error_text = 'El total del pedido ('+ total_aceptado + '€) no coincide con la línea ('+ subtotal + '€)';
|
||||
}
|
||||
|
||||
return `
|
||||
<div>
|
||||
${data}
|
||||
</div>
|
||||
|
||||
<div class="mt-5">
|
||||
|
||||
<span style="color: red;" id="error-${meta.row}">${error_text}</span>
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<label for="input-${meta.row}">Total aceptado</label>
|
||||
<input readonly type="text" id="input-${meta.row}" value="${row.total_aceptado}">
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
},
|
||||
{data: "precio_unidad"},
|
||||
{data: "iva"},
|
||||
{data: "subtotal"},
|
||||
@ -219,7 +236,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
||||
},
|
||||
{
|
||||
visible: false,
|
||||
targets: [1, 2, 3, 9, 10]
|
||||
targets: [1, 2, 3, 4, 10, 11]
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6 mb-3" <?= $clienteId != 0 ?' style="display:none;"':''?>>
|
||||
<div class="col-sm-6 mb-3" <?= $clienteId != 0 && !(auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) ?' style="display:none;"':''?>>
|
||||
<label for="clienteId" class="form-label">
|
||||
<?= lang('Presupuestos.clienteId') ?>*
|
||||
</label>
|
||||
|
||||
@ -97,7 +97,7 @@
|
||||
$total = $presupuestoEntity->total_aceptado;
|
||||
$iva = $presupuestoEntity->iva_reducido?1.04:1.21;
|
||||
$total *= $iva;
|
||||
$total_unidad = $total / $presupuestoEntity->tirada;
|
||||
$total_unidad = $presupuestoEntity->total_precio_unidad * $iva;;
|
||||
echo '<h4 id="resumenTotalIVA" class="mb-1">Total: ' . round($total, 2) . '€</h4>';
|
||||
echo '<h6 id="resumenPrecioU" class="mb-0">' . round($total_unidad, 4) . '€/ud</h6>'
|
||||
?>
|
||||
|
||||
@ -606,7 +606,7 @@ async function calcularPresupuesto() {
|
||||
if($('#colorColorDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
|
||||
isColor = true;
|
||||
let isHq = false;
|
||||
if($('#colorNegroDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
|
||||
if($('#colorNegroHqDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
|
||||
isHq = true;
|
||||
|
||||
if(!comprobarTiradasPOD()){
|
||||
|
||||
@ -76,6 +76,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($presupuestoEntity->estado_id == 2): ?>
|
||||
<div class="row mt-5">
|
||||
<div class="mb-1">
|
||||
<label for="paginas" class="form-label">
|
||||
<?= lang('Presupuestos.totalAceptado') ?>
|
||||
</label>
|
||||
<input disabled type="text" id="totalAceptado" name="totalAceptado" class="form-control" value="<?= old('paginas', $presupuestoEntity->total_aceptado) ?>" <?php echo ($tipo_impresion_id == 21)?' max=80':'' ?>>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div> <!-- //.accordion-body -->
|
||||
</div> <!-- //.accordion-collapse -->
|
||||
|
||||
@ -177,8 +177,8 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
||||
margenEnvios = parseFloat($('#margenEnvios').attr('val'))
|
||||
}
|
||||
|
||||
var totalCostes = totalPapel + totalImpresion + totalServicios + totalEnvios
|
||||
var totalMargenes = margenPapel + margenImpresion + margenServicios + margenEnvios
|
||||
var totalCostes = parseFloat(totalPapel.toFixed(2)) + parseFloat(totalImpresion.toFixed(2)) + parseFloat(totalServicios.toFixed(2)) + parseFloat(totalEnvios.toFixed(2))
|
||||
var totalMargenes = parseFloat(margenPapel.toFixed(2)) + parseFloat(margenImpresion.toFixed(2)) + parseFloat(margenServicios.toFixed(2)) + parseFloat(margenEnvios.toFixed(2))
|
||||
$('#totalCostes').text((addSeparatorsNF(totalCostes.toFixed(2), ".", ",", ".")) + "€")
|
||||
$('#totalMargenes').text((addSeparatorsNF(totalMargenes.toFixed(2), ".", ",", ".")) + "€")
|
||||
$('#totalCostes').attr('val',(totalCostes).toFixed(2) + '€')
|
||||
@ -251,11 +251,13 @@ function getValuesResumenForm(){
|
||||
formResumen += '&total_presupuesto=' + $('#totalDespuesDecuento').attr('val');
|
||||
formResumen += '&total_precio_unidad=' + $('#precioUnidadPresupuesto').attr('val');
|
||||
|
||||
formResumen += '&total_factor=' + $('#total_factor').text();
|
||||
formResumen += '&total_factor_ponderado=' + $('#total_factor_ponderado').text();
|
||||
// replace , for . in the values
|
||||
formResumen += '&total_factor=' + $('#factor').text().replace(/,/g, '.');
|
||||
formResumen += '&total_factor_ponderado=' + $('#factor_ponderado').text().replace(/,/g, '.');
|
||||
|
||||
if($('#confirmar_presupuesto').prop('checked')){
|
||||
formResumen += '&confirmar=1';
|
||||
formResumen += '&confirmar=1';
|
||||
formResumen += '&total_aceptado=' + $('#totalDespuesDecuento').attr('val');
|
||||
}
|
||||
|
||||
return formResumen
|
||||
|
||||
Reference in New Issue
Block a user