 
<?php 

date_default_timezone_set('America/Lima');
$y=date('Y');
$m=date('m');
$d=date('d');

$fec1="$d-$m-$y";
$fec2="$d-$m-$y";


?>

<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
		    <div class="card">
		        <div class="card-header">
    		<div class="row">
						<form name="for_fil_pro" id="for_fil_pro" method="POST" > 

						<div class="row">
						
						<div class=" col-lg-2 col-xs-6 form-group">
                  <label>Fecha 1:</label>

                  <div class="input-group">
                    <div class="input-group-prepend">
                      <span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
                    </div>
                    <input name="txt_fil_devpro_fec1" type="text" id="txt_fil_devpro_fec1" value="<?php echo $fec1?>" class="form-control" >
                  </div>
                </div>
				
				
				<div class=" col-lg-2 col-xs-6 form-group">
                  <label>Fecha 2:</label>

                  <div class="input-group">
                    <div class="input-group-prepend">
                      <span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
                    </div>
                    <input name="txt_fil_devpro_fec2" type="text" id="txt_fil_devpro_fec2" value="<?php echo $fec2?>" class="form-control" >
                  </div>
                </div>
				
							<div class="col-lg-4  col-sm-3 col-xs-6">
								<label for="cmb_dev_emp_id">Empresa:</label>
								<select name="cmb_dev_emp_id" id="cmb_dev_emp_id" class="form-control"></select>
							</div>
							
							<div class="col-lg-3 col-xs-6">
								<input type="hidden" id="hdd_fil_pro_id" name="hdd_fil_pro_id"/>
								<label for="txt_dev_pro_nom">Proveedor:</label>
								<input name="txt_dev_pro_nom" type="text" id="txt_dev_pro_nom" class="form-control"> 
							</div> 

                            <div class="col-lg-2 col-xs-6">
								<label for="txt_dev_numdoc">Numero Doc:</label>
								<input name="txt_dev_numdoc" type="text" id="txt_dev_numdoc" class="form-control">   
							</div>
							
							<div class="col-lg-3 col-xs-6" style="padding-top:30px;"> 
								<span style="cursor:pointer" onClick="devolucion_tabla()"  class="btn btn-primary" ><i class="fa fa-search"></i></span>
								<span style="cursor:pointer" onClick="devolucion_filtro()"  class="btn btn-default" >Restablecer</i></span>
							</div>
						
							</div>

						</form>
						
						
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
</section>

<script type="text/javascript">

 function cmb_empresa_id(empid){
	
	  	$.ajax({
			type: "POST",
			url: "../empresa/cmb_emp_id.php",
			async:true,
			dataType: "html",                      
			data: ({
				emp_id:empid
			}),
			beforeSend: function() {
				$('#cmb_dev_emp_id').html('<option value="">Cargando...</option>');
			},
			success: function(html){	
			
				$('#cmb_dev_emp_id').html(html);
				//alert($('#cmb_empresa_id').val());
				
				
			}
		});		
  
  }
  
  

	$(function() {



	$('#txt_fil_devpro_fec1, #txt_fil_devpro_fec2').datepicker({
			format: 'dd-mm-yyyy',
			autoclose:true
		}).on('changeDate', function(e){
			
				
		}); 
		
	
		$( "#txt_dev_pro_nom" ).autocomplete({
			minLength: 1,
			source: "../proveedor/proveedor_complete_nom.php",
			select: function(event, ui){			
				$("#hdd_fil_pro_id").val(ui.item.id);							
			}
		});

		$("#cmb_fil_empresa_id").change(function(){
			
		});
	
	
	$("#txt_dev_numdoc").keydown(function(e){
			if (e.which == 13){
					
			return false;
			}
		});
		
		$("#txt_dev_pro_nom").keydown(function(e){
			if (e.which == 13){
					
			return false;
			}
		});

	
		cmb_empresa_id();
		devolucion_tabla();
		
	});
</script>   