mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado guardas
This commit is contained in:
@ -345,12 +345,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
$this->viewData['POD'] = $this->getPOD();
|
$this->viewData['POD'] = $this->getPOD();
|
||||||
|
|
||||||
$this->viewData['serviciosCheckboxes'] = [
|
$this->viewData['serviciosAutomaticos'] = [
|
||||||
'retractilado' => 3,
|
'retractilado' => 3,
|
||||||
'retractilado5' => 5,
|
'retractilado5' => 5,
|
||||||
'ferro' => 24,
|
'ferro' => 24,
|
||||||
'prototipo' => 9,
|
'prototipo' => 9,
|
||||||
'fajaColor' => 16,
|
'fajaColor' => 16,
|
||||||
|
'plegadoGuardas' => 62,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
|
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
|
||||||
@ -468,7 +469,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($type=='interior' || 'guardas') {
|
if ($type=='interior' || $type=='guardas') {
|
||||||
|
|
||||||
$datosTipolog = $reqData['negro'] ?? null;
|
$datosTipolog = $reqData['negro'] ?? null;
|
||||||
if(!is_null($datosTipolog)){
|
if(!is_null($datosTipolog)){
|
||||||
@ -487,8 +488,17 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
if ($type=='guardas') {
|
if ($type=='guardas') {
|
||||||
$datosPedido->paginas_impresion = intval($reqData['paginas_impresion']) ?? 0;
|
$datosPedido->paginas_impresion = intval($reqData['paginas_impresion']) ?? 0;
|
||||||
}
|
// Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
|
||||||
|
// y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
|
||||||
|
// o wire-o tapa dura, las guardas se imprimen como hojas sueltas
|
||||||
|
if($tipo_impresion_id == 1 || $tipo_impresion_id == 3){
|
||||||
|
$datosPedido->isCosido = true;
|
||||||
|
}else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7){
|
||||||
|
$datosPedido->isCosido = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$a_favor_fibra = $reqData['a_favor_fibra'] ?? false;
|
$a_favor_fibra = $reqData['a_favor_fibra'] ?? false;
|
||||||
|
|
||||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog, $a_favor_fibra);
|
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog, $a_favor_fibra);
|
||||||
@ -730,7 +740,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
'a_favor_fibra' => $a_favor_fibra, // este parametro se cambia para comprobar
|
'a_favor_fibra' => $a_favor_fibra, // este parametro se cambia para comprobar
|
||||||
// en las dos direcciones (menos en rustica fresada que es siempre 1)
|
// en las dos direcciones (menos en rustica fresada que es siempre 1)
|
||||||
'bnPages' => $isColor?0:$datosPedido->paginas,
|
'bnPages' => $isColor?0:$datosPedido->paginas,
|
||||||
'colorPages' => $isColor?$datosPedido->paginas:0,
|
'colorPages' => ($uso == 'guardas')?$datosPedido->paginas_impresion:($isColor?$datosPedido->paginas:0),
|
||||||
'rotativa_gota_negro' => 0,
|
'rotativa_gota_negro' => 0,
|
||||||
'rotativa_gota_color' => 0,
|
'rotativa_gota_color' => 0,
|
||||||
);
|
);
|
||||||
@ -818,11 +828,26 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$linea['fields']['precio_impresion_horas'] = $precio_hora*(1+$margen_precio_hora/100.0)*$tiempo;
|
$linea['fields']['precio_impresion_horas'] = $precio_hora*(1+$margen_precio_hora/100.0)*$tiempo;
|
||||||
$linea['fields']['margen_impresion_horas'] = $precio_hora*($margen_precio_hora/100.0)*$tiempo;
|
$linea['fields']['margen_impresion_horas'] = $precio_hora*($margen_precio_hora/100.0)*$tiempo;
|
||||||
|
|
||||||
|
// para guardas
|
||||||
|
if(\property_exists($datosPedido, 'paginas_impresion')){
|
||||||
|
$linea['fields']['paginas_impresion'] = $datosPedido->paginas_impresion;
|
||||||
|
}
|
||||||
|
|
||||||
if($maquina->is_inkjet){
|
if($maquina->is_inkjet){
|
||||||
$linea['fields']['a_favor_fibra'] = $parametrosInkjet->a_favor_fibra;
|
$linea['fields']['a_favor_fibra'] = $parametrosInkjet->a_favor_fibra;
|
||||||
$linea['fields']['paginas_color'] = $isColor?$datosPedido->paginas:0;
|
$linea['fields']['paginas_color'] = $isColor?$datosPedido->paginas:0;
|
||||||
$linea['fields']['totalClicksPedido'] = $linea['fields']['precio_click_pedido'];
|
$linea['fields']['totalClicksPedido'] = $linea['fields']['precio_click_pedido'];
|
||||||
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro']) * 2, 2);
|
if( $uso != 'guardas' ){
|
||||||
|
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro']) * 2, 2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if($datosPedido->paginas_impresion == 4)
|
||||||
|
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro']), 2);
|
||||||
|
else if($datosPedido->paginas_impresion == 8)
|
||||||
|
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro'])*2, 2);
|
||||||
|
else
|
||||||
|
$linea['fields']['clicks_libro'] = 0;
|
||||||
|
}
|
||||||
$linea['fields']['clicks_pedido'] = round($linea['fields']['clicks_libro'] * ($datosPedido->tirada + $datosPedido->merma), 2);
|
$linea['fields']['clicks_pedido'] = round($linea['fields']['clicks_libro'] * ($datosPedido->tirada + $datosPedido->merma), 2);
|
||||||
[$ancho, $alto] = PresupuestoService::calculoDimForma($datosPedido, $parametrosInkjet);
|
[$ancho, $alto] = PresupuestoService::calculoDimForma($datosPedido, $parametrosInkjet);
|
||||||
$linea['fields']['factor_anchura'] = round($maquina->ancho_impresion / $ancho, 2);
|
$linea['fields']['factor_anchura'] = round($maquina->ancho_impresion / $ancho, 2);
|
||||||
|
|||||||
@ -10,6 +10,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"presupuesto_id" => null,
|
"presupuesto_id" => null,
|
||||||
"tipo" => null,
|
"tipo" => null,
|
||||||
"paginas" => 0,
|
"paginas" => 0,
|
||||||
|
"paginas_impresion" => 0, //guardas
|
||||||
"paginas_color_posicion" => null,
|
"paginas_color_posicion" => null,
|
||||||
"solapas_ancho" => 0.0,
|
"solapas_ancho" => 0.0,
|
||||||
"papel_id" => null,
|
"papel_id" => null,
|
||||||
@ -79,6 +80,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
"presupuesto_id" => "int",
|
"presupuesto_id" => "int",
|
||||||
"paginas" => "int",
|
"paginas" => "int",
|
||||||
|
"paginas_impresion" => "int", // guardas
|
||||||
"solapas_ancho" => "float",
|
"solapas_ancho" => "float",
|
||||||
"papel_id" => "?int",
|
"papel_id" => "?int",
|
||||||
"papel_impresion_id" => "?int",
|
"papel_impresion_id" => "?int",
|
||||||
@ -140,3 +142,4 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"total_linea" => "double",
|
"total_linea" => "double",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,6 +296,8 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
|||||||
$builder->where("t1.cubierta", 1);
|
$builder->where("t1.cubierta", 1);
|
||||||
else if ($uso == 'sobrecubierta')
|
else if ($uso == 'sobrecubierta')
|
||||||
$builder->where("t1.sobrecubierta", 1);
|
$builder->where("t1.sobrecubierta", 1);
|
||||||
|
else if ($uso == 'guardas')
|
||||||
|
$builder->where("t1.guardas", 1);
|
||||||
else{
|
else{
|
||||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||||
$builder->where("t1.bn", 1);
|
$builder->where("t1.bn", 1);
|
||||||
|
|||||||
@ -12,11 +12,12 @@ class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $useAutoIncrement = true;
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"presupuesto_id",
|
"presupuesto_id",
|
||||||
"tipo",
|
"tipo",
|
||||||
"paginas",
|
"paginas",
|
||||||
|
"paginas_impresion", //guardas
|
||||||
"paginas_color_posicion",
|
"paginas_color_posicion",
|
||||||
"solapas_ancho",
|
"solapas_ancho",
|
||||||
"papel_id",
|
"papel_id",
|
||||||
|
|||||||
@ -87,11 +87,18 @@ class PresupuestoService extends BaseService
|
|||||||
alto: $datosPedido->alto,
|
alto: $datosPedido->alto,
|
||||||
gramaje: $papel_impresion->gramaje,
|
gramaje: $papel_impresion->gramaje,
|
||||||
paginas: $datosPedido->paginas
|
paginas: $datosPedido->paginas
|
||||||
);
|
);
|
||||||
|
|
||||||
// impresion
|
// impresion
|
||||||
$precio_click = $tarifa;
|
$precio_click = $tarifa;
|
||||||
$precio_click_pedido = $pliegos_pedido * 2 * $precio_click;
|
if($uso=='guardas'){
|
||||||
|
if(floatval($datosPedido->paginas_impresion)==0)
|
||||||
|
$precio_click_pedido = 0;
|
||||||
|
elseif (floatval($datosPedido->paginas_impresion)==4) // Una cara
|
||||||
|
$precio_click_pedido = $pliegos_pedido * $precio_click;
|
||||||
|
else // dos caras (impresion normal)
|
||||||
|
$precio_click_pedido = $pliegos_pedido * 2 * $precio_click;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// cubierta o sobrecubierta (siempre a color)
|
// cubierta o sobrecubierta (siempre a color)
|
||||||
@ -378,13 +385,6 @@ class PresupuestoService extends BaseService
|
|||||||
else{
|
else{
|
||||||
$anchoForCalculo = $ancho;
|
$anchoForCalculo = $ancho;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates a message like: User 123 logged into the system from 127.0.0.1
|
|
||||||
$info = [
|
|
||||||
'isCosido' => $forzar_a_favor_fibra,
|
|
||||||
];
|
|
||||||
|
|
||||||
log_message('error', 'isCosido en formas planas: {isCosido}', $info);
|
|
||||||
|
|
||||||
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
||||||
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
|
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
|
||||||
|
|||||||
@ -687,12 +687,12 @@
|
|||||||
$('#compPapelGuardas').select2({
|
$('#compPapelGuardas').select2({
|
||||||
allowClear: false,
|
allowClear: false,
|
||||||
});
|
});
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
$('#compCarasGuardas').select2({
|
$('#compCarasGuardas').select2({
|
||||||
allowClear: false,
|
allowClear: false,
|
||||||
minimumResultsForSearch: Infinity,
|
minimumResultsForSearch: Infinity,
|
||||||
});
|
});
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
updatePapelesComparador();
|
updatePapelesComparador();
|
||||||
const paginasColor = document.getElementById('compCalPaginasColor');
|
const paginasColor = document.getElementById('compCalPaginasColor');
|
||||||
@ -701,7 +701,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
computarPaginasColor($('#compPosPaginasColor').val());
|
computarPaginasColor($('#compPosPaginasColor').val());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_lineas_comparador(){
|
function init_lineas_comparador(){
|
||||||
@ -752,7 +751,7 @@
|
|||||||
}catch(e){}
|
}catch(e){}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$("#compCarasCubierta").val(parseInt(comp_data.cubierta.paginas)).trigger('select2:select');
|
$("#compCarasCubierta").val(parseInt(comp_data.cubierta.paginas)).change();
|
||||||
try{
|
try{
|
||||||
$("#compPapelCubierta").val(parseInt(comp_data.cubierta.papel_id)).trigger('select2:select');
|
$("#compPapelCubierta").val(parseInt(comp_data.cubierta.papel_id)).trigger('select2:select');
|
||||||
|
|
||||||
@ -765,6 +764,11 @@
|
|||||||
}catch(e){}
|
}catch(e){}
|
||||||
}catch(e){}
|
}catch(e){}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$("#compCarasGuardas").val(parseInt(comp_data.guardas.paginas_impresion)).change();
|
||||||
|
$("#compPapelGuardas").val(parseInt(comp_data.guardas.papel_id)).trigger('change');
|
||||||
|
}catch(e){}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tableCompIntPlana = new DataTable('#tableCompIntPlana',{
|
var tableCompIntPlana = new DataTable('#tableCompIntPlana',{
|
||||||
@ -976,11 +980,12 @@
|
|||||||
{ 'data': 'tiempoMaquina'},
|
{ 'data': 'tiempoMaquina'},
|
||||||
{ 'data': 'papelGenericoId'},
|
{ 'data': 'papelGenericoId'},
|
||||||
{ 'data': 'papelImpresionId'},
|
{ 'data': 'papelImpresionId'},
|
||||||
{ 'data': 'tarifa_impresion_id'}
|
{ 'data': 'tarifa_impresion_id'},
|
||||||
|
{ 'data': 'paginas_impresion'},
|
||||||
],
|
],
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{
|
{
|
||||||
target: [16,17,18,19,20,21],
|
target: [16,17,18,19,20,21,22],
|
||||||
visible: false,
|
visible: false,
|
||||||
searchable: false
|
searchable: false
|
||||||
},
|
},
|
||||||
@ -989,7 +994,7 @@
|
|||||||
|
|
||||||
function checkComparadorGuardas(actualizarLinea = false){
|
function checkComparadorGuardas(actualizarLinea = false){
|
||||||
|
|
||||||
if ($('#compPapelGuardas').select2('data').length > 0 ){
|
if ($('#compPapelGuardas').select2('data')[0].id > 0 ){
|
||||||
|
|
||||||
const dimension = getDimensionLibro();
|
const dimension = getDimensionLibro();
|
||||||
|
|
||||||
@ -1020,18 +1025,16 @@
|
|||||||
clearGuardas();
|
clearGuardas();
|
||||||
|
|
||||||
if(data.lineas.length >0){
|
if(data.lineas.length >0){
|
||||||
/*
|
fillGuardas(data);
|
||||||
fillCubierta(data);
|
selectGuardasLineas();
|
||||||
selectCubiertaLineas();
|
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>' + ' (' + tableCompGuardas.rows().count() + ')');
|
||||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
|
$('#insertarGuardasBtn').removeClass('d-none')
|
||||||
$('#insertarCubiertaBtn').removeClass('d-none')
|
|
||||||
if(actualizarLinea){
|
if(actualizarLinea){
|
||||||
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||||
for(row of rows){
|
for(row of rows){
|
||||||
fill_lp_cubierta(row, true);
|
fill_lp_guardas(row, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>');
|
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>');
|
||||||
@ -1056,7 +1059,7 @@
|
|||||||
|
|
||||||
$('.comp_guardas_items').on('change', function (e) {
|
$('.comp_guardas_items').on('change', function (e) {
|
||||||
|
|
||||||
checkComparadorGuardas(false,false);
|
checkComparadorGuardas(false);
|
||||||
});
|
});
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
@ -1215,7 +1218,7 @@
|
|||||||
|
|
||||||
function checkComparadorCubierta(actualizarLinea = false){
|
function checkComparadorCubierta(actualizarLinea = false){
|
||||||
|
|
||||||
if ($('#compCarasCubierta').select2('data').length > 0 &&
|
if ($('#compCarasCubierta option:selected').val().length > 0 &&
|
||||||
$('#compPapelCubierta').select2('data').length > 0 &&
|
$('#compPapelCubierta').select2('data').length > 0 &&
|
||||||
$('#compGramajeCubierta').select2('data').length > 0 ){
|
$('#compGramajeCubierta').select2('data').length > 0 ){
|
||||||
|
|
||||||
@ -1224,7 +1227,7 @@
|
|||||||
let datos = {
|
let datos = {
|
||||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||||
type: 'cubierta',
|
type: 'cubierta',
|
||||||
paginas: parseInt($('#compCarasCubierta').select2('data')[0].id),
|
paginas: parseInt($('#compCarasCubierta option:selected').val()),
|
||||||
tirada: parseInt($('#tirada').val()),
|
tirada: parseInt($('#tirada').val()),
|
||||||
merma: parseInt($('#mermacubierta').val()),
|
merma: parseInt($('#mermacubierta').val()),
|
||||||
color: 1,
|
color: 1,
|
||||||
@ -1656,6 +1659,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
init_comparador()
|
init_comparador()
|
||||||
init_lineas_comparador()
|
init_lineas_comparador()
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -609,12 +609,12 @@
|
|||||||
|
|
||||||
function servicioRetractilado(){
|
function servicioRetractilado(){
|
||||||
if($('#retractilado').prop('checked')){
|
if($('#retractilado').prop('checked')){
|
||||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['retractilado'] ?>)
|
$('#add_servicio_acabado_list').val(<?php echo $serviciosAutomaticos['retractilado'] ?>)
|
||||||
$('#insertar_serv_acabado').click()
|
$('#insertar_serv_acabado').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['retractilado'] ?> ? true : false;
|
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['retractilado'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||||
@ -625,12 +625,12 @@
|
|||||||
|
|
||||||
function servicioRetractilado5(){
|
function servicioRetractilado5(){
|
||||||
if($('#retractilado5').prop('checked')){
|
if($('#retractilado5').prop('checked')){
|
||||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['retractilado5'] ?>)
|
$('#add_servicio_acabado_list').val(<?php echo $serviciosAutomaticos['retractilado5'] ?>)
|
||||||
$('#insertar_serv_acabado').click()
|
$('#insertar_serv_acabado').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['retractilado5'] ?> ? true : false;
|
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['retractilado5'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||||
@ -641,12 +641,12 @@
|
|||||||
|
|
||||||
function servicioFajaColor(){
|
function servicioFajaColor(){
|
||||||
if($('#fajaColor').prop('checked')){
|
if($('#fajaColor').prop('checked')){
|
||||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['fajaColor'] ?>)
|
$('#add_servicio_acabado_list').val(<?php echo $serviciosAutomaticos['fajaColor'] ?>)
|
||||||
$('#insertar_serv_acabado').click()
|
$('#insertar_serv_acabado').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['fajaColor'] ?> ? true : false;
|
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['fajaColor'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||||
@ -1180,6 +1180,22 @@
|
|||||||
return datosManipulado
|
return datosManipulado
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function servicioGuardas(add_service = false){
|
||||||
|
if(add_service){
|
||||||
|
$('#add_servicio_manipulado_list').val(<?php echo $serviciosAutomaticos['plegadoGuardas'] ?>)
|
||||||
|
$('#insertar_serv_manipulado').click()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var row_indexes = tableServiciosManipulado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
|
return tableServiciosManipulado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['plegadoGuardas'] ?> ? true : false;
|
||||||
|
} );
|
||||||
|
if(row_indexes.length > 0){
|
||||||
|
tableServiciosManipulado.row(row_indexes[0]).remove().draw()
|
||||||
|
check_serv_manipulado_error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init_servicio_manipulado()
|
init_servicio_manipulado()
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -1290,12 +1306,12 @@
|
|||||||
|
|
||||||
function servicioPrototipo(){
|
function servicioPrototipo(){
|
||||||
if($('#prototipo').prop('checked')){
|
if($('#prototipo').prop('checked')){
|
||||||
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosCheckboxes['prototipo'] ?>)
|
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosAutomaticos['prototipo'] ?>)
|
||||||
$('#insertar_serv_preimpresion').click()
|
$('#insertar_serv_preimpresion').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['prototipo'] ?> ? true : false;
|
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['prototipo'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
||||||
@ -1306,11 +1322,11 @@
|
|||||||
|
|
||||||
function servicioFerro(){
|
function servicioFerro(){
|
||||||
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['ferro'] ?> ? true : false;
|
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['ferro'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if($('#ferro').prop('checked')){
|
if($('#ferro').prop('checked')){
|
||||||
if(row_indexes.length == 0){
|
if(row_indexes.length == 0){
|
||||||
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosCheckboxes['ferro'] ?>)
|
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosAutomaticos['ferro'] ?>)
|
||||||
$('#insertar_serv_preimpresion').click()
|
$('#insertar_serv_preimpresion').click()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,9 +49,8 @@
|
|||||||
<div class='col-md-12 col-lg-9 px-4'></div>
|
<div class='col-md-12 col-lg-9 px-4'></div>
|
||||||
<div class='col-md-12 col-lg-3 px-4'>
|
<div class='col-md-12 col-lg-3 px-4'>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label class="input-group-text" for="addLineasPresupuesto"><?= lang('Presupuestos.addLineaPresupuesto') ?></label>
|
<label id="btn_addLinea" class="btn btn-outline-primary waves-effect" ><?= lang('Presupuestos.addLineaPresupuesto') ?></label>
|
||||||
<select class="form-select" id="addLineasPresupuesto" data-native-menu="false">
|
<select class="form-select" id="addLineasPresupuesto" data-native-menu="false">
|
||||||
<option></option>
|
|
||||||
<option value="lp_bn"><?= lang('Presupuestos.bn') ?></option>
|
<option value="lp_bn"><?= lang('Presupuestos.bn') ?></option>
|
||||||
<option value="lp_bnhq"><?= lang('Presupuestos.bnhq') ?></option>
|
<option value="lp_bnhq"><?= lang('Presupuestos.bnhq') ?></option>
|
||||||
<option value="lp_color"><?= lang('Presupuestos.color') ?></option>
|
<option value="lp_color"><?= lang('Presupuestos.color') ?></option>
|
||||||
@ -59,6 +58,7 @@
|
|||||||
<option value="lp_rot_bn"><?= lang('Presupuestos.rotativa_bn') ?></option>
|
<option value="lp_rot_bn"><?= lang('Presupuestos.rotativa_bn') ?></option>
|
||||||
<option value="lp_rot_color"><?= lang('Presupuestos.rotativa_color') ?></option>
|
<option value="lp_rot_color"><?= lang('Presupuestos.rotativa_color') ?></option>
|
||||||
<option value="lp_cubierta"><?= lang('Presupuestos.cubierta') ?></option>
|
<option value="lp_cubierta"><?= lang('Presupuestos.cubierta') ?></option>
|
||||||
|
<option value="lp_guardas"><?= lang('Presupuestos.Guardas') ?></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -81,6 +81,9 @@ const papelGenericoCubiertaList = <?php echo json_encode($papelGenericoCubiertaL
|
|||||||
const papelGenericoSobrecubiertaList = <?php echo json_encode($papelGenericoSobrecubiertaList); ?>;
|
const papelGenericoSobrecubiertaList = <?php echo json_encode($papelGenericoSobrecubiertaList); ?>;
|
||||||
const papelGenericoRotativaNegroList = <?php echo json_encode($papelGenericoRotativaNegroList); ?>;
|
const papelGenericoRotativaNegroList = <?php echo json_encode($papelGenericoRotativaNegroList); ?>;
|
||||||
const papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRotativaColorList); ?>;
|
const papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRotativaColorList); ?>;
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
|
const papelGenericoGuardasList = <?php echo json_encode($papelGenericoGuardasList); ?>;
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
// Formatting function for row details - modify as you need
|
// Formatting function for row details - modify as you need
|
||||||
@ -409,7 +412,7 @@ const actionBtns_lp = function(data) {
|
|||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
searching: false,
|
searching: false,
|
||||||
paging: false,
|
paging: false,
|
||||||
@ -475,6 +478,9 @@ const actionBtns_lp = function(data) {
|
|||||||
else if(row.row_id.includes('_sobrecubierta')){
|
else if(row.row_id.includes('_sobrecubierta')){
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
else if(row.row_id.includes('_guardas')){
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{data: 'icon',
|
{data: 'icon',
|
||||||
@ -484,19 +490,60 @@ const actionBtns_lp = function(data) {
|
|||||||
},
|
},
|
||||||
{data: 'paginas',
|
{data: 'paginas',
|
||||||
render: function ( data, type, row, meta ) {
|
render: function ( data, type, row, meta ) {
|
||||||
if(row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta")
|
if(row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta" && row.row_id != "lp_guardas")
|
||||||
return '<td class="lp-td"><input id="' + row.row_id + '_paginas" name="' + row.row_id + '_paginas" class="lp-cell lp-input paginas-lp" type="text" value="' + data + '"></td>';
|
return '<td class="lp-td"><input id="' + row.row_id + '_paginas" name="' + row.row_id + '_paginas" class="lp-cell lp-input paginas-lp" type="text" value="' + data + '"></td>';
|
||||||
else if(row.row_id == "lp_cubierta"){
|
else if(row.row_id == "lp_cubierta"){
|
||||||
return ' \
|
select = '<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
||||||
<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;"> \
|
if(data==2){
|
||||||
<option value="2"> \
|
select += '<option value="2" selected >'
|
||||||
<p><?= lang('Presupuestos.1cara') ?></p> \
|
}
|
||||||
</option> \
|
else{
|
||||||
<option value="4"> \
|
select += '<option value="2">'
|
||||||
<p><?= lang('Presupuestos.2caras') ?></p> \
|
}
|
||||||
</option> \
|
select +='<p><?= lang('Presupuestos.1cara') ?></p>'
|
||||||
</select> \
|
select += '</option>'
|
||||||
';
|
if(data==4){
|
||||||
|
select += '<option value="4" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="4">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.2caras') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
select += '</select>'
|
||||||
|
|
||||||
|
return select;
|
||||||
|
}
|
||||||
|
else if(row.row_id == "lp_guardas"){
|
||||||
|
select = '<select id="lp_guardas_paginas" name="comp_paginas_guardas" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
||||||
|
if(row.paginas_impresion==0){
|
||||||
|
select += '<option value="0" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="0">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.sinImpresion') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
if(row.paginas_impresion==4){
|
||||||
|
select += '<option value="4" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="4">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.1cara') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
if(row.paginas_impresion==8){
|
||||||
|
select += '<option value="8" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="8">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.2caras') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
select += '</select>'
|
||||||
|
|
||||||
|
return select;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -527,6 +574,9 @@ const actionBtns_lp = function(data) {
|
|||||||
else if (row.row_id == 'lp_sobrecubierta'){
|
else if (row.row_id == 'lp_sobrecubierta'){
|
||||||
papelList = papelGenericoSobrecubiertaList
|
papelList = papelGenericoSobrecubiertaList
|
||||||
}
|
}
|
||||||
|
else if (row.row_id == 'lp_guardas'){
|
||||||
|
papelList = papelGenericoGuardasList
|
||||||
|
}
|
||||||
else if (row.row_id == 'lp_rot_bn'){
|
else if (row.row_id == 'lp_rot_bn'){
|
||||||
papelList = papelGenericoRotativaNegroList
|
papelList = papelGenericoRotativaNegroList
|
||||||
}
|
}
|
||||||
@ -625,12 +675,16 @@ tableLineasPresupuesto.on( 'draw.dt', function () {
|
|||||||
$(document).on('click', '.btn-delete-lp', function(e) {
|
$(document).on('click', '.btn-delete-lp', function(e) {
|
||||||
|
|
||||||
const row = $(this).closest('tr');
|
const row = $(this).closest('tr');
|
||||||
|
data = tableLineasPresupuesto.row( row ).data()
|
||||||
tableLineasPresupuesto.row( row )
|
tableLineasPresupuesto.row( row )
|
||||||
.remove()
|
.remove()
|
||||||
.draw();
|
.draw();
|
||||||
updateTotales(true, false, false)
|
updateTotales(true, false, false)
|
||||||
updateTablaEnvios()
|
updateTablaEnvios()
|
||||||
|
|
||||||
|
if(data.row_id == 'lp_guardas')
|
||||||
|
servicioGuardas(false)
|
||||||
|
|
||||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
})
|
})
|
||||||
@ -686,6 +740,8 @@ function processRowData(row, rowId, rowClass){
|
|||||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_cubierta.png") ?>'
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_cubierta.png") ?>'
|
||||||
else if(rowId=='lp_sobrecubierta')
|
else if(rowId=='lp_sobrecubierta')
|
||||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png") ?>'
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png") ?>'
|
||||||
|
else if(rowId=='lp_guardas')
|
||||||
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_guardas.png") ?>'
|
||||||
else if(rowId=='lp_rot_bn')
|
else if(rowId=='lp_rot_bn')
|
||||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png") ?>'
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png") ?>'
|
||||||
else if(rowId=='lp_rot_color')
|
else if(rowId=='lp_rot_color')
|
||||||
@ -708,6 +764,7 @@ function processRowData(row, rowId, rowClass){
|
|||||||
|
|
||||||
'icon': icon,
|
'icon': icon,
|
||||||
'paginas': blank_line?0:row.paginas,
|
'paginas': blank_line?0:row.paginas,
|
||||||
|
'paginas_impresion': rowId=='lp_guardas'?row.paginas_impresion:0,
|
||||||
'papel': blank_line?"":row.papel_generico_id,
|
'papel': blank_line?"":row.papel_generico_id,
|
||||||
'gramaje': blank_line?"":row.gramaje,
|
'gramaje': blank_line?"":row.gramaje,
|
||||||
'papel_impresion': blank_line?"":row.papel_impresion,
|
'papel_impresion': blank_line?"":row.papel_impresion,
|
||||||
@ -721,8 +778,8 @@ function processRowData(row, rowId, rowClass){
|
|||||||
|
|
||||||
'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2),
|
'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2),
|
||||||
|
|
||||||
'numeroPliegos':isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2),
|
'numeroPliegos':isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(0),
|
||||||
'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(2),
|
'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(0),
|
||||||
'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6),
|
'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6),
|
||||||
'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2),
|
'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2),
|
||||||
'totalPapelPedido': isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2),
|
'totalPapelPedido': isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2),
|
||||||
@ -806,7 +863,6 @@ function processRowData(row, rowId, rowClass){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#addLineasPresupuesto').val('');
|
|
||||||
|
|
||||||
$('.paginas-lp').on('change', function(){
|
$('.paginas-lp').on('change', function(){
|
||||||
checkPaginasPresupuesto()
|
checkPaginasPresupuesto()
|
||||||
@ -892,6 +948,7 @@ function clear_cubierta(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.insertarLinea').on("click", function (e) {
|
$('.insertarLinea').on("click", function (e) {
|
||||||
|
|
||||||
if(e.target.id.includes("Plana")){
|
if(e.target.id.includes("Plana")){
|
||||||
@ -941,11 +998,22 @@ $('.insertarLinea').on("click", function (e) {
|
|||||||
fill_lp_cubierta(row, true);
|
fill_lp_cubierta(row, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(e.target.id.includes("Guardas")){
|
||||||
|
|
||||||
|
clear_guardas();
|
||||||
|
|
||||||
|
var rows = $("#tableCompGuardas").DataTable().rows( '.selected' ).data().toArray();
|
||||||
|
for(row of rows){
|
||||||
|
fill_lp_guardas(row, true);
|
||||||
|
}
|
||||||
|
servicioGuardas(true)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#addLineasPresupuesto').on("change", function (e) {
|
$('#btn_addLinea').on("click", function (e) {
|
||||||
|
|
||||||
var dataRows = tableLineasPresupuesto
|
var dataRows = tableLineasPresupuesto
|
||||||
.rows()
|
.rows()
|
||||||
@ -1099,6 +1167,29 @@ $('#addLineasPresupuesto').on("change", function (e) {
|
|||||||
tableLineasPresupuesto.row.add(data).draw()
|
tableLineasPresupuesto.row.add(data).draw()
|
||||||
eventos_lp_cubierta()
|
eventos_lp_cubierta()
|
||||||
break
|
break
|
||||||
|
|
||||||
|
case 'lp_guardas':
|
||||||
|
var hayLinea = false
|
||||||
|
for(let number=0;number<dataRows.length;number++){
|
||||||
|
if(dataRows[number].row_id == 'lp_guardas'){
|
||||||
|
hayLinea = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hayLinea){
|
||||||
|
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = processRowData({tipo_maquina: 'toner'}, 'lp_guardas', 'lp-guardas');
|
||||||
|
tableLineasPresupuesto.row.add(data).draw()
|
||||||
|
$('#lp_guardas_gramaje').empty()
|
||||||
|
var o = new Option("170", "170");
|
||||||
|
$('#lp_guardas_gramaje').append(o)
|
||||||
|
eventos_lp_guardas()
|
||||||
|
servicioGuardas(true)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -3403,7 +3494,7 @@ function getLomoLineasPresupuesto(){
|
|||||||
var rowData = this.data();
|
var rowData = this.data();
|
||||||
lomoTotal += parseFloat(rowData.lomo)
|
lomoTotal += parseFloat(rowData.lomo)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch(error){
|
catch(error){
|
||||||
lomoTotal = 0
|
lomoTotal = 0
|
||||||
}
|
}
|
||||||
@ -3411,10 +3502,280 @@ function getLomoLineasPresupuesto(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************
|
||||||
|
***************************** */
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
|
|
||||||
|
function clear_lp_guardas(clear_selectors){
|
||||||
|
let pags = $("#lp_guardas_paginas option:selected" ).val()
|
||||||
|
$(".lp-guardas-input" ).val("0")
|
||||||
|
$("#lp_guardas_paginas" ).val(pags)
|
||||||
|
if(clear_selectors){
|
||||||
|
$( "#lp_guardas_maquina").empty()
|
||||||
|
$( "#lp_guardas_papelImpresion").empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function clear_guardas(){
|
||||||
|
clear_lp_guardas(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function calcularPresupuesto_guardas(fromComparador=false, input_data={}){
|
||||||
|
|
||||||
|
const dimension = getDimensionLibro();
|
||||||
|
|
||||||
|
if(Object.keys(input_data).length == 0){
|
||||||
|
|
||||||
|
input_data = {
|
||||||
|
paginas: <?php echo ($tipo_impresion_id == 1 || $tipo_impresion_id == 3)?8:4 ?>,
|
||||||
|
paginas_impresion: parseInt($('#lp_guardas_paginas option:selected').val()),
|
||||||
|
papel_generico_id: $('#lp_guardas_papel option:selected').val(),
|
||||||
|
papel_generico: $('#lp_guardas_papel option:selected').text().trim(),
|
||||||
|
gramaje: 170,
|
||||||
|
maquina_id: $('#lp_guardas_maquina option:selected').val(),
|
||||||
|
papel_impresion_id: $('#lp_guardas_papelImpresion option:selected').val()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var datos = {
|
||||||
|
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||||
|
type: 'guardas',
|
||||||
|
color: 1,
|
||||||
|
hq: 1,
|
||||||
|
paginas: <?php echo ($tipo_impresion_id == 1 || $tipo_impresion_id == 3)?8:4 ?>,
|
||||||
|
paginas_impresion: input_data.paginas_impresion,
|
||||||
|
tirada: parseInt($('#tirada').val()),
|
||||||
|
merma: parseInt($('#merma').val()),
|
||||||
|
ancho: dimension.ancho,
|
||||||
|
alto: dimension.alto,
|
||||||
|
papel_generico_id: input_data.papel_generico_id,
|
||||||
|
papel_generico: input_data.papel_generico,
|
||||||
|
gramaje: input_data.gramaje,
|
||||||
|
cliente_id: $('#clienteId').find(":selected").val(),
|
||||||
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/cosidotapablanda/datatable",
|
||||||
|
data: datos,
|
||||||
|
success: function (data) {
|
||||||
|
|
||||||
|
if(data.lineas.length >0){
|
||||||
|
// Se cogen los valores de la linea con los datos correspondientes
|
||||||
|
$.each(data.lineas, function(key, value) {
|
||||||
|
if(value.fields.maquina_id === input_data.maquina_id &&
|
||||||
|
value.fields.papel_generico_id === input_data.papel_generico_id &&
|
||||||
|
value.fields.papel_impresion_id === input_data.papel_impresion_id) {
|
||||||
|
|
||||||
|
if(Object.keys(input_data).length == 0){
|
||||||
|
value.fields.check_papel_total = $('#lp_guardas' + '_checkPapel').is(":checked")?1:0
|
||||||
|
value.fields.check_impresion_total = $('#lp_guardas' + '_checkClicks').is(":checked")?1:0
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
value.fields.check_papel_total = 1
|
||||||
|
value.fields.check_impresion_total = 1
|
||||||
|
}
|
||||||
|
fill_lp_guardas(value.fields);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
clear_lp_guardas(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
}
|
||||||
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(e){
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function fill_lp_guardas(row, fromComparador=false){
|
||||||
|
|
||||||
|
if(fromComparador){
|
||||||
|
|
||||||
|
var input_data = {
|
||||||
|
paginas: row.paginas,
|
||||||
|
paginas_impresion: row.paginas_impresion,
|
||||||
|
papel_generico_id: row.papelGenericoId,
|
||||||
|
gramaje: row.gramaje,
|
||||||
|
papel_impresion_id: row.papelImpresionId,
|
||||||
|
maquina_id: row.maquinaId,
|
||||||
|
}
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas(false, input_data);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// Se guarda el estado de "ver calculos"
|
||||||
|
mostrar_calculos = ($( ".calculos_lp_guardas").css('display') == 'table-row')
|
||||||
|
|
||||||
|
// Si viene de hacerlo a mano...
|
||||||
|
data = processRowData(row, 'lp_guardas', 'lp-guardas');
|
||||||
|
|
||||||
|
var row = tableLineasPresupuesto.row('#lp_guardas');
|
||||||
|
if(row.length>0)
|
||||||
|
tableLineasPresupuesto.row('#lp_guardas').data(data).draw()
|
||||||
|
else{
|
||||||
|
tableLineasPresupuesto.row.add(data).draw()
|
||||||
|
row = tableLineasPresupuesto.row('#lp_guardas');
|
||||||
|
}
|
||||||
|
row.child(format(row.data())).show();
|
||||||
|
|
||||||
|
eventos_lp_guardas(data.maquinaTipo=='inkjet'?true:false)
|
||||||
|
|
||||||
|
$('#lp_guardas_checkPapel').change()
|
||||||
|
|
||||||
|
calcular_mermas()
|
||||||
|
updateTotales(true, false, false)
|
||||||
|
updateTablaEnvios()
|
||||||
|
|
||||||
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
|
check_update_cubierta()
|
||||||
|
|
||||||
|
if(mostrar_calculos){
|
||||||
|
$( ".calculos_lp_guardas").css('display','table-row')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||||
|
}
|
||||||
|
|
||||||
|
function eventos_lp_guardas(isInkjet = false){
|
||||||
|
|
||||||
|
$('#lp_guardas_papel').bind("focus", {clear_selectors: true}, clear_lp_guardas);
|
||||||
|
$('#lp_guardas_papelImpresion').focus("focus", set_lp_guardas_papelImpresion);
|
||||||
|
$('#lp_guardas_maquina').bind("focus", set_lp_guardas_maquina);
|
||||||
|
$('#lp_guardas_maquina').bind("change", calcularPresupuesto_guardas);
|
||||||
|
$('#lp_guardas_paginas').bind("change", change_lp_guardas_paginas);
|
||||||
|
$('#lp_guardas_checkPapel').bind("change", {id_linea: 'lp_guardas'}, update_total_linea);
|
||||||
|
$('#lp_guardas_checkClicks').bind("change", {id_linea: 'lp_guardas'}, update_total_linea);
|
||||||
|
|
||||||
|
if(isInkjet){
|
||||||
|
$('#lp_guardas_vercalculos').bind("click", {rowId: 'lp_guardas'}, verCalculosInkjet);
|
||||||
|
$('.lp-guardas-tipologia').bind("change", change_lp_guardas_tipologia);
|
||||||
|
$('#lp_guardas_defecto').bind("click", por_defecto_lp_guardas);
|
||||||
|
$('#lp_guardas_aFavorFibra').bind("change", change_lp_guardas_aFavorFibra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_lp_guardas_tipologia(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas({},true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function por_defecto_lp_guardas(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function change_lp_guardas_aFavorFibra(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
var rowData = tableLineasPresupuesto.row('#lp_guardas').data()
|
||||||
|
rowData.aFavorFibra = $('#lp_guardas_aFavorFibra').prop('checked')
|
||||||
|
tableLineasPresupuesto.row('#lp_guardas').data(rowData).draw(false)
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas(false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_lp_guardas_paginas(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function set_lp_guardas_maquina(){
|
||||||
|
|
||||||
|
await $.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||||
|
beforeSend: function() {
|
||||||
|
$('#lp_guardas_maquina').empty()
|
||||||
|
clear_lp_guardas(false)
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
tipo: 'maquina',
|
||||||
|
uso: 'colorhq',
|
||||||
|
tipoLinea: "guardas",
|
||||||
|
is_rotativa: 0,
|
||||||
|
ancho: getDimensionLibro().ancho,
|
||||||
|
alto: getDimensionLibro().alto,
|
||||||
|
datos: parseInt($('#tirada').val()) + parseInt($('#merma').val()),
|
||||||
|
papel_impresion: $('#lp_guardas_papelImpresion option:selected').val() ,
|
||||||
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
$.each(data.menu, function(item){
|
||||||
|
var option = $('<option/>', {'value':data.menu[item].maquina_id, 'text':data.menu[item].maquina})
|
||||||
|
$('#lp_guardas_maquina').append(option);
|
||||||
|
});
|
||||||
|
$('#lp_guardas_maquina').val('')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function set_lp_guardas_papelImpresion(){
|
||||||
|
await $.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||||
|
beforeSend: function() {
|
||||||
|
$('#lp_guardas_papelImpresion').empty()
|
||||||
|
$('#lp_guardas_maquina').empty()
|
||||||
|
clear_lp_guardas(false)
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
tipo: 'papelImpresion',
|
||||||
|
uso: 'guardas',
|
||||||
|
datos: $('#lp_guardas_papel option:selected').val() ,
|
||||||
|
gramaje: 170 ,
|
||||||
|
tipoLinea: "colorhq",
|
||||||
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
$.each(data.menu, function(item){
|
||||||
|
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||||
|
$('#lp_guardas_papelImpresion').append(option);
|
||||||
|
});
|
||||||
|
$('#lp_guardas_papelImpresion').val('')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
fill_lp_from_bbdd()
|
fill_lp_from_bbdd()
|
||||||
|
|
||||||
@ -3543,7 +3904,12 @@ function fill_lp_from_bbdd(){
|
|||||||
case 'lp_cubierta':
|
case 'lp_cubierta':
|
||||||
eventos_lp_cubierta()
|
eventos_lp_cubierta()
|
||||||
break
|
break
|
||||||
|
case 'lp_guardas':
|
||||||
|
eventos_lp_guardas()
|
||||||
|
lp['paginas_impresion'] = lp.paginas_impresion
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3575,7 +3941,7 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
|||||||
linea_data = {
|
linea_data = {
|
||||||
presupuesto_id: presupuesto_id,
|
presupuesto_id: presupuesto_id,
|
||||||
tipo: rowData.row_id,
|
tipo: rowData.row_id,
|
||||||
paginas: rowData.paginas,
|
paginas: (rowData.row_id=='lp_guardas')?(<?php echo ($tipo_impresion_id == 1 || $tipo_impresion_id == 3)?8:4 ?>):rowData.paginas,
|
||||||
papel_id: rowData.papel,
|
papel_id: rowData.papel,
|
||||||
gramaje: rowData.gramaje,
|
gramaje: rowData.gramaje,
|
||||||
papel_impresion_id: rowData.papel_impresion_id,
|
papel_impresion_id: rowData.papel_impresion_id,
|
||||||
@ -3606,6 +3972,9 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
|||||||
total_linea: rowData.total_linea,
|
total_linea: rowData.total_linea,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rowData.row_id=='lp_guardas')
|
||||||
|
linea_data.paginas_impresion = rowData.paginas_impresion
|
||||||
|
|
||||||
// maquina rotativa o inkjet
|
// maquina rotativa o inkjet
|
||||||
if(linea_data.maquina_tipo=='inkjet'){
|
if(linea_data.maquina_tipo=='inkjet'){
|
||||||
|
|
||||||
@ -3730,7 +4099,7 @@ function checkPaginasPresupuesto(){
|
|||||||
|
|
||||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||||
var rowData = this.data();
|
var rowData = this.data();
|
||||||
if(rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta')
|
if(rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
||||||
cantidad_total += parseInt(rowData.paginas)
|
cantidad_total += parseInt(rowData.paginas)
|
||||||
})
|
})
|
||||||
htmlString = ''
|
htmlString = ''
|
||||||
|
|||||||
@ -97,6 +97,9 @@ $('.accordion-button').on('click', function (e) {
|
|||||||
else if (e.target.id.includes("cubierta")) {
|
else if (e.target.id.includes("cubierta")) {
|
||||||
$("#tableCompCubierta").DataTable().columns.adjust();
|
$("#tableCompCubierta").DataTable().columns.adjust();
|
||||||
}
|
}
|
||||||
|
else if (e.target.id.includes("guardas")) {
|
||||||
|
$("#tableCompGuardas").DataTable().columns.adjust();
|
||||||
|
}
|
||||||
else if (e.target.id.includes("LineasPresupuesto")) {
|
else if (e.target.id.includes("LineasPresupuesto")) {
|
||||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||||
}
|
}
|
||||||
@ -116,7 +119,7 @@ function getRowFromLineaInt(tipo, linea) {
|
|||||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas + linea.fields.precio_click_pedido).toFixed(2);
|
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas + linea.fields.precio_click_pedido).toFixed(2);
|
||||||
|
|
||||||
|
|
||||||
return {
|
data = {
|
||||||
'tipo': tipo,
|
'tipo': tipo,
|
||||||
'paginas': linea.fields.paginas,
|
'paginas': linea.fields.paginas,
|
||||||
'papel': linea.fields.papel_generico,
|
'papel': linea.fields.papel_generico,
|
||||||
@ -140,6 +143,9 @@ function getRowFromLineaInt(tipo, linea) {
|
|||||||
'papelImpresionId': linea.fields.papel_impresion_id,
|
'papelImpresionId': linea.fields.papel_impresion_id,
|
||||||
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
||||||
}
|
}
|
||||||
|
if(data['tipo']=='guardas')
|
||||||
|
data['paginas_impresion'] = linea.fields.paginas_impresion;
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRowFromLineaRot(linea) {
|
function getRowFromLineaRot(linea) {
|
||||||
@ -403,6 +409,22 @@ function selectCubiertaLineas() {
|
|||||||
$('#total_comp_cubierta').html(value_total.toFixed(2));
|
$('#total_comp_cubierta').html(value_total.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectGuardasLineas() {
|
||||||
|
|
||||||
|
$("#tableCompGuardas").DataTable().rows('.selected').deselect();
|
||||||
|
|
||||||
|
let value_total = 0.00;
|
||||||
|
|
||||||
|
if ($("#tableCompGuardas").DataTable().rows().count() > 0) {
|
||||||
|
|
||||||
|
$("#tableCompGuardas").DataTable().row(0).nodes().to$().toggleClass('selected');
|
||||||
|
value_total = parseFloat($("#tableCompGuardas").DataTable().rows(0).data()[0]['total'])
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$('#total_comp_guardas').html(value_total.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
function getIDsComparador(is_color, is_hq) {
|
function getIDsComparador(is_color, is_hq) {
|
||||||
|
|
||||||
if (!is_color) {
|
if (!is_color) {
|
||||||
@ -517,7 +539,7 @@ function fillIntRot(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillCubierta(data, is_color, is_hq) {
|
function fillCubierta(data) {
|
||||||
|
|
||||||
let sorted = data.lineas.sort(
|
let sorted = data.lineas.sort(
|
||||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
@ -530,6 +552,19 @@ function fillCubierta(data, is_color, is_hq) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fillGuardas(data) {
|
||||||
|
|
||||||
|
let sorted = data.lineas.sort(
|
||||||
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
|
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||||
|
sorted.forEach(function (linea) {
|
||||||
|
if (typeof linea.error == "undefined")
|
||||||
|
$('#tableCompGuardas').DataTable().row
|
||||||
|
.add(getRowFromLineaInt('guardas', linea))
|
||||||
|
.draw()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function clearCompTable() {
|
function clearCompTable() {
|
||||||
|
|
||||||
$('#insertarPlanaBtn').addClass('d-none')
|
$('#insertarPlanaBtn').addClass('d-none')
|
||||||
@ -612,7 +647,7 @@ function generateCompJSON() {
|
|||||||
try {
|
try {
|
||||||
cubierta_obj = {
|
cubierta_obj = {
|
||||||
"cubierta": {
|
"cubierta": {
|
||||||
'paginas': $('#compCarasCubierta').select2('data')[0].id,
|
'paginas': $('#compCarasCubierta option:selected').val(),
|
||||||
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
|
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
|
||||||
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
|
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
|
||||||
},
|
},
|
||||||
@ -621,9 +656,24 @@ function generateCompJSON() {
|
|||||||
catch (e) {
|
catch (e) {
|
||||||
cubierta_obj = {}
|
cubierta_obj = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
$.extend(data, cubierta_obj);
|
$.extend(data, cubierta_obj);
|
||||||
|
|
||||||
|
if($('#compCarasGuardas').length>0){
|
||||||
|
try {
|
||||||
|
guardas_obj = {
|
||||||
|
"guardas": {
|
||||||
|
'paginas_impresion': $('#compCarasGuardas option:selected').val(),
|
||||||
|
'papel_id': $('#compPapelGuardas').select2('data')[0].id,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
guardas_obj = {}
|
||||||
|
}
|
||||||
|
$.extend(data, guardas_obj);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
data_str = JSON.stringify(data)
|
data_str = JSON.stringify(data)
|
||||||
$('#comparador_json_data').val(data_str)
|
$('#comparador_json_data').val(data_str)
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
httpdocs/themes/vuexy/img/safekat/presupuestos/icon_guardas.png
Normal file
BIN
httpdocs/themes/vuexy/img/safekat/presupuestos/icon_guardas.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Reference in New Issue
Block a user