<?php
require '../../conexion.php';
include '../../session.php';
?>

<div class="modal-header " >
    <button type="button" class="close"     
            data-dismiss="modal" arial-label="Close">x</button>
    <h4 class="modal-title"><i class="fa fa-plus"></i> <strong>Registrar Nota de Remisión</strong></h4>
</div>
<form action="remision_control.php" method="post" accept-charset="utf-8" class="form-horizontal" >
    <div class="panel-body se">
        <input type="hidden" name="accion"  value="1">
        <input type="hidden" name="vtotal" value="0">
        <input type="hidden" name="vtotiva" value="0">
        <input type="hidden" name="vusu" value="<?php echo $_SESSION['usu_cod']; ?>">
        <input type="hidden" name="vsucsalida" value="<?php echo $_SESSION['cod_suc']; ?>">
        <input type="hidden" name="pagina" value="remision_index.php" id="vcod">
        <input type="hidden" name="vcod" value="0"/>
        <input type="hidden" name="vestado" value="ACTIVO"/> 
        <div class="row">
            <div class="col-md-4">
                <label class="control-label">Fecha</label>
                <input type="date" name="vcom_fecha" required="" class="form-control" value="<?php echo date("Y-m-d") ?>" max="<?php echo date("Y-m-d") ?>" name="vfechainicio">
            </div>
            <div class="col-md-8" >
                <label class="control-label">N° Nota Remisión</label>
                <input type="text" required="" placeholder="Ingrese el N° Nota" class="form-control" name="vnronota" 
                       id="vnronota" maxlength="15" pattern="[0-9-]+">
            </div>                                            
        </div>
        <div class="row">
            <div class="col-md-4">                
                <?php $prv = consultas::get_datos("SELECT * from sucursal where cod_suc<>" . $_SESSION['cod_suc']); ?>                                 
                <label class="control-label">Sucursal Destino</label>
                <select name="vsucentrada" class="select2 form-control" required="" style="width: 100%">
                    <?php if (!empty($prv)) {
                        foreach ($prv as $prv) { ?>
                            <option value="<?php echo $prv['cod_suc']; ?>">
                                <?php echo $prv['suc_nombre']; ?></option>
                            <?php
                        }
                    } else {
                        ?>
                        <option value="">No existen registros</option>
                    <?php } ?>
                </select>
            </div>
            <div class="col-md-8" >
                <label class="control-label">N° Timbrado</label>
                <input type="text" required="" placeholder="Ingrese el N° Nota" class="form-control" name="vtimbrado" 
                       id="vnrofac" maxlength="15" pattern="[0-9-]+">
            </div>                                            
        </div>        
        <div class="row">
            <div class="col-md-4" >
                <?php $empleados = consultas::get_datos("SELECT * from v_empleados"); ?>                                 
                <label class="control-label">Conductor</label>
                <select name="vempleado" class="select2 form-control" required="" style="width: 100%">
                    <?php if (!empty($empleados)) {
                        foreach ($empleados as $emp) { ?>
                            <option value="<?php echo $emp['id_empleado']; ?>">
                                <?php echo $emp['empleado']; ?></option>
                            <?php
                        }
                    } else {
                        ?>
                        <option value="">No existen registros</option>
                    <?php } ?>
                </select>
            </div>

            <div class="col-md-8" >
                <?php $prv = consultas::get_datos("SELECT * from v_vehiculos"); ?>                                 
                <label class="control-label">Vehiculo</label>
                <select name="vvehiculo" class="select2 form-control" required="" style="width:100%">
                    <?php if (!empty($prv)) {
                        foreach ($prv as $prv) { ?>
                            <option value="<?php echo $prv['id_vehi']; ?>">
                                <?php echo $prv['vehiculo']; ?></option>
                            <?php
                        }
                    } else {
                        ?>
                        <option value="">No existen registros</option>
                    <?php } ?>

                </select>
            </div>
        </div>

        <div class="row">
            <div class="col-md-12">
                <label class="control-label">Motivo de Translado</label>
                <input type="text" required=""
                       placeholder="Ingrese el Motivo" class="form-control" name="vmotivo" id="vmotivo">
            </div>
        </div>

        <div class="modal-footer">
            <button type="submit" class="btn btn-primary center-block">
                <i class="fa fa-floppy-o"></i> Registrar</button>
        </div>
    </div> 
</form>

<script type="text/javascript">
    $(".select2").select2();
</script>