mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
problema muestra genericos que no
This commit is contained in:
@ -215,6 +215,7 @@ $routes->group('papelesgenericos', ['namespace' => 'App\Controllers\Configuracio
|
||||
$routes->post('datatable', 'Papelesgenericos::datatable', ['as' => 'dataTableOfPapelesGenericos']);
|
||||
$routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
$routes->get('getpapelgenericocliente', 'Papelesgenericos::getPapelGenericoCliente', ['as' => 'getPapelGenericoCliente']);
|
||||
});
|
||||
$routes->resource('papelesgenericos', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesgenericos', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -228,6 +229,7 @@ $routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracio
|
||||
$routes->post('datatable', 'Papelesimpresion::datatable', ['as' => 'dataTableOfPapelesImpresion']);
|
||||
$routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']);
|
||||
$routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']);
|
||||
$routes->get('getgramajecliente', 'Papelesimpresion::getGramajesCliente', ['as' => 'getGramajePresupuestoCliente']);
|
||||
});
|
||||
$routes->resource('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesimpresion', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
@ -293,4 +293,25 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getPapelGenericoCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('text'))[0];
|
||||
$papel_especial = goSanitize($this->request->getGet('papel_especial'))[0] ?? 0;
|
||||
$menu = $this->model->getPapelGenericoCliente($tipo, $cubierta, $papel_especial);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'papeles' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -444,4 +444,26 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
$ma_pa_model->updateRows($active_values);
|
||||
}
|
||||
}
|
||||
|
||||
public function getGramajesCliente(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$papel_generico_id = goSanitize($this->request->getGet('papel'))[0];
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('text'))[0];
|
||||
$papel_especial = goSanitize($this->request->getGet('papel_especial'))[0] ?? 0;
|
||||
$menu = $this->model->getGramajePresupuestoCliente($papel_generico_id, $tipo, $cubierta, $papel_especial);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'gramajes' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
];
|
||||
|
||||
|
||||
public function getIdFromCode(string $code=""){
|
||||
public function getIdFromCode(string $code = "")
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
@ -78,7 +79,8 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getCodeFromId($id=0){
|
||||
public function getCodeFromId($id = 0)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
@ -113,16 +115,16 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
@ -130,9 +132,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -155,48 +157,48 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $tipo);
|
||||
|
||||
if($is_cubierta==true){
|
||||
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
}
|
||||
|
||||
if($is_sobrecubierta==true){
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
}
|
||||
if ($is_cubierta == true) {
|
||||
|
||||
if($is_cubierta==false && $is_sobrecubierta==false){
|
||||
$builder->where("t5.uso", 'interior');
|
||||
}
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
}
|
||||
|
||||
if($is_guardas==true){
|
||||
$builder->where("t2.guardas", 1);
|
||||
}
|
||||
if ($is_sobrecubierta == true) {
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
}
|
||||
|
||||
if($rotativa==true){
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
if ($is_cubierta == false && $is_sobrecubierta == false) {
|
||||
$builder->where("t5.uso", 'interior');
|
||||
}
|
||||
|
||||
if($mostrar_cliente!=null){
|
||||
$builder->where("t1.show_in_client", $mostrar_cliente);
|
||||
}
|
||||
if ($is_guardas == true) {
|
||||
$builder->where("t2.guardas", 1);
|
||||
}
|
||||
|
||||
if ($rotativa == true) {
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
|
||||
if ($mostrar_cliente != null) {
|
||||
$builder->where("t1.show_in_client", $mostrar_cliente);
|
||||
}
|
||||
|
||||
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
//var_dump($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getGramajeComparador(string $papel_generico_nombre="", $uso="", $ejemplares=0)
|
||||
public function getGramajeComparador(string $papel_generico_nombre = "", $uso = "", $ejemplares = 0)
|
||||
{
|
||||
if($uso == 'cubierta' || $uso == 'sobrecubierta')
|
||||
if ($uso == 'cubierta' || $uso == 'sobrecubierta')
|
||||
$tipo = 'colorhq';
|
||||
else
|
||||
$tipo=$uso; // color y colorhq valen para los dos
|
||||
if($uso == 'bn')
|
||||
$tipo="negro";
|
||||
if($uso == 'bnhq')
|
||||
$tipo="negrohq";
|
||||
$tipo = $uso; // color y colorhq valen para los dos
|
||||
if ($uso == 'bn')
|
||||
$tipo = "negro";
|
||||
if ($uso == 'bnhq')
|
||||
$tipo = "negrohq";
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -207,7 +209,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->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)
|
||||
@ -216,44 +218,43 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->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'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
}
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
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') {
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
} else if ($uso == 'sobrecubierta') {
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
|
||||
$builder->where("t4.min <=", $ejemplares);
|
||||
$builder->where("t4.max >=", $ejemplares);
|
||||
|
||||
$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));
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
$builder->where("t4.min <=", $ejemplares);
|
||||
$builder->where("t4.max >=", $ejemplares);
|
||||
|
||||
$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="")
|
||||
public function getGramajeLineasPresupuesto($papel_generico_id = 0, $tipo = "", $uso = "")
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -264,7 +265,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->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)
|
||||
@ -274,42 +275,94 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->where("t5.tipo", $tipo)
|
||||
->where("t1.id", $papel_generico_id);
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
if ($uso == 'cubierta'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
}
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
else{
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
}
|
||||
|
||||
if($uso=='rotativa')
|
||||
$builder->where("t2.rotativa", 1);
|
||||
else
|
||||
$builder->where("t2.rotativa", 0);
|
||||
if ($uso == 'cubierta') {
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
} else if ($uso == 'sobrecubierta') {
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
} else {
|
||||
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
}
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
|
||||
$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));
|
||||
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();
|
||||
$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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getPapelGenericoCliente($tipo, $is_cubierta = false, $papel_especial = false)
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
$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("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.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $tipo)
|
||||
->distinct('t1.id');
|
||||
|
||||
$builder->groupStart()
|
||||
->where("t2.id IS NOT NULL") // Validar relación con `t2`
|
||||
->orWhere("t4.id IS NOT NULL") // Validar relación con `t4`
|
||||
->groupEnd();
|
||||
|
||||
if ($is_cubierta == true) {
|
||||
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
} else {
|
||||
$builder->where("t5.uso", 'interior');
|
||||
}
|
||||
|
||||
if ($papel_especial == true) {
|
||||
$builder->where("t1.show_in_client_special", 1);
|
||||
}
|
||||
|
||||
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
//var_dump($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "", $generico_id=-1)
|
||||
public function getResource(string $search = "", $generico_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -157,12 +157,12 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id,
|
||||
t1.show_in_client AS show_in_client, t1.show_in_client_special AS show_in_client_special"
|
||||
);
|
||||
|
||||
|
||||
$builder->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left");
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
if($generico_id>0){
|
||||
$builder->where("t1.papel_generico_id", $generico_id);
|
||||
if ($generico_id > 0) {
|
||||
$builder->where("t1.papel_generico_id", $generico_id);
|
||||
}
|
||||
|
||||
return empty($search)
|
||||
@ -182,29 +182,29 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"'".$maquina_id."'". " as maquina_id, t1.id AS papel_impresion_id, '0' as active"
|
||||
"'" . $maquina_id . "'" . " as maquina_id, t1.id AS papel_impresion_id, '0' as active"
|
||||
);
|
||||
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
|
||||
$isFirst = true;
|
||||
$where_str = "";
|
||||
//Si hay tarifas...
|
||||
if (!empty($tarifas)){
|
||||
foreach ($tarifas as $tarifa){
|
||||
if (!empty($tarifas)) {
|
||||
foreach ($tarifas as $tarifa) {
|
||||
if (!$isFirst)
|
||||
$where_str .= ' OR ';
|
||||
else{
|
||||
else {
|
||||
$isFirst = false;
|
||||
}
|
||||
if ($tarifa->uso == 'cubierta')
|
||||
$where_str .= "`t1`.`cubierta`=1";
|
||||
else if ($tarifa->uso == 'sobrecubierta')
|
||||
$where_str .= "`t1`.`sobrecubierta`=1";
|
||||
else{
|
||||
else {
|
||||
if ($tarifa->tipo == 'negro' || $tarifa->tipo == 'negrohq')
|
||||
$where_str .= "`t1`.`bn`=1 ";
|
||||
$where_str .= "`t1`.`bn`=1 ";
|
||||
else
|
||||
$where_str .= "`t1`.`color`=1 ";
|
||||
}
|
||||
@ -212,11 +212,11 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$builder->where($where_str);
|
||||
}
|
||||
// si no hay tarifas no hay que devolver nada
|
||||
else{
|
||||
else {
|
||||
// Se pone una condicion que no se puede dar
|
||||
$builder->where("t1.bn", 2);
|
||||
}
|
||||
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
@ -229,43 +229,45 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
*
|
||||
* @return [type]
|
||||
*/
|
||||
public function getIdPapelesImpresionForPresupuesto($papel_generico_id = null, $gramaje = null, $options=[]){
|
||||
public function getIdPapelesImpresionForPresupuesto($papel_generico_id = null, $gramaje = null, $options = [])
|
||||
{
|
||||
$bn = array_key_exists('bn', $options) ? $options['bn'] : null;
|
||||
$color = array_key_exists('color', $options)? $options['color'] : null;
|
||||
$cubierta = array_key_exists('cubierta', $options)? $options['cubierta'] : null;
|
||||
$sobrecubierta = array_key_exists('sobrecubierta', $options)? $options['sobrecubierta'] : null;
|
||||
$guardas = array_key_exists('guardas', $options)? $options['guardas'] : null;
|
||||
$rotativa = array_key_exists('rotativa', $options)? $options['rotativa'] : null;
|
||||
$color = array_key_exists('color', $options) ? $options['color'] : null;
|
||||
$cubierta = array_key_exists('cubierta', $options) ? $options['cubierta'] : null;
|
||||
$sobrecubierta = array_key_exists('sobrecubierta', $options) ? $options['sobrecubierta'] : null;
|
||||
$guardas = array_key_exists('guardas', $options) ? $options['guardas'] : null;
|
||||
$rotativa = array_key_exists('rotativa', $options) ? $options['rotativa'] : null;
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->distinct("t1.id")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.papel_generico_id AS papel_generico_id,
|
||||
t1.gramaje as gramaje, t1.espesor AS espesor, t1.precio_tonelada AS precio_tonelada, t1.rotativa AS rotativa");
|
||||
|
||||
t1.gramaje as gramaje, t1.espesor AS espesor, t1.precio_tonelada AS precio_tonelada, t1.rotativa AS rotativa"
|
||||
);
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
|
||||
$builder->where("t1.papel_generico_id", $papel_generico_id);
|
||||
$builder->where("t1.gramaje", $gramaje);
|
||||
|
||||
if(!is_null($bn)){
|
||||
|
||||
if (!is_null($bn)) {
|
||||
$builder->where("t1.bn", $bn);
|
||||
}
|
||||
if(!is_null($color)){
|
||||
if (!is_null($color)) {
|
||||
$builder->where("t1.color", $color);
|
||||
}
|
||||
if(!is_null($cubierta)){
|
||||
if (!is_null($cubierta)) {
|
||||
$builder->where("t1.cubierta", $cubierta);
|
||||
}
|
||||
if(!is_null($sobrecubierta)){
|
||||
if (!is_null($sobrecubierta)) {
|
||||
$builder->where("t1.sobrecubierta", $sobrecubierta);
|
||||
}
|
||||
if(!is_null($guardas)){
|
||||
if (!is_null($guardas)) {
|
||||
$builder->where("t1.guardas", $guardas);
|
||||
}
|
||||
if(!is_null($rotativa)){
|
||||
if (!is_null($rotativa)) {
|
||||
$builder->where("t1.rotativa", $rotativa);
|
||||
}
|
||||
|
||||
@ -274,7 +276,8 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
|
||||
//tipo: negro, negrohq, color, colorhq
|
||||
//uso: interior, rotativa, cubierta, sobrecubierta
|
||||
public function getPapelesImpresionForMenu($papel_generico = null, $gramaje = null, $tipo = null, $uso=""){
|
||||
public function getPapelesImpresionForMenu($papel_generico = null, $gramaje = null, $tipo = null, $uso = "")
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->distinct("t1.id")
|
||||
@ -283,8 +286,9 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
->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");
|
||||
|
||||
"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);
|
||||
@ -293,7 +297,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$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);
|
||||
|
||||
@ -303,32 +307,35 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
else if ($uso == 'guardas')
|
||||
$builder->where("t1.guardas", 1);
|
||||
else{
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
else {
|
||||
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t1.color", 1);
|
||||
}
|
||||
if($uso=='rotativa')
|
||||
if ($uso == 'rotativa')
|
||||
$builder->where("t1.rotativa", 1);
|
||||
else
|
||||
$builder->where("t1.rotativa", 0);
|
||||
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function getNombre($id){
|
||||
public function getNombre($id)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.nombre AS text");
|
||||
|
||||
"t1.nombre AS text"
|
||||
);
|
||||
|
||||
$builder->where("t1.id", $id);
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function getPapelGenericoCode($papel_id = 0){
|
||||
public function getPapelGenericoCode($papel_id = 0)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select("t2.code AS code")
|
||||
@ -337,12 +344,63 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.isActivo", 1)
|
||||
->where("t2.is_deleted", 0);
|
||||
|
||||
|
||||
$result = $builder->get()->getResultObject();
|
||||
if(count($result) > 0){
|
||||
if (count($result) > 0) {
|
||||
return $result[0]->code;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getGramajePresupuestoCliente($papel_generico_id = -1, $tipo = 'interior', $cubierta = 0, $papel_especial = 0)
|
||||
{
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.gramaje AS text"
|
||||
)
|
||||
->join("lg_papel_generico t2", "t2.id = t1.papel_generico_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.isActivo", 1)
|
||||
->where("t1.use_in_client", 1)
|
||||
->where("t2.id", $papel_generico_id)
|
||||
->where("t2.show_in_client", 1)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t3.active", 1)
|
||||
->where("t4.is_deleted", 0)
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $tipo)
|
||||
->distinct("t1.gramaje");
|
||||
|
||||
if($papel_especial){
|
||||
$builder->where('t2.show_in_client_special');
|
||||
}
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
if ($cubierta) {
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t1.cubierta", 1);
|
||||
} else {
|
||||
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t1.color", 1);
|
||||
}
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
|
||||
$values = $builder->orderBy("t1.gramaje", "asc")->get()->getResultObject();
|
||||
foreach ($values as $value) {
|
||||
$value->id = $value->text;
|
||||
}
|
||||
//$query=$this->db->getLastQuery();
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,41 +42,13 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
||||
<div id="textoPapelInterior" class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none">
|
||||
<h3 class="mb-1 fw-bold"> Papel interior </h3>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
<div id="divPapelInterior" name="div_papel_interior" class="row col-sm-10 mb-5 justify-content-center">
|
||||
|
||||
<div id="offsetBlanco" cod="OFF1" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-blanco.png") ?>" alt="offsetBlanco">
|
||||
<label for="titulo" class="form-label">
|
||||
Offset Blanco
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="offsetAhuesado" cod="OFF2" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado.png") ?>" alt="offsetAhuesado">
|
||||
<label for="titulo" class="form-label">
|
||||
Offset Ahuesado
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="offsetAhuesadoVolumen" cod="OFF4" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado-volumen.png") ?>" alt="offsetAhuesadoVolumen">
|
||||
<label for="titulo" class="form-label">
|
||||
Offset Ahuesado Volumen
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="estucadoMate" cod="EST2" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/estucado-mate.png") ?>" alt="estucadoMate">
|
||||
<label for="titulo" class="form-label">
|
||||
Estucado Mate
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<?= view("themes/_commonPartialsBs/_modalInput") ?>
|
||||
<?= view("themes/vuexy/components/modals/modalDireccion") ?>
|
||||
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div id="mainContainer" class="container-xxl flex-grow-1 container-p-y">
|
||||
|
||||
<div class="col-12">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user