<?php
  $page_title = 'Editar Produccion MI';
  require_once('../../includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(5);
?>
<?php
  $maquinaria = find_by_id('produccionmi',(int)$_GET['id']);
  if(!$maquinaria){
  $session->msg("d","Error: No se encontró id del maquinaria.");
  redirect('maquinaria.php');  
}
?>
<?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-edit"></span>
            <span>Editar Produccion</span>
         </strong>
        </div> 
 <!-- FORMULARIO PARA GUARDAR EL PROGRAMA-->
        <form  enctype="multipart/form-data" autocomplete="off" id="form" onSubmit="Edit()">
          <div class="panel-body">
            <div class="col-md-12">
        		<div class="card-header">
                  <strong>
                     <span> Produccion</span>
                  </strong> 
                </div>

                 <div class="card-body">
		              <div class="form-group">
		                <div class="row">
		                	   <div class="col-md-3">
		                      <label for="produccion" class="control-label">Produccion:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                             <input type="text" id="produccion" name="produccion" class="form-control" value="<?php echo (int)$maquinaria['id'];?>" readonly>		                                                                        
		                        </div>               
		                    </div>
		                  	<div class="col-md-3">
		                      <label for="maquinaria" class="control-label">Maquinaria:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <select id="maquinaria" name="maquinaria" class="form-control">
		                                <?php
																	        $consulta = $db->query("SELECT * FROM activo");
																	        $idPro =$maquinaria['IdActivo'];
																	        while ($activo = $db->fetch_array($consulta)) {
																	        $def='';
																	        if($activo['id']==$idPro){
																	            $def='selected';
																	        }
																	   ?>
																				    <option value="<?php echo $activo['id']?>" <?php echo $def?> ><?php echo $activo['NombreActivo'] ?></option>
																				    <?php
																	        }
																	   ?>
		                              </select> 		                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="implemento" class="control-label">Implemento:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <select id="implemento" name="implemento" class="form-control">
		                                <?php
																	        $consulta = $db->query("SELECT * FROM implemento");
																	        $idPro =$maquinaria['IdImplemento'];
																	        while ($implemento = $db->fetch_array($consulta)) {
																	        $def='';
																	        if($implemento['id']==$idPro){
																	            $def='selected';
																	        }
																	   ?>
																				    <option value="<?php echo $implemento['id']?>" <?php echo $def?> ><?php echo $implemento['NombreImplemento'] ?></option>
																				    <?php
																	        }
																	   ?>
		                              </select>                                              
		                        </div>               
		                    </div>	
		                    <div class="col-md-3">
		                      <label for="servicio" class="control-label">Servicio:</label>
		                      <div class="input-group">   
		                              <select id="servicio" name="servicio" class="form-control">
		                                <?php
																	        $consulta = $db->query("SELECT * FROM tiposerviciomi");
																	        $idPro =$maquinaria['IdTipoServicioMI'];
																	        while ($implemento = $db->fetch_array($consulta)) {
																	        $def='';
																	        if($implemento['IdTipoServicioMI']==$idPro){
																	            $def='selected';
																	        }
																	   ?>
																				    <option value="<?php echo $implemento['IdTipoServicioMI']?>" <?php echo $def?> ><?php echo $implemento['NombreTipoServicioMI'] ?></option>
																				    <?php
																	        }
																	   ?>
		                              </select>                            
		                        </div>               
		                    </div>	                    
		                </div>
		               </div>

		               <div class="form-group">
		                <div class="row">		                	  
		                  	<div class="col-md-3">
		                      <label for="operacion" class="control-label">Operacion:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                             <input type="text" id="operacion" name="operacion" class="form-control" value="<?php echo remove_junk($maquinaria['IdOperacion']); ?>" required>                                                                
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="f_produccion" class="control-label">Fecha Produccion:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                             <input type="date" id="f_produccion" name="f_produccion" class="form-control" value="<?php echo remove_junk($maquinaria['FechaRegistroProduccionMI']); ?>" required>                                           
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="horas_ope" class="control-label">Horas:</label>
		                      <div class="input-group">  
		                              <input type="text" id="horas_ope" name="horas_ope" class="form-control" value="<?php echo remove_junk($maquinaria['HorasProduccion']); ?>">                            
		                        </div>               
		                    </div>
		                  	<div class="col-md-3">
		                      <label for="horas_e_ope" class="control-label">Hrs Extras Ope:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="horas_e_ope" name="horas_e_ope" class="form-control" value="<?php echo remove_junk($maquinaria['HorasExtrasMI']); ?>">	                                                                        
		                        </div>               
		                    </div>
		                </div>
		              </div>


		              <div class="form-group">
		                <div class="row">		                	  
		                    <div class="col-md-3">
		                      <label for="despacho_gln" class="control-label">Despacho Gln:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="despacho_gln" name="despacho_gln" class="form-control" value="<?php echo remove_junk($maquinaria['DespachoMI']); ?>">                                      
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="h_inicial" class="control-label">H. Inicial:</label>
		                      <div class="input-group">   
		                              <input type="text" id="h_inicial" name="h_inicial" class="form-control" value="<?php echo remove_junk($maquinaria['HorometroInicial']); ?>">                             
		                        </div>               
		                    </div>
		                  	<div class="col-md-3">
		                      <label for="h_final" class="control-label">H.Final:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="h_final" name="h_final" class="form-control" value="<?php echo remove_junk($maquinaria['HorometroFinal']); ?>">                                           
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="responsable" class="control-label">Responsable:</label>
		                      <div class="input-group">   
		                              <select id="responsable" name="responsable" class="form-control">
		                                <?php
																	        $consulta = $db->query("SELECT * FROM responsableactivo");
																	        $idPro =$maquinaria['IdResponsableActivo'];
																	        while ($implemento = $db->fetch_array($consulta)) {
																	        $def='';
																	        if($implemento['id']==$idPro){
																	            $def='selected';
																	        }
																	   ?>
																				    <option value="<?php echo $implemento['id']?>" <?php echo $def?> ><?php echo $implemento['NombreResponsableActivo'] .' '.$implemento['ApellidoResponsableActivo']  ?></option>
																				    <?php
																	        }
																	   ?>
		                              </select>                               
		                        </div>               
		                    </div>
		                </div>
		              </div>
              
		              <div class="form-group">
		                <div class="row">
		                	  		                    
		                </div>
		               </div>
		               <div class="form-group">
		                <div class="row">
		                	<div class="col-md-3">
		                      <label for="observacion" class="control-label">Observacion:</label>
		                      <div class="input-group">   
		                              <input type="text" id="observacion" name="observacion" class="form-control" value="<?php echo remove_junk($maquinaria['ObsProduccionMI']); ?>">                             
		                        </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_maquinaria.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/edit_maquinaria.js"></script>


