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