<?php 

session_start();
if($_SESSION["sistema"]!= "1"){ header("location: ../login/index.php"); exit();}



?>


<style type="text/css">

	select{
		cursor:pointer;	
	}

	div#tabla_ingreso { margin: 0 0; }
	div#tabla_ingreso table { margin: 0 0; border-collapse: collapse;}
	div#tabla_ingreso table td, div#tabla_ingreso table th { border: 1px solid #eee; padding: 3px 8px; font-size:10px; }
	div#tabla_ingreso table th { height:16px }
	
</style>




<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Caja General
			<small>Operación</small>
			</h1>
		</div>	
		
		<div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
				<li class="breadcrumb-item" >Inicio</li>
				<li class="breadcrumb-item" >Consulta</li>
				<li class="breadcrumb-item active">Caja General</li>
            </ol>
          </div>
		</div>
	</div>
</div>

<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:0px;"  >
		    <div class="card">
		        <div class="card-header">
					<button id="btn_actualizar" class="btn btn-default "> Actualizar</button>
				<span class="btn btn-sm float-right " id="btn_pdf" style="background-color:#00897b;color:#fff;text-align:left" ><i class="fa fa-file-pdf"></i>  DESCARGAR E IMPRIMIR RESUMEN</span>	
				</div>
		    </div>
		</div>
	</div>
	</div>
</section>


<div class="modal fade" id="div_ventamanual_form_dialog_vista" role="dialog" data-keyboard="true" tabindex="-1"  style="padding:0px;">
			<div class="modal-dialog modal-xl" style="width: 95% !important;" role="document" >

			<div class="modal-content">

			<div class="modal-body div_ventamanual_form_vista" >

			</div>
			<br />
			<br />
			</div>
			</div>
	</div>
	

	<!-- formulario de mensaje -->
			<div class="modal fade" id="div_mensaje_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-md"  role="document" >

			<div class="modal-content" style="padding:0px;">

			<div class="modal-body div_mensaje"  >

			
		
			
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>		
			
		
			<div class="modal fade" id="div_ingreso_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >

			<div class="modal-content"  >

			<div class="modal-body div_ingreso_form" >

			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			

	
				<div class="modal fade" id="div_cobros_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >

			<div class="modal-content"  >

			<div class="modal-body div_cobros_form" >

			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			
		<!-- busqueda de registros -->	
		<div id="div_compra_filtro"></div>
		<!-- tabla de registros -->	
		<div id="div_compra_tabla"></div>


	<script type="text/javascript">
	
		function cajageneral_cst_filtro()
		{
			$.ajax({
				type: "POST",
				url: "../cajageneral_cst/cajageneral_cst_filtro.php",
				async:true,
				dataType: "html",                      
			data: ({ }),
			beforeSend: function() {
				
				var div = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
		
				$('#div_compra_filtro').html(div);
			},
			success: function(html){
				$('#div_compra_filtro').html(html);
			},
			complete: function(){
				
			}
		});
		}


function ventamanual_form_vista(act,idf){
		$('#div_ventamanual_form_dialog_vista').modal();
		
		$.ajax({
			type: "POST",
			url: "../ventamanual/ventamanual_form_vista.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				ven_id:	idf
			}),
			beforeSend: function() {
				var div = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
		$('.div_ventamanual_form_vista').html(div); 
			},
			success: function(html){
				$('.div_ventamanual_form_vista').html(html);	
			},
			complete: function(){
			}
		});
	}


		function cajageneral_cst_tabla()
		{
			$('#div_mensaje_dialog').show('fade');
			$.ajax({
				type: "POST",
				url: "../cajageneral_cst/cajageneral_cst_tabla.php",
				async:true,
				dataType: "html",                      
				data: $("#for_fil_com").serialize(), 
				beforeSend: function() {
						var div = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
						$('.div_mensaje').html(div);
						
						$('#div_compra_tabla').addClass("ui-state-disabled");
				},
				success: function(html){
					$('#div_compra_tabla').html(html);
				},
				complete: function(){			
					$('#div_compra_tabla').removeClass("ui-state-disabled");
					
					$('#div_mensaje_dialog').hide('fade');
					
			}
			});     
		}
	
	
		function abrirEnPestana(url) {
		var a = document.createElement("a");
		a.target = "_blank";
		a.href = url;
		a.click();
	}
	
		$(function(){ 

		
		$("#btn_pdf").click(function(){
			txt_fil_com_fec1 = $("#txt_fil_com_fec1").val();
			txt_fil_com_fec2 = $("#txt_fil_com_fec2").val();
			cmb_fil_puntoventa_id = $("#cmb_fil_puntoventa_id").val();
			
			abrirEnPestana('../../files/cajageneral/cajageneral_impcpe_doc.php?fec1='+txt_fil_com_fec1
			+'&fec2='+txt_fil_com_fec2
			+'&punven_id='+cmb_fil_puntoventa_id);
		});



		$('#btn_actualizar').click(function(){
			$("#contenido").load("../cajageneral_cst/cajageneral_cst_vista.php");
		});
 
		$("#div_mensaje_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','scroll');
		});
 
		//$("body").addClass('sidebar-collapse');
 
		cajageneral_cst_filtro(); 
		
		setTitle("CAJA GENERAL - "+nombreEmpresa);	

		});
	</script>
	<script src="../../admin/dist/js/uploadifive/jquery.uploadifive.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../../admin/dist/js/uploadifive/uploadifive.css"> 

<link rel="stylesheet" href="../../admin/dist/js/colorbox/example1/colorbox.css">
<script src="../../admin/dist/js/colorbox/jquery.colorbox-min.js"></script>

