Merge branch 'dev/presupuestos3_lp_2' into 'dev/presupuestos3'

Dev/presupuestos3 lp 2

See merge request jjimenez/safekat!71
This commit is contained in:
2023-11-10 12:19:15 +00:00
13 changed files with 2313 additions and 377 deletions

View File

@ -145,6 +145,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
// Tarifas
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
@ -440,6 +442,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
];
$gramaje = $reqData['gramaje'] ?? 0;
if ($type=='interior') {
@ -461,7 +465,21 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
'color' => intval($reqData['paginas_color']) ?? 0,
);
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas);
$datosTipolog = $reqData['negro'] ?? null;
if(!is_null($datosTipolog)){
$datosTipolog = [];
$data = (object)array(
'negro' => intval($reqData['negro']) ?? 0,
'cyan' => intval($reqData['cyan']) ?? 0,
'magenta' => intval($reqData['magenta']) ?? 0,
'amarillo' => intval($reqData['amarillo']) ?? 0,
'gota_negro' => intval($reqData['gota_negro']) ?? 0,
'gota_color' => intval($reqData['gota_color']) ?? 0,
);
array_push($datosTipolog, $data);
}
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
@ -551,6 +569,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
is_rotativa: 0,
tarifa_tipo: $tipo,
uso_tarifa: $uso,
tirada: $datosPedido->tirada + $datosPedido->merma,
papel_impresion_id: $papel->id,
);
@ -584,7 +603,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
return $lineas;
}
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas)
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog = null)
{
$uso = 'interior';
@ -628,10 +647,20 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
foreach ($papeles as $papel) {
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
$datosTipologias = $papelImpresionTipologiaModel
->findTipologiasForPapelImpresion($papel->id, $parametrosRotativa->colorPages>0?'color':'negro')
->get()->getResultObject();
if(is_null($datosTipolog)){
$datosTipologias = $papelImpresionTipologiaModel
->findTipologiasForPapelImpresion($papel->id, $parametrosRotativa->colorPages>0?'color':'negro')
->get()->getResultObject();
if(count($datosTipologias)==0){
continue;
}
}
else{
$datosTipologias = $datosTipolog;
}
$parametrosRotativa->rotativa_gota_negro = $datosTipologias[0]->gota_negro;
$parametrosRotativa->rotativa_gota_color = $datosTipologias[0]->gota_color;
$parametrosRotativa->rotativa_negro = $datosTipologias[0]->negro;
@ -644,6 +673,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
is_rotativa: 1,
tarifa_tipo: $tipo,
uso_tarifa: $uso,
tirada: $datosPedido->tirada + $datosPedido->merma,
papel_impresion_id: $papel->id,
);
@ -678,6 +708,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$linea['fields']['papel_impresion'] = $papel->nombre;
$linea['fields']['papel_impresion_id'] = $papel->id;
$linea['fields']['paginas'] = $datosPedido->paginas;
$linea['fields']['paginas_color'] = $paginas->color;
$linea['fields']['gramaje'] = $gramaje;
$linea['fields']['papel_generico_id'] = $papel_generico['id'];
$linea['fields']['papel_generico'] = $papel_generico['nombre'];
@ -686,6 +717,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$linea['fields']['num_formas_horizontales'] = floor($linea['fields']['factor_anchura']);
$linea['fields']['num_formas_verticales'] = floor($linea['fields']['factor_altura']);
$linea['fields']['datosTipologias'] = $datosTipologias[0];
// impresion
$linea['fields']['precio_click'] = $tarifa;
$linea['fields']['precio_click_pedido'] = $linea['fields']['clicks_pedido'] * $linea['fields']['precio_click'];
@ -786,8 +819,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$alto = $reqData['alto'] ?? null;
// Datos contiene la tirada
// uso: negro, negrohq, color, colorhq,
$uso_tarifa = $reqData['uso_tarifa'] ?? 'interior';
$model = new MaquinaModel();
$maquinas = $model->getMaquinaImpresionForPresupuesto($is_rotativa, $uso, $datos, $papel_impresion );
$maquinas = $model->getMaquinaImpresionForPresupuesto($is_rotativa, $uso, $uso_tarifa ,$datos, $papel_impresion );
$menu = [];
foreach ($maquinas as $maquina){
@ -850,6 +884,29 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
return $data;
}
protected function getPapelGenericoRotativaNegro()
{
$model = model('App\Models\Configuracion\PapelGenericoModel');
$data = $model->getPapelForComparador('negro', false, false, true);
array_unshift($data, (object)array(
"id" => 0,
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
));
return $data;
}
protected function getPapelGenericoRotativaColor()
{
$model = model('App\Models\Configuracion\PapelGenericoModel');
$data = $model->getPapelForComparador('color', false, false, true);
array_unshift($data, (object)array(
"id" => 0,
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
));
return $data;
}
protected function getPapelGenericoNegro()
{
$model = model('App\Models\Configuracion\PapelGenericoModel');

View File

@ -92,6 +92,8 @@ return [
'color' => 'Colour',
'colorhq' => 'ColourHQ',
'rotativa' => 'Rotary',
'rotativa_bn' => 'Rot. BW',
'rotativa_color' => 'Rot. Colour',
'si' => 'Yes',
'no' => 'No',
'insertarLinea' => 'Insert Line',
@ -137,6 +139,15 @@ return [
'totalCorte' => 'Total Cut',
'totalImpresion' => 'TOTAL PRINT',
'addLineaPresupuesto' => 'Add line...',
'errores' => [
'paginas' => 'The field pages must be greater than zero',
'tiradas' => 'The field print must be greater than zero',
'dimension' => 'The book dimension must be greater than 60mm',
'lineaDuplicada' => 'That type of line already exists in the budget.',
],
/* '4x0' => '4x0',
'4x4' => '4x4',
'aprobadoAt' => 'Aprobado At',

View File

@ -91,6 +91,8 @@ return [
'color' => 'Color',
'colorhq' => 'ColorHQ',
'rotativa' => 'Rotativa',
'rotativa_bn' => 'Rot. BN',
'rotativa_color' => 'Rot. Color',
'si' => 'Si',
'no' => 'No',
'insertarLinea' => 'Insertar Línea',
@ -143,6 +145,8 @@ return [
'gTintaMagentaPed' => 'G.T. Magenta Ped.',
'gTintaAmarilloPed' => 'G.T. Amarillo Ped.',
'addLineaPresupuesto' => 'Añadir linea...',
'servicioAcabado' => 'Servicio de acabado',
'servicioPreimpresion' => 'Servicio de preimpresión',
'servicioEncuadernado' => 'Servicio de encuadernado',
@ -166,6 +170,13 @@ return [
'max_length' => 'El campo {field} no puede exceder los {param} caracteres de longitud.',
],
'errores' => [
'paginas' => 'El campo páginas tiene que ser mayor que cero',
'tiradas' => 'El campo tiradas tiene que ser mayor que cero',
'dimension' => 'La dimensión del libro tiene que ser mayor que 60mm',
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto'
],
/* '4x0' => '4x0',
'4x4' => '4x4',

View File

@ -336,7 +336,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
->groupEnd();
}
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $tirada, $papel_impresion_id = -1)
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $uso_tarifa = 'interior', $tirada, $papel_impresion_id = -1)
{
/*
1.-> tarifa_Tipo impresion
@ -371,11 +371,12 @@ class MaquinaModel extends \App\Models\GoBaseModel
if(is_array($tarifa_tipo)){
foreach($tarifa_tipo as $tarifa){
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.is_deleted=0)");
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.uso='{$uso_tarifa}' AND t2.is_deleted=0)");
}
}
else{
$builder->where("t2.tipo", $tarifa_tipo);
$builder->where("t2.uso", $uso_tarifa);
}
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();

View File

@ -93,7 +93,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
}
public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null)
public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null, $rotativa = null)
{
/*
1.-> Tipo impresion
@ -124,12 +124,19 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
$builder->where("t2.cubierta", 1);
}
}
if(!is_null($is_sobrecubierta)){
if($is_sobrecubierta==true){
$builder->where("t2.sobrecubierta", 1);
}
}
if(!is_null($rotativa)){
if($rotativa==true){
$builder->where("t2.rotativa", 1);
}
}
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
@ -162,15 +169,23 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
->where("t4.tipo", "impresion")
->where("t5.tipo", $tipo)
->where("t1.nombre", $papel_generico_nombre);
$uso_tarifa = 'interior';
if($uso == 'bn' || $uso == 'bnhq')
$builder->where("t2.bn", 1);
else if ($uso == 'color' || $uso == 'colorhq')
$builder->where("t2.color", 1);
else if ($uso == 'cubierta')
else if ($uso == 'cubierta'){
$uso_tarifa = 'cubierta';
$builder->where("t2.cubierta", 1);
else if ($uso == 'sobrecubierta')
}
else if ($uso == 'sobrecubierta'){
$uso_tarifa = 'sobrecubierta';
$builder->where("t2.sobrecubierta", 1);
}
$builder->where("t5.uso", $uso_tarifa);
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
$id = 1;
@ -209,18 +224,26 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
->where("t5.tipo", $tipo)
->where("t1.id", $papel_generico_id);
$uso_tarifa = 'interior';
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t2.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t2.color", 1);
if ($uso == 'cubierta')
if ($uso == 'cubierta'){
$uso_tarifa = 'cubierta';
$builder->where("t2.cubierta", 1);
else if ($uso == 'sobrecubierta')
}
else if ($uso == 'sobrecubierta'){
$uso_tarifa = 'sobrecubierta';
$builder->where("t2.sobrecubierta", 1);
}
if($uso=='rotativa')
$builder->where("t2.rotativa", 1);
else
$builder->where("t2.rotativa", 0);
$builder->where("t5.uso", $uso_tarifa);
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();

View File

@ -295,35 +295,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
$builder->where("t1.rotativa", 1);
else
$builder->where("t1.rotativa", 0);
/*
if($tipo=='negro' || $tipo=='negrohq'){
$builder->where("t1.bn", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='color' || $tipo=='colorhq'){
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='cubierta'){
$builder->where("t1.cubierta", 1);
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='sobrecubierta'){
$builder->where("t1.sobrecubierta", 1);
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='rot_bn'){
$builder->where("t1.bn", 1);
$builder->where("t1.rotativa", 1);
}
elseif($tipo=='rot_color'){
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 1);
}
*/
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}

View File

@ -233,6 +233,8 @@ class PresupuestoService extends BaseService
$data['precio_pagina_color'] = round($pag_color ? $data['precio_tinta'] / ($pag_color * ($datosPedido->tirada + $datosPedido->merma)) : 0, 6);
// calculo de corte
$data['velocidad_corte'] = $maquina->velocidad_corte;
$data['precio_hora_corte'] = $maquina->precio_hora_corte;
$data['tiempo_corte'] = $maquina->velocidad_corte > 0 ? round($metros_papel_total / $maquina->velocidad_corte, 2) : 0;
$data['total_corte'] = round(($data['tiempo_corte'] / 60.0) * $maquina->precio_hora_corte, 2);

View File

@ -24,7 +24,7 @@ if (session()->has('error')) {
<?= $this->section('additionalInlineJs') ?>
function popAlert(message, alertClass, alertIcon){
function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
var htmlString = `
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
<span class="alert-icon alert-icon-lg text-primary me-2">
@ -34,24 +34,26 @@ function popAlert(message, alertClass, alertIcon){
<h5 class="alert-heading mb-2">${message}</h5>
</div>
</div>`;
$(window).scrollTop(0);
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
if(containerId == 'sk-alert'){
$(window).scrollTop(0);
}
$('#' + containerId).hide().empty().html(htmlString).fadeIn("slow", function(){
setTimeout(function(){
$('#sk-alert').fadeOut("slow");
$('#' + containerId).fadeOut("slow");
}, 5000);
});
}
function popSuccessAlert(successMsg){
popAlert(successMsg, "alert-success", "ti-check");
function popSuccessAlert(successMsg, containerId = 'sk-alert'){
popAlert(successMsg, "alert-success", "ti-check", containerId);
}
function popWarningAlert(warningMsg){
popAlert(warningMsg, "alert-warning", "ti-bell");
function popWarningAlert(warningMsg, containerId = 'sk-alert'){
popAlert(warningMsg, "alert-warning", "ti-bell", containerId);
}
function popErrorAlert(errorMsg){
popAlert(errorMsg, "alert-danger", "ti-ban");
function popErrorAlert(errorMsg, containerId = 'sk-alert'){
popAlert(errorMsg, "alert-danger", "ti-ban", containerId);
}
<?php if (isset($successMessage) && $successMessage){ ?>

View File

@ -19,7 +19,7 @@
<label for="paginas" class="form-label">
<?= lang('Presupuestos.paginas') ?>*
</label>
<input type="number" id="paginas" name="paginas" maxLength="11" class="form-control" value="<?= old('paginas', $presupuestoEntity->paginas) ?>">
<input type="number" id="paginas" name="paginas" tabindex="1" maxLength="11" class="form-control" value="<?= old('paginas', $presupuestoEntity->paginas) ?>">
</div><!--//.mb-3 -->
</div>
@ -29,7 +29,7 @@
<div class="mb-3">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="solapas" name="solapas" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
<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="papelFormatoPersonalizado"><?= lang('Presupuestos.solapasCubierta') ?></label>
</div>
@ -44,7 +44,7 @@
<label for="tirada" class="form-label">
<?= lang('Presupuestos.tirada') ?>*
</label>
<input type="number" id="tirada" name="tirada" maxLength="11" class="form-control" value="<?= old('tirada', $presupuestoEntity->tirada) ?>">
<input type="number" id="tirada" name="tirada" tabindex="2" maxLength="11" class="form-control" value="<?= old('tirada', $presupuestoEntity->tirada) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
@ -55,7 +55,7 @@
<?= lang('Presupuestos.papelFormatoId') ?>*
</label>
<select id="papelFormatoId" name="papel_formato_id" class="form-control select2bs2" style="width: 100%;">
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
<?php if (isset($papelFormatoList) && is_array($papelFormatoList) && !empty($papelFormatoList)) :
foreach ($papelFormatoList as $formato) : ?>
@ -95,7 +95,7 @@
<label for="merma" class="form-label">
<?= lang('Presupuestos.merma') ?>*
</label>
<input type="number" id="merma" name="merma" maxLength="8" step="1" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
<input type="number" id="merma" name="merma" maxLength="8" tabindex="4" step="1" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
@ -104,7 +104,7 @@
<label for="mermacubierta" class="form-label">
<?= lang('Presupuestos.mermacubierta') ?>*
</label>
<input type="number" id="mermacubierta" name="merma_cubierta" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
<input type="number" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->

View File

@ -9,6 +9,9 @@
<div id="accordionDatosPresupuestoClienteTip" class="accordion-collapse collapse show" data-bs-parent="#accordionDatosPresupuestoCliente">
<div class="accordion-body">
<!----------------------------------------------------------------------------->
<div id="divAlarmasComparador"></div>
<!----------------------------------------------------------------------------->
<div class="divider divider-dark text-start mb-1">
<div class="divider-text">

View File

@ -151,50 +151,6 @@ $('.accordion-button').on('click', function (e) {
/*******************************
* Metodos
*******************************/
$('.insertarLinea').on("click", function (e) {
if(e.target.id.includes("Plana")){
// Se borran todas las líneas que no sean cubierta y sobrecubierta
$('#tableLineasPresupuesto').DataTable()
.rows( function ( idx, data, node ) {
return data[0] !== 'cubierta' && data[0] !== 'sobrecubierta';
} )
.remove()
.draw();
var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray();
console.log(rows);
for(row of rows){
$('#tableLineasPresupuesto').DataTable().row.add({
'tipo': row['tipo'],
'paginas': row['paginas'],
'papel': row['papel'],
'gramaje': row['gramaje'],
'marca': row['marca'],
'maquina': row['maquina'],
'tiempo': row['tiempoMaquina'],
'numeroPliegos': row['numeroPliegos'],
'pliegosPedido': row['pliegosPedido'],
'precioPliego': row['precioPliego'],
'libro': row['libro'],
'totalPapelPedido': row['totalPapelPedido'],
'chekPapel': true,
'lomo': row['lomo'],
'peso': row['peso'],
'click': row['click'],
'totalClicks': row['totalClicks'],
'chekClicks': true,
'maquinaId': row['maquinaId'],
'maquinaVelocidad': row['maquinaVelocidad'],
'papelGenericoId': row['papelGenericoId'],
'papelImpresionId': row['papelImpresionId'],
}
).draw();
}
}
});
function getRowFromLineaInt(tipo, linea) {
return {
@ -252,19 +208,11 @@ function getRowFromLineaRot(linea) {
'tiempoMaquina': linea.fields.tiempo_maquina,
'papelGenericoId': linea.fields.papel_generico_id,
'papelImpresionId': linea.fields.papel_impresion_id,
'paginasColor': linea.fields.paginas_color,
}
}
function checkDatosPedidoForComp() {
if (parseInt($('#paginas').val()) > 0 &&
parseInt($('#tirada').val()) > 0 &&
($('#papelFormatoId').select2('data').length > 0 ||
(parseInt($('#papelFormatoAncho').val()) > 0 && parseInt($('#papelFormatoAlto').val()) > 0)))
return true;
return false;
}
@ -530,12 +478,20 @@ function getIDsComparador(is_color, is_hq){
function getDimensionLibro(){
var ancho = 0;
var alto = 0;
if($('#papelFormatoId').select2('data').length > 0){
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
if($('#papelFormatoId').select2('data')[0].id.length > 0){
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
}
else if(document.getElementById('papelFormatoPersonalizado').checked){
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
}
}
else{
else if(document.getElementById('papelFormatoPersonalizado').checked){
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
}

View File

@ -184,7 +184,7 @@
info: false,
ordering: false,
responsive: true,
select: true,
select: false,
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
@ -239,7 +239,7 @@
info: false,
ordering: false,
responsive: true,
select: true,
select: false,
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
@ -281,11 +281,12 @@
{ 'data': 'maquinaVelocidad'},
{ 'data': 'tiempoMaquina'},
{ 'data': 'papelGenericoId'},
{ 'data': 'papelImpresionId'}
{ 'data': 'papelImpresionId'},
{ 'data': 'paginasColor'},
],
columnDefs: [
{
target: [21,22,23,24,25],
target: [21,22,23,24,25,26],
visible: false,
searchable: false
},
@ -299,7 +300,7 @@
info: false,
ordering: false,
responsive: true,
select: true,
select: false,
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
@ -358,7 +359,7 @@
},
});
$('.comp_negro_items').on('change', function (e) {
@ -485,7 +486,6 @@
}
return false;
}
$('.comp_cubierta_items').on('change', function (){
@ -550,38 +550,17 @@
$('#tipoImpresion').on("change", function () {
updatePapelesComparador();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
$('#paginas').change();
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if (($('#tipoImpresion').select2('data')[0].id == 'negro' ||
$('#tipoImpresion').select2('data')[0].id == 'color')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if( $('#tableCompIntPlana').DataTable().rows().count() > 0 &&
$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
else if (($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
$('#tipoImpresion').select2('data')[0].id == 'colorhq')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if($('#tableCompIntPlana').DataTable().rows().count() > 0 &&
!$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
});
@ -591,11 +570,16 @@
if ($(''+ elementos.papel).select2('data').length > 0 &&
$(''+ elementos.gramaje).select2('data').length > 0 &&
parseInt($(''+ elementos.paginas).val()) > 0 &&
checkDatosPedidoForComp()) {
getLineasIntPlana(is_color, is_hq).then((result) =>{
getLineasIntRot(is_hq);
// Para rotativa, si es color el papel y el gramaje tiene que ser igual
if(!is_color || ($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id &&
$('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim()))
{
getLineasIntRot(is_hq);
}
});
}
else{
@ -835,10 +819,9 @@
function checkComparadorInt(is_color, is_hq) {
elementos = getIDsComparador(is_color, is_hq)
if ($(''+ elementos.papel).select2('data').length > 0 &&
$(''+ elementos.gramaje).select2('data').length > 0 &&
parseInt($(''+ elementos.paginas).val()) > 0 &&
checkDatosPedidoForComp()) {
getLineasIntPlana(is_color, is_hq).then((result) =>{
@ -1069,8 +1052,37 @@
}
});
function checkDatosPedidoForComp() {
const dimension = getDimensionLibro();
if (parseInt($('#paginas').val()) <= 0){
popErrorAlert('<?=lang('Presupuestos.errores.paginas') ?>', 'divAlarmasComparador');
return false;
}
if (parseInt($('#tirada').val()) <= 0){
popErrorAlert('<?=lang('Presupuestos.errores.tiradas') ?>', 'divAlarmasComparador');
return false;
}
if('ancho' in dimension && 'alto' in dimension){
if(dimension.alto < 60 || dimension.ancho < 60 || isNaN(dimension.alto) || isNaN(dimension.ancho) ){
popErrorAlert('<?=lang('Presupuestos.errores.dimension') ?>', 'divAlarmasComparador');
return false;
}
}
else{
popErrorAlert('<?=lang('Presupuestos.errores.dimension') ?>', 'divAlarmasComparador');
return false;
}
return true;
}
<?= $this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
@ -1088,5 +1100,4 @@
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>
<?=$this->endSection() ?>