<?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

//EXCLUINDO ARQUIVOS
if($_GET['AcaoArquivo'] == "ExcluirArquivo"){
	$idarquivo = $_GET['idarquivo'];
    $deletar_adicional = Excluir("arquivos_checklist", "idarquivo", $_GET['idarquivo']);	
	$redireciona = VerificaSql($deletar_adicional, "arquivos_checklist.php?idobra=".$_GET['idobra']."&idservicoobra=".$_GET['idservicoobra']."", "arquivos_checklist.php?idobra=".$_GET['idobra']."&idservicoobra=".$_GET['idservicoobra']."");
} 

?>
<!doctype html>
<html ng-app="myApp">
<head>
<title>CHECKLIST</title>
<link href="inclusos/css_precopratico.css" rel="stylesheet" type="text/css">

<style type="text/css">
.TextoVerdeMax {
	color: #060;
}
body {
	background-color: #FFFFFF;
}
</style>
<meta charset="utf-8">
</head>

<body>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="60" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tbody>
      <form action="upload_checklist.php" method="post" enctype="multipart/form-data">
        <input type="hidden" name="idobra" id="idobra"  value="<?php echo $_GET['idobra'];?>" />
        <input type="hidden" name="idservicoobra" id="idservicoobra"  value="<?php echo $_GET['idservicoobra'];?>" />        
        <tr>
          <td height="45" bgcolor="#E7E7E7"><strong class="TextoCinzaGrande">UPLOAD DE ARQUIVOS</strong></td>
          <td bgcolor="#E7E7E7">&nbsp;</td>
          <td bgcolor="#E7E7E7">&nbsp;</td>
        </tr>
        <tr>
          <td height="45" bgcolor="#E7E7E7"><input type="text" name="titulo" placeholder="Titulo do Arquivo" class="form-campos"  style="width:100%; height: 30px;" /></td>
          <td bgcolor="#E7E7E7"><input type="file" name="file" class="form-campos"  style="width:100%; height: 30px;" /></td>
          <td bgcolor="#E7E7E7"><input name="btn-upload" type="submit" class="BoxVerde" id="upload" value="Upload" style="width: 80px; height: 35px;"/></td>
        </tr>
      </form>
      <tr>
        <td colspan="3" bgcolor="#E7E7E7"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="0">
          <tr class="TextoCinzaEscuro">
            <td width="20%" height="30" bgcolor="#A6A6A6"><strong>TITULO</strong></td>
            <td width="10%" align="right" bgcolor="#A6A6A6">&nbsp;</td>
          </tr>
          <?php
			$cor_fundo = "#FFFFFF";			  
			 	$seleciona = Seleciona("arquivos_checklist", "WHERE idservicoobra='".$_GET['idservicoobra']."'", "");

			while($linha=mysql_fetch_array($seleciona)){

			
			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='<?php echo $cor_fundo;?>'" style="cursor:pointer;">
            <td width="20%" height="30"><?php echo $linha['titulo'];?></td>
            <td width="10%" align="right"><a href="upload_obras/<?php echo $linha['file'] ?>" target="_blank"><img src="img/icone_detalhe.gif" width="22" height="24" border="0" /></a><a href="arquivos_checklist.php?AcaoArquivo=ExcluirArquivo&amp;idarquivo=<?php echo $linha['idarquivo'];?>&amp;idobra=<?php echo $linha['idobra'];?>&amp;idservicoobra=<?php echo $linha['idservicoobra'];?>"><img src="img/icone_excluir.gif" width="24" height="24" border="0" alt="Excluir" /></a></td>
          </tr>
          <?php }?>
          <?php
			$cor_fundo = "#FFFFFF";			  
			 	$seleciona = Seleciona("arquivos_vendas", "WHERE idvenda='$idvenda'", "");

			while($linha=mysql_fetch_array($seleciona)){

			
			if($cor_fundo == "#FFFFFF"){
				$cor_fundo = "#E4E4E4";
			}else{
				$cor_fundo = "#FFFFFF";
			}
		?>
          <?php }?>
        </table></td>
      </tr>
  </tbody>
  
    </table></td>
  </tr>
</table>
</body>
</html>