From 71706158ca8de82843de1fbd6cc436c725105b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez=20Ortega?= Date: Mon, 6 Nov 2023 09:11:05 +0100 Subject: [PATCH] linea de presupuesto bn funcionando a falta de borrar --- .../Presupuestos/Cosidotapablanda.php | 457 +++--------------- .../Configuracion/PapelGenericoModel.php | 55 ++- .../Configuracion/PapelImpresionModel.php | 70 +++ ci4/app/Services/PresupuestoService.php | 4 +- .../cosidotapablanda/_datosLibroItems.php | 4 +- .../_lineasPresupuestoItems.php | 266 ++++++++-- .../viewCosidotapablandaForm.php | 3 +- httpdocs/themes/vuexy/css/sk-datatables.css | 3 +- 8 files changed, 425 insertions(+), 437 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php index a75a8c57..49b3598e 100644 --- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php +++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php @@ -747,20 +747,78 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController $datos = $reqData['datos'] ?? null; //$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); if ($tipo == 'gramaje') { // En este caso contiene el nombre del papel generico $model = new PapelGenericoModel(); $menu = $model->getGramajeComparador($datos, $uso ); + + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + } + elseif ($tipo == 'gramajeLineasPresupuesto') { + $tipoLinea = $reqData['tipoLinea'] ?? null; + // En este caso contiene el id del papel generico + $model = new PapelGenericoModel(); + $menu = $model->getGramajeLineasPresupuesto($datos, $tipoLinea, $uso ); + + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + } + elseif ($tipo == 'papelImpresion') { + $gramaje = $reqData['gramaje'] ?? null; + $tipoLinea = $reqData['tipoLinea'] ?? null; + // En este caso contiene el nombre del papel generico + // Uso: negro, negrohq, color, colorhq, rot_bn, rot_color, + $model = new PapelImpresionModel(); + $menu = $model->getPapelesImpresionForMenu($datos, $gramaje, $tipoLinea, $uso ); + + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; } + elseif ($tipo == 'maquina') { + $is_rotativa = $reqData['is_rotativa'] ?? null; + $papel_impresion = $reqData['papel_impresion'] ?? null; + $tipo_linea = $reqData['tipoLinea'] ?? null; + $ancho = $reqData['ancho'] ?? null; + $alto = $reqData['alto'] ?? null; + // Datos contiene la tirada + // uso: negro, negrohq, color, colorhq, + $model = new MaquinaModel(); + $maquinas = $model->getMaquinaImpresionForPresupuesto($is_rotativa, $uso, $datos, $papel_impresion ); + $menu = []; + foreach ($maquinas as $maquina){ + + $formas = PresupuestoService::getNumFormasPlana($tipo_linea, $maquina, floatval($ancho), floatval($alto), true); + + if($formas['num_formas'] != 'n/a'){ + array_push($menu, $maquina); + } + } - $newTokenHash = csrf_hash(); - $csrfTokenName = csrf_token(); - $data = [ - 'menu' => $menu, - $csrfTokenName => $newTokenHash - ]; + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + } + + else{ + + $data = [ + 'tipo' => $tipo, + $csrfTokenName => $newTokenHash + ]; + } + return $this->respond($data); } else { return $this->failUnauthorized('Invalid request', 403); @@ -912,391 +970,4 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController - /* - - - - - - protected function getUbicacionLibroListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('LgUbicacionesLibros.ubicacionLibro'))])]; - if (!empty($selId)) : - $ubicacionesLibroModel = model('App\Models\Configuracion\UbicacionesLibroModel'); - - $selOption = $ubicacionesLibroModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getFormaPagoListItems() - { - $formasPagoModel = model('App\Models\Configuracion\FormasPagoModel'); - $onlyActiveOnes = true; - $data = $formasPagoModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes); - - return $data; - } - - - protected function getPapelImpresionListItems4($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])]; - if (!empty($selId)) : - $papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel'); - - $selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPresupuestoEstadoListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PresupuestoEstados.presupuestoEstado'))])]; - if (!empty($selId)) : - $presupuestoEstadoModel = model('App\Models\Presupuestos\PresupuestoEstadoModel'); - - $selOption = $presupuestoEstadoModel->where('id', $selId)->findColumn('estado'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPapelGenericoListItems3($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])]; - if (!empty($selId)) : - $papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel'); - - $selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPapelImpresionListItems2($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])]; - if (!empty($selId)) : - $papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel'); - - $selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getMaquinaListItems3($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])]; - if (!empty($selId)) : - $maquinaModel = model('App\Models\Presupuestos\MaquinaModel'); - - $selOption = $maquinaModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getMaquinasTarifasImpresionListItems2($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])]; - if (!empty($selId)) : - $maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel'); - - $selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('precio'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPapelGenericoListItems2($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])]; - if (!empty($selId)) : - $papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel'); - - $selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getMaquinaListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])]; - if (!empty($selId)) : - $maquinaModel = model('App\Models\Presupuestos\MaquinaModel'); - - $selOption = $maquinaModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - - - protected function getMaquinaListItems2($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])]; - if (!empty($selId)) : - $maquinaModel = model('App\Models\Presupuestos\MaquinaModel'); - - $selOption = $maquinaModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getTipologiasLibroListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('TipologiasLibros.tipologiasLibro'))])]; - if (!empty($selId)) : - $tipologiasLibroModel = model('App\Models\Presupuestos\TipologiasLibroModel'); - - $selOption = $tipologiasLibroModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPapelImpresionListItems3($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])]; - if (!empty($selId)) : - $papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel'); - - $selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getMaquinasTarifasImpresionListItems4($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])]; - if (!empty($selId)) : - $maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel'); - - $selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('precio'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getUserListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])]; - if (!empty($selId)) : - $userModel = model('App\Models\Presupuestos\UserModel'); - - $selOption = $userModel->where('id_user', $selId)->findColumn('first_name'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getMaquinasTarifasImpresionListItems3($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])]; - if (!empty($selId)) : - $maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel'); - - $selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('id'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getUserListItems3($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])]; - if (!empty($selId)) : - $userModel = model('App\Models\Presupuestos\UserModel'); - - $selOption = $userModel->where('id_user', $selId)->findColumn('first_name'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPapelImpresionListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])]; - if (!empty($selId)) : - $papelImpresionModel = model('App\Models\Presupuestos\PapelImpresionModel'); - - $selOption = $papelImpresionModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getTiposImpresionListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('TiposImpresions.tiposImpresion'))])]; - if (!empty($selId)) : - $tiposImpresionModel = model('App\Models\Presupuestos\TiposImpresionModel'); - - $selOption = $tiposImpresionModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getMaquinasTarifasImpresionListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifasImpresion'))])]; - if (!empty($selId)) : - $maquinasTarifasImpresionModel = model('App\Models\Presupuestos\MaquinasTarifasImpresionModel'); - - $selOption = $maquinasTarifasImpresionModel->where('id', $selId)->findColumn('precio'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPapelGenericoListItems4($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])]; - if (!empty($selId)) : - $papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel'); - - $selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - - protected function getMaquinaListItems4($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])]; - if (!empty($selId)) : - $maquinaModel = model('App\Models\Presupuestos\MaquinaModel'); - - $selOption = $maquinaModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getUserListItems2($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])]; - if (!empty($selId)) : - $userModel = model('App\Models\Presupuestos\UserModel'); - - $selOption = $userModel->where('id_user', $selId)->findColumn('first_name'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPapelGenericoListItems($selId = null) - { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelGenericoes.papelGenerico'))])]; - if (!empty($selId)) : - $papelGenericoModel = model('App\Models\Presupuestos\PapelGenericoModel'); - - $selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre'); - if (!empty($selOption)) : - $data[$selId] = $selOption[0]; - endif; - endif; - return $data; - } - - - protected function getPaginasCubiertaOptions() - { - $paginasCubiertaOptions = [ - '' => lang('Basic.global.pleaseSelect'), - '4x0' => '4x0', - '4x4' => '4x4', - ]; - return $paginasCubiertaOptions; - } - - - - protected function getPaginasPortadaOptions() - { - $paginasPortadaOptions = [ - '' => lang('Basic.global.pleaseSelect'), - '4x0' => '4x0', - '4x4' => '4x4', - ]; - return $paginasPortadaOptions; - } - */ - } diff --git a/ci4/app/Models/Configuracion/PapelGenericoModel.php b/ci4/app/Models/Configuracion/PapelGenericoModel.php index eb971ea2..17b68119 100644 --- a/ci4/app/Models/Configuracion/PapelGenericoModel.php +++ b/ci4/app/Models/Configuracion/PapelGenericoModel.php @@ -135,7 +135,10 @@ class PapelGenericoModel extends \App\Models\GoBaseModel public function getGramajeComparador(string $papel_generico_nombre="", $uso="") { - $tipo=$uso; // color y colorhq valen para los dos + if($uso == 'cubierta' || $uso == 'sobrecubierta') + $tipo = 'color'; + else + $tipo=$uso; // color y colorhq valen para los dos if($uso == 'bn') $tipo="negro"; if($uso == 'bnhq') @@ -168,10 +171,58 @@ class PapelGenericoModel extends \App\Models\GoBaseModel $builder->where("t2.cubierta", 1); else if ($uso == 'sobrecubierta') $builder->where("t2.sobrecubierta", 1); - + + $values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject(); + $id = 1; + foreach ($values as $value){ + $value->id = $id; + $id++; + } + $values_array = array_map( function( $value ) { + return $value->text; + }, $values ); + $unique_values = array_unique($values_array); + return array_values(array_intersect_key($values, $unique_values)); + } + //tipo: negro, negrohq, color, colorhq + //uso: interior, rotativa, cubierta, sobrecubierta + public function getGramajeLineasPresupuesto($papel_generico_id=0, $tipo="", $uso="") + { + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t2.gramaje AS text" + ) + ->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left") + ->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left") + ->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left") + ->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left") + + ->where("t1.is_deleted", 0) + ->where("t2.is_deleted", 0) + ->where("t2.isActivo", 1) + ->where("t3.active", 1) + ->where("t4.is_deleted", 0) + ->where("t4.tipo", "impresion") + ->where("t5.tipo", $tipo) + ->where("t1.id", $papel_generico_id); + if($tipo == 'negro' || $tipo == 'negrohq') + $builder->where("t2.bn", 1); + else if ($tipo == 'color' || $tipo == 'colorhq') + $builder->where("t2.color", 1); + if ($uso == 'cubierta') + $builder->where("t2.cubierta", 1); + else if ($uso == 'sobrecubierta') + $builder->where("t2.sobrecubierta", 1); + if($uso=='rotativa') + $builder->where("t2.rotativa", 1); + else + $builder->where("t2.rotativa", 0); + + $values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject(); $id = 1; foreach ($values as $value){ diff --git a/ci4/app/Models/Configuracion/PapelImpresionModel.php b/ci4/app/Models/Configuracion/PapelImpresionModel.php index d600bbc2..4e53176b 100644 --- a/ci4/app/Models/Configuracion/PapelImpresionModel.php +++ b/ci4/app/Models/Configuracion/PapelImpresionModel.php @@ -255,6 +255,76 @@ class PapelImpresionModel extends \App\Models\GoBaseModel $builder->where("t1.rotativa", $rotativa); } + return $builder->orderBy("t1.id", "asc")->get()->getResultObject(); + } + + //tipo: negro, negrohq, color, colorhq + //uso: interior, rotativa, cubierta, sobrecubierta + public function getPapelesImpresionForMenu($papel_generico = null, $gramaje = null, $tipo = null, $uso=""){ + $builder = $this->db + ->table($this->table . " t1") + ->distinct("t1.id") + ->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left") + ->join("lg_maquina_papel_impresion t3", "t1.id = t3.papel_impresion_id", "left") + ->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left") + ->join("lg_maquinas_tarifas_impresion t5", "t4.id = t5.maquina_id", "left") + ->select( + "t1.id AS id, t1.nombre AS text"); + + $builder->where("t1.is_deleted", 0); + $builder->where("t1.isActivo", 1); + $builder->where("t2.is_deleted", 0); + $builder->where("t3.active", 1); + $builder->where("t4.is_deleted", 0); + $builder->where("t4.tipo", 'impresion'); + $builder->where("t5.is_deleted", 0); + $builder->where("t5.tipo", $tipo); + + $builder->where("t2.id", $papel_generico); + $builder->where("t1.gramaje", $gramaje); + + if($tipo == 'negro' || $tipo == 'negrohq') + $builder->where("t1.bn", 1); + else if ($tipo == 'color' || $tipo == 'colorhq') + $builder->where("t1.color", 1); + if ($uso == 'cubierta') + $builder->where("t1.cubierta", 1); + else if ($uso == 'sobrecubierta') + $builder->where("t1.sobrecubierta", 1); + if($uso=='rotativa') + $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(); } } diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index c3a05d5c..81ddd6a3 100644 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -251,7 +251,7 @@ class PresupuestoService extends BaseService } - private static function getNumFormasPlana($uso, $maquina, $ancho, $alto, $isCosido) + public static function getNumFormasPlana($uso, $maquina, $ancho, $alto, $isCosido) { // El ancho si es cosido es el doble if($uso != 'cubierta' && $uso != 'sobrecubierta'){ @@ -306,7 +306,7 @@ class PresupuestoService extends BaseService if(count($calles)>0) $h2 = ($h2_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h2_temp : $h2_temp - 1; else - $h2 = $h2_temp; + $h2 = $h2_temp; $v2 = floor($maquina->alto_impresion / $anchoForCalculo); $formas_v = $h2 * $v2; //p2 diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php index dd8f5b93..ac6a29b5 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php @@ -95,7 +95,7 @@ - + @@ -104,7 +104,7 @@ - + diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php index 88cd20a4..34fa2795 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php @@ -37,9 +37,9 @@ - + - $v) : ?> id != 0): ?> @@ -52,28 +52,28 @@ - - - - - - - - - + + + + + + - - - - + + + + @@ -82,7 +82,7 @@ - $v) : ?> id != 0): ?> @@ -99,11 +99,11 @@ - - @@ -125,7 +125,7 @@ - $v) : ?> id != 0): ?> @@ -142,11 +142,11 @@ - - @@ -168,7 +168,7 @@ - $v) : ?> id != 0): ?> @@ -185,11 +185,11 @@ - - @@ -211,7 +211,7 @@ - $v) : ?> id != 0): ?> @@ -228,11 +228,11 @@ - - @@ -460,7 +460,7 @@ - $v) : ?> id != 0): ?> @@ -477,11 +477,11 @@ - - @@ -708,7 +708,7 @@ - $v) : ?> id != 0): ?> @@ -725,11 +725,11 @@ - - @@ -751,7 +751,7 @@ - $v) : ?> id != 0): ?> @@ -768,11 +768,11 @@ - - @@ -803,7 +803,17 @@ section("additionalInlineJs") ?> + +$('#lp_bn_papel').val(''); +$('#lp_bnhq_papel').val(''); +$('#lp_color_papel').val(''); +$('#lp_colorhq_papel').val(''); +$('#lp_rot_bn_papel').val(''); +$('#lp_rot_color_papel').val(''); +$('#lp_cubierta_papel').val(''); +$('#lp_sobrecubierta_papel').val(''); + $('#lp_rot_color_vercalculos').on("click", function () { if($( ".calculos_rot_color" ).css('display') == 'none') $( ".calculos_rot_color" ).css('display', 'flex') @@ -819,4 +829,188 @@ $('#lp_rot_bn_vercalculos').on("click", function () { $( ".calculos_rot_bn" ).css('display', 'none') } }); + + +function clear_lp_bn(clear_selectors){ + let pags = $("#lp_bn_paginas" ).val() + $(".lp-bn-input" ).val("0") + $("#lp_bn_paginas" ).val(pags) + if(clear_selectors) + $( ".lp-bn-select").empty() +} + +function fill_lp_bn(data){ + $('#lp_bn_tiempo').val(data.tiempo_maquina) + $('#lp_bn_numeroPliegos').val(isNaN(parseFloat(data.pliegos_libro)) ? "" : parseFloat(data.pliegos_libro).toFixed(2)) + $('#lp_bn_pliegosPedido').val(isNaN(parseFloat(data.pliegos_pedido)) ? "" : parseFloat(data.pliegos_pedido).toFixed(2)) + $('#lp_bn_precioPliego').val(isNaN(parseFloat(data.precios_pliegos)) ? "" : parseFloat(data.precios_pliegos).toFixed(6)) + $('#lp_bn_libro').val(isNaN(parseFloat(data.precio_libro)) ? "" : parseFloat(data.precio_libro).toFixed(2)) + $('#lp_bn_totalPapelPedido').val(isNaN(parseFloat(data.precio_pedido)) ? "" : parseFloat(data.precio_pedido).toFixed(2)) + $('#lp_bn_lomo').val(isNaN(parseFloat(data.mano)) ? "" : parseFloat(data.mano).toFixed(2)) + $('#lp_bn_peso').val(isNaN(parseFloat(data.peso)) ? "" : parseFloat(data.peso).toFixed(2)) + $('#lp_bn_click').val(isNaN(parseFloat(data.precio_click)) ? "" : parseFloat(data.precio_click).toFixed(6)) + $('#lp_bn_totalClicks').val(isNaN(parseFloat(data.precio_click_pedido)) ? "" : parseFloat(data.precio_click_pedido).toFixed(2)) +} + + + +$('#lp_bn_papel').on("change", function () { + clear_lp_bn(true) + $.ajax({ + type: 'post', + url: '', + data: { + tipo: 'gramajeLineasPresupuesto', + uso: 'interior', + datos: $('#lp_bn_papel option:selected').val() , + tipoLinea: "negro", + : v + }, + dataType: 'json', + success: function (data) { + yeniden(data.); + $.each(data.menu, function(item){ + var option = $('