<?php
error_reporting(0);
ini_set("display_errors", 0 );
header('Content-Type: text/html; charset=utf-8');
include("configuracao.php");//confirma no banco de dados
include("inclusos/funcoes.php");
include("seguranca.php"); // Inclui o arquivo com o sistema de seguran?a
protegePagina(); // Protege a página

//RECEBE PÁGINA
$recebepagina	= $_GET['pagina'];
$pagina			= RecebePagina($recebepagina);
?>
<!doctype html>
<html ng-app="myApp">
<head>
<title>MAX LAYOUTS</title>

<link rel="stylesheet" href="inclusos/styles.css">
<link href="inclusos/css_precopratico.css" rel="stylesheet" type="text/css">

<script src="https://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>

<script src="inclusos/script.js"></script>
</head>
<body>


<?php
$idobra = $_GET['idobra'];	  
$SelecionaObra = Seleciona("obras", "WHERE idobra='$idobra'", "LIMIT 0,1");
while($linha_obras = mysql_fetch_array($SelecionaObra)){

$idobra = $linha_obras['idobra']; 
$idcliente = $linha_obras['idcliente']; 
$idorcamento = $linha_obras['idorcamento']; 
$idvenda = $linha_obras['idvenda']; 
$titulo = $linha_obras['titulo']; 
$observacao = $linha_obras['observacao']; 
$valorprojeto = $linha_obras['valorprojeto']; 
$valormaximo = $linha_obras['valormaximo']; 
$lucro = $linha_obras['lucro']; 
$datainicio = $linha_obras['datainicio']; 
$datafim = $linha_obras['datafim']; 
$status = $linha_obras['status']; 
$idprofissional = $linha_obras['idprofissional']; 
$segunda = $linha_obras['segunda']; 
$terca = $linha_obras['terca']; 
$quarta = $linha_obras['quarta']; 
$quinta = $linha_obras['quinta']; 
$sexta = $linha_obras['sexta']; 
$sabado = $linha_obras['sabado']; 
$domingo = $linha_obras['domingo']; 
$horario_obra = $linha_obras['horario_obra']; 
$itens_obrigatorios = $linha_obras['itens_obrigatorios']; 
$local_obra = $linha_obras['local_obra']; 
$engenheiro_responsavel = $linha_obras['engenheiro_responsavel']; 
$arquiteto_responsavel = $linha_obras['arquiteto_responsavel']; 
$cordenador1 = $linha_obras['cordenador1']; 
$cordenador2 = $linha_obras['cordenador2']; 
$supervisor1 = $linha_obras['supervisor1']; 
$supervisor2 = $linha_obras['supervisor2']; 
$tecnicoseguranca = $linha_obras['tecnicoseguranca']; 
$descricao_obra = $linha_obras['descricao_obra']; 
$observacao_obra = $linha_obras['observacao_obra']; 


}

$SelecionaClientes = Seleciona("clientes", "WHERE CodCli='$idcliente'", "LIMIT 0,1");
while($Clientes = mysql_fetch_array($SelecionaClientes)){
  $cliente = $Clientes['Fantasia'];
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <!-- LINHA DADOS -->
  <?php if($_GET['idobra'] != ""){ ?>
  <tr>
    <td colspan="4" align="center" valign="top"><strong class="TextoCinzaGrande">FICHA DE EQUIPE TÉCNICA</strong></td>
  </tr>
  <tr>
    <td colspan="4" align="center" valign="top"><table width="98%" border="0" cellspacing="2" cellpadding="0">
      <tr>
        <td height="40" align="left" bgcolor="#E7E7E7"><strong class="TextoCinzaGrande">Nº 2016-<?php echo $idobra;?> - CLIENTE : <?php echo $cliente;?></strong></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="4" align="center" valign="top"><table width="98%" border="0" cellspacing="2" cellpadding="0" bgcolor="#FFFFFF">
      <tr>
        <td width="863" colspan="3"><table width="99%" border="0" align="center" cellpadding="8" cellspacing="0">
          <tr>
            <td width="50%" valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">ENGENHEIRO RESP:</strong> <?php echo RetornaMaoObra($engenheiro_responsavel, 'nome');?></td>
            <td width="20%" valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($engenheiro_responsavel, 'telefone');?></td>
            <td width="30%" valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($engenheiro_responsavel, 'email');?></td>
            </tr>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">ARQUITETO RESP: </strong> <?php echo RetornaMaoObra($arquiteto_responsavel, 'nome');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($arquiteto_responsavel, 'telefone');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($arquiteto_responsavel, 'email');?></td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">CORDENADOR 1:</strong> <?php echo RetornaMaoObra($cordenador1, 'nome');?></td>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($cordenador1, 'telefone');?></td>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($cordenador1, 'email');?></td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">CORDENADOR 2:</strong> <?php echo RetornaMaoObra($cordenador2, 'nome');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($cordenador2, 'telefone');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($cordenador2, 'email');?></td>          
          </tr>
          <tr>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">SUPERVISOR 1:</strong> <?php echo RetornaMaoObra($supervisor1, 'nome');?></td>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($supervisor1, 'telefone');?></td>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($supervisor1, 'email');?></td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">SUPERVISOR 2:</strong> <?php echo RetornaMaoObra($supervisor2, 'nome');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($supervisor2, 'telefone');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($supervisor2, 'email');?></td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">TECNICO DE SEGURANÇA:</strong> <?php echo RetornaMaoObra($tecnicoseguranca, 'nome');?></td>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong>  <?php echo RetornaMaoObra($tecnicoseguranca, 'telefone');?></td>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong>  <?php echo RetornaMaoObra($tecnicoseguranca, 'email');?></td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">ENGENHEIROS:</strong></td>
            <td valign="top" bgcolor="#E7E7E7">&nbsp;</td>
            <td valign="top" bgcolor="#E7E7E7">&nbsp;</td>
          </tr>
			<?php
			$Seleciona = Seleciona("obras_contatos", "WHERE idobra='$idobra' AND tipo='Engenheiro'", "");
			while($linha = mysql_fetch_array($Seleciona)){
            ?>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">NOME:</strong> <?php echo RetornaMaoObra($linha['idmaodeobra'], 'nome');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($linha['idmaodeobra'], 'telefone');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($linha['idmaodeobra'], 'email');?></td>
          </tr>
          <?php }?>
          <tr>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#FFFFFF"><strong style="color: #000000;  font-size: 13px;">ARQUITETOS:</strong></td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
			<?php
			$Seleciona = Seleciona("obras_contatos", "WHERE idobra='$idobra' AND tipo='Arquiteto'", "");
			while($linha = mysql_fetch_array($Seleciona)){
            ?>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">NOME:</strong> <?php echo RetornaMaoObra($linha['idmaodeobra'], 'nome');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaMaoObra($linha['idmaodeobra'], 'telefone');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaMaoObra($linha['idmaodeobra'], 'email');?></td>
          </tr>
          <?php }?>
          <tr>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">COLABORADORES:</strong></td>
            <td valign="top" bgcolor="#E7E7E7">&nbsp;</td>
            <td valign="top" bgcolor="#E7E7E7">&nbsp;</td>
          </tr>
			<?php
            $Seleciona = Seleciona("obras_contatos", "WHERE idobra='$idobra' AND tipo='Colaborador'", "");
            while($linha = mysql_fetch_array($Seleciona)){
            ?>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">NOME:</strong> <?php echo RetornaColaborador($linha['idusuario'], 'nome');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaColaborador($linha['idusuario'], 'telefone');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaColaborador($linha['idusuario'], 'email');?></td>
          </tr>
          <?php }?>
          <tr>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">FORNECEDORES:</strong></td>
            <td valign="top" bgcolor="#E7E7E7">&nbsp;</td>
            <td valign="top" bgcolor="#E7E7E7">&nbsp;</td>
          </tr>
			<?php
            $Seleciona = Seleciona("obras_contatos", "WHERE idobra='$idobra' AND tipo='Fornecedor'", "");
            while($linha = mysql_fetch_array($Seleciona)){
            ?>
          <tr>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">NOME:</strong> <?php echo RetornaFornecedor($linha['idfornecedor'], 'nome');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">TEL.:</strong> <?php echo RetornaFornecedor($linha['idfornecedor'], 'telefone');?></td>
            <td valign="top" bgcolor="#E7E7E7"><strong style="color: #000000;  font-size: 13px;">E-MAIL:</strong> <?php echo RetornaFornecedor($linha['idfornecedor'], 'email');?></td>
          </tr>
          <?php }?>
          <tr>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td valign="top" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
  <?php } ?>
  <!-- LINHA DADOS -->
  
  </table>
  </body>
  </html>