<div class="content-wrapper">

<!-- Content Header (Page header) -->

<section class="content-header">

  <h1>

    Compra Pago

    <small>modulo</small>

  </h1>

  <ol class="breadcrumb">

    <li><a href="#"><i class="fa fa-dashboard"></i> Inicio</a></li>

    <li><a href="#">Modulos</a></li>

    <li class="active"> Compra Pago</li>

  </ol>

</section>

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

	<div class="row">

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

		    <div class="box">

		        <div class="box-header">

		          <button id="btn_agregar" onClick="comprapago_form('insertar')" class="btn btn-primary">Agregar</button>

		          <button id="btn_actualizar" class="btn btn-default">Actualizar</button>

		          <div id="msj_comprapago" class="alert alert-info pull-right" style="padding:2px;margin-bottom:0px;display:none"></div>

		          <!--<h3 class="box-title">Listado de Clientes</h3>-->

		        </div>

		    </div>

		</div>

	</div>

</section>





<!-- Filter content -->

<div id="div_comprapago_filtro"></div>

<!-- Table content -->



<!-- Form content -->

<div id="div_comprapago_tabla"></div>

<!--  <div id="div_comprapago_tabla"></div> -->

</div>









<script type="text/javascript">



function comprapago_filtro()

{

	$.ajax({

		type: "POST",

		url: "../comprapago/comprapago_filtro.php",

		async:true,

		dataType: "html",                      

		beforeSend: function() {

			$('#div_comprapago_filtro').html('Cargando..');

        },

		success: function(html){

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

		},

		complete: function(){

			comprapago_tabla();



			setTitle("Compra pago- "+nameofempresa);

		}

	});

}



function compra_form(act,idf,pagar){

			$.ajax({

				type: "POST",

				url: "../compra/compra_form.php",

				async:true,

				dataType: "html",                      

				data: ({

					action: act,

					com_id:	idf,

					com_pagar:pagar

				}),

				beforeSend: function() {

					$('#msj_compra').hide();

					$('#div_compra_form').dialog("open");

					$('#div_compra_form').html('Cargando..');

				},

				success: function(html){

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

				}

			});

		}









function comprapago_tabla()

{

	$.ajax({

		type: "POST",

		url: "../comprapago/comprapago_tabla.php",

		async:true,

		dataType: "html",

		data: $("#for_fil_ven").serialize(),

		beforeSend: function() {

			$('#msj_comprapago_tabla').html("Cargando datos...");

			$('#msj_comprapago_tabla').show(100);

			$('#div_comprapago_tabla').addClass("ui-state-disabled");

        },

		success: function(html){

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

		},

		complete: function(){			

			$('#div_comprapago_tabla').removeClass("ui-state-disabled");

			$('#msj_comprapago_tabla').hide(100);

		}

	});     

}











$(function() {

	

	$('#btn_actualizar').button({

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

		text: true

		}).click(function() {

		location.reload();

	});

	

	$('#btn_agregar').button({

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

		text: true

	});

	$('.btn_modo').button({

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

		text: true

	});

	$('.imprimir_pdf').button({

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

		text: true

	});

	

	$('#btn_imprimir_xls').button({

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

		text: true

	});

		

	comprapago_filtro();



	$( "#div_compra_form" ).dialog({

			title:'Información de Compra | <?php echo $_SESSION["empresa_nombre"]?>',

			autoOpen: false,

			resizable: false,

			height: 'auto',

			width: 980,

			modal: true,

			position: "top",

			closeOnEscape: false,

			buttons: [				

				{

					text : 'Ok',

					id: 'btn_form_com_cancelar',

					click : function(){

						$('#for_com').each (function(){this.reset();});

						$( this ).dialog( "close" );

					}

				},

			]

		});

	

	

});





</script>



















