<?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_cuecob" id="for_fil_cuecob" method="POST" > 
							
							<div class="row">
							
							<div class="col-lg-3 col-sm-3 col-xs-6">
								<label for="cmb_fil_empresa_id">Empresa:</label>
								<select name="cmb_fil_empresa_id" id="cmb_fil_empresa_id" class="form-control"></select>
							</div>
							
							<div class="col-lg-3 col-sm-3 col-xs-6">
								<input type="hidden" id="hdd_fil_cli_id" name="hdd_fil_cli_id" value="<?php echo $cli_id?>" />		
								<label for="txt_cc_cli_nom">Cliente:</label>
								<input type="text" id="txt_cc_cli_nom" name="txt_cc_cli_nom"  class="form-control" />
							</div>		
							   <div class="col-lg-3 col-sm-3 col-xs-6">
								<label for="cmb_fil_mon_id">Moneda:</label>
								<select name="cmb_fil_mon_id" id="cmb_fil_mon_id" class="form-control">
								</select>    
							</div>
							
							<div class="col-lg-3 col-sm-3 col-xs-6" style="padding-top: 30px;"> 
							<span onClick="cuentacobrar_tabla()" style="cursor:pointer" class="btn btn-primary" ><i class="fa fa-search"></i></span>						
							<span onClick="cuentacobrar_filtro()" style="cursor:pointer" class="btn btn-default" id="btn_resfil">Restablecer</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_fil_empresa_id').html('<option value="">Cargando...</option>');
			},
			success: function(html){	
			
				$('#cmb_fil_empresa_id').html(html);
				//alert($('#cmb_empresa_id').val());
				
				
			}
		});		
  
  }
  
  
  	function cmb_fil_mon_id(moneid)
	{	
		$.ajax({
			type: "POST",
			url: "../moneda/cmb_mon_id.php",
			async:true,
			dataType: "html",                      
			data: ({
				mon_id: moneid
			}),
			beforeSend: function(){
				$('#cmb_fil_mon_id').html('<option value="">Cargando...</option>');
			},
			success: function(html){
				$('#cmb_fil_mon_id').html(html);
			}
		});
	}
	
	
	$(function() {

		cmb_empresa_id();
		cmb_fil_mon_id('1');
	
		$("#txt_cc_cli_nom").autocomplete({
			minLength: 1,
			source: "../cliente/cliente_complete_nom.php",
			select: function(event, ui){			
				$("#hdd_fil_cli_id").val(ui.item.id);
				//cuentacobrar_tabladeudas(ui.item.id);		 
			}
		});
		
		$('#txt_ven_cli_nom').change(function(){
			//cuentacobrar_tabla();
		});
		$("#cmb_fil_empresa_id").change(function(){
		//	cuentacobrar_tabla();
		});
		
		//cuentacobrar_tabla();
	});
</script>  