<?php

$y=date('Y');

$m=date('m');

$d=date('d');



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

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



?>

<script type="text/javascript">

	$('#btn_filtrar').button({

		icons: {primary: "ui-icon-search"},

		text: false

	});

	$('#btn_resfil').button({

		icons: {primary: "ui-icon-arrowrefresh-1-w"},

		text: false

	});



	var dates = $( "#txt_fil_ven_fec1, #txt_fil_ven_fec2" ).datepicker({

	//defaultDate: "+1w",

	maxDate:"+0D",

	changeMonth: true,

	numberOfMonths: 1,

	dateFormat: 'dd-mm-yy',

	onSelect: function( selectedDate ) {

		var option = this.id == "txt_fil_ven_fec1" ? "minDate" : "maxDate",

		instance = $( this ).data( "datepicker" ),

		date = $.datepicker.parseDate(

			instance.settings.dateFormat ||

			$.datepicker._defaults.dateFormat,

			selectedDate, instance.settings );

		dates.not( this ).datepicker( "option", option, date );

		comprapago_tabla();

	}

});



function cmb_caj_id(ids)

{	

	$.ajax({

		type: "POST",

		url: "../caja/cmb_caj_id.php",

		async:false,

		dataType: "html",                      

		data: ({

			caj_id: ids

		}),

		beforeSend: function() {

			$('#cmb_caj_id').html('<option value="">Cargando...</option>');

		},

		success: function(html){

			$('#cmb_caj_id').html(html);

		}

	});

}



	function forpag_id()

	{

		var tipo = $("#cmb_fil_forpag_id").val();



	//contado

	if(tipo == 1)

	{		

		$(".cmb_caj_id").show(100);

	}

	//credito

	if(tipo == 2){			

		$(".cmb_caj_id").hide();

	}

	comprapago_tabla();

}





$(function() {



	cmb_caj_id(1);

	forpag_id();



	$( "#txt_fil_cli" ).autocomplete({

		minLength: 1,

		source: "../cliente/cliente_complete_nom.php",

		select: function(event, ui){

			$("#hdd_fil_cli_id").val(ui.item.id);														

		}

	});



	$("#cmb_fil_forpag_id").change(function(){		

		forpag_id();

	});



	



	$('#txt_fil_ven_fec1, #txt_fil_ven_fec2, #cmb_caj_id').change(function(e) {

		comprapago_tabla();

	});		



});

</script>

<section class="content" id="filter" style="min-height:0px;padding-bottom:0px;margin-bottom:-30px;">

  <div class="row">

    <div class="col-xs-12">

      <div class="box">

        <div class="box-body">

    		<div class="row">

					<input name="hdd_modo" id="hdd_modo" type="hidden" value="comprapago_tabla.php">

					

				    <div class="col-lg-2 col-xs-6">

						<label>Fecha:</label>

						<input name="txt_fil_ven_fec1" type="text" id="txt_fil_ven_fec1" value="<?php echo $fec1?>" size="8" readonly  class="form-control" >

                    </div>

				    <div class="col-lg-2 col-xs-6">

						<label>-</label>

						<input name="txt_fil_ven_fec2" type="text" id="txt_fil_ven_fec2" value="<?php echo $fec2?>" size="8" readonly class="form-control" >

				    </div>

				    <div class="col-lg-2 col-xs-6">

						<label>Forma:</label>

						<select  name="cmb_fil_forpag_id" id="cmb_fil_forpag_id"  class="form-control">

							<option value="1" selected="selected">CONTADO</option>

							<option value="2">CREDITO</option>

							<!-- <option value="3">NOTA CREDITO</option> -->

						</select>

				    </div>

				    <div class="col-lg-2 col-xs-6">

						<label>Caja:</label> 

						<select name="cmb_caj_id" id="cmb_caj_id"  class="form-control" ></select>

				    </div>

				    <div class="col-lg-2 col-xs-6"  style="padding-top: 23px;">

						<button  onClick="comprapago_tabla()"  class="btn btn-primary" >Filtrar</button>

						<button  onClick="comprapago_filtro()"  class="btn btn-default">Restablecer</button>

				    </div>

            </div>

           </div>

        </div>

      </div>

    </div>

  </div>

</section> 





