trabajando

This commit is contained in:
2025-07-25 13:39:11 +02:00
parent ca2aeacd84
commit 0785e7fcc8
18 changed files with 581 additions and 709 deletions

View File

@ -36,7 +36,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
$routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
$routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
$routes->get('gettipopapel', 'Papelesgenericos::getTipoPapelCliente');
});
@ -54,6 +53,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
$routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']);
$routes->get('show/(:num)', 'Papelesimpresion::papel_impresion_find/$1', ['as' => 'showPapelImpresion']);
$routes->get('getgramajecliente', 'Papelesimpresion::getGramajeCliente', ['as' => 'getGramajeCliente']);
});
/* Maquinas */

View File

@ -313,6 +313,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
$data_input = $this->request->getGet();
$result = $this->papelService->getTiposPalelGenerico((object)$data_input);
foreach ($result as $key => $value) {
$result[$key]->texto = strtoupper(lang('PapelGenerico.' . $value->nombre));
}
return $this->respond($result);
} else {
@ -325,110 +328,13 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
{
if ($this->request->isAJAX()) {
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
$POD = null;
if ($tirada != null) {
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
if (intval($tirada) <= intval($POD_value)) {
$POD = true;
} else {
$POD = false;
}
}
$tipo = goSanitize($this->request->getGet('tipo'))[0];
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
$guardas = goSanitize($this->request->getGet('guardas'))[0] ?? 0;
$ancho = floatval($this->request->getGet('ancho') ?? 0);
$alto = floatval($this->request->getGet('alto') ?? 0);
$solapas = floatval($this->request->getGet('solapas') ?? 0);
$lomo = floatval($this->request->getGet('lomo') ?? 0);
$forSelect2 = intval($this->request->getGet('forSelect2') ?? 0);
$anchoLibro = $ancho;
if(intval($cubierta) == 1 || intval($sobrecubierta) == 1){
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
}
$menu = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
if ($forSelect2) {
$menu = array_map(function ($item) {
if (isset($item->id)) {
return [
'id' => $item->id,
'name' => $item->nombre
];
} else {
return [
'id' => $item->gramaje,
'name' => $item->gramaje
];
}
}, $menu);
return $this->respond($menu);
}
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'papeles' => $menu,
'papeles_especiales' => $menu2,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
$data_input = $this->request->getGet();
$result = $this->papelService->getPapelGenerico((object)$data_input);
return $this->respond($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function selectPapelEspecial()
{
if ($this->request->isAJAX()) {
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
$POD = null;
if ($tirada != null) {
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
if (intval($tirada) <= intval($POD_value)) {
$POD = true;
} else {
$POD = false;
}
}
$tipo = goSanitize($this->request->getGet('tipo'))[0];
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
$ancho = floatval($this->request->getGet('ancho') ?? 0);
$alto = floatval($this->request->getGet('alto') ?? 0);
$solapas = floatval($this->request->getGet('solapas') ?? 0);
$lomo = floatval($this->request->getGet('lomo') ?? 0);
$tapa_dura = $this->request->getGet('tapa_dura') ?? 0;
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
$items = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, false, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
$items = array_map(function ($item) {
return [
'id' => $item->id,
'name' => $item->nombre
];
}, $items);
return $this->response->setJSON($items);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -72,6 +72,8 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
$this->tpModel = new PapelImpresionTipologiaModel();
$this->validation = service("validation");
$this->papelService = service('papel');
// Breadcrumbs
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
@ -473,6 +475,22 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
}
}
public function getGramajeCliente(){
if ($this->request->isAJAX()) {
$data_input = $this->request->getGet();
$result = $this->papelService->getGramajes((object)$data_input);
return $this->respond($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function papel_impresion_select()
{
$q = $this->request->getGet('q');

View File

@ -3452,31 +3452,37 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$return_data['interior']['negro']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
$return_data['interior']['negro']['papel']['id'] = $linea->papel_id;
$return_data['interior']['negro']['gramaje'] = $linea->gramaje;
$return_data['interior']['negro']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
} else if ($linea->tipo == 'lp_color' || $linea->tipo == 'lp_colorhq' || $linea->tipo == 'lp_rot_color') {
$return_data['interior']['color']['tipo'] = $linea->tipo == 'lp_color' || $linea->tipo == 'lp_rot_color' ? 'colorEstandar' : 'colorPremium';
$return_data['interior']['color']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
$return_data['interior']['color']['papel']['id'] = $linea->papel_id;
$return_data['interior']['color']['gramaje'] = $linea->gramaje;
$return_data['interior']['color']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
} else if ($linea->tipo == 'lp_cubierta') {
$return_data['cubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
$return_data['cubierta']['papel']['id'] = $linea->papel_id;
$return_data['cubierta']['gramaje'] = $linea->gramaje;
$return_data['cubierta']['paginas'] = $linea->paginas;
$return_data['cubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
} else if ($linea->tipo == 'lp_sobrecubierta') {
$return_data['sobrecubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
$return_data['sobrecubierta']['papel_id'] = $linea->papel_id;
$return_data['sobrecubierta']['gramaje'] = $linea->gramaje;
$return_data['sobrecubierta']['paginas'] = $linea->paginas;
$return_data['sobrecubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
} else if ($linea->tipo == 'lp_faja') {
$return_data['faja']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
$return_data['faja']['papel_id'] = $linea->papel_id;
$return_data['faja']['gramaje'] = $linea->gramaje;
$return_data['faja']['paginas'] = $linea->paginas;
$return_data['faja']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
} else if ($linea->tipo == 'lp_guardas') {
$return_data['guardas']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
$return_data['guardas']['papel_id'] = $linea->papel_id;
$return_data['guardas']['gramaje'] = $linea->gramaje;
$return_data['guardas']['paginas'] = $linea->paginas;
$return_data['guardas']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
}
}
}

View File

@ -49,7 +49,7 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
"user_created_id" => 1,
"user_update_id" => 1,
"no_envio_base" => 0,
"forzar_rotativa_pod" => 0,
"forzar_rotativa_pod" => false,
];
protected $casts = [
"comunidad_autonoma_id" => "?int",

View File

@ -120,6 +120,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
return $data;
}
/**
* Get resource data.
*
@ -572,4 +573,109 @@ class PapelGenericoModel extends \App\Models\BaseModel
$query = $this->db->getLastQuery();
return $data;
}
public function getPapelGenericoCliente($data)
{
/*
1.-> Tipo impresion
2.-> Maquina
3.-> Papeles impresion asociados a esa maquina
4.-> papeles genericos que aparecen en esos papeles impresion
*/
if ($data->POD == true && ($data->tipo == 'color')) {
if ($data->tipo == 'color')
$data->tipo = 'colorhq';
else if ($data->tipo == 'negro')
$data->tipo = 'negrohq';
}
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as id, t1.nombre AS nombre",
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
)
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "inner")
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
->where("t1.is_deleted", 0)
->where("t1.show_in_client", 1)
->where("t1.tipo_papel_generico_id", $data->tipo_papel_generico_id)
->where("t2.is_deleted", 0)
->where("t2.isActivo", 1)
->where("t2.use_in_client", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.min <= ", $data->tirada)
->where("t4.max >= ", $data->tirada)
->where("t4.tipo", "impresion")
->where("t5.is_deleted", 0)
->where("t5.tipo", $data->tipo)
->distinct('t1.id');
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
$builder->whereIn("t1.id", function ($subQuery) {
$subQuery->select("t1_inner.id")
->from("lg_papel_generico t1_inner")
->join("lg_papel_impresion t2_inner", "t2_inner.papel_generico_id = t1_inner.id", "inner")
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t2_inner.id", "inner")
->where("t3_inner.active", 1);
});
$builder->groupStart()
->groupStart()
->where("t4.ancho_impresion >", $data->ancho)
->where("t4.alto_impresion >", $data->alto)
->groupEnd()
->orGroupStart()
->where("t4.ancho_impresion >", $data->alto)
->where("t4.alto_impresion >", $data->ancho)
->groupEnd()
->orGroupStart()
->where("t4.ancho_impresion >", $data->alto)
->where("t4.is_rotativa", 1)
->groupEnd()
->groupEnd();
if ($data->cubierta == true) {
$builder->where("t2.cubierta", 1);
$builder->where("t5.uso", 'cubierta');
if ($data->tapa_dura == true) {
$builder->where("t2.use_for_tapa_dura", 1);
}
} else if ($data->sobrecubierta == true) {
$builder->where("t2.sobrecubierta", 1);
$builder->where("t5.uso", 'sobrecubierta');
} else if ($data->guardas == true) {
$builder->where("t2.guardas", 1);
$builder->where("t5.uso", 'interior');
} else {
$builder->where("t2.interior", 1);
$builder->where("t5.uso", 'interior');
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
$builder->where("t2.bn", 1);
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
$builder->where("t2.color", 1);
}
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
$builder->where("t2.rotativa", 0);
} else {
if ($data->POD == false) {
$builder->where("t2.rotativa", 1);
} else if ($data->POD == true) {
$builder->where("t2.rotativa", 0);
}
}
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
//$query = $this->db->getLastQuery(); // DEBUG
return $data;
}
}

View File

@ -390,7 +390,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
public function querySelect(?string $query)
{
$q = $this->builder()->select([
$q = $this->builder()->select([
"id",
"nombre as name",
]);
@ -400,4 +400,104 @@ class PapelImpresionModel extends \App\Models\BaseModel
return $q;
}
public function getGramajeCliente($data) {
/*
1.-> Tipo impresion
2.-> Maquina
3.-> Papeles impresion asociados a esa maquina
4.-> papeles genericos que aparecen en esos papeles impresion
*/
if ($data->POD == true && ($data->tipo == 'color')) {
if ($data->tipo == 'color')
$data->tipo = 'colorhq';
else if ($data->tipo == 'negro')
$data->tipo = 'negrohq';
}
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.gramaje as gramaje",
// for debug, t1.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
)
->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "inner")
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t1.id", "inner")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
->where("t2.is_deleted", 0)
->where("t2.show_in_client", 1)
->where("t1.is_deleted", 0)
->where("t1.isActivo", 1)
->where("t1.use_in_client", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.min <= ", $data->tirada)
->where("t4.max >= ", $data->tirada)
->where("t4.tipo", "impresion")
->where("t5.is_deleted", 0)
->where("t5.tipo", $data->tipo)
->where("t2.id", $data->papel_id ?? null)
->distinct('t1.id');
// Validación adicional para asegurar que t2.id esté presente en las combinaciones con t3.active = 1
$builder->whereIn("t2.id", function ($subQuery) {
$subQuery->select("t2_inner.id")
->from("lg_papel_generico t2_inner")
->join("lg_papel_impresion t1_inner", "t1_inner.papel_generico_id = t2_inner.id", "inner")
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t1_inner.id", "inner")
->where("t3_inner.active", 1);
});
$builder->groupStart()
->groupStart()
->where("t4.ancho_impresion >", $data->ancho)
->where("t4.alto_impresion >", $data->alto)
->groupEnd()
->orGroupStart()
->where("t4.ancho_impresion >", $data->alto)
->where("t4.alto_impresion >", $data->ancho)
->groupEnd()
->orGroupStart()
->where("t4.ancho_impresion >", $data->alto)
->where("t4.is_rotativa", 1)
->groupEnd()
->groupEnd();
if ($data->cubierta == true) {
$builder->where("t1.cubierta", 1);
$builder->where("t5.uso", 'cubierta');
if ($data->tapa_dura == true) {
$builder->where("t1.use_for_tapa_dura", 1);
}
} else if ($data->sobrecubierta == true) {
$builder->where("t1.sobrecubierta", 1);
$builder->where("t5.uso", 'sobrecubierta');
} else if ($data->guardas == true) {
$builder->where("t1.guardas", 1);
$builder->where("t5.uso", 'interior');
} else {
$builder->where("t1.interior", 1);
$builder->where("t5.uso", 'interior');
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
$builder->where("t1.bn", 1);
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
$builder->where("t1.color", 1);
}
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
$builder->where("t1.rotativa", 0);
} else {
if ($data->POD == false) {
$builder->where("t1.rotativa", 1);
} else if ($data->POD == true) {
$builder->where("t1.rotativa", 0);
}
}
$data = $builder->orderBy("t1.gramaje", "asc")->get()->getResultObject();
$query = $this->db->getLastQuery();
return $data;
}
}

View File

@ -97,15 +97,15 @@ class TipoPapelGenericoModel extends \App\Models\BaseModel
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
$builder->where("t3.rotativa", 0);
} else {
if ($data->POD == false) {
if ($data->POD == false || $data->forzar_rotativa_POD) {
$builder->where("t3.rotativa", 1);
} else if ($data->POD == true) {
$builder->where("t3.rotativa", 0);
}
}
$return_data = $builder->orderBy("t1.clave", "asc")->get()->getResultObject();
//$query = $this->db->getLastQuery();
$return_data = $builder->orderBy("t1.id", "asc")->get()->getResultObject();
$query = $this->db->getLastQuery();
return $return_data;
}

View File

@ -2,6 +2,8 @@
namespace App\Services;
use App\Models\Clientes\ClienteModel;
use App\Models\Configuracion\PapelImpresionModel;
use CodeIgniter\Config\BaseService;
use App\Models\Configuracion\TipoPapelGenericoModel;
use App\Models\Configuracion\PapelGenericoModel;
@ -10,11 +12,15 @@ class PapelService extends BaseService
{
protected TipoPapelGenericoModel $tipoPapelGenericoModel;
protected PapelGenericoModel $papelGenericoModel;
protected PapelImpresionModel $papelImpresionModel;
protected ClienteModel $clienteModel;
public function __construct()
{
$this->tipoPapelGenericoModel = model(TipoPapelGenericoModel::class);
$this->papelGenericoModel = model(PapelGenericoModel::class);
$this->papelImpresionModel = model(PapelImpresionModel::class);
$this->clienteModel = model(ClienteModel::class);
}
public function getTipoPapelGenerico()
@ -40,7 +46,7 @@ class PapelService extends BaseService
return [];
}
$tirada = (int)$data->tirada ?? null;
$tirada = (int) $data->tirada ?? null;
$POD = null;
if ($tirada != null) {
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
@ -63,39 +69,176 @@ class PapelService extends BaseService
$anchoLibro = $ancho;
$cliente_id = $data->cliente_id ?? null;
$forzar_rotativa_POD = false;
if (isset($cliente_id) && !is_null($cliente_id)) {
$cliente = $this->clienteModel->find($cliente_id);
if ($cliente && isset($cliente->forzar_rotativa_pod)) {
$forzar_rotativa_POD = boolval($cliente->forzar_rotativa_pod);
}
}
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
}
$data_output = (object)
[
'tipo' => $tipo,
'cubierta' => $cubierta,
'tapa_dura' => $tapa_dura,
'sobrecubierta' => $sobrecubierta,
'guardas' => $guardas,
'ancho' => $anchoLibro,
'alto' => $alto,
'solapas' => $solapas,
'lomo' => $lomo,
'anchoLibro' => $anchoLibro,
'tirada' => $tirada,
'POD' => $POD
];
$data_output = (object)
[
'tipo' => $tipo,
'cubierta' => $cubierta,
'tapa_dura' => $tapa_dura,
'sobrecubierta' => $sobrecubierta,
'guardas' => $guardas,
'ancho' => $anchoLibro,
'alto' => $alto,
'solapas' => $solapas,
'lomo' => $lomo,
'anchoLibro' => $anchoLibro,
'tirada' => $tirada,
'POD' => $POD,
'forzar_rotativa_POD' => $forzar_rotativa_POD
];
$list = $this->tipoPapelGenericoModel->getTiposPapelCliente($data_output);
return $list;
}
/**
* Obtencion de los tipos de papel genérico dependiendo del uso para un tipo de papel específico
* @param object $data
* @return array
*/
public function getPapelGenerico($data)
{
/*
$values = $this->papelGenericoModel->where('uso', $uso)->findAll();
$tipoPapelGenericoList = [];
foreach ($values as $value) {
$tipoPapelGenericoList[$value->id] = lang('PapelGenerico.' . $value->clave);
if (!isset($data) || empty($data)) {
return [];
}
return $tipoPapelGenericoList;
*/
$tirada = (int) $data->tirada ?? null;
$POD = null;
if ($tirada != null) {
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
if (intval($tirada) <= intval($POD_value)) {
$POD = true;
} else {
$POD = false;
}
}
$tipo = $data->tipo;
$cubierta = $data->cubierta ?? 0;
$tapa_dura = $data->tapa_dura ?? null;
$sobrecubierta = $data->sobrecubierta ?? 0;
$guardas = $data->guardas ?? 0;
$ancho = $data->ancho ?? 0;
$alto = $data->alto ?? 0;
$solapas = $data->solapas ?? 0;
$lomo = $data->lomo ?? 0;
$tipo_papel_generico_id = $data->tipo_papel_generico_id ?? null;
$anchoLibro = $ancho;
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
}
$data_output = (object)
[
'tipo' => $tipo,
'tipo_papel_generico_id' => $tipo_papel_generico_id,
'cubierta' => $cubierta,
'tapa_dura' => $tapa_dura,
'sobrecubierta' => $sobrecubierta,
'guardas' => $guardas,
'ancho' => $anchoLibro,
'alto' => $alto,
'solapas' => $solapas,
'lomo' => $lomo,
'anchoLibro' => $anchoLibro,
'tirada' => $tirada,
'POD' => $POD
];
if (isset($data->selected_tipo_id)) {
$data_output->selected_tipo_id = $data->selected_tipo_id;
}
$list = $this->papelGenericoModel->getPapelGenericoCliente($data_output);
return $list;
}
/**
* Obtencion de los tipos de papel genérico dependiendo del uso para un tipo de papel específico
* @param object $data
* @return array
*/
public function getGramajes($data)
{
if (!isset($data) || empty($data)) {
return [];
}
$tirada = (int) $data->tirada ?? null;
$POD = null;
if ($tirada != null) {
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
if (intval($tirada) <= intval($POD_value)) {
$POD = true;
} else {
$POD = false;
}
}
$tipo = $data->tipo;
$cubierta = $data->cubierta ?? 0;
$tapa_dura = $data->tapa_dura ?? null;
$sobrecubierta = $data->sobrecubierta ?? 0;
$guardas = $data->guardas ?? 0;
$ancho = $data->ancho ?? 0;
$alto = $data->alto ?? 0;
$solapas = $data->solapas ?? 0;
$lomo = $data->lomo ?? 0;
$forzar_rotativa_POD = $data->forzar_rotativa_POD ?? false;
$papel_id = $data->papel_id ?? null;
$anchoLibro = $ancho;
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
}
$data_output = (object)
[
'tipo' => $tipo,
'papel_id' => $papel_id,
'cubierta' => $cubierta,
'tapa_dura' => $tapa_dura,
'sobrecubierta' => $sobrecubierta,
'guardas' => $guardas,
'ancho' => $anchoLibro,
'alto' => $alto,
'solapas' => $solapas,
'lomo' => $lomo,
'anchoLibro' => $anchoLibro,
'tirada' => $tirada,
'POD' => $POD
];
if (isset($data->selected_tipo_id)) {
$data_output->selected_tipo_id = $data->selected_tipo_id;
}
$list = $this->papelImpresionModel->getGramajeCliente($data_output);
return $list;
}
}

View File

@ -240,34 +240,34 @@
<div class="row justify-content-center">
<div id="fresado"
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>"
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.jpg") ?>"
alt="Fresado">
<div class="form-text text-center">Fresado (a partir de 32 páginas)</div>
<div class="form-text text-center">A partir de 32 páginas</div>
</div>
<div id="cosido"
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>"
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.jpg") ?>"
alt="Cosido">
<div class="form-text text-center">Cosido (a partir de 32 páginas)</div>
<div class="form-text text-center">A partir de 32 páginas</div>
</div>
<div id="grapado"
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>"
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.jpg") ?>"
alt="Grapado">
<div class="form-text text-center">Grapado (entre 12 y 40 páginas)</div>
<div class="form-text text-center">Entre 12 y 40 páginas</div>
</div>
<div id="espiral"
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>"
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.jpg") ?>"
alt="Espiral">
<div class="form-text text-center">Espiral (a partir de 20 páginas)</div>
<div class="form-text text-center">A partir de 20 páginas</div>
</div>
<div id="wireo"
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/wire-o.png") ?>"
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/wire-o.jpg") ?>"
alt="Wire-O">
<div class="form-text text-center">Wire-O (a partir de 20 páginas)</div>
<div class="form-text text-center">A partir de 20 páginas</div>
</div>
</div>
</div>

View File

@ -49,27 +49,23 @@
</div>
<div id="textoPapelInterior" class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none texto-papel-interior">
<h3 class="mb-1 fw-bold"> Papel interior </h3>
</div><!--//.mb-3 -->
<h5 id="textoTipoPapelInterior" class="mb-1 fw-bold">Tipo</h5>
<div id="divTipoPapelInterior" name="div_tipo_papel_interior" class="row col-sm-10 mb-1 justify-content-center">
</div>
<h5 class="mb-1 fw-bold texto-papel-interior">Papel</h5>
<div id="divPapelInterior" name="div_papel_interior" class="row col-sm-10 mb-1 justify-content-center">
</div>
<div id="divPapelEspecialInterior" name="div_papel_especial_interior"
class="row col-sm-10 mb-3 justify-content-center d-none">
<div class="col-sm-5 mb-0">
<label for="titulo" class="form-label">
Seleccione el papel especial
</label>
<select id="papelEspecialInterior" name="papel_especial_interior"
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
</select>
</div>
</div>
<h5 id="textoGramajeInterior" class="mb-1 fw-bold">Gramaje</h5>
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
</div>
@ -102,34 +98,4 @@
</div>
<div id="textoPapelInteriorColor" class="col-sm-8 mb-3 d-flex flex-column align-items-center interior-color d-none">
<h3 class="mb-1 fw-bold"> Papel interior color</h3>
</div><!--//.mb-3 -->
<div id="divPapelInteriorColor" name="div_papel_interior_color"
class="row col-sm-10 mb-5 interior-color justify-content-center interior-color d-none">
</div>
<div id="divPapelEspecialInteriorColor" name="div_papel_especial_interior_color"
class="row col-sm-10 mb-3 justify-content-center d-none">
<div class="col-sm-5 mb-0">
<label for="titulo" class="form-label">
Seleccione el papel especial
</label>
<select id="papelEspecialInteriorColor" name="papel_especial_interior_color"
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
</select>
</div>
</div>
<div id="divGramajeInteriorColor" name="div_gramaje_interior_color"
class="row col-sm-10 mb-3 justify-content-center d-none">
</div>
</div>