if (!empty($data_inicial) and empty($data_final)) { if (strlen($query) > 34) { $query .= "AND "; } $data_inicial = datam($data_inicial); $query .= "data_abertura>='{$data_inicial}'"; } if (empty($data_inicial) and !empty($data_final)) { if (strlen($query) > 34) { $query .= "AND "; } $data_final = datam($data_final); $query .= "data_abertura<='{$data_final}'"; } if (empty($data_inicial) and empty($data_final)) { $data_inicial = datam("01/01/1990"); $query .= "data_abertura>='{$data_inicial}'"; } $query_total = $query . " ) ORDER BY numero"; $query_abertas = $query . " AND status!='4') ORDER BY numero"; $query_encerradas = $query . " AND status='4') ORDER BY numero"; $query_aguardando = $query . " AND status='1') ORDER BY numero"; $query_atendimento = $query . " AND status='2') ORDER BY numero"; $query_estudo = $query . " AND status='3') ORDER BY numero"; if (strlen($query) > 36) { $resultado_total = mysql_query($query_total); $linhas_total = mysql_numrows($resultado_total); $resultado_abertas = mysql_query($query_abertas); $linhas_abertas = mysql_numrows($resultado_abertas); $resultado_encerradas = mysql_query($query_encerradas); $linhas_encerradas = mysql_numrows($resultado_encerradas);
} //############################################################################### if ($relatorio == "intranet") { if (empty($data_inicial) and empty($data_final)) { $data_inicial = "01/" . date(m) . "/" . date(Y); $mes = date(m); $data_final = date(t, $mes) . "/" . date(m) . "/" . date(Y); } if (!empty($data_inicial) and empty($data_final)) { $data_final = date(t, $mes) . "/" . date(m) . "/" . date(Y); } if (empty($data_inicial) and !empty($data_final)) { $data_inicial = "01/" . date(m) . "/" . date(Y); } $data_inicial = datam($data_inicial); $data_final = datam($data_final); $query = "SELECT * FROM ocorrencias WHERE (data_abertura>='{$data_inicial}' AND data_abertura<='{$data_final}') ORDER BY data_abertura"; $resultado = mysql_query($query); $linhas = mysql_numrows($resultado); $i = 0; $sem1 = 0; $sem2 = 0; $sem3 = 0; $sem4 = 0; $sem5 = 0; $semana1 = "2002-03-07"; $semana2 = "2002-03-14"; $semana3 = "2002-03-21"; $semana4 = "2002-03-28"; $semana5 = "2002-03-31"; while ($i < $linhas) {
$data_final .= " 23:59:59"; $query .= "data_fechamento>='{$data_inicial}' AND data_fechamento<='{$data_final}'"; } if (!empty($data_inicial) and empty($data_final)) { if (strlen($query) > 34) { $query .= "AND "; } $data_inicial = substr(datam($data_inicial), 0, 10); $data_inicial .= " 00:00:00"; $query .= "data_fechamento>='{$data_inicial}'"; } if (empty($data_inicial) and !empty($data_final)) { if (strlen($query) > 34) { $query .= "AND "; } $data_final = substr(datam($data_final), 0, 10); $data_final .= " 23:59:59"; $query .= "data_fechamento<='{$data_final}'"; } } //########################################################################### if ($status == "Em aberto") { if (strlen($query) > 34) { $query .= "AND "; } $status = "Encerrada"; $query .= "status !=4 "; } else { if (strlen($query) > 34) { $query .= "AND "; }
//O SQL, em um primeiro momento, pesquisa por qualquer uma das palavras digitadas. $queryWhere = "\nWHERE ((" . $qrySolucao . ") OR (" . $qryAssentamento . ") OR (" . $qryDesc . ") )" . "\n AND (a.ocorrencia = s.numero AND o.numero = s.numero and o.operador = u.user_id "; if (isset($_POST['onlyImgs'])) { $queryWhere .= "\n and o.numero = i.img_oco "; } $queryWhere .= " ) "; $query .= $queryFrom . $queryWhere; if (isset($_POST['data_inicial']) && !empty($_POST['data_inicial'])) { // $data_inicial = str_replace("-","/",$_POST['data_inicial']); $data_inicial = datam($_POST['data_inicial']); //$query.="and o.data_abertura >='".$data_inicial."' and o.data_fechamento >= '".$data_inicial."' "; $query .= "and o.data_abertura >='" . $data_inicial . "' "; } if (isset($_POST['data_final']) && !empty($_POST['data_final'])) { //$data_final = str_replace("-","/",$_POST['data_final']); $data_final = datam($_POST['data_final']); //$query.="and o.data_abertura <='".$data_final."' and o.data_fechamento <= '".$data_final."' "; $query .= " and o.data_fechamento <= '" . $data_final . "' "; } if (!empty($_POST['operador']) and $_POST['operador'] != -1) { $query .= "and s.responsavel=" . $_POST['operador'] . " "; } $query .= "\nGROUP BY numero ORDER BY numero"; // Retorna todos os registros onde pelo menos um dos termos existe. $query2 = $query; $resultado = mysql_query($query) or die(TRANS('MSG_ERR_SEARCH_INFO_TABLE') . $query); $resultado2 = mysql_query($query2); $linhas = mysql_numrows($resultado); $qryChkOco = array(); $qryChkAss = array(); $qryChkSol = array();
// if ($_POST['comp_modem'] == -1) { $comp_modem = "null";} else $comp_modem = "'$comp_modem'"; // if ($_POST['comp_cdrom'] == -1) { $comp_cdrom = "null";} else $comp_cdrom = "'$comp_cdrom'"; // if ($_POST['comp_dvd'] == -1) { $comp_dvd = "null";} else $comp_dvd = "'$comp_dvd'"; // if ($_POST['comp_grav'] == -1) { $comp_grav = "null";} else $comp_grav = "'$comp_grav'"; // if ($_POST['comp_nome'] == -1) { $comp_nome = "null";} ;//else $comp_nome = "'$comp_nome'"; // if ($_POST['comp_nf'] == -1) { $comp_nf = "null";};// else $comp_nf = "'$comp_nf'"; // if ($_POST['comp_coment'] == -1) { $comp_coment = "null";};// else $comp_coment = "'$comp_coment'"; // if ($_POST['comp_ccusto'] == -1) { $comp_ccusto = "null";} else $comp_ccusto = "'$comp_ccusto'"; // if ($_POST['comp_tipo_imp'] == -1) { $comp_tipo_imp = "null";} else $comp_tipo_imp = "'$comp_tipo_imp'"; // if ($_POST['comp_resolucao'] == -1) { $comp_resolucao = "null";} else $comp_resolucao = "'$comp_resolucao'"; // if ($_POST['comp_polegada'] == -1) { $comp_polegada = "null";} else $comp_polegada = "'$comp_polegada'"; // if ($_POST['comp_fornecedor'] == -1) { $comp_fornecedor = "null";} else $comp_fornecedor = "'$comp_fornecedor'"; // // if ($_POST['comp_tipo_garant'] == -1) { $comp_tipo_garant = "null";} else $comp_tipo_garant = "'$comp_tipo_garant'"; // if ($_POST['comp_garant_meses'] == -1) { $comp_garant_meses = "null";} else $comp_garant_meses = "'$comp_garant_meses'"; $query = "INSERT INTO equipamentos " . "(comp_inv, comp_sn, comp_marca, comp_mb, comp_proc, comp_memo, comp_video, comp_som, " . "comp_rede, comp_modelohd, comp_modem, comp_cdrom, comp_dvd, comp_grav, comp_nome, " . "comp_local, comp_fornecedor, comp_nf, comp_coment, comp_data, comp_valor, comp_data_compra, " . "comp_inst, comp_ccusto, comp_tipo_equip, comp_tipo_imp, comp_resolucao, comp_polegada, " . "comp_fab, comp_situac, comp_tipo_garant, comp_garant_meses) " . "VALUES ('" . $_POST['comp_inv'] . "','" . noHtml($_POST['comp_sn']) . "','" . $_POST['comp_marca'] . "'," . "" . $_POST['comp_mb'] . ", " . $_POST['comp_proc'] . "," . $_POST['comp_memo'] . "," . $_POST['comp_video'] . "," . "" . $_POST['comp_som'] . ", " . $_POST['comp_rede'] . ", " . $_POST['comp_modelohd'] . ", " . "" . $_POST['comp_modem'] . ", " . $_POST['comp_cdrom'] . ", " . $_POST['comp_dvd'] . ", " . "" . $_POST['comp_grav'] . ",'" . noHtml($_POST['comp_nome']) . "', '" . $_POST['comp_local'] . "', " . "" . $_POST['comp_fornecedor'] . ",'" . noHtml($_POST['comp_nf']) . "','" . noHtml($_POST['comp_coment']) . "', " . "'" . date("Y-m-d H:i:s") . "', '" . $comp_valor . "', '" . datam($_POST['comp_data_compra']) . "', " . "'" . $_POST['comp_inst'] . "', " . $_POST['comp_ccusto'] . ", '" . $_POST['comp_tipo_equip'] . "', " . "" . $_POST['comp_tipo_imp'] . ", " . $_POST['comp_resolucao'] . ", " . $_POST['comp_polegada'] . ", " . "'" . $_POST['comp_fab'] . "', '" . $_POST['comp_situac'] . "', " . $_POST['comp_tipo_garant'] . ", " . "" . $_POST['comp_garant_meses'] . " " . ")"; $resultado = mysql_query($query) or die(TRANS('ERR_INSERT') . '<br>' . $query); if ($resultado == 0) { $aviso = TRANS('MSG_NOT_INCLUDE_DATA'); } else { $numero = mysql_insert_id(); $aviso = TRANS('MSG_OK_EQUIP_CAD_SUCESS'); $texto = "[Etiqueta = " . $_POST['comp_inv'] . "], [Unidade = " . $_POST['comp_inst'] . "]"; geraLog(LOG_PATH . 'invmon.txt', date("d-m-Y H:i:s"), $_SESSION['s_usuario'], $_SERVER['PHP_SELF'], $texto); } } print "<script>mensagem('" . $aviso . "'); " . "redirect('mostra_consulta_inv.php?comp_inv=" . $_POST['comp_inv'] . "&comp_inst=" . $_POST['comp_inst'] . "');" . "</script>"; } $cab->set_foot(); ?> <script type='text/javascript'>
if ($_POST['categoria'] != 3 and !$rowtesta['sis_atende']) { $aviso = TRANS('MSG_ATTEND_OPERATORS'); //"Usuários operadores não podem pertencer à áreas que não prestam atendimento!"; $erro = true; } } $qryins = "SELECT login FROM usuarios WHERE login = '******'login'] . "'"; $execins = mysql_query($qryins) or die(TRANS('ERR_QUERY') . $qryins); $regs = mysql_num_rows($execins); if ($regs > 0) { $aviso = TRANS('MSG_RECORD_EXISTS'); $erro = true; } if (!$erro) { $data_inc = datam($_POST['data_inc']); $data_admis = datam($_POST['data_admis']); /* if ($_POST['areaadmin']){ }*/ if (isset($_POST['areaadmin'])) { $areaadmin = $_POST['areaadmin']; } else { $areaadmin = 0; } $qryins = "INSERT INTO usuarios (login, nome, password, data_inc, data_admis, email, fone, nivel, AREA, user_admin) " . "values ('" . noHtml($_POST['login']) . "','" . noHtml($_POST['nome']) . "','" . $pass . "','" . $data_inc . "'" . ",'" . $data_admis . "','" . $_POST['email'] . "','" . $_POST['telefone'] . "', " . $_POST['categoria'] . ", " . $_POST['area'] . ", '" . $areaadmin . "')"; $execins = mysql_query($qryins) or die(TRANS('ERR_INSERT') . $qryins); $uid = mysql_insert_id(); $qrycountarea = "SELECT count(*) tAreas from sistemas"; $execcountarea = mysql_query($qrycountarea) or die(TRANS('ERR_QUERY') . $qrycountarea); $rowcountarea = mysql_fetch_array($execcountarea); for ($j = 0; $j < $rowcountarea['tAreas']; $j++) {
} else { if ($_POST['submit'] == TRANS('BT_CAD')) { $erro = false; if (!$erro) { $query = "INSERT INTO emprestimos (material, responsavel, data_empr, data_devol, quem, local, ramal) values" . " ('" . noHtml($_POST['material']) . "', '" . $_SESSION['s_uid'] . "','" . datam($_POST['saida']) . "','" . datam($_POST['volta']) . "'," . "'" . $_POST['quem'] . "', '" . $_POST['local'] . "', '" . $_POST['ramal'] . "')"; $resultado = mysql_query($query) or die(TRANS('ERR_QUERY') . '<br>' . $query); if ($resultado == 0) { $aviso = "" . TRANS('ERR_INSERT') . "<br>" . $query; } else { $aviso = TRANS('OK_INSERT'); } } echo "<script>mensagem('" . $aviso . "'); redirect('" . $_SERVER['PHP_SELF'] . "');</script>"; } else { if ($_POST['submit'] == TRANS('BT_ALTER')) { $query2 = "UPDATE emprestimos SET material='" . noHtml($_POST['material']) . "', responsavel='" . noHtml($_POST['responsavel']) . "', " . "ramal = '" . $_POST['ramal'] . "', local = " . $_POST['local'] . ", data_empr='" . datam($_POST['saida']) . "', data_devol='" . datam($_POST['volta']) . "', " . "quem='" . $_POST['quem'] . "' WHERE empr_id='" . $_POST['cod'] . "'"; $resultado2 = mysql_query($query2); if ($resultado2 == 0) { $aviso = TRANS('ERR_EDIT'); } else { $aviso = TRANS('OK_EDIT'); } echo "<script>mensagem('" . $aviso . "'); redirect('" . $_SERVER['PHP_SELF'] . "');</script>"; } } } } } } print "</table>"; print "</form>";
$query .= "AND "; } $query .= "operador='{$operador}' "; } if (!empty($data_inicial) and !empty($data_final)) { if (strlen($query) > 34) { $query .= "AND "; } $data_inicial = datam($data_inicial); $data_final = datam($data_final); $query .= "data_abertura>='{$data_inicial}' AND data_abertura<='{$data_final}'"; } elseif (!empty($data_inicial) and empty($data_final)) { if (strlen($query) > 34) { $query .= "AND "; } $data_inicial = datam($data_inicial); $query .= "data_abertura>='{$data_inicial}' AND data_abertura<='{$data_inicial}'"; } if ($status == "Em aberto") { if (strlen($query) > 34) { $query .= "AND "; } // $status = "Encerrada"; $status = "4"; $query .= "status !='{$status}' "; } else { if (strlen($query) > 34) { $query .= "AND "; } $query .= "status='{$status}' "; }
print TD_COLOR; ?> > <TR> <TD align="center" width="100%" bgcolor=<?php print BODY_COLOR; ?> ><a href=abertura.php>Voltar</a></TD> </TR> </TABLE> <?php if ($rodou == "sim") { $erro = "não"; if ($erro == "não") { $data = datam($hoje); $query = "UPDATE materiais SET mat_nome='{$mat_nome}', mat_qtd='{$mat_qtd}', mat_caixa='{$mat_caixa}', mat_obs='{$mat_obs}' WHERE (mat_cod='{$mat_cod}')"; $resultado = mysql_query($query); if ($resultado == 0) { $aviso = "Um erro ocorreu ao tentar alterar o Registro."; } else { $aviso = "Registro Alterado com sucesso no sistema."; } } $origem = "abertura.php"; session_register("aviso"); session_register("origem"); echo "<META HTTP-EQUIV=REFRESH CONTENT=\"0;URL=mensagem.php\">"; } ?>
$VARS['%descricao%'] = $rowfull['descricao']; $VARS['%setor%'] = $rowfull['setor']; $VARS['%ramal%'] = $rowfull['telefone']; //$VARS['%assentamento%'] = $_POST['assentamento']; $VARS['%site%'] = $_SESSION['s_ocomon_site']; $VARS['%area%'] = $rowfull['area']; $VARS['%operador%'] = $rowfull['nome']; //$VARS['%editor%'] = $rowMailLogado['nome']; $VARS['%aberto_por%'] = $rowfull['aberto_por']; $VARS['%problema%'] = $rowfull['problema']; $VARS['%versao%'] = VERSAO; $VARS['%url%'] = $_SESSION['s_ocomon_site'] . "ocomon/geral/mostra_consulta.php?numero=" . $_POST['numero'] . "&id=" . $rowID['gt_id']; $VARS['%patrimonio%'] = $rowfull['unidade'] . " " . $rowfull['etiqueta']; $VARS['%data_abertura%'] = datam($rowfull['data_abertura']); $VARS['%status%'] = $rowfull['chamado_status']; $VARS['%data_agendamento%'] = datam($rowfull['data_abertura']); $bodyTranslated = ""; $subjectTranslated = ""; $subjectTranslated = noHtml(transvars($_POST['field_subject'], $VARS)); $bodyTranslated = noHtml(transvars($_POST['field_body'], $VARS)); $qryMailArea = "SELECT u.nome, s.sistema, s.sis_email as replyto FROM usuarios u, sistemas s " . "WHERE u.user_id='" . $_SESSION['s_uid'] . "' and s.sis_id = u.AREA"; $execMailArea = mysql_query($qryMailArea); $rowMailArea = mysql_fetch_array($execMailArea); $qryconfmail = "SELECT * FROM mailconfig"; $execconfmail = mysql_query($qryconfmail) or die(TRANS('ERR_QUERY')); $rowconfmail = mysql_fetch_array($execconfmail); $msg = ""; for ($i = 1; $i <= $_POST['totalLists']; $i++) { if (isset($_POST["check_mlist" . $i])) { $qryFindList = "SELECT * FROM mail_list WHERE ml_cod = " . $_POST["check_mlist" . $i] . ""; $execFindList = mysql_query($qryFindList);
*/ session_start(); include "../../includes/include_geral.inc.php"; include "../../includes/include_geral_II.inc.php"; $cab = new headers(); $cab->set_title(TRANS('TTL_INVMON')); $auth = new auth(); $auth->testa_user($_SESSION['s_usuario'], $_SESSION['s_nivel'], $_SESSION['s_nivel_desc'], 2); $hoje = date("Y-m-d H:i:s"); $clausula = ""; $msgData = ""; if (!empty($dInicio) and !empty($dFinal)) { $min = $dInicio; $max = $dFinal; $dInicio = substr(datam($dInicio), 0, 10); $dFinal = substr(datam($dFinal), 0, 10); $clausula = "and h.hist_data between '" . $dInicio . "' and '" . $dFinal . "'"; $msgData = "" . TRANS('TXT_IN_PERIOD_THIS') . " " . $min . " e " . $max . ""; } if (isset($_POST['comp_local']) && $_POST['comp_local'] != -1) { $clausula .= " and h.hist_local = " . $_POST['comp_local'] . ""; $setorOk = true; } else { $setorOK = false; } if (!empty($_POST['comp_local'])) { $query = "SELECT c.comp_inv AS etiqueta, c.comp_inst AS instituicao, c.comp_local AS tipo_local,\n \t\t\ti.inst_nome AS instituicao_nome, c.comp_tipo_equip AS tipo, t.tipo_nome AS equipamento,\n\t\t\tl.local AS locais, l.loc_id as local_cod, m.marc_nome as modelo, m.marc_cod as tipo_marca, f.fab_nome as fabricante,\n\t\t\tf.fab_cod as tipo_fab, s.situac_cod as situac_cod,\n\t\t\th.hist_data AS DATA , extract(DAY FROM hist_data ) AS DIA,\n\t\t\textract(MONTH FROM hist_data ) AS MES, extract( year FROM hist_data ) AS ANO\n\t\t\tFROM equipamentos AS c, instituicao AS i, localizacao AS l, historico AS h,\n\t\t\ttipo_equip AS t, marcas_comp as m, fabricantes as f, situacao as s\n\n\t\t\tWHERE\n\t\t\t c.comp_inv = h.hist_inv AND c.comp_inst = h.hist_inst AND c.comp_fab = f.fab_cod and\n\t\t\th.hist_local = l.loc_id AND h.hist_inv = c.comp_inv AND i.inst_cod = h.hist_inst AND\n\t\t\t c.comp_tipo_equip = t.tipo_cod AND m.marc_cod = c.comp_marca and c.comp_situac = s.situac_cod\n\t\t\t"; $equip = ''; if (isset($_POST['comp_tipo_equip']) && $_POST['comp_tipo_equip'] != -1 && $_POST['comp_tipo_equip'] != '') { $query .= " and t.tipo_cod = " . $_POST['comp_tipo_equip'] . ""; } else {
} print "<TD " . $valign . "><a onClick=\"javascript:popup('mostra_hist_status.php?popup=true&numero=" . $row['numero'] . "')\">" . $row['chamado_status'] . "</a></TD>"; print "<TD " . $valign . " align='center'><a onClick=\"javascript:popup('../../includes/help/sla_popup.php?sla=r')\"><img height='14' width='14' src='../../includes/imgs/imgs/" . $imgSlaR . "'></a></TD>"; print "<TD " . $valign . " align='center'><a onClick=\"javascript:popup('../../includes/help/sla_popup.php?sla=s')\"><img height='14' width='14' src='../../includes/imgs/" . $imgSlaS . "'></a></TD>"; print "</TR>"; } //while } else { if (isset($_POST['saida']) && $_POST['saida'] == 2) { //Show detailed output while ($row = mysql_fetch_array($resultado)) { print "<tr><td><b>TRANS('OCO_FIELD_NUMBER');:</b></td><td>" . $row['numero'] . "</td><td><b>" . TRANS('OCO_AREA') . ":</b></td><td>" . $row['area'] . "</td><td><b>" . TRANS('OCO_FIELD_PROB') . ":</b></td><td>" . $row['problema'] . "</td></tr>"; print "<tr><td><b>" . TRANS('OCO_DESC') . ":</b></td><td colspan='5'>" . nl2br($row['descricao']) . "</td></tr>"; print "<tr><td><b>" . TRANS('OCO_FIELD_UNIT') . ":</b></td><td>" . $row['unidade'] . "</td><td><b>" . TRANS('OCO_FIELD_TAG') . ":</b></td><td colspan='3'>" . $row['etiqueta'] . "</td></tr>"; print "<tr><td><b>" . TRANS('OCO_FIELD_LOCAL') . ":</b></td><td>" . $row['setor'] . "</td><td><b>" . TRANS('OCO_FIELD_CONTACT') . ":</b></td><td>" . $row['contato'] . "</td><td><b>" . TRANS('OCO_FIELD_PHONE') . ":</b></td><td>" . $row['telefone'] . "</td></tr>"; print "<tr><td><b>" . TRANS('OCO_FIELD_DATE_OPEN') . ":</b></td><td>" . $row['data_abertura'] . "</td><td><b>" . TRANS('FIELD_DATE_CLOSING') . ":</b></td><td colspan='3'>" . $row['data_fechamento'] . "</td></tr>"; print "<tr><td colspan='6'><b><u>" . TRANS('FIELD_NESTING') . "s</u>:</b></td></tr>"; $sql = "SELECT * FROM assentamentos a, usuarios u where a.ocorrencia = " . $row['numero'] . " AND u.user_id = a.responsavel"; $exec = mysql_query($sql); while ($rowA = mysql_fetch_array($exec)) { print "<tr><td><b>Por " . $rowA['nome'] . "</b> em " . datam($rowA['data']) . ":</td><td colspan='5'>" . $rowA['assentamento'] . "</td></tr>"; } print "<tr><td><b>" . TRANS('FIELD_STATUS_NOW') . ":</b></td><td colspan='6'><b>" . $row['chamado_status'] . "</td></tr>"; print "<tr><td colspan='6'><hr /></td></tr>"; } } } print "</TABLE>"; } print "</body>"; print "</html>";