Files
safekat/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
2023-09-18 07:55:44 +02:00

901 lines
39 KiB
PHP

<?php
namespace App\Controllers\Presupuestos;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Presupuestos\PresupuestoEntity;
use App\Models\Presupuestos\PresupuestoModel;
class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
{
protected $modelName = "PresupuestoModel";
protected $format = 'json';
protected static $singularObjectName = 'Cosido Tapa Blanda';
protected static $singularObjectNameCc = 'Cosidotapablanda';
protected static $pluralObjectName = 'Cosidos Tapa Blanda';
protected static $pluralObjectNameCc = 'cosidosTapaBlanda';
protected static $controllerSlug = 'cosidotapablanda';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/cosidotapablanda/';
protected $indexRoute = 'cosidotapablandaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Presupuestos.moduleTitleCosidoTB');
$this->viewData['usingSweetAlert'] = true;
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
$this->viewData = ['usingServerSideDataTable' => true]; // JJO
// Breadcrumbs
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_libros_cosido_tapa_blanda"), 'route' => site_url('presupuestos/cosidotapablanda'), 'active' => true]
];
parent::initController($request, $response, $logger);
$this->model = new PresupuestoModel();
}
public function index()
{
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Presupuestos.presupuesto')]),
'presupuestoEntity' => new PresupuestoEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewCosidotapablandaList', $viewData);
}
public function add()
{
// JJO
$session = session();
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
// JJO
$sanitizedData['user_created_id'] = $session->id_user;
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else :
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Presupuestos.presupuesto'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
endif;
if ($noException && $successfulResult) :
$id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.';
$message .= anchor("admin/presupuestos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
//return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
return redirect()->to(site_url('presupuestos/presupuestos/edit/' . $id))->with('sweet-success', $message);
else :
return $this->redirect2listView('sweet-success', $message);
endif;
else :
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['presupuestoEntity'] = isset($sanitizedData) ? new PresupuestoEntity($sanitizedData) : new PresupuestoEntity();
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
$this->viewData['incReiList'] = array('incidencia'=>lang('Presupuestos.incidencia'), 'reimpresion'=>lang('Presupuestos.reimpresion'), 'sin_cargo'=>lang('Presupuestos.sinCargo'));
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
/*
$this->viewData['formaPagoList'] = $this->getFormaPagoListItems();
$this->viewData['tiposImpresionList'] = $this->getTiposImpresionListItems($presupuestoEntity->tipo_impresion_id ?? null);
$this->viewData['tipologiasLibroList'] = $this->getTipologiasLibroListItems($presupuestoEntity->tipologia_id ?? null);
$this->viewData['ubicacionLibroList'] = $this->getUbicacionLibroListItems($presupuestoEntity->ubicacion_id ?? null);
$this->viewData['presupuestoEstadoList'] = $this->getPresupuestoEstadoListItems($presupuestoEntity->estado_id ?? null);
$this->viewData['papelGenericoList'] = $this->getPapelGenericoListItems($presupuestoEntity->paginas_negro_papel_id ?? null);
$this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($presupuestoEntity->paginas_negro_papel_impresion_id ?? null);
$this->viewData['maquinaList'] = $this->getMaquinaListItems($presupuestoEntity->paginas_negro_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList'] = $this->getMaquinasTarifasImpresionListItems($presupuestoEntity->paginas_negro_tarifa_impresion_id ?? null);
$this->viewData['papelGenericoList2'] = $this->getPapelGenericoListItems2($presupuestoEntity->paginas_color_papel_id ?? null);
$this->viewData['papelImpresionList2'] = $this->getPapelImpresionListItems2($presupuestoEntity->paginas_color_papel_impresion_id ?? null);
$this->viewData['maquinaList2'] = $this->getMaquinaListItems2($presupuestoEntity->paginas_color_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList2'] = $this->getMaquinasTarifasImpresionListItems2($presupuestoEntity->paginas_color_tarifa_impresion_id ?? null);
$this->viewData['papelGenericoList3'] = $this->getPapelGenericoListItems3($presupuestoEntity->paginas_portada_papel_id ?? null);
$this->viewData['papelImpresionList3'] = $this->getPapelImpresionListItems3($presupuestoEntity->paginas_portada_papel_impresion_id ?? null);
$this->viewData['maquinaList3'] = $this->getMaquinaListItems3($presupuestoEntity->paginas_portada_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList3'] = $this->getMaquinasTarifasImpresionListItems3($presupuestoEntity->paginas_portada_tarifa_impresion_id ?? null);
$this->viewData['papelGenericoList4'] = $this->getPapelGenericoListItems4($presupuestoEntity->paginas_cubierta_papel_id ?? null);
$this->viewData['papelImpresionList4'] = $this->getPapelImpresionListItems4($presupuestoEntity->paginas_cubierta_papel_impresion_id ?? null);
$this->viewData['maquinaList4'] = $this->getMaquinaListItems4($presupuestoEntity->paginas_cubierta_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList4'] = $this->getMaquinasTarifasImpresionListItems4($presupuestoEntity->paginas_cubierta_tarifa_impresion_id ?? null);
$this->viewData['userList'] = $this->getUserListItems($presupuestoEntity->total_confirmado_user_id ?? null);
$this->viewData['userList2'] = $this->getUserListItems2($presupuestoEntity->aprobado_user_id ?? null);
$this->viewData['userList3'] = $this->getUserListItems3($presupuestoEntity->pedido_espera_user_id ?? null);
$this->viewData['paginasCubiertaList'] = $this->getPaginasCubiertaOptions();
$this->viewData['paginasPortadaList'] = $this->getPaginasPortadaOptions();
*/
$this->viewData['formAction'] = route_to('createCosidotapablanda');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.addNewSuffix');
/* TEST JS LOADER */
//$this->viewData['global_js_variables'] = array('jsVarTest' => "'Hola Jaime'");
return $this->displayForm(__METHOD__);
} // end function add()
public function edit($requestedId = null)
{
// JJO
$session = session();
if ($requestedId == null) :
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$presupuestoEntity = $this->model->find($id);
if ($presupuestoEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Presupuestos.presupuesto')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
if ($this->request->getPost('recoger_en_taller') == null) {
$sanitizedData['recoger_en_taller'] = false;
}
if ($this->request->getPost('ferro') == null) {
$sanitizedData['ferro'] = false;
}
if ($this->request->getPost('ferro_digital') == null) {
$sanitizedData['ferro_digital'] = false;
}
if ($this->request->getPost('marcapaginas') == null) {
$sanitizedData['marcapaginas'] = false;
}
if ($this->request->getPost('papel_formato_personalizado') == null) {
$sanitizedData['papel_formato_personalizado'] = false;
}
if ($this->request->getPost('solapas') == null) {
$sanitizedData['solapas'] = false;
}
if ($this->request->getPost('cosido') == null) {
$sanitizedData['cosido'] = false;
}
if ($this->request->getPost('cubiertas') == null) {
$sanitizedData['cubiertas'] = false;
}
if ($this->request->getPost('imagenes_bn_interior') == null) {
$sanitizedData['imagenes_bn_interior'] = false;
}
if ($this->request->getPost('en_produccion') == null) {
$sanitizedData['en_produccion'] = false;
}
if ($this->request->getPost('en_espera') == null) {
$sanitizedData['en_espera'] = false;
}
if ($this->request->getPost('modo_comparador') == null) {
$sanitizedData['modo_comparador'] = false;
}
if ($this->request->getPost('paginas_negro_hq') == null) {
$sanitizedData['paginas_negro_hq'] = false;
}
if ($this->request->getPost('paginas_negro_check_papel_total') == null) {
$sanitizedData['paginas_negro_check_papel_total'] = false;
}
if ($this->request->getPost('paginas_negro_check_impresion_total') == null) {
$sanitizedData['paginas_negro_check_impresion_total'] = false;
}
if ($this->request->getPost('paginas_color_check_papel_total') == null) {
$sanitizedData['paginas_color_check_papel_total'] = false;
}
if ($this->request->getPost('paginas_color_check_impresion_total') == null) {
$sanitizedData['paginas_color_check_impresion_total'] = false;
}
if ($this->request->getPost('paginas_portada_check_papel_total') == null) {
$sanitizedData['paginas_portada_check_papel_total'] = false;
}
if ($this->request->getPost('paginas_portada_check_impresion_total') == null) {
$sanitizedData['paginas_portada_check_impresion_total'] = false;
}
if ($this->request->getPost('paginas_cubierta_papel_impresion_id') == null) {
$sanitizedData['paginas_cubierta_papel_impresion_id'] = false;
}
if ($this->request->getPost('paginas_cubierta_check_papel_total') == null) {
$sanitizedData['paginas_cubierta_check_papel_total'] = false;
}
if ($this->request->getPost('paginas_cubierta_check_impresion_total') == null) {
$sanitizedData['paginas_cubierta_check_impresion_total'] = false;
}
if ($this->request->getPost('isDig') == null) {
$sanitizedData['isDig'] = false;
}
if ($this->request->getPost('envios_recoge_cliente') == null) {
$sanitizedData['envios_recoge_cliente'] = false;
}
if ($this->request->getPost('fecha_entrega_real_aviso') == null) {
$sanitizedData['fecha_entrega_real_aviso'] = false;
}
// JJO
$sanitizedData['user_updated_id'] = $session->id_user;
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else :
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Presupuestos.presupuesto'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$presupuestoEntity->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $presupuestoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.';
$message .= anchor("admin/presupuestos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else :
return $this->redirect2listView('sweet-success', $message);
endif;
else :
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['presupuestoEntity'] = $presupuestoEntity;
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
$this->viewData['formaPagoList'] = $this->getFormaPagoListItems();
$this->viewData['tiposImpresionList'] = $this->getTiposImpresionListItems($presupuestoEntity->tipo_impresion_id ?? null);
$this->viewData['tipologiasLibroList'] = $this->getTipologiasLibroListItems($presupuestoEntity->tipologia_id ?? null);
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['ubicacionLibroList'] = $this->getUbicacionLibroListItems($presupuestoEntity->ubicacion_id ?? null);
$this->viewData['presupuestoEstadoList'] = $this->getPresupuestoEstadoListItems($presupuestoEntity->estado_id ?? null);
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
$this->viewData['papelGenericoList'] = $this->getPapelGenericoListItems($presupuestoEntity->paginas_negro_papel_id ?? null);
$this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($presupuestoEntity->paginas_negro_papel_impresion_id ?? null);
$this->viewData['maquinaList'] = $this->getMaquinaListItems($presupuestoEntity->paginas_negro_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList'] = $this->getMaquinasTarifasImpresionListItems($presupuestoEntity->paginas_negro_tarifa_impresion_id ?? null);
$this->viewData['papelGenericoList2'] = $this->getPapelGenericoListItems2($presupuestoEntity->paginas_color_papel_id ?? null);
$this->viewData['papelImpresionList2'] = $this->getPapelImpresionListItems2($presupuestoEntity->paginas_color_papel_impresion_id ?? null);
$this->viewData['maquinaList2'] = $this->getMaquinaListItems2($presupuestoEntity->paginas_color_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList2'] = $this->getMaquinasTarifasImpresionListItems2($presupuestoEntity->paginas_color_tarifa_impresion_id ?? null);
$this->viewData['papelGenericoList3'] = $this->getPapelGenericoListItems3($presupuestoEntity->paginas_portada_papel_id ?? null);
$this->viewData['papelImpresionList3'] = $this->getPapelImpresionListItems3($presupuestoEntity->paginas_portada_papel_impresion_id ?? null);
$this->viewData['maquinaList3'] = $this->getMaquinaListItems3($presupuestoEntity->paginas_portada_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList3'] = $this->getMaquinasTarifasImpresionListItems3($presupuestoEntity->paginas_portada_tarifa_impresion_id ?? null);
$this->viewData['papelGenericoList4'] = $this->getPapelGenericoListItems4($presupuestoEntity->paginas_cubierta_papel_id ?? null);
$this->viewData['papelImpresionList4'] = $this->getPapelImpresionListItems4($presupuestoEntity->paginas_cubierta_papel_impresion_id ?? null);
$this->viewData['maquinaList4'] = $this->getMaquinaListItems4($presupuestoEntity->paginas_cubierta_maquina_id ?? null);
$this->viewData['maquinasTarifasImpresionList4'] = $this->getMaquinasTarifasImpresionListItems4($presupuestoEntity->paginas_cubierta_tarifa_impresion_id ?? null);
$this->viewData['userList'] = $this->getUserListItems($presupuestoEntity->total_confirmado_user_id ?? null);
$this->viewData['userList2'] = $this->getUserListItems2($presupuestoEntity->aprobado_user_id ?? null);
$this->viewData['userList3'] = $this->getUserListItems3($presupuestoEntity->pedido_espera_user_id ?? null);
$this->viewData['paginasCubiertaList'] = $this->getPaginasCubiertaOptions();
$this->viewData['paginasPortadaList'] = $this->getPaginasPortadaOptions();
$this->viewData['formAction'] = route_to('updatePresupuesto', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Presupuestos.moduleTitle') . ' ' . lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
$order = PresupuestoModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
foreach ($resourceData as $item) :
if (isset($item->comentarios_pdf) && strlen($item->comentarios_pdf) > 100) :
$item->comentarios_pdf = character_limiter($item->comentarios_pdf, 100);
endif;
if (isset($item->causa_cancelacion) && strlen($item->causa_cancelacion) > 100) :
$item->causa_cancelacion = character_limiter($item->causa_cancelacion, 100);
endif;
if (isset($item->comentarios) && strlen($item->comentarios) > 100) :
$item->comentarios = character_limiter($item->comentarios, 100);
endif;
if (isset($item->comentarios_safekat) && strlen($item->comentarios_safekat) > 100) :
$item->comentarios_safekat = character_limiter($item->comentarios_safekat, 100);
endif;
if (isset($item->comentarios_tarifa) && strlen($item->comentarios_tarifa) > 100) :
$item->comentarios_tarifa = character_limiter($item->comentarios_tarifa, 100);
endif;
if (isset($item->tirada_alternativa_json_data) && strlen($item->tirada_alternativa_json_data) > 100) :
$item->tirada_alternativa_json_data = character_limiter($item->tirada_alternativa_json_data, 100);
endif;
if (isset($item->titulo) && strlen($item->titulo) > 100) :
$item->titulo = character_limiter($item->titulo, 100);
endif;
if (isset($item->paginas_color_posicion) && strlen($item->paginas_color_posicion) > 100) :
$item->paginas_color_posicion = character_limiter($item->paginas_color_posicion, 100);
endif;
if (isset($item->aprobado_json_data) && strlen($item->aprobado_json_data) > 100) :
$item->aprobado_json_data = character_limiter($item->aprobado_json_data, 100);
endif;
if (isset($item->comparador_json_data) && strlen($item->comparador_json_data) > 100) :
$item->comparador_json_data = character_limiter($item->comparador_json_data, 100);
endif;
if (isset($item->ws_externo_json_data) && strlen($item->ws_externo_json_data) > 100) :
$item->ws_externo_json_data = character_limiter($item->ws_externo_json_data, 100);
endif;
endforeach;
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function allItemsSelect()
{
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal . ', titulo', 'titulo', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->titulo = '- ' . lang('Basic.global.None') . ' -';
array_unshift($menu, $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function menuItems()
{
if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'titulo'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
array_unshift($menu, $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
protected function getClienteListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Clientes.cliente'))])];
if (!empty($selId)) :
$clienteModel = model('App\Models\Clientes\ClienteModel');
$selOption = $clienteModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getPaisListItems()
{
$paisModel = model('App\Models\Configuracion\PaisModel');
$onlyActiveOnes = true;
$data = $paisModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
return $data;
}
protected function getPapelFormatoListItems($selId = null)
{
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
$data = $papelFormatoModel->getElementsForMenu();
array_unshift($data, (object)['id'=>'', 'tamanio' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papelFormatoId'))])]);
return $data;
}
/*
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;
}
*/
}