<?php require_once('../topo.php');?>
<?php require_once('../lateral.php');?>
<br><br><br>
<?php
$busca = $_GET['busca'];
	$cor_fundo = "#FFFFFF";	
if(empty($busca)){
	$seleciona = Seleciona("maodeobra", "", "");
}else{
	$seleciona = Seleciona("maodeobra", "WHERE nome LIKE '%".$busca."%'", "");
}
$Total = mysql_num_rows($seleciona);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="50" colspan="4" align="left" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="273" height="40" class="TituloPagina" style="padding-left: 5px;">TERCEIRIZADOS</td>
        <td width="594" align="left" class="TituloPagina" style="padding-left: 5px;"><table width="100" border="0" align="center" cellpadding="2" cellspacing="0">
          <tr>
            <td width="167" align="left"><table width="200" border="0" cellspacing="0" cellpadding="2" class="BoxMenuCinzaEscuro" onclick="location.href='listar_maodeobra.php';">
              <tr>
                <td height="25" align="center" class="TextoMenuCinza"><img src="img/icone_novo.gif" width="29" height="21" /></td>
                <td align="left" class="TextoMenuBranco" style="font-weight:normal;">Todos os Terceirizados</td>
                </tr>
              </table></td>
            <td width="150" align="left"><table width="160" border="0" cellspacing="0" cellpadding="2" class="BoxMenuCinzaEscuro" onclick="location.href='manutencao_maodeobra.php';">
              <tr>
                <td height="25" align="center" class="TextoMenuCinza"><img src="img/icone_novo.gif" width="29" height="21" /></td>
                <td align="left" class="TextoMenuBranco" style="font-weight:normal;">Novo Terceirizado</td>
                </tr>
              </table></td>
            <td width="125" align="left">&nbsp;</td>
            <td width="370" align="right"><table width="180" border="0" align="right" cellpadding="0" cellspacing="0" class="BoxMenuBranco">
              <form method="get" action="index.php" enctype="multipart/form-data">
              <input type="hidden" name="pagina" value="listar_maodeobra.php"> 
                <tr>
                  <td width="148" align="left" bgcolor="#FFFFFF"><input type="text" name="busca" id="busca" style="width: 100%; height: 20px;" class="InputBranco" /></td>
                  <td width="28" align="center" bgcolor="#FFFFFF"><input type="image" src="img/icone_buscar.gif" /></td>
                  </tr>
                </form>
              </table></td>
            </tr>
          </table></td>
        <td width="229" align="right">&nbsp;</td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="4" align="center" valign="top">
     <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" id="tabela_padrao" class="display">
      <thead>
       <tr class="TextoPretoPequeno">
        <td width="20%" height="30" bgcolor="#A6A6A6" class="TextoPretoPequeno"><strong>NOME</strong></td>
        <td width="20%" align="left" bgcolor="#A6A6A6" class="TextoPretoPequeno"><strong>TELEFONE</strong></td>
        <td width="20%" align="left" bgcolor="#A6A6A6" class="TextoPretoPequeno"><strong>CELULAR</strong></td>
        <td width="20%" align="left" bgcolor="#A6A6A6" class="TextoPretoPequeno"><strong>E-MAIL</strong></td>
        <td width="15%" align="left" bgcolor="#A6A6A6" class="TextoPretoPequeno"><strong>CARGO</strong></td>
        <td width="5%" align="center" bgcolor="#A6A6A6">&nbsp;</td>
        </tr>
        </thead>
        <tbody>
        <?php
			$cor_fundo = "#FFFFFF";		
			while($linha=mysql_fetch_array($seleciona)){
				$cargo = $linha['cargo'];
			
			$seleciona_cargo = Seleciona("cargos", "WHERE idcargo='$cargo'", "");
			while($linha_cargo=mysql_fetch_array($seleciona_cargo)){
				$nome_cargo = $linha_cargo['nome'];	
			}
			if($cor_fundo == "#FFFFFF"){
				$cor_fundo = "#E4E4E4";
			}else{
				$cor_fundo = "#FFFFFF";
			}
		?>
        <tr class="TextoCinzaPequeno" bgcolor="<?php echo $cor_fundo;?>" onmouseover="javascript:this.style.backgroundColor='#CCCCCC'" onmouseout="javascript:this.style.backgroundColor=''" style="cursor:pointer;" onclick="location.href='manutencao_maodeobra.php?idmaodeobra=<?php echo $linha['idmaodeobra'];?>';">
          <td width="20%" height="30" bgcolor="<?php echo $cor_fundo;?>"><strong><?php echo $linha['nome'];?></strong></td>
          <td width="20%" align="left" bgcolor="<?php echo $cor_fundo;?>"><?php echo $linha['telefone'];?></td>
          <td width="20%" align="left" bgcolor="<?php echo $cor_fundo;?>"><?php echo $linha['celular'];?></td>
          <td width="20%" align="left" bgcolor="<?php echo $cor_fundo;?>"><?php echo $linha['email'];?></td>
          <td width="15%" align="left" bgcolor="<?php echo $cor_fundo;?>"><?php echo $nome_cargo;?></td>
          <td width="5%" align="right" bgcolor="<?php echo $cor_fundo;?>"><img src="img/icone_detalhe.gif" width="22" height="24" border="0" /></td>
          </tr>
        <?php }?>
        </tbody>
        </table>
    </td>
  </tr>
</table>
<?php require_once('../rodape.php');?>