realizado el calculo por horas e introducido en el comparador

This commit is contained in:
Jaime Jiménez
2024-01-03 16:57:55 +01:00
parent fbea595a6b
commit 04f5748cb3
16 changed files with 240 additions and 49 deletions

View File

@ -178,6 +178,18 @@
editor.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
const domain = window.location.origin
fetch(domain + "/clientes/clienteprecios/update/" + -1 , {
method: "POST",
body: JSON.stringify({
plantilla_id: id,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
}),
headers: {
"Content-type": "application/json; charset=UTF-8"
}
})
});
editor.on( 'submitSuccess', function ( e, json, data, action ) {

View File

@ -269,14 +269,14 @@
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.marca') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.maquina') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.numeroPliegos') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.pliegosPedido') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPliego') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.pliegosPedido') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioPliego') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.libro') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalPapelPedido') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.totalPapelPedido') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.lomo') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.peso') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.click') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.horas') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioImpresion') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.total') ?></th>
</tr>
</thead>
@ -334,8 +334,8 @@
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalPapelPedido') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.lomo') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.peso') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.click') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.horas') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioImpresion') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagNegro') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagColor') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalTinta') ?></th>
@ -388,14 +388,14 @@
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.marca') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.maquina') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.numeroPliegos') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.pliegosPedido') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPliego') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.pliegosPedido') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioPliego') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.libro') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalPapelPedido') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.totalPapelPedido') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.lomo') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.peso') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.click') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.horas') ?></th>
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioImpresion') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.total') ?></th>
</tr>
</thead>
@ -694,8 +694,8 @@
{ 'data': 'totalPapelPedido' },
{ 'data': 'lomo' },
{ 'data': 'peso' },
{ 'data': 'click' },
{ 'data': 'totalClicks' },
{ 'data': 'horasMaquina' },
{ 'data': 'precioImpresion' },
{ 'data': 'total' },
{ 'data': 'maquinaId'},
{ 'data': 'maquinaVelocidad'},
@ -752,8 +752,8 @@
{ 'data': 'totalPapelPedido' },
{ 'data': 'lomo' },
{ 'data': 'peso' },
{ 'data': 'click' },
{ 'data': 'totalClicks' },
{ 'data': 'horasMaquina' },
{ 'data': 'precioImpresion' },
{ 'data': 'precioPagNegro' },
{ 'data': 'precioPagColor' },
{ 'data': 'totalTinta' },
@ -808,8 +808,8 @@
{ 'data': 'totalPapelPedido' },
{ 'data': 'lomo' },
{ 'data': 'peso' },
{ 'data': 'click' },
{ 'data': 'totalClicks' },
{ 'data': 'horasMaquina' },
{ 'data': 'precioImpresion' },
{ 'data': 'total' },
{ 'data': 'maquinaId'},
{ 'data': 'maquinaVelocidad'},
@ -845,6 +845,7 @@
papel_generico_id: $(''+ elementos.papel).select2('data')[0].id,
papel_generico: $(''+ elementos.papel).select2('data')[0].text.trim(),
gramaje: $(''+ elementos.gramaje).select2('data')[0].text.trim() ,
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -857,7 +858,7 @@
clearIntLineas(is_color);
if(data.lineas.length >0){
fillIntPlana(data, is_color, is_hq);
selectIntLineas();
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + tableCompIntPlana.rows().count() + ')');
@ -922,6 +923,7 @@
papel_generico_id: $('#compPapelNegro').select2('data')[0].id,
papel_generico: $('#compPapelNegro').select2('data')[0].text.trim(),
gramaje: $('#compGramajeNegro').select2('data')[0].text.trim() ,
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -998,6 +1000,7 @@
papel_generico_id: $('#compPapelCubierta').select2('data')[0].id,
papel_generico: $('#compPapelCubierta').select2('data')[0].text.trim(),
gramaje: $('#compGramajeCubierta').select2('data')[0].text.trim() ,
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -1010,7 +1013,7 @@
clearCubierta();
if(data.lineas.length >0){
fillCubierta(data);
selectCubiertaLineas();
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');

View File

@ -1042,6 +1042,7 @@ $('.insertarLinea').on("click", function (e) {
clear_rotativa();
var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray();
for(row of rows){
if(row['tipo'] =='bn'){
fill_lp_bn(row, true);
@ -1313,6 +1314,7 @@ function calcularPresupuesto_bn(){
papel_generico_id: $('#lp_bn_papel option:selected').val() ,
papel_generico: $('#lp_bn_papel option:selected').text().trim(),
gramaje: $('#lp_bn_gramaje option:selected').text().trim(),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -1553,6 +1555,7 @@ function calcularPresupuesto_color(){
papel_generico_id: $('#lp_color_papel option:selected').val() ,
papel_generico: $('#lp_color_papel option:selected').text().trim(),
gramaje: $('#lp_color_gramaje option:selected').text().trim(),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -1790,6 +1793,7 @@ function calcularPresupuesto_bnhq(){
papel_generico_id: $('#lp_bnhq_papel option:selected').val() ,
papel_generico: $('#lp_bnhq_papel option:selected').text().trim(),
gramaje: $('#lp_bnhq_gramaje option:selected').text().trim(),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -2029,6 +2033,7 @@ function calcularPresupuesto_colorhq(){
papel_generico_id: $('#lp_colorhq_papel option:selected').val() ,
papel_generico: $('#lp_colorhq_papel option:selected').text().trim(),
gramaje: $('#lp_colorhq_gramaje option:selected').text().trim(),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -2285,6 +2290,7 @@ function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=fals
papel_generico_id: $('#lp_rot_bn_papel option:selected').val() ,
papel_generico: $('#lp_rot_bn_papel option:selected').text().trim(),
gramaje: $('#lp_rot_bn_gramaje option:selected').text().trim(),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -2634,6 +2640,7 @@ function calcularPresupuesto_rot_color(fromComparador=false, updatedTipologias=f
papel_generico_id: $('#lp_rot_color_papel option:selected').val() ,
papel_generico: $('#lp_rot_color_papel option:selected').text().trim(),
gramaje: $('#lp_rot_color_gramaje option:selected').text().trim(),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
@ -2993,6 +3000,7 @@ function calcularPresupuesto_cubierta(fromComparador=false, updatedTipologias=fa
papel_generico_id: $('#lp_cubierta_papel option:selected').val() ,
papel_generico: $('#lp_cubierta_papel option:selected').text().trim(),
gramaje: $('#lp_cubierta_gramaje option:selected').text().trim(),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
}

View File

@ -112,6 +112,10 @@ $('.accordion-button').on('click', function (e) {
*******************************/
function getRowFromLineaInt(tipo, linea) {
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas)) ? "" :
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas).toFixed(2);
return {
'tipo': tipo,
'paginas': linea.fields.paginas,
@ -126,10 +130,10 @@ function getRowFromLineaInt(tipo, linea) {
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
'peso': isNaN(parseFloat(linea.fields.peso)) ? "" : parseFloat(linea.fields.peso).toFixed(2),
'click': isNaN(parseFloat(linea.fields.precio_click)) ? "" : parseFloat(linea.fields.precio_click).toFixed(6),
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
'total': isNaN(parseFloat(linea.fields.precio_pedido) + parseFloat(linea.fields.precio_click_pedido)) ?
"" : (parseFloat(linea.fields.precio_pedido) + parseFloat(linea.fields.precio_click_pedido)).toFixed(2),
'horasMaquina': isNaN(parseFloat(linea.fields.horas_maquina)) ? "" : parseFloat(linea.fields.horas_maquina).toFixed(2),
'precioImpresion': $precio_impresion,
'total': isNaN(parseFloat(linea.fields.precio_pedido) + parseFloat($precio_impresion)) ?
"" : (parseFloat(linea.fields.precio_pedido) + parseFloat($precio_impresion)).toFixed(2),
'maquinaId': linea.fields.maquina_id,
'maquinaVelocidad': linea.fields.maquina_velocidad,
'tiempoMaquina': linea.fields.tiempo_maquina,
@ -141,6 +145,9 @@ function getRowFromLineaInt(tipo, linea) {
function getRowFromLineaRot(linea) {
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas)) ? "" :
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas).toFixed(2);
return {
'tipo': 'rotativa',
'paginas': linea.fields.paginas,
@ -156,8 +163,8 @@ function getRowFromLineaRot(linea) {
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
'peso': isNaN(parseFloat(linea.fields.peso)) ? "" : parseFloat(linea.fields.peso).toFixed(2),
'click': isNaN(parseFloat(linea.fields.precio_click)) ? "" : parseFloat(linea.fields.precio_click).toFixed(6),
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
'horasMaquina': isNaN(parseFloat(linea.fields.horas_maquina)) ? "" : parseFloat(linea.fields.horas_maquina).toFixed(2),
'precioImpresion': $precio_impresion,
'precioPagNegro': isNaN(parseFloat(linea.fields.precio_pagina_negro)) ? "" : parseFloat(linea.fields.precio_pagina_negro).toFixed(6),
'precioPagColor': isNaN(parseFloat(linea.fields.precio_pagina_color)) ? "" : parseFloat(linea.fields.precio_pagina_color).toFixed(6),
'totalTinta': isNaN(parseFloat(linea.fields.precio_tinta)) ? "" : parseFloat(linea.fields.precio_tinta).toFixed(2),

View File

@ -457,7 +457,7 @@ function getVisibleTabs() {
$("#tableLineasPresupuesto tbody tr:visible").each(function () {
console.log($(this).attr('id'));
//console.log($(this).attr('id'));
if ($(this).attr('id').indexOf('cubierta') > -1) {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show();
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).show();