top.window.location = '../../index.php'"; exit; } require_once __DIR__ . "/" . "../../includes/include_basics_only.php"; require_once __DIR__ . "/" . "../../includes/classes/ConnectPDO.php"; require_once __DIR__ . "/" . "../../includes/classes/worktime/Worktime.php"; include_once __DIR__ . "/" . "../../includes/functions/getWorktimeProfile.php"; $auth = new AuthNew($_SESSION['s_logado'], $_SESSION['s_nivel'], 2, 2); use includes\classes\ConnectPDO; $conn = ConnectPDO::getInstance(); $uareas = $_SESSION['s_uareas']; $exception = ""; $post = (isset($_POST) ? $_POST : ''); // var_dump($post); $imgsPath = "../../includes/imgs/"; $iconFrozen = ""; $iconOutOfWorktime = ""; $iconTicketClosed = ""; $config = getConfig($conn); $percLimit = $config['conf_sla_tolerance']; $calc_slas = (isset($post['calc_slas']) && $post['calc_slas'] == 'on' ? true : false); $options = [ 'client' => [ 'label' => TRANS('CLIENT'), 'table' => 'clients', 'field_id' => 'id', 'field_name' => 'nickname', 'table_reference' => 'instituicao', 'table_reference_alias' => 'un', 'field_reference' => 'inst_client', 'sql_alias' => 'cl.id', 'alias' => 'cl', 'value' => '' ], 'category' => [ 'label' => TRANS('ASSET_CATEGORY'), 'table' => 'assets_categories', 'field_id' => 'id', 'field_name' => 'cat_name', 'table_reference' => 'tipo_equip', 'table_reference_alias' => 't', 'field_reference' => 'tipo_categoria', 'sql_alias' => 'equip.tipo_categoria', 'alias' => 'cat', 'value' => '' ], 'asset_type' => [ 'label' => TRANS('ASSET_TYPE'), 'table' => 'tipo_equip', 'field_id' => 'tipo_cod', 'field_name' => 'tipo_nome', 'table_reference' => 'equipamentos', 'table_reference_alias' => 'e', 'field_reference' => 'comp_tipo_equip', 'sql_alias' => 'equip.tipo_cod', 'alias' => 't', 'value' => '' ], 'unit' => [ 'label' => TRANS('COL_UNIT'), 'table' => 'instituicao', 'field_id' => 'inst_cod', 'field_name' => 'inst_nome', 'table_reference' => 'equipamentos', 'table_reference_alias' => 'e', 'field_reference' => 'comp_inst', 'sql_alias' => 'inst.inst_cod', 'alias' => 'un', 'value' => '' ], 'department' => [ 'label' => TRANS('DEPARTMENT'), 'table' => 'localizacao', 'field_id' => 'loc_id', 'field_name' => 'local', 'table_reference' => 'equipamentos', 'table_reference_alias' => 'e', 'field_reference' => 'comp_local', 'sql_alias' => 'loc.loc_id', 'alias' => 'l', 'value' => '' ], 'model' => [ 'label' => TRANS('COL_MODEL'), 'table' => 'marcas_comp', 'field_id' => 'marc_cod', 'field_name' => 'marc_nome', 'table_reference' => 'equipamentos', 'table_reference_alias' => 'e', 'field_reference' => 'comp_marca', 'sql_alias' => 'model.marc_cod', 'alias' => 'm', 'value' => '' ], 'state' => [ 'label' => TRANS('STATE'), 'table' => 'situacao', 'field_id' => 'situac_cod', 'field_name' => 'situac_nome', 'table_reference' => 'equipamentos', 'table_reference_alias' => 'e', 'field_reference' => 'comp_situac', 'sql_alias' => 'sit.situac_cod', 'alias' => 's', 'value' => '' ], 'manufacturer' => [ 'label' => TRANS('COL_MANUFACTURER'), 'table' => 'fabricantes', 'field_id' => 'fab_cod', 'field_name' => 'fab_nome', 'table_reference' => 'equipamentos', 'table_reference_alias' => 'e', 'field_reference' => 'comp_fab', 'sql_alias' => 'fab.fab_cod', 'alias' => 'f', 'value' => '' ] ]; if (!empty($post)) { // var_dump($post); exit; // $queryForResources = [ // 1 => "", // 2 => " AND cat.cat_is_product = 0 ", // 3 => " AND cat.cat_is_product = 1 " // ]; $queryForResources = [ 1 => "", 2 => " AND (c.is_product IS NULL OR c.is_product = 0) ", 3 => " AND c.is_product = 1 " ]; $terms_resources = ""; $terms_resources = (isset($post['group_0']) ? $queryForResources[$post['group_0']] : ""); $queryAvailability = [ 1 => "", 2 => " AND uxa.id IS NULL ", /* disponíveis */ 3 => " AND uxa.id IS NOT NULL " /* Nao disponíveis */ ]; $terms_availability = ""; $terms_availability = (isset($post['group_00']) ? $queryAvailability[$post['group_00']] : ""); /* Níveis possíveis de agrupamento */ $groups = [ 'group_1' => '', 'group_2' => '', 'group_3' => '', 'group_4' => '', 'group_5' => '', ]; foreach ($groups as $key => $group) { if (!empty($post[$key])) { $groups[$key] = $post[$key]; } else { unset($groups[$key]); } } $table_id = $post['params']; $params = []; if (isset($post['params']) && !empty($post['params'])) { /* Tratamento quando o último parâmetro for de valor nulo */ if (substr($post['params'], -1) == '-') { $post['params'] .= '0'; } $params = explode('--', str_replace('---','-0--', $post['params'])); } $tmp = []; /** Adicionando o valor para pesquisa no array principal $options */ foreach ($params as $param) { $tmp = explode('-' , $param); $options[$tmp[0]]['value'] = (array_key_exists(1, $tmp) ? $tmp[1] : '0'); } /* Monta os termos de pesquisa para a consulta SQL que exibirá a tabela de chamados */ $sql_terms = ""; foreach ($options as $key => $value) { if ($value['value'] !== '') { $sql_terms .= ($value['value'] == 0 ? "AND {$value['sql_alias']} IS NULL " : "AND {$value['sql_alias']}={$value['value']} "); } } /* Controle para apenas unidades visíveis pela área primária do usuário */ $terms = ""; if (!empty($_SESSION['s_allowed_units'])) { $terms = " AND inst.inst_cod IN ({$_SESSION['s_allowed_units']}) "; } // $sql = $QRY["full_detail_ini"]; $sql = $QRY["assets_queues"]; $sql .= $sql_terms; $sql .= $terms; $sql .= $terms_resources; $sql .= $terms_availability; // $sql .= $QRY["full_detail_fim"]; // $sql .= " ORDER BY instituicao, etiqueta"; // dump($sql); /* Só enviará dados se for o último nível do agrupamento selecionado */ if (count($params) == count($groups)) { // var_dump([ // 'params' => $params, // 'sql_terms' => $sql_terms, // 'terms' => $terms, // ]); // dump($sql); // return; try { $res = $conn->query($sql); ?>
| = TRANS('ASSET_TAG'); ?> | = TRANS('CLIENT'); ?> | = TRANS('COL_UNIT'); ?> = TRANS('DEPARTMENT'); ?> |
= TRANS('COL_TYPE'); ?> = TRANS('COL_MANUFACTURER'); ?> = TRANS('COL_MODEL'); ?> |
= TRANS('DIRECT_ATTRIBUTES'); ?> | = TRANS('AGGREGATED_ATTRIBUTES'); ?> | = TRANS('AVAILABILITY'); ?> |
|---|---|---|---|---|---|---|
| )>= $rowDetail['etiqueta']; ?> | = $rowDetail['nickname']; ?> | = $rowDetail['instituicao']; ?> = $rowDetail['local']; ?> |
= $rowDetail['equipamento'] . $categorieBadge ?> = $rowDetail['fab_nome']; ?> = $rowDetail['modelo']; ?> |
= $directAttributes; ?> | = $aggregatedAttributes; ?> | = $availability; ?> |