Esempio n. 1
0
           <div class="title-box" style="float:left"><div style="float:left"><img src="../images/search-icon.png" width="35px"></div><div style="float:left; margin-top:10px; margin-left:10px;"><span class="title">Pesquisar Patrimonio</span></div></div>                                                                
                 <form method="POST" class="pesquisa-campos" id="pesquisa-campos" name="pesquisa-campos" action="pesquisa_patrimonio.php">
                    <table id="table-search">
                      <tr>
                         <td><span >Patrimonio: </span></td>
                         <td><input type="text" id="name_search" name="name_search" title="Digite qual patrimobio deseja procurar..." placeholder="Deixe em branco para pesquisar todos"></td>
                         <td><input type="submit" value="Buscar" class="button"></td>
                      </tr>
                   </table>
                 </form>
          <?php 
if (isset($_POST['name_search'])) {
    $patrimonio = new Patrimonio();
    $patrimonios = $patrimonio->get_all_patrimonio($_POST['name_search'], $_SESSION['id_empresa']);
    if ($_POST['name_search'] == "") {
        $patrimonios = $patrimonio->get_all();
    }
    $patrimonios_geral = new Patrimonio_geral();
    $geral = $patrimonios_geral->get_patrimonio_geral_nome($_POST['name_search']);
    $aux = 0;
    echo '<table class="exibe-pesquisa">';
    if (count($geral) > 0) {
        foreach ($geral as $key => $patrimonio_geral) {
            echo '<tr> 
                                           <td><a href="pesquisa_patrimonio.php?verificador=1&id=' . $geral[$key][0] . '&controle=' . $geral[$key][3] . '">' . $geral[$key][4] . " " . $geral[$key][1] . " " . $geral[$key][2] . '</a></td></tr>';
        }
        $aux = $aux + 1;
    }
    if (count($patrimonios) > 0) {
        foreach ($patrimonios as $key => $patrimonio) {
            echo '<tr>