top.window.location = '../../index.php'";
exit;
}
require_once __DIR__ . "/" . "../../includes/include_basics_only.php";
require_once __DIR__ . "/" . "../../includes/classes/ConnectPDO.php";
$auth = new AuthNew($_SESSION['s_logado'], $_SESSION['s_nivel'], 2, 2);
use includes\classes\ConnectPDO;
$conn = ConnectPDO::getInstance();
$post = $_POST;
// var_dump($post);
$terms = "";
$criteria = array();
$criterText = "";
$badgeClass = "badge badge-info p-2 mb-1";
$badgeClassDirectAttributes = "badge badge-success p-2 mb-1";
$badgeClassAggregatedAttributes = "badge badge-oc-olive p-2 mb-1";
$badgeClassCustomFields = "badge badge-oc-teal p-2 mb-1";
$badgeClassEmptySearch = "badge badge-danger p-2 mb-1";
$imgsPath = "../../includes/imgs/";
$config = getConfig($conn);
$render_custom_fields = (isset($post['render_custom_fields']) ? $post['render_custom_fields']: 1);
$possibleOperations = ['<', '>', '<=', '>=', '==', '===', '!=', 'IN'];
$hasLimitationByAllowedClients = false;
$hasLimitationByAllowedUnits = false;
/* Cliente */
$field_label = TRANS('CLIENT');
$post_field_sufix = "client";
$field_table = "clients";
$field_id = "id";
$field_name = "nickname";
if (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$fieldIn = "";
$unitIn = "";
$treatedPostField = array_map('noHtml', $post[$post_field_sufix]);
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$sql = "SELECT inst_cod FROM instituicao WHERE inst_client IN ({$fieldIn}) ";
$res = $conn->query($sql);
if ($res->rowCount()) {
foreach ($res->fetchAll() as $rowUnit) {
if (strlen((string)$unitIn)) $unitIn .= ",";
$unitIn .= $rowUnit['inst_cod'];
}
$terms .= " AND inst.inst_cod IN ({$unitIn}) ";
}
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
} else {
/* Não houve seleção de cliente - é necessário checar se há limite de visualização para a área primária do usuário */
if (!empty($_SESSION['s_allowed_units'])) {
$hasLimitationByAllowedClients = true;
$terms .= " AND inst.inst_cod IN ({$_SESSION['s_allowed_units']}) ";
}
}
/* Unidade */
$field_label = TRANS('COL_UNIT');
$post_field_sufix = "unidade";
$sql_column = "inst.inst_cod";
$field_table = "instituicao";
$field_id = "inst_cod";
$field_name = "inst_nome";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = array_map('noHtml', $post[$post_field_sufix]);
$fieldIn = "";
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
} else {
/* Não houve seleção de unidade - é necessário checar se há limite de visualização para a área primária do usuário */
if (!empty($_SESSION['s_allowed_units'])) {
$hasLimitationByAllowedUnits = true;
$terms .= " AND inst.inst_cod IN ({$_SESSION['s_allowed_units']}) ";
}
}
/* Usuário do ativo */
/* Exibição dos critérios relacionados aos usuários dos ativos */
if (isset($post['no_empty_asset_user']) && !empty($post['no_empty_asset_user'])) {
$criterText = TRANS('SMART_ASSETS_HAVING_USERS') . "
";
$criteria[] = "{$criterText}";
$terms .= " ";
} elseif (isset($post['no_asset_user']) && !empty($post['no_asset_user'])) {
$criterText = TRANS('SMART_ASSETS_NOT_HAVING_USERS') . "
";
$criteria[] = "{$criterText}";
$terms .= " ";
} elseif (isset($post['asset_user']) && !empty($post['asset_user'])) {
$criterText = "";
$treatedPostField = array_map('intval', $post['asset_user']);
$usersNames = getArrayOfUsersNamesByIds($conn, $treatedPostField);
$criterText = implode(", ", $usersNames);
$criterText = TRANS('FIELD_USER') . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
$terms .= " ";
}
/* Etiqueta */
$field_label = TRANS('ASSET_TAG');
$post_field_sufix = "etiqueta";
$sql_column = "c.comp_inv";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$tmp = explode(',', (string)$post[$post_field_sufix]);
// $treatValues = array_map('intval', $tmp);
$treatValues = array_map('noHtml', $tmp);
$tagIN = "";
foreach ($treatValues as $tag) {
if (strlen((string)$tagIN)) $tagIN .= ", ";
$tag = trim($tag);
$tagIN .= "'{$tag}'";
}
$terms .= " AND {$sql_column} IN ({$tagIN}) ";
$criterText = $field_label . ": {$tagIN}
";
$criteria[] = "{$criterText}";
}
/* Tipo de ativo */
$field_label = TRANS('COL_TYPE');
$post_field_sufix = "equip_type";
$sql_column = "c.comp_tipo_equip";
$field_table = "tipo_equip";
$field_id = "tipo_cod";
$field_name = "tipo_nome";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$fieldIn = "";
if (is_array($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
} else {
/* Se não for array, indica que a requisição não está vindo do filtro avancado */
$fieldIn = (int)$post[$post_field_sufix];
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* asset_or_resource : Filtra se é busca sobre todos os ativos ou apenas recursos */
$field_label = TRANS('CONSIDERS');
// $queryForTypes = [
// 1 => "",
// 2 => "AND cat.cat_is_product = 0",
// 3 => "AND cat.cat_is_product = 1"
// ];
$queryForTypes = [
1 => "",
2 => "AND (c.is_product IS NULL OR c.is_product = 0) ",
3 => "AND c.is_product = 1"
];
$optionsForTypes = [
1 => TRANS('ALL_TYPES'),
2 => TRANS('ONLY_ASSETS'),
3 => TRANS('ONLY_RESOURCES')
];
if (isset($post['asset_or_resource']) && !empty($post['asset_or_resource'])) {
$treatedPostField = (int)$post['asset_or_resource'];
$terms .= $queryForTypes[$treatedPostField];
$criterText = $field_label . ": " . $optionsForTypes[$treatedPostField] ."
";
$criteria[] = "{$criterText}";
}
/* Categoria do tipo de ativo */
$field_label = TRANS('ASSET_CATEGORY');
$post_field_sufix = "asset_category";
$sql_column = "equip.tipo_categoria";
$field_table = "assets_categories";
$field_id = "id";
$field_name = "cat_name";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$fieldIn = "";
if (is_array($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
} else {
/* Se não for array, indica que a requisição não está vindo do filtro avancado */
$fieldIn = (int)$post[$post_field_sufix];
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Fabricante */
$field_label = TRANS('COL_MANUFACTURER');
$post_field_sufix = "manufacturer";
$sql_column = "fab.fab_cod";
$field_table = "fabricantes";
$field_id = "fab_cod";
$field_name = "fab_nome";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
$fieldIn = "";
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Modelo */
$field_label = TRANS('COL_MODEL');
$post_field_sufix = "model";
$sql_column = "model.marc_cod";
$field_table = "marcas_comp";
$field_id = "marc_cod";
$field_name = "marc_nome";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$fieldIn = "";
if (is_array($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
} else {
$fieldIn = (int)$post[$post_field_sufix];
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Serial number */
$field_label = TRANS('SERIAL_NUMBER');
$post_field_sufix = "serial_number";
$sql_column = "c.comp_sn";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$tmp = explode(',', (string)$post[$post_field_sufix]);
// $treatValues = array_map('intval', $tmp);
$treatValues = array_map('noHtml', $tmp);
$tagIN = "";
foreach ($treatValues as $tag) {
if (strlen((string)$tagIN)) $tagIN .= ", ";
$tag = trim($tag);
$tagIN .= "'{$tag}'";
}
$terms .= " AND {$sql_column} IN ({$tagIN}) ";
$criterText = $field_label . ": {$tagIN}
";
$criteria[] = "{$criterText}";
}
/* Part-number */
$field_label = TRANS('COL_PARTNUMBER');
$post_field_sufix = "part_number";
$sql_column = "c.comp_part_number";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$tmp = explode(',', (string)$post[$post_field_sufix]);
// $treatValues = array_map('intval', $tmp);
$treatValues = array_map('noHtml', $tmp);
$tagIN = "";
foreach ($treatValues as $tag) {
if (strlen((string)$tagIN)) $tagIN .= ", ";
$tag = trim($tag);
$tagIN .= "'{$tag}'";
}
$terms .= " AND {$sql_column} IN ({$tagIN}) ";
$criterText = $field_label . ": {$tagIN}
";
$criteria[] = "{$criterText}";
}
/* Departamento */
$field_label = TRANS('DEPARTMENT');
$post_field_sufix = "departamento";
$sql_column = "c.comp_local";
$field_table = "localizacao";
$field_id = "loc_id";
$field_name = "local";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$fieldIn = "";
if (is_array($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
} else {
/* Se não for array, indica que a requisição não está vindo do filtro avancado */
$fieldIn = (int)$post[$post_field_sufix];
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Situação */
$field_label = TRANS('STATE');
$post_field_sufix = "condition";
$sql_column = "c.comp_situac";
$field_table = "situacao";
$field_id = "situac_cod";
$field_name = "situac_nome";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
$fieldIn = "";
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Fornecedores */
$field_label = TRANS('COL_VENDOR');
$post_field_sufix = "supplier";
$sql_column = "c.comp_fornecedor";
$field_table = "fornecedores";
$field_id = "forn_cod";
$field_name = "forn_nome";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
$fieldIn = "";
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Centro de Custo */
$field_label = TRANS('COST_CENTER');
$post_field_sufix = "cost_center";
$sql_column = "c.comp_ccusto";
$db_name = DB_CCUSTO;
$field_table = TB_CCUSTO;
$field_id = CCUSTO_ID;
$field_name = CCUSTO_DESC;
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
$fieldIn = "";
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$db_name}.{$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Nota Fiscal */
$field_label = TRANS('INVOICE_NUMBER');
$post_field_sufix = "invoice_number";
$sql_column = "c.comp_nf";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$tmp = explode(',', (string)$post[$post_field_sufix]);
// $treatValues = array_map('intval', $tmp);
$treatValues = array_map('noHtml', $tmp);
$tagIN = "";
foreach ($treatValues as $tag) {
if (strlen((string)$tagIN)) $tagIN .= ", ";
$tag = trim($tag);
$tagIN .= "'{$tag}'";
}
$terms .= " AND {$sql_column} IN ({$tagIN}) ";
$criterText = $field_label . ": {$tagIN}
";
$criteria[] = "{$criterText}";
}
/* Assistência */
$field_label = TRANS('ASSISTENCE');
$post_field_sufix = "assistance";
$sql_column = "c.comp_assist";
$field_table = "assistencia";
$field_id = "assist_cod";
$field_name = "assist_desc";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
$fieldIn = "";
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Tipo de garantia */
$field_label = TRANS('FIELD_TYPE_WARRANTY');
$post_field_sufix = "warranty_type";
$sql_column = "c.comp_tipo_garant";
$field_table = "tipo_garantia";
$field_id = "tipo_garant_cod";
$field_name = "tipo_garant_nome";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} != '-1' AND {$sql_column} != '0' AND {$sql_column} IS NOT NULL AND {$sql_column} != '') ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} = '-1' OR {$sql_column} = '0' OR {$sql_column} IS NULL OR {$sql_column} = '' ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = array_map('intval', $post[$post_field_sufix]);
$fieldIn = "";
foreach ($treatedPostField as $field) {
if (strlen((string)$fieldIn)) $fieldIn .= ",";
$fieldIn .= (int)$field;
}
$terms .= " AND {$sql_column} IN ({$fieldIn}) ";
$criterText = "";
$sqlCriter = "SELECT {$field_name} FROM {$field_table} WHERE {$field_id} in ({$fieldIn}) ORDER BY {$field_name}";
$resCriter = $conn->query($sqlCriter);
foreach ($resCriter->fetchAll() as $rowCriter) {
if (strlen((string)$criterText)) $criterText .= ", ";
$criterText .= $rowCriter[$field_name];
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Garantia */
$field_label = TRANS('WARRANTY_STATUS');
$post_field_sufix = "warranty_status";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND (c.comp_data_compra IS NOT NULL AND c.comp_garant_meses IS NOT NULL) ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND (c.comp_data_compra IS NULL OR c.comp_garant_meses IS NULL) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$criterText = "";
if ((int)$post[$post_field_sufix] == 1) {
$terms .= " AND (date_add(c.comp_data_compra, INTERVAL tmp.tempo_meses month) >= now()) ";
$criterText .= TRANS('UNDER_WARRANTY');
} elseif ((int)$post[$post_field_sufix] == 2) {
$terms .= " AND (date_add(c.comp_data_compra, INTERVAL tmp.tempo_meses month) < now()) ";
$criterText .= TRANS('SEL_GUARANTEE_EXPIRED');
}
$criterText = $field_label . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
}
/* Data mínima de aquisição */
$field_label = TRANS('SMART_MIN_PURCHASE_DATE');
$post_field_sufix = "purchase_date_from";
$sql_column = "c.comp_data_compra";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} IS NOT NULL ) ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} IS NULL ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = noHtml($post[$post_field_sufix]);
if (!isValidDate($treatedPostField, 'd/m/Y')) {
$errorFieldMessage = TRANS('MSG_ERROR_WRONG_FORMATTED') . ": " . $field_label;
echo message('warning', '', $errorFieldMessage, '', '' , 1);
exit;
}
$date_from = "";
$date_from = $treatedPostField . " 00:00:00";
$date_from = dateDB($date_from);
$terms .= " AND ( {$sql_column} >= '{$date_from}' ) ";
$criterText = $field_label . ": " . $treatedPostField . "
";
$criteria[] = "{$criterText}";
}
/* Data máxima de aquisição */
$field_label = TRANS('SMART_MAX_PURCHASE_DATE');
$post_field_sufix = "purchase_date_to";
$sql_column = "c.comp_data_compra";
if (isset($post['no_empty_' . $post_field_sufix]) && $post['no_empty_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} IS NOT NULL ) ";
$criterText = $field_label . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_' . $post_field_sufix]) && $post['no_' . $post_field_sufix] == 1) {
$terms .= " AND ( {$sql_column} IS NULL ) ";
$criterText = $field_label . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$post_field_sufix]) && !empty($post[$post_field_sufix])) {
$treatedPostField = noHtml($post[$post_field_sufix]);
if (!isValidDate($treatedPostField, 'd/m/Y')) {
$errorFieldMessage = TRANS('MSG_ERROR_WRONG_FORMATTED') . ": " . $field_label;
echo message('warning', '', $errorFieldMessage, '', '' , 1);
exit;
}
$date_from = "";
$date_from = $treatedPostField . " 23:59:59";
$date_from = dateDB($date_from);
$terms .= " AND ( {$sql_column} <= '{$date_from}' ) ";
$criterText = $field_label . ": " . $treatedPostField . "
";
$criteria[] = "{$criterText}";
}
// if (empty($terms)) {
// $criterText = TRANS('SMART_WITHOUT_SEARCH_CRITERIA') . "
";
// $criteria[] = "{$criterText}";
// }
// echo $terms;
$sql = $QRY["full_detail_ini"];
$sql .= $terms;
$sql .= " ORDER BY instituicao, etiqueta";
// /* Controle para evitar consultas sem critérios relevantes */
// if (empty(trim($terms))) {
// $criterText = TRANS('SMART_WITHOUT_SEARCH_CRITERIA') . "
";
// $criteria[] = "{$criterText}";
// /* Não permito a busca de ativos sem ao menos um critério dentro dos campos oficiais */
// echo message('warning', '', TRANS('CHOOSE_AT_LEAST_ONE_CRITERIA_ASSETS'), '', '' , 1);
// exit;
// }
$sqlResult = $conn->query($sql);
$totalFiltered = $sqlResult->rowCount();
/* Exibição dos critérios sobre os atributos diretos do ativo pesquisado */
if (!empty($post['measure_type'])) {
$i = 0;
foreach ($post['measure_type'] as $measure) {
if (!empty($post['measure_value'][$i]) && !empty($post['operation'][$i]) && !empty($post['measure_unit'][$i])) {
if (!in_array($post['operation'][$i], $possibleOperations)) {
$errorFieldMessage = TRANS('MSG_INVALID_OPERATION');
echo message('warning', '', $errorFieldMessage, '', '' , 1);
exit;
}
$measure_type_name = getMeasureTypes($conn, (int)$post['measure_type'][$i])['mt_name'];
$measure_unit_name = getMeasureUnits($conn, (int)$post['measure_unit'][$i])['unit_abbrev'];
$criterText = $measure_type_name . ' ' . $post['operation'][$i] . ' ' . noHtml($post['measure_value'][$i]) . $measure_unit_name . "
";
$criteria[] = "{$criterText}";
}
$i++;
}
}
/* Exibição dos critérios sobre os atributos agregados ao ativo pesquisado */
if (!empty($post['asset_type_aggregated'])) {
$i = 0;
foreach ($post['asset_type_aggregated'] as $type_aggregated) {
if (!empty($post['asset_type_aggregated']) && !empty($post['measure_type_aggregated']) && !empty($post['measure_value_aggregated'][$i]) && !empty($post['measure_unit_aggregated'][$i])) {
$asset_type_name = getAssetsTypes($conn, (int)$post['asset_type_aggregated'][$i])['tipo_nome'];
$measure_type_name = getMeasureTypes($conn, (int)$post['measure_type_aggregated'][$i])['mt_name'];
$measure_unit_name = getMeasureUnits($conn, (int)$post['measure_unit_aggregated'][$i])['unit_abbrev'];
$criterText = $asset_type_name . ' ' . TRANS('WITH') . ' ' . $measure_type_name . ' ' . noHtml($post['operation_aggregated'][$i]) . ' ' . noHtml($post['measure_value_aggregated'][$i]) . $measure_unit_name . "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_empty_']) && count($post['no_empty_']) && array_key_exists($post['asset_type_aggregated'][$i], $post['no_empty_'])) {
$asset_type_name = getAssetsTypes($conn, $post['asset_type_aggregated'][$i])['tipo_nome'];
$criterText = $asset_type_name . ': ' . TRANS('OCO_SEL_ANY'). "
";
$criteria[] = "{$criterText}";
} elseif (isset($post['no_']) && count($post['no_']) && array_key_exists($post['asset_type_aggregated'][$i], $post['no_'])) {
$asset_type_name = getAssetsTypes($conn, (int)$post['asset_type_aggregated'][$i])['tipo_nome'];
$criterText = $asset_type_name . ': ' . TRANS('SEL_NONE');
$criteria[] = "{$criterText}";
}
$i++;
}
}
/**
* Campos personalizados
* Tipos de campos possíveis:
* ["date", "datetime", "select", "select_multi", "number", "text", "textarea", "checkbox"]
*
* Até o momento esses são os campos permitidos e tratados:
* ["date", "datetime", "select", "select_multi", "number", "text", "textarea", "checkbox"]
*/
$custom_fields = [];
$custom_fields_full = [];
if ($render_custom_fields) {
$types = ["date", "datetime", "select", "select_multi", "number", "text", "textarea", "checkbox"];
$custom_fields = getCustomFields($conn, null, 'equipamentos', $types); /* Apenas campos customizados ativos e que podem ser pesquisados */
$custom_fields_full = getCustomFields($conn, null, 'equipamentos'); /* Para montar a tabela de exibição, todos os campos ativos sao utilizados */
}
/* Montagem dos Critérios dos campos personalizados preenchidos */
$emptyPrefix = "no_";
$notEmptyPrefix = "no_empty_";
$minDatePrefix = "min_";
$maxDatePrefix = "max_";
$minNumberPrefix = "minNum_";
$maxNumberPrefix = "maxNum_";
$noRenderPrefix = "norender_";
$dontRender = [];
/** Armazenarei aqui os valores a serem checados por cada chamado */
$customTerms = [];
foreach ($custom_fields as $cfield) {
$criterText = "";
/* Ver os campos que não devem ser renderizados */
if (isset($post[$noRenderPrefix . $cfield['field_name']]) && $post[$noRenderPrefix . $cfield['field_name']] == 1) {
$dontRender[] = $cfield['id'];
}
if (isset($post[$notEmptyPrefix . $cfield['field_name']]) && $post[$notEmptyPrefix . $cfield['field_name']] == 1) {
/* Qualquer valor não vazio */
$criterText = $cfield['field_label'] . ": " . TRANS('SMART_NOT_EMPTY') . "
";
$criteria[] = "{$criterText}";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['!='][] = '';
} elseif (isset($post[$emptyPrefix . $cfield['field_name']]) && $post[$emptyPrefix . $cfield['field_name']] == 1) {
/* Valor obrigatiamente vazio */
$criterText = $cfield['field_label'] . ": " . TRANS('SMART_EMPTY') . "
";
$criteria[] = "{$criterText}";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['=='][] = '';
} elseif (isset($post[$cfield['field_name']]) && !empty($post[$cfield['field_name']])) {
/* Valor informado */
if ($cfield['field_type'] == 'select' || $cfield['field_type'] == 'select_multi') {
$treatedPostField = array_map('noHtml', $post[$cfield['field_name']]);
$fieldIN = [];
foreach ($treatedPostField as $fieldValue) {
$fieldIN[] = getCustomFieldValue($conn, $fieldValue);
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['IN'][] = $fieldValue;
}
} else {
/* Ver tratamento para cada tipo de campo - Datas não entram nesse laço */
$fieldIN = noHtml($post[$cfield['field_name']]);
/* id - operador - valor de comparacao */
// $customTerms[$cfield['id']]['=='][] = $fieldIN;
/* Operador de comparação direta '===' */
$customTerms[$cfield['id']]['==='][] = $fieldIN;
}
$criterText = (is_array($fieldIN) ? implode(", ", $fieldIN) : $fieldIN);
$criterText = $cfield['field_label'] . ": " . $criterText ."
";
$criteria[] = "{$criterText}";
} elseif (isset($post[$minDatePrefix . $cfield['field_name']]) && !empty($post[$minDatePrefix . $cfield['field_name']])) {
/* Se tiver data mínima selecionada - Campos do tipo date ou datetime' */
$criterText = noHtml($post[$minDatePrefix . $cfield['field_name']]);
$criterText = $cfield['field_label'] . " (" . TRANS('MIN_DATE') . "): " . $criterText ."
";
$criterText2 = "";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['<='][] = noHtml($post[$minDatePrefix . $cfield['field_name']]);
/* Tem data final? */
if (isset($post[$maxDatePrefix . $cfield['field_name']]) && !empty($post[$maxDatePrefix . $cfield['field_name']])) {
$criterText2 = noHtml($post[$maxDatePrefix . $cfield['field_name']]);
$criterText2 = $cfield['field_label'] . " (" . TRANS('MAX_DATE') . "): " . $criterText2 ."
";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['>='][] = noHtml($post[$maxDatePrefix . $cfield['field_name']]);
}
$criteria[] = "{$criterText}";
$criteria[] = "{$criterText2}";
} elseif (isset($post[$maxDatePrefix . $cfield['field_name']]) && !empty($post[$maxDatePrefix . $cfield['field_name']])) {
/* Se tiver data máxima selecionada mas não tiver data mínima */
$criterText = noHtml($post[$maxDatePrefix . $cfield['field_name']]);
$criterText = $cfield['field_label'] . " (" . TRANS('MAX_DATE') . "): " . $criterText ."
";
$criterText2 = "";
$criteria[] = "{$criterText}";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['>='][] = noHtml($post[$maxDatePrefix . $cfield['field_name']]);
} elseif (isset($post[$minNumberPrefix . $cfield['field_name']]) && !empty($post[$minNumberPrefix . $cfield['field_name']])) {
/* Se tiver data mínima selecionada - Campos do tipo date ou datetime' */
$criterText = noHtml($post[$minNumberPrefix . $cfield['field_name']]);
$criterText = $cfield['field_label'] . " (" . TRANS('MIN_VALUE') . "): " . $criterText ."
";
$criterText2 = "";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['<='][] = noHtml($post[$minNumberPrefix . $cfield['field_name']]);
/* Tem limite final? */
if (isset($post[$maxNumberPrefix . $cfield['field_name']]) && !empty($post[$maxNumberPrefix . $cfield['field_name']])) {
$criterText2 = noHtml($post[$maxNumberPrefix . $cfield['field_name']]);
$criterText2 = $cfield['field_label'] . " (" . TRANS('MAX_VALUE') . "): " . $criterText2 ."
";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['>='][] = noHtml($post[$maxNumberPrefix . $cfield['field_name']]);
}
$criteria[] = "{$criterText}";
$criteria[] = "{$criterText2}";
} elseif (isset($post[$maxNumberPrefix . $cfield['field_name']]) && !empty($post[$maxNumberPrefix . $cfield['field_name']])) {
/* Se tiver data máxima selecionada mas não tiver data mínima */
$criterText = noHtml($post[$maxNumberPrefix . $cfield['field_name']]);
$criterText = $cfield['field_label'] . " (" . TRANS('MAX_VALUE') . "): " . $criterText ."
";
$criterText2 = "";
$criteria[] = "{$criterText}";
/* id - operador - valor de comparacao */
$customTerms[$cfield['id']]['>='][] = noHtml($post[$maxNumberPrefix . $cfield['field_name']]);
}
}
/* Final da montagem dos critérios sobre os campos personalizados preenchidos */
if (empty($criteria)) {
$criterText = TRANS('SMART_WITHOUT_SEARCH_CRITERIA') . "
";
$criteria[] = "{$criterText}";
}
$criterios = "";
?>
| = TRANS('ASSET_TAG'); ?> | = TRANS('CLIENT'); ?> | = TRANS('COL_UNIT'); ?> | = TRANS('ASSET_CATEGORY'); ?> | = TRANS('COL_TYPE'); ?> | = TRANS('COL_MANUFACTURER'); ?> | = TRANS('COL_MODEL'); ?> | = TRANS('ALLOCATED_TO'); ?> | = TRANS('SERIAL_NUMBER'); ?> | = TRANS('COL_PARTNUMBER'); ?> | = TRANS('DEPARTMENT'); ?> | = TRANS('STATE'); ?> | = TRANS('COL_VENDOR'); ?> | = TRANS('COST_CENTER'); ?> | = TRANS('FIELD_PRICE'); ?> | = TRANS('INVOICE_NUMBER'); ?> | = TRANS('ASSISTENCE'); ?> | = TRANS('FIELD_TYPE_WARRANTY'); ?> | = TRANS('WARRANTY_EXPIRE'); ?> | = TRANS('PURCHASE_DATE'); ?> | = TRANS('DIRECT_ATTRIBUTES'); ?> | = TRANS('AGGREGATED_ATTRIBUTES'); ?> | = TRANS('AGGREGATED_SOFTWARES'); ?> | = noHtml($cfield['field_label']); ?> | = TRANS('DEPRECATED_ATTRIBUTES'); ?> | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| = $row['comp_cod']; ?> | = "" . $row['etiqueta'] . ""; ?> | = $row['nickname'] ; ?> | = $row['instituicao'] ; ?> | = $category; ?> | = $row['equipamento'] ; ?> | = $row['fab_nome'] ; ?> | = $row['modelo'] ; ?> | = $allocated_to; ?> | = $row['serial'] ; ?> | = $row['part_number'] ; ?> | = $row['local'] ; ?> | = $row['situac_nome'] ; ?> | = $row['fornecedor_nome'] ; ?> | = $cost_center ; ?> | = priceScreen($row['valor']) ; ?> | = $row['nota'] ; ?> | = $row['assistencia'] ; ?> | = $row['tipo_garantia'] ; ?> | = dateScreen($row['vencimento'], 1) ; ?> | = dateScreen($row['data_compra'], 1) ; ?> | = $directAttributes ; ?> | = $aggregatedAttributes ; ?> | = $softAggregatedAttributes ; ?> | = $showField; ?> | = $deprecatedAttributes ; ?> |