<?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 );

		ventapago_tabla();

	}

});



	function cmb_tar_id(ids){

		$.ajax({

			type: "POST",

			url: "../tarjeta/cmb_tar_id.php",

			async:true,

			dataType: "html",                      

			data: ({

				tar_id: ids

			}),

			beforeSend: function() {

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

			},

			success: function(html){

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

			}

		});

	}



	function cmb_cuedep_id(ids){

		$.ajax({

			type: "POST",

			url: "../cuentadeposito/cmb_cuedep_id.php",

			async:true,

			dataType: "html",                      

			data: ({

				cuecor_id: ids

			}),

			beforeSend: function() {

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

			},

			success: function(html){

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

			}

		});

	}



	function forpag_id()

	{

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



	//contado

	if(tipo == 1)

	{		

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

		$(".cmb_fil_tar_id").hide();

		$(".fill_vencimiento").hide();

		$(".cmb_fil_cuedep_id").hide();

	}

	//credito

	if(tipo == 2){			

		$(".cmb_fil_modpag_id").hide();

		$(".cmb_fil_tar_id").hide();

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

		$(".cmb_fil_cuedep_id").hide();

	}

	ventapago_tabla();

}



function modpag_id()

{

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

	

	//efectivo

	if(tipo == 1)

	{

		$(".fill_vencimiento").hide();

		$(".cmb_fil_cuedep_id").hide();

		$(".cmb_fil_tar_id").hide();

	}

	//tarjeta

	if(tipo == 2)

	{						

		$(".fill_vencimiento").hide();

		$(".cmb_fil_cuedep_id").hide();

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

	}

	//deposito

	if(tipo == 3)

	{

		$(".fill_vencimiento").hide();

		$(".cmb_fil_tar_id").hide();

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

	}

	ventapago_tabla();

}



$(function() {





	cmb_tar_id(1);

	cmb_cuedep_id(1);

	modpag_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();

	});



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

		modpag_id();

	});



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

		ventapago_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="ventapago_tabla.php">

			

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

					<label>Fecha:</label>

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

                 </div>

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

					<label>-</label>

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

                  </div>



                    <div class="col-lg-1 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-1 col-xs-6">

					<label>Modo:</label>

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

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

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

						<option value="3">DEPOSITO</option>

					</select>

			      </div>



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

					<label>Tarjeta:</label>

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

                   </div>



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

					<label>Cuenta Depósito:</label>

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

                 </div>

					

                 <div class="col-lg-2 col-xs-6" style="display:none">

					<label>Vencen:</label>

					<select style="opacity: 6" name="fill_vencimiento" id="fill_vencimiento" class="form-control">

						<option value="">-</option>

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

						<option value="2">Este Semana</option>

						<option value="3">Este Mes</option>

						<option value="3">Proximo Mes</option>

					</select>

                 </div>



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

					<button href="#" onClick="ventapago_tabla()" class="btn btn-primary">Filtrar</button>

					<button href="#" onClick="ventapago_filtro()" class="btn btn-default">Restablecer</button>

				</div>

			

         </div>

        </div>

      </div>

    </div>

  </div>

</section> 

