Guest User

Untitled

a guest
Jan 10th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.39 KB | None | 0 0
  1. <?php
  2. require('../dao/conexao.php');
  3. ?>
  4. <!DOCTYPE html>
  5. <html>
  6.     <head>
  7.         <title>.:Lista de Cliente:.</title>
  8.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10.         <link href="http://localhost/a.swebnet/geral/css/bootstrap-responsive.css" rel="stylesheet">
  11.         <link href="http://localhost/a.swebnet/geral/css/bootstrap.css" rel="stylesheet" media="screen">
  12.         <script src="http://code.jquery.com/jquery.js"></script>
  13.         <script src="http://localhost/a.swebnet/geral/js/bootstrap.min.js"></script>
  14.  
  15.     </head>
  16.     <body>
  17.         <ul class="breadcrumb">
  18.             <li><a href="http://localhost/a.swebnet/home.php?p=3">Voltar</a> <span class="divider">/</span></li>
  19.             <li class="active">Relatorio Clientes </li>
  20.         </ul>
  21.         <div class="well bs-component">
  22.             <!-- PESQUISAR -->
  23.             <form  class="form-search" id="form1" name="form1" method="post" action="#">                    
  24.                 <input type="text" name="busca" id="cadastronome" />&nbsp&nbsp &nbsp &nbsp                    
  25.                 <input type="text" name="cl_endereco"  id="cadastroendereco"/>&nbsp&nbsp&nbsp                    
  26.                 <input type="submit" class="btn" name="acao" id="button" value="Buscar" />      
  27.                 <input type="submit" class="btn" name="acao" maxlength="255" value="Limpar"/>
  28.  
  29.                 <div id="todo">
  30.                     <?php
  31.                     if (isset($_POST['acao']) && $_POST['acao'] == 'busca') {
  32.                         $pesquisa = $_POST['busca'];
  33.                         $cl_endereco = $_POST ['cl_endereco'];
  34.                         $sql = mysql_query("SELECT * FROM cliente WHERE cl_nome like '%$pesquisa%' and cl_endereco like '%$cl_endereco%' ");
  35.                         //Mostrando todos os campos encontrados
  36.                         while ($ress = mysql_fetch_assoc($sql)) {
  37.                             $cl_nome = $ress['cl_nome'];
  38.                             $cl_endereco = $ress['cl_endereco'];
  39.                             echo "<td>" . $cl_nome . "</td>";
  40.                             echo "<td>" . $cl_endereco . "</td>";
  41.                             ?>  
  42.                         <?php
  43.                         }
  44.                     }
  45.                     ?>
  46.                 </div>  
  47.             </form>
  48.             <!-- END PESQUISAR -->
  49.  
  50.             <!-- TRATAMENTO USUARIO -->
  51.             <table class="table table-bordered" id="table_cadastro">
  52.                 <thead>
  53.                     <tr>
  54.                         <th>Ação</th>
  55.                         <th>Nome</th>
  56.                         <th>Usuário</th>
  57.                         <th>CPF</th>
  58.                         <th>Endereço</th>
  59.                         <th>N°</th>
  60.                         <th>Entrada</th>
  61.                         <th>Equipamento</th>
  62.                         <th>Mac</th>
  63.                         <th>Plano</th>
  64.                         <th>Valor</th>
  65.                         <th>Observação</th>
  66.                         <th></th>
  67.                     </tr>
  68.                 </thead>
  69.                 <tbody>
  70.                     <!-- MONSTRANDO DADOS -->
  71.                     <?php
  72.                     $query = mysql_query("SELECT id, cl_nome,cl_obs,cl_cpf, cl_endereco,cl_numero,cl_data,cl_eqpto,cl_mac,cl_plano,cl_usuario,cl_mensalidade,cl_status FROM cliente ORDER BY cl_nome ASC");
  73.  
  74.                     $TotalReceber = 0;
  75.                     $FaltaReceber = 0;
  76.                     while ($prod = mysql_fetch_array($query)) {
  77.                         echo '<tr>';
  78.  
  79.                         echo '<td><a href="javascript:abrir(\'../controller/crud/editar.php?id=' . $prod['id'] . '\');"><i class="icon-edit"></i></a>';
  80.                         echo '&nbsp;&nbsp';
  81.                         echo '<a href="../controller/crud/deletar.php?id=' . $prod['id'] . '"><i class="icon-remove"></i></a></td>';
  82.                         echo "<td>" . $prod['cl_nome'] . "</td>";
  83.                         echo "<td>" . $prod['cl_usuario'] . "</td>";
  84.                         echo "<td>" . $prod['cl_cpf'] . "</td>";
  85.                         echo "<td>" . $prod['cl_endereco'] . "</td>";
  86.                         echo "<td>" . $prod['cl_numero'] . "</td>";
  87.                         echo "<td>" . $prod['cl_data'] . "</td>";
  88.                         echo "<td>" . $prod['cl_eqpto'] . "</td>";
  89.                         echo "<td>" . $prod['cl_mac'] . "</td>";
  90.                         echo "<td>" . $prod['cl_plano'] . "</td>";
  91.                         // Incluir R$ no campo [VALOR] se o mesmo não for vazio.
  92.                         $prod['Valor'] = (!empty($prod['cl_mensalidade'])) ? 'R$ ' . $prod['cl_mensalidade'] : $prod['cl_mensalidade'];
  93.                         echo "<td>" . $prod['Valor'] . "</td>";
  94.                         echo "<td>" . $prod['cl_obs'] . "</td>";
  95.                         echo "<td>" . '<li class="andamento"> <img width="15" id="noneon" src="../geral/img/' . $prod['cl_status'] . '.png" title="' . $prod['cl_status'] . '"/></li>' . "</td>";
  96.  
  97.                         echo '</tr>';
  98.                         ?>
  99.                         <?php
  100.                         if (!empty($prod['cl_mensalidade']) and ( $prod['cl_status'] !== 'Ativo')) {
  101.                             $FaltaReceber = $FaltaReceber + $prod['cl_mensalidade'];
  102.                         }
  103.                         $TotalReceber = $TotalReceber + $prod['cl_mensalidade'];
  104.                     }
  105.                     ?>
  106.  
  107.                 </tbody>
  108.             </table>
  109.             <span class="label label-important">FALTA RECEBER: <?php echo toReal($FaltaReceber); ?> </span></br></br>
  110.             <span class="label label-info">TOTAL RECEBER: <?php echo toReal($TotalReceber); ?></span>
  111.  
  112.         </div>
  113.         <style>
  114.             td{list-style:none;}
  115.         </style>
  116.  
  117.         <script language="JavaScript">
  118.             function abrir(URL) {
  119.                 var width = 800;
  120.                 var height = 750;
  121.                 var left = 99;
  122.                 var top = 99;
  123.                 window.open(URL, 'janela', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
  124.  
  125.             }
  126.         </script>
  127.  
  128.     </body>
  129. </html>
Advertisement
Add Comment
Please, Sign In to add comment