<?php

require '../../conexion.php';
?>
<div class="form-group">
    <label class="col-md-2 col-sm-2 col-lg-2 control-label">Pedidos: </label>
        <div class="col-md-6 col-sm-6 col-lg-6">
        <?php $pedidos = consultas::get_datos("select * from v_servicios_pedidos where ped_estado='PENDIENTE' and id_cliente = ".$_REQUEST['id_cliente']." order by id_ped"); ?> 
               <select name="vped" class="select2 form-control" required="" style="width: 100%" onchange="div_ped_detalle();"id="vped" >
                <option value="">Seleccione un Pedido</option>                       
                <?php if (!empty($pedidos)) {
                    foreach ($pedidos as $p) { ?>
                <option value="<?php echo $p['id_ped']; ?>"><?php echo "#".$p['id_ped']." Fecha:".date("d/m/Y", strtotime($p['ped_fecha']))." Total:". number_format($p['ped_total'],0,",","."); ?></option>
                <?php
                    }
                } else {
                    ?>
                    <option value="null">No existen pedidos pendientes</option>
                <?php } ?>
            </select>                                               
    </div>
</div>

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