<?php 
session_start();
if($_SESSION["sistema"]!= "1"){ header("location: ../login/index.php"); exit();}
?>
<style type="text/css">
select{
	cursor:pointer;
}
</style>
<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Cotizaciones
			<small>modulo</small>
			</h1>
		</div>	
		
		<div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
				<li class="breadcrumb-item" >Inicio</li>
				<li class="breadcrumb-item" >Operaciónes</li>
				<li class="breadcrumb-item active">Cotizaciones</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:0%;">
		    <div class="card">
		        <div class="card-header">
		          <button id="btn_agregar" onClick="cotizacion_form('insertar')" class="btn btn-primary">Agregar</button>
		          <button id="btn_actualizar" class="btn btn-default">Actualizar</button>		        
		        </div>
		    </div>
		</div>
	</div>
	</div>
</section>
<!-- formulario de mensaje -->
			<div class="modal" id="div_mensaje_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  
			style="padding:0px; overflow-y:scroll;z-index:9999;">
			<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>		
			
			
	<!-- formulario de registro -->
			<div class="modal fade" id="div_cotizacion_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg "   style="width: 95% !important;" role="document" >
			<div class="modal-content">
			<div class="modal-body div_cotizacion_form" style="padding:0%;" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<!-- formulario de pago venta -->
			<div class="modal fade" id="div_venta_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog "  role="document" >
			<div class="modal-content">
			<div class="modal-body div_venta_form" style="padding:0%;" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			<div class="modal fade" id="div_cotizacion_correo_form" role="dialog" data-keyboard="false" data-backdrop="static" style="padding:0px; overflow-y:scroll ">
			<div class="modal-dialog modal-lg"  >
			<div class="modal-content">
			<div class="modal-body div_cotizacion_correo_conten" style="padding:0px;"   >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<!-- formulario de nuevo cliente -->
			<div class="modal fade" id="div_cliente_form_dialog" role="dialog" data-keyboard="false" 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_cliente_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<div class="modal fade" id="div_cotizacion_formitem_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">

			<div class="modal-body div_cotizacion_formitem" style="padding:0%;" >

			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			
				<!-- formulario de registro -->
			<div class="modal fade" id="div_productomarca_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-xl" style="width: 90% !important;"   role="document" >
			<div class="modal-content">
			<div class="modal-body div_productomarca_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<div class="modal fade" id="div_stock_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_stock_form" >

			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
				<div class="modal fade" id="div_productomarcacantidad_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static"  style="padding:0px;overflow-y:scroll;z-index:99999;">
			<div class="modal-dialog modal-lg" style=""   role="document" >

			<div class="modal-content">

			<div class="modal-body div_productomarcacantidad_form"  >

			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
				
<!-- Filter content -->
<div id="div_cotizacion_filtro"></div>
<!-- Table content -->
<div id="div_cotizacion_tabla"></div>
	<script type="text/javascript">
		
		function cotizacion_form_vista(act,idf){
		$('#div_cotizacion_form_dialog').modal();
		$('body').css('overflow-y','hidden');
		//$('body').css('padding-right','0px');
		$.ajax({
			type: "POST",
			url: "../cotizacion/cotizacion_form_vista.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				cotid:	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_cotizacion_form').html(div); 
			},
			success: function(html){
				$('.div_cotizacion_form').html(html);	
			},
			complete: function(){
			}
		});
	}
	
	function cotizacion_form(act,idf){
		$('#div_cotizacion_form_dialog').modal();
		$('body').css('overflow-y','hidden');
		$.ajax({
			type: "POST",
			url: "../cotizacion/cotizacion_form.php",
			async:true,
			dataType: "html",   
			position:'top',                   
			data: ({
				action: act,
				cotid:	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_cotizacion_form').html(div);
			},
			success: function(html){
				$('.div_cotizacion_form').html(html);				
			},
			complete: function(){
			}
		});
	}
	
	function verstock(pre_id,mar_id){
		$('#div_stock_form_dialog').modal();
		
		$.ajax({
			type: "POST",
			url: "../stock/stock_form_vista.php",
			async:true,
			dataType: "html",   
			        
			data: ({
				pre_id: pre_id,
				mar_id:	mar_id,
				vista : 'venta'
			}),
			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_stock_form').html(div);
			},
			success: function(html){
				$('.div_stock_form').html(html);				
			},
			complete: function(){

			}
		});
	}
	
function enviarCorreo(cotid,cliid){
	
	$('#div_cotizacion_correo_form').modal();
				
	$.ajax({
			type: "POST",
			url: "../cotizacion/cotizacion_correo_form.php",
			async:true,
			dataType: "html",
			data: ({
				cotid:cotid,
				cli_id:cliid
			}),
			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_cotizacion_correo_conten').html(div);
	        },
			success: function(html){
				$('.div_cotizacion_correo_conten').html(html);				
			}
		});
	
}
function enviar_documentos(cotid,cliid){
	
	$('#div_cotizacion_correo_form').modal();
				
	$.ajax({
			type: "POST",
			url: "../cotizacion/documento_correo_form.php",
			async:true,
			dataType: "html",
			data: ({
				cotid:cotid,
				cli_id:cliid
			}),
			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_cotizacion_correo_conten').html(div);
	        },
			success: function(html){
				$('.div_cotizacion_correo_conten').html(html);				
			}
		});
	
}
	
	function generar_pdf(cotid){	
		
		$.ajax({
			type: "GET",
			url: "../cotizacion/cotizacion_generar_doc.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			cotid: cotid
			}),
			beforeSend: function() {	
			},
			success: function(data){
			}
		});
}
	
	
	
	
		function cotizacion_filtro(){
			$.ajax({
				type: "POST",
				url: "../cotizacion/cotizacion_filtro.php",
				dataType: "html",
				beforeSend: function() {
					$('#div_cotizacion_filtro').addClass("ui-state-disabled");
				},
				success: function(html){
					$('#div_cotizacion_filtro').html(html);
				},
				complete: function(){			
					$('#div_cotizacion_filtro').removeClass("ui-state-disabled");
				}
			}); 
		}
		
		function cotizacion_tabla(){
		$('#div_mensaje_dialog').modal('show');
			$.ajax({
				type: "POST",
				url: "../cotizacion/cotizacion_tabla.php",
				dataType: "html",
				data:  $("#for_fil_cot").serialize(),
				beforeSend: function() {
					var divmen = "<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(divmen);
					$('#div_cotizacion_tabla').addClass("ui-state-disabled");
				},
				success: function(html){
					$('#div_cotizacion_tabla').html(html);
				},
				complete: function(){					
					$('#div_mensaje_dialog').modal('hide');				
					
					$('#div_cotizacion_tabla').removeClass("ui-state-disabled");
					
				}
			}); 
		}
		
	function AgregarItem(act){
		$('#div_cotizacion_formitem_dialog').modal();
	
		$.ajax({
			type: "POST",
			url: "../cotizacion/cotizacion_formitem.php",
			async:true,
			dataType: "html",     
			data: ({
				action: act
			}),
			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_cotizacion_formitem').html(div);
			},
			success: function(html){
				$('.div_cotizacion_formitem').html(html);				
			},
			complete: function(){

			}
		});
	}
	
	
	function AgregarItemeditar(act,ind,det,pre,can){
		$('#div_cotizacion_formitem_dialog').modal();
	//alert(can);
		$.ajax({
			type: "POST",
			url: "../cotizacion/cotizacion_formitem.php",
			async:true,
			dataType: "html",     
			data: ({
				action: act,
				ind:ind,
				det:det,
				pre:pre,
				can:can
			}),
			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_cotizacion_formitem').html(div);
			},
			success: function(html){
				$('.div_cotizacion_formitem').html(html);				
			},
			complete: function(){

			}
		});
	}
		
		
		function generar_venta(cotid,empid){
		
		
		$('#div_venta_form_dialog').modal();
		$('body').css('overflow-y','hidden');
		$.ajax({
			type: "POST",
			url: "../cotizacion/cotizacion_ventaform.php",
			async:true,
			dataType: "html",   
			position:'top',                   
			data: ({
				cotid:	cotid,
				empid:	empid
			}),
			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_venta_form').html(div);
			},
			success: function(html){
				$('.div_venta_form').html(html);				
			},
			complete: function(){
			}
		});
		
		
		
			/* $.ajax({
				type: "POST",
				url: "../cotizacion/cotizacion_venta.php",
				dataType: "json",
				data:  ({
					cotid:cotid
				}),
				beforeSend: function() {
					
				},
				success: function(data){
				toastr["info"](data.msj);		
				},
				complete: function(){			
					
				}
			});  */
		}
		
		
		function cotizacion_anular(id,texto){   
		if(confirm("Realmente desea anular la cotizacion Nº "+texto+", Continuar?")){
			$.ajax({
				type: "POST",
				url: "../cotizacion/cotizacion_reg.php",
				async:true,
				dataType: "json",
				data: ({
					action_cotizacion: "eliminar",
					cotid: id
				}),
				beforeSend: function() {					
				},
				success: function(data){
					/* if(data.act!='correcto')
					{
						cotizacion_anular(id);
					} */
					toastr["info"](data.msj);	
				},
				complete: function(){
					
					cotizacion_tabla();
				}
			});
		}
		else
		{			
			cotizacion_tabla();	
		}
	}
	
		function actualizarestado(cot_id,campo,valor,texto){   
		if(confirm("Realmente desea cambiar el estado de la cotizacion Nº "+texto+", Continuar?")){
			$.ajax({
				type: "POST",
				url: "../cotizacion/cotizacion_reg.php",
				async:true,
				dataType: "json",
				data: ({
					action_cotizacion: "actualizarestado",
					cotid: cot_id,
					campo: campo,
					valor: valor,
					texto:texto
				}),
				beforeSend: function() {					
				},
				success: function(data){				
					toastr["success"](data.msj);	
				},
				complete: function(){
					
					cotizacion_tabla();
				}
			});
		}
		else
		{			
			cotizacion_tabla();	
		}
	}
	
	///FACTURACION ELECTRONICAA
	
	
	
	
	
	
	
	function venta_ticket_datos(id_ven){	
		
		
		$.ajax({
			type: "POST",
			url: "../venta/venta_ticket_datos.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			venid: id_ven
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				 console.log(data); 
				
				if(data!=""){					
					if(data.ven_docabr=="F" /* && data.cli_nom !='CLIENTE' */ ){
					generarFactura_xml(data,data.url_genfac,data.emp_ruc,data.ven_numdoc,id_ven,data.cli_id);
					}else if(data.ven_docabr=="B" /* && data.cli_nom !='CLIENTE' */ ){
					generarBoleta_xml(data,data.url_genbol,data.emp_ruc,data.ven_numdoc,id_ven,data.cli_id);
					}else if(data.ven_docabr=="NV"){
						
					generar_pdf_documento(id_ven);
					//venta_ticket_impresion(data,data.imp_doc);
					
					}		
				}else{
					
				}
			}
		});
	
	}
	
function generarFactura_xml(data,url,emp_ruc,ven_numdoc,id_ven,id_cli){
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: data,
		beforeSend: function()
		{
			
		},
		success: function(data){
				
		firmar(data.url,data.arc,emp_ruc,ven_numdoc,data.tipcom,id_ven,id_cli);
		}
	});
}
function generarBoleta_xml(data,url,emp_ruc,ven_numdoc,id_ven,id_cli){
		/* alert(url); */
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: data,
		beforeSend: function()
		{
			
		},
		success: function(data){
			
 firmar(data.url,data.arc,emp_ruc,ven_numdoc,data.tipcom,id_ven,id_cli);			
			/* alert(html); */
		//tip_com = '03';
		//crear_xml(html,emp_ruc,ven_numdoc,tip_com,id_ven,id_cli);
		}
	});
}
	
	function cotizacion_ticket_datos(cot_id){	
		
		/* alert(id_ven); */
		
		$.ajax({
			type: "POST",
			url: "../cotizacion/cotizacion_ticket_datos.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			cotid: cot_id
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				 console.log(data); 
				
				if(data!=""){						
					cotizacion_ticket_impresion(data,data.imp_doc);
				}else{
					
				}
			}
		});
	
}
function cotizacion_ticket_impresion(data,url){	
	$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "html",                      
		data: data,
		beforeSend: function()
		{
			console.log(data);	
		},
		success: function(html){
				
			
		}
	});
}
	
function firmar(url,arc,emp_ruc,ven_numdoc,tipcom,id_ven,id_cli){
		/* alert(url); */
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: ({
			arc : arc,
			emp_ruc : emp_ruc,
			ven_numdoc:ven_numdoc,
			tipcom:tipcom,
			venid:id_ven
		}),
		beforeSend: function()
		{
			
		},
		success: function(data){
			
	enviarSunat(data.xml_nom,data.fil_name_zip,data.fil_name_xml,data.filenom,id_ven,id_cli,tipcom,emp_ruc);
				/* traer_datos_doc(id_ven,data.fil_name_xml); */
		}
	});
}
	
function enviarSunat(nomxml,fil_name_zip,fil_name_xml,filenom,id_ven,id_cli,tipcom,emp_ruc){
	
		$.ajax({
		type: "POST",
		url: '../../docgeneracion/enviosunat.php',
		async:true,
		dataType: "json",                      
		data: ({
			nomxml:nomxml,
			name_zip:fil_name_zip,
			nomfile:filenom,
			id_ven:id_ven,
			xmlarchivo:fil_name_xml,
			tipcom:tipcom,
			emp_ruc:emp_ruc
		}),
		beforeSend: function()
		{
			toastr["error"]('Esperando respuesta de sunat');
		},
		success: function(data){
			if(data.est==1){
				//enviarCorreo(id_ven,id_cli);
				traer_datos_doc(id_ven,fil_name_xml);
				generar_pdf_documento(id_ven);
				//venta_tabla();
			}else{
				toastr["info"]('El documento no se ha emitido.');
			}
			
			toastr["info"](data.msj);
				
		}
	});
}	
function traer_datos_doc(venid,urlxml){
	
	$.ajax({
			type: "POST",
			url: "../venta/venta_doc_datos.php",
			async:true,
			dataType: "json",                      
			data:({ 
			venid: venid,
			urlxml :urlxml
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				/* console.log(data); */
				
			venta_doc_impresion(data,data.imp_doc);
			/* if(data.cli_ema==""){
				
			}else{
				act ="enviar";
				enviarCorreo(data);
			}	 */	
			
			}
		});
	
}
function venta_doc_impresion(data,url){
	$.ajax({
			type: "POST",
			url: url,
			async:true,
			dataType: "json",                      
			data: data ,
			beforeSend: function() {
				console.log(data);
			},
			success: function(data){
				
				
			}
		});
}
	
	///// GUIA ELECTRONICAA 
	
	
	
	
function guia_ticket_datos(id_guia){	
		
		
		$.ajax({
			type: "POST",
			url: "../guiaremision/guia_ticket_datos.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			guiaid: id_guia
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				 console.log(data); 
				
				if(data!=""){					
				//alert(data.guia_docAbr);
					if(data.guia_docAbr=="T" /* && data.cli_nom !='CLIENTE' */ ){
					generarGuia_xml(data,data.url_genguia,data.emp_ruc,data.guia_numdoc,id_guia,data.cliId);
					}
				}else{
					
				}
			}
		});
	
}
	
	
function generarGuia_xml(data,url,emp_ruc,guia_numdoc,guia_id,id_cli){
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: data,
		beforeSend: function()
		{
			
		},
		success: function(data){
				// alert(data.arc+' - '+emp_ruc+' - '+guia_numdoc+' - '+data.tipcom); 
		firmarGuia(data.url,data.arc,emp_ruc,guia_numdoc,data.tipcom,guia_id,id_cli);
		}
	});
}
	
	
	
	
function firmarGuia(url,arc,emp_ruc,guia_numdoc,tipcom,guia_id,id_cli){
		
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: ({
			arc : arc,
			emp_ruc : emp_ruc,
			ven_numdoc:guia_numdoc,
			tipcom:tipcom,
			venid:guia_id
		}),
		beforeSend: function()
		{
			
		},
		success: function(data){
			
	enviarSunatguia(data.xml_nom,data.fil_name_zip,data.fil_name_xml,data.filenom,guia_id,id_cli,tipcom,emp_ruc);
				/* traer_datos_doc(id_ven,data.fil_name_xml); */
		}
	});
}
function enviarSunatguia(nomxml,fil_name_zip,fil_name_xml,filenom,guia_id,id_cli,tipcom,emp_ruc){
	
	//alert(filenom);
	//$('#div_mensaje_dialog').modal();
	
		$.ajax({
		type: "POST",
		url: '../../docgeneracion/enviosunatguia.php',
		async:true,
		dataType: "json",                      
		data: ({
			nomxml:nomxml,
			name_zip:fil_name_zip,
			nomfile:filenom,
			guia_id:guia_id,
			xmlarchivo:fil_name_xml,
			tipcom:tipcom,
			emp_ruc:emp_ruc
		}),
		beforeSend: function()
		{
		//	var div = "<center><div class='overlay col-lg-12 col-sm-12 col-xs-12' style='background-color:#fff;padding:0%;font-size:3rem;' >  <i class='fa fa-refresh fa-spin ' ></i> ESPERANDO SOLICITUD DE SUNAT...</div>  </center>";	
			//	$('.div_mensaje').html(div);
			toastr["error"]('Esperando respuesta de sunat');
		},
		success: function(data){
			if(data.est==1){
				//enviarCorreo(id_ven,id_cli);
				traer_datos_docguia(guia_id,fil_name_xml);
				generar_pdf_guia(guia_id);
				//venta_tabla();
			}else{
				toastr["info"]('El documento no se ha emitido.');
			}
			toastr["info"](data.msj);
			
			//$('#div_mensaje_dialog').modal('hide');
		}
	});
}	
function traer_datos_docguia(guia_id,urlxml){
	
	$.ajax({
			type: "POST",
			url: "../guiaremision/guia_doc_datos.php",
			async:true,
			dataType: "json",                      
			data:({ 
			guia_id: guia_id,
			urlxml :urlxml
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				/* console.log(data); */
				
			guia_doc_impresion(data,data.imp_doc);
			/* if(data.cli_ema==""){
				
			}else{
				act ="enviar";
				enviarCorreo(data);
			}	 */	
			
			}
		});
	
}
function guia_doc_impresion(data,url){
	$.ajax({
			type: "POST",
			url: url,
			async:true,
			dataType: "json",                      
			data: data ,
			beforeSend: function() {
				console.log(data);
			},
			success: function(data){
				
				
			}
		});
}
	function generar_pdf_documento(venid)
	{	
	    //alert(venid);
		$.ajax({
			type: "GET",
			url: "../venta/venta_generar_doc.php",
			async:true,
			dataType: "json",                      
			data: ({
			venid: venid
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				
				}
		});
	
	}
	
	function generar_pdf_guia(guiaid){	
		$.ajax({
			type: "GET",
			url: "../guiaremision/guiaremision_generar_doc.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			guiaid: guiaid
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				
				}
		});
	
	}	
	
$(function() {
			cotizacion_filtro();
			
			$('#btn_actualizar').click(function() {
				$("#contenido").load("../cotizacion/cotizacion_vista.php");
			});
			
			$("#div_cliente_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','hidden');
			});
			
			
			$("#div_venta_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','scroll');
			
			});
			
			$("#div_cotizacion_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','scroll');
			});
	
	
			$("#div_mensaje_dialog").on('hidden.bs.modal', function () {
			$('body').css('padding-right','0px');
			});
	
	
			setTitle("COTIZACION - "+nombreEmpresa);
		});
	</script>