
lbDate().init;
/*                                            INICIO INSTANCIA DE STORE VUEX                                            */


const store = new Vuex.Store({
  	state: {
		layout_visible: 'layout_login',
		modal_visible: '',
		modo_seleccion: 'todo',
		hayconexion: true,
		control_cambios: false,
		centro: {latitud: -34.906563, longitud: -56.186266, zoom: 17},
		centro_gps: {latitud: -34.906563, longitud: -56.186266, zoom: 17},
		centro_mapa: {latitud: -34.906563, longitud: -56.186266, zoom: 17},
		toast_abierto: false,
		alerta: false,
		alerta_mensaje: [],
		datos_login: { usuario: '' , password: '', email: '', permisos: '', fecha: '', celular: '', empresa: '',mensaje: '', nivel_acceso: 0},
		usuarios: [],
		conexiones_eliminadas: [],
		datos_log: [],
		conexiones_en_mapa: [],
		camaras1_en_mapa:[],
		colectores_en_mapa: [],
		camaras_en_mapa: [],
		calles_en_mapa: [],
		padrones_en_mapa: [],
		datos_en_mapa: [],
		nueva_conexion:'',
		conexion_seleccionada: {id:0,lon1:0,lat1:0,lon2:0,lat2:0,padron:0,colector:0,profundidad:'',tipo:'',seccion:'',distmed: 0, distmei: 0, alta_fuent:'',alta_descr:'',alta_fecha:'',servicios:'',tgms:'',oses:'',medidores:'',sur:'',historial:'',etapa:'',ccz:'',accion:'',fotos:'',audios:'',activo:'',puertas:'',z_col:0,via:0,id_tramite:'',id_con_ant:0,calle:'',tramite:'',empresa:'',descripcion:'',foto_blob:'', fotos_con_fecha: [], audios_con_fecha: []},
		padron_seleccionado: 0,
		colector_seleccionado: 0,
		calle_seleccionada: '',
		via_seleccionada: 0,
		audio_temporal: {blob: [],archivo:''},
		dato_temporal: '',
		datos_filtro1: {zona:0,id:0,padron:0,calle1:'',calle2:'',colector:0},
		calles: [''],
		calles_cruzan: [''],
		datos_consulta_distribuida: {certificado:false,certificado_valor:'Con certificado',tramite:false,tramite_valor:'Nueva Inicio',sur:false,sur_valor:'Sin reclamos',servicios:false,servicios_valor:'Sin tarifa',fuente:false,fuente_valor:'Otros',etapa:false,etapa_valor:'Sin asignar',accion:false,accion_valor:'Sin asignar',ccz:false,ccz_valor:'CCZ01',calle:false,calle_valor:'YI',fecha:false,fecha1_valor:new Date(),fecha2_valor:new Date()},
		modo_conexiones: 0,
		descripcion_consulta_distribuida: '',
		color_anterior: 'green',
		color_anterior_colector: 'green',
		indicadores: [],
		mantenimiento: [],
		monitoreo: [],
		movimientos: [],
        adm_tipos: [],
        adm_clases: [],
        adm_contratos: [],
        adm_proyectos: []
	},
/*INICIO DE GETTERS 
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111*/	
	getters: {

	},

/*INICIO DE MUTATIONS 
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222*/
  	mutations:{

	},
/*INICIO DE ACTIIONS 
3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333*/
	actions: {
		},

})

/*                                              FIN DE DEFINICION DE STORE VUEX                                            */




/*                                              INICIO INSTANCIA DE VUE                                                    */
var app = new Vue({
  el: '#app',
  data: {
		  pagina_visible: 'dl_login',
		  visitCount: 33,
		  hideCompletedTodos: false,
		  todos: [],
		  error: null,
		  time: '13:20',
		  location:null,
		  gettingLocation: false,
		  errorStr:null
		},	
  store:store,


  	/*
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
INICIO DE METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS
	*/  
  methods: {
			marca_ayuda: function(lat,lon,mapa){
				var latlngini = [lat,lon];
				var marca = L.circle(latlngini, {
					color: 'red',
					fillColor: '#59D52A',
					fillOpacity: 1,
					radius:0.5
				}).addTo(mapa);	
			},
			chequeo_conexion: function(){
								var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
								var type = '';
								connection !== undefined ? type = connection.effectiveType : type = '';
								store.state.hayconexion = false;
								if(navigator.onLine) {
									store.state.hayconexion = true;
									if (type == '2g' || type == 'slow-2g')
									{
										store.state.hayconexion = false;
									}
									}
								},
			obtengo_ubicacion: async function(){
								if("geolocation" in navigator) {
									navigator.geolocation.getCurrentPosition(pos => {
										if ((pos.coords.latitude > -34.94 && pos.coords.latitude < -34.69) && (pos.coords.longitude > -56.44 && pos.coords.longitude < -55.99))
										{
										store.state.centro_gps.latitud = pos.coords.latitude;
										store.state.centro_gps.longitud = pos.coords.longitude;
										}
										else
										{
											store.state.centro_gps.latitud = -34.906563;
											store.state.centro_gps.longitud = -56.186266;	
										}
										store.state.centro_mapa.latitud = store.state.centro_gps.latitud;
										store.state.centro_mapa.longitud = store.state.centro_gps.longitud;	
																})
								}
								},
			texto_normalizo: function(cadena){
				cadena = cadena.replace(/Ã/g, "Á");
				cadena = cadena.replace(/Ã¡/g, "á");
				cadena = cadena.replace(/Ã‰/g, "É");
				cadena = cadena.replace(/Ã©/g, "é");
				cadena = cadena.replace(/Ã/g, "Í");
				cadena = cadena.replace(/Ã­/g,  "í");
				cadena = cadena.replace(/Ã“/g, "Ó");
				cadena = cadena.replace(/Ã³/g, "ó");
				cadena = cadena.replace(/Ãš/g, "Ú");
				cadena = cadena.replace(/Ãº/g, "ú");
				cadena = cadena.replace(/Ã/g, "Ñ");
				cadena = cadena.replace(/Ã±/g, "ñ");
									return cadena;
								},
			obtengo_fecha: function(fecha){
				fecha.setHours(fecha.getHours()-3);
									var fecha2=  fecha.toISOString();
									var parte1 = fecha2.split("T")[0];
									var parte2 = fecha2.split("T")[1].substr(0,8);
									parte2 = parte2.replace(/-/g,":");
									return parte1 + " " + parte2;
								},
			limpio_mapa: function(mapa,alcance){

							if(typeof store.state.colectores_en_mapa !== 'undefined')
							{
								for(var i=0;i<store.state.colectores_en_mapa.length; i++)
								{
								store.state.colectores_en_mapa[i].remove(mapa);
								}
							}
							store.state.colectores_en_mapa = [];
							if(typeof store.state.camaras_en_mapa !== 'undefined'){
								for(var i=0;i<store.state.camaras_en_mapa.length; i++)
								{
								store.state.camaras_en_mapa[i].remove(mapa);
								}
							}
							store.state.colectores_en_mapa = [];
							store.state.camaras_en_mapa = [];
							if(typeof store.state.calles_en_mapa !== 'undefined'){
								for(var i=0;i<store.state.calles_en_mapa.length; i++)
								{
								store.state.calles_en_mapa[i].remove(mapa);
								}
							}
							store.state.calles_en_mapa = [];
							if(typeof store.state.padrones_en_mapa !== 'undefined'){
								for(var i=0;i<store.state.padrones_en_mapa.length; i++)
								{
								store.state.padrones_en_mapa[i].remove(mapa);
								}
							}
								store.state.padrones_en_mapa = [];

							if(alcance == 0)
							{	
								if(typeof store.state.conexiones_en_mapa !== 'undefined'){
									for(var i=0;i<store.state.conexiones_en_mapa.length; i++)
									{
									store.state.conexiones_en_mapa[i].remove(mapa);
									}
								}
								store.state.conexiones_en_mapa = [];
								if(typeof store.state.camaras1_en_mapa !== 'undefined'){
									for(var i=0;i<store.state.camaras1_en_mapa.length; i++)
									{
									store.state.camaras1_en_mapa[i].remove(mapa);
									}
								}
								store.state.camaras1_en_mapa = [];
								}
			},
			limpio_mantenimiento: function(mapa){
				if(typeof store.state.mantenimiento !== 'undefined')
				{
					for(var i=0;i<store.state.mantenimiento.length; i++)
					{
					store.state.mantenimiento[i].remove(mapa);
					}
				}
				store.state.mantenimiento = [];
			},		
			limpio_monitoreo: function(mapa){
				if(typeof store.state.monitoreo !== 'undefined')
				{
					for(var i=0;i<store.state.monitoreo.length; i++)
					{
					store.state.monitoreo[i].remove(mapa);
					}
				}
				store.state.monitoreo = [];
			},							
			cargo_saneamiento: function(mapa,datos){
										store.state.modo_conexiones = 0;
										app.limpio_mapa(mapa,0);
									//---------------------COMIENZA FUNCION QUE CARGA COLECTORES DE SANEAMIENTO AL MAPA_______________________________________________________________________________________
										for(var i=0;i< datos[1].length;i++){
													var geom = datos[1][i]["geom"];
													var latlng_ini = [];
													var latlng_fin = [];
													var solocoord = geom.substring(11);
													solocoord = solocoord.slice(0,-1);
													var latlngs1 = solocoord.split(",");
													var latlngs = [];
													for (var j=0; j<latlngs1.length; j++)
													{
														var elemento = (latlngs1[j].split(" "));
														elemento = elemento.reverse();
														latlngs.push(elemento);
														if (j == 0){latlng_ini = elemento};
														if (j == latlngs1.length - 1){latlng_fin =  elemento};
													}
													var colector = L.polyline(latlngs, {
																color: '#D5872A',
																opacity: 1,
																weight: 8,
																customData:{
																	tiposec:datos[1][i]["tiposec"],
																	tipotra:datos[1][i]["tipotra"],
																	elemred:datos[1][i]["elemred"],
																	dim1:datos[1][i]["dim1"],
																	dim2:datos[1][i]["dim2"],
																	zarriba:datos[1][i]["zarriba"],
																	zabajo:datos[1][i]["zabajo"],
																	longitud:datos[1][i]["longitud"],
																	desc_tramo:datos[1][i]["desc_tramo"],
																	desc_secci:datos[1][i]["desc_secci"]
																}
														}).bindTooltip("<div style='background:#D5872A; padding:1px 3px 1px 3px'><b>Elemred:" + datos[1][i]["elemred"] + "</b><br><b>Dim1:" + datos[1][i]["dim1"].substring(0,5) + "</b><br><b>ZAa:" + datos[1][i]["zarriba"].substring(0,5) + "</b><br><b>ZAb:" + datos[1][i]["zabajo"].substring(0,5) + "</b></div>", 
																{
																			direction: 'right',
																			permanent: false,
																			sticky: true,
																			offset: [10, 0],
																			opacity: 0.75,
																			className: 'leaflet-tooltip-own' 
																}).addTo(mapa).on('click',function(e){
																	if (store.state.modo_seleccion == 'todo' || store.state.modo_seleccion == 'colector')
																	{
																		for(var j=0; j<store.state.colectores_en_mapa.length;j++)
																		{
																			store.state.colectores_en_mapa[j].setStyle({color:'#D5872A'});
																		}
																		this.setStyle({color:'yellow'});
																		store.state.alerta_mensaje = [];
																		store.state.alerta_mensaje.push("Elemred: " + this.options.customData.elemred);
																		store.state.alerta_mensaje.push("Longitud: " + this.options.customData.longitud.substring(0,4));
																		store.state.alerta_mensaje.push("Tiposec: " + this.options.customData.tiposec);
																		store.state.alerta_mensaje.push("Tipotra: " + this.options.customData.tipotra);
																		store.state.alerta_mensaje.push("Dim1: " + this.options.customData.dim1.substring(0,5));
																		store.state.alerta_mensaje.push("Dim2: " + this.options.customData.dim2.substring(0,5));
																		store.state.alerta_mensaje.push("Zarriba: " + this.options.customData.zarriba.substring(0,5));
																		store.state.alerta_mensaje.push("Zabajo: " + this.options.customData.zabajo.substring(0,5));
																		store.state.alerta_mensaje.push("Descripción: " + app.texto_normalizo(this.options.customData.desc_tramo));
																		store.state.alerta_mensaje.push("Seccion: " + this.options.customData.desc_secci);																		
																		store.state.colector_seleccionado = this.options.customData.elemred;
																		store.state.alerta = true;
																	}
																});
																var camara = L.circle(latlng_ini, {
																	color: '#D5872A',
																	fillColor: '#D5872A',
																	fillOpacity: 1,
																	radius: 1
																}).addTo(mapa);	
													store.state.colectores_en_mapa.push(colector);			
													store.state.camaras_en_mapa.push(camara);
											};
										//*******************FIN FUNCION QUE CARGA LOS COLECTORES DE SANEAMIENTO AL MAPA_______________________________________________________________________________________	
										//---------------------COMIENZA FUNCION QUE CARGA LOS EJES DE CALLE AL MAPA_______________________________________________________________________________________
											
											for(var i=0;i< datos[2].length;i++){
												var geom = datos[2][i]["geom"];
												var solocoord = geom.substring(11);
												solocoord = solocoord.slice(0,-1);
												var latlngs1 = solocoord.split(",");
												var latlngs = [];
												for (var j=0; j<latlngs1.length; j++)
												{
													var elemento = (latlngs1[j].split(" "));
													latlngs.push(elemento.reverse());
												}
												var calle = L.polyline(latlngs, {
															color: 'black',
															opacity: 0.5,
															weight: 4,
															customData:{
																nom_calle:datos[2][i]["nom_calle"],
																cod_nombre:datos[2][i]["cod_nombre"]
															}
													}).bindTooltip("<div style='background:black;color:white; padding:1px 3px 1px 3px'><b>" + datos[2][i]["cod_nombre"] + "-" + datos[2][i]["nom_calle"] + "</b></div>", 
															{
																		direction: 'left',
																		permanent: false,
																		sticky: true,
																		offset: [10, 0],
																		opacity: 0.75,
																		className: 'leaflet-tooltip-own' 
															}).addTo(mapa).on('click',function(e){
																if (store.state.modo_seleccion == 'calle' || store.state.modo_seleccion == 'todo')
																{
																	for(var j=0; j<store.state.calles_en_mapa.length;j++)
																	{
																		store.state.calles_en_mapa[j].setStyle({color:'black', weight:4});
																	}
																	this.setStyle({color:'cyan', weight: 8});
																	store.state.calle_seleccionada = this.options.customData.nom_calle;
																	store.state.via_seleccionada = this.options.customData.cod_nombre;
																	store.state.alerta_mensaje = [];
																	store.state.alerta_mensaje.push("Calle: " + this.options.customData.nom_calle);
																	store.state.alerta_mensaje.push("Via: " +  this.options.customData.cod_nombre);
																	store.state.alerta = true;
																}
															});
												store.state.calles_en_mapa.push(calle);
											};
											//*******************FIN FUNCION QUE CARGA LOS EJES DE CALLE AL MAPA_______________________________________________________________________________________	
											//---------------------COMIENZA FUNCION QUE CARGA LOS PADRONES AL MAPA_______________________________________________________________________________________


												for(var i=0;i< datos[3].length;i++){
													var geom = datos[3][i]["geom"];
													var solocoord = geom.substring(9);
													solocoord = solocoord.slice(0,-2);
													var latlngs1 = solocoord.split(",");
													var latlngs = [];
													for (var j=0; j<latlngs1.length; j++)
													{
														var elemento = (latlngs1[j].split(" "));
														latlngs.push(elemento.reverse());
													}
													var color_padron = 'grey';
													if (datos[3][i]["saneado"] != 1){color_padron = 'yellow';};
													var padron = L.polygon(latlngs, {
																color: color_padron,
																opacity: 0.5,
																weight: 3,
																customData:{
																	padron:datos[3][i]["padron"],
																	saneado:datos[3][i]["saneado"]
																}
														}).bindTooltip("<div style='background:black;color:white; padding:1px 3px 1px 3px'><b>" + datos[3][i]["padron"] + "</b></div>", 
																{
																			direction: 'left',
																			permanent: false,
																			sticky: true,
																			offset: [10, 0],
																			opacity: 0.75,
																			className: 'leaflet-tooltip-own' 
																}).addTo(mapa)
																.on('click',function(e){
																	if (store.state.modo_seleccion == 'todo' || store.state.modo_seleccion == 'padron')
																	{
																			var mensaje = 'Sin datos comerciales';
																			var servicios = '';
																			var tgms = '';
																			var oses = '';
																			var medidores = '';
																			var puertas = '';
																			for(var j=0; j<store.state.padrones_en_mapa.length;j++)
																			{
																				let color_padron = 'grey';
																				if (store.state.padrones_en_mapa[j].options.customData.saneado != 1){color_padron = 'yellow';};
																				store.state.padrones_en_mapa[j].setStyle({color:color_padron});
																			}
																			for(var i=0;i< datos[4].length;i++){
																				if (datos[4][i]["padron"] == this.options.customData.padron)
																				{
																					servicios = servicios + datos[4][i]["servicio"] + ' ';
																					tgms = tgms + datos[4][i]["tgms"] + ' ';
																					oses = oses + datos[4][i]["oses"] + ' ';
																					medidores = medidores + datos[4][i]["medidores"] + ' '; 
																					if(puertas.indexOf(datos[4][i]["puertas"]) == -1)
																					{
																					puertas = puertas + datos[4][i]["puertas"] + ' ';
																					}
																				}
																			}

																			store.state.alerta_mensaje = [];
																			store.state.alerta_mensaje.push("Padron: " + this.options.customData.padron);
																			store.state.alerta_mensaje.push("Servicios: " +  servicios);
																			store.state.alerta_mensaje.push("Tgms: " + tgms);
																			store.state.alerta_mensaje.push("Oses: " + oses);
																			store.state.alerta_mensaje.push("Medidores: " + medidores);
																			store.state.alerta_mensaje.push("Puertas: " + puertas);
																			this.setStyle({color:'orange'});
																			store.state.padron_seleccionado = this.options.customData.padron;
																			store.state.alerta = true;
																		}
												});
												store.state.padrones_en_mapa.push(padron);
												};
												//*******************FIN FUNCION QUE CARGA LOS PADRONES AL MAPA_______________________________________________________________________________________	
												//---------------------COMIENZA FUNCION QUE CARGA CONEXIONES DE SANEAMIENTO AL MAPA_______________________________________________________________________________________
													

												for(var i=0;i< datos[0].length;i++){
														var lat1 = datos[0][i]["lat1"];
														var lon1 = datos[0][i]["lon1"];
														var lat2 = datos[0][i]["lat2"];
														var lon2 = datos[0][i]["lon2"];
														var latlngs = [[lat1,lon1],[lat2,lon2]];
														var latlngini = [lat1,lon1];
														if (datos[0][i]["etapa"] == 'Proyectada' || datos[0][i]["etapa"] == 'Solicitada')
														{
															var dasharrayvalue = '10,10';
															var dashoffsetvalue = '0';
															var opacityvalue = 0.5;
														}
														else
														{
															var dasharrayvalue = null;
															var dashoffsetvalue = null;
															var opacityvalue = 1;
														}
														var conexion = L.polyline(latlngs, {
																	color: 'green',
																	opacity: opacityvalue,
																	weight: 5,
																	dashArray: dasharrayvalue,
																	dashOffset: dashoffsetvalue,
																	customData:{
																		id:datos[0][i]["id"],
																		lon1:datos[0][i]["lon1"],
																		lat1:datos[0][i]["lat1"],
																		lon2:datos[0][i]["lon2"],
																		lat2:datos[0][i]["lat2"],
																		padron:datos[0][i]["padron"],
																		colector:datos[0][i]["colector"],
																		profundidad:datos[0][i]["profundidad"],
																		tipo:datos[0][i]["tipo"],
																		seccion:datos[0][i]["seccion"],
																		distmed:datos[0][i]["distmed"],
																		distmei:datos[0][i]["distmei"],
																		alta_fuent:datos[0][i]["alta_fuent"],
																		alta_descr:datos[0][i]["alta_descr"],
																		alta_fecha:datos[0][i]["alta_fecha"],
																		servicios:datos[0][i]["servicios"],
																		tgms:datos[0][i]["tgms"],
																		oses:datos[0][i]["oses"],
																		medidores:datos[0][i]["medidores"],
																		sur:datos[0][i]["sur"],
																		historial:datos[0][i]["historial"],
																		etapa:datos[0][i]["etapa"],
																		ccz:datos[0][i]["ccz"],
																		accion:datos[0][i]["accion"],
																		fotos:datos[0][i]["fotos"],
																		audios:datos[0][i]["audios"],
																		activo:datos[0][i]["activo"],
																		puertas:datos[0][i]["puertas"],
																		z_col:datos[0][i]["z_col"],
																		via:datos[0][i]["via"],
																		id_tramite:datos[0][i]["id_tramite"],
																		id_con_ant:datos[0][i]["id_con_ant"],
																		calle:datos[0][i]["calle"],
																		empresa:datos[0][i]["empresa"],
																		tramite:datos[0][i]["tramite"],
																		descripcion:datos[0][i]["descripcion"]
																	}
															}).bindTooltip("<div style='background:green; padding:1px 3px 1px 3px'><b>Id:" + datos[0][i]["id"] + "</b><br><b>Zcol:" + datos[0][i]["z_col"].substring(0,5) + "</br></div>", 
															{
																		direction: 'right',
																		permanent: false,
																		sticky: true,
																		offset: [10, 0],
																		opacity: 0.75,
																		className: 'leaflet-tooltip-own' 
															}).addTo(mapa).on('click',function(e){
																	if (store.state.modo_seleccion == 'todo' || store.state.modo_seleccion == 'conexion')
																		{
																			for(var j=0; j<store.state.conexiones_en_mapa.length;j++)
																			{
																				store.state.conexiones_en_mapa[j].setStyle({weight:5});
																			}
																			this.setStyle({weight:12});
																		store.state.conexion_seleccionada.id = this.options.customData.id;
																		store.state.conexion_seleccionada.lon1=this.options.customData.lon1;
																		store.state.conexion_seleccionada.lat1=this.options.customData.lat1;
																		store.state.conexion_seleccionada.lon2=this.options.customData.lon2;
																		store.state.conexion_seleccionada.lat2=this.options.customData.lat2;
																		store.state.conexion_seleccionada.padron=this.options.customData.padron;
																		store.state.conexion_seleccionada.colector=this.options.customData.colector;
																		store.state.conexion_seleccionada.profundidad=this.options.customData.profundidad.substring(0,5);
																		store.state.conexion_seleccionada.tipo=this.options.customData.tipo;
																		store.state.conexion_seleccionada.seccion=this.options.customData.seccion;
																		store.state.conexion_seleccionada.distmed=this.options.customData.distmed;
																		store.state.conexion_seleccionada.distmei=this.options.customData.distmei;
																		store.state.conexion_seleccionada.alta_fuent=app.texto_normalizo(this.options.customData.alta_fuent);
																		store.state.conexion_seleccionada.alta_descr=app.texto_normalizo(this.options.customData.alta_descr);
																		store.state.conexion_seleccionada.alta_fecha=this.options.customData.alta_fecha;
																		store.state.conexion_seleccionada.servicios=this.options.customData.servicios;
																		store.state.conexion_seleccionada.tgms=this.options.customData.tgms;
																		store.state.conexion_seleccionada.oses=this.options.customData.oses;
																		store.state.conexion_seleccionada.medidores=this.options.customData.medidores;
																		store.state.conexion_seleccionada.sur=this.options.customData.sur;
																		store.state.conexion_seleccionada.historial=app.texto_normalizo(this.options.customData.historial);
																		store.state.conexion_seleccionada.etapa=this.options.customData.etapa;
																		store.state.conexion_seleccionada.ccz=this.options.customData.ccz;
																		store.state.conexion_seleccionada.accion=this.options.customData.accion;
																		store.state.conexion_seleccionada.fotos=this.options.customData.fotos;
																		store.state.conexion_seleccionada.audios=this.options.customData.audios;
																		store.state.conexion_seleccionada.activo=this.options.customData.activo;
																		store.state.conexion_seleccionada.puertas=this.options.customData.puertas;
																		store.state.conexion_seleccionada.z_col=this.options.customData.z_col.substring(0,5);
																		store.state.conexion_seleccionada.via=this.options.customData.via;
																		store.state.conexion_seleccionada.id_tramite=this.options.customData.id_tramite;
																		store.state.conexion_seleccionada.id_con_ant=this.options.customData.id_con_ant;
																		store.state.conexion_seleccionada.calle=app.texto_normalizo(this.options.customData.calle);
																		store.state.conexion_seleccionada.empresa=this.options.customData.empresa;
																		store.state.conexion_seleccionada.tramite=this.options.customData.tramite;
																		store.state.conexion_seleccionada.descripcion=this.options.customData.descripcion;
																		store.state.modal_visible = 'Catastro_Conexion';
																		}
															}).on('mouseover',function(e){
																store.state.color_anterior = this.options.color;
																if (this.options.color != 'orange')
																{this.setStyle({color :'red'});}
																for (var s = 0;s < store.state.colectores_en_mapa.length; s++)
																{ 
																	if (store.state.colectores_en_mapa[s].options.customData.elemred == this.options.customData.colector)
																		{
																			store.state.color_anterior_colector = store.state.colectores_en_mapa[s].options.color;
																			store.state.colectores_en_mapa[s].setStyle({color :'red'});
																		}
																}
																for (var s = 0;s < store.state.calles_en_mapa.length; s++)
																{ 
																	if (store.state.calles_en_mapa[s].options.customData.cod_nombre == this.options.customData.via)
																		{
																			store.state.calles_en_mapa[s].setStyle({color :'red'});
																		}
																}
																for (var s = 0;s < store.state.padrones_en_mapa.length; s++)
																{ 
																	if (store.state.padrones_en_mapa[s].options.customData.padron == this.options.customData.padron)
																		{
																			store.state.padrones_en_mapa[s].setStyle({color :'red'});
																		}
																}		
															}).on('mouseout',function(e){
																if (this.options.color != 'orange')
																{this.setStyle({color :store.state.color_anterior});}
																	for (var s = 0;s < store.state.colectores_en_mapa.length; s++)
																	{ 
																		if (store.state.colectores_en_mapa[s].options.customData.elemred == this.options.customData.colector)
																			{
																				store.state.colectores_en_mapa[s].setStyle({color :store.state.color_anterior_colector});
																			}
																	}
																	for (var s = 0;s < store.state.calles_en_mapa.length; s++)
																	{ 
																		if (store.state.calles_en_mapa[s].options.customData.via == this.options.customData.cod_nombre)
																			{
																				store.state.calles_en_mapa[s].setStyle({color :'black'});
																			}
																	}
																	for (var s = 0;s < store.state.padrones_en_mapa.length; s++)
																	{ 
																		if (store.state.padrones_en_mapa[s].options.customData.padron == this.options.customData.padron)
																			{
																				store.state.padrones_en_mapa[s].setStyle({color :'grey'});
																			}
																	}		
															});
															L.path.touchHelper(conexion, {extraWeight:25}).addTo(map);
															store.state.conexiones_en_mapa.push(conexion);
														var camara1 = L.circle(latlngini, {
															color: 'green',
															fillColor: '#59D52A',
															fillOpacity: 1,
															radius:0.8,
															customData:{
																id:datos[0][i]["id"],
															}
														}).addTo(mapa);		
											store.state.camaras1_en_mapa.push(camara1);
												};
							//*******************FIN FUNCION QUE CARGA CONEXIONES DE SANEAMIENTO AL MAPA_______________________________________________________________________________________	
							let lati = datos[5][0];
							let long = datos[5][1];
								},
			cargo_mantenimiento: function(mapa,datos){
									app.limpio_mantenimiento(mapa);
								//---------------------COMIENZA FUNCION QUE CARGA controles AL MAPA_______________________________________________________________________________________
									for(var i=0;i< datos.length;i++){
												var id = datos[i]["id"];
												var xc = datos[i]["xc"];
												var yc = datos[i]["yc"];
												var tipo = datos[i]["tipo"];
												switch (tipo)
												{
													//TIPO 1
													case 'Padron cruzado': 
													color =  '#FE2712'; //rojo
													radio = 15;
													break;
													case 'Padron mutado': 
													color =  '#3333cc';//azul
													radio = 18;
													break;
													case 'Conexion corta': 
													color =  '#ff6600';//naranja
													radio = 10;
													break;
													case 'Conexion larga': 
													color =  '#33cc33'; //verde
													radio = 12;
													break;
													case 'Colector alejado': 
													color =  '#ffff00';//amarillo
													radio = 15;
													break;
													//TIPO 2
													case 'Colector cero': 
													color =  '#FE2712'; //rojo
													radio = 13;
													break;
													//TIPO 3
													case 'Padron cero': 
													color =  '#FE2712'; //rojo
													radio = 5;
													break;
													//TIPO 4
													case 'Tarifa sin conexion':
													color =  '#FE2712'; //rojo
													radio = 15;
													break;
													case 'Tarifa sin conexion ep': 
													color =   '#3333cc';//azul
													radio = 15;
													break;
													case 'Tarifa padron cruzado': 
													color = '#ffff00';//amarillo
													radio = 5;
													break;
													case 'Conexion sin tarifa': 
													color =  '#33cc33'; //verde
													radio = 15;
													break;
													default:
													color =  '#FCCC1A';
													radio = 8;
												}
												var latlngini = [yc,xc];
												var mantenimiento = L.circle(latlngini, {
													color: color,
													fillColor: color,
													fillOpacity: 0.1,
													radius:radio,
													wheight:2,
													customData:{
														id:id,
														tipo:tipo
													}
												}).bindTooltip("<div style='background:#D5872A; padding:1px 3px 1px 3px'><b>Tipo:" + tipo + "</b><br><b>Id:" + id + "</b></div>", 
												{
															direction: 'right',
															permanent: false,
															sticky: true,
															offset: [10, 0],
															opacity: 0.75,
															className: 'leaflet-tooltip-own' 
												}).addTo(mapa);		
									store.state.mantenimiento.push(mantenimiento);
											}
							},
			cargo_monitoreo: function(mapa,datos){
								app.limpio_monitoreo(mapa);
							//---------------------COMIENZA FUNCION QUE CARGA controles AL MAPA_______________________________________________________________________________________
								for(var i=0;i< datos.length;i++){
											var id = datos[i]["id"];
											var xc = datos[i]["xc"];
											var yc = datos[i]["yc"];
											var tipo = datos[i]["tipo"];
											var cantidad = datos[i]["cantidad"];
											switch (tipo)
											{
												case 'Reclamo SUR reiterado': 
												radio = 3 * cantidad;
												switch (cantidad)
												{
													case 2: 
													color =  '#A8FF33';
													break;
													case 3: 
													color =  '#A8FF33';
													break;
													case 4: 
													color =  '#A8FF33';
													break;
													case 5: 
													color =  '#A8FF33';
													break;
													case 6: 
													color =  '#FBF70A';
													break;
													case 7: 
													color =  '#FBB20A';
													break;
													case 8: 
													color =  '#FB7F0A';
													break;
													case 9: 
													color =  '#FB2B0A';
													break;
													default:
													color =  '#E933FF';
												}	
											}
											var latlngini = [yc,xc];
											var monitoreo = L.circle(latlngini, {
												color: color,
												fillColor: color,
												fillOpacity: 0.1,
												radius:radio,
												wheight:2,
												customData:{
													id:id,
													tipo:tipo,
													cantidad:cantidad
												}
											}).bindTooltip("<div style='background:#D5872A; padding:1px 3px 1px 3px'><b>Tipo:" + tipo + "</b><br><b>Cantidad:" + cantidad + "</b><br><b>Id:" +id + "</b></div>", 
											{
														direction: 'right',
														permanent: false,
														sticky: true,
														offset: [10, 0],
														opacity: 0.75,
														className: 'leaflet-tooltip-own' 
											}).addTo(mapa);		
								store.state.monitoreo.push(monitoreo);
										}
			},
			cargo_saneamiento2: function(mapa,datos){
									store.state.modo_conexiones = 1;
									app.limpio_mapa(mapa,1);
											//---------------------COMIENZA FUNCION QUE CARGA CONEXIONES DE SANEAMIENTO AL MAPA_______________________________________________________________________________________
											for(var i=0;i< datos[0].length;i++){
												
													var lat1 = datos[0][i]["lat1"];
													var lon1 = datos[0][i]["lon1"];
													var lat2 = datos[0][i]["lat2"];
													var lon2 = datos[0][i]["lon2"];
													var latlngs = [[lat1,lon1],[lat2,lon2]];
													var latlngini = [lat1,lon1];
													var conexion = L.polyline(latlngs, {
																color: 'blue',
																opacity: 1,
																weight: 7,
																customData:{
																	id:datos[0][i]["id"],
																	lon1:datos[0][i]["lon1"],
																	lat1:datos[0][i]["lat1"],
																	lon2:datos[0][i]["lon2"],
																	lat2:datos[0][i]["lat2"],
																	padron:datos[0][i]["padron"],
																	colector:datos[0][i]["colector"],
																	profundidad:datos[0][i]["profundidad"],
																	tipo:datos[0][i]["tipo"],
																	seccion:datos[0][i]["seccion"],
																	distmed:datos[0][i]["distmed"],
																	distmei:datos[0][i]["distmei"],
																	alta_fuent:datos[0][i]["alta_fuent"],
																	alta_descr:datos[0][i]["alta_descr"],
																	alta_fecha:datos[0][i]["alta_fecha"],
																	servicios:datos[0][i]["servicios"],
																	tgms:datos[0][i]["tgms"],
																	oses:datos[0][i]["oses"],
																	medidores:datos[0][i]["medidores"],
																	sur:datos[0][i]["sur"],
																	historial:datos[0][i]["historial"],
																	etapa:datos[0][i]["etapa"],
																	ccz:datos[0][i]["ccz"],
																	accion:datos[0][i]["accion"],
																	fotos:datos[0][i]["fotos"],
																	audios:datos[0][i]["audios"],
																	activo:datos[0][i]["activo"],
																	puertas:datos[0][i]["puertas"],
																	z_col:datos[0][i]["z_col"],
																	via:datos[0][i]["via"],
																	id_tramite:datos[0][i]["id_tramite"],
																	id_con_ant:datos[0][i]["id_con_ant"],
																	calle:datos[0][i]["calle"],
																	empresa:datos[0][i]["empresa"],
																	tramite:datos[0][i]["tramite"],
																	descripcion:datos[0][i]["descripcion"]
																}
														}).bindTooltip("<div style='background:cyan; padding:1px 3px 1px 3px'><b>Id:" + datos[0][i]["id"] + "</b><br><b>Padron:" + datos[0][i]["padron"] + "</b><br><b>Zcol:" + datos[0][i]["z_col"].substring(0,5) + "</br></div>", 
														{
																	direction: 'right',
																	permanent: false,
																	sticky: true,
																	offset: [10, 0],
																	opacity: 0.75,
																	className: 'leaflet-tooltip-own' 
														}).addTo(mapa);
														store.state.conexiones_en_mapa.push(conexion);
													var camara1 = L.circle(latlngini, {
														color: 'blue',
														fillColor: 'cyan',
														fillOpacity: 1,
														radius:0.8,
														customData:{
															id:datos[0][i]["id"],
														}
													}).addTo(map);		
										    store.state.camaras1_en_mapa.push(camara1);
											};
						//*******************FIN FUNCION QUE CARGA CONEXIONES DE SANEAMIENTO AL MAPA_______________________________________________________________________________________	

			},								
			obtengo_fecha2: function(fecha){
				fecha.setHours(fecha.getHours()-3);
									var fecha2=  fecha.toISOString();
									var parte1 = fecha2.split("T")[0];
									var parte2 = fecha2.split("T")[1].substr(0,8);
									parte2 = parte2.replace(/:/g,"-");
									return "_" + parte1 + "T" + parte2;
			},
			obtengo_punto_en_colector: function(lat,lon){
					var menor_distancia = 999999;
					var latres = lat;
					var lonres = lon;
					if(typeof store.state.colectores_en_mapa !== 'undefined')
					{
						for(var i=0;i<store.state.colectores_en_mapa.length; i++)
						{
							let linestring = '';
							let puntosline = store.state.colectores_en_mapa[i].getLatLngs();
							for (var j=0;j<puntosline.length; j++)
							{
								linestring += puntosline[j]['lng'] + " " + puntosline[j]['lat'] + ',';
							}
							linestring = linestring.substr(0, linestring.length - 1);
							let resdist = dl_geometria.dl_punto_cercano_linestring(lat,lon,linestring);
							if (resdist['distancia'] < menor_distancia)
							{
								latres = resdist['lat'];
								lonres = resdist['lon'];
								menor_distancia = resdist['distancia'];
							}	
						}
					}
					var res = {lat:latres,lon:lonres};
					return res;
			},
			genero_reporte_excel: function(){
				return new Promise(resolve => {
									//INICIO REPORTE GENERAL DE RUIDO //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
									//obtengo datos a reportar
									////////////////////////////						
									

										var nombre_reporte= "Reporte_Conexiones_" + this.obtengo_fecha2(new Date()) + ".xlsx";
										var excel = $JExcel.new("Lato 11 #666666");			// Default font
												
										// excel.set is the main function to generate content:
										// 		We can use parameter notation excel.set(sheetValue,columnValue,rowValue,cellValue,styleValue) 
										// 		Or object notation excel.set({sheet:sheetValue,column:columnValue,row:rowValue,value:cellValue,style:styleValue })
										// 		null or 0 are used as default values for undefined entries
										let mensaje = store.state.descripcion_consulta_distribuida;	
										excel.set( {sheet:0,value: "Reporte_Conexiones" } );
									
										
										excel.set({row:0,value: 35});
										excel.set({row:1,value: 40});
									
										excel.set({column:0,value: 10});
										excel.set(0,0,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,0,0,mensaje,excel.addStyle({align:"L C",fill: "#00823B",border:"none,none,none,none #666666",font: "Lato 14 #FFFFFF B"}));

										excel.set(0,0,1,"Id",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:1,value: 20});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,1,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,1,1,"Sur",excel.addStyle({align:"C C",fill: "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:2,value: 10});								// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,2,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,2,1,"Padron",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:3,value: 10});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,3,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,3,1,"Colector",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM			
										excel.set({column:4,value: 7});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,4,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,4,1,"Zamp",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										
										excel.set({column:5,value: 8});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,5,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,5,1,"Prof",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:6,value: 10});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,6,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,6,1,"Tipo",excel.addStyle({align:"C C",fill:"#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:7,value: 12});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,7,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,7,1,"Seccion",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:8,value: 45});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,8,0,"",excel.addStyle({align:"L C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,8,1,"Fuente de alta",excel.addStyle({align:"C C",fill:"#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:9,value: 20});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,9,0,"",excel.addStyle({align:"L C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,9,1,"Descripción de alta",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:10,value: 15});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,10,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,10,1,"Fecha de alta",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:11,value: 20});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,11,0,"",excel.addStyle({align:"L C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,11,1,"Calle",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:12,value: 10});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,12,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,12,1,"Puertas",excel.addStyle({align:"C C",fill:"#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:13,value: 15});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,13,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,13,1,"Trámite",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:14,value: 20});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,14,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,14,1,"Descripción",excel.addStyle({align:"C C",fill:"#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));								
										excel.set({column:15,value: 12});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,15,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,15,1,"Servicios",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:16,value: 12});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,16,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,16,1,"Tgms",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:17,value: 12});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,17,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,17,1,"Oses",excel.addStyle({align:"C C",fill: "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
									    excel.set({column:18,value: 30});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,18,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,18,1,"Historial",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:19,value: 7});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,19,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,19,1,"CCZ",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:20,value: 7});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,20,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,20,1,"Accion",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:21,value: 7});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,21,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,21,1,"Fotos",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:22,value: 7});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,22,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,22,1,"Audios",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:23,value: 12});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,23,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,23,1,"Empresa",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:24,value: 7});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,24,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,24,1,"Via",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:25,value: 12});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,25,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,25,1,"Id de trámite",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:26,value: 12});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,26,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,26,1,"Id anterior",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));



																			
																			fila = 2;

																			let registros = store.state.conexiones_en_mapa;


																			for (i=0;i<registros.length;i++)
																			{
																				var registro = registros[i];
																				var id_registro = registro[0];
																				excel.set({row:fila,value: 17});
																				excel.set(0,0,fila,registro.options.customData.id,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,1,fila,registro.options.customData.sur,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,2,fila,registro.options.customData.padron,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,3,fila,registro.options.customData.colector,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										let zampeado = registro.options.customData.z_col;
										zampeado = parseFloat(zampeado).toPrecision(3);
																				excel.set(0,4,fila,zampeado,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,5,fila,registro.options.customData.profundidad,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,6,fila,registro.options.customData.tipo,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,7,fila,registro.options.customData.seccion,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,8,fila,registro.options.customData.alta_fuent,excel.addStyle({align:"L C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										let altadescripcion = this.texto_normalizo(registro.options.customData.alta_descr);
																				excel.set(0,9,fila,altadescripcion,excel.addStyle({align:"L C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										let fechadealta = registro.options.customData.alta_fecha;
										fechadealta = fechadealta.substr(0,10);										
																				excel.set(0,10,fila,fechadealta,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,11,fila,registro.options.customData.calle,excel.addStyle({align:"L C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										let puertas = registro.options.customData.puertas;
										puertas = puertas.replace(/\u0022/g,'');
										puertas = puertas.replace(/\u005B/g,'');
										puertas = puertas.replace(/\u005D/g,'');
																				excel.set(0,12,fila,puertas,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,13,fila,registro.options.customData.tramite,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,14,fila,registro.options.customData.descripcion,excel.addStyle({align:"L C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										let dato = registro.options.customData.servicios;
										dato = dato.replace(/\u0022/g,'');
										dato = dato.replace(/\u005B/g,'');
										dato = dato.replace(/\u005D/g,'');
																				
																				excel.set(0,15,fila,dato,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										dato = registro.options.customData.tgms;
										dato = dato.replace(/\u0022/g,'');
										dato = dato.replace(/\u005B/g,'');
										dato = dato.replace(/\u005D/g,'');										
																				excel.set(0,16,fila,dato,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										dato = registro.options.customData.oses;
										dato = dato.replace(/\u0022/g,'');
										dato = dato.replace(/\u005B/g,'');
										dato = dato.replace(/\u005D/g,'');	
																				excel.set(0,17,fila,dato,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				
										let historial = JSON.parse(registro.options.customData.historial);					
										dato = '';
										for(var j=0; j < historial.length; j++)
										{
										if (j>0){dato = dato + "\n"};	
										let renglon = historial[j]["descripcion"] + " en " + historial[j]["fecha"].substr(0,10) + " usuario: " + historial[j]["usuario"];
										dato = dato + renglon;
										}		
																				excel.set(0,18,fila,dato,excel.addStyle({align:"L C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,19,fila,registro.options.customData.ccz,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,20,fila,registro.options.customData.accion,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										dato = registro.options.customData.fotos;
										dato.length > 5 ? dato="Si" : dato="No";
																				excel.set(0,21,fila,dato,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										dato = registro.options.customData.audios;
										dato.length > 5 ? dato="Si" : dato="No";										
										excel.set(0,22,fila,dato,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										excel.set(0,23,fila,registro.options.customData.empresa,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										excel.set(0,24,fila,registro.options.customData.via,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										excel.set(0,25,fila,registro.options.customData.id_tramite,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
										excel.set(0,26,fila,registro.options.customData.id_con_ant,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
	
									
									fila++;
									}
										excel.generate(nombre_reporte);
										fila = fila * 2.5;
										setTimeout(function(){resolve(true)},fila);										
					});
									//FIN REPORTE GENERAL DE RUIDO //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
									//FINALIZO REPORTE DE RUIDO TIPO 1
			},
			genero_reporte_excel_log: function(){
				return new Promise(resolve => {
										var nombre_reporte= "Reporte_Log_Conexiones_" + this.obtengo_fecha2(new Date()) + ".xlsx";
										var excel = $JExcel.new("Lato 11 #666666");			// Default font
										excel.set( {sheet:0,value: "Reporte_Log_Conexiones" } );
					
										
										excel.set({row:0,value: 35});
										excel.set({row:1,value: 40});
									
										excel.set({column:0,value: 15});
										excel.set(0,0,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,0,0,"Reporte LOG de Aplicación de Conexiones",excel.addStyle({align:"L C",fill: "#00823B",border:"none,none,none,none #666666",font: "Lato 14 #FFFFFF B"}));
										excel.set(0,0,1,"Id conexion",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:1,value: 30});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,1,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,1,1,"Tipo",excel.addStyle({align:"C C",fill: "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));
										excel.set({column:2,value: 20});								// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,2,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,2,1,"Fecha",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set({column:3,value: 20});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,3,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,3,1,"Usuario",excel.addStyle({align:"C C",fill:  "#E2EFDA",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										// Align cell 3-3  to RIGHT-BOTTOM			
										excel.set({column:4,value: 70});										// Align cell 3-3  to RIGHT-BOTTOM
										excel.set(0,4,0,"",excel.addStyle({align:"C C",border:"none,none,none,none #333333",fill: "#00823B"}));
										excel.set(0,4,1,"Descripcion",excel.addStyle({align:"C C",fill: "#FFFFFF",border:"none,none,none,none #666666",font: "Lato 12 #666666 B"}));										
																			
																			fila = 2;
																			let registros = store.state.datos_log;
																			for (i=0;i<registros.length;i++)
																			{
																				var registro = registros[i];
																				var id_registro = registro[0];
																				excel.set({row:fila,value: 17});
																				excel.set(0,0,fila,registro.id_conex,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,1,fila,registro.tipo,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,2,fila,registro.fecha,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,3,fila,registro.usuario,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																				excel.set(0,4,fila,registro.descripcion,excel.addStyle({align:"C C",border:"none,none,none,thin #333333",font: "Lato 10 #666666"}));
																			fila++;
																			}
										excel.generate(nombre_reporte);
										fila = fila * 2.5;
										setTimeout(function(){resolve(true)},fila);										
					});
			},
			bajar_archivo: function(url, filename) {
										let xhr = new XMLHttpRequest();
										xhr.open("GET", url, true);
										xhr.responseType = "blob";
										xhr.onload = function(e) {
										  if (this.status == 200) {
											const blob = this.response;
											const a = document.createElement("a");
											document.body.appendChild(a);
											const blobUrl = window.URL.createObjectURL(blob);
											a.href = blobUrl;
											a.download = filename;
											a.click();
											setTimeout(() => {
											  window.URL.revokeObjectURL(blobUrl);
											  document.body.removeChild(a);
											}, 0);
										  }
										};
										xhr.send();
			},
			genero_kml: function(){
				return new Promise(resolve => {
										//INICIO kmz //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
										//obtengo datos a reportar
										////////////////////////////
										var nombre_kml = "SAS_Conexiones_" + this.obtengo_fecha2(new Date()) + ".kml";	
										var registros = store.state.conexiones_en_mapa;
										var latpromedio = 0;
										var lonpromedio = 0;
										var cantidad = 0;
										var registro;
										for (var s=0;s<registros.length;s++)
										{
											registro = registros[s];
											latpromedio = latpromedio + Number(registro.options.customData.lat1);									
											lonpromedio = lonpromedio + Number(registro.options.customData.lon1);									
											cantidad++;
										}
										latpromedio = latpromedio / cantidad;
										lonpromedio = lonpromedio / cantidad;
								
									var kml = '<?xml version="1.0" encoding="UTF-8"?>\n';
									kml = kml + '<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">\n';
									kml = kml + '<Document><name>Reporte de Conexiones</name>\n';
									
				
									kml = kml + '<LookAt>';
									kml = kml + '<longitude>' + lonpromedio +'</longitude>';
									kml = kml + '<latitude>' + latpromedio + '</latitude>\n';
									kml = kml + '<altitude>0</altitude>';
									kml = kml + '<heading>0.01954018220427638</heading>\n';
									kml = kml + '<tilt>1.030498795460985</tilt>';
									kml = kml + '<range>504.7072132194871</range>';
									kml = kml + '<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>';
									kml = kml + '</LookAt>\n';




									kml = kml + '<Style id="CLASE1">';
									kml = kml + '<LineStyle>';
									kml = kml + '<color>ff0000ff</color>';
									kml = kml + '<width>8</width>';
									kml = kml + '</LineStyle>';
									kml = kml + '</Style>\n';
									
									
									kml = kml + '<Style id="CLASE2">';
									kml = kml + '<LineStyle>';
									kml = kml + '<color>ff00ffff</color>';
									kml = kml + '<width>8</width>';
									kml = kml + '</LineStyle>';
									kml = kml + '</Style>\n';
									
									
									kml = kml + '<Style id="CLASE3">';
									kml = kml + '<LineStyle>';
									kml = kml + '<color>ffff0000</color>';
									kml = kml + '<width>8</width>';
									kml = kml + '</LineStyle>';
									kml = kml + '</Style>\n';
									
									
									kml = kml + '<Style id="CLASE4">';
									kml = kml + '<LineStyle>';
									kml = kml + '<color>ff00ff00</color>';
									kml = kml + '<width>8</width>';
									kml = kml + '</LineStyle>';
									kml = kml + '</Style>\n';
									
									
									kml = kml + '<Style id="CLASE5">';
									kml = kml + '<LineStyle>';
									kml = kml + '<color>ff800080</color>';
									kml = kml + '<width>8</width>';
									kml = kml + '</LineStyle>';
									kml = kml + '</Style>\n';
									
									
									kml = kml + '<Style id="CLASE6">';
									kml = kml + '<LineStyle>';
									kml = kml + '<color>ff0080ff</color>';
									kml = kml + '<width>8</width>';
									kml = kml + '</LineStyle>';
									kml = kml + '</Style>\n';


									kml = kml + '<Style id="CLASE7">';
									kml = kml + '<LineStyle>';
									kml = kml + '<color>ffff00ff</color>';
									kml = kml + '<width>8</width>';
									kml = kml + '</LineStyle>';
									kml = kml + '</Style>\n';



									kml = kml + '<Folder>';
									kml = kml + '<name>Conexiones</name>';
									kml = kml + '<open>1</open>"';
									kml = kml + '"<visibility>1</visibility>\n';




for (var i=0;i<registros.length;i++)
	{
		var registro = registros[i];
		var id_registro = registro[0];
let estilo = 'CLASE1';
let clave = registro.options.customData.alta_fuent;
let clave2 = clave.substr(0,13);
clave2 == 'CONFORME OBRA' ? clave = clave2 : clave = clave;
switch (clave){
		case "ARTEAGA":
			estilo = "CLASE1";
			break;
			case "CONFORME OBRA":
				estilo = "CLASE2";
			break;
			case "SISTEMA DE CONEXIONES":
				estilo = "CLASE3";
			break;
			case "INGRESO CON APLICACION DE CATASTRO":
				estilo = "CLASE4";
			break;
			case "DATOS RECOPILADOS DE LIBROS":
				estilo = "CLASE5";
			break;
			case "DATOS RECOPILADOS DEL SISTEMA UNICO DE RECLAMOS":
				estilo = "CLASE6";
			break;
			default:						
				estilo = "CLASE7";
				break;
}

	


											kml = kml + '<Placemark><name>Rangos por fuente</name><LookAt>\n';
											kml = kml + '<longitude>' + registro.options.customData.lon1 + '</longitude>\n';
											kml = kml + '<latitude>' + registro.options.customData.lat1 + '</latitude>\n';
											kml = kml + '<altitude>0</altitude>\n';
											kml = kml + '<range>1237.205460638887</range><gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode></LookAt>\n';
											kml = kml + '<styleUrl>#' + estilo + '</styleUrl>\n';
					kml = kml + '<description><![CDATA[<table border="0"> <tr><td> <h2 width="620" style="color:darkbrown;text-align:center">\n';
											kml = kml + 'Id: ' + registro.options.customData.id + '</table><table border="0">\n';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">';
											kml = kml + 'Padron: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.padron  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">';
											kml = kml + 'Colector: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.colector  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											let zampeado = registro.options.customData.z_col;
											zampeado = parseFloat(zampeado).toPrecision(3);
											kml = kml + 'Zampeado: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + zampeado + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';


											kml = kml + 'Profundidad: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.profundidad  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											kml = kml + 'Tipo: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.tipo  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											kml = kml + 'Seccion: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.seccion  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											kml = kml + 'Alta fuente: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.alta_fuent  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											let altadescripcion = this.texto_normalizo(registro.options.customData.alta_descr);
											kml = kml + 'Alta desc: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + altadescripcion  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											let fechadealta = registro.options.customData.alta_fecha;
											fechadealta = fechadealta.substr(0,10);	
											kml = kml + 'Alta fecha: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + fechadealta  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											kml = kml + 'Calle: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.calle  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';


											let puertas = registro.options.customData.puertas;
											puertas = puertas.replace(/\u0022/g,'');
											puertas = puertas.replace(/\u005B/g,'');
											puertas = puertas.replace(/\u005D/g,'');
											kml = kml + 'Puertas: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + puertas + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											kml = kml + 'Tramite: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.tramite  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';

											kml = kml + 'Descripcion: </th><td width=\"450\" style=\"background-color:khaki;text-align:right">' + registro.options.customData.descripcion  + '</td></tr>';
											kml = kml + '<tr><th width="220" style="background-color:darkgrey;text-align:left">\n';


											kml = kml + '</table><p><font color="darkblue">IM</font></p> ]]></description>\n';	
											kml = kml + '<LineString><tessellate>1</tessellate><coordinates>\n';
											kml = kml + registro.options.customData.lon1 + "," + registro.options.customData.lat1 + ",0 "; 
											kml = kml + registro.options.customData.lon2 + "," + registro.options.customData.lat2 + ",0 "; 
											kml = kml + '</coordinates></LineString></Placemark>\n';
									}
										kml = kml + '</Folder></Document></kml>\n';
									
									
										  var data = new Blob([kml], {type: 'text/plain'});
										  textFile = window.URL.createObjectURL(data);
										  this.bajar_archivo(textFile, nombre_kml);
									
										 resolve(true);										
					  });


										}
}

	/*
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
FIN DE METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS METODOS
	*/  

})
/*                                              FIN INSTANCIA DE VUE                                                    */


//FUNCIONES GLOBALES
window.addEventListener('offline', () => {store.state.hayconexion = false});
window.addEventListener('online', () => { 
	console.log("se retoma conexion");
	store.state.hayconexion = true;
});

var forzar_carga_registros = false;

function obtengo_nuevo_id(){
	var date = new Date();
	var p1 = String(date.getYear());
	if (date.getMonth() < 10)
	{
		var p2 = "0" + String(date.getMonth());
	}else
	{
		var p2 = String(date.getMonth());
	}
	if (date.getDate() < 10)
	{
		var p3 = "0" + String(date.getDate());
	}else
	{
		var p3 = String(date.getDate());
	}
	if (date.getHours() < 10)
	{
		var p4 = "0" + String(date.getHours());
	}else
	{
		var p4 = String(date.getHours());
	}
	if (date.getMinutes() < 10)
	{
		var p5 = "0" + String(date.getMinutes());
	}else
	{
		var p5 = String(date.getMinutes());
	}
	var id_registro = p1 + p2 + p3 + p4 + p5 + String(parseInt(0 + (Math.random() * 500)));
	return id_registro;
}













