<?php
  $page_title = 'Agregar Proyeccion';
  require_once('../../includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(5);
?>
<?php include_once('../../layouts/header.php'); ?>
<div class="row">
  <div class="col-md-12">
    <?php echo display_msg($msg); ?>
  </div>
</div>
  <div class="row">
  <div class="col-md-16">
      <div class="panel panel-default">
        <div class="panel-heading">
          <strong>
            <span class="glyphicon glyphicon-plus"></span>
            <span>Proyeccion</span>
         </strong>
        </div> 
 <!-- FORMULARIO PARA GUARDAR EL PROGRAMA-->
        <form  enctype="multipart/form-data" autocomplete="off" id="form" onSubmit="validar()">
          <div class="panel-body">
            <div class="col-md-12">
        		<div class="card-header">
                  <strong>
                     <span>Proyeccion</span>
                  </strong> 
                </div>
                 <div class="card-body">
		              <div class="form-group">
		                <div class="row">		                  	
		                    <div class="col-md-3">
		                      <label for="fecha" class="control-label">Fecha de Inicio:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="date" class="form-control" id="fecha" name="fecha" required>                                            
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="cant_galones" class="control-label">Cantidad Galones:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" class="form-control" id="cant_galones" name="cant_galones" required>                                            
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="t_combustible" class="control-label">Tipo Combustible:</label>
		                      <div class="input-group">   
		                              <select id="t_combustible" name="t_combustible" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM tipocombustible");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdTipoCombustible']; 
																		      $T_Combustible = $row['DetTipoCombustible'];    
																		      echo "<option value='$id'>$T_Combustible</option>";
																		    }
																		?>
		                              </select>                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="granja" class="control-label">Granja:</label>
		                      <div class="input-group">   
		                             <select id="granja" name="granja" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM granja");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdGranja']; 
																		      $Nom_Granja = $row['GNombre'];    
																		      echo "<option value='$id'>$Nom_Granja</option>";
																		    }
																		?>
		                              </select>                             
		                        </div>               
		                    </div>
		                </div>
		               </div>

		               <div class="form-group">
		                <div class="row">
		                	  <div class="col-md-3">
		                      <label for="destino" class="control-label">Destino:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <select class="form-control" id="destino" name="destino">
		                              	<option>Mercado</option>
		                              	<option>Camal</option>
		                              </select>                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="responsable" class="control-label">Responsable:</label>
		                      <div class="input-group">   
	                              <input type="text" class="form-control" id="responsable" name="responsable" value="<?php echo $user['name']; ?>" readonly>                             
		                        </div>               
		                    </div>		                    
		                    <div class="col-md-3">
		                      <label for="t_abastecimiento" class="control-label">Tipo Abastecimiento:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <select id="t_abastecimiento" name="t_abastecimiento" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM tipoabastecimiento");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdTipoAbastecimiento']; 
																		      $T_Abastecimiento = $row['NombreTipoAbastecimiento'];    
																		      echo "<option value='$id'>$T_Abastecimiento</option>";
																		    }
																		?>
		                              </select>                                       
		                        </div>               
		                    </div>
		                </div>
		              </div>
                     <div class="text-center">
                   		 <button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-floppy-disk"></i>Guardar</button>
                   		  <a href="listado_proyeccion.php" class="btn btn-primary"><i class="glyphicon glyphicon-th-list"></i>Listado</a>
                     </div>
          			  </div>
	          	    </div>
	             </div>
	           </div>   
            </div>
          </div>           
        </form>
     </div>
    </div>
  </div>
</div>
</div>




<?php include_once('../../layouts/footer.php'); ?>
<script type="text/javascript" src="js/proyeccion.js"></script>


