PageRenderTime 27ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/jf/web/reports/IS_Reportssmry.php

http://tinkerportal.googlecode.com/
PHP | 1770 lines | 1270 code | 238 blank | 262 comment | 333 complexity | 0399dd5157eaf2f7a1408ee791df86b7 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1<?php
   2if (session_id() == "") session_start(); // Initialize Session data
   3ob_start();
   4?>
   5<?php include_once "phprptinc/ewrcfg5.php"; ?>
   6<?php include_once "phprptinc/ewmysql.php"; ?>
   7<?php include_once "phprptinc/ewrfn5.php"; ?>
   8<?php include_once "phprptinc/ewrusrfn.php"; ?>
   9<?php
  10
  11// Global variable for table object
  12$IS_Reports = NULL;
  13
  14//
  15// Table class for IS Reports
  16//
  17class crIS_Reports {
  18	var $TableVar = 'IS_Reports';
  19	var $TableName = 'IS Reports';
  20	var $TableType = 'REPORT';
  21	var $ShowCurrentFilter = EWRPT_SHOW_CURRENT_FILTER;
  22	var $FilterPanelOption = EWRPT_FILTER_PANEL_OPTION;
  23	var $CurrentOrder; // Current order
  24	var $CurrentOrderType; // Current order type
  25
  26	// Table caption
  27	function TableCaption() {
  28		global $ReportLanguage;
  29		return $ReportLanguage->TablePhrase($this->TableVar, "TblCaption");
  30	}
  31
  32	// Session Group Per Page
  33	function getGroupPerPage() {
  34		return @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_grpperpage"];
  35	}
  36
  37	function setGroupPerPage($v) {
  38		@$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_grpperpage"] = $v;
  39	}
  40
  41	// Session Start Group
  42	function getStartGroup() {
  43		return @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_start"];
  44	}
  45
  46	function setStartGroup($v) {
  47		@$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_start"] = $v;
  48	}
  49
  50	// Session Order By
  51	function getOrderBy() {
  52		return @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_orderby"];
  53	}
  54
  55	function setOrderBy($v) {
  56		@$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_orderby"] = $v;
  57	}
  58
  59//	var $SelectLimit = TRUE;
  60	var $full_name;
  61	var $dob;
  62	var $joined_company_date;
  63	var $name;
  64	var $fields = array();
  65	var $Export; // Export
  66	var $ExportAll = TRUE;
  67	var $UseTokenInUrl = EWRPT_USE_TOKEN_IN_URL;
  68	var $RowType; // Row type
  69	var $RowTotalType; // Row total type
  70	var $RowTotalSubType; // Row total subtype
  71	var $RowGroupLevel; // Row group level
  72	var $RowAttrs = array(); // Row attributes
  73
  74	// Reset CSS styles for table object
  75	function ResetCSS() {
  76    	$this->RowAttrs["style"] = "";
  77		$this->RowAttrs["class"] = "";
  78		foreach ($this->fields as $fld) {
  79			$fld->ResetCSS();
  80		}
  81	}
  82
  83	//
  84	// Table class constructor
  85	//
  86	function crIS_Reports() {
  87		global $ReportLanguage;
  88
  89		// full_name
  90		$this->full_name = new crField('IS_Reports', 'IS Reports', 'x_full_name', 'full_name', '`full_name`', 200, EWRPT_DATATYPE_STRING, -1);
  91		$this->fields['full_name'] =& $this->full_name;
  92		$this->full_name->DateFilter = "";
  93		$this->full_name->SqlSelect = "";
  94		$this->full_name->SqlOrderBy = "";
  95
  96		// dob
  97		$this->dob = new crField('IS_Reports', 'IS Reports', 'x_dob', 'dob', '`dob`', 133, EWRPT_DATATYPE_DATE, 7);
  98		$this->dob->FldDefaultErrMsg = str_replace("%s", "/", $ReportLanguage->Phrase("IncorrectDateDMY"));
  99		$this->fields['dob'] =& $this->dob;
 100		$this->dob->DateFilter = "";
 101		$this->dob->SqlSelect = "";
 102		$this->dob->SqlOrderBy = "";
 103
 104		// joined_company_date
 105		$this->joined_company_date = new crField('IS_Reports', 'IS Reports', 'x_joined_company_date', 'joined_company_date', '`joined_company_date`', 133, EWRPT_DATATYPE_DATE, 7);
 106		$this->joined_company_date->FldDefaultErrMsg = str_replace("%s", "/", $ReportLanguage->Phrase("IncorrectDateDMY"));
 107		$this->fields['joined_company_date'] =& $this->joined_company_date;
 108		$this->joined_company_date->DateFilter = "";
 109		$this->joined_company_date->SqlSelect = "";
 110		$this->joined_company_date->SqlOrderBy = "";
 111
 112		// name
 113		$this->name = new crField('IS_Reports', 'IS Reports', 'x_name', 'name', '`name`', 200, EWRPT_DATATYPE_STRING, -1);
 114		$this->name->GroupingFieldId = 1;
 115		$this->fields['name'] =& $this->name;
 116		$this->name->DateFilter = "";
 117		$this->name->SqlSelect = "SELECT DISTINCT `name` FROM " . $this->SqlFrom();
 118		$this->name->SqlOrderBy = "`name`";
 119		$this->name->FldGroupByType = "";
 120		$this->name->FldGroupInt = "0";
 121		$this->name->FldGroupSql = "";
 122	}
 123
 124	// Multiple column sort
 125	function UpdateSort(&$ofld, $ctrl) {
 126		if ($this->CurrentOrder == $ofld->FldName) {
 127			$sLastSort = $ofld->getSort();
 128			if ($this->CurrentOrderType == "ASC" || $this->CurrentOrderType == "DESC") {
 129				$sThisSort = $this->CurrentOrderType;
 130			} else {
 131				$sThisSort = ($sLastSort == "ASC") ? "DESC" : "ASC";
 132			}
 133			$ofld->setSort($sThisSort);
 134		} else {
 135			if ($ofld->GroupingFieldId == 0 && !$ctrl) $ofld->setSort("");
 136		}
 137	}
 138
 139	// Get Sort SQL
 140	function SortSql() {
 141		$sDtlSortSql = "";
 142		$argrps = array();
 143		foreach ($this->fields as $fld) {
 144			if ($fld->getSort() <> "") {
 145				if ($fld->GroupingFieldId > 0) {
 146					if ($fld->FldGroupSql <> "")
 147						$argrps[$fld->GroupingFieldId] = str_replace("%s", $fld->FldExpression, $fld->FldGroupSql) . " " . $fld->getSort();
 148					else
 149						$argrps[$fld->GroupingFieldId] = $fld->FldExpression . " " . $fld->getSort();
 150				} else {
 151					if ($sDtlSortSql <> "") $sDtlSortSql .= ", ";
 152					$sDtlSortSql .= $fld->FldExpression . " " . $fld->getSort();
 153				}
 154			}
 155		}
 156		$sSortSql = "";
 157		foreach ($argrps as $grp) {
 158			if ($sSortSql <> "") $sSortSql .= ", ";
 159			$sSortSql .= $grp;
 160		}
 161		if ($sDtlSortSql <> "") {
 162			if ($sSortSql <> "") $sSortSql .= ",";
 163			$sSortSql .= $sDtlSortSql;
 164		}
 165		return $sSortSql;
 166	}
 167
 168	// Table level SQL
 169	function SqlFrom() { // From
 170		return "`vw__is_reports`";
 171	}
 172
 173	function SqlSelect() { // Select
 174		return "SELECT * FROM " . $this->SqlFrom();
 175	}
 176
 177	function SqlWhere() { // Where
 178		return "";
 179	}
 180
 181	function SqlGroupBy() { // Group By
 182		return "";
 183	}
 184
 185	function SqlHaving() { // Having
 186		return "";
 187	}
 188
 189	function SqlOrderBy() { // Order By
 190		return "`name` ASC";
 191	}
 192
 193	// Table Level Group SQL
 194	function SqlFirstGroupField() {
 195		return "`name`";
 196	}
 197
 198	function SqlSelectGroup() {
 199		return "SELECT DISTINCT " . $this->SqlFirstGroupField() . " FROM " . $this->SqlFrom();
 200	}
 201
 202	function SqlOrderByGroup() {
 203		return "`name` ASC";
 204	}
 205
 206	function SqlSelectAgg() {
 207		return "SELECT * FROM " . $this->SqlFrom();
 208	}
 209
 210	function SqlAggPfx() {
 211		return "";
 212	}
 213
 214	function SqlAggSfx() {
 215		return "";
 216	}
 217
 218	function SqlSelectCount() {
 219		return "SELECT COUNT(*) FROM " . $this->SqlFrom();
 220	}
 221
 222	// Sort URL
 223	function SortUrl(&$fld) {
 224		if ($this->Export <> "" ||
 225			in_array($fld->FldType, array(128, 204, 205))) { // Unsortable data type
 226				return "";
 227		} elseif ($fld->Sortable) {
 228			$sUrlParm = "order=" . urlencode($fld->FldName) . "&ordertype=" . $fld->ReverseSort();
 229			return ewrpt_CurrentPage() . "?" . $sUrlParm;
 230		} else {
 231			return "";
 232		}
 233	}
 234
 235	// Row attributes
 236	function RowAttributes() {
 237		$sAtt = "";
 238		foreach ($this->RowAttrs as $k => $v) {
 239			if (trim($v) <> "")
 240				$sAtt .= " " . $k . "=\"" . trim($v) . "\"";
 241		}
 242		return $sAtt;
 243	}
 244
 245	// Field object by fldvar
 246	function &fields($fldvar) {
 247		return $this->fields[$fldvar];
 248	}
 249
 250	// Table level events
 251	// Row Rendering event
 252	function Row_Rendering() {
 253
 254		// Enter your code here	
 255	}
 256
 257	// Cell Rendered event
 258	function Cell_Rendered(&$Field, $CurrentValue, &$ViewValue, &$ViewAttrs, &$CellAttrs, &$HrefValue) {
 259
 260		//$ViewValue = "xxx";
 261		//$ViewAttrs["style"] = "xxx";
 262
 263	}
 264
 265	// Row Rendered event
 266	function Row_Rendered() {
 267
 268		// To view properties of field class, use:
 269		//var_dump($this-><FieldName>); 
 270
 271	}
 272
 273	// Load Filters event
 274	function Filters_Load() {
 275
 276		// Enter your code here	
 277		// Example: Register/Unregister Custom Extended Filter
 278		//ewrpt_RegisterFilter($this-><Field>, 'StartsWithA', 'Starts With A', 'GetStartsWithAFilter');
 279		//ewrpt_UnregisterFilter($this-><Field>, 'StartsWithA');
 280
 281	}
 282
 283	// Page Filter Validated event
 284	function Page_FilterValidated() {
 285
 286		// Example:
 287		//global $MyTable;
 288		//$MyTable->MyField1->SearchValue = "your search criteria"; // Search value
 289
 290	}
 291
 292	// Chart Rendering event
 293	function Chart_Rendering(&$chart) {
 294
 295		// var_dump($chart);
 296	}
 297
 298	// Chart Rendered event
 299	function Chart_Rendered($chart, &$chartxml) {
 300
 301		// Example:	
 302		//$doc = $chart->XmlDoc; // Get the DOMDocument object
 303		// Enter your code to manipulate the DOMDocument object here
 304		//$chartxml = $doc->saveXML(); // Output the XML
 305
 306	}
 307
 308	// Email Sending event
 309	function Email_Sending(&$Email, &$Args) {
 310
 311		//var_dump($Email); var_dump($Args); exit();
 312		return TRUE;
 313	}
 314}
 315?>
 316<?php ewrpt_Header(FALSE) ?>
 317<?php
 318
 319// Create page object
 320$IS_Reports_summary = new crIS_Reports_summary();
 321$Page =& $IS_Reports_summary;
 322
 323// Page init
 324$IS_Reports_summary->Page_Init();
 325
 326// Page main
 327$IS_Reports_summary->Page_Main();
 328?>
 329<?php include_once "phprptinc/header.php"; ?>
 330<?php if ($IS_Reports->Export == "" || $IS_Reports->Export == "print" || $IS_Reports->Export == "email") { ?>
 331<script type="text/javascript">
 332
 333// Create page object
 334var IS_Reports_summary = new ewrpt_Page("IS_Reports_summary");
 335
 336// page properties
 337IS_Reports_summary.PageID = "summary"; // page ID
 338IS_Reports_summary.FormID = "fIS_Reportssummaryfilter"; // form ID
 339var EWRPT_PAGE_ID = IS_Reports_summary.PageID;
 340
 341// extend page with Chart_Rendering function
 342IS_Reports_summary.Chart_Rendering =  
 343 function(chart, chartid) { // DO NOT CHANGE THIS LINE!
 344
 345 	//alert(chartid);
 346 }
 347
 348// extend page with Chart_Rendered function
 349IS_Reports_summary.Chart_Rendered =  
 350 function(chart, chartid) { // DO NOT CHANGE THIS LINE!
 351
 352 	//alert(chartid);
 353 }
 354</script>
 355<?php } ?>
 356<?php if ($IS_Reports->Export == "") { ?>
 357<script language="JavaScript" type="text/javascript">
 358<!--
 359
 360// Write your client script here, no need to add script tags.
 361//-->
 362
 363</script>
 364<?php } ?>
 365<?php if ($IS_Reports->Export == "" || $IS_Reports->Export == "print" || $IS_Reports->Export == "email") { ?>
 366<script src="<?php echo EWRPT_FUSIONCHARTS_FREE_JSCLASS_FILE; ?>" type="text/javascript"></script>
 367<?php } ?>
 368<?php if ($IS_Reports->Export == "") { ?>
 369<div id="ewrpt_PopupFilter"><div class="bd"></div></div>
 370<script src="phprptjs/ewrptpop.js" type="text/javascript"></script>
 371<script type="text/javascript">
 372
 373// popup fields
 374<?php $jsdata = ewrpt_GetJsData($IS_Reports->name, $IS_Reports->name->FldType); ?>
 375ewrpt_CreatePopup("IS_Reports_name", [<?php echo $jsdata ?>]);
 376</script>
 377<?php } ?>
 378<?php if ($IS_Reports->Export == "" || $IS_Reports->Export == "print" || $IS_Reports->Export == "email") { ?>
 379<!-- Table Container (Begin) -->
 380<table id="ewContainer" cellspacing="0" cellpadding="0" border="0">
 381<!-- Top Container (Begin) -->
 382<tr><td colspan="3"><div id="ewTop" class="phpreportmaker">
 383<!-- top slot -->
 384<a name="top"></a>
 385<?php } ?>
 386<p class="phpreportmaker ewTitle"><?php echo $IS_Reports->TableCaption() ?>
 387&nbsp;&nbsp;<?php $IS_Reports_summary->ExportOptions->Render("body"); ?></p>
 388<?php $IS_Reports_summary->ShowPageHeader(); ?>
 389<?php $IS_Reports_summary->ShowMessage(); ?>
 390<br><br>
 391<?php if ($IS_Reports->Export == "" || $IS_Reports->Export == "print" || $IS_Reports->Export == "email") { ?>
 392</div></td></tr>
 393<!-- Top Container (End) -->
 394<tr>
 395	<!-- Left Container (Begin) -->
 396	<td style="vertical-align: top;"><div id="ewLeft" class="phpreportmaker">
 397	<!-- Left slot -->
 398	</div></td>
 399	<!-- Left Container (End) -->
 400	<!-- Center Container - Report (Begin) -->
 401	<td style="vertical-align: top;" class="ewPadding"><div id="ewCenter" class="phpreportmaker">
 402	<!-- center slot -->
 403<?php } ?>
 404<!-- summary report starts -->
 405<div id="report_summary">
 406<?php if ($IS_Reports->ShowCurrentFilter) { ?>
 407<div id="ewrptFilterList">
 408<?php $IS_Reports_summary->ShowFilterList() ?>
 409</div>
 410<br>
 411<?php } ?>
 412<table class="ewGrid" cellspacing="0"><tr>
 413	<td class="ewGridContent">
 414<?php if ($IS_Reports->Export == "") { ?>
 415<div class="ewGridUpperPanel">
 416<form action="<?php echo ewrpt_CurrentPage() ?>" name="ewpagerform" id="ewpagerform" class="ewForm">
 417<table border="0" cellspacing="0" cellpadding="0">
 418	<tr>
 419		<td style="white-space: nowrap;">
 420<?php if (!isset($Pager)) $Pager = new crPrevNextPager($IS_Reports_summary->StartGrp, $IS_Reports_summary->DisplayGrps, $IS_Reports_summary->TotalGrps) ?>
 421<?php if ($Pager->RecordCount > 0) { ?>
 422	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Page") ?>&nbsp;</span></td>
 423<!--first page button-->
 424	<?php if ($Pager->FirstButton->Enabled) { ?>
 425	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->FirstButton->Start ?>"><img src="phprptimages/first.gif" alt="<?php echo $ReportLanguage->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
 426	<?php } else { ?>
 427	<td><img src="phprptimages/firstdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
 428	<?php } ?>
 429<!--previous page button-->
 430	<?php if ($Pager->PrevButton->Enabled) { ?>
 431	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->PrevButton->Start ?>"><img src="phprptimages/prev.gif" alt="<?php echo $ReportLanguage->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
 432	<?php } else { ?>
 433	<td><img src="phprptimages/prevdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
 434	<?php } ?>
 435<!--current page number-->
 436	<td><input type="text" name="pageno" id="pageno" value="<?php echo $Pager->CurrentPage ?>" size="4"></td>
 437<!--next page button-->
 438	<?php if ($Pager->NextButton->Enabled) { ?>
 439	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->NextButton->Start ?>"><img src="phprptimages/next.gif" alt="<?php echo $ReportLanguage->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
 440	<?php } else { ?>
 441	<td><img src="phprptimages/nextdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
 442	<?php } ?>
 443<!--last page button-->
 444	<?php if ($Pager->LastButton->Enabled) { ?>
 445	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->LastButton->Start ?>"><img src="phprptimages/last.gif" alt="<?php echo $ReportLanguage->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
 446	<?php } else { ?>
 447	<td><img src="phprptimages/lastdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
 448	<?php } ?>
 449	<td><span class="phpreportmaker">&nbsp;<?php echo $ReportLanguage->Phrase("of") ?> <?php echo $Pager->PageCount ?></span></td>
 450	</tr></table>
 451	</td>	
 452	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
 453	<td>
 454	<span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Record") ?> <?php echo $Pager->FromIndex ?> <?php echo $ReportLanguage->Phrase("To") ?> <?php echo $Pager->ToIndex ?> <?php echo $ReportLanguage->Phrase("Of") ?> <?php echo $Pager->RecordCount ?></span>
 455<?php } else { ?>
 456	<?php if ($IS_Reports_summary->Filter == "0=101") { ?>
 457	<span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("EnterSearchCriteria") ?></span>
 458	<?php } else { ?>
 459	<span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("NoRecord") ?></span>
 460	<?php } ?>
 461<?php } ?>
 462		</td>
 463<?php if ($IS_Reports_summary->TotalGrps > 0) { ?>
 464		<td style="white-space: nowrap;">&nbsp;&nbsp;&nbsp;&nbsp;</td>
 465		<td align="right" style="vertical-align: top; white-space: nowrap;"><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("GroupsPerPage"); ?>&nbsp;
 466<select name="<?php echo EWRPT_TABLE_GROUP_PER_PAGE; ?>" onchange="this.form.submit();">
 467<option value="1"<?php if ($IS_Reports_summary->DisplayGrps == 1) echo " selected=\"selected\"" ?>>1</option>
 468<option value="2"<?php if ($IS_Reports_summary->DisplayGrps == 2) echo " selected=\"selected\"" ?>>2</option>
 469<option value="3"<?php if ($IS_Reports_summary->DisplayGrps == 3) echo " selected=\"selected\"" ?>>3</option>
 470<option value="4"<?php if ($IS_Reports_summary->DisplayGrps == 4) echo " selected=\"selected\"" ?>>4</option>
 471<option value="5"<?php if ($IS_Reports_summary->DisplayGrps == 5) echo " selected=\"selected\"" ?>>5</option>
 472<option value="10"<?php if ($IS_Reports_summary->DisplayGrps == 10) echo " selected=\"selected\"" ?>>10</option>
 473<option value="20"<?php if ($IS_Reports_summary->DisplayGrps == 20) echo " selected=\"selected\"" ?>>20</option>
 474<option value="50"<?php if ($IS_Reports_summary->DisplayGrps == 50) echo " selected=\"selected\"" ?>>50</option>
 475<option value="ALL"<?php if ($IS_Reports->getGroupPerPage() == -1) echo " selected=\"selected\"" ?>><?php echo $ReportLanguage->Phrase("AllRecords") ?></option>
 476</select>
 477		</span></td>
 478<?php } ?>
 479	</tr>
 480</table>
 481</form>
 482</div>
 483<?php } ?>
 484<!-- Report Grid (Begin) -->
 485<div class="ewGridMiddlePanel">
 486<table class="<?php echo $IS_Reports_summary->ReportTableClass ?>" cellspacing="0">
 487<?php
 488
 489// Set the last group to display if not export all
 490if ($IS_Reports->ExportAll && $IS_Reports->Export <> "") {
 491	$IS_Reports_summary->StopGrp = $IS_Reports_summary->TotalGrps;
 492} else {
 493	$IS_Reports_summary->StopGrp = $IS_Reports_summary->StartGrp + $IS_Reports_summary->DisplayGrps - 1;
 494}
 495
 496// Stop group <= total number of groups
 497if (intval($IS_Reports_summary->StopGrp) > intval($IS_Reports_summary->TotalGrps))
 498	$IS_Reports_summary->StopGrp = $IS_Reports_summary->TotalGrps;
 499$IS_Reports_summary->RecCount = 0;
 500
 501// Get first row
 502if ($IS_Reports_summary->TotalGrps > 0) {
 503	$IS_Reports_summary->GetGrpRow(1);
 504	$IS_Reports_summary->GrpCount = 1;
 505}
 506while (($rsgrp && !$rsgrp->EOF && $IS_Reports_summary->GrpCount <= $IS_Reports_summary->DisplayGrps) || $IS_Reports_summary->ShowFirstHeader) {
 507
 508	// Show header
 509	if ($IS_Reports_summary->ShowFirstHeader) {
 510?>
 511	<thead>
 512	<tr>
 513<td class="ewTableHeader">
 514<?php if ($IS_Reports->Export <> "") { ?>
 515<?php echo $IS_Reports->name->FldCaption() ?>
 516<?php } else { ?>
 517	<table cellspacing="0" class="ewTableHeaderBtn"><tr>
 518<?php if ($IS_Reports->SortUrl($IS_Reports->name) == "") { ?>
 519		<td style="vertical-align: bottom;"><?php echo $IS_Reports->name->FldCaption() ?></td>
 520<?php } else { ?>
 521		<td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $IS_Reports->SortUrl($IS_Reports->name) ?>',2);"><?php echo $IS_Reports->name->FldCaption() ?></td><td style="width: 10px;">
 522		<?php if ($IS_Reports->name->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($IS_Reports->name->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
 523<?php } ?>
 524		<td style="width: 20px;" align="right"><a href="#" onclick="ewrpt_ShowPopup(this.name, 'IS_Reports_name', false, '<?php echo $IS_Reports->name->RangeFrom; ?>', '<?php echo $IS_Reports->name->RangeTo; ?>');return false;" name="x_name<?php echo $IS_Reports_summary->Cnt[0][0]; ?>" id="x_name<?php echo $IS_Reports_summary->Cnt[0][0]; ?>"><img src="phprptimages/popup.gif" width="15" height="14" border="0" alt="<?php echo $ReportLanguage->Phrase("Filter") ?>"></a></td>
 525	</tr></table>
 526<?php } ?>
 527</td>
 528<td class="ewTableHeader">
 529<?php if ($IS_Reports->Export <> "") { ?>
 530<?php echo $IS_Reports->full_name->FldCaption() ?>
 531<?php } else { ?>
 532	<table cellspacing="0" class="ewTableHeaderBtn" style="white-space: nowrap;"><tr>
 533<?php if ($IS_Reports->SortUrl($IS_Reports->full_name) == "") { ?>
 534		<td style="vertical-align: bottom;"><?php echo $IS_Reports->full_name->FldCaption() ?></td>
 535<?php } else { ?>
 536		<td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $IS_Reports->SortUrl($IS_Reports->full_name) ?>',2);"><?php echo $IS_Reports->full_name->FldCaption() ?></td><td style="width: 10px;">
 537		<?php if ($IS_Reports->full_name->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($IS_Reports->full_name->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
 538<?php } ?>
 539	</tr></table>
 540<?php } ?>
 541</td>
 542<td class="ewTableHeader">
 543<?php if ($IS_Reports->Export <> "") { ?>
 544<?php echo $IS_Reports->dob->FldCaption() ?>
 545<?php } else { ?>
 546	<table cellspacing="0" class="ewTableHeaderBtn"><tr>
 547<?php if ($IS_Reports->SortUrl($IS_Reports->dob) == "") { ?>
 548		<td style="vertical-align: bottom;"><?php echo $IS_Reports->dob->FldCaption() ?></td>
 549<?php } else { ?>
 550		<td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $IS_Reports->SortUrl($IS_Reports->dob) ?>',2);"><?php echo $IS_Reports->dob->FldCaption() ?></td><td style="width: 10px;">
 551		<?php if ($IS_Reports->dob->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($IS_Reports->dob->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
 552<?php } ?>
 553	</tr></table>
 554<?php } ?>
 555</td>
 556<td class="ewTableHeader">
 557<?php if ($IS_Reports->Export <> "") { ?>
 558<?php echo $IS_Reports->joined_company_date->FldCaption() ?>
 559<?php } else { ?>
 560	<table cellspacing="0" class="ewTableHeaderBtn"><tr>
 561<?php if ($IS_Reports->SortUrl($IS_Reports->joined_company_date) == "") { ?>
 562		<td style="vertical-align: bottom;"><?php echo $IS_Reports->joined_company_date->FldCaption() ?></td>
 563<?php } else { ?>
 564		<td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $IS_Reports->SortUrl($IS_Reports->joined_company_date) ?>',2);"><?php echo $IS_Reports->joined_company_date->FldCaption() ?></td><td style="width: 10px;">
 565		<?php if ($IS_Reports->joined_company_date->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($IS_Reports->joined_company_date->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
 566<?php } ?>
 567	</tr></table>
 568<?php } ?>
 569</td>
 570	</tr>
 571	</thead>
 572	<tbody>
 573<?php
 574		$IS_Reports_summary->ShowFirstHeader = FALSE;
 575	}
 576
 577	// Build detail SQL
 578	$sWhere = ewrpt_DetailFilterSQL($IS_Reports->name, $IS_Reports->SqlFirstGroupField(), $IS_Reports->name->GroupValue());
 579	if ($IS_Reports_summary->Filter != "")
 580		$sWhere = "($IS_Reports_summary->Filter) AND ($sWhere)";
 581	$sSql = ewrpt_BuildReportSql($IS_Reports->SqlSelect(), $IS_Reports->SqlWhere(), $IS_Reports->SqlGroupBy(), $IS_Reports->SqlHaving(), $IS_Reports->SqlOrderBy(), $sWhere, $IS_Reports_summary->Sort);
 582	$rs = $conn->Execute($sSql);
 583	$rsdtlcnt = ($rs) ? $rs->RecordCount() : 0;
 584	if ($rsdtlcnt > 0)
 585		$IS_Reports_summary->GetRow(1);
 586	while ($rs && !$rs->EOF) { // Loop detail records
 587		$IS_Reports_summary->RecCount++;
 588
 589		// Render detail row
 590		$IS_Reports->ResetCSS();
 591		$IS_Reports->RowType = EWRPT_ROWTYPE_DETAIL;
 592		$IS_Reports_summary->RenderRow();
 593?>
 594	<tr<?php echo $IS_Reports->RowAttributes(); ?>>
 595		<td<?php echo $IS_Reports->name->CellAttributes(); ?>>
 596<span<?php echo $IS_Reports->name->ViewAttributes(); ?>><?php echo $IS_Reports->name->GroupViewValue; ?></span></td>
 597		<td<?php echo $IS_Reports->full_name->CellAttributes() ?>>
 598<span<?php echo $IS_Reports->full_name->ViewAttributes(); ?>><?php echo $IS_Reports->full_name->ListViewValue(); ?></span></td>
 599		<td<?php echo $IS_Reports->dob->CellAttributes() ?>>
 600<span<?php echo $IS_Reports->dob->ViewAttributes(); ?>><?php echo $IS_Reports->dob->ListViewValue(); ?></span></td>
 601		<td<?php echo $IS_Reports->joined_company_date->CellAttributes() ?>>
 602<span<?php echo $IS_Reports->joined_company_date->ViewAttributes(); ?>><?php echo $IS_Reports->joined_company_date->ListViewValue(); ?></span></td>
 603	</tr>
 604<?php
 605
 606		// Accumulate page summary
 607		$IS_Reports_summary->AccumulateSummary();
 608
 609		// Get next record
 610		$IS_Reports_summary->GetRow(2);
 611
 612		// Show Footers
 613?>
 614<?php
 615	} // End detail records loop
 616?>
 617<?php
 618?>
 619<?php
 620			$IS_Reports->ResetCSS();
 621			$IS_Reports->RowType = EWRPT_ROWTYPE_TOTAL;
 622			$IS_Reports->RowTotalType = EWRPT_ROWTOTAL_GROUP;
 623			$IS_Reports->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
 624			$IS_Reports->RowGroupLevel = 1;
 625			$IS_Reports_summary->RenderRow();
 626?>
 627	<tr<?php echo $IS_Reports->RowAttributes(); ?>>
 628		<td colspan="4"<?php echo $IS_Reports->name->CellAttributes() ?>><?php echo $ReportLanguage->Phrase("RptSumHead") ?> <?php echo $IS_Reports->name->FldCaption() ?>: <?php echo $IS_Reports->name->GroupViewValue; ?> (<?php echo ewrpt_FormatNumber($IS_Reports_summary->Cnt[1][0],0,-2,-2,-2); ?><?php echo $ReportLanguage->Phrase("RptDtlRec") ?>)</td></tr>
 629<?php
 630
 631			// Reset level 1 summary
 632			$IS_Reports_summary->ResetLevelSummary(1);
 633?>
 634<?php
 635
 636	// Next group
 637	$IS_Reports_summary->GetGrpRow(2);
 638	$IS_Reports_summary->GrpCount++;
 639} // End while
 640?>
 641	</tbody>
 642	<tfoot>
 643<?php
 644if ($IS_Reports_summary->TotalGrps > 0) {
 645	$IS_Reports->ResetCSS();
 646	$IS_Reports->RowType = EWRPT_ROWTYPE_TOTAL;
 647	$IS_Reports->RowTotalType = EWRPT_ROWTOTAL_GRAND;
 648	$IS_Reports->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
 649	$IS_Reports->RowAttrs["class"] = "ewRptGrandSummary";
 650	$IS_Reports_summary->RenderRow();
 651?>
 652	<!-- tr><td colspan="4"><span class="phpreportmaker">&nbsp;<br></span></td></tr -->
 653	<tr<?php echo $IS_Reports->RowAttributes(); ?>><td colspan="4"><?php echo $ReportLanguage->Phrase("RptGrandTotal") ?> (<?php echo ewrpt_FormatNumber($IS_Reports_summary->TotCount,0,-2,-2,-2); ?><?php echo $ReportLanguage->Phrase("RptDtlRec") ?>)</td></tr>
 654<?php } ?>
 655	</tfoot>
 656</table>
 657</div>
 658<?php if ($IS_Reports_summary->TotalGrps > 0) { ?>
 659<?php if ($IS_Reports->Export == "") { ?>
 660<div class="ewGridLowerPanel">
 661<form action="<?php echo ewrpt_CurrentPage() ?>" name="ewpagerform" id="ewpagerform" class="ewForm">
 662<table border="0" cellspacing="0" cellpadding="0">
 663	<tr>
 664		<td style="white-space: nowrap;">
 665<?php if (!isset($Pager)) $Pager = new crPrevNextPager($IS_Reports_summary->StartGrp, $IS_Reports_summary->DisplayGrps, $IS_Reports_summary->TotalGrps) ?>
 666<?php if ($Pager->RecordCount > 0) { ?>
 667	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Page") ?>&nbsp;</span></td>
 668<!--first page button-->
 669	<?php if ($Pager->FirstButton->Enabled) { ?>
 670	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->FirstButton->Start ?>"><img src="phprptimages/first.gif" alt="<?php echo $ReportLanguage->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
 671	<?php } else { ?>
 672	<td><img src="phprptimages/firstdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
 673	<?php } ?>
 674<!--previous page button-->
 675	<?php if ($Pager->PrevButton->Enabled) { ?>
 676	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->PrevButton->Start ?>"><img src="phprptimages/prev.gif" alt="<?php echo $ReportLanguage->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
 677	<?php } else { ?>
 678	<td><img src="phprptimages/prevdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
 679	<?php } ?>
 680<!--current page number-->
 681	<td><input type="text" name="pageno" id="pageno" value="<?php echo $Pager->CurrentPage ?>" size="4"></td>
 682<!--next page button-->
 683	<?php if ($Pager->NextButton->Enabled) { ?>
 684	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->NextButton->Start ?>"><img src="phprptimages/next.gif" alt="<?php echo $ReportLanguage->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
 685	<?php } else { ?>
 686	<td><img src="phprptimages/nextdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
 687	<?php } ?>
 688<!--last page button-->
 689	<?php if ($Pager->LastButton->Enabled) { ?>
 690	<td><a href="<?php echo ewrpt_CurrentPage() ?>?start=<?php echo $Pager->LastButton->Start ?>"><img src="phprptimages/last.gif" alt="<?php echo $ReportLanguage->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
 691	<?php } else { ?>
 692	<td><img src="phprptimages/lastdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
 693	<?php } ?>
 694	<td><span class="phpreportmaker">&nbsp;<?php echo $ReportLanguage->Phrase("of") ?> <?php echo $Pager->PageCount ?></span></td>
 695	</tr></table>
 696	</td>	
 697	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
 698	<td>
 699	<span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Record") ?> <?php echo $Pager->FromIndex ?> <?php echo $ReportLanguage->Phrase("To") ?> <?php echo $Pager->ToIndex ?> <?php echo $ReportLanguage->Phrase("Of") ?> <?php echo $Pager->RecordCount ?></span>
 700<?php } else { ?>
 701	<?php if ($IS_Reports_summary->Filter == "0=101") { ?>
 702	<span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("EnterSearchCriteria") ?></span>
 703	<?php } else { ?>
 704	<span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("NoRecord") ?></span>
 705	<?php } ?>
 706<?php } ?>
 707		</td>
 708<?php if ($IS_Reports_summary->TotalGrps > 0) { ?>
 709		<td style="white-space: nowrap;">&nbsp;&nbsp;&nbsp;&nbsp;</td>
 710		<td align="right" style="vertical-align: top; white-space: nowrap;"><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("GroupsPerPage"); ?>&nbsp;
 711<select name="<?php echo EWRPT_TABLE_GROUP_PER_PAGE; ?>" onchange="this.form.submit();">
 712<option value="1"<?php if ($IS_Reports_summary->DisplayGrps == 1) echo " selected=\"selected\"" ?>>1</option>
 713<option value="2"<?php if ($IS_Reports_summary->DisplayGrps == 2) echo " selected=\"selected\"" ?>>2</option>
 714<option value="3"<?php if ($IS_Reports_summary->DisplayGrps == 3) echo " selected=\"selected\"" ?>>3</option>
 715<option value="4"<?php if ($IS_Reports_summary->DisplayGrps == 4) echo " selected=\"selected\"" ?>>4</option>
 716<option value="5"<?php if ($IS_Reports_summary->DisplayGrps == 5) echo " selected=\"selected\"" ?>>5</option>
 717<option value="10"<?php if ($IS_Reports_summary->DisplayGrps == 10) echo " selected=\"selected\"" ?>>10</option>
 718<option value="20"<?php if ($IS_Reports_summary->DisplayGrps == 20) echo " selected=\"selected\"" ?>>20</option>
 719<option value="50"<?php if ($IS_Reports_summary->DisplayGrps == 50) echo " selected=\"selected\"" ?>>50</option>
 720<option value="ALL"<?php if ($IS_Reports->getGroupPerPage() == -1) echo " selected=\"selected\"" ?>><?php echo $ReportLanguage->Phrase("AllRecords") ?></option>
 721</select>
 722		</span></td>
 723<?php } ?>
 724	</tr>
 725</table>
 726</form>
 727</div>
 728<?php } ?>
 729<?php } ?>
 730</td></tr></table>
 731</div>
 732<!-- Summary Report Ends -->
 733<?php if ($IS_Reports->Export == "" || $IS_Reports->Export == "print" || $IS_Reports->Export == "email") { ?>
 734	</div><br></td>
 735	<!-- Center Container - Report (End) -->
 736	<!-- Right Container (Begin) -->
 737	<td style="vertical-align: top;"><div id="ewRight" class="phpreportmaker">
 738	<!-- Right slot -->
 739	</div></td>
 740	<!-- Right Container (End) -->
 741</tr>
 742<!-- Bottom Container (Begin) -->
 743<tr><td colspan="3"><div id="ewBottom" class="phpreportmaker">
 744	<!-- Bottom slot -->
 745	</div><br></td></tr>
 746<!-- Bottom Container (End) -->
 747</table>
 748<!-- Table Container (End) -->
 749<?php } ?>
 750<?php $IS_Reports_summary->ShowPageFooter(); ?>
 751<?php if (EWRPT_DEBUG_ENABLED) echo ewrpt_DebugMsg(); ?>
 752<?php
 753
 754// Close recordsets
 755if ($rsgrp) $rsgrp->Close();
 756if ($rs) $rs->Close();
 757?>
 758<?php if ($IS_Reports->Export == "") { ?>
 759<script language="JavaScript" type="text/javascript">
 760<!--
 761
 762// Write your table-specific startup script here
 763// document.write("page loaded");
 764//-->
 765
 766</script>
 767<?php } ?>
 768<?php include_once "phprptinc/footer.php"; ?>
 769<?php
 770$IS_Reports_summary->Page_Terminate();
 771?>
 772<?php
 773
 774//
 775// Page class
 776//
 777class crIS_Reports_summary {
 778
 779	// Page ID
 780	var $PageID = 'summary';
 781
 782	// Table name
 783	var $TableName = 'IS Reports';
 784
 785	// Page object name
 786	var $PageObjName = 'IS_Reports_summary';
 787
 788	// Page name
 789	function PageName() {
 790		return ewrpt_CurrentPage();
 791	}
 792
 793	// Page URL
 794	function PageUrl() {
 795		$PageUrl = ewrpt_CurrentPage() . "?";
 796		global $IS_Reports;
 797		if ($IS_Reports->UseTokenInUrl) $PageUrl .= "t=" . $IS_Reports->TableVar . "&"; // Add page token
 798		return $PageUrl;
 799	}
 800
 801	// Export URLs
 802	var $ExportPrintUrl;
 803	var $ExportExcelUrl;
 804	var $ExportWordUrl;
 805	var $ExportPdfUrl;
 806	var $ReportTableClass;
 807
 808	// Message
 809	function getMessage() {
 810		return @$_SESSION[EWRPT_SESSION_MESSAGE];
 811	}
 812
 813	function setMessage($v) {
 814		if (@$_SESSION[EWRPT_SESSION_MESSAGE] <> "") { // Append
 815			$_SESSION[EWRPT_SESSION_MESSAGE] .= "<br>" . $v;
 816		} else {
 817			$_SESSION[EWRPT_SESSION_MESSAGE] = $v;
 818		}
 819	}
 820
 821	// Show message
 822	function ShowMessage() {
 823		$sMessage = $this->getMessage();
 824		$this->Message_Showing($sMessage);
 825		if ($sMessage <> "") { // Message in Session, display
 826			echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
 827			$_SESSION[EWRPT_SESSION_MESSAGE] = ""; // Clear message in Session
 828		}
 829	}
 830	var $PageHeader;
 831	var $PageFooter;
 832
 833	// Show Page Header
 834	function ShowPageHeader() {
 835		$sHeader = $this->PageHeader;
 836		$this->Page_DataRendering($sHeader);
 837		if ($sHeader <> "") { // Header exists, display
 838			echo "<p><span class=\"phpreportmaker\">" . $sHeader . "</span></p>";
 839		}
 840	}
 841
 842	// Show Page Footer
 843	function ShowPageFooter() {
 844		$sFooter = $this->PageFooter;
 845		$this->Page_DataRendered($sFooter);
 846		if ($sFooter <> "") { // Fotoer exists, display
 847			echo "<p><span class=\"phpreportmaker\">" . $sFooter . "</span></p>";
 848		}
 849	}
 850
 851	// Validate page request
 852	function IsPageRequest() {
 853		global $IS_Reports;
 854		if ($IS_Reports->UseTokenInUrl) {
 855			if (ewrpt_IsHttpPost())
 856				return ($IS_Reports->TableVar == @$_POST("t"));
 857			if (@$_GET["t"] <> "")
 858				return ($IS_Reports->TableVar == @$_GET["t"]);
 859		} else {
 860			return TRUE;
 861		}
 862	}
 863
 864	//
 865	// Page class constructor
 866	//
 867	function crIS_Reports_summary() {
 868		global $conn, $ReportLanguage;
 869
 870		// Language object
 871		$ReportLanguage = new crLanguage();
 872
 873		// Table object (IS_Reports)
 874		$GLOBALS["IS_Reports"] = new crIS_Reports();
 875		$GLOBALS["Table"] =& $GLOBALS["IS_Reports"];
 876
 877		// Initialize URLs
 878		$this->ExportPrintUrl = $this->PageUrl() . "export=print";
 879		$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
 880		$this->ExportWordUrl = $this->PageUrl() . "export=word";
 881		$this->ExportPdfUrl = $this->PageUrl() . "export=pdf";
 882
 883		// Page ID
 884		if (!defined("EWRPT_PAGE_ID"))
 885			define("EWRPT_PAGE_ID", 'summary', TRUE);
 886
 887		// Table name (for backward compatibility)
 888		if (!defined("EWRPT_TABLE_NAME"))
 889			define("EWRPT_TABLE_NAME", 'IS Reports', TRUE);
 890
 891		// Start timer
 892		$GLOBALS["gsTimer"] = new crTimer();
 893
 894		// Open connection
 895		$conn = ewrpt_Connect();
 896
 897		// Export options
 898		$this->ExportOptions = new crListOptions();
 899		$this->ExportOptions->Tag = "span";
 900		$this->ExportOptions->Separator = "&nbsp;&nbsp;";
 901	}
 902
 903	// 
 904	//  Page_Init
 905	//
 906	function Page_Init() {
 907		global $gsExport, $gsExportFile, $ReportLanguage, $Security;
 908		global $IS_Reports;
 909
 910		// Get export parameters
 911		if (@$_GET["export"] <> "") {
 912			$IS_Reports->Export = $_GET["export"];
 913		}
 914		$gsExport = $IS_Reports->Export; // Get export parameter, used in header
 915		$gsExportFile = $IS_Reports->TableVar; // Get export file, used in header
 916		if ($IS_Reports->Export == "excel") {
 917			header('Content-Type: application/vnd.ms-excel;charset=utf-8');
 918			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
 919		}
 920		if ($IS_Reports->Export == "word") {
 921			header('Content-Type: application/vnd.ms-word;charset=utf-8');
 922			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
 923		}
 924
 925		// Setup export options
 926		$this->SetupExportOptions();
 927
 928		// Global Page Loading event (in userfn*.php)
 929		Page_Loading();
 930
 931		// Page Load event
 932		$this->Page_Load();
 933	}
 934
 935	// Set up export options
 936	function SetupExportOptions() {
 937		global $ReportLanguage, $IS_Reports;
 938
 939		// Printer friendly
 940		$item =& $this->ExportOptions->Add("print");
 941		$item->Body = "<a href=\"" . $this->ExportPrintUrl . "\">" . $ReportLanguage->Phrase("PrinterFriendly") . "</a>";
 942		$item->Visible = TRUE;
 943
 944		// Export to Excel
 945		$item =& $this->ExportOptions->Add("excel");
 946		$item->Body = "<a href=\"" . $this->ExportExcelUrl . "\">" . $ReportLanguage->Phrase("ExportToExcel") . "</a>";
 947		$item->Visible = TRUE;
 948
 949		// Export to Word
 950		$item =& $this->ExportOptions->Add("word");
 951		$item->Body = "<a href=\"" . $this->ExportWordUrl . "\">" . $ReportLanguage->Phrase("ExportToWord") . "</a>";
 952		$item->Visible = TRUE;
 953
 954		// Export to Pdf
 955		$item =& $this->ExportOptions->Add("pdf");
 956		$item->Body = "<a href=\"" . $this->ExportPdfUrl . "\">" . $ReportLanguage->Phrase("ExportToPDF") . "</a>";
 957		$item->Visible = FALSE;
 958
 959		// Uncomment codes below to show export to Pdf link
 960//		$item->Visible = FALSE;
 961		// Export to Email
 962
 963		$item =& $this->ExportOptions->Add("email");
 964		$item->Body = "<a name=\"emf_IS_Reports\" id=\"emf_IS_Reports\" href=\"javascript:void(0);\" onclick=\"ewrpt_EmailDialogShow({lnk:'emf_IS_Reports',hdr:ewLanguage.Phrase('ExportToEmail')});\">" . $ReportLanguage->Phrase("ExportToEmail") . "</a>";
 965		$item->Visible = FALSE;
 966
 967		// Reset filter
 968		$item =& $this->ExportOptions->Add("resetfilter");
 969		$item->Body = "<a href=\"" . ewrpt_CurrentPage() . "?cmd=reset\">" . $ReportLanguage->Phrase("ResetAllFilter") . "</a>";
 970		$item->Visible = TRUE;
 971		$this->SetupExportOptionsExt();
 972
 973		// Hide options for export
 974		if ($IS_Reports->Export <> "")
 975			$this->ExportOptions->HideAllOptions();
 976
 977		// Set up table class
 978		if ($IS_Reports->Export == "word" || $IS_Reports->Export == "excel" || $IS_Reports->Export == "pdf")
 979			$this->ReportTableClass = "ewTable";
 980		else
 981			$this->ReportTableClass = "ewTable ewTableSeparate";
 982	}
 983
 984	//
 985	// Page_Terminate
 986	//
 987	function Page_Terminate($url = "") {
 988		global $conn;
 989		global $ReportLanguage;
 990		global $IS_Reports;
 991
 992		// Page Unload event
 993		$this->Page_Unload();
 994
 995		// Global Page Unloaded event (in userfn*.php)
 996		Page_Unloaded();
 997
 998		// Export to Email (use ob_file_contents for PHP)
 999		if ($IS_Reports->Export == "email") {
1000			$sContent = ob_get_contents();
1001			$this->ExportEmail($sContent);
1002			ob_end_clean();
1003
1004			 // Close connection
1005			$conn->Close();
1006			header("Location: " . ewrpt_CurrentPage());
1007			exit();
1008		}
1009
1010		// Export to PDF (use ob_file_contents for PHP)
1011		if ($IS_Reports->Export == "pdf") {
1012			$sContent = ob_get_contents();
1013			$this->ExportPDF($sContent);
1014			ob_end_clean();
1015
1016			 // Close connection
1017			$conn->Close();
1018		}
1019
1020		 // Close connection
1021		$conn->Close();
1022
1023		// Go to URL if specified
1024		if ($url <> "") {
1025			if (!EWRPT_DEBUG_ENABLED && ob_get_length())
1026				ob_end_clean();
1027			header("Location: " . $url);
1028		}
1029		exit();
1030	}
1031
1032	// Initialize common variables
1033	var $ExportOptions; // Export options
1034
1035	// Paging variables
1036	var $RecCount = 0; // Record count
1037	var $StartGrp = 0; // Start group
1038	var $StopGrp = 0; // Stop group
1039	var $TotalGrps = 0; // Total groups
1040	var $GrpCount = 0; // Group count
1041	var $DisplayGrps = 10; // Groups per page
1042	var $GrpRange = 10;
1043	var $Sort = "";
1044	var $Filter = "";
1045	var $UserIDFilter = "";
1046
1047	// Clear field for ext filter
1048	var $ClearExtFilter = "";
1049	var $FilterApplied;
1050	var $ShowFirstHeader;
1051	var $Cnt, $Col, $Val, $Smry, $Mn, $Mx, $GrandSmry, $GrandMn, $GrandMx;
1052	var $TotCount;
1053
1054	//
1055	// Page main
1056	//
1057	function Page_Main() {
1058		global $IS_Reports;
1059		global $rs;
1060		global $rsgrp;
1061		global $gsFormError;
1062
1063		// Aggregate variables
1064		// 1st dimension = no of groups (level 0 used for grand total)
1065		// 2nd dimension = no of fields
1066
1067		$nDtls = 4;
1068		$nGrps = 2;
1069		$this->Val =& ewrpt_InitArray($nDtls, 0);
1070		$this->Cnt =& ewrpt_Init2DArray($nGrps, $nDtls, 0);
1071		$this->Smry =& ewrpt_Init2DArray($nGrps, $nDtls, 0);
1072		$this->Mn =& ewrpt_Init2DArray($nGrps, $nDtls, NULL);
1073		$this->Mx =& ewrpt_Init2DArray($nGrps, $nDtls, NULL);
1074		$this->GrandSmry =& ewrpt_InitArray($nDtls, 0);
1075		$this->GrandMn =& ewrpt_InitArray($nDtls, NULL);
1076		$this->GrandMx =& ewrpt_InitArray($nDtls, NULL);
1077
1078		// Set up if accumulation required
1079		$this->Col = array(FALSE, FALSE, FALSE, FALSE);
1080
1081		// Set up groups per page dynamically
1082		$this->SetUpDisplayGrps();
1083		$IS_Reports->name->SelectionList = "";
1084		$IS_Reports->name->DefaultSelectionList = "";
1085		$IS_Reports->name->ValueList = "";
1086
1087		// Load default filter values
1088		$this->LoadDefaultFilters();
1089
1090		// Load custom filters
1091		$IS_Reports->Filters_Load();
1092
1093		// Set up popup filter
1094		$this->SetupPopup();
1095
1096		// Extended filter
1097		$sExtendedFilter = "";
1098
1099		// Build popup filter
1100		$sPopupFilter = $this->GetPopupFilter();
1101
1102		//ewrpt_SetDebugMsg("popup filter: " . $sPopupFilter);
1103		if ($sPopupFilter <> "") {
1104			if ($this->Filter <> "")
1105				$this->Filter = "($this->Filter) AND ($sPopupFilter)";
1106			else
1107				$this->Filter = $sPopupFilter;
1108		}
1109
1110		// Check if filter applied
1111		$this->FilterApplied = $this->CheckFilter();
1112		$this->ExportOptions->GetItem("resetfilter")->Visible = $this->FilterApplied;
1113
1114		// Get sort
1115		$this->Sort = $this->GetSort();
1116
1117		// Get total group count
1118		$sGrpSort = ewrpt_UpdateSortFields($IS_Reports->SqlOrderByGroup(), $this->Sort, 2); // Get grouping field only
1119		$sSql = ewrpt_BuildReportSql($IS_Reports->SqlSelectGroup(), $IS_Reports->SqlWhere(), $IS_Reports->SqlGroupBy(), $IS_Reports->SqlHaving(), $IS_Reports->SqlOrderByGroup(), $this->Filter, $sGrpSort);
1120		$this->TotalGrps = $this->GetGrpCnt($sSql);
1121		if ($this->DisplayGrps <= 0) // Display all groups
1122			$this->DisplayGrps = $this->TotalGrps;
1123		$this->StartGrp = 1;
1124
1125		// Show header
1126		$this->ShowFirstHeader = ($this->TotalGrps > 0);
1127
1128		//$this->ShowFirstHeader = TRUE; // Uncomment to always show header
1129		// Set up start position if not export all
1130
1131		if ($IS_Reports->ExportAll && $IS_Reports->Export <> "")
1132		    $this->DisplayGrps = $this->TotalGrps;
1133		else
1134			$this->SetUpStartGroup(); 
1135
1136		// Hide all options if export
1137		if ($IS_Reports->Export <> "") {
1138			$this->ExportOptions->HideAllOptions();
1139		}
1140
1141		// Get current page groups
1142		$rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
1143
1144		// Init detail recordset
1145		$rs = NULL;
1146	}
1147
1148	// Check level break
1149	function ChkLvlBreak($lvl) {
1150		global $IS_Reports;
1151		switch ($lvl) {
1152			case 1:
1153				return (is_null($IS_Reports->name->CurrentValue) && !is_null($IS_Reports->name->OldValue)) ||
1154					(!is_null($IS_Reports->name->CurrentValue) && is_null($IS_Reports->name->OldValue)) ||
1155					($IS_Reports->name->GroupValue() <> $IS_Reports->name->GroupOldValue());
1156		}
1157	}
1158
1159	// Accummulate summary
1160	function AccumulateSummary() {
1161		$cntx = count($this->Smry);
1162		for ($ix = 0; $ix < $cntx; $ix++) {
1163			$cnty = count($this->Smry[$ix]);
1164			for ($iy = 1; $iy < $cnty; $iy++) {
1165				$this->Cnt[$ix][$iy]++;
1166				if ($this->Col[$iy]) {
1167					$valwrk = $this->Val[$iy];
1168					if (is_null($valwrk) || !is_numeric($valwrk)) {
1169
1170						// skip
1171					} else {
1172						$this->Smry[$ix][$iy] += $valwrk;
1173						if (is_null($this->Mn[$ix][$iy])) {
1174							$this->Mn[$ix][$iy] = $valwrk;
1175							$this->Mx[$ix][$iy] = $valwrk;
1176						} else {
1177							if ($this->Mn[$ix][$iy] > $valwrk) $this->Mn[$ix][$iy] = $valwrk;
1178							if ($this->Mx[$ix][$iy] < $valwrk) $this->Mx[$ix][$iy] = $valwrk;
1179						}
1180					}
1181				}
1182			}
1183		}
1184		$cntx = count($this->Smry);
1185		for ($ix = 1; $ix < $cntx; $ix++) {
1186			$this->Cnt[$ix][0]++;
1187		}
1188	}
1189
1190	// Reset level summary
1191	function ResetLevelSummary($lvl) {
1192
1193		// Clear summary values
1194		$cntx = count($this->Smry);
1195		for ($ix = $lvl; $ix < $cntx; $ix++) {
1196			$cnty = count($this->Smry[$ix]);
1197			for ($iy = 1; $iy < $cnty; $iy++) {
1198				$this->Cnt[$ix][$iy] = 0;
1199				if ($this->Col[$iy]) {
1200					$this->Smry[$ix][$iy] = 0;
1201					$this->Mn[$ix][$iy] = NULL;
1202					$this->Mx[$ix][$iy] = NULL;
1203				}
1204			}
1205		}
1206		$cntx = count($this->Smry);
1207		for ($ix = $lvl; $ix < $cntx; $ix++) {
1208			$this->Cnt[$ix][0] = 0;
1209		}
1210
1211		// Reset record count
1212		$this->RecCount = 0;
1213	}
1214
1215	// Accummulate grand summary
1216	function AccumulateGrandSummary() {
1217		$this->Cnt[0][0]++;
1218		$cntgs = count($this->GrandSmry);
1219		for ($iy = 1; $iy < $cntgs; $iy++) {
1220			if ($this->Col[$iy]) {
1221				$valwrk = $this->Val[$iy];
1222				if (is_null($valwrk) || !is_numeric($valwrk)) {
1223
1224					// skip
1225				} else {
1226					$this->GrandSmry[$iy] += $valwrk;
1227					if (is_null($this->GrandMn[$iy])) {
1228						$this->GrandMn[$iy] = $valwrk;
1229						$this->GrandMx[$iy] = $valwrk;
1230					} else {
1231						if ($this->GrandMn[$iy] > $valwrk) $this->GrandMn[$iy] = $valwrk;
1232						if ($this->GrandMx[$iy] < $valwrk) $this->GrandMx[$iy] = $valwrk;
1233					}
1234				}
1235			}
1236		}
1237	}
1238
1239	// Get group count
1240	function GetGrpCnt($sql) {
1241		global $conn;
1242		global $IS_Reports;
1243		$rsgrpcnt = $conn->Execute($sql);
1244		$grpcnt = ($rsgrpcnt) ? $rsgrpcnt->RecordCount() : 0;
1245		if ($rsgrpcnt) $rsgrpcnt->Close();
1246		return $grpcnt;
1247	}
1248
1249	// Get group rs
1250	function GetGrpRs($sql, $start, $grps) {
1251		global $conn;
1252		global $IS_Reports;
1253		$wrksql = $sql;
1254		if ($start > 0 && $grps > -1)
1255			$wrksql .= " LIMIT " . ($start-1) . ", " . ($grps);
1256		$rswrk = $conn->Execute($wrksql);
1257		return $rswrk;
1258	}
1259
1260	// Get group row values
1261	function GetGrpRow($opt) {
1262		global $rsgrp;
1263		global $IS_Reports;
1264		if (!$rsgrp)
1265			return;
1266		if ($opt == 1) { // Get first group
1267
1268			//$rsgrp->MoveFirst(); // NOTE: no need to move position
1269			$IS_Reports->name->setDbValue(""); // Init first value
1270		} else { // Get next group
1271			$rsgrp->MoveNext();
1272		}
1273		if (!$rsgrp->EOF)
1274			$IS_Reports->name->setDbValue($rsgrp->fields[0]);
1275		if ($rsgrp->EOF) {
1276			$IS_Reports->name->setDbValue("");
1277		}
1278	}
1279
1280	// Get row values
1281	function GetRow($opt) {
1282		global $rs;
1283		global $IS_Reports;
1284		if (!$rs)
1285			return;
1286		if ($opt == 1) { // Get first row
1287
1288	//		$rs->MoveFirst(); // NOTE: no need to move position
1289		} else { // Get next row
1290			$rs->MoveNext();
1291		}
1292		if (!$rs->EOF) {
1293			$IS_Reports->full_name->setDbValue($rs->fields('full_name'));
1294			$IS_Reports->dob->setDbValue($rs->fields('dob'));
1295			$IS_Reports->joined_company_date->setDbValue($rs->fields('joined_company_date'));
1296			if ($opt <> 1) {
1297				if (is_array($IS_Reports->name->GroupDbValues))
1298					$IS_Reports->name->setDbValue(@$IS_Reports->name->GroupDbValues[$rs->fields('name')]);
1299				else
1300					$IS_Reports->name->setDbValue(ewrpt_GroupValue($IS_Reports->name, $rs->fields('name')));
1301			}
1302			$this->Val[1] = $IS_Reports->full_name->CurrentValue;
1303			$this->Val[2] = $IS_Reports->dob->CurrentValue;
1304			$this->Val[3] = $IS_Reports->joined_company_date->CurrentValue;
1305		} else {
1306			$IS_Reports->full_name->setDbValue("");
1307			$IS_Reports->dob->setDbValue("");
1308			$IS_Reports->joined_company_date->setDbValue("");
1309			$IS_Reports->name->setDbValue("");
1310		}
1311	}
1312
1313	//  Set up starting group
1314	function SetUpStartGroup() {
1315		global $IS_Reports;
1316
1317		// Exit if no groups
1318		if ($this->DisplayGrps == 0)
1319			return;
1320
1321		// Check for a 'start' parameter
1322		if (@$_GET[EWRPT_TABLE_START_GROUP] != "") {
1323			$this->StartGrp = $_GET[EWRPT_TABLE_START_GROUP];
1324			$IS_Reports->setStartGroup($this->StartGrp);
1325		} elseif (@$_GET["pageno"] != "") {
1326			$nPageNo = $_GET["pageno"];
1327			if (is_numeric($nPageNo)) {
1328				$this->StartGrp = ($nPageNo-1)*$this->DisplayGrps+1;
1329				if ($this->StartGrp <= 0) {
1330					$this->StartGrp = 1;
1331				} elseif ($this->StartGrp >= intval(($this->TotalGrps-1)/$this->DisplayGrps)*$this->DisplayGrps+1) {
1332					$this->StartGrp = intval(($this->TotalGrps-1)/$this->DisplayGrps)*$this->DisplayGrps+1;
1333				}
1334				$IS_Reports->setStartGroup($this->StartGrp);
1335			} else {
1336				$this->StartGrp = $IS_Reports->getStartGroup();
1337			}
1338		} else {
1339			$this->StartGrp = $IS_Reports->getStartGroup();
1340		}
1341
1342		// Check if correct start group counter
1343		if (!is_numeric($this->StartGrp) || $this->StartGrp == "") { // Avoid invalid start group counter
1344			$this->StartGrp = 1; // Reset start group counter
1345			$IS_Reports->setStartGroup($this->StartGrp);
1346		} elseif (intval($this->StartGrp) > intval($this->TotalGrps)) { // Avoid starting group > total groups
1347			$this->StartGrp = intval(($this->TotalGrps-1)/$this->DisplayGrps) * $this->DisplayGrps + 1; // Point to last page first group
1348			$IS_Reports->setStartGroup($this->StartGrp);
1349		} elseif (($this->StartGrp-1) % $this->DisplayGrps <> 0) {
1350			$this->StartGrp = intval(($this->StartGrp-1)/$this->DisplayGrps) * $this->DisplayGrps + 1; // Point to page boundary
1351			$IS_Reports->setStartGroup($this->StartGrp);
1352		}
1353	}
1354
1355	// Set up popup
1356	function SetupPopup() {
1357		global $conn, $ReportLanguage;
1358		global $IS_Reports;
1359
1360		// Initialize popup
1361		// Build distinct values for name
1362
1363		$bNullValue = FALSE;
1364		$bEmptyValue = FALSE;
1365		$sSql = ewrpt_BuildReportSql($IS_Reports->name->SqlSelect, $IS_Reports->SqlWhere(), $IS_Reports->SqlGroupBy(), $IS_Reports->SqlHaving(), $IS_Reports->name->SqlOrderBy, $this->Filter, "");
1366		$rswrk = $conn->Execute($sSql);
1367		while ($rswrk && !$rswrk->EOF) {
1368			$IS_Reports->name->setDbValue($rswrk->fields[0]);
1369			if (is_null($IS_Reports->name->CurrentValue)) {
1370				$bNullValue = TRUE;
1371			} elseif ($IS_Reports->name->CurrentValue == "") {
1372				$bEmptyValue = TRUE;
1373			} else {
1374				$IS_Reports->name->GroupViewValue = ewrpt_DisplayGroupValue($IS_Reports->name,$IS_Reports->name->GroupValue());
1375				ewrpt_SetupDistinctValues($IS_Reports->name->ValueList, $IS_Reports->name->GroupValue(), $IS_Reports->name->GroupViewValue, FALSE);
1376			}
1377			$rswrk->MoveNext();
1378		}
1379		if ($rswrk)
1380			$rswrk->Close();
1381		if ($bEmptyValue)
1382			ewrpt_SetupDistinctValues($IS_Reports->name->ValueList, EWRPT_EMPTY_VALUE, $ReportLanguage->Phrase("EmptyLabel"), FALSE);
1383		if ($bNullValue)
1384			ewrpt_SetupDistinctValues($IS_Reports->name->Valu…

Large files files are truncated, but you can click here to view the full file