mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en la preview
This commit is contained in:
@ -662,6 +662,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function obtenerComparadorExteriores()
|
||||
{
|
||||
|
||||
@ -1721,7 +1722,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$input_data = [];
|
||||
$input_data['presupuesto'] = $presupuestoEntity;
|
||||
|
||||
return PresupuestoService::checkLineasPresupuesto($input_data, $lineas);
|
||||
return [false, $lineas];
|
||||
}
|
||||
|
||||
protected function getLineasServicios($presupuestoEntity)
|
||||
|
||||
@ -308,7 +308,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$datosPedido = (object) array(
|
||||
'paginas' => $paginas,
|
||||
'tirada' => $tirada[0],
|
||||
'merma' => $tirada[0] > $POD ? $this->calcular_merma($tirada[0], $POD) : 0,
|
||||
'merma' => $this->calcular_merma($tirada[0], $POD),
|
||||
'ancho' => intval($tamanio['ancho']) ?? 100000,
|
||||
'alto' => intval($tamanio['alto']) ?? 100000,
|
||||
'isCosido' => $is_cosido,
|
||||
@ -1057,6 +1057,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$datos_presupuesto['retractilado5'] = $retractilado5;
|
||||
$datos_presupuesto['entrega_taller'] = $reqData['entrega_taller'] ?? 0;
|
||||
|
||||
$resultado_presupuesto['info']['merma'] = $this->calcular_merma($selected_tirada, $POD);
|
||||
|
||||
$id = $model_presupuesto->insertarPresupuestoCliente(
|
||||
$id,
|
||||
$selected_tirada,
|
||||
@ -1074,17 +1076,17 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$this->borrarRelacionesPresupuesto($id);
|
||||
}
|
||||
|
||||
foreach ($resultado_presupuesto['info']['interior'] as $linea) {
|
||||
foreach ($resultado_presupuesto['values']['interior'] as $linea) {
|
||||
|
||||
if (count($linea) > 0)
|
||||
$this->guardarLineaPresupuesto($id, $linea);
|
||||
}
|
||||
if (count($resultado_presupuesto['info']['cubierta']) > 0)
|
||||
$this->guardarLineaPresupuesto($id, $resultado_presupuesto['info']['cubierta']);
|
||||
if (count($resultado_presupuesto['info']['sobrecubierta']) > 0)
|
||||
$this->guardarLineaPresupuesto($id, $resultado_presupuesto['info']['sobrecubierta']);
|
||||
if (count($resultado_presupuesto['info']['guardas']) > 0)
|
||||
$this->guardarLineaPresupuesto($id, $resultado_presupuesto['info']['guardas']);
|
||||
if (count($resultado_presupuesto['values']['cubierta']) > 0)
|
||||
$this->guardarLineaPresupuesto($id, $resultado_presupuesto['values']['cubierta']);
|
||||
if (count($resultado_presupuesto['values']['sobrecubierta']) > 0)
|
||||
$this->guardarLineaPresupuesto($id, $resultado_presupuesto['values']['sobrecubierta']);
|
||||
if (count($resultado_presupuesto['values']['guardas']) > 0)
|
||||
$this->guardarLineaPresupuesto($id, $resultado_presupuesto['values']['guardas']);
|
||||
|
||||
// Servicios
|
||||
if ($sobrecubierta) {
|
||||
@ -1110,13 +1112,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
}
|
||||
foreach ($resultado_presupuesto['info']['serviciosDefecto']['encuadernacion'] as $servicio) {
|
||||
foreach ($resultado_presupuesto['values']['serviciosDefecto']['encuadernacion'] as $servicio) {
|
||||
$this->guardarServicio($id, $servicio, 'encuadernacion');
|
||||
}
|
||||
foreach ($resultado_presupuesto['info']['serviciosDefecto']['manipulado'] as $servicio) {
|
||||
foreach ($resultado_presupuesto['values']['serviciosDefecto']['manipulado'] as $servicio) {
|
||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||
}
|
||||
foreach ($resultado_presupuesto['info']['servicios_automaticos'] as $servicio) {
|
||||
foreach ($resultado_presupuesto['values']['servicios_automaticos'] as $servicio) {
|
||||
if ($servicio->tarifa_id == 3 || $servicio->tarifa_id == 5 || $servicio->tarifa_id == 16) {
|
||||
// Servicios acabado
|
||||
$this->guardarServicio($id, $servicio, 'acabado');
|
||||
@ -1638,7 +1640,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$datosPedido = (object) array(
|
||||
'paginas' => $paginas,
|
||||
'tirada' => $tirada[$t],
|
||||
'merma' => $tirada[$t] > $POD ? $this->calcular_merma($tirada[$t], $POD) : 0,
|
||||
'merma' => $this->calcular_merma($tirada[$t], $POD),
|
||||
'ancho' => intval($tamanio['ancho']) ?? 100000,
|
||||
'alto' => intval($tamanio['alto']) ?? 100000,
|
||||
'isCosido' => $is_cosido,
|
||||
@ -2269,15 +2271,15 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$return_data['info'] = $info;
|
||||
|
||||
|
||||
if ($extra_info) { // && $tirada[$t] == $selected_tirada) {
|
||||
if ($extra_info && ($tirada[$t] == $selected_tirada)) {
|
||||
|
||||
$return_data['info']['interior'] = $interior;
|
||||
$return_data['info']['cubierta'] = $cubierta;
|
||||
$return_data['info']['sobrecubierta'] = $linea_sobrecubierta;
|
||||
$return_data['info']['guardas'] = $guardas;
|
||||
$return_data['info']['serviciosDefecto']['encuadernacion'] = $servDefectoEnc;
|
||||
$return_data['info']['serviciosDefecto']['manipulado'] = $servDefectoMan;
|
||||
$return_data['info']['servicios_automaticos'] = $serviciosAutomaticos;
|
||||
$return_data['values']['interior'] = $interior;
|
||||
$return_data['values']['cubierta'] = $cubierta;
|
||||
$return_data['values']['sobrecubierta'] = $linea_sobrecubierta;
|
||||
$return_data['values']['guardas'] = $guardas;
|
||||
$return_data['values']['serviciosDefecto']['encuadernacion'] = $servDefectoEnc;
|
||||
$return_data['values']['serviciosDefecto']['manipulado'] = $servDefectoMan;
|
||||
$return_data['values']['servicios_automaticos'] = $serviciosAutomaticos;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2392,7 +2394,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$merma = 0;
|
||||
|
||||
if ($tirada > $POD) {
|
||||
$merma = $tirada * 0.1 <= 30 ? $tirada * 0.1 : 30;
|
||||
$merma = $tirada * 0.1;
|
||||
} else {
|
||||
$merma_lineas = [];
|
||||
foreach ($formas_lineas_interior as $formas_linea) {
|
||||
|
||||
@ -196,6 +196,7 @@ return [
|
||||
'totalLinea' => 'TOTAL LÍNEA',
|
||||
'verCalculos' => 'Cálculos',
|
||||
'metrosMinuto' => 'Metros x min.',
|
||||
'clicksMinuto' => 'Clicks x min.',
|
||||
'resolucion' => 'Resolución (dpi)',
|
||||
'areaPaginas' => 'Área páginas (in)',
|
||||
'gotasNegro' => 'Nº gotas negro',
|
||||
|
||||
@ -557,7 +557,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
// -- SOBRECUBIERTA --
|
||||
if ($data['sobrecubierta']) {
|
||||
$values['sobrecubierta'] = array(
|
||||
'papel_id' => intval($data['sobrecubierta']['papel']),
|
||||
'papel_id' => intval($data['sobrecubierta']['papel']['id']),
|
||||
'gramaje' => intval($data['sobrecubierta']['gramaje']),
|
||||
'imprimir' => 1,
|
||||
);
|
||||
|
||||
@ -462,21 +462,21 @@ class PresupuestoService extends BaseService
|
||||
[$data['ancho'], $data['alto']] = PresupuestoService::calculoDimForma($datosPedido, $parametrosRotativa);
|
||||
|
||||
// calculo de papel y clicks
|
||||
$factor_anchura = round($maquina->ancho_impresion / $data['ancho'], 2);
|
||||
$factor_altura = round($maquina->alto_impresion / ($data['alto'] + self::MARGEN_PAGINAS_ROTATIVA), 2);
|
||||
$factor_altura_click = round($maquina->alto_click / ($data['alto'] + self::MARGEN_PAGINAS_ROTATIVA), 2);
|
||||
$factor_anchura = floor($maquina->ancho_impresion / $datosPedido->ancho);
|
||||
$factor_altura = round($maquina->alto_impresion / ($datosPedido->alto + self::MARGEN_PAGINAS_ROTATIVA), 2);
|
||||
$factor_altura_click = round($maquina->alto_click / ($datosPedido->alto + self::MARGEN_PAGINAS_ROTATIVA), 2);
|
||||
|
||||
if (floor($factor_anchura) == 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$multiplicador_pliego = $datosPedido->isCosido ? 4 : 2;
|
||||
$paginas_por_pliego = round(floor($factor_anchura) * $factor_altura * $multiplicador_pliego, 2);
|
||||
//$multiplicador_pliego = $datosPedido->isCosido ? 4 : 2;
|
||||
$paginas_por_pliego = round($factor_anchura * $factor_altura * 2 /** $multiplicador_pliego*/, 2);
|
||||
$pliegos_libro = round($paginas_por_pliego ? $datosPedido->paginas / $paginas_por_pliego : 0, 2);
|
||||
$metros_papel_libro = round($pliegos_libro * ($maquina->alto_impresion / 1000.0), 2);
|
||||
$metros_papel_total = round($metros_papel_libro * ($datosPedido->tirada + $datosPedido->merma), 2);
|
||||
|
||||
$paginas_por_pliego_click = round(floor($factor_anchura) * $factor_altura_click * $multiplicador_pliego, 2);
|
||||
$paginas_por_pliego_click = round($factor_anchura * $factor_altura_click * 2/** $multiplicador_pliego*/, 2);
|
||||
$pliegos_libro_click = round($paginas_por_pliego_click ? $datosPedido->paginas / $paginas_por_pliego_click : 0, 2);
|
||||
$clicks_libro = round(ceil($pliegos_libro_click) * 2, 2);
|
||||
$clicks_pedido = round($clicks_libro * ($datosPedido->tirada + $datosPedido->merma), 2);
|
||||
@ -843,7 +843,7 @@ class PresupuestoService extends BaseService
|
||||
$ancho_total = 0;
|
||||
$sangre_cubierta = self::SANGRE_FORMAS_CUBIERTA;
|
||||
if ($datosPedido->ancho >= 210) {
|
||||
$sangre_cubierta = 15;
|
||||
$sangre_cubierta = 10;
|
||||
}
|
||||
|
||||
if ($datosPedido) {
|
||||
@ -925,7 +925,7 @@ class PresupuestoService extends BaseService
|
||||
$alto_total = floatval($datosPedido->alto);
|
||||
$sangre_cubierta = self::SANGRE_FORMAS_CUBIERTA;
|
||||
if ($datosPedido->alto >= 297) {
|
||||
$sangre_cubierta = 15;
|
||||
$sangre_cubierta = 10;
|
||||
}
|
||||
// Tapa dura (cosido y fresado)
|
||||
if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3) {
|
||||
|
||||
@ -1,370 +0,0 @@
|
||||
/***********************
|
||||
* Funcionamiento general de la página
|
||||
************************/
|
||||
function fill_lp_from_bbdd(){
|
||||
|
||||
window.lineasPresupuestoList.forEach(function(lp) {
|
||||
|
||||
const formas = JSON.parse(lp.formas)
|
||||
lp.dimensiones_maquina = [formas.maquina_ancho, formas.maquina_alto]
|
||||
lp.dimensiones_maquina_impresion = [formas.maquina_impresion_ancho, formas.maquina_impresion_alto]
|
||||
lp.num_formas = {
|
||||
value : formas.formas,
|
||||
num_formas_verticales : formas.formas_v,
|
||||
num_formas_horizontales : formas.formas_h,
|
||||
posicion_formas : formas.formas_orientacion
|
||||
}
|
||||
lp['tipo_maquina'] = lp['maquina_tipo']
|
||||
lp['precio_impresion_horas'] = lp['precio_impresion']
|
||||
lp['margen_impresion_horas'] = lp['margen_impresion']
|
||||
lp['precio_libro'] = lp['libro']
|
||||
lp['precio_pedido'] = lp['total_papel_pedido']
|
||||
lp['total_impresion'] = lp['total_linea']
|
||||
lp['precios_pliegos'] = lp['pliegos_precio']
|
||||
lp['papel_generico_id'] = lp['papel_id']
|
||||
|
||||
dateObj = new Date(lp['tiempo_maquina'] * 1000);
|
||||
hours = dateObj.getUTCHours();
|
||||
minutes = dateObj.getUTCMinutes();
|
||||
seconds = dateObj.getSeconds();
|
||||
lp['tiempo_maquina'] = hours.toString().padStart(2, '0') + ':' +
|
||||
minutes.toString().padStart(2, '0') + ':' +
|
||||
seconds.toString().padStart(2, '0');
|
||||
|
||||
if(lp.maquina_tipo=='inkjet'){
|
||||
|
||||
lp.datosTipologias = {
|
||||
negro: lp.rotativa_negro,
|
||||
cyan: lp.rotativa_cyan,
|
||||
magenta: lp.rotativa_magenta,
|
||||
amarillo: lp.rotativa_amarillo,
|
||||
cg: lp.rotativa_cg,
|
||||
gota_negro: lp.rotativa_gota_negro,
|
||||
gota_color: lp.rotativa_gota_color,
|
||||
}
|
||||
|
||||
lp['paginas_color'] = lp['rotativa_pag_color']
|
||||
|
||||
lp['totalImpresion'] = lp['rotativa_total_impresion']
|
||||
lp['a_favor_fibra'] = lp['rotativa_a_favor_fibra']
|
||||
|
||||
lp['resolucion'] = lp['rotativa_resolucion']
|
||||
lp['superficie'] = lp['rotativa_area_paginas']
|
||||
|
||||
lp['num_gotas_negro'] = lp['rotativa_num_gotas_negro']
|
||||
lp['num_gotas_cyan'] = lp['rotativa_num_gotas_cyan']
|
||||
lp['num_gotas_magenta'] = lp['rotativa_num_gotas_magenta']
|
||||
lp['num_gotas_amarillo'] = lp['rotativa_num_gotas_amarillo']
|
||||
lp['num_gotas_cg'] = lp['rotativa_num_gotas_cg']
|
||||
|
||||
lp['precio_pagina_negro'] = lp['rotativa_precio_pag_negro']
|
||||
lp['precio_pagina_color'] = lp['rotativa_precio_pag_color']
|
||||
lp['factor_altura'] = lp['rotativa_factor_altura']
|
||||
lp['factor_anchura'] = lp['rotativa_factor_anchura']
|
||||
lp['paginas_por_pliego'] = lp['rotativa_pag_por_pliego']
|
||||
|
||||
lp['clicks_libro'] = lp['rotativa_clicks_libro']
|
||||
lp['peso_gotas_negro'] = lp['rotativa_peso_gotas_negro']
|
||||
lp['peso_gotas_cyan'] = lp['rotativa_peso_gotas_cyan']
|
||||
lp['peso_gotas_magenta'] = lp['rotativa_peso_gotas_magenta']
|
||||
lp['peso_gotas_amarillo'] = lp['rotativa_peso_gotas_amarillo']
|
||||
lp['peso_gotas_cg'] = lp['rotativa_peso_gotas_cg']
|
||||
lp['clicks_pedido'] = lp['rotativa_clicks_total']
|
||||
lp['precio_click_pedido'] = lp['precio_click_pedido']
|
||||
lp['margen_click_pedido'] = lp['margen_click_pedido']
|
||||
lp['precio_tinta'] = lp['rotativa_precio_tinta']
|
||||
|
||||
|
||||
lp['peso_gotas_negro_pedido'] = lp['rotativa_peso_gotas_negro_pedido']
|
||||
lp['peso_gotas_cyan_pedido'] = lp['rotativa_peso_gotas_cyan_pedido']
|
||||
lp['peso_gotas_magenta_pedido'] = lp['rotativa_peso_gotas_magenta_pedido']
|
||||
lp['peso_gotas_amarillo_pedido'] = lp['rotativa_peso_gotas_amarillo_pedido']
|
||||
lp['peso_gotas_cg_pedido'] = lp['rotativa_peso_gotas_cg_pedido']
|
||||
|
||||
}
|
||||
if(lp.tipo.includes('rot')){
|
||||
|
||||
lp['maquina_velocidad'] = lp['rotativa_mxm']
|
||||
lp['metros_papel_libro'] = lp['rotativa_metros_libro']
|
||||
lp['metros_papel_total'] = lp['rotativa_metros_total']
|
||||
lp['velocidad_corte'] = lp['rotativa_velocidad_corte']
|
||||
lp['precio_hora_corte'] = lp['rotativa_precio_hora_corte']
|
||||
lp['tiempo_corte'] = lp['rotativa_tiempo_corte']
|
||||
lp['total_corte'] = lp['rotativa_total_corte']
|
||||
}
|
||||
|
||||
lp['areaPaginas'] = lp['rotativa_superficie']
|
||||
|
||||
|
||||
data = processRowData(lp, lp.tipo, lp.tipo.replace(/_/g, '-'));
|
||||
|
||||
var row = tableLineasPresupuesto.row("#" + lp.tipo);
|
||||
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row("#" + lp.tipo);
|
||||
|
||||
row.child(format(row.data())).show();
|
||||
|
||||
switch(lp.tipo){
|
||||
case 'lp_bn':
|
||||
eventos_lp_bn(lp.maquina_tipo=='inkjet'?true:false)
|
||||
break
|
||||
case 'lp_bnhq':
|
||||
eventos_lp_bnhq(lp.maquina_tipo=='inkjet'?true:false)
|
||||
break
|
||||
case 'lp_color':
|
||||
eventos_lp_color(lp.maquina_tipo=='inkjet'?true:false)
|
||||
break
|
||||
case 'lp_colorhq':
|
||||
eventos_lp_colorhq(lp.maquina_tipo=='inkjet'?true:false)
|
||||
break
|
||||
case 'lp_rot_bn':
|
||||
eventos_lp_rot_bn()
|
||||
break
|
||||
case 'lp_rot_color':
|
||||
eventos_lp_rot_color()
|
||||
break
|
||||
case 'lp_cubierta':
|
||||
eventos_lp_cubierta()
|
||||
break
|
||||
case 'lp_sobrecubierta':
|
||||
eventos_lp_sobrecubierta()
|
||||
break
|
||||
case 'lp_guardas':
|
||||
eventos_lp_guardas()
|
||||
lp['paginas_impresion'] = lp.paginas_impresion
|
||||
break
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function fill_bbdd_from_lp(presupuesto_id){
|
||||
|
||||
data=[];
|
||||
|
||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var rowData = this.data();
|
||||
const formas = {
|
||||
maquina_ancho: rowData.maquina_ancho,
|
||||
maquina_alto: rowData.maquina_alto,
|
||||
maquina_impresion_ancho: rowData.maquina_impresion_ancho,
|
||||
maquina_impresion_alto: rowData.maquina_impresion_alto,
|
||||
formas: rowData.formas,
|
||||
formas_v: rowData.formas_v,
|
||||
formas_h: rowData.formas_h,
|
||||
formas_orientacion: rowData.formas_orientacion,
|
||||
}
|
||||
|
||||
var t_maq_str = rowData.tiempo.split(':'); // split it at the colons
|
||||
var t_maq = 0
|
||||
|
||||
if(t_maq_str.length == 3)
|
||||
t_maq = (+t_maq_str[0]) * 3600 + (+t_maq_str[1]) * 60 + (+t_maq_str[2]);
|
||||
|
||||
linea_data = {
|
||||
presupuesto_id: presupuesto_id,
|
||||
tipo: rowData.row_id,
|
||||
paginas: (rowData.row_id=='lp_guardas')?(($('#tipo_impresion_id').val() == 1 || $('#tipo_impresion_id').val() == 3)?8:4):rowData.paginas,
|
||||
papel_id: rowData.papel,
|
||||
gramaje: rowData.gramaje,
|
||||
papel_impresion_id: rowData.papel_impresion_id,
|
||||
papel_impresion: rowData.papel_impresion,
|
||||
maquina_id: rowData.maquina_id,
|
||||
maquina: rowData.maquina,
|
||||
maquina_tipo: rowData.maquinaTipo,
|
||||
tiempo_maquina: t_maq,
|
||||
pliegos_libro: rowData.numeroPliegos,
|
||||
pliegos_pedido: rowData.pliegosPedido,
|
||||
pliegos_precio: rowData.precioPliego,
|
||||
libro: rowData.libro,
|
||||
total_papel_pedido: rowData.totalPapelPedido,
|
||||
margen_papel_pedido: rowData.margenPapelPedido,
|
||||
mano: rowData.lomo,
|
||||
peso: rowData.peso,
|
||||
precio_click: rowData.click,
|
||||
precio_click_pedido: rowData.totalClicks,
|
||||
margen_click_pedido: rowData.margenClicks,
|
||||
check_papel_total: $('#' + rowData.row_id + '_checkPapel').is(":checked")?1:0,
|
||||
check_impresion_total: $('#' + rowData.row_id + '_checkClicks').is(":checked")?1:0,
|
||||
tarifa_impresion_id: rowData.tarifa_impresion_id,
|
||||
formas: JSON.stringify(formas),
|
||||
|
||||
horas_maquina: rowData.horasMaquina,
|
||||
precio_hora: rowData.precioHora,
|
||||
precio_impresion: rowData.precioImpresion,
|
||||
margen_impresion: rowData.margenImpresion,
|
||||
total_linea: rowData.total_linea,
|
||||
}
|
||||
|
||||
if(rowData.row_id=='lp_guardas')
|
||||
linea_data.paginas_impresion = rowData.paginas_impresion
|
||||
|
||||
// maquina rotativa o inkjet
|
||||
if(linea_data.maquina_tipo=='inkjet'){
|
||||
|
||||
linea_data.rotativa_pag_color = rowData.numPagColor
|
||||
|
||||
linea_data.rotativa_total_impresion = rowData.totalImpresion
|
||||
linea_data.rotativa_a_favor_fibra = rowData.aFavorFibra,
|
||||
linea_data.rotativa_negro = rowData.cobNegro
|
||||
linea_data.rotativa_cyan = rowData.cobCyan
|
||||
linea_data.rotativa_magenta = rowData.cobMagenta
|
||||
linea_data.rotativa_amarillo = rowData.cobAmarillo
|
||||
linea_data.rotativa_cg = rowData.cobCG
|
||||
linea_data.rotativa_gota_negro = rowData.gotaNegro
|
||||
linea_data.rotativa_gota_color = rowData.gotaColor
|
||||
|
||||
|
||||
linea_data.rotativa_resolucion = rowData.resolucion
|
||||
linea_data.rotativa_area_paginas = rowData.areaPaginas
|
||||
|
||||
linea_data.rotativa_num_gotas_negro = rowData.gotaNegro
|
||||
linea_data.rotativa_num_gotas_cyan = rowData.gotasCyan
|
||||
linea_data.rotativa_num_gotas_magenta = rowData.gotasMagenta
|
||||
linea_data.rotativa_num_gotas_amarillo = rowData.gotasAmarillo
|
||||
linea_data.rotativa_num_gotas_cg = rowData.gotasCG
|
||||
|
||||
linea_data.rotativa_precio_pag_negro = rowData.precioPagNegro
|
||||
linea_data.rotativa_precio_pag_color = rowData.precioPagColor
|
||||
linea_data.rotativa_factor_altura = rowData.factorAltura
|
||||
linea_data.rotativa_factor_anchura = rowData.factorAnchura
|
||||
linea_data.rotativa_pag_por_pliego = rowData.paginasPliego
|
||||
|
||||
linea_data.rotativa_clicks_libro = rowData.clicksLibro
|
||||
linea_data.rotativa_peso_gotas_negro = rowData.gTintaNegro
|
||||
linea_data.rotativa_peso_gotas_cyan = rowData.gTintaCyan
|
||||
linea_data.rotativa_peso_gotas_magenta = rowData.gTintaMagenta
|
||||
linea_data.rotativa_peso_gotas_amarillo = rowData.gTintaAmarillo
|
||||
linea_data.rotativa_peso_gotas_cg = rowData.gTintaCG
|
||||
linea_data.rotativa_clicks_total = rowData.clicksPedido
|
||||
linea_data.precio_click_pedido = rowData.totalClicksPedido
|
||||
linea_data.rotativa_precio_tinta = rowData.totalTinta
|
||||
|
||||
|
||||
linea_data.rotativa_peso_gotas_negro_pedido = rowData.gTintaNegroPed
|
||||
linea_data.rotativa_peso_gotas_cyan_pedido = rowData.gTintaCyanPed
|
||||
linea_data.rotativa_peso_gotas_magenta_pedido = rowData.gTintaMagentaPed
|
||||
linea_data.rotativa_peso_gotas_amarillo_pedido = rowData.gTintaAmarilloPed
|
||||
linea_data.rotativa_peso_gotas_cg_pedido = rowData.gTintaCGPed
|
||||
|
||||
}
|
||||
if(linea_data.tipo.includes('rot')){
|
||||
|
||||
linea_data.rotativa_mxm = rowData.metrosMinuto
|
||||
linea_data.rotativa_metros_libro = rowData.metrosPapelLibro
|
||||
linea_data.rotativa_metros_total = rowData.metrosPapelTotal
|
||||
linea_data.rotativa_velocidad_corte = rowData.velocidadCorte
|
||||
linea_data.rotativa_precio_hora_corte = rowData.precioHoraCorte
|
||||
linea_data.rotativa_tiempo_corte = rowData.tiempoCorte
|
||||
linea_data.rotativa_total_corte = rowData.totalCorte
|
||||
linea_data.rotativa_a_favor_fibra = rowData.aFavorFibra==true?1:0
|
||||
}
|
||||
|
||||
data.push(linea_data)
|
||||
} );
|
||||
|
||||
var datos = {
|
||||
tipo: 'lineasPresupuesto',
|
||||
datos: data,
|
||||
presupuesto_id: presupuesto_id,
|
||||
}
|
||||
datos = Object.assign(datos, window.token_ajax);
|
||||
|
||||
await $.ajax({
|
||||
type: 'post',
|
||||
url: window.routes_lp.updateDataOfPresupuestoAdmin,
|
||||
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
success:function(response){
|
||||
|
||||
token=response[window.csrf_token];
|
||||
yeniden(token);
|
||||
}
|
||||
}).fail(function (jqXHR, textStatus, error) {
|
||||
// Handle error here
|
||||
console.log(jqXHR)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function checkPaginasPresupuesto(){
|
||||
|
||||
cantidad_total = 0
|
||||
|
||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var rowData = this.data();
|
||||
if(rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
||||
cantidad_total += parseInt(rowData.paginas)
|
||||
})
|
||||
htmlString = ''
|
||||
|
||||
if(cantidad_total != parseInt($('#paginas').val())){
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-bell ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.errores.paginasLP +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)
|
||||
}
|
||||
|
||||
// variable para controlar el foco en los inputs
|
||||
let focused = 0;
|
||||
|
||||
function change_focus(){
|
||||
// se comprueba que el elemento es un input
|
||||
if($('#'+focused).is('input')){
|
||||
if(focused){
|
||||
$('#'+focused).focus();
|
||||
$('#'+focused).select();
|
||||
focused = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
tableLineasPresupuesto.on( 'draw.dt', function () {
|
||||
checkPaginasPresupuesto()
|
||||
getVisibleTabs()
|
||||
} );
|
||||
|
||||
|
||||
$(document).on('click', '.btn-delete-lp', function(e) {
|
||||
|
||||
const row = $(this).closest('tr');
|
||||
data = tableLineasPresupuesto.row( row ).data()
|
||||
tableLineasPresupuesto.row( row )
|
||||
.remove()
|
||||
.draw();
|
||||
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
if(data.row_id == 'lp_guardas')
|
||||
servicioGuardas(false)
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
})
|
||||
|
||||
|
||||
|
||||
@ -21,8 +21,7 @@
|
||||
value="<?= $tipo_impresion_id ?>"></input>
|
||||
<input type="hidden" name="lomo" id="lomo" class="form-control" value=""></input>
|
||||
<input type="hidden" name="lomo_cubierta" id="lomo_cubierta" class="form-control" value=""></input>
|
||||
<input type="hidden" name="lomo_sobrecubierta" id="lomo_sobrecubierta" class="form-control"
|
||||
value="<?= is_null($presupuestoEntity->lomo_sobrecubierta)?0:$presupuestoEntity->lomo_sobrecubierta ?>"></input>
|
||||
<input type="hidden" name="lomo_sobrecubierta" id="lomo_sobrecubierta" class="form-control" value=""></input>
|
||||
<input type="hidden" name="isCosido" id="isCosido" class="form-control"
|
||||
value="<?= $isCosido ?>"></input>
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
|
||||
class previewFormas {
|
||||
|
||||
constructor(container, tipoLibro, tipoTapa, size, datos) {
|
||||
|
||||
this.container = container;
|
||||
@ -19,10 +20,211 @@ class previewFormas {
|
||||
this.solapa = datos.solapas;
|
||||
this.offsetSolapa = 3.0;
|
||||
}
|
||||
if (datos.solapas_sobrecubierta == undefined || datos.solapas_sobrecubierta == null || datos.solapas_sobrecubierta == false) {
|
||||
this.solapas_sobrecubierta = 0;
|
||||
this.offsetSolapa_sobrecubierta = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa_sobrecubierta = datos.solapas_sobrecubierta;
|
||||
this.offsetSolapa_sobrecubierta = 3.0;
|
||||
}
|
||||
this.lomoRedondo = datos.lomoRedondo;
|
||||
|
||||
}
|
||||
|
||||
setContainer(container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
setData(datos) {
|
||||
|
||||
this.ancho = datos.ancho;
|
||||
this.alto = datos.alto;
|
||||
this.lomo = datos.lomo;
|
||||
|
||||
if (datos.solapas == undefined || datos.solapas == null || datos.solapas == false) {
|
||||
this.solapa = 0;
|
||||
this.offsetSolapa = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa = datos.solapas;
|
||||
this.offsetSolapa = 3.0;
|
||||
}
|
||||
this.lomoRedondo = datos.lomoRedondo;
|
||||
}
|
||||
|
||||
previewInteriorPlana(lpTagName, isCosido, isTapaDura) {
|
||||
|
||||
// Local parameters
|
||||
let guardaV = 0;
|
||||
let guardaH = 0;
|
||||
let styleText = {size: 12, family: 'Public Sans'};
|
||||
|
||||
// Get the preview Object parameters
|
||||
getObjetoLP(lpTagName, isCosido, isTapaDura);
|
||||
|
||||
// Configuracion de las guardas
|
||||
// Guarda vertical
|
||||
if (pvObj.nFormasV > 1) {
|
||||
guardaV = 3;
|
||||
}
|
||||
// Guarda horizontal
|
||||
if (pvObj.nFormasH > 1) {
|
||||
guardaH = 3;
|
||||
}
|
||||
// Constantes relativas a las dimnesiones de la forma
|
||||
let LVo = pvObj.altoForma / 2;
|
||||
let LHo = pvObj.anchoForma / 2;
|
||||
|
||||
// Clear the canvas element
|
||||
$('#pv_' + pvObj.idIndex + '_shape').empty();
|
||||
// Get the element for placing the graphical elements
|
||||
var divPlana = document.getElementById('pv_' + pvObj.idIndex + '_shape');
|
||||
var _pvPlana = new Two({fitted: true}).appendTo(divPlana);
|
||||
// Calculate the center of the canvas element
|
||||
var origenPlana = new Two.Vector(_pvPlana.width / 2, _pvPlana.height / 2);
|
||||
|
||||
var areaMaquinaPlana = _pvPlana.makeRectangle(
|
||||
origenPlana.x,
|
||||
origenPlana.y,
|
||||
pvObj.anchoMaquina,
|
||||
pvObj.altoMaquina);
|
||||
areaMaquinaPlana.stroke = 'black';
|
||||
areaMaquinaPlana.fill = '#E69F6E';
|
||||
areaMaquinaPlana.linewidth = 1;
|
||||
|
||||
var areaImpresionPlana = _pvPlana.makeRectangle(
|
||||
origenPlana.x,
|
||||
origenPlana.y,
|
||||
pvObj.anchoImpresion,
|
||||
pvObj.altoImpresion);
|
||||
areaImpresionPlana.stroke = 'red';
|
||||
areaImpresionPlana.fill = '#FCEAF1';
|
||||
areaImpresionPlana.linewidth = 1;
|
||||
|
||||
var formas = [];
|
||||
|
||||
for (let iV = 0; iV < pvObj.nFormasV; iV++) {
|
||||
|
||||
for (let iH = 0; iH < pvObj.nFormasH; iH++) {
|
||||
|
||||
let _offsetX = ((((pvObj.nFormasH - 1) - 2 * iH) * LHo) + (((pvObj.nFormasH - 1) / 2 - iH) * guardaH));
|
||||
let _offsetY = ((((pvObj.nFormasV - 1) - 2 * iV) * LVo) + (((pvObj.nFormasV - 1) / 2 - iV) * guardaV));
|
||||
|
||||
formas[iV + iH] = _pvPlana.makeRectangle(
|
||||
origenPlana.x + _offsetX,
|
||||
origenPlana.y + _offsetY,
|
||||
pvObj.anchoForma,
|
||||
pvObj.altoForma);
|
||||
formas[iV + iH].stroke = 'grey';
|
||||
formas[iV + iH].fill = '#F4F8F2';
|
||||
formas[iV + iH].linewidth = 1;
|
||||
|
||||
// Texts
|
||||
_pvPlana.makeText(pvObj.altoForma, (origenPlana.x + _offsetX) + (pvObj.anchoForma / 2 - 25), (origenPlana.y + _offsetY), styleText);
|
||||
_pvPlana.makeText(pvObj.anchoForma, (origenPlana.x + _offsetX), (origenPlana.y + _offsetY) + (pvObj.altoForma / 2 - 15), styleText);
|
||||
|
||||
}
|
||||
}
|
||||
_pvPlana.update();
|
||||
}
|
||||
|
||||
previewRotativa(lpTagName, isCosido, isTapaDura) {
|
||||
|
||||
// Local parameters
|
||||
let styleText = {size: 12, family: 'Public Sans'};
|
||||
let margenTop = 3;
|
||||
let guardaV = 0;
|
||||
let guardaH = 0;
|
||||
|
||||
// Get the preview Object parameters
|
||||
getObjetoLP(lpTagName, isCosido, isTapaDura);
|
||||
|
||||
// Calculos
|
||||
// Configuracion de las guardas
|
||||
// Guarda vertical
|
||||
if (pvObj.nFormasV > 1) {
|
||||
guardaV = 3;
|
||||
}
|
||||
// Guarda horizontal
|
||||
if (pvObj.nFormasH > 1) {
|
||||
guardaH = 3;
|
||||
}
|
||||
// Constantes relativas al libro
|
||||
let LVo = pvObj.altoForma / 2;
|
||||
let LHo = pvObj.anchoForma / 2;
|
||||
|
||||
// offset Y
|
||||
let nTopForms = (pvObj.altoImpresion / 2.0 - margenTop) / (LVo + guardaV);
|
||||
let yOffset = LVo * getDecimalPart(nTopForms);
|
||||
|
||||
//console.log(yOffset);
|
||||
|
||||
// Clear the canvas element
|
||||
$('#pv_' + pvObj.idIndex + '_shape').empty();
|
||||
// Get the element for placing the graphical elements
|
||||
var divRotativa = document.getElementById('pv_' + pvObj.idIndex + '_shape');
|
||||
var _pvRotativa = new Two({fitted: true}).appendTo(divRotativa);
|
||||
// Calculate the center of the canvas element
|
||||
var origenRotativa = new Two.Vector(_pvRotativa.width / 2, _pvRotativa.height / 2);
|
||||
|
||||
var areaMaquinaRotativa = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x,
|
||||
origenRotativa.y,
|
||||
pvObj.anchoMaquina,
|
||||
pvObj.altoMaquina);
|
||||
areaMaquinaRotativa.stroke = 'black';
|
||||
areaMaquinaRotativa.fill = '#E69F6E';
|
||||
areaMaquinaRotativa.linewidth = 1;
|
||||
|
||||
var areaImpresionRotativa = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x,
|
||||
origenRotativa.y,
|
||||
pvObj.anchoImpresion,
|
||||
pvObj.altoImpresion);
|
||||
areaImpresionRotativa.stroke = 'red';
|
||||
areaImpresionRotativa.fill = '#FCEAF1';
|
||||
areaImpresionRotativa.linewidth = 1;
|
||||
|
||||
var areaClickRotativa = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x,
|
||||
origenRotativa.y - (pvObj.altoImpresion / 2 - pvObj.altoClick / 2),
|
||||
pvObj.anchoImpresion - 10,
|
||||
pvObj.altoClick);
|
||||
areaClickRotativa.stroke = 'blue';
|
||||
//areaClickRotativa.fill = '#FCEAF1';
|
||||
areaClickRotativa.linewidth = 2;
|
||||
|
||||
var formas = [];
|
||||
|
||||
for (let iV = 0; iV < pvObj.nFormasV; iV++) {
|
||||
|
||||
for (let iH = 0; iH < pvObj.nFormasH; iH++) {
|
||||
|
||||
let _offsetX = ((((pvObj.nFormasH - 1) - 2 * iH) * LHo) + (((pvObj.nFormasH - 1) / 2 - iH) * guardaH));
|
||||
let _offsetY = ((((pvObj.nFormasV - 1) - 2 * iV) * LVo) + (((pvObj.nFormasV - 1) / 2 - iV) * guardaV));
|
||||
|
||||
formas[iV + iH] = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x + _offsetX,
|
||||
(origenRotativa.y - yOffset) + _offsetY,
|
||||
pvObj.anchoForma,
|
||||
pvObj.altoForma);
|
||||
formas[iV + iH].stroke = 'grey';
|
||||
formas[iV + iH].fill = '#F4F8F2';
|
||||
formas[iV + iH].linewidth = 1;
|
||||
|
||||
// Texts
|
||||
_pvRotativa.makeText(pvObj.altoForma, (origenRotativa.x + _offsetX) + (pvObj.anchoForma / 2 - 25), ((origenRotativa.y - yOffset) + _offsetY), styleText);
|
||||
_pvRotativa.makeText(pvObj.anchoForma, (origenRotativa.x + _offsetX), ((origenRotativa.y - yOffset) + _offsetY) + (pvObj.altoForma / 2 - 15), styleText);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_pvRotativa.update();
|
||||
|
||||
}
|
||||
|
||||
previewEsquemaCubierta() {
|
||||
|
||||
if (this.tipoLibro.includes("cosido") || this.tipoLibro.includes("fresado")) {
|
||||
@ -242,8 +444,8 @@ class previewFormas {
|
||||
let sangradoTexto = "Sangrado 20 mm";
|
||||
let sangradoValor = parseFloat(20); // mm
|
||||
if (this.ancho >= 210 || this.alto >= 297) {
|
||||
sangradoValor = parseFloat(15); // mm
|
||||
sangradoTexto = "Sangrado 15 mm";
|
||||
sangradoValor = parseFloat(10); // mm
|
||||
sangradoTexto = "Sangrado 10 mm";
|
||||
}
|
||||
let anchoPliegue = parseFloat(7); // mm cajo
|
||||
let altoPliegue = parseFloat(7); // mm
|
||||
|
||||
@ -5,6 +5,7 @@ import DatosGenerales from './sections/datosGenerales.js';
|
||||
import DatosLibro from './sections/datosLibro.js';
|
||||
import Comparador from './sections/comparador.js';
|
||||
import LineasPresupuesto from './sections/lineasPresupuesto.js';
|
||||
import PreviewFormasAdmin from './sections/previewFormasAdmin.js';
|
||||
|
||||
class PresupuestoAdminEdit {
|
||||
|
||||
@ -19,7 +20,6 @@ class PresupuestoAdminEdit {
|
||||
this.lsc = $("#lomo_sobrecubierta");
|
||||
this.cosido = $("#isCosido");
|
||||
this.tipo_impresion = $("#tipo_impresion_id");
|
||||
this.cosido = $("#isCosido");
|
||||
this.POD = $("#POD");
|
||||
|
||||
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
@ -34,7 +34,8 @@ class PresupuestoAdminEdit {
|
||||
{
|
||||
getDimensionLibro: this.getDimensionLibro,
|
||||
});
|
||||
|
||||
|
||||
this.previewFormasAdmin = null;
|
||||
this.calcularPresupuesto = false;
|
||||
}
|
||||
|
||||
@ -45,11 +46,43 @@ class PresupuestoAdminEdit {
|
||||
document.querySelector('.select2-search__field').focus();
|
||||
});
|
||||
|
||||
const impresion_id = $('#tipo_impresion_id').val();
|
||||
let tipoLibro = '';
|
||||
if (impresion_id == 1 || impresion_id == 2) {
|
||||
tipoLibro = 'fresado';
|
||||
} else if (impresion_id == 3 || impresion_id == 4) {
|
||||
tipoLibro ='cosido';
|
||||
} else if (impresion_id == 5 || impresion_id == 6) {
|
||||
tipoLibro ='espiral';
|
||||
} else if (impresion_id == 7 || impresion_id == 8) {
|
||||
tipoLibro = 'wireo';
|
||||
} else if (impresion_id == 21) {
|
||||
tipoLibro = 'grapado';
|
||||
}
|
||||
|
||||
|
||||
this.datosGenerales.init();
|
||||
this.datosLibro.init();
|
||||
this.comparador.init();
|
||||
this.lineasPresupuesto.init();
|
||||
|
||||
this.previewFormasAdmin = new PreviewFormasAdmin(tipoLibro, this.tipoTapa,
|
||||
{
|
||||
ancho: ()=>{return this.getDimensionLibro().ancho},
|
||||
alto: ()=>{return this.getDimensionLibro().alto},
|
||||
lomo: ()=>{$('#lc').val() === '' ? parseFloat('0.0') : parseFloat($('#lc').val())},
|
||||
solapas: ()=>{
|
||||
$('#solapas').prop('checked')?parseFloat($('#solapas_ancho').val()):0
|
||||
},
|
||||
solapas_sobrecubierta: ()=>{
|
||||
$('#solapas_sobrecubierta').prop('checked')?parseFloat($('#solapas_ancho_sobrecubierta').val()):0
|
||||
},
|
||||
lomoRedondo: ()=>{
|
||||
(self.tipo_impresion == 1 || $self.tipo_impresion == 3)?parseFloat($('#compLomoRedondo').val()):0
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
|
||||
setTimeout(() => {
|
||||
@ -88,7 +121,7 @@ class PresupuestoAdminEdit {
|
||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
self.datosLibro.cargarDatos(response.data.datosLibro);
|
||||
self.comparador.cargarDatos(response.data.comparador);
|
||||
|
||||
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
||||
/*self.direcciones.handleChangeCliente();
|
||||
|
||||
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||
|
||||
@ -162,7 +162,7 @@ class Comparador {
|
||||
this.btnInsertarGuardas = $('#insertarGuardasBtn');
|
||||
}
|
||||
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
this.lomoRedondo = $('#compLomoRedondo');
|
||||
this.cabezada = $('#cabezada');
|
||||
}
|
||||
@ -221,7 +221,7 @@ class Comparador {
|
||||
this.papelCubierta.init();
|
||||
this.gramajeCubierta.init();
|
||||
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
this.lomoRedondo.select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: Infinity,
|
||||
@ -355,21 +355,33 @@ class Comparador {
|
||||
this.papelNegro.setOption(datos.json_data.bn.papel_id, datos.json_data.bn.papel_nombre);
|
||||
this.gramajeNegro.setOption(datos.json_data.bn.gramaje, datos.json_data.bn.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasNegro.val(0);
|
||||
}
|
||||
if (datos.json_data.bnhq) {
|
||||
this.paginasNegrohq.val(datos.json_data.bnhq.paginas);
|
||||
this.papelNegrohq.setOption(datos.json_data.bnhq.papel_id, datos.json_data.bnhq.papel_nombre);
|
||||
this.gramajeNegrohq.setOption(datos.json_data.bnhq.gramaje, datos.json_data.bnhq.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasNegrohq.val(0);
|
||||
}
|
||||
if (datos.json_data.color) {
|
||||
this.paginasColor.val(datos.json_data.color.paginas);
|
||||
this.papelColor.setOption(datos.json_data.color.papel_id, datos.json_data.color.papel_nombre);
|
||||
this.gramajeColor.setOption(datos.json_data.color.gramaje, datos.json_data.color.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasColor.val(0);
|
||||
}
|
||||
if (datos.json_data.colorhq) {
|
||||
this.paginasColorhq.val(datos.json_data.colorhq.paginas);
|
||||
this.papelColorhq.setOption(datos.json_data.colorhq.papel_id, datos.json_data.colorhq.papel_nombre);
|
||||
this.gramajeColorhq.setOption(datos.json_data.colorhq.gramaje, datos.json_data.colorhq.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasColorhq.val(0);
|
||||
}
|
||||
if (datos.json_data.cubierta) {
|
||||
this.paginasCubierta.val(datos.json_data.cubierta.paginas);
|
||||
this.papelCubierta.setOption(datos.json_data.cubierta.papel_id, datos.json_data.cubierta.papel_nombre);
|
||||
@ -386,8 +398,8 @@ class Comparador {
|
||||
this.gramajeGuardas.setOption(datos.json_data.guardas.gramaje, datos.json_data.guardas.gramaje);
|
||||
}
|
||||
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
this.lomoRedondo.val(datos.lomoRedondo?1:0).trigger('change');
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
this.lomoRedondo.val(datos.lomoRedondo ? 1 : 0).trigger('change');
|
||||
this.cabezada.val(datos.cabezada).trigger('change');
|
||||
}
|
||||
|
||||
@ -397,7 +409,18 @@ class Comparador {
|
||||
}
|
||||
|
||||
this.cargando = false;
|
||||
this.paginasNegro.trigger('change');
|
||||
if (this.paginasNegro.val() > 0) {
|
||||
this.paginasNegro.trigger('change');
|
||||
}
|
||||
else if (this.paginasNegrohq.val() > 0) {
|
||||
this.paginasNegrohq.trigger('change');
|
||||
}
|
||||
else if (this.paginasColor.val() > 0) {
|
||||
this.paginasColor.trigger('change');
|
||||
}
|
||||
else if (this.paginasColorhq.val() > 0) {
|
||||
this.paginasColorhq.trigger('change');
|
||||
}
|
||||
this.paginasCubierta.trigger('change');
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
||||
this.carasGuardas.trigger('change');
|
||||
@ -789,7 +812,7 @@ class Comparador {
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.cargando)
|
||||
if (!this.cargando)
|
||||
$('#paginas').trigger('change');
|
||||
}
|
||||
|
||||
@ -854,15 +877,21 @@ class Comparador {
|
||||
}
|
||||
for (let element of papeles) {
|
||||
if (element.getVal() == 0 || element.getVal() == null) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
const tipo = element.item.attr('id').split('Papel')[1];
|
||||
if ($('#compPaginas' + tipo).val() > 0) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
}
|
||||
}
|
||||
};
|
||||
for (let element of gramajes) {
|
||||
|
||||
if (element.getVal() == 0 || element.getVal() == null) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
const tipo = element.item.attr('id').split('Papel')[1];
|
||||
if ($('#compPaginas' + tipo).val() > 0) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -961,8 +990,8 @@ class Comparador {
|
||||
cliente_id: $('#clienteId').select2('data')[0].id,
|
||||
papel_generico: papel_generico,
|
||||
gramaje: gramaje,
|
||||
isColor: this.tipo_impresion.val().includes('color')?1:0,
|
||||
isHq: this.tipo_impresion.val().includes('hq')?1:0,
|
||||
isColor: this.tipo_impresion.val().includes('color') ? 1 : 0,
|
||||
isHq: this.tipo_impresion.val().includes('hq') ? 1 : 0,
|
||||
paginas_color: paginasColor
|
||||
}
|
||||
|
||||
@ -970,12 +999,12 @@ class Comparador {
|
||||
datos.datosPedido.lomo = $("#lomo_cubierta").val();
|
||||
datos.datosPedido.solapas = $('#solapas').prop('checked') ? 1 : 0;
|
||||
datos.datosPedido.solapas_ancho = $('#solapas').prop('checked') ? parseInt($('#solapas_ancho').val()) : 0;
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
datos.lomoRedondo = this.lomoRedondo.val();
|
||||
}
|
||||
}
|
||||
else if (uso == 'sobrecubierta') {
|
||||
datos.datosPedido.lomo = $("#lomo_sobrecubierta");
|
||||
datos.datosPedido.lomo = $("#lomo_sobrecubierta").val();
|
||||
datos.datosPedido.solapas = $('#solapas_sobrecubierta').prop('checked') ? 1 : 0;
|
||||
datos.datosPedido.solapas_ancho = $('#solapas_sobrecubierta').prop('checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0;
|
||||
}
|
||||
@ -1041,8 +1070,8 @@ class Comparador {
|
||||
}
|
||||
else {
|
||||
|
||||
const isHq = this.tipo_impresion.val().includes('hq')?1:0;
|
||||
const isColor = this.tipo_impresion.val().includes('color')?1:0;
|
||||
const isHq = this.tipo_impresion.val().includes('hq') ? 1 : 0;
|
||||
const isColor = this.tipo_impresion.val().includes('color') ? 1 : 0;
|
||||
|
||||
datosComp.data['tipo_maquina'] = 'plana';
|
||||
datosComp.data[this.csrf_token] = this.csrf_hash;
|
||||
@ -1085,13 +1114,24 @@ class Comparador {
|
||||
|
||||
// Rotativa
|
||||
if (!isHq) {
|
||||
if (!isColor || (isColor && datosComp.data.papel_generico.negro.id == datosComp.data.papel_generico.color.id &&
|
||||
datosComp.data.gramaje.negro == datosComp.data.gramaje.color)) {
|
||||
if (!isColor ||
|
||||
(isColor && datosComp.data.papel_generico.negro.id == datosComp.data.papel_generico.color.id &&
|
||||
datosComp.data.gramaje.negro == datosComp.data.gramaje.color) ||
|
||||
(isColor && datosComp.data.datosPedido.paginas == parseInt(datosComp.data.paginas_color))) {
|
||||
|
||||
datosComp.data['tipo_maquina'] = 'rotativa';
|
||||
datosComp.data.papel_generico.id = datosComp.data.papel_generico.negro.id;
|
||||
datosComp.data.papel_generico.nombre = datosComp.data.papel_generico.negro.nombre;
|
||||
datosComp.data.gramaje = datosComp.data.gramaje.negro;
|
||||
if (isColor && datosComp.data.datosPedido.paginas == parseInt(datosComp.data.paginas_color)) {
|
||||
datosComp.data.papel_generico.id = datosComp.data.papel_generico.color.id;
|
||||
datosComp.data.papel_generico.nombre = datosComp.data.papel_generico.color.nombre;
|
||||
datosComp.data.gramaje = datosComp.data.gramaje.color;
|
||||
}
|
||||
else {
|
||||
datosComp.data.papel_generico.id = datosComp.data.papel_generico.negro.id;
|
||||
datosComp.data.papel_generico.nombre = datosComp.data.papel_generico.negro.nombre;
|
||||
datosComp.data.gramaje = datosComp.data.gramaje.negro;
|
||||
}
|
||||
|
||||
|
||||
new Ajax('/presupuestoadmin/comparadorinterior',
|
||||
datosComp.data,
|
||||
{},
|
||||
@ -1252,9 +1292,9 @@ class Comparador {
|
||||
if (datosComp.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
datosComp.data[this.csrf_token] = this.csrf_hash;
|
||||
|
||||
|
||||
new Ajax('/presupuestoadmin/comparadorguardas',
|
||||
datosComp.data,
|
||||
{},
|
||||
@ -1271,7 +1311,7 @@ class Comparador {
|
||||
.draw();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
self.selectLineas('guardas');
|
||||
if (self.tableCompGuardas.rows().count() > 0) {
|
||||
$('#title_guardas').html(window.language.Presupuestos.Guardas +
|
||||
@ -1543,7 +1583,7 @@ class Comparador {
|
||||
data_str = JSON.stringify(data)
|
||||
$('#comparador_json_data').val(data_str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default Comparador;
|
||||
@ -461,12 +461,166 @@ class LineasPresupuesto {
|
||||
row.child(self.formatRow(row.data())).show();
|
||||
|
||||
self.#addEventosLineas(lp.tipo, lp.maquina_tipo == 'inkjet' ? true : false);
|
||||
if (lp.tipo=='lp_guardas')
|
||||
lp['paginas_impresion'] = lp.paginas_impresion;
|
||||
|
||||
if (lp.tipo == 'lp_guardas')
|
||||
lp['paginas_impresion'] = lp.paginas_impresion;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
guardarLineasPresupuesto() {
|
||||
|
||||
data = [];
|
||||
|
||||
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
|
||||
var rowData = this.data();
|
||||
|
||||
const formas = {
|
||||
maquina_ancho: rowData.maquina_ancho,
|
||||
maquina_alto: rowData.maquina_alto,
|
||||
maquina_impresion_ancho: rowData.maquina_impresion_ancho,
|
||||
maquina_impresion_alto: rowData.maquina_impresion_alto,
|
||||
formas: rowData.formas,
|
||||
formas_v: rowData.formas_v,
|
||||
formas_h: rowData.formas_h,
|
||||
formas_orientacion: rowData.formas_orientacion,
|
||||
}
|
||||
|
||||
var t_maq_str = rowData.tiempo.split(':'); // split it at the colons
|
||||
var t_maq = 0
|
||||
|
||||
if (t_maq_str.length == 3)
|
||||
t_maq = (+t_maq_str[0]) * 3600 + (+t_maq_str[1]) * 60 + (+t_maq_str[2]);
|
||||
|
||||
linea_data = {
|
||||
presupuesto_id: presupuesto_id,
|
||||
tipo: rowData.row_id,
|
||||
paginas: (rowData.row_id == 'lp_guardas') ? (($('#tipo_impresion_id').val() == 1 || $('#tipo_impresion_id').val() == 3) ? 8 : 4) : rowData.paginas,
|
||||
papel_id: rowData.papel,
|
||||
gramaje: rowData.gramaje,
|
||||
papel_impresion_id: rowData.papel_impresion_id,
|
||||
papel_impresion: rowData.papel_impresion,
|
||||
maquina_id: rowData.maquina_id,
|
||||
maquina: rowData.maquina,
|
||||
maquina_tipo: rowData.maquinaTipo,
|
||||
tiempo_maquina: t_maq,
|
||||
pliegos_libro: rowData.numeroPliegos,
|
||||
pliegos_pedido: rowData.pliegosPedido,
|
||||
pliegos_precio: rowData.precioPliego,
|
||||
libro: rowData.libro,
|
||||
total_papel_pedido: rowData.totalPapelPedido,
|
||||
margen_papel_pedido: rowData.margenPapelPedido,
|
||||
mano: rowData.lomo,
|
||||
peso: rowData.peso,
|
||||
precio_click: rowData.click,
|
||||
precio_click_pedido: rowData.totalClicks,
|
||||
margen_click_pedido: rowData.margenClicks,
|
||||
check_papel_total: $('#' + rowData.row_id + '_checkPapel').is(":checked") ? 1 : 0,
|
||||
check_impresion_total: $('#' + rowData.row_id + '_checkClicks').is(":checked") ? 1 : 0,
|
||||
tarifa_impresion_id: rowData.tarifa_impresion_id,
|
||||
formas: JSON.stringify(formas),
|
||||
|
||||
horas_maquina: rowData.horasMaquina,
|
||||
precio_hora: rowData.precioHora,
|
||||
precio_impresion: rowData.precioImpresion,
|
||||
margen_impresion: rowData.margenImpresion,
|
||||
total_linea: rowData.total_linea,
|
||||
}
|
||||
|
||||
if (rowData.row_id == 'lp_guardas')
|
||||
linea_data.paginas_impresion = rowData.paginas_impresion
|
||||
|
||||
// maquina rotativa o inkjet
|
||||
if (linea_data.maquina_tipo == 'inkjet') {
|
||||
|
||||
linea_data.rotativa_pag_color = rowData.numPagColor
|
||||
|
||||
linea_data.rotativa_total_impresion = rowData.totalImpresion
|
||||
linea_data.rotativa_a_favor_fibra = rowData.aFavorFibra,
|
||||
linea_data.rotativa_negro = rowData.cobNegro
|
||||
linea_data.rotativa_cyan = rowData.cobCyan
|
||||
linea_data.rotativa_magenta = rowData.cobMagenta
|
||||
linea_data.rotativa_amarillo = rowData.cobAmarillo
|
||||
linea_data.rotativa_cg = rowData.cobCG
|
||||
linea_data.rotativa_gota_negro = rowData.gotaNegro
|
||||
linea_data.rotativa_gota_color = rowData.gotaColor
|
||||
|
||||
|
||||
linea_data.rotativa_resolucion = rowData.resolucion
|
||||
linea_data.rotativa_area_paginas = rowData.areaPaginas
|
||||
|
||||
linea_data.rotativa_num_gotas_negro = rowData.gotaNegro
|
||||
linea_data.rotativa_num_gotas_cyan = rowData.gotasCyan
|
||||
linea_data.rotativa_num_gotas_magenta = rowData.gotasMagenta
|
||||
linea_data.rotativa_num_gotas_amarillo = rowData.gotasAmarillo
|
||||
linea_data.rotativa_num_gotas_cg = rowData.gotasCG
|
||||
|
||||
linea_data.rotativa_precio_pag_negro = rowData.precioPagNegro
|
||||
linea_data.rotativa_precio_pag_color = rowData.precioPagColor
|
||||
linea_data.rotativa_factor_altura = rowData.factorAltura
|
||||
linea_data.rotativa_factor_anchura = rowData.factorAnchura
|
||||
linea_data.rotativa_pag_por_pliego = rowData.paginasPliego
|
||||
|
||||
linea_data.rotativa_clicks_libro = rowData.clicksLibro
|
||||
linea_data.rotativa_peso_gotas_negro = rowData.gTintaNegro
|
||||
linea_data.rotativa_peso_gotas_cyan = rowData.gTintaCyan
|
||||
linea_data.rotativa_peso_gotas_magenta = rowData.gTintaMagenta
|
||||
linea_data.rotativa_peso_gotas_amarillo = rowData.gTintaAmarillo
|
||||
linea_data.rotativa_peso_gotas_cg = rowData.gTintaCG
|
||||
linea_data.rotativa_clicks_total = rowData.clicksPedido
|
||||
linea_data.precio_click_pedido = rowData.totalClicksPedido
|
||||
linea_data.rotativa_precio_tinta = rowData.totalTinta
|
||||
|
||||
|
||||
linea_data.rotativa_peso_gotas_negro_pedido = rowData.gTintaNegroPed
|
||||
linea_data.rotativa_peso_gotas_cyan_pedido = rowData.gTintaCyanPed
|
||||
linea_data.rotativa_peso_gotas_magenta_pedido = rowData.gTintaMagentaPed
|
||||
linea_data.rotativa_peso_gotas_amarillo_pedido = rowData.gTintaAmarilloPed
|
||||
linea_data.rotativa_peso_gotas_cg_pedido = rowData.gTintaCGPed
|
||||
|
||||
}
|
||||
if (linea_data.tipo.includes('rot')) {
|
||||
|
||||
linea_data.rotativa_mxm = rowData.metrosMinuto
|
||||
linea_data.rotativa_metros_libro = rowData.metrosPapelLibro
|
||||
linea_data.rotativa_metros_total = rowData.metrosPapelTotal
|
||||
linea_data.rotativa_velocidad_corte = rowData.velocidadCorte
|
||||
linea_data.rotativa_precio_hora_corte = rowData.precioHoraCorte
|
||||
linea_data.rotativa_tiempo_corte = rowData.tiempoCorte
|
||||
linea_data.rotativa_total_corte = rowData.totalCorte
|
||||
linea_data.rotativa_a_favor_fibra = rowData.aFavorFibra == true ? 1 : 0
|
||||
}
|
||||
|
||||
data.push(linea_data)
|
||||
});
|
||||
|
||||
/*
|
||||
var datos = {
|
||||
tipo: 'lineasPresupuesto',
|
||||
datos: data,
|
||||
presupuesto_id: presupuesto_id,
|
||||
}
|
||||
datos = Object.assign(datos, window.token_ajax);
|
||||
|
||||
await $.ajax({
|
||||
type: 'post',
|
||||
url: window.routes_lp.updateDataOfPresupuestoAdmin,
|
||||
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
|
||||
token = response[window.csrf_token];
|
||||
yeniden(token);
|
||||
}
|
||||
}).fail(function (jqXHR, textStatus, error) {
|
||||
// Handle error here
|
||||
console.log(jqXHR)
|
||||
});*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
mostrarTabsPreview() {
|
||||
|
||||
@ -1009,7 +1163,7 @@ class LineasPresupuesto {
|
||||
'<input readonly type="text" id="' + d.row_id + '_factorAnchura" name="' + d.row_id + '_factorAnchura" class="lp-cell lp-cell-disabled lp-input ' + d.row_class + '-input" readonly value="' + d.factorAnchura + '">' +
|
||||
'</div>' : '') +
|
||||
(d.row_id.includes('rot') ? '<div class="col-md-12 col-lg-1">' : '<div class="col-md-12 col-lg-1" style="display:none;">') +
|
||||
window.language.Presupuestos.metrosMinuto +
|
||||
window.language.Presupuestos.clicksMinuto +
|
||||
'<input readonly type="text" id="' + d.row_id + '_metrosMinuto" name="' + d.row_id + '_metrosMinuto" class="lp-cell lp-cell-disabled lp-input ' + d.row_class + '-input" readonly value="' + d.metrosMinuto + '">' +
|
||||
'</div>' +
|
||||
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
import previewFormas from '../../../components/preview.js';
|
||||
import preview from '../../../components/preview.js';
|
||||
|
||||
class PreviewFormasAdmin{
|
||||
|
||||
constructor(tipoLibro, tipoTapa, data){
|
||||
|
||||
this.data = data;
|
||||
this.isCosido = $("#isCosido").val();
|
||||
this.tipoTapa = tipoTapa;
|
||||
|
||||
this.preview = new previewFormas(null, tipoLibro, tipoTapa, "thumbnail", data);
|
||||
}
|
||||
|
||||
setData(data){
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
init(){
|
||||
|
||||
const self = this;
|
||||
|
||||
$('#tab-pv-bn').on( "click", function() {
|
||||
|
||||
self.preview.setData(data);
|
||||
self.preview.previewInteriorPlana('bn', self.isCosido, self.tipoTapa.constains("dura")?1:0);
|
||||
} );
|
||||
/*
|
||||
$('#tab-pv-bnhq').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('bnhq', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-color').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('color', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-colorhq').on( "click", function() {
|
||||
|
||||
|
||||
previewInteriorPlana('colorhq', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-rot-bn').on( "click", function() {
|
||||
|
||||
previewRotativa('rot_bn', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );*/
|
||||
|
||||
$('#tab-pv-rot-color').on( "click", function() {
|
||||
|
||||
self.preview.setData(data);
|
||||
self.preview.previewRotativa('rot_color', self.isCosido, self.tipoTapa.constains("dura")?1:0);
|
||||
|
||||
} );
|
||||
/*
|
||||
$('#tab-pv-guardas').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('guardas', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-cubierta').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('cubierta', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-esquema-cubierta').on( "click", function() {
|
||||
|
||||
previewEsquemaCubierta('ec', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-sobrecubierta').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('sobrecubierta', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );*/
|
||||
}
|
||||
}
|
||||
@ -561,17 +561,17 @@ class PresupuestoCliente {
|
||||
|
||||
popAlert2Hide();
|
||||
|
||||
for (let i = 0; i < tiradas.length; i++) {
|
||||
for (let i = 0; i < response.tiradas.length; i++) {
|
||||
new tarjetaTiradasPrecio(
|
||||
this.divTiradasPrecios,
|
||||
('precio-tiradas-' + response.tiradas[i]),
|
||||
tiradas[i],
|
||||
(parseFloat(response.precio_u[i]) * parseInt(tiradas[i])).toFixed(2),
|
||||
response.tiradas[i],
|
||||
(parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2),
|
||||
response.precio_u[i]
|
||||
);
|
||||
|
||||
if (this.actualizarTiradasEnvio) {
|
||||
this.direcciones.insertTirada(tiradas[i]);
|
||||
this.direcciones.insertTirada(response.tiradas[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user