/**** SQL para los distintos tipos de mapas ****/ var app = app || {}; //VARIABLES GLOBALES var tipofiltro = ""; var param_subfiltro = ""; var sqlnuevo = ""; var filtroactual = ""; var filtro = ""; var query = ""; var estado, idactual = ''; var array, arraymenu, menus, capas_adicionales = ''; var seccion, subseccion = ''; var ttc1, ttc2, ttc3 = ''; var loteactual = ''; //FUNCIONES GLOBALES var mapa_zonas = function () { mapa = 'zona'; app.map.el.map.remove(); app.map.init(); } //muestra/oculta resumen de lote var mostrarResumen = function() { if($('#resumen').css('display') != 'none'){ $('#resumen').css({ display: 'none' }); $("#toggle_msg").html('Mostrar Resumen'); document.getElementById('print_resumen').type = 'hidden'; $("#box2").css({display: 'block', height: 'auto'}); }else{ $('#resumen').css({display: 'block'}); $("#toggle_msg").html('Ocultar Resumen'); document.getElementById('print_resumen').type = 'button'; $("#box2").css({display: 'block', height: '500px'}); } }; //funcion para limpiar el mapa cuando se elija un nuevo filtro/operacion var limpiar = function() { el = app.map.el; el.map.setView([lat, lng], zoom); $("#resumen").html(""); $("#resumen").css({display: 'none'}); $("#toggle_resumen").html(""); //document.getElementById("box").style.opacity = "0.7"; $("#box").css({ 'opacity': '0.7' } ) $('#box2').hide(); if (el.polygon) { el.map.removeLayer(el.polygon); } }; window.forceReload = function(){ if( !window.fetch)return document.location.reload( true); var els = document.getElementsByTagName( "*"); for( var i = 0; i < els.length; i++){ var src = ""; if( els[i].tagName == "A")continue; if( !src && els[i].src)src = els[i].getAttribute( "src"); if( !src && els[i].href)src = els[i].getAttribute( "href"); if( !src)continue; fetch( src, { cache: "reload"}); } return document.location.reload( true); }; var procesar = function (identificador, operacion) { console.log('identificador: ', identificador, ' operacion: ', operacion); switch (operacion){ case 'actualizar': var ccc = document.getElementById("infoModalCCC").value; var zona = document.getElementById("infoModalZona").value; var mz = document.getElementById("infoModalManzana").value; var lote = document.getElementById("infoModalLote").value; $.ajax({ url: "login/set_valores.php", type: "POST", data: {id: identificador, operacion: operacion, ccc: ccc, zona: zona, mz: mz, lote: lote}, async: false, dataType: 'json', success: function (data) { array = JSON.parse(data); alert(array[0].total_rows + ' de ' + array[1].total_rows + ' agregado'); $('#modal_editar_lotes')[0].reset(); console.log(array); }, error:function(data){console.log('ndoikoi!', data);} }); break; case 'eliminar': $.ajax({ url: "login/set_valores.php", type: "POST", data: {id: identificador, operacion: operacion}, async: false, dataType: 'json', success: function (data) { array = JSON.parse(data); alert('Se ha eliminado '+ array.total_rows + ' registro/s'); }, error:function(data){console.log('ndoikoi!', data);} }); break; case 'cancelar': map.removeLayer(polygon); $('#modal_editar_lotes')[0].reset(); break; default: alert('Operacion no valida'); } $("#infoModal").toggle(); //forceReload(); }; //Se imprime el div que contiene el informe del lote var printDiv = function() { var divToPrint=document.getElementById('resumen'); var newWin=window.open('','Print-Window'); newWin.document.open(); newWin.document.write('' + '
' + ''+ ''+ ''+ ''+ ''+ ''+ ''+divToPrint.innerHTML+''); newWin.document.close(); setTimeout(function(){newWin.close();},10); }; app.conf = ( function () { //mapa = "zonas"; //MENU DINAMICO var initMenu = function() { //console.log(mapa); seccion = 'Mapas'; actualizar_navegacion(); $.ajax({ url: "login/get_valores.php", type: "POST", data: {mapa: mapa}, async: false, dataType: 'json', success: function (data) { //console.log(data); switch (mapa) { case 'morosidad': array = JSON.parse(data); //console.log(array); var estado = ''; var idactual; var actual = 0; var tipo = 0; creg = 0; cpag = 0; for (var p = 0; p < array.total_rows; p++) { var pimpuesto = array.rows[p]; if (pimpuesto.estado === 'REG') { if (creg === 0){ creg = creg + 1; estado = 'ADEUDADOS'; menus = "" + "Informe Catastral
' + 'Lote: '+ccc+' Ficha: '+data[0].inm_ficha+'
'); //SE CREA LA TABLA PARA EL RESUMEN $("#resumen").append( '| Ejercicio Fiscal | '+ 'Tributo | '+ 'Estado | '+ 'Importe | '+ 'Fecha de pago | '+ '
|---|---|---|---|---|
| '+item.ejer_fisca+' | ' + ''+item.trb_tributo+' | ' + ''+item.liq_estado+' | ' + ''+$.number(item.liq_importe_apagar,0,',','.')+' | ' + ''+estadopago+' | ' + '
Total '+tiporesumen+': '+ $.number(sum,0,',','.')+' Gs.
'); $('#toggle_resumen').append('Ocultar Resumen'); $('#toggle_resumen').append(''); }else{ $("#resumen").html(""); $("#resumen").css({display: 'block', height: 'auto', overflow: ''}); $("#box2").css({display: 'block', height: 'auto'}); $('#resumen').append('No se encontraron Datos
'); } }, error:function(data) { $('#resumen').append('
No se encontraron datos
') } });; }else { //alert("FAVOR ELIJA TIPO DE IMPUESTO!"); } break; } //console.log(polygon.getBounds()); } }); }; //Buscador $('#ctactastral').focus(function(){if ($(this).val()==="Ingrese Cta Catastral") {$(this).val("");}}); $('#ctactastral').on('blur',function(){if ($(this).val()!=="") {buscador();$(this).val("")}}); $(document).keyup(function (e) {if ($("#ctactastral:focus") && (e.keyCode === 13)) {buscador();$(this).val("")}}); var buscador = function () { var numficha = document.getElementById("ctactastral").value; if (numficha === null || numficha === ''){alert('Favor ingrese datos!');$('#ctactastral').value(''); }else{ $.ajax({ url: "login/buscar.php", type: "POST", data: {lote: numficha, busqueda: 'lote'}, dataType: 'json', success: function (data) { busqueda = JSON.parse(data); if (busqueda.total_rows === 0){ alert('NO SE ENCONTRARON DATOS!'); $('#ctactastral').val(""); }else{ cartoid = busqueda.rows[0].cartodb_id;mostrarLOTE(cartoid, numficha); $('#ctactastral').val(""); } } }) } } //FIN FUNCIONES GLOBALES //URL yvyape app.url = 'https://yvyape.yvaga.com.py/user/yvaga/api/v2/viz/'+basemap+'/viz.json'; //QUERY's mapas app.param = ( function(){ return { //CAPAS EXTRA manzanas: 'SELECT * FROM e'+entidad+'_manzanas', calles : 'SELECT * FROM e'+entidad+'_calles', lotesincc : 'SELECT * FROM e'+entidad+'_lotes_sinccc where borrado is not true', capazonastrib : 'SELECT * from e'+entidad+'_zonas_tributarias', ///////////////////////////// //BASE all: 'SELECT * FROM e'+entidad+'_lotes_conccc', ///////////////////////////// //MOROSIDAD morosidadtodos : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_liq_entidad_totalxobjeto on ccc = inm_ctacatastral', morosidadRenSTab : 'SELECT * FROM e'+entidad+'_lotes_conccc', morosidadVacant : "SELECT * FROM bushwick_pluto14v1 WHERE landuse = '11'", ///////////////// //FRENTES/ frentetodos: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', frentepavimento: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', frentepavimentolb: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', fplbresumen: 'SELECT b.inm_tpav, count(inm_tpav) as total FROM e'+entidad+'_lotes_conccc a left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento b on ccc = inm_ctacatastral where b.inm_tpav is not null and b.inm_tpav <> \'\' GROUP BY b.inm_tpav', //////////////// //ZONAS zonas : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', zonaslb : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', zonastributarias: "SELECT *," + " (coalesce(inm_tipo_ur, '0')" + " || '-' || " + " coalesce(inm_zona_tributaria, '0')" + " || '-' || " + "coalesce(sub_zona_rural,'0')) as zonas_tributarias " + "FROM e"+entidad+"_lotes_conccc " + "left join sigem"+entidad+".v_inmuebles_zona_pavimento " + "on ccc = inm_ctacatastral", zonastributariaslb: "SELECT *," + " (coalesce(inm_tipo_ur, '0')" + " || '-' || " + " coalesce(inm_zona_tributaria, '0')" + " || '-' || " + "coalesce(sub_zona_rural,'0')) as zonas_tributarias " + "FROM e"+entidad+"_lotes_conccc " + "left join sigem"+entidad+"lb.v_inmuebles_zona_pavimento " + "on ccc = inm_ctacatastral", ///////////////////// ///NOTIFICACIONES//// notificaciones: 'SELECT * FROM e'+entidad+'_lotes_conccc LEFT JOIN sigem'+entidad+'.v_seguimiento_notificaciones ON ccc = obj_numero', //////////////////// ///MIGRACION//////// migracion: 'SELECT DISTINCT ON (actualizacion_proceso, obj_imponible_ficha) * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.actualizaciones on ccc = obj_imponible_id where obj_imponible_ficha is not null ORDER BY actualizacion_proceso, obj_imponible_ficha, fec_graba DESC NULLS LAST', migraciontipo: 'SELECT DISTINCT ON (actualizacion_proceso, obj_imponible_ficha) * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.actualizaciones on ccc = obj_imponible_id where obj_imponible_ficha is not null ORDER BY actualizacion_proceso, obj_imponible_ficha, fec_graba DESC NULLS LAST', /////////////////////// ///RECOLECION BASURA/// recoleccion: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', lotes_recoleccion: 'select a.cartodb_id, a.ccc, a.ccc_guion, a.the_geom, a.the_geom_webmercator, b.ruta_id, b.name, b.ruta_descripcion from e'+entidad+'_lotes_conccc a, e'+entidad+'_cobertura_recoleccion b WHERE ST_DWithin(a.the_geom_webmercator, b.the_geom_webmercator, 20)', /////////////////////// ///ESTADO SIGEM//// sigem: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', estado_mejoras: 'SELECT * FROM e'+entidad+'_mejoras where borrado is not true', estado_lotes: 'SELECT * FROM e'+entidad+'_lotes_conccc where borrado is not true' }; } )();