<?php
date_default_timezone_set('America/Lima');
$y=date('Y');
$m=date('m');
$d=date('d');
$fec1="$d-$m-$y";
$fec2="$d-$m-$y";
?>
<script type="text/javascript">
	
	
	function cmb_tra_alm_ori(){	
		$.ajax({
			type: "POST",
			url: "../almacen/cmb_alm_id.php",
			async:true,
			dataType: "html",                      
			data: ({
				alm_id: '<?php echo $alm_id?>',
				vista:'filtro'
			}),
			beforeSend: function() {
				$('#cmb_fil_tra_alm_ori').html('<option value="">Cargando...</option>');
			},
			success: function(html){
				$('#cmb_fil_tra_alm_ori').html(html);
				cmb_tra_alm_des();
			}
		});
	}
	function cmb_tra_alm_des(){	
		$.ajax({
			type: "POST",
			url: "../almacen/cmb_alm_id.php",
			async:true,
			dataType: "html",                      
			data: ({
				alm_id: '<?php echo $alm_id?>',
				vista:'filtro'
			}),
			beforeSend: function() {
				$('#cmb_fil_tra_alm_des').html('<option value="">Cargando...</option>');
			},
			success: function(html){
				$('#cmb_fil_tra_alm_des').html(html);
					traspaso_tabla();
			}
		});
	}
$(function() {	
		$('#txt_fil_tra_fec1, #txt_fil_tra_fec2').datepicker({
			format: 'dd-mm-yyyy',
			autoclose:true
		}).on('changeDate', function(e){
			traspaso_tabla();
		}); 
	
	cmb_tra_alm_ori();
	//cmb_tra_alm_des();
	$('#cmb_fil_tra_alm_ori, #cmb_fil_tra_alm_des, #chk_tra_anu').change(function(){
		traspaso_tabla();
	});
});
</script>
<style>
/*label {
	display:inline-block;
    width: 150px; 
}*/
</style>

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

		<div class=" col-lg-2 col-sm-2 col-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_tra_fec1" type="text" id="txt_fil_tra_fec1" value="<?php echo $fec1?>" class="form-control" >
                  </div>
         </div>
				
		<div class=" col-lg-2 col-sm-2 col-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_tra_fec2" type="text" id="txt_fil_tra_fec2" value="<?php echo $fec2?>" class="form-control" >
                  </div>
        </div>
	
		<div class="col-lg-3 col-sm-3 col-6">	
		<label for="cmb_fil_tra_alm_ori">Almacén Origen:</label>
		<select name="cmb_fil_tra_alm_ori" class="form-control" id="cmb_fil_tra_alm_ori">
		</select>
		</div>	
		
		<div class="col-lg-3 col-sm-3 col-6">	
		<label for="cmb_fil_tra_alm_des">Almacén Destino:</label>
		<select name="cmb_fil_tra_alm_des" class="form-control" id="cmb_fil_tra_alm_des">
		</select>
		</div>	
		<!--
		<div class="col-lg-2 col-6">	
		<?php if($_SESSION['usuariogrupo_id']==2){?>
		<label for="chk_tra_anu" title="Activar para anular transferencia.">
		<input name="chk_tra_anu" id="chk_tra_anu" type="checkbox" value="1"> Anular </label>
		<?php }?>
		</div>	
		-->
		
		<div class="col-lg-2 col-sm-2 col-6" style="display: inline-block; white-space: nowrap;padding-top: 30px;" >	

		<span onClick="traspaso_tabla()" style="cursor:pointer;" class="btn btn-primary" ><i class="fas fa-search"></i></span>
		<span onClick="traspaso_filtro()" style="cursor:pointer;" class="btn btn-default" >Restablecer</span>
		</div>
		
		
	</div>
</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
</section>