falta las lineas de sobrecubierta

This commit is contained in:
Jaime Jiménez
2024-02-20 21:35:09 +01:00
parent 177522ce49
commit b7bfaac05c
20 changed files with 304 additions and 86 deletions

0
.idea/modules.xml generated Normal file → Executable file
View File

0
.idea/phpunit.xml generated Normal file → Executable file
View File

0
.idea/safekat.iml generated Normal file → Executable file
View File

View File

@ -226,6 +226,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$sanitizedData['papel_formato_id'] = 0;
}
if ($this->request->getPost('solapas') == null) {
$sanitizedData['solapas'] = 0;
}
if ($this->request->getPost('solapas_sobrecubierta') == null) {
$sanitizedData['solapas'] = 0;
}
$noException = true;
if($sanitizedData['papel_formato_id'] == null && $sanitizedData['papel_formato_ancho'] == null
&& $sanitizedData['papel_formato_alto'] == null){
@ -795,8 +802,10 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
}
if(array_key_exists('error', $linea))
if(array_key_exists('error', $linea)){
//array_push($lineas, $linea); for debug
continue;
}
if($maquina->is_inkjet){
// calculo de tintas

View File

@ -18,7 +18,7 @@ class Test extends BaseController
public function index()
{
echo '<pre>';
($this->getPapelesSobrecubierta());
($this->testLineasSobrecubierta());
echo '</pre>';
/*
@ -521,6 +521,99 @@ class Test extends BaseController
echo '</pre>';
}
public static function testLineasSobrecubierta()
{
$uso = 'sobrecubierta';
$tipo = 'colorhq';
$datosPedido = (object)array(
'paginas' => 240,
'tirada' => 100,
'merma' => 10,
'merma_portada' => 10,
'ancho' => 150,
'alto' => 210,
'isCosido' => true,
'solapas' => false,
);
$opciones_papel = array(
'sobrecubierta' => 1,
'rotativa' => 0,
);
// Se obtienen los papeles disponibles
$papelimpresionmodel = new \App\Models\Configuracion\PapelImpresionModel();
$papeles = $papelimpresionmodel->getIdPapelesImpresionForPresupuesto(
papel_generico_id: 1, // Blanco offset
gramaje: 200,
options: $opciones_papel
);
echo '<pre>';
var_dump($papeles);
echo '</pre>';
$lineas = array();
// Para cada papel, se obtienen las maquinas disponibles
foreach ($papeles as $papel) {
$maquinamodel = new \App\Models\Configuracion\MaquinaModel();
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
is_rotativa: 0,
tarifa_tipo: $tipo,
uso_tarifa: 'sobrecubierta',
tirada: $datosPedido->tirada + $datosPedido->merma,
papel_impresion_id: $papel->id,
);
echo '<pre>';
echo '-------------------------------';
echo '</pre>';
echo '<pre>';
var_dump($maquinas);
echo '</pre>';
// Se recorren las máquinas y se calcula el coste de linea por cada una
foreach ($maquinas as $maquina) {
echo '<pre>';
echo '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$';
echo '</pre>';
$tarifamodel = new \App\Models\Configuracion\MaquinasTarifasImpresionModel();
$tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
echo '<pre>';
var_dump($tarifa);
echo '</pre>';
if(!is_float($tarifa)){
continue;
}
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
$linea['fields']['maquina'] = $maquina->maquina;
$linea['fields']['maquina_id'] = $maquina->maquina_id;
$linea['fields']['papel_impresion'] = $papel->nombre;
$linea['fields']['papel_impresion_id'] = $papel->id;
$linea['fields']['paginas'] = $datosPedido->paginas;
$linea['fields']['gramaje'] = 100;
$linea['fields']['papel_generico_id'] = 3;
$linea['fields']['papel_generico'] = 'Blanco offset';
array_push($lineas, $linea);
}
}
echo '<pre>';
var_dump($lineas);
echo '</pre>';
}
}

0
ci4/app/Entities/Clientes/ClientePreciosEntity.php Normal file → Executable file
View File

View File

@ -39,6 +39,8 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"tirada" => null,
"solapas" => false,
"solapas_ancho" => 0.0,
"solapas_sobrecubierta" => false,
"solapas_ancho_sobrecubierta" => 0.0,
"cosido" => false,
"sobrecubiertas" => false,
"sobrecubiertas_ancho" => 0.0,
@ -107,6 +109,8 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"tirada" => "int",
"solapas" => "boolean",
"solapas_ancho" => "float",
"solapas_sobrecubierta" => "boolean",
"solapas_ancho_sobrecubierta" => "float",
"cosido" => "boolean",
"sobrecubiertas" => "boolean",
"sobrecubiertas_ancho" => "float",

View File

@ -95,7 +95,9 @@ return [
'sobrecubierta' => 'Sobrecubierta',
'encuadernacion' => 'Encuadernación',
'solapasCubierta' => 'Solapas cubierta',
'solapasAnchoCubierta' => 'Ancho solapas cubierta',
'solapasSobrecubierta' => 'Solapas sobrecub.',
'solapasAnchoCubierta' => 'Ancho solapas cub.',
'solapasAnchoSobrecubierta' => 'Ancho solapas sobrecub.',
'sinImpresion' => 'Sin impresion',
'1cara' => '1 cara',
'2caras' => '2 caras',

0
ci4/app/Models/Clientes/ClientePreciosModel.php Normal file → Executable file
View File

View File

@ -60,6 +60,8 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"tirada",
"solapas",
"solapas_ancho",
"solapas_sobrecubierta",
"solapas_ancho_sobrecubierta",
"cosido",
"sobrecubiertas",
"sobrecubiertas_ancho",

View File

@ -15,8 +15,7 @@
<div class="col-md-12 col-lg-2 px-4">
<div class="row">
<div class="mb-3">
<div class="mb-1">
<label for="paginas" class="form-label">
<?= lang('Presupuestos.paginas') ?>*
</label>
@ -24,37 +23,21 @@
</div><!--//.mb-3 -->
</div>
<?php if($tipo_impresion_id != 1 && $tipo_impresion_id != 3 && $tipo_impresion_id != 5 && $tipo_impresion_id != 7): ?>
<div class="row">
<div class="mb-3">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="solapas"><?= lang('Presupuestos.solapasCubierta') ?></label>
</div>
</div><!--//.mb-3 -->
</div>
<?php endif; ?>
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<div class="mb-1">
<label for="tirada" class="form-label">
<?= lang('Presupuestos.tirada') ?>*
</label>
<input type="number" id="tirada" name="tirada" tabindex="2" maxLength="11" class="form-control" value="<?= old('tirada', $presupuestoEntity->tirada) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-4 px-4">
<div class="mb-3">
<div class="mb-1">
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
<?= lang('Presupuestos.papelFormatoId') ?>*
</label>
@ -72,30 +55,24 @@
<div class="row">
<div class="col-md-12 col-lg-6">
<div class="mb-3">
<div class="mb-1">
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control formato_libro" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6">
<div class="mb-3">
<div class="mb-1">
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control formato_libro" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1" <?= $presupuestoEntity->papel_formato_personalizado == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
</div>
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<div class="mb-1">
<label for="merma" class="form-label">
<?= lang('Presupuestos.merma') ?>*
</label>
@ -104,7 +81,7 @@
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<div class="mb-1">
<label for="mermacubierta" class="form-label">
<?= lang('Presupuestos.mermacubierta') ?>*
</label>
@ -114,29 +91,81 @@
</div> <!--//.row -->
<!-- Fila 2 -->
<div class="row">
</div>
<?php if($tipo_impresion_id != 1 && $tipo_impresion_id != 3 && $tipo_impresion_id != 5 && $tipo_impresion_id != 7): ?>
<?php if($presupuestoEntity->solapas == true): ?>
<div class="row" id="div_solapas_ancho">
<?php else: ?>
<div class="row" id="div_solapas_ancho" style="display:none;">
<?php endif; ?>
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label for="solapas_ancho" class="form-label">
<?= lang('Presupuestos.solapasAnchoCubierta') ?>*
<?php if($tipo_impresion_id != 1 && $tipo_impresion_id != 3 && $tipo_impresion_id != 5 && $tipo_impresion_id != 7): ?>
<div class="row">
<div class="mb-1">
<div class="form-check form-switch mb-2">
<input class="form-check-input solapas_cubierta" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="solapas"><?= lang('Presupuestos.solapasCubierta') ?></label>
</div>
</div><!--//.mb-3 -->
</div>
<?php endif; ?>
</div>
<div class="col-md-12 col-lg-2 px-4">
<div class="row">
<div class="mb-1">
<div class="form-check form-switch mb-2">
<input class="form-check-input solapas_sobrecubierta" type="checkbox" id="solapas_sobrecubierta" name="solapas_sobrecubierta" tabindex="6" value="1" <?= $presupuestoEntity->solapas_sobrecubierta == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="solapas_sobrecubierta"><?= lang('Presupuestos.solapasSobrecubierta') ?></label>
</div>
</div><!--//.mb-3 -->
</div>
</div>
<div class="col-md-12 col-lg-6 px-4">
<div class="row">
<div class="mb-1">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1" <?= $presupuestoEntity->papel_formato_personalizado == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
</div>
</div>
</div>
</div>
</div>
<!-- Fila 3 -->
<div class="row">
<div class="col-md-12 col-lg-2 px-4">
<?php if($tipo_impresion_id != 1 && $tipo_impresion_id != 3 && $tipo_impresion_id != 5 && $tipo_impresion_id != 7): ?>
<?php if($presupuestoEntity->solapas == true): ?>
<div class="mb-1" id="div_solapas_ancho">
<?php else: ?>
<div class="mb-1" id="div_solapas_ancho" style="display:none;">
<?php endif; ?>
<label for="solapas_ancho" class="form-label">
<?= lang('Presupuestos.solapasAnchoCubierta') ?>*
</label>
<input type="number" id="solapas_ancho" name="solapas_ancho" placeholder="0" maxLength="8" step="1" class="form-control solapas_cubierta" value="<?= old('solapas_ancho', $presupuestoEntity->solapas_ancho) ?>">
</div><!--//.mb-1 -->
<?php endif; ?>
</div>
<div class="col-md-12 col-lg-2 px-4">
<?php if($presupuestoEntity->solapas_sobrecubierta == true): ?>
<div class="mb-1" id="div_solapas_ancho_sobrecubierta">
<?php else: ?>
<div class="mb-1" id="div_solapas_ancho_sobrecubierta" style="display:none;">
<?php endif; ?>
<label for="solapas_ancho_sobrecubierta" class="form-label">
<?= lang('Presupuestos.solapasAnchoSobrecubierta') ?>*
</label>
<input type="number" id="solapas_ancho" name="solapas_ancho" placeholder="6.00" maxLength="8" step="0.01" class="form-control" value="<?= old('solapas_ancho', $presupuestoEntity->solapas_ancho) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<input type="number" id="solapas_ancho_sobrecubierta" name="solapas_ancho_sobrecubierta" placeholder="0" maxLength="8" step="1" class="form-control solapas_sobrecubierta" value="<?= old('solapas_ancho', $presupuestoEntity->solapas_ancho_sobrecubierta) ?>">
</div><!--//.mb-1 -->
</div>
</div>
<?php endif; ?>
@ -279,6 +308,14 @@ $('#paginas').on("change", function () {
}
});
$('.solapas_cubierta').on('change', function(){
$('#compGramajeCubierta').trigger('change')
})
$('.solapas_sobrecubierta').on('change', function(){
$('#compGramajeSobrecubierta').trigger('change')
})
$('#tirada').on("change", function () {
calcular_mermas()
@ -306,7 +343,7 @@ function calcular_mermas(){
merma_lineas = []
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_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta'){
const formas_linea = <?php echo $isCosido; ?>==0?parseInt(rowData.formas):parseInt(rowData.formas)/2
if(formas_linea > tirada)
merma_lineas.push(formas_linea-tirada)
@ -434,7 +471,7 @@ function event_change_formato(){
$("#solapas").on("click", function () {
var e = document.getElementById('div_solapas_ancho');
if (document.getElementById('solapas').checked) {
e.style.display = "flex";
e.style.display = "block";
}
else {
e.style.display = "none";
@ -444,4 +481,15 @@ $("#solapas").on("click", function () {
});
<?php endif; ?>
$("#solapas_sobrecubierta").on("click", function () {
var e = document.getElementById('div_solapas_ancho_sobrecubierta');
if (document.getElementById('solapas_sobrecubierta').checked) {
e.style.display = "block";
}
else {
e.style.display = "none";
}
$('#serv_default').click()
});
<?= $this->endSection() ?>

View File

@ -444,7 +444,7 @@
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingThree">
<button id="accordion-button-cubierta" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompCubiertaSobrecubiertaTip" aria-expanded="false" aria-controls="accordionCompCubiertaSobrecubiertaTip">
<h6 id="title_cubierta"><?= lang("Presupuestos.cubierta") ?></h6>
<h6 id="title_cubierta"><?= lang("Presupuestos.compCubiertaSobrecubierta") ?></h6>
</button>
</h2>
@ -486,7 +486,7 @@
<button type="button" name="insertarCubiertaBtn"
id="insertarCubiertaBtn"
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.cubierta')) ?>
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.compCubiertaSobrecubierta')) ?>
</button>
</div>
@ -762,8 +762,11 @@
}
else{
value = 'disabled'
$('#compPapelSobrecubierta').val(0)
$('#compPapelSobrecubierta').val(0)
$('#compGramajeSobrecubierta').val('')
$('#compGramajeSobrecubierta').select2("destroy")
$('#compGramajeSobrecubierta').select2({allowClear: false, minimumResultsForSearch: Infinity})
}
$('#compPapelSobrecubierta').prop('disabled', value);
$('#compGramajeSobrecubierta').prop('disabled', value);
@ -830,6 +833,20 @@
}catch(e){}
}catch(e){}
try{
$("#compSobrecubierta").val(parseInt(comp_data.sobrecubierta.imprimir)).change();
try{
$("#compPapelSobrecubierta").val(parseInt(comp_data.sobrecubierta.papel_id)).trigger('select2:select');
try{
var newState = new Option(comp_data.sobrecubierta.gramaje, comp_data.sobrecubierta.gramaje, true, true);
// Append it to the select
$("#compGramajeSobrecubierta").append(newState).trigger('change');
$('#compGramajeSobrecubierta').prop('disabled', false);
}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');
@ -960,7 +977,7 @@
searching: false,
paging: false,
info: false,
ordering: false,
ordering: true,
responsive: true,
select: false,
language: {
@ -1003,7 +1020,8 @@
visible: false,
searchable: false
},
]
],
"order": [ [0, 'asc'],[15, 'asc'] ]
});
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
@ -1301,7 +1319,7 @@
alto: dimension.alto,
lomo: getLomoLineasPresupuesto(),
solapas: $('#solapas').is(':checked')?1:0,
solapas_ancho: parseInt($('#solapas_ancho').val()),
solapas_ancho: $('#solapas').is(':checked')?parseInt($('#solapas_ancho').val()):0,
papel_generico_id: $('#compPapelCubierta').select2('data')[0].id,
papel_generico: $('#compPapelCubierta').select2('data')[0].text.trim(),
gramaje: $('#compGramajeCubierta').select2('data')[0].text.trim() ,
@ -1318,10 +1336,10 @@
clearCubierta();
if(data.lineas.length >0){
fillCubierta(data);
selectCubiertaLineas();
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
tableCompCubierta.order([0, 'asc']).draw()
$('#title_cubierta').html('<?= lang("Presupuestos.compCubiertaSobrecubierta") ?>' + (tableCompCubierta.rows().count()>0 ?(' (' + tableCompCubierta.rows().count() + ')'):''));
$('#insertarCubiertaBtn').removeClass('d-none')
if(actualizarLinea){
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
@ -1331,9 +1349,14 @@
}
}
else{
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>');
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
$('#title_cubierta').html('<?= lang("Presupuestos.compCubiertaSobrecubierta") ?>' + (tableCompCubierta.rows().count()>0 ?(' (' + tableCompCubierta.rows().count() + ')'):''));
if(tableCompCubierta.rows().count()==0){
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
}
else{
selectCubiertaLineas();
}
}
yeniden(data.<?= csrf_token() ?>);
@ -1347,7 +1370,7 @@
else{
clearCubierta();
}
}
}
$('.comp_sobrecubierta_items').on('change', function (){
@ -1362,6 +1385,7 @@
$('#compPapelSobrecubierta').select2('data').length > 0 &&
$('#compGramajeSobrecubierta').select2('data').length > 0 ){
const dimension = getDimensionLibro();
let datos = {
@ -1375,8 +1399,8 @@
alto: dimension.alto,
lomo: getLomoLineasPresupuesto(),
lomo_cubierta: getLomoCubiertaLineasPresupuesto(),
solapas: $('#solapas').is(':checked')?1:0,
solapas_ancho: parseInt($('#solapas_ancho').val()),
solapas: $('#solapas_sobrecubierta').is(':checked')?1:0,
solapas_ancho: $('#solapas_sobrecubierta').is(':checked')?parseInt($('#solapas_ancho_sobrecubierta').val()):0,
papel_generico_id: $('#compPapelSobrecubierta').select2('data')[0].id,
papel_generico: $('#compPapelSobrecubierta').select2('data')[0].text.trim(),
gramaje: $('#compGramajeSobrecubierta').select2('data')[0].text.trim() ,
@ -1389,27 +1413,32 @@
url: "/cosidotapablanda/datatable",
data: datos,
success: function (data) {
console.log(data)
clearSobrecubierta();
if(data.lineas.length >0){
fillCubierta(data);
fillSobrecubierta(data);
selectCubiertaLineas();
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
tableCompCubierta.order([ [0, 'asc'],[15, 'asc'] ]).draw()
$('#title_cubierta').html('<?= lang("Presupuestos.compCubiertaSobrecubierta") ?>' + (tableCompCubierta.rows().count()>0 ?(' (' + tableCompCubierta.rows().count() + ')'):''));
$('#insertarCubiertaBtn').removeClass('d-none')
if(actualizarLinea){
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
/*var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
for(row of rows){
fill_lp_cubierta(row, true);
}
}*/
}
}
else{
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>');
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
$('#title_cubierta').html('<?= lang("Presupuestos.compCubiertaSobrecubierta") ?>' + (tableCompCubierta.rows().count()>0 ?(' (' + tableCompCubierta.rows().count() + ')'):''));
if(tableCompCubierta.rows().count()==0){
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
}
else{
selectCubiertaLineas();
}
}
yeniden(data.<?= csrf_token() ?>);
@ -1422,7 +1451,7 @@
}
else{
clearCubierta();
clearSobrecubierta();
}
}
@ -1746,8 +1775,7 @@
$('#compGramajeCubierta').prop('disabled', true);
}
else{
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
clearCubierta();
$('#compGramajeCubierta').empty().trigger("change");
$('#compGramajeCubierta').val('').trigger('change');
$('#compGramajeCubierta').prop('disabled', false);
@ -1783,16 +1811,20 @@
}
});
$('#compPapelSobrecubierta').on('select2:open', function (e){
$('#compGramajeSobrecubierta').val(0).trigger('change');
$('#compGramajeSobrecubierta').select2("destroy")
$('#compGramajeSobrecubierta').select2({allowClear: false, minimumResultsForSearch: Infinity})
})
$('#compPapelSobrecubierta').on('select2:select', function (e){
if($('#compPapelSobrecubierta').select2('data')[0].id=='0'){
$('#compGramajeSobrecubierta').val('').change();
$('#compGramajeSobrecubierta').prop('disabled', true);
}
else{
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
$('#compGramajeSobrecubierta').empty().trigger("change");
$('#compGramajeSobrecubierta').val('').trigger('change');
clearSobrecubierta();
$('#compGramajeSobrecubierta').prop('disabled', false);
$('#compPapelSobrecubierta').find('option[value="0"]').remove();
$('#compGramajeSobrecubierta').select2({

View File

@ -3507,7 +3507,7 @@ function getLomoCubiertaLineasPresupuesto(){
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var rowData = this.data();
if(rowData.row_id == 'lp_cubierta')
return parseFloat(rowData.lomo)
lomoTotal += parseFloat(rowData.lomo)
})
}
catch(error){

View File

@ -342,6 +342,7 @@ function clearCubierta() {
function clearSobrecubierta() {
var tabla = $('#tableCompCubierta').DataTable();
tabla
.rows(function (idx, data, node) {
@ -591,6 +592,19 @@ function fillCubierta(data) {
})
}
function fillSobrecubierta(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")
$('#tableCompCubierta').DataTable().row
.add(getRowFromLineaInt('sobrecubierta', linea))
.draw()
})
}
function fillGuardas(data) {
let sorted = data.lineas.sort(
@ -697,6 +711,20 @@ function generateCompJSON() {
}
$.extend(data, cubierta_obj);
try {
sobrecubierta_obj = {
"sobrecubierta": {
'imprimir': $('#compSobrecubierta option:selected').val(),
'papel_id': $('#compPapelSobrecubierta').select2('data')[0].id,
'gramaje': $('#compGramajeSobrecubierta').select2('data')[0].text.trim(),
},
}
}
catch (e) {
sobrecubierta_obj = {}
}
$.extend(data, sobrecubierta_obj);
if($('#compCarasGuardas').length>0){
try {
guardas_obj = {

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

0
sk-commit.bat Normal file → Executable file
View File

0
sk-new-branch.bat Normal file → Executable file
View File