PageRenderTime 54ms CodeModel.GetById 38ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/jf/web/reports/Emp_Reports_by_Yearsmry.php

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

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