<?php
/*
CRIADO POR: K88
DATA ULTIMA ALTERAÇÃO: 17/03/2017 15:41
OBS.: ATUALIZAÇÃO DE ESTRUTURA E REVISÃO
*/

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


$idobra = $_GET['idobra'];
$idservicoobra = $_GET['idservicoobra'];


//INSERIR REGISTROS
if($_GET['acao'] == "Salvar"){

//Dados da Tabela


$titulo = $_POST['titulo'];
$tipo = $_POST['tipo'];
$data = $_POST['data'];
$descricao = $_POST['descricao'];
$idusuario = $_SESSION['usuarioID'];

$tabela        ="obras_diarios";
$campos_tabela = "idobra, data, titulo, tipo, descricao, idfilial, idservicoobra, idusuario_cadastro, idusuario";
$campos_value = "'$idobra', '$data', '$titulo', '$tipo', '$descricao', '".$_SESSION['idfilial_usuario']."', '$idservicoobra', '".$_SESSION['usuarioID']."', '".$_SESSION['usuarioID']."'";

$salvar = Salvar($tabela,  $campos_tabela, $campos_value);
$id_compra = mysql_insert_id();

	$redireciona = VerificaSqlSemAlert($salvar, "adicionar_ocorrencia_obra.php?idobra=".$idobra."&idservicoobra=".$idservicoobra."", "adicionar_ocorrencia_obra.php?idobra=".$idobra."&idservicoobra=".$idservicoobra."");	
}

?>
    <!doctype html>
    <html ng-app="myApp">

    <head>
        <title>OCORRÊNCIAS OBRAS</title>

        <script src="https://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>
        <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/minified/jquery-ui.min.css" type="text/css" />
        <script type="text/javascript" src="https://code.jquery.com/ui/1.10.1/jquery-ui.min.js"></script>
        <script type="text/javascript" src="inclusos/jquery-ui-1.8.20.custom.min.js"></script>
        <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 height="60" align="center"><strong class="TextoCinzaGrande">ADICIONAR OCORRÊNCIA <span class="TextoVerdeMax">#<?php echo $idobra;?></span></strong></td>
            </tr>
            <tr>
                <td>
        <!-- INICIO FORM -->
        <form method="post" action="adicionar_ocorrencia_obra.php?acao=Salvar&idobra=<?php echo $idobra;?>&idservicoobra=<?php echo $idservicoobra;?>" enctype="multipart/form-data">
        <table width="99%" border="0" align="center" cellpadding="4" cellspacing="0">
          <tr>
            <td valign="top"><strong>DIÁRIO DE OBRA</strong></td>
            </tr>
          <tr>
            <td valign="top" bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="3" cellpadding="3">
              <tbody>
                <tr>
                  <td><strong style="color: #000000;  font-size: 13px;">DATA:</strong></td>
                  <td><span style="color: #000000; font-size: 13px;">
                    <input name="data" type="date" required class="form-campos datepicker" id="datepicker"  style="width:100%; height: 30px; font-weight: bold"  value="<?php echo $data;?>"   >
                    </span></td>
                  <td><strong style="color: #000000;  font-size: 13px;">TITULO: </strong></td>
                  <td><span style="color: #000000; font-size: 13px;">
                    <input name="titulo" type="text" required class="form-campos" id="titulo"  style="width:100%; height: 30px; font-weight: bold"  value="" />
                    </span></td>
                  <td><strong style="color: #000000;  font-size: 13px;">TIPO: </strong></td>
                  <td>
                    <select name="tipo" size="1" id="tipo" class="form-campos" style="width:100%; height: 30px;">
                      <option value="Relatorio">Relatório</option>
                      <option value="Ocorrencia">Ocorrência</option>
                      </select>
                    </td>
                  </tr>
                </tbody>
              </table></td>
            </tr>
          <tr>
            <td valign="top" bgcolor="#CCCCCC"><strong style="color: #000000;  font-size: 13px;">DESCRIÇÃO:</strong></td>
            </tr>
          <tr>
            <td width="50%" valign="top" bgcolor="#CCCCCC"><textarea name="descricao" class="form-campos" id="descricao" style="width:99%; height: 150px;"></textarea></td>
            </tr>
          <tr>
            <td align="right" valign="top" bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="2">
              <tbody>
                <tr>
                  <td align="left"><table width="200" border="0" cellspacing="0" cellpadding="2">
                    <tbody>
                      <tr>
                        <td width="157" align="center"><span class="TituloCinzaEscuro" style="font-size: 14px;"><a class="fancybox fancybox.iframe" href="diariodeobra.php?idobra=<?php echo $idobra;?>&idservicoobra=<?php echo $idservicoobra;?>" style="color:#575757;">VER TODOS OS DIAS </a></span></td>
                      </tr>
                    </tbody>
                  </table></td>
                  <td align="right"><input name="button" type="submit" class="BoxVerde" id="button" value="Salvar" style="width: 100px; height: 35px;"  /></td>
                  </tr>
                </tbody>
              </table></td>
            </tr>
          </table>
          </form>
          <!-- FIM FORM -->
                </td>
            </tr>
        </table>
    </body>

    </html>