hay que corregir el checkeo de lineas con las paginas

This commit is contained in:
jaimejimenezortega
2024-05-20 21:20:09 +02:00
parent 75df199c5d
commit 8b1114dc7f
10 changed files with 20960 additions and 44 deletions

View File

@ -1049,7 +1049,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
if ($extra_info) {
$this->calcular_coste_linea(
$linea,
$cubierta,
$totalPapel,
$margenPapel,
$sumForFactor,
@ -1106,7 +1106,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
if ($extra_info) {
$this->calcular_coste_linea(
$linea,
$linea_sobrecubierta,
$totalPapel,
$margenPapel,
$sumForFactor,
@ -1175,7 +1175,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
if ($extra_info) {
$this->calcular_coste_linea(
$linea,
$guardas,
$totalPapel,
$margenPapel,
$sumForFactor,
@ -1266,8 +1266,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$coste_servicios += floatval($resultado[0]->precio);
if ($extra_info) {
$totalServicios += floatval($resultado[0]->total);
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
$totalServicios += floatval($resultado[0]->precio);
$margenServicios += floatval($resultado[0]->precio) * floatval($resultado[0]->margen) / 100.0;
}
} else if (intval($servicio) == 62) {
// Servicios manipulado

View File

@ -504,12 +504,12 @@ class PresupuestoLineaModel extends \App\Models\BaseModel
'rotativa_clicks_libro' => $new_linea['clicks_libro'],
'rotativa_clicks_total' => $new_linea['clicks_pedido'],
'rotativa_precio_tinta' => $new_linea['precio_tinta'],
'rotativa_mxm' => $new_linea['maquina_velocidad'],
];
}
if (strpos($new_linea['tipo_linea'], 'rot') !== false) {
$data += [
'rotativa_mxm' => $new_linea['maquina_velocidad'],
'rotativa_metros_libro' => $new_linea['metros_papel_libro'],
'rotativa_metros_total' => $new_linea['metros_papel_total'],
'rotativa_velocidad_corte' => $new_linea['velocidad_corte'],

View File

@ -243,7 +243,6 @@ class PresupuestoClienteService extends BaseService
$paginas_negro = $datosPedido->paginas - $paginas_color;
$linea_negro_plana = [];
$linea_color_plana = [];
@ -290,6 +289,7 @@ class PresupuestoClienteService extends BaseService
// Color
if ($paginas_color > 0) {
$datosPedido->paginas = $paginas_color;
for ($i = 0; $i < 2; $i++) {
$lineas = PresupuestoService::obtenerComparadorPlana([
@ -322,7 +322,7 @@ class PresupuestoClienteService extends BaseService
}
);
$linea_color_plana = $linea_color_plana[0]['fields'];
$linea_negro_plana['tipo_linea'] = $isHq ? 'lp_colorhq' : 'lp_color';
$linea_color_plana['tipo_linea'] = $isHq ? 'lp_colorhq' : 'lp_color';
}
}
return [$linea_negro_plana, $linea_color_plana];

View File

@ -1767,6 +1767,20 @@ class PresupuestoService extends BaseService
if(empty($linea))
continue;
if(!array_key_exists('tipo_linea', $linea['fields'])){
if($isColor){
if($isHq)
$linea['fields']['tipo_linea'] = 'lp_colorhq';
else
$linea['fields']['tipo_linea'] = 'lp_color';
}
else{
if($isHq)
$linea['fields']['tipo_linea'] = 'lp_bnhq';
else
$linea['fields']['tipo_linea'] = 'lp_bn';
}
}
array_push($lineas, $linea);
}
}

View File

@ -443,7 +443,7 @@
<div>No existe combinación con las opciones seleccionadas. Pruebe con otro papel/gramaje</div>
</div>
<div class="row guardas">
<div id="divGuardas" class="row guardas">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="impresionGuardas" class="form-label">Impresión de guardas</label>
<select id="impresionGuardas" name="impresionGuardas" class="form-control select2bs2 comp_guardas_items calcular-presupuesto" style="width: 100%;">

View File

@ -2,7 +2,8 @@ function initDirecciones() {
data = {
id: $('#clienteId').val()
},
data = Object.assign(data, window.token_ajax)
data = Object.assign(data, window.token_ajax);
$('#errorDirecciones').hide();
$.ajax({
url: window.routes_direcciones.direcciones,

View File

@ -266,12 +266,16 @@ $('#papelInterior').on('change', function () {
data: datos,
success: function (response) {
$('#gramajeInterior').empty();
$(response.menu).each(function (index, element) {
$('#gramajeInterior').append($("<option />").val(element.id).text(element.text));
});
if(response.menu){
if (valInterior != undefined)
$('#gramajeInterior').empty();
$(response.menu).each(function (index, element) {
$('#gramajeInterior').append($("<option />").val(element.id).text(element.text));
});
}
if (valInterior != undefined && valInterior != '')
$('#gramajeInterior option[value=' + valInterior + ']').prop('selected', true).trigger('change');
else
$('#gramajeInterior').val('').trigger('change');
@ -310,7 +314,7 @@ $('#papelCubierta').on('change', function () {
$('#gramajeCubierta').append($("<option />").val(element.id).text(element.text));
});
if (valCubierta != undefined)
if (valCubierta != undefined && valCubierta != '')
$('#gramajeCubierta option[value=' + valCubierta + ']').prop('selected', true).trigger('change');
else
$('#gramajeCubierta').val('').trigger('change');
@ -647,7 +651,7 @@ async function calcularPresupuesto() {
}
// Si hay sobrecubierta
if ($('.enable-sobrecubierta').is(':visible')) {
if ($('#enableSobrecubierta').is(':checked')) {
if($('#papelSobrecubierta option:selected').val()>0 && $('#gramajeSobrecubierta option:selected').val()>0){
datos.sobrecubierta = {
@ -661,7 +665,7 @@ async function calcularPresupuesto() {
}
}
if ($('.guardas').is(':visible')) {
if ($('#divGuardas').is(':visible')) {
datos.guardas = {
papel: $('#papelGuardas option:selected').val(),
papel_nombre: $('#papelGuardas option:selected').text().trim(),
@ -681,6 +685,7 @@ async function calcularPresupuesto() {
data: datos,
success: function (response) {
error = false;
$('#errorGeneral').hide();
try{
@ -727,32 +732,35 @@ async function calcularPresupuesto() {
$('#divTiradasPrecio').empty();
$('#lomo_cubierta').val(response.lomo_cubierta);
if(!error){
$('#precios').show();
$('#lomo_cubierta').val(response.lomo_cubierta);
if(response.tiradas){
for (i = 0; i < response.tiradas.length; i++) {
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
const label = "tiradaPrecio" + parseInt(i+1);
$('#precios').show();
let html = '';
if(response.tiradas){
for (i = 0; i < response.tiradas.length; i++) {
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
const label = "tiradaPrecio" + parseInt(i+1);
html += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
html += '<div class="list-content">';
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
html += '</div>';
html += '</div>'
html += '</a>';
html += '</div>';
let html = '';
$('#divTiradasPrecio').append(html);
}
}
html += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
html += '<div class="list-content">';
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
html += '</div>';
html += '</div>'
html += '</a>';
html += '</div>';
$('#divTiradasPrecio').append(html);
}
}
}
},
error: function (error) {
$('#loader').hide();

View File

@ -272,7 +272,7 @@
// clientePresupuestoWizardForm.submit()
// or send the form data to server via an Ajax request
// To make the demo simple, I just placed an alert
alert('Submitted..!!');
//alert('Submitted..!!');
});
clientePresupuestoWizardNext.forEach(item => {

View File

@ -171,7 +171,7 @@ function finalizarPresupuesto(confirmar){
}
// Si hay sobrecubierta
if ($('.enable-sobrecubierta').is(':visible')) {
if ($('#enableSobrecubierta').is(':checked')) {
if($('#papelSobrecubierta option:selected').val()>0 && $('#gramajeSobrecubierta option:selected').val()>0){
datos_libro.sobrecubierta = {
@ -181,11 +181,11 @@ function finalizarPresupuesto(confirmar){
acabado: $('#acabadosSobrecubierta').val()
}
datos.sobrecubierta.solapas = $('#anchoSolapasSobrecubierta').val()
datos_libro.sobrecubierta.solapas = $('#anchoSolapasSobrecubierta').val()
}
}
if ($('.guardas').is(':visible')) {
if ($('#divGuardas').is(':visible')) {
datos_libro.guardas = {
papel: $('#papelGuardas option:selected').val(),
papel_nombre: $('#papelGuardas option:selected').text().trim(),
@ -236,7 +236,7 @@ function finalizarPresupuesto(confirmar){
if(Object.keys(response).length > 0) {
if(response.status > 0){
window.location.href = response.url;
//window.location.href = response.url;
}
}

20893
xdebug.log

File diff suppressed because one or more lines are too long