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['serviciosCheckboxes'] = [
|
||||
$this->viewData['serviciosAutomaticos'] = [
|
||||
'retractilado' => 3,
|
||||
'retractilado5' => 5,
|
||||
'ferro' => 24,
|
||||
'prototipo' => 9,
|
||||
'fajaColor' => 16,
|
||||
'plegadoGuardas' => 62,
|
||||
];
|
||||
|
||||
$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;
|
||||
if(!is_null($datosTipolog)){
|
||||
@ -487,8 +488,17 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
if ($type=='guardas') {
|
||||
$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;
|
||||
|
||||
$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
|
||||
// en las dos direcciones (menos en rustica fresada que es siempre 1)
|
||||
'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_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']['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){
|
||||
$linea['fields']['a_favor_fibra'] = $parametrosInkjet->a_favor_fibra;
|
||||
$linea['fields']['paginas_color'] = $isColor?$datosPedido->paginas:0;
|
||||
$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);
|
||||
[$ancho, $alto] = PresupuestoService::calculoDimForma($datosPedido, $parametrosInkjet);
|
||||
$linea['fields']['factor_anchura'] = round($maquina->ancho_impresion / $ancho, 2);
|
||||
|
||||
@ -10,6 +10,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
"presupuesto_id" => null,
|
||||
"tipo" => null,
|
||||
"paginas" => 0,
|
||||
"paginas_impresion" => 0, //guardas
|
||||
"paginas_color_posicion" => null,
|
||||
"solapas_ancho" => 0.0,
|
||||
"papel_id" => null,
|
||||
@ -79,6 +80,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
protected $casts = [
|
||||
"presupuesto_id" => "int",
|
||||
"paginas" => "int",
|
||||
"paginas_impresion" => "int", // guardas
|
||||
"solapas_ancho" => "float",
|
||||
"papel_id" => "?int",
|
||||
"papel_impresion_id" => "?int",
|
||||
@ -140,3 +142,4 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
"total_linea" => "double",
|
||||
];
|
||||
}
|
||||
|
||||
@ -296,6 +296,8 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t1.cubierta", 1);
|
||||
else if ($uso == 'sobrecubierta')
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
else if ($uso == 'guardas')
|
||||
$builder->where("t1.guardas", 1);
|
||||
else{
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
|
||||
@ -12,11 +12,12 @@ class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
|
||||
protected $allowedFields = [
|
||||
"presupuesto_id",
|
||||
"tipo",
|
||||
"paginas",
|
||||
"paginas_impresion", //guardas
|
||||
"paginas_color_posicion",
|
||||
"solapas_ancho",
|
||||
"papel_id",
|
||||
|
||||
@ -87,11 +87,18 @@ class PresupuestoService extends BaseService
|
||||
alto: $datosPedido->alto,
|
||||
gramaje: $papel_impresion->gramaje,
|
||||
paginas: $datosPedido->paginas
|
||||
);
|
||||
);
|
||||
|
||||
// impresion
|
||||
$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)
|
||||
@ -378,13 +385,6 @@ class PresupuestoService extends BaseService
|
||||
else{
|
||||
$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(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
|
||||
|
||||
@ -687,12 +687,12 @@
|
||||
$('#compPapelGuardas').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
$('#compCarasGuardas').select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: Infinity,
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
updatePapelesComparador();
|
||||
const paginasColor = document.getElementById('compCalPaginasColor');
|
||||
@ -701,7 +701,6 @@
|
||||
}
|
||||
|
||||
computarPaginasColor($('#compPosPaginasColor').val());
|
||||
|
||||
}
|
||||
|
||||
function init_lineas_comparador(){
|
||||
@ -752,7 +751,7 @@
|
||||
}catch(e){}
|
||||
|
||||
try{
|
||||
$("#compCarasCubierta").val(parseInt(comp_data.cubierta.paginas)).trigger('select2:select');
|
||||
$("#compCarasCubierta").val(parseInt(comp_data.cubierta.paginas)).change();
|
||||
try{
|
||||
$("#compPapelCubierta").val(parseInt(comp_data.cubierta.papel_id)).trigger('select2:select');
|
||||
|
||||
@ -765,6 +764,11 @@
|
||||
}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',{
|
||||
@ -976,11 +980,12 @@
|
||||
{ 'data': 'tiempoMaquina'},
|
||||
{ 'data': 'papelGenericoId'},
|
||||
{ 'data': 'papelImpresionId'},
|
||||
{ 'data': 'tarifa_impresion_id'}
|
||||
{ 'data': 'tarifa_impresion_id'},
|
||||
{ 'data': 'paginas_impresion'},
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [16,17,18,19,20,21],
|
||||
target: [16,17,18,19,20,21,22],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
@ -989,7 +994,7 @@
|
||||
|
||||
function checkComparadorGuardas(actualizarLinea = false){
|
||||
|
||||
if ($('#compPapelGuardas').select2('data').length > 0 ){
|
||||
if ($('#compPapelGuardas').select2('data')[0].id > 0 ){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -1020,18 +1025,16 @@
|
||||
clearGuardas();
|
||||
|
||||
if(data.lineas.length >0){
|
||||
/*
|
||||
fillCubierta(data);
|
||||
selectCubiertaLineas();
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
|
||||
$('#insertarCubiertaBtn').removeClass('d-none')
|
||||
fillGuardas(data);
|
||||
selectGuardasLineas();
|
||||
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>' + ' (' + tableCompGuardas.rows().count() + ')');
|
||||
$('#insertarGuardasBtn').removeClass('d-none')
|
||||
if(actualizarLinea){
|
||||
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
fill_lp_cubierta(row, true);
|
||||
fill_lp_guardas(row, true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else{
|
||||
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>');
|
||||
@ -1056,7 +1059,7 @@
|
||||
|
||||
$('.comp_guardas_items').on('change', function (e) {
|
||||
|
||||
checkComparadorGuardas(false,false);
|
||||
checkComparadorGuardas(false);
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
@ -1215,7 +1218,7 @@
|
||||
|
||||
function checkComparadorCubierta(actualizarLinea = false){
|
||||
|
||||
if ($('#compCarasCubierta').select2('data').length > 0 &&
|
||||
if ($('#compCarasCubierta option:selected').val().length > 0 &&
|
||||
$('#compPapelCubierta').select2('data').length > 0 &&
|
||||
$('#compGramajeCubierta').select2('data').length > 0 ){
|
||||
|
||||
@ -1224,7 +1227,7 @@
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'cubierta',
|
||||
paginas: parseInt($('#compCarasCubierta').select2('data')[0].id),
|
||||
paginas: parseInt($('#compCarasCubierta option:selected').val()),
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
merma: parseInt($('#mermacubierta').val()),
|
||||
color: 1,
|
||||
@ -1656,6 +1659,6 @@
|
||||
}
|
||||
|
||||
init_comparador()
|
||||
init_lineas_comparador()
|
||||
init_lineas_comparador()
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -609,12 +609,12 @@
|
||||
|
||||
function servicioRetractilado(){
|
||||
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()
|
||||
}
|
||||
else{
|
||||
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){
|
||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||
@ -625,12 +625,12 @@
|
||||
|
||||
function servicioRetractilado5(){
|
||||
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()
|
||||
}
|
||||
else{
|
||||
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){
|
||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||
@ -641,12 +641,12 @@
|
||||
|
||||
function servicioFajaColor(){
|
||||
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()
|
||||
}
|
||||
else{
|
||||
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){
|
||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||
@ -1180,6 +1180,22 @@
|
||||
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()
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -1290,12 +1306,12 @@
|
||||
|
||||
function servicioPrototipo(){
|
||||
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()
|
||||
}
|
||||
else{
|
||||
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){
|
||||
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
||||
@ -1306,11 +1322,11 @@
|
||||
|
||||
function servicioFerro(){
|
||||
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(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()
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,9 +49,8 @@
|
||||
<div class='col-md-12 col-lg-9 px-4'></div>
|
||||
<div class='col-md-12 col-lg-3 px-4'>
|
||||
<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">
|
||||
<option></option>
|
||||
<option value="lp_bn"><?= lang('Presupuestos.bn') ?></option>
|
||||
<option value="lp_bnhq"><?= lang('Presupuestos.bnhq') ?></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_color"><?= lang('Presupuestos.rotativa_color') ?></option>
|
||||
<option value="lp_cubierta"><?= lang('Presupuestos.cubierta') ?></option>
|
||||
<option value="lp_guardas"><?= lang('Presupuestos.Guardas') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -81,6 +81,9 @@ const papelGenericoCubiertaList = <?php echo json_encode($papelGenericoCubiertaL
|
||||
const papelGenericoSobrecubiertaList = <?php echo json_encode($papelGenericoSobrecubiertaList); ?>;
|
||||
const papelGenericoRotativaNegroList = <?php echo json_encode($papelGenericoRotativaNegroList); ?>;
|
||||
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
|
||||
@ -409,7 +412,7 @@ const actionBtns_lp = function(data) {
|
||||
`;
|
||||
};
|
||||
|
||||
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
||||
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
@ -475,6 +478,9 @@ const actionBtns_lp = function(data) {
|
||||
else if(row.row_id.includes('_sobrecubierta')){
|
||||
return 3;
|
||||
}
|
||||
else if(row.row_id.includes('_guardas')){
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
},
|
||||
{data: 'icon',
|
||||
@ -484,19 +490,60 @@ const actionBtns_lp = function(data) {
|
||||
},
|
||||
{data: 'paginas',
|
||||
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>';
|
||||
else if(row.row_id == "lp_cubierta"){
|
||||
return ' \
|
||||
<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;"> \
|
||||
<option value="2"> \
|
||||
<p><?= lang('Presupuestos.1cara') ?></p> \
|
||||
</option> \
|
||||
<option value="4"> \
|
||||
<p><?= lang('Presupuestos.2caras') ?></p> \
|
||||
</option> \
|
||||
</select> \
|
||||
';
|
||||
select = '<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){
|
||||
select += '<option value="2" selected >'
|
||||
}
|
||||
else{
|
||||
select += '<option value="2">'
|
||||
}
|
||||
select +='<p><?= lang('Presupuestos.1cara') ?></p>'
|
||||
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'){
|
||||
papelList = papelGenericoSobrecubiertaList
|
||||
}
|
||||
else if (row.row_id == 'lp_guardas'){
|
||||
papelList = papelGenericoGuardasList
|
||||
}
|
||||
else if (row.row_id == 'lp_rot_bn'){
|
||||
papelList = papelGenericoRotativaNegroList
|
||||
}
|
||||
@ -625,12 +675,16 @@ tableLineasPresupuesto.on( 'draw.dt', function () {
|
||||
$(document).on('click', '.btn-delete-lp', function(e) {
|
||||
|
||||
const row = $(this).closest('tr');
|
||||
data = tableLineasPresupuesto.row( row ).data()
|
||||
tableLineasPresupuesto.row( row )
|
||||
.remove()
|
||||
.draw();
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
if(data.row_id == 'lp_guardas')
|
||||
servicioGuardas(false)
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
})
|
||||
@ -686,6 +740,8 @@ function processRowData(row, rowId, rowClass){
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_cubierta.png") ?>'
|
||||
else if(rowId=='lp_sobrecubierta')
|
||||
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')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png") ?>'
|
||||
else if(rowId=='lp_rot_color')
|
||||
@ -708,6 +764,7 @@ function processRowData(row, rowId, rowClass){
|
||||
|
||||
'icon': icon,
|
||||
'paginas': blank_line?0:row.paginas,
|
||||
'paginas_impresion': rowId=='lp_guardas'?row.paginas_impresion:0,
|
||||
'papel': blank_line?"":row.papel_generico_id,
|
||||
'gramaje': blank_line?"":row.gramaje,
|
||||
'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),
|
||||
|
||||
'numeroPliegos':isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2),
|
||||
'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).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(0),
|
||||
'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6),
|
||||
'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).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(){
|
||||
checkPaginasPresupuesto()
|
||||
@ -892,6 +948,7 @@ function clear_cubierta(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('.insertarLinea').on("click", function (e) {
|
||||
|
||||
if(e.target.id.includes("Plana")){
|
||||
@ -941,11 +998,22 @@ $('.insertarLinea').on("click", function (e) {
|
||||
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
|
||||
.rows()
|
||||
@ -1099,6 +1167,29 @@ $('#addLineasPresupuesto').on("change", function (e) {
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_cubierta()
|
||||
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:
|
||||
break
|
||||
}
|
||||
@ -3403,7 +3494,7 @@ function getLomoLineasPresupuesto(){
|
||||
var rowData = this.data();
|
||||
lomoTotal += parseFloat(rowData.lomo)
|
||||
})
|
||||
}
|
||||
}
|
||||
catch(error){
|
||||
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()
|
||||
|
||||
@ -3543,7 +3904,12 @@ function fill_lp_from_bbdd(){
|
||||
case 'lp_cubierta':
|
||||
eventos_lp_cubierta()
|
||||
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 = {
|
||||
presupuesto_id: presupuesto_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,
|
||||
gramaje: rowData.gramaje,
|
||||
papel_impresion_id: rowData.papel_impresion_id,
|
||||
@ -3606,6 +3972,9 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
||||
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'){
|
||||
|
||||
@ -3730,7 +4099,7 @@ function checkPaginasPresupuesto(){
|
||||
|
||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
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)
|
||||
})
|
||||
htmlString = ''
|
||||
|
||||
@ -97,6 +97,9 @@ $('.accordion-button').on('click', function (e) {
|
||||
else if (e.target.id.includes("cubierta")) {
|
||||
$("#tableCompCubierta").DataTable().columns.adjust();
|
||||
}
|
||||
else if (e.target.id.includes("guardas")) {
|
||||
$("#tableCompGuardas").DataTable().columns.adjust();
|
||||
}
|
||||
else if (e.target.id.includes("LineasPresupuesto")) {
|
||||
$("#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);
|
||||
|
||||
|
||||
return {
|
||||
data = {
|
||||
'tipo': tipo,
|
||||
'paginas': linea.fields.paginas,
|
||||
'papel': linea.fields.papel_generico,
|
||||
@ -140,6 +143,9 @@ function getRowFromLineaInt(tipo, linea) {
|
||||
'papelImpresionId': linea.fields.papel_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) {
|
||||
@ -403,6 +409,22 @@ function selectCubiertaLineas() {
|
||||
$('#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) {
|
||||
|
||||
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(
|
||||
(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() {
|
||||
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
@ -612,7 +647,7 @@ function generateCompJSON() {
|
||||
try {
|
||||
cubierta_obj = {
|
||||
"cubierta": {
|
||||
'paginas': $('#compCarasCubierta').select2('data')[0].id,
|
||||
'paginas': $('#compCarasCubierta option:selected').val(),
|
||||
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
|
||||
},
|
||||
@ -621,9 +656,24 @@ function generateCompJSON() {
|
||||
catch (e) {
|
||||
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)
|
||||
$('#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