PageSourceSearch

https://campreservation.com/inc/247scouting/admin/javascript/reports.js?1305

js campreservation.com collected 2026-10-01 15:16:13 UTC 38,689 bytes, 1,048 lines download raw bytes

1var startDate = getNowDaterpt(new Date());
2var endDate = getNowDaterpt(new Date());
3var camp=0;
4var account=0;
5var DistrictSelect =0;
6var reportID=0;
7var mdmUser_ID=0;
8var orgKey='';
9var systemID=1;
10var hipaaPassword='';
11var prevEvent='';
12/* jlm 01-22-2013 no longer going to pass the sql to the report
13function fillSQLCount_Parm(OrgKey,mdmUser_ID,selectedValue,idName,eventInstanceID)
14{
15	var timestamp = new Date();
16	var instanceID=document.getElementById("instanceIDSQL_COUNT").value;
17	var selectedValueArray = selectedValue.split('@|');
18	var tblName=selectedValueArray[0];
19	var colName=selectedValueArray[1];
20	var title=selectedValueArray[2];
21	var attributeID=selectedValueArray[3];
22	var rowID=selectedValueArray[4];
23
24//jlm 11-02-2012 NOT SURE THIS IS USED ANYMORE!
25	//JLM 01-09-2013 --- LOOKS LIKE THIS IS USED!
26	var SQLCount = getCountSQL(OrgKey,instanceID,tblName,colName,title,attributeID,rowID,idName);
27
28}
29*/
30
31function Reports()
32{
33	this.reportsHTML = '';
34
35	this.updatePackList = function($this)
36	{
37		if ($('#packListSelHidden').length)
38			$('#packListSelHidden').val( $this.val().join(',') );
39	};
40
41	this.insertDatabaseField = function(idField,value,eventInstanceID)
42	{
43		var packListSel = $('#packListSelHidden').val();
44		CKEDITOR.instances[idField].insertText(value);
45		if (value == '{$customFieldReport}')
46		{
47			//FillSpecializedTableDropDown
48			$.post('inc/ajax_reports.php',
49					{
50						'action'          : 'FillSpecializedTableDropDown',
51						'idName'          : '',
52						'eventInstanceID' : eventInstanceID,
53						'accountGroup'    : 0,
54						'sDate'           : '',
55						'eDate'           : '',
56						'multiFlag'       : 1,
57						'limitTypeID'     : 0,
58						'packListSel'     : packListSel
59					},function(data)
60					{
61						data == $.trim(data);
62						//put in spot on modal
63						$('#custFieldPackList').html(data);
64					});
65		}
66		else
67		{
68			//blank out spot for FillSpecializedTableDropDown
69			$('#custFieldPackList').html('');
70		}
71
72	};
73
74	this.quickDateEntry = function($elm) {
75		var $sdate = $elm.closest('.modal').find('input[data-javaid = "SDATE"]');
76		var $edate = $elm.closest('.modal').find('input[data-javaid = "EDATE"]');
77		var sdate = $elm.find('> option:selected').data('sdate');
78		var edate = $elm.find('> option:selected').data('edate');
79
80		$sdate.val(sdate);
81		$edate.val(edate);
82
83		$elm.val(0);
84	};
85
86	this.toggleFavorites = function($btn)
87	{
88		$btn.attr('data-active', Math.abs(parseInt($btn.attr('data-active')) - 1));
89
90		if ($btn.attr('data-active') == "1")
91		{
92			this.reportsHTML = $('#reportSearchContentDIV').html();
93
94			$('#reportSearchContentDIV div[id ^= "categoryToggle"]').each(function()
95			{
96				if ($(this).find('span > span.glyphicon').filter(function() { return $(this).css('display') != 'none'; }).length)
97				{
98					$(this).show();
99
100					$(this).find('> div[id]').each(function()
101					{
102						if ($(this).find('span > span.glyphicon').filter(function() { return $(this).css('display') != 'none'; }).length)
103						{
104							$(this).show();
105
106							$(this).find('div').each(function()
107							{
108								if ($(this).find('span.glyphicon').filter(function() { return $(this).css('display') != 'none'; }).length)
109								{
110									$(this).show();
111								}
112								else
113									$(this).hide();
114							});
115						}
116						else
117						{
118							$(this).prev().hide();
119							$(this).hide();
120						}
121					});
122				}
123				else
124				{
125					$(this).prev().hide();
126					$(this).hide();
127				}
128			});
129		}
130		else
131			$('#reportSearchContentDIV').html(this.reportsHTML);
132	};
133
134	this.initializeDatePickerFromTo = function(fromID, toID, groupName)
135	{
136		if ($("#" + fromID + groupName).length && $("#" + toID + groupName).length )
137		{
138			  var dateFormat = "yy-mm-dd";
139			  $( "#" + fromID + groupName).datepicker({
140				  					dateFormat     : "yy-mm-dd",
141						          	changeMonth: true
142						        })
143		        		.on( "change", function()
144		        		{
145			        		if (this.value.length == 10)
146			        		{
147		        				var thisID= this.id.slice((this.id.length - 4) * -1);
148					        	$( "#" + toID + groupName ).datepicker( "option", "minDate", reports.getDateFromDatepicker( this, dateFormat ) );
149			        		}
150			        		else
151			        			this.value='';
152
153			        		changeSelectionCriteria('','',groupName,$(this).datepicker('getDate'), fromID);
154
155					        });
156
157		       $( "#" + toID  + groupName).datepicker({
158		    	   				dateFormat     : "yy-mm-dd",
159						        changeMonth: true
160						      })
161						.on( "change", function()
162						{
163							if (this.value.length == 10)
164			        		{
165								var thisID= this.id.slice((this.id.length - 2) * -1);
166								$( "#" + fromID + groupName ).datepicker( "option", "maxDate", reports.getDateFromDatepicker( this, dateFormat ) );
167							}
168			        		else
169			        			this.value='';
170
171							changeSelectionCriteria('','',groupName,$(this).datepicker('getDate'), toID);
172		      		});
173		}
174		else if ($("#" + fromID + groupName).length )
175		{
176			 $( "#" + fromID + groupName ).datepicker({
177					dateFormat     : "yy-mm-dd",
178		          	changeMonth: true
179		        });
180		}
181		else if ($("#" + toID + groupName).length )
182		{
183			 $( "#" + toID + groupName ).datepicker({
184					dateFormat     : "yy-mm-dd",
185		          	changeMonth: true
186		        });
187		}
188	};
189
190	this.getDateFromDatepicker = function( element, dateFormat )
191    {
192	      var date;
193	      try {
194	        date = $.datepicker.parseDate( dateFormat, element.value );
195	      } catch( error ) {
196	        date = null;
197	      }
198
199	      return date;
200	  };
201
202	this.setMultiAll = function (name, $this, allSelectID) {
203		var doThis = $this.is(':checked');
204		$("input[name='" + name + "']").prop("checked", doThis);
205
206		$('#' + allSelectID).val(doThis ? '1' : '0');
207	};
208
209	this.toggleAllReports = function () {
210		if ($('.divToggle').first().is(':visible')) {
211			$('.categoryToggle').toggle(false);
212			$('.divToggle').toggle(false);
213		} else {
214			$('.categoryToggle').toggle(true);
215			$('.divToggle').toggle(true);
216		}
217	}
218}
219
220var reports = new Reports();
221
222//$(document).on('click', '#reportSearchContentDIV a', function()
223//{
224//	if ($(this).find('b').length == 0)
225//	{
226//		$('#reportSearchContentDIV a').each(function()
227//		{
228//			if ($(this).find('b').length == 0)
229//				$(this).css({'font-weight': 'normal', 'color': ''});
230//		});
231//
232//		$(this).css({'font-weight': 'bold', 'color': '#070'});
233//	}
234//});
235
236function toggleDiv(divId)
237{
238	$("#"+divId).toggle();
239}
240
241
242function showSpecializedFieldsforGroup(orgKey,mdmUser_ID,accountGroup,groupName)
243{
244	var timestamp = new Date();
245	var sDate=document.getElementById("SDATE"+groupName).value;
246	var eDate=document.getElementById("EDATE"+groupName).value;
247    if (sDate=='' || eDate=='') {
248    	alert("You must select the start and end dates prior to selecting the group");
249    	document.getElementById("accountGroupList").value=0;
250    }else {
251		$.get("inc/ajax_reports.php?selectAdditionalInfo="+orgKey
252				+"&orgKey="+orgKey
253				+"&mdmUser_ID="+mdmUser_ID
254				+"&accountGroup="+accountGroup
255				+"&sDate="+sDate
256				+"&eDate="+eDate
257				+"&TimeStamp="+timestamp,
258	 	  function(data){
259			document.getElementById("selectAdditionalInfo").innerHTML=data;
260			 });
261
262    }
263
264}
265/* jlm 01-22-2013 no longer going to pass the sql to the report
266function getCountSQL(OrgKey,instanceID,tblName,colName,title,attributeID,rowID,idName)
267{
268	// concat(LOCATION_NAME,' - ',date_format(START_DATE,'%m-%d-%Y %l:%i %p')) as LOCATION_NAME
269		var SQLCount= "SELECT LOCATION_NAME, START_DATE, EVENT_TITLE, END_DATE,REGISTRANT_NAME, COLUMN_NAME, COUNT_NAME, SUM(COUNT) AS COUNT " +
270				" FROM " +
271				" (Select loc.NAME AS LOCATION_NAME, inst2loc.SDATE as START_DATE, TITLE AS EVENT_TITLE, " +
272				"  inst2loc.EDATE as END_DATE, reg.NAME as REGISTRANT_NAME, " +
273				" IFNULL(inst2att.DISPLAY_NAME,(SELECT DISPLAY_NAME FROM SES_ATTRIBUTE WHERE ID="+attributeID+ ")) AS COLUMN_NAME, " +
274				" `VALUE` AS COUNT_NAME, 0 as COUNT,  attValue.ID as VALUE_SORT_ORDER   " +
275				" 	 FROM SES_INSTANCE_LK_SES_ATTRIBUTE inst2att,  " +
276				"      SES_ATTRIBUTE_VALUE attValue,  " +
277				"        MDM_LOCATION loc,   " +
278				"        SES_INSTANCE_LK_MDM_LOCATION inst2loc,  " +
279				"      SES_INSTANCE inst,   " +
280				"      SES_INSTANCE_REGISTRANT instreg,  " +
281				"      SES_REGISTRANT reg   " +
282				"      WHERE attValue.SES_INSTANCE_LK_SES_ATTRIBUTE_ID = inst2att.ID  " +
283				"      and inst2att.SES_ATTRIBUTE_ID= "+attributeID+ "  " +
284				"       and inst2att.SES_INSTANCE_ID=inst2loc.SES_INSTANCE_ID  " +
285				"       and loc.ID=inst2loc.MDM_LOCATION_ID   " +
286				"      AND inst2loc.SES_INSTANCE_ID= "+instanceID+ "  " +
287				"      and inst2loc.SES_INSTANCE_ID=inst.ID   " +
288				"      and inst2loc.SES_INSTANCE_ID=instreg.SES_INSTANCE_ID  " +
289				"      AND instreg.SES_REGISTRANT_ID=reg.ID  " +
290				"      AND reg.ID != 1   " +
291				"      GROUP BY LOCATION_NAME,  START_DATE, REGISTRANT_NAME, COUNT_NAME  " +
292				"        UNION (    " +
293				" 		 SELECT loc.NAME AS LOCATION_NAME, inst2loc.SDATE as START_DATE, TITLE AS EVENT_TITLE,  " +
294				"  inst2loc.EDATE as END_DATE, reg.NAME as REGISTRANT_NAME,    " +
295				" IFNULL(inst2att.DISPLAY_NAME,(SELECT DISPLAY_NAME FROM SES_ATTRIBUTE WHERE ID="+attributeID+ ")) AS COLUMN_NAME,  " +
296				"  	 IF(inst2att.MDM_LKP_ATTRIBUTE_TYPE_ID=2, VALUE, " +
297                " 			(SELECT VALUE FROM SES_ATTRIBUTE_VALUE WHERE ID=attndValue.SES_ATTRIBUTE_VALUE_ID)) AS COUNT_NAME, " +
298              	"	SUM(CNT) AS COUNT, SES_ATTRIBUTE_VALUE_ID as VALUE_SORT_ORDER  " +
299				"  from MDM_LOCATION loc    " +
300				"  join SES_INSTANCE_LK_MDM_LOCATION inst2loc  " +
301				" on loc.ID=inst2loc.MDM_LOCATION_ID  " +
302				"  join SES_INSTANCE inst  " +
303				" on inst2loc.SES_INSTANCE_ID=inst.ID  " +
304				" JOIN SES_INSTANCE_LK_SES_ATTRIBUTE inst2att  " +
305				" ON inst.ID=inst2att.SES_INSTANCE_ID  " +
306				"  join SES_REGISTRATION regi  " +
307				" on inst2loc.ID=regi.SES_INSTANCE_LK_MDM_LOCATION_ID  " +
308				" 			 join SES_ATTENDEE attnd  " +
309				"     on regi.ID=attnd.SES_REGISTRATION_ID  " +
310				"  join SES_ATTENDEE_VALUE attndValue " +
311				"     on attnd.ID = attndValue.SES_ATTENDEE_ID " +
312				"     AND inst2att.ID=attndValue.SES_INSTANCE_LK_SES_ATTRIBUTE_ID " +
313				" 		 join SES_INSTANCE_REGISTRANT instreg   " +
314				"     on attnd.SES_INSTANCE_REGISTRANT_ID=instreg.ID " +
315				"  join SES_REGISTRANT reg   " +
316				"     on instreg.SES_REGISTRANT_ID=reg.ID  " +
317				"  where inst2loc.SES_INSTANCE_ID=  "+instanceID+ " " +
318				" 		 		 and regi.CAN_FLAG = 0 " +
319				" 		 and attnd.CAN_FLAG = 0   " +
320				"   and inst2att.SES_ATTRIBUTE_ID="+attributeID+ " " +
321				" 		 AND attnd.BOOKING_TS IS NOT NULL   " +
322				" 		  AND attnd.REG_CONTACT_FLAG=0   " +
323				" 		 GROUP BY LOCATION_NAME,  START_DATE, REGISTRANT_NAME, SES_ATTRIBUTE_VALUE_ID )) AS tbl2  ";
324//				" 		 GROUP BY LOCATION_NAME,  START_DATE, REGISTRANT_NAME, COUNT_NAME  " +
325//				" 		 order by LOCATION_NAME,  START_DATE, REGISTRANT_NAME, COUNT_NAME; ";
326
327		document.getElementById(idName).value = SQLCount;
328//		return SQLCount;
329}
330*/
331
332function getNowDaterpt(now) {
333//  var now = new Date();
334  var then = now.getFullYear()+'-';
335	if (now.getMonth()+1 < 10) then += "0" + (now.getMonth()+1)+'-'; else then += (now.getMonth()+1)+'-';
336	if (now.getDate() < 10) then += "0" +now.getDate(); else then += ''+now.getDate();
337	then += ' ';
338	if (now.getHours() < 10) then += "0" +now.getHours(); else then += ''+now.getHours();
339	then += ':';
340	if (now.getMinutes() < 10) then += "0" +now.getMinutes(); else then += ''+now.getMinutes();
341	then += ':';
342	if (now.getSeconds() < 10) then += "0" +now.getSeconds(); else then += ''+now.getSeconds();
343
344  return then;
345}
346
347function changeFormat(myForm,newType, groupName) {
348
349	document.getElementById("exportFormat" + groupName).value=newType;
350	if (newType=='PDF') {
351		document.getElementById("IS_IGNORE_PAGINATION" + groupName).value="false";
352		document.getElementById("IS_reportType" + groupName).value="P";
353	}else  if (newType=='XLS') {
354		document.getElementById("IS_IGNORE_PAGINATION" + groupName).value="true";
355		document.getElementById("IS_reportType" + groupName).value="E";
356	}else {
357		document.getElementById("IS_IGNORE_PAGINATION" + groupName).value="true";
358		document.getElementById("IS_reportType" + groupName).value="C";
359	}
360
361//jlm 08/26/2012 converted to <select so no longer want to submit	myForm.submit();
362
363}
364function updateReportURI(keyID, groupName)
365{
366	if(keyID==147) {
367		document.getElementById("rpturi" + groupName).value="/reports/Jasper4_5_0/SESAdminComments";
368		document.getElementById("reportTitle"  + groupName).value='Administrative Comments';
369	}else if(keyID==148) {
370		document.getElementById("rpturi" + groupName).value="/reports/Jasper4_5_0/SESHealthComments";
371		document.getElementById("reportTitle" + groupName).value='Health Officer Comments';
372	}else {
373		 document.getElementById("rpturi" + groupName).value="/reports/Jasper4_5_0/SESAttendeeAdminFields";
374		 document.getElementById("reportTitle" + groupName).value='Administrative Fields Report';
375	}
376}
377function updateAttendeeColumnName(indexID)
378{
379	var allGroupNames = document.getElementById("mySQLColumnNamesALL").value;
380	var allGroupNamesArray = allGroupNames.split(',');
381	document.getElementById("ATTENDEE_COLUMN_NAMEOperations").value =allGroupNamesArray[indexID];
382
383}
384
385//LLG 2015-10-06 adding logic to check password for HIPAA compliance
386//LLG 2015-10-13 adding 73, 63, and 16 to checked options
387function checkHIPAAInfo(orgkey,mdmUser_ID,eventInstanceID,indexID,keyID,registrationID,attendeeID,thisInstanceLocationID, groupName)
388{
389	if(keyID==148 || keyID==73 || keyID==63 || keyID==16)//148 is health officer, 73 medical concerns, 63 allergies, 16 dietary restrictions
390	{
391		if(hipaaPassword=='' || prevEvent != eventInstanceID)//either first time in(no password) or in new event
392		{
393			displayInfo = "<center>Please enter the<br>Health Officer password<br><br>";
394			displayInfo += "<input type=text id=pwText size=15 onkeydown=\"if (event.keyCode == 13) clickEnter("+eventInstanceID+","+indexID+","+keyID+","+registrationID+","+attendeeID+","+thisInstanceLocationID + ",'" + groupName + "'); \" /><br>";
395			displayInfo += "</center>";
396			document.getElementById("dialog-modal-essentials").innerHTML = displayInfo;
397			$( "#dialog-modal-essentials" ).dialog({
398				autoOpen: false,
399				height: 175,
400				width: 200,
401				title: "Password",
402				position: {
403                    my: "center top",
404                    at: "center top+100px",
405                    of: window
406                },
407                modal: true,
408				buttons:  {
409					" Enter ": function() { clickEnter(eventInstanceID,indexID,keyID,registrationID,attendeeID,thisInstanceLocationID, groupName); },
410			        Cancel: function() {
411			        	tryPWAgain(eventInstanceID,indexID,keyID,'',registrationID,attendeeID,thisInstanceLocationID, groupName);
412						$( this ).dialog( "close" );
413					}
414				},
415				close: function(dialog){
416					tryPWAgain(eventInstanceID, indexID, keyID, '', registrationID, attendeeID, thisInstanceLocationID, groupName);
417					$( this ).dialog('destroy').remove();
418					if (document.getElementById("essentialsParentDiv")) document.getElementById("essentialsParentDiv").innerHTML= "<div id=\"dialog-modal-essentials\" class=\"dialog-modal-standard\"></div>";
419				}
420
421			 });
422			//$(".ui-dialog-titlebar-close span").removeClass("ui-icon-closethick").addClass("ui-icon-minusthick");
423			 $( "#dialog-modal-essentials" ).dialog( "open" );
424		}else{
425			if(indexID==-1)checkPasswordCheckin(eventInstanceID,indexID,keyID,registrationID,attendeeID,thisInstanceLocationID, groupName);
426			else checkPassword(eventInstanceID,indexID,keyID, groupName); }//check just in case password got corrupted
427
428	}else
429	{
430		updateAttendeeColumnName(indexID);
431		updateReportURI(keyID, groupName);
432		updateAdminContentSortOrder(orgKey,mdmUser_ID,eventInstanceID,keyID);//onChangeCall
433	}
434
435}
436function clickEnter(eventInstanceID,indexID,keyID,registrationID,attendeeID,thisInstanceLocationID, groupName)
437{
438	hipaaPassword=encodeURIComponentCustom(document.getElementById('pwText').value);
439	if(indexID==-1)checkPasswordCheckin(eventInstanceID,indexID,keyID,registrationID,attendeeID,thisInstanceLocationID, groupName);//LLG 2015-10-28 indexID == -1 is from checking screen
440	else checkPassword(eventInstanceID,indexID,keyID, groupName);
441	$('#dialog-modal-essentials' ).dialog( "destroy" ).remove();
442	document.getElementById("essentialsParentDiv").innerHTML= "<div id=\"dialog-modal-essentials\" class=\"dialog-modal-standard\"></div>";
443}
444function checkPassword(eventInstanceID,indexID,keyID, groupName)
445{
446	var timestamp = new Date();
447	var errorMsg = '';
448
449	$.get("inc/ajax_reports.php?checkPassword="+orgKey +
450			"&hipaaPassword="+hipaaPassword+
451			"&eventInstanceID="+eventInstanceID+
452			"&TimeStamp="+timestamp,
453		function(data){
454			data = jQuery.trim(data);
455			if(data==1)
456			{
457				//document.getElementById('refreshSort').style.visibility = 'visible';
458				prevEvent=eventInstanceID;//save eventID so you can tell when you have a new event
459				updateAttendeeColumnName(indexID);
460				updateReportURI(keyID, groupName);
461				updateAdminContentSortOrder(orgKey,mdmUser_ID,eventInstanceID,keyID);
462			}else
463			{
464				alert( "That password was not correct");
465				hipaaPassword='';
466				errorMsg = "<b>An incorrect password was entered.</b><br>";
467				tryPWAgain(eventInstanceID,indexID,keyID,errorMsg,registrationID,attendeeID,thisInstanceLocationID, groupName);
468			}
469		});
470}
471function tryPWAgain(eventInstanceID,indexID,keyID,errorMsg,registrationID,attendeeID,thisInstanceLocationID, groupName)
472{
473	//document.getElementById('refreshSort').style.visibility = 'hidden';//hide button so user can not 'refresh' past bad password
474	var reEnterButton = "<button type=button onclick=\"checkHIPAAInfo('"+orgKey+"',"+mdmUser_ID+","+eventInstanceID+","+indexID+","+keyID+","+registrationID+","+attendeeID+","+thisInstanceLocationID + ",'" + groupName + "')\">Enter Password</button>";
475	if(indexID==-1){//LLG 2015-10-28 indexID == -1 is from checking screen
476		errorMsg += "<b>Click the Enter Password button to re-enter your password<br>or select the health icon again.</b><br>"+reEnterButton;
477		document.getElementById("viewError").innerHTML = errorMsg;
478	}else{
479		errorMsg += "<b>Click the Enter Password button to enter your password<br>or select another field option from the dropdown list above.</b><br>"+reEnterButton;
480		document.getElementById("viewInstance").innerHTML = errorMsg;
481	}
482}
483function openReportModal(orgKey,mdmUser_ID,modalTitle,eventInstanceID,reportIDtmp,groupName,uniqueKey,width, height)
484{
485	var displayInfo = "<div id=reportselection"+reportIDtmp+uniqueKey+" class=text10 ></div>";
486
487//	var $m = mobileModal(modalTitle, displayInfo);
488
489//	document.getElementById("dialog-modal-essentials").innerHTML = displayInfo;
490//	$( "#dialog-modal-essentials" ).dialog({
491//		autoOpen: false,
492//		height: height,
493//		width: width,
494//		title: modalTitle,
495//		position: {
496//            my: "center top",
497//            at: "center top+100px",
498//            of: window
499//        },
500//        modal: true,
501//		buttons:  {
502//			Done: function() {
503//	        	$( this ).dialog( "close" );
504//			}
505//		},
506//		close: function(dialog){
507//			$( this ).dialog('destroy').remove();
508//			if (document.getElementById("essentialsParentDiv")) document.getElementById("essentialsParentDiv").innerHTML= "<div id=\"dialog-modal-essentials\" class=\"dialog-modal-standard\"></div>";
509//		}
510//
511//	 });
512
513	lastReportID=0;
514	getSelectedReportParam(orgKey,reportIDtmp,groupName,modalTitle,eventInstanceID,uniqueKey);
515//	$( "#dialog-modal-essentials" ).dialog( "open" );
516
517}
518
519function runReportreportsJS(myForm)
520{
521	myForm.submit();
522	saveReportView();//LLG 2015-10-13 added to clear the HIPAA password modal
523	if ($("#dialog-modal-essentials").hasClass('ui-dialog-content')) //jlm 22-15-2015 changed from dialog-modal-standard  to ui-dialog-content - all modals have class dialog-modal-standard
524	{
525		$( "#dialog-modal-essentials" ).dialog( "destroy" ).remove();
526		if (document.getElementById("essentialsParentDiv")) document.getElementById("essentialsParentDiv").innerHTML= "<div id=\"dialog-modal-essentials\" class=\"dialog-modal-standard\"></div>";
527	}
528
529}
530function saveReportView()
531{
532	 var openDivs='', divID='';
533	 var elements = document.getElementsByTagName('div');
534	  for(var i=0; i<elements.length; i++) {
535	 	     var divElement = elements[i];
536	 	     divID=divElement.id;
537	 	     if (divID.slice(0,6)=='RPTDIV') {
538				if( !$('#'+divID).is(':visible') ) {}
539				else { openDivs += divElement.id+"@"; }
540	 	     }
541	   }
542		var timestamp = new Date();
543
544		$.get("/inc/ajax_reports.php?saveReportView=true"
545				+"&openDivs="+openDivs
546				+"&TimeStamp="+timestamp,
547	 	  function(data){
548					data = jQuery.trim(data);
549	//jlm 09-03-2015 removed alert - was showing full page load may have been caused by runReportreportsJS (somehow)	if (data=='') {} else { alert(data); }
550		});
551}
552
553//jlm 06/22/2012 moved this function from reporting.php to here
554function changeSelectAll(selectName, selectID, selectValue, selectText) {
555	if ($('#' + selectID).length < 1) return;
556
557	if (selectValue != '0') document.getElementById(selectID).value = 0;
558	else document.getElementById(selectID).value = 1;
559	//jlm 09/22/2012 - receivig an error on _NAME using selectID for location so putting in if checks and also using selectName
560	if (document.getElementById(selectID + "_NAME")) { document.getElementById(selectID + "_NAME").value = selectText; }
561	if (document.getElementById(selectName + "_NAME")) { document.getElementById(selectName + "_NAME").value = selectText; }
562}
563
564function changeSelectionCriteria(orgKey,mdmUser_ID,groupName,newValue,isFrom)
565{
566	var selectionCriteriaStr = "";
567	if ($("#CampIdentifier" + groupName).length)
568	{ //if it exists
569		var e = document.getElementById("CampIdentifier" + groupName);
570		selectionCriteriaStr += e.options[e.selectedIndex].text;
571		document.getElementById("ReportCampName"  + groupName).value=selectionCriteriaStr;
572		//jlm 03-06-2013 added category selection - switch visible category depending upon which camp is selected
573		var campIdentifier=document.getElementById("CampIdentifier"+groupName).value;
574		if (document.getElementById('hidemeDIV' + campIdentifier)) {
575			if( !$('#hidemeDIV' + campIdentifier).is(':visible') ) {
576				$('#hidemeDIV' + campIdentifier).toggle();
577			}
578
579			var allCamps=document.getElementById("allCamps").value.split('@');
580			var thisCamp=0;
581			for (var i=0; i<allCamps.length; i++)
582			{	thisCamp=allCamps[i];
583				if (campIdentifier==thisCamp) {}
584				else {
585					if( $('#hidemeDIV'+thisCamp).is(':visible') ) {
586						$('#hidemeDIV'+thisCamp).toggle();
587						document.getElementById("categoryList"+campIdentifier).value=0;
588						document.getElementById("categoryListHidden").value=0;
589					}
590				}
591			}
592		}
593	}
594	if (document.getElementById("SDATE" + groupName)) { //if it exists
595		//if (selectionCriteriaStr.length > 1) selectionCriteriaStr += " - ";
596		document.getElementById("ReportSDate" + groupName).value= document.getElementById("SDATE"+groupName).value;
597	}
598	if (document.getElementById("EDATE"+groupName)) { //if it exists
599		document.getElementById("ReportEDate" + groupName).value= document.getElementById("EDATE"+groupName).value;
600	}
601}
602function changeHiddenMonthDay(paramid,newValue,valueType)
603{
604	var month = $('#' + paramid).parent().find('#calMonth').val();
605	var year  = $('#' + paramid).parent().find('#calYear').val();
606
607	$('#' + paramid).val(year + "-" + month + "-01");
608}
609function exportTableToExcel(myForm, orgKey,mdmUser_ID,tableID,title)
610{
611	//var timestamp = new Date(),
612	var rowInfo="", tableInfo="", skipCol1=-1,skipCol2=-1;
613	var oTable = document.getElementById(tableID);
614    //gets table
615	if (document.getElementById('skipCol1')) { skipCol1=document.getElementById('skipCol1').value; }
616	if (document.getElementById('skipCol2')) { skipCol2=document.getElementById('skipCol2').value; }
617    var rowLength = oTable.rows.length;
618    //gets rows of table
619
620    for (var i = 0; i < rowLength; i++){
621    //loops through rows
622       rowInfo="";
623       var oCells = oTable.rows.item(i).cells;
624       //gets cells of current row
625       var cellLength = oCells.length;
626       for(var j = 0; j < cellLength; j++){
627       //loops through each cell in current row
628    	   if (skipCol1==j || skipCol2==j) {}
629    	   else {
630	          var cellVal = oCells.item(j).innerHTML;
631	          rowInfo += ""+cellVal + "@:@";
632    	   }
633       }
634       rowInfo = rowInfo.slice(0,-3);
635       tableInfo += rowInfo+"|@|";
636    }
637    tableInfo = tableInfo.slice(0,-3);
638    document.getElementById('exportTable').value=tableInfo;
639    myForm.submit();
640}
641function reloadDataDump(orgKey,mdmUser_ID,reportIDtmp,groupName, eventInstanceID,locationID,registrantID,inProgress,exportToCSV)
642{
643	reportID            = reportIDtmp;
644	var registrantTypes = [];
645	var $regLi          = $('#selectRegistrantTypeSpecial');
646
647	exportToCSV = exportToCSV !== true ? false : true;
648
649	if ($regLi.length)
650	{
651		$regLi.find('[data-changed]').removeAttr('data-changed');
652		registrantTypes = $regLi.find('input[name = "registrantTypes"]:checked').map(function() { return $(this).val(); }).toArray();
653	}
654
655	var url = '/inc/ajax_reports.php';
656	var postdata = {
657		'getSelectedReportExcelData': orgKey,
658		'orgKey'                    : orgKey,
659		'mdmUser_ID'                : mdmUser_ID,
660		'groupName'                 : groupName,
661		'reportID'                  : reportID,
662		'eventInstanceID'           : eventInstanceID,
663		'locationID'                : locationID,
664		'registrantID'              : registrantID,
665		'inProgress'                : inProgress,
666		'registrantTypes'           : registrantTypes,
667		'exportToCSV'               : exportToCSV ? 1 : 0
668	};
669
670	if (exportToCSV)
671	{
672		global.form_submit(postdata, url);
673	}
674	else
675	{
676		$.post(url, postdata, function(data)
677		{
678			mobileModalEdit($('.modal[role = "dialog"]:last'), null, data);
679		});
680	}
681
682}
683function showReportDetails(orgKey,mdmUser_ID,registrationID,reportID,groupName,eventInstanceID, submitInfo,newLine,reportLevel,keyValue,instanceLocationID,attendeeID,suppresParam,useATag)
684{
685	var timestamp = new Date();
686	var titletmp=decodeURIComponent(submitInfo.replace(/\+/g, ' '));
687
688	$.get("inc/ajax_reports.php?showReportDetails="+orgKey +
689			"&orgKey="+orgKey+
690			"&mdmUser_ID="+mdmUser_ID +
691			"&registrationID="+registrationID+
692			"&reportID="+reportID+
693			"&groupName="+groupName+
694			"&eventInstanceID="+eventInstanceID+
695			"&submitInfo="+submitInfo+
696			"&newLine="+newLine+
697			"&reportLevel="+reportLevel+
698			"&keyValue="+keyValue+
699			"&instanceLocationID="+instanceLocationID+
700			"&attendeeID="+attendeeID+
701			"&suppresParam="+suppresParam+
702			"&useATag="+useATag+
703			"&TimeStamp="+timestamp,
704 	  function(data){
705		//alert("viewcalendar"+data);
706		document.getElementById("dialog-modal-reports").innerHTML = data;
707		$( "#dialog-modal-reports" ).dialog({
708			autoOpen: false,
709			height: 500,
710			width: 500,
711			title: titletmp,
712			modal: true,
713			buttons:  {
714		            Close: function() {
715						$( this ).dialog( "close" );
716		            }
717				},
718				close: function(dialog)
719				{
720					$(  this  ).dialog('destroy').remove();
721					document.getElementById("essentialsParentDiv").innerHTML="<div id=\"dialog-modal-reports\" class=\"dialog-modal-standard\"></div>";
722				}
723		 });
724		$( "#dialog-modal-reports" ).dialog( "open" );
725		 });
726
727	}
728
729function getSelectedReportExcelData(orgKey, reportIDtmp, groupName, title, eventInstanceID, showFavorites)
730{
731	reportID = reportIDtmp;
732	var titletmp = decodeURIComponent(title.replace(/\+/g, ' '));
733	showFavorites = showFavorites == null || showFavorites == undefined ? '0' : showFavorites;
734
735	$.post('/inc/ajax_reports.php',
736	{
737		'getSelectedReportExcelData': orgKey,
738		'orgKey'                    : orgKey,
739		'mdmUser_ID'                : mdmUser_ID,
740		'groupName'                 : groupName,
741		'reportID'                  : reportID,
742		'eventInstanceID'           : eventInstanceID,
743		'locationID'                : '-1',
744		'registrantID'              : '0',
745		'inProgress'                : '0',
746		'showFavorites'             : showFavorites
747	}, function(data)
748	{
749		var json = parseJSON(data);
750
751		if (json !== false)
752		{
753			data = json.DATA;
754			titletmp = json.FAVORITE + titletmp;
755		}
756
757		var buttons = {
758			'Export to CSV': function()
759			{
760				var baseName = reportIDtmp == 226 ? 'myEventClassData' : 'myEventData';
761				var n = new Date();
762				global.tableToCSV($m.find('table:first'), 0, baseName + '-' + n.getFullYear() + '-' + pad(n.getMonth() + 1, 2, '0') + '-' + pad(n.getDate(), 2, '0'))
763			}
764		};
765
766		if (reportIDtmp == 35 || reportIDtmp == 423 )
767			buttons = {};
768
769		var $m = mobileModal(titletmp, data, buttons, null, 'large');
770
771	});
772
773}
774
775var sdateHold='';
776var edateHold='';
777var sdateHold2='';
778var edateHold2='';
779var lastReportID=0;
780function getSelectedReportParam(orgKey,reportIDtmp,groupName,title,eventInstanceID,uniqueKey,showFavorites, reportLevel, registrationID, suppresParam)
781{
782	reportLevel 	= reportLevel    == null ? 0 : reportLevel;
783	suppresParam  	= suppresParam   == null ? 0 : suppresParam;
784	registrationID	= registrationID == null ? 0 : registrationID;
785
786	reportID=reportIDtmp;
787	var timestamp = new Date();
788	var titletmp=decodeURIComponent(title.replace(/\+/g, ' '));
789	uniqueKey 		   = uniqueKey == null          || uniqueKey == undefined          ? ''  			 : uniqueKey;
790	showFavorites 	   = showFavorites == null      || showFavorites == undefined 	   ? '0' 			 : showFavorites;
791
792	var instanceLocationID = 0;
793	if ($('#locationclassReq').length)
794	{
795		instanceLocationID = $('#locationclassReq').val();
796	}
797	else if ($("input[name=location]").length)
798	{
799		instanceLocationID = $("input[name=location]").val();
800	}
801
802	//jlm 11-02-2012 - these don't appear to be used!	var sdatetmp='',edatetmp='';
803	//jlm 04-16-2013	clearGroupNameSelectionArea(groupName);
804
805		$.get("/inc/ajax_reports.php?getSelectedReportParam="+orgKey
806				+"&orgKey="+orgKey
807				+"&mdmUser_ID="+mdmUser_ID
808				+"&DistrictSelect="+DistrictSelect
809				+"&CampSelect="+camp
810				+"&AccountSelect="+account
811				+"&groupName="+groupName
812				+"&reportID="+reportID
813				+"&eventInstanceID="+eventInstanceID
814				+"&instanceLocationID="+instanceLocationID
815				+"&sdateHold="+sdateHold
816				+"&edateHold="+edateHold
817				+"&sdateHold2="+sdateHold2
818				+"&edateHold2="+edateHold2
819				+"&showFavorites="+showFavorites
820				+"&reportLevel="+reportLevel
821				+"&uniqueKey=" + uniqueKey
822				+"&registrationID=" + registrationID
823				+"&suppresParam=" + suppresParam
824				+"&TimeStamp="+timestamp,
825	 	  function(data)
826	 	  {
827			var json = parseJSON(data);
828
829			if (json !== false)
830			{
831				data = json.DATA;
832				titletmp = json.FAVORITE + titletmp;
833			}
834
835			//alert("viewcalendar"+data);
836			if (document.getElementById("reportselection"+lastReportID)) document.getElementById("reportselection"+lastReportID).innerHTML='';
837			lastReportID=reportID;
838				// document.getElementById("reportselection"+reportID+uniqueKey).innerHTML = "<br><fieldset><legend><b>"+titletmp+"</b></legend>"+data+"</fieldset>";
839				// informationDisplay( window.btoa('<div style="text-align: center; font-weight: bold; padding: 4px 0px 10px 0px;">' + titletmp + '</div>' + data), 350 );
840				mobileModal(titletmp, data);
841
842				if ($( "#SDATE" + groupName ).length)
843					reports.initializeDatePickerFromTo('SDATE', 'EDATE', groupName);
844
845				if ($( "#SDATE2" + groupName ).length)
846					reports.initializeDatePickerFromTo('SDATE2', 'EDATE2', groupName);
847
848					if (document.getElementById(groupName+"DEFAULT_ORDER_BY_FLAG")) { //ID exists
849						$(function() {
850							$( "#a_orderby" ).sortable({
851								cursor: 'move',
852								update: function(event, ui) { updateSortOrderBy(groupName); }
853
854								});
855							$( "#a_orderby" ).disableSelection();
856						});
857
858
859					}
860			 });
861
862
863
864}
865function updateSortOrderBy(groupName)
866{
867	var defaultOrderValue=document.getElementById(groupName+"DEFAULT_ORDER_BY_VALUE").value;
868	var orderBy = $('#a_orderby').sortable('toArray');
869	if (defaultOrderValue==orderBy) { document.getElementById(groupName+"DEFAULT_ORDER_BY_FLAG").value=1; }
870	else { document.getElementById(groupName+"DEFAULT_ORDER_BY_FLAG").value=0; }
871
872	document.getElementById("ORDER_BY"+groupName+"").value=orderBy;
873	var orderByName='';
874	 var x=$("li").toArray(); //Requires this to be the only LI on the page
875     for (var i=0;i<x.length;i++)
876     {
877    	 orderByName += x[i].innerHTML.slice(27,-6)+",";
878     }
879     document.getElementById("ORDER_BY"+groupName+"_NAME").value=orderByName.slice(0,-1);
880
881}
882function changeURI(newURI,subTitle,formID, groupName)
883{
884	document.forms[formID].elements['rpturi' + groupName].value=newURI;
885	document.forms[formID].elements['reportSubTitle' + groupName].value=subTitle;
886
887	//jlm 05-18-2015 changing for specific form document.getElementById("rpturi").value=newURI;
888	//jlm 05-18-2015 changing for specific form document.getElementById("reportSubTitle").value=subTitle;
889}
890function showMyReportsOnly(orgKey,mdmUser_ID,systemID,eventInstanceID)
891{
892	displaySelectReport(orgKey,mdmUser_ID,systemID,eventInstanceID);
893}
894function updateReportSearchContent(orgKey,mdmUser_ID,eventInstanceID,systemID,grpIds)
895{
896	var searchstring = encodeURIComponent(jQuery.trim(document.getElementById('searchstring').value));
897	if (searchstring=='') {
898		displaySelectReport(orgKey,mdmUser_ID,systemID,eventInstanceID);
899	}else {
900		var timestamp = new Date();
901		$.get("inc/ajax_reports.php?updateReportSearchContent=true"
902				+"&systemID="+systemID
903				+"&eventInstanceID="+eventInstanceID
904				+"&grpIds="+grpIds
905				+"&searchstring="+searchstring
906				+"&TimeStamp="+timestamp,
907	 	  function(data){
908			document.getElementById("reportSearchContentDIV").innerHTML = data;
909		});
910	}
911}
912function displaySelectReport(orgKey,mdmUser_ID,systemID,eventInstanceID)
913{
914	var timestamp = new Date();
915
916	$.get("inc/ajax_reports.php?displaySelectReport="+orgKey
917			+"&orgKey="+orgKey
918			+"&mdmUser_ID="+mdmUser_ID
919			+"&systemID="+systemID
920			+"&eventInstanceID="+eventInstanceID
921			+"&myReportsOnly=0"
922			+"&TimeStamp="+timestamp,
923 	  function(data){
924		if (eventInstanceID > 0) document.getElementById("editPage").innerHTML = data;
925		else document.getElementById("reportselect").innerHTML = data;
926
927		$('#reportSearchContentDIV div[id ^= "categoryToggle"] > table > tbody > tr > td > div').each(function()
928		{
929			if ($(this).css('display') != 'none')
930				$(this).closest('div[id ^= "categoryToggle"]').show();
931		});
932
933	});
934}
935
936/* jlm 04-16-2013 changing to only reset lastreportID
937function clearGroupNameSelectionArea(currentGroupName)
938{
939	if (lastReportID > 0) document.getElementById("reportselection"+lastReportID).innerHTML='';
940
941	var allGroupNames = document.getElementById("allGroupNames").value;
942
943	var allGroupNamesArray = allGroupNames.split('@:@');
944	for(var i=0; i< allGroupNamesArray.length; i++)
945	{
946		var groupName=allGroupNamesArray[i];
947		if (currentGroupName==groupName) {}
948		else {	document.getElementById("reportselection"+groupName).innerHTML=''; }
949	}
950
951} */
952
953function showLocationSelectionInfo(accountGroup,javaIDgroupName)
954{
955	var timestamp = new Date();
956		$.get("inc/ajax_reports.php?showLocationSelectionInfo=true"
957				+"&javaIDgroupName="+javaIDgroupName
958				+"&accountGroup="+accountGroup
959				+"&TimeStamp="+timestamp,
960	 	  function(data){
961			data = jQuery.trim(data);
962			document.getElementById("locationInfoDIV"+javaIDgroupName).innerHTML = data;
963
964		});
965
966}
967
968function createBSAAccountingTrans(orgKey,groupName)
969{
970	var sdate=document.getElementById('SDATE'+groupName).value;
971	var edate=document.getElementById('EDATE'+groupName).value;
972	var sdate2=document.getElementById('SDATE2'+groupName).value;
973	var edate2=document.getElementById('EDATE2'+groupName).value;
974	var limitBSAImport=0;
975	if (document.getElementById('LIMIT_BSA_IMPORT_COUNCIL_PROGRAM'+groupName).checked) limitBSAImport=1;
976
977	var thisWindow="bsatransaction.php?orgKey="+orgKey+"&sdate="+sdate+"&edate="+edate+"&echeckSdate="+sdate2+"&echeckEdate="+edate2+"&limitBSAImport="+limitBSAImport;
978
979	window.open(thisWindow,  '_blank' );
980
981
982}
983
984function createBSAAccountingTransBPSFee(orgKey,groupName)
985{
986	var BillingMonth=document.getElementById('BillingMonth'+groupName).value;
987	var thisWindow="bsatransactionBPSFee.php?orgKey="+orgKey+"&BillingMonth="+BillingMonth;
988
989	window.open(thisWindow,  '_blank' );
990
991}
992function updateFavorite(mdmUserID,reportID,action)
993{
994	var timestamp = new Date();
995	//var grpIDs = '';
996	var fclass='';
997	var faction='';
998
999	//grpIDs = document.getElementById("favGrpIDs").value;
1000	$.get("inc/ajax_reports.php?updateFavorite=true"
1001			+"&mdmUserID="+mdmUserID
1002			+"&reportID="+reportID
1003			+"&action="+action
1004			+"&TimeStamp="+timestamp,
1005 	  function(data)
1006 	  {
1007		data = jQuery.trim(data);
1008
1009		if (data==1)
1010		{
1011			if (action=='add')
1012			{
1013				fclass = "class='glyphicon glyphicon-heart textBSARed' ";
1014				faction = "remove";
1015				ftitle = "title='Remove from Favorites' ";
1016				$("#fav"+reportID).show();
1017				$('#addfav' + reportID).removeClass('favorite-hover');
1018			}
1019			else
1020			{
1021				fclass = "class='glyphicon glyphicon-heart-empty textBSARed' ";
1022				faction = "add";
1023				ftitle = "title='Add to Favorites' ";
1024				$("#fav"+reportID).hide();
1025				$('#addfav' + reportID).addClass('favorite-hover');
1026			}
1027
1028			if ($('#favoriteBtn').length)
1029				document.getElementById("favoriteBtn").innerHTML = "<span "+fclass+" style='font-size:18px;' onclick=\"updateFavorite("+mdmUserID+","+reportID+",'"+faction+"') \" "+ftitle+" ></span>";
1030		}
1031		else
1032			alert(data);
1033
1034	});
1035}
1036function getFavoriteReports(mdmUserID,grpIDs)
1037{
1038	var timestamp = new Date();
1039	$.get("inc/ajax_reports.php?getFavoriteReports=true"
1040			+"&mdmUserID="+mdmUserID
1041			+"&grpIDs="+grpIDs
1042			+"&TimeStamp="+timestamp,
1043 	  function(data){
1044		data = jQuery.trim(data);
1045		document.getElementById("favoriteReportsDIV").innerHTML = data;
1046	  }
1047	);
1048}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.