Viewing File: /home/cienp/public_html/portal/res_patr.php
<?php
if ($_POST[passa] == 'yes') {
require "$this->include_dir/conecta.php";
$s_id_patr = protecao($_POST[v_id_patr],'inteiro');
$s_id_marc = protecao($_POST[v_id_marc],'inteiro');
$s_id_forn = protecao($_POST[v_id_forn],'inteiro');
$s_nm_equp = protecao($_POST[v_nm_equp]);
$s_fl_atvo = protecao($_POST[v_fl_atvo]);
if ($s_id_patr != "")
$selpatr = "AND m.id_patr = '$s_id_patr'";
if ($s_id_marc != "")
$selmarc = "AND m.id_marc = '$s_id_marc'";
if ($s_id_forn != "")
$selforn = "AND f.id_forn = '$s_id_forn'";
if ($s_nm_equp != "")
$selequp = "AND p.nm_equp LIKE '%$s_nm_equp%'";
if ($_POST[v_fl_atvo] != "")
$selatvo = "AND p.fl_atvo = '$s_fl_atvo'";
$sql = "SELECT p.id_patr, p.nm_equp, p.vl_patr, p.fl_atvo, m.id_marc, m.de_marc, f.id_forn, f.nm_forn, r.id_recs, r.de_recs, s.id_labt, s.nm_labt ";
$sql .= "FROM ".$pref_tabl."patr p, ".$pref_tabl."patr_marc m, ".$pref_tabl."forn f, ".$pref_tabl."recs r, ".$pref_tabl."labt s ";
$sql .= "WHERE m.id_marc = p.id_marc ";
$sql .= "AND f.id_forn = p.id_forn ";
$sql .= "AND r.id_recs = p.id_recs ";
$sql .= "AND s.id_labt = p.id_setr ";
$sql .= "AND p.id_patr = p.id_patr ";
$sql .= "$selmarc $selforn $selequp $selatvo ";
$sql .= "ORDER BY p.nm_equp ";
$res = mysqli_query($conn, $sql);
if (mysqli_num_rows($res) > 0){
?>
<div class="right_col" role="main">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Resultado da Busca de Patrimônio<small>Gerenciador de Patrimônio</small></h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<table id="datatable" class="table table-striped table-bordered">
<thead>
<tr>
<th>Número</th>
<th>Equipamento</th>
<th>Marca</th>
<th>Fornecedor</th>
<th>Local de Instalação</th>
<th>Recurso</th>
<th>Valor</th>
<th width="10%" class="text-center">Ativo</th>
<th width="10%" class="text-center">Alterar</th>
</tr>
</thead>
<tbody>
<?php
$cont = 1;
while ($linha = mysqli_fetch_array($res)){
unset($fundo);
if (($cont % 2) == 0)
$fundo = 'class="dif"';
$cont++;
$totl++;
switch($linha[fl_atvo]) {
case 'S':
$fl_atvo = '<i class="fa fa-check" aria-hidden="true" style="color:#26B99A;"></i>';
break;
case 'N':
$fl_atvo = '<i class="fa fa-close" aria-hidden="true" style="color:#d9534f;"></i>';
break;
}
?>
<tr>
<td>
<a href="javascript:alt_patr('<?php echo $linha['id_patr'] ?>')">
<?php echo str_pad($linha[id_patr], 5, "0", STR_PAD_LEFT);?>
</a>
</td>
<td>
<a href="javascript:alt_patr('<?php echo $linha['id_patr'] ?>')">
<?php echo $linha['nm_equp'] ?>
</a>
</td>
<td>
<?php echo $linha['de_marc'] ?>
</td>
<td>
<?php echo $linha['nm_forn'] ?>
</td>
<td>
<?php echo $linha['nm_labt'] ?>
</td>
<td>
<?php echo $linha['de_recs'] ?>
</td>
<td class="text-center">
R$ <?php echo moeda ($linha['vl_patr']) ?>
</td>
<td class="text-center">
<?=$fl_atvo?>
</td>
<td class="text-center">
<a href="javascript:alt_patr('<?php echo $linha['id_patr'] ?>')" class="btn btn-info btn-xs">
<i class="fa fa-pencil" aria-hidden="true"></i> Alterar
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="form-group">
<div class="col-md-6 col-sm-6 col-xs-12" style="padding:0px; margin-bottom:10px;">
<a href="javascript:voltar();"><button class="btn btn-primary" type="button">Voltar</button></a>
</div>
</div>
</div>
</div>
</div>
<?php
} else {
?>
<div class="right_col" role="main">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Resultado da Busca de Patrimônio<small>Gerenciador de Patrimônio</small></h2>
<div class="clearfix"></div>
</div>
<div class='alert alert-danger alert-dismissible fade in' role='alert' style='margin-top:30px;'>
<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button>
<strong>Alerta!</strong> Nenhum patrimônio com estas caracteristicas foi encontrado!
</div>
<div class="form-group">
<div class="col-md-6 col-sm-6 col-xs-12" style="padding:0px; margin-bottom:10px;">
<a href="javascript:voltar();"><button class="btn btn-primary" type="button">Voltar</button></a>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
<SCRIPT LANGUAGE="javascript">
function alt_patr(xb){
document.acidente.action = "index1.php?pg=alt_patr";
document.acidente.id_patr.value = xb;
document.acidente.submit();
}
function voltar(){
document.acidente.action = "index1.php?pg=pesq_patr";
document.acidente.submit();
}
</script>
<form name="acidente" method="post" action="" style="margin:0px !important;">
<input type="hidden" name="id_patr">
<input type="hidden" name="v_id_marc" id="v_id_marc" value="<?=$_POST[v_id_marc]?>">
<input type="hidden" name="v_id_forn" id="v_id_forn" value="<?=$_POST[v_id_forn]?>">
<input type="hidden" name="v_nm_equp" id="v_nm_equp" value="<?=$_POST[v_nm_equp]?>">
<input type="hidden" name="v_fl_atvo" id="v_fl_atvo" value="<?=$_POST[v_fl_atvo]?>">
<input type="hidden" name="passa" id="passa" value="yes">
</form>
<?php
} else {
require "erro.php";
}
?>
Back to Directory
File Manager