$.noConflict(); jQuery(document).ready(function ($) { var tema='ui-redmond'; // prepare the data var catequistaSeleccionado=localStorage['usernameComboCatequistasSel']==null?$("#usernameComboCatequistas").val():localStorage['usernameComboCatequistasSel'];//$("#usernameComboCatequistas").find("option[selected='selected']").val();//$("#usernameComboCatequistas").val(); //alert("catequistaSeleccionado"+catequistaSeleccionado) var sourceCatequistaCursos = { datatype: "json", datafields: [ { name: 'ETIQUETA' }, { name: 'VALOR' } ], url: "../util/comboCatequistaCursos.php?CatequistaID="+catequistaSeleccionado+"", async: false }; $("#CatequistaID").on('change', function (event) { // Se actualiza el combo del desplegable de catequistas del menu con el elemento ya seleccionado //alert($( "#usernameComboCatequistas option:selected" ).val()); //alert($('#usernameComboCatequistas').find(':selected').index()); var usernameComboCatequistasSeleccionado=$('#usernameComboCatequistas').find(':selected').index(); if(usernameComboCatequistasSeleccionado==0){ usernameComboCatequistasSeleccionado=($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[0]; $('#usernameComboCatequistas').val(usernameComboCatequistasSeleccionado); } //alert("usernameComboCatequistasSeleccionado:"+usernameComboCatequistasSeleccionado); //alert("usernameComboCatequistas selectedIndex:"+document.getElementById("usernameComboCatequistas").selectedIndex) //$('#usernameComboCatequistas').prop('selectedIndex', $('#usernameComboCatequistas').prop('selectedIndex')); //alert("change"); }); //alert("sourceCatequistaCursos:"+sourceCatequistaCursos); var dataAdapterCatequistaCursos = new $.jqx.dataAdapter(sourceCatequistaCursos); $("#CatequistaID").jqxDropDownList( { source: dataAdapterCatequistaCursos, theme: tema, filterable: true, width: 700, height: 25, placeHolder: "",//"[Seleccione]", filterPlaceHolder: "Buscar con cualquier texto:", searchMode:"contains", selectedIndex: 0, displayMember: 'ETIQUETA', valueMember: 'VALOR' }); //$("#CatequistaID").jqxDropDownList('insertAt', { label: '[Seleccione]', value: '' }, 0); //alert("CatequistaID"+$("#CatequistaID").val()) // prepare the data //var urlDestino="data.php?CatequistaID="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[0])+"&DiaCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[1])+"&HoraCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[2])+"" $.getUrlDestino = function() { //alert("urlDestino"+$("#CatequistaID").val()) return "data.php?CatequistaID="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[0])+"&DiaCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[1])+"&HoraCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[2])+""; }; var source = { //contentType: 'application/json; charset=utf-8', datatype: "json", datafields: [ { name: 'AlumnoID', type: 'string'}, { name: 'Nombre', type: 'string'}, //{ name: 'Colegio', type: 'string'}, //{ name: 'CursoColegio', type: 'string'}, { name: 'FechaNacimiento', type: 'date'}, //{ name: 'ClaseReligion', type: 'string'}, //{ name: 'EstaBautizado', type: 'string'}, //{ name: 'NombreMadre', type: 'string'}, //{ name: 'TelefonoMadre', type: 'string'}, //{ name: 'NombrePadre', type: 'string'}, //{ name: 'TelefonoPadre', type: 'string'}, { name: 'Email', type: 'string'}, //{ name: 'Domicilio', type: 'string'}, //{ name: 'TelefonoFijo', type: 'string'}, { name: 'Observaciones', type: 'string'}, { name: 'GrupoCatequesis', type: 'string'}, { name: 'DiaCatequesis', type: 'string'}, { name: 'HoraCatequesis', type: 'number'}, { name: 'CatequistaID', type: 'string'}, { name: 'CONTADOR_ALUMNOS', type: 'number'}, { name: 'PARROQUIA_BAUTISMO', type: 'string'}, { name: 'GRUPO_CATEQUESIS', type: 'string'}, { name: 'TELEFONOS_PADRES', type: 'string'}, { name: 'HORARIO_RESERVA', type: 'string'}, { name: 'FECHA_NACIMIENTO', type: 'string'}, { name: 'FECHA_ALTA', type: 'string'} //{ name: 'CATEQUISTA_CURSO', type: 'string'}, //{ name: 'FechaAlta', type: 'date'}, //{ name: 'UsuarioAlta', type: 'string'}, //{ name: 'FechaModificacion', type: 'date'}, //{ name: 'UsuarioModificacion', type: 'string'} ], id: 'AlumnoID', url: $.getUrlDestino()//urlDestino//"data.php?CatequistaID="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[0])+"&DiaCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[1])+"&HoraCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[2])+"" }; //alert("source:"+source) var getLocalization = function () { var localizationobj = {}; localizationobj.pagerRangeString = " de "; localizationobj.pagerPreviousButtonString = "previo"; localizationobj.pagerNextButtonString = "siguiente"; localizationobj.pagerFirstButtonString = "primero"; localizationobj.pagerLastButtonString = "último"; localizationobj.groupsheaderstring = "Arrastre una columna para que se agrupe por ella"; localizationobj.sortAscendingString = "Ordenar Acs"; localizationobj.sortDescendingString = "Ordenar Des"; localizationobj.sortRemoveString = "Quitar orden"; localizationobj.groupbystring = "Agrupar por esta columna"; localizationobj.groupremovestring = "Quitar de grupos"; localizationobj.validationstring = "Valor no valido"; localizationobj.emptydatastring = "No hay registros que mostrar"; localizationobj.filterselectstring = "Seleccione un Filtro"; localizationobj.filterclearstring = "Limpiar"; localizationobj.filterstring = "Filtro"; localizationobj.filtershowrowstring = "Mostrar filas donde="; localizationobj.filtershowrowdatestring = "Mostrar filas donde fecha="; localizationobj.filterorconditionstring = "O"; localizationobj.filterandconditionstring = "Y"; localizationobj.filterselectallstring = "(Seleccionar Todo)"; localizationobj.filterchoosestring = "Por favor seleccione:"; localizationobj.filterstringcomparisonoperators = ['vacio', 'no vacio', 'contenga', 'contenga(coicidir Mayusculas/Minusculas)', 'no contenga', 'no contenga(coincidir Mayusculas/Minusculas)', 'inicia con', 'inicia con(coicidir Mayusculas/Minusculas)', 'termina con', 'termina con(coicidir Mayusculas/Minusculas)', 'igual', 'igual(coicidir Mayusculas/Minusculas)', 'null', 'no null' ]; filternumericcomparisonoperators = ['igual', 'no igual', 'menor que', 'menor o igual que', 'mayor que', 'mayor o igual que', 'nulo', 'no nulo']; filterdatecomparisonoperators = ['igual', 'no igual', 'menor que', 'menor o igual que', 'mayor que', 'mayor o igual que', 'nulo', 'no nulo']; filterbooleancomparisonoperators = ['igual', 'no igual']; localizationobj.filternumericcomparisonoperators = filternumericcomparisonoperators; localizationobj.filterdatecomparisonoperators = filterdatecomparisonoperators; localizationobj.filterbooleancomparisonoperators = filterbooleancomparisonoperators; localizationobj.loadtext = "Cargando..."; localizationobj.clearstring = "Limpiar"; localizationobj.todaystring = "hoy"; localizationobj.firstDay = 1; localizationobj.percentSymbol = "%"; localizationobj.currencySymbol = "€"; localizationobj.currencySymbolPosition = "anterior"; localizationobj.decimalSeparator = ","; localizationobj.thousandsSeparator = "."; var days = { // full day names names: ["Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"], // abbreviated day names namesAbbr: ["Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab"], // shortest day names namesShort: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"] }; localizationobj.days = days; var months = { // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) names: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Augosto", "Septiembre", "Octubre", "Noviembre", "Diciembre", ""], // abbreviated month names namesAbbr: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic", ""] }; var patterns = { c: "dd/MM/yyyy HH:mm:ss", s: "dd/MM/yyyy", d: "dd.MM.yyyy", D: "dddd, d. MMMM yyyy", t: "HH:mm", T: "HH:mm:ss", f: "dddd, d. MMMM yyyy HH:mm", F: "dddd, d. MMMM yyyy HH:mm:ss", M: "dd MMMM", Y: "MMMM yyyy" } localizationobj.patterns = patterns; localizationobj.months = months; return localizationobj; } //var editrow = -1; var dataAdapter = new $.jqx.dataAdapter(source); //var dataAdapter = new $.jqx.dataAdapter(source, {loadComplete: function () {}}); // initialize jqxDataTable $("#dataTable").jqxDataTable( { width: '100%', //pageable: true, source: dataAdapter, altRows: true, sortable: true, //filterable: true, //pagerMode: "advanced", //pageSize:15, //exportSettings: { fileName: 'Listado', characterSet: "UTF-8" }, localization: getLocalization(), theme: tema, //pagerButtonsCount: 8, columns: [ { text: 'BAUTIZADO EN', datafield: 'PARROQUIA_BAUTISMO', cellsAlign: 'center', width: '10%' }, { text: 'NÚM.', datafield: 'CONTADOR_ALUMNOS', cellsAlign: 'center', width: '5%' },//{ text: 'GRUPO', datafield: 'GRUPO_CATEQUESIS', cellsAlign: 'center', width: '5%' }, //{ text: 'CATEQUISTA', datafield: 'CatequistaID', width: 400}, //{ text: 'DIA CLASE', datafield: 'DiaCatequesis', width: 100}, //{ text: 'HORA CLASE', datafield: 'HoraCatequesis', width: 50}, //{ text: 'CURSO', datafield: 'CursoColegio', width: 20}, { text: 'NOMBRE', datafield: 'Nombre', width: '30%'}, //{ text: 'TELF. MADRE', datafield: 'TelefonoMadre', width: 100 }, //{ text: 'TELF. PADRE', datafield: 'TelefonoPadre', width: 100 }, //{ text: 'TELF. FIJO', datafield: 'TelefonoFijo', width: 100 }, { text: 'TELEFONOS PADRES', datafield: 'TELEFONOS_PADRES', width: '20%' }, { text: 'CORREO ELECTRONICO', datafield: 'Email', width: '25%' }, { text: 'OBSERVACIONES', datafield: 'Observaciones', width: 500 }, { text: 'HORARIO RESERVA', datafield: 'HORARIO_RESERVA', width: '10%' }, , { text: 'FECHA NACIMIENTO', datafield: 'FECHA_NACIMIENTO', width: '10%' }, { text: 'FECHA ALTA', datafield: 'FECHA_ALTA', width: '10%' } ] }); //$("#dataTable").on('bindingComplete', function (event) { //alert("dataTable getRows:"+$("#dataTable").jqxDataTable('getRows')); // $("#dataTable").jqxDataTable('filter'); //}); // prepare the data //var urlDestinoB="dataB.php?CatequistaID="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[0])+"&DiaCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[1])+"&HoraCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[2])+"" $.getUrlDestinoB = function() { //alert("urlDestinoB"+$("#CatequistaID").val()) return "dataB.php?CatequistaID="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[0])+"&DiaCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[1])+"&HoraCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[2])+""; }; var sourceB = { //contentType: 'application/json; charset=utf-8', datatype: "json", datafields: [ { name: 'AlumnoID', type: 'string'}, { name: 'Nombre', type: 'string'}, //{ name: 'Colegio', type: 'string'}, //{ name: 'CursoColegio', type: 'string'}, //{ name: 'FechaNacimiento', type: 'date'}, //{ name: 'ClaseReligion', type: 'string'}, //{ name: 'EstaBautizado', type: 'string'}, //{ name: 'NombreMadre', type: 'string'}, //{ name: 'TelefonoMadre', type: 'string'}, //{ name: 'NombrePadre', type: 'string'}, //{ name: 'TelefonoPadre', type: 'string'}, { name: 'Email', type: 'string'}, //{ name: 'Domicilio', type: 'string'}, //{ name: 'TelefonoFijo', type: 'string'}, { name: 'Observaciones', type: 'string'}, { name: 'GrupoCatequesis', type: 'string'}, { name: 'DiaCatequesis', type: 'string'}, { name: 'HoraCatequesis', type: 'number'}, { name: 'CatequistaID', type: 'string'}, { name: 'CONTADOR_ALUMNOS', type: 'number'}, { name: 'PARROQUIA_BAUTISMO', type: 'string'}, { name: 'GRUPO_CATEQUESIS', type: 'string'}, { name: 'TELEFONOS_PADRES', type: 'string'}, { name: 'HORARIO_RESERVA', type: 'string'}, { name: 'FECHA_NACIMIENTO', type: 'string'}, { name: 'FECHA_ALTA', type: 'string'} //{ name: 'CATEQUISTA_CURSO', type: 'string'}, //{ name: 'FechaAlta', type: 'date'}, //{ name: 'UsuarioAlta', type: 'string'}, //{ name: 'FechaModificacion', type: 'date'}, //{ name: 'UsuarioModificacion', type: 'string'} ], id: 'AlumnoID', url: $.getUrlDestinoB()//urlDestinoB//"dataB.php?CatequistaID="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[0])+"&DiaCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[1])+"&HoraCatequesis="+(($("#CatequistaID").val()=="")?null:$("#CatequistaID").val().split("@")[2])+"" }; //var editrow = -1; var dataAdapterB = new $.jqx.dataAdapter(sourceB); //var dataAdapterB = new $.jqx.dataAdapter(sourceB, {loadComplete: function () {}}); // initialize jqxDataTable $("#dataTableB").jqxDataTable( { width: '100%', //pageable: true, source: dataAdapterB, altRows: true, sortable: true, //filterable: true, //pagerMode: "advanced", //pageSize:15, //exportSettings: { fileName: 'Listado', characterSet: "UTF-8" }, localization: getLocalization(), theme: tema, //pagerButtonsCount: 8, columns: [ { text: 'BAUTIZADO EN', datafield: 'PARROQUIA_BAUTISMO', cellsAlign: 'center', width: '30%' }, { text: 'NÚM.', datafield: 'CONTADOR_ALUMNOS', cellsAlign: 'center', width: '5%' },//{ text: 'GRUPO', datafield: 'GRUPO_CATEQUESIS', cellsAlign: 'center', width: '5%' }, //{ text: 'CATEQUISTA', datafield: 'CatequistaID', width: 400}, //{ text: 'DIA CLASE', datafield: 'DiaCatequesis', width: 100}, //{ text: 'HORA CLASE', datafield: 'HoraCatequesis', width: 50}, //{ text: 'CURSO', datafield: 'CursoColegio', width: 20}, { text: 'NOMBRE', datafield: 'Nombre', width: '30%'}, //{ text: 'TELF. MADRE', datafield: 'TelefonoMadre', width: 100 }, //{ text: 'TELF. PADRE', datafield: 'TelefonoPadre', width: 100 }, //{ text: 'TELF. FIJO', datafield: 'TelefonoFijo', width: 100 }, { text: 'TELEFONOS PADRES', datafield: 'TELEFONOS_PADRES', width: '20%' }, { text: 'CORREO ELECTRONICO', datafield: 'Email', width: '25%' }, { text: 'OBSERVACIONES', datafield: 'Observaciones', width: 500 }, { text: 'HORARIO RESERVA', datafield: 'HORARIO_RESERVA', width: '20%' }, , { text: 'FECHA NACIMIENTO', datafield: 'FECHA_NACIMIENTO', width: '10%' }, { text: 'FECHA ALTA', datafield: 'FECHA_ALTA', width: '10%' } ] }); $("#excelExport").jqxButton(); $("#excelExport").click(function () { //$('#dataTable').jqxDataTable('exportSettings',{ fileName: 'Listado', characterSet: "UTF-8" });//$("#dataTable").jqxDataTable({ exportSettings: { fileName: 'Listado', characterSet: "UTF-8" } }); //$("#dataTable").jqxDataTable('exportData', 'xls'); //$("#dataTable").jqxDataTable('exportData', 'xls', null, false, null, null, null, 'utf-8'); //alert($('#contenttabledataTableB').html()) var gridContent=""; //alert($('#dataTable').jqxDataTable('getRows').length) if($('#dataTable').jqxDataTable('getRows').length > 0){ $('#dataTable').jqxDataTable('exportSettings',{ fileName: null, characterSet: "UTF-8" }); gridContent = $("#dataTable").jqxDataTable('exportData', 'html'); } var gridContentB=""; //alert($('#dataTableB').jqxDataTable('getRows').length) if($('#dataTableB').jqxDataTable('getRows').length > 0){ $('#dataTableB').jqxDataTable('exportSettings',{ fileName: null, characterSet: "UTF-8" }); gridContentB = $("#dataTableB").jqxDataTable('exportData', 'html'); } //window.open('data:application/vnd.ms-excel;filename="Listados.xls";charset=utf-8,' + encode(gridContent+gridContentB)); var downloadLink = document.createElement("a"); downloadLink.href = 'data:application/vnd.ms-excel;charset=UTF-8,' + escape(gridContent+gridContentB); downloadLink.download = "Listados.xls"; document.body.appendChild(downloadLink); downloadLink.click(); document.body.removeChild(downloadLink); }); $("#pdfExport").jqxButton(); $("#pdfExport").click(function () { //$('#dataTable').jqxDataTable('exportSettings',{ fileName: 'Listado', characterSet: "UTF-8" }) //$("#dataTable").jqxDataTable('exportData', 'pdf'); //$('#dataTableB').jqxDataTable('exportSettings',{ fileName: 'ListadoB', characterSet: "UTF-8" }) //$("#dataTableB").jqxDataTable('exportData', 'pdf'); //window.open('data:application/pdf;filename="Listados.pdf";charset=utf-8,' + encode(gridContent+gridContentB)); $('#contenedor').tableExport({type:'pdf',escape:'false'}); /*var downloadLink = document.createElement("a"); //downloadLink.href = 'data:application/pdf;base64,';// + escape(gridContent+gridContentB); downloadLink.href='data:application/pdf;base64,'+"$('#contenedor').tableExport({type:'pdf',escape:'false'}));";//$('#contenedor').tableExport({type:'pdf',escape:'false'}); downloadLink.download = "Listados.pdf"; downloadLink.target="_blank"; //downloadLink.onClick="$('#contenedor').tableExport({type:'pdf',escape:'false'}));"; document.body.appendChild(downloadLink); downloadLink.click(); document.body.removeChild(downloadLink);*/ }); $("#print").jqxButton({ width: 80 }); $("#print").click(function () { var cabecera = $("#cabecera").html(); var cabeceraB = $("#cabeceraB").html(); $('#dataTable').jqxDataTable('exportSettings',{ fileName: null, characterSet: "UTF-8" }) var gridContent = $("#dataTable").jqxDataTable('exportData', 'html'); $('#dataTableB').jqxDataTable('exportSettings',{ fileName: null, characterSet: "UTF-8" }) var gridContentB = $("#dataTableB").jqxDataTable('exportData', 'html'); var comboCatequistaID= $("#CatequistaID").html(); var newWindow = window.open('', '', 'width=800, height=500'), document = newWindow.document.open(), pageContent = '' + '' + '
' + //''+ //''+ //''+ //''+ ""+ '' + 'Curso / Día / Hora / Catequista (total niñ@s) / Aula: | '+comboCatequistaID+' |