Viewing File: /home/cienp/public_html/portal/impr_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_id_setr = protecao($_POST[v_id_setr],'inteiro');
    $s_nm_equp = protecao($_POST[v_nm_equp]);
    $s_fl_atvo = protecao($_POST[v_fl_atvo]);

    if ($s_id_patr != "")
        $selpatr = "AND p.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_id_setr != "")
        $selsetr = "AND p.id_setr = '$s_id_setr'";

    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.id_colb_inst, p.id_colb_test, p.vl_patr, c.nm_colb, p.nm_equp, 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."colb c, ".$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 c.id_colb = p.id_colb_inst ";
    $sql .= "AND p.id_patr = p.id_patr ";
    $sql .= "$selpatr $selmarc $selforn $selsetr $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>Relatório Geral de Patrimônio <small>Gerenciador de Relatório Geral de Patrimônio</small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                        <li>
                            <button class="btn btn-default" onclick="window.print();"><i class="fa fa-print"></i> Imprimir</button>
                        </li>
                        <li>
                            <a href="javascript:voltar();" style="padding:0px;"><button class="btn btn-primary" type="button">Voltar</button></a>
                        </li>
                    </ul>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content">
                    <table class="table table-striped jambo_table bulk_action">
                        <thead>
                            <tr>
                                <th>Número</th>
                                <th>Marca</th>
                                <th>Fornecedor</th>
                                <th>Equipamento</th>
                                <th>Local de Instalação</th>
                                <th>Recurso</th>
                                <th>Valor</th>
                                <th>Responsável Inst.</th>
                                <th>Responsável teste</th>
                            </tr>
                        </thead>
                        <tbody>
<?php
                        $cont = 1;
                        while ($linha = mysqli_fetch_array($res)){
                            unset($fundo);
                            if (($cont % 2) == 0)
                                $fundo = 'class="dif"';
                            $cont++;
                            $totl++;

                            $vl_totl = $linha['vl_patr'] + $vl_totl;

?>
                            <tr>
                                <td>
                                    <?php echo str_pad($linha[id_patr], 5, "0", STR_PAD_LEFT);?>
                                </td>
                                <td>
                                    <?php echo $linha['de_marc'] ?>
                                </td>
                                <td>
                                    <?php echo $linha['nm_forn'] ?>
                                </td>
                                <td>
                                    <?php echo $linha['nm_equp'] ?>
                                </td>
                                <td>
                                    <?php echo $linha['nm_labt'] ?>
                                </td>
                                <td>
                                    <?php echo $linha['de_recs'] ?>
                                </td>
                                <td>
                                    R$ <?php echo moeda ($linha['vl_patr']) ?>
                                </td>
                                <td>
                                    <?php echo $linha['nm_colb'] ?>
                                </td>
                                <td>
                                    <?php echo $linha['nm_colb'] ?>
                                </td>
                            </tr>
<?php
    }
?>
                        </tbody>
                        <thead>
                            <tr>
                                <th colspan="6">Valor Total</th>
                                <th>R$ <?php echo moeda ($vl_totl) ?></th>
                                <th colspan="2"></th>
                            </tr>
                        </thead>
                    </table>
                </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>Relatório Geral de Patrimônio<small>Gerenciador de Relatório Geral 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 relatório de 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 voltar(){
        document.acidente.action = "index1.php?pg=relt_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="opc">
  <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="passa" id="passa" value="yes">
</form>
<?php
    } else {
        require "erro.php";
    }
?>
Back to Directory File Manager