/jf/web/reports/TKChucdanhsmry.php
PHP | 1698 lines | 1229 code | 224 blank | 245 comment | 339 complexity | 4ab4def7e6154057b5b29f7abf2315af MD5 | raw file
Possible License(s): LGPL-2.1
- <?php
- if (session_id() == "") session_start(); // Initialize Session data
- ob_start();
- ?>
- <?php include_once "phprptinc/ewrcfg5.php"; ?>
- <?php include_once "phprptinc/ewmysql.php"; ?>
- <?php include_once "phprptinc/ewrfn5.php"; ?>
- <?php include_once "phprptinc/ewrusrfn.php"; ?>
- <?php
-
- // Global variable for table object
- $TKChucdanh = NULL;
-
- //
- // Table class for TKChucdanh
- //
- class crTKChucdanh {
- var $TableVar = 'TKChucdanh';
- var $TableName = 'TKChucdanh';
- var $TableType = 'REPORT';
- var $ShowCurrentFilter = EWRPT_SHOW_CURRENT_FILTER;
- var $FilterPanelOption = EWRPT_FILTER_PANEL_OPTION;
- var $CurrentOrder; // Current order
- var $CurrentOrderType; // Current order type
-
- // Table caption
- function TableCaption() {
- global $ReportLanguage;
- return $ReportLanguage->TablePhrase($this->TableVar, "TblCaption");
- }
-
- // Session Group Per Page
- function getGroupPerPage() {
- return @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_grpperpage"];
- }
-
- function setGroupPerPage($v) {
- @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_grpperpage"] = $v;
- }
-
- // Session Start Group
- function getStartGroup() {
- return @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_start"];
- }
-
- function setStartGroup($v) {
- @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_start"] = $v;
- }
-
- // Session Order By
- function getOrderBy() {
- return @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_orderby"];
- }
-
- function setOrderBy($v) {
- @$_SESSION[EWRPT_PROJECT_VAR . "_" . $this->TableVar . "_orderby"] = $v;
- }
-
- // var $SelectLimit = TRUE;
- var $name;
- var $Count28DISTINCT_tbl__employee2Eid29;
- var $Count28tbl__employee2Egender29;
- var $Count28tbl__profile2Ejoined_party_date29;
- var $fields = array();
- var $Export; // Export
- var $ExportAll = TRUE;
- var $UseTokenInUrl = EWRPT_USE_TOKEN_IN_URL;
- var $RowType; // Row type
- var $RowTotalType; // Row total type
- var $RowTotalSubType; // Row total subtype
- var $RowGroupLevel; // Row group level
- var $RowAttrs = array(); // Row attributes
-
- // Reset CSS styles for table object
- function ResetCSS() {
- $this->RowAttrs["style"] = "";
- $this->RowAttrs["class"] = "";
- foreach ($this->fields as $fld) {
- $fld->ResetCSS();
- }
- }
-
- //
- // Table class constructor
- //
- function crTKChucdanh() {
- global $ReportLanguage;
-
- // name
- $this->name = new crField('TKChucdanh', 'TKChucdanh', 'x_name', 'name', '`name`', 200, EWRPT_DATATYPE_STRING, -1);
- $this->name->GroupingFieldId = 1;
- $this->fields['name'] =& $this->name;
- $this->name->DateFilter = "";
- $this->name->SqlSelect = "SELECT DISTINCT `name` FROM " . $this->SqlFrom();
- $this->name->SqlOrderBy = "`name`";
- $this->name->FldGroupByType = "";
- $this->name->FldGroupInt = "0";
- $this->name->FldGroupSql = "";
-
- // Count(DISTINCT tbl__employee.id)
- $this->Count28DISTINCT_tbl__employee2Eid29 = new crField('TKChucdanh', 'TKChucdanh', 'x_Count28DISTINCT_tbl__employee2Eid29', 'Count(DISTINCT tbl__employee.id)', '`Count(DISTINCT tbl__employee.id)`', 20, EWRPT_DATATYPE_NUMBER, -1);
- $this->Count28DISTINCT_tbl__employee2Eid29->FldDefaultErrMsg = $ReportLanguage->Phrase("IncorrectInteger");
- $this->fields['Count28DISTINCT_tbl__employee2Eid29'] =& $this->Count28DISTINCT_tbl__employee2Eid29;
- $this->Count28DISTINCT_tbl__employee2Eid29->DateFilter = "";
- $this->Count28DISTINCT_tbl__employee2Eid29->SqlSelect = "";
- $this->Count28DISTINCT_tbl__employee2Eid29->SqlOrderBy = "";
-
- // Count(tbl__employee.gender)
- $this->Count28tbl__employee2Egender29 = new crField('TKChucdanh', 'TKChucdanh', 'x_Count28tbl__employee2Egender29', 'Count(tbl__employee.gender)', '`Count(tbl__employee.gender)`', 20, EWRPT_DATATYPE_NUMBER, -1);
- $this->Count28tbl__employee2Egender29->FldDefaultErrMsg = $ReportLanguage->Phrase("IncorrectInteger");
- $this->fields['Count28tbl__employee2Egender29'] =& $this->Count28tbl__employee2Egender29;
- $this->Count28tbl__employee2Egender29->DateFilter = "";
- $this->Count28tbl__employee2Egender29->SqlSelect = "";
- $this->Count28tbl__employee2Egender29->SqlOrderBy = "";
-
- // Count(tbl__profile.joined_party_date)
- $this->Count28tbl__profile2Ejoined_party_date29 = new crField('TKChucdanh', 'TKChucdanh', 'x_Count28tbl__profile2Ejoined_party_date29', 'Count(tbl__profile.joined_party_date)', '`Count(tbl__profile.joined_party_date)`', 20, EWRPT_DATATYPE_NUMBER, -1);
- $this->Count28tbl__profile2Ejoined_party_date29->FldDefaultErrMsg = $ReportLanguage->Phrase("IncorrectInteger");
- $this->fields['Count28tbl__profile2Ejoined_party_date29'] =& $this->Count28tbl__profile2Ejoined_party_date29;
- $this->Count28tbl__profile2Ejoined_party_date29->DateFilter = "";
- $this->Count28tbl__profile2Ejoined_party_date29->SqlSelect = "";
- $this->Count28tbl__profile2Ejoined_party_date29->SqlOrderBy = "";
- }
-
- // Multiple column sort
- function UpdateSort(&$ofld, $ctrl) {
- if ($this->CurrentOrder == $ofld->FldName) {
- $sLastSort = $ofld->getSort();
- if ($this->CurrentOrderType == "ASC" || $this->CurrentOrderType == "DESC") {
- $sThisSort = $this->CurrentOrderType;
- } else {
- $sThisSort = ($sLastSort == "ASC") ? "DESC" : "ASC";
- }
- $ofld->setSort($sThisSort);
- } else {
- if ($ofld->GroupingFieldId == 0 && !$ctrl) $ofld->setSort("");
- }
- }
-
- // Get Sort SQL
- function SortSql() {
- $sDtlSortSql = "";
- $argrps = array();
- foreach ($this->fields as $fld) {
- if ($fld->getSort() <> "") {
- if ($fld->GroupingFieldId > 0) {
- if ($fld->FldGroupSql <> "")
- $argrps[$fld->GroupingFieldId] = str_replace("%s", $fld->FldExpression, $fld->FldGroupSql) . " " . $fld->getSort();
- else
- $argrps[$fld->GroupingFieldId] = $fld->FldExpression . " " . $fld->getSort();
- } else {
- if ($sDtlSortSql <> "") $sDtlSortSql .= ", ";
- $sDtlSortSql .= $fld->FldExpression . " " . $fld->getSort();
- }
- }
- }
- $sSortSql = "";
- foreach ($argrps as $grp) {
- if ($sSortSql <> "") $sSortSql .= ", ";
- $sSortSql .= $grp;
- }
- if ($sDtlSortSql <> "") {
- if ($sSortSql <> "") $sSortSql .= ",";
- $sSortSql .= $sDtlSortSql;
- }
- return $sSortSql;
- }
-
- // Table level SQL
- function SqlFrom() { // From
- return "`vw__official_reports`";
- }
-
- function SqlSelect() { // Select
- return "SELECT * FROM " . $this->SqlFrom();
- }
-
- function SqlWhere() { // Where
- return "";
- }
-
- function SqlGroupBy() { // Group By
- return "";
- }
-
- function SqlHaving() { // Having
- return "";
- }
-
- function SqlOrderBy() { // Order By
- return "`name` ASC";
- }
-
- // Table Level Group SQL
- function SqlFirstGroupField() {
- return "`name`";
- }
-
- function SqlSelectGroup() {
- return "SELECT DISTINCT " . $this->SqlFirstGroupField() . " FROM " . $this->SqlFrom();
- }
-
- function SqlOrderByGroup() {
- return "`name` ASC";
- }
-
- function SqlSelectAgg() {
- return "SELECT SUM(`Count(DISTINCT tbl__employee.id)`) AS `sum_count28distinct_tbl__employee2eid29`, SUM(`Count(tbl__employee.gender)`) AS `sum_count28tbl__employee2egender29`, SUM(`Count(tbl__profile.joined_party_date)`) AS `sum_count28tbl__profile2ejoined_party_date29` FROM " . $this->SqlFrom();
- }
-
- function SqlAggPfx() {
- return "";
- }
-
- function SqlAggSfx() {
- return "";
- }
-
- function SqlSelectCount() {
- return "SELECT COUNT(*) FROM " . $this->SqlFrom();
- }
-
- // Sort URL
- function SortUrl(&$fld) {
- if ($this->Export <> "" ||
- in_array($fld->FldType, array(128, 204, 205))) { // Unsortable data type
- return "";
- } elseif ($fld->Sortable) {
- $sUrlParm = "order=" . urlencode($fld->FldName) . "&ordertype=" . $fld->ReverseSort();
- return ewrpt_CurrentPage() . "?" . $sUrlParm;
- } else {
- return "";
- }
- }
-
- // Row attributes
- function RowAttributes() {
- $sAtt = "";
- foreach ($this->RowAttrs as $k => $v) {
- if (trim($v) <> "")
- $sAtt .= " " . $k . "=\"" . trim($v) . "\"";
- }
- return $sAtt;
- }
-
- // Field object by fldvar
- function &fields($fldvar) {
- return $this->fields[$fldvar];
- }
-
- // Table level events
- // Row Rendering event
- function Row_Rendering() {
-
- // Enter your code here
- }
-
- // Cell Rendered event
- function Cell_Rendered(&$Field, $CurrentValue, &$ViewValue, &$ViewAttrs, &$CellAttrs, &$HrefValue) {
-
- //$ViewValue = "xxx";
- //$ViewAttrs["style"] = "xxx";
-
- }
-
- // Row Rendered event
- function Row_Rendered() {
-
- // To view properties of field class, use:
- //var_dump($this-><FieldName>);
-
- }
-
- // Load Filters event
- function Filters_Load() {
-
- // Enter your code here
- // Example: Register/Unregister Custom Extended Filter
- //ewrpt_RegisterFilter($this-><Field>, 'StartsWithA', 'Starts With A', 'GetStartsWithAFilter');
- //ewrpt_UnregisterFilter($this-><Field>, 'StartsWithA');
-
- }
-
- // Page Filter Validated event
- function Page_FilterValidated() {
-
- // Example:
- //global $MyTable;
- //$MyTable->MyField1->SearchValue = "your search criteria"; // Search value
-
- }
-
- // Chart Rendering event
- function Chart_Rendering(&$chart) {
-
- // var_dump($chart);
- }
-
- // Chart Rendered event
- function Chart_Rendered($chart, &$chartxml) {
-
- // Example:
- //$doc = $chart->XmlDoc; // Get the DOMDocument object
- // Enter your code to manipulate the DOMDocument object here
- //$chartxml = $doc->saveXML(); // Output the XML
-
- }
-
- // Email Sending event
- function Email_Sending(&$Email, &$Args) {
-
- //var_dump($Email); var_dump($Args); exit();
- return TRUE;
- }
- }
- ?>
- <?php ewrpt_Header(FALSE) ?>
- <?php
-
- // Create page object
- $TKChucdanh_summary = new crTKChucdanh_summary();
- $Page =& $TKChucdanh_summary;
-
- // Page init
- $TKChucdanh_summary->Page_Init();
-
- // Page main
- $TKChucdanh_summary->Page_Main();
- ?>
- <?php include_once "phprptinc/header.php"; ?>
- <?php if ($TKChucdanh->Export == "" || $TKChucdanh->Export == "print" || $TKChucdanh->Export == "email") { ?>
- <script type="text/javascript">
-
- // Create page object
- var TKChucdanh_summary = new ewrpt_Page("TKChucdanh_summary");
-
- // page properties
- TKChucdanh_summary.PageID = "summary"; // page ID
- TKChucdanh_summary.FormID = "fTKChucdanhsummaryfilter"; // form ID
- var EWRPT_PAGE_ID = TKChucdanh_summary.PageID;
-
- // extend page with Chart_Rendering function
- TKChucdanh_summary.Chart_Rendering =
- function(chart, chartid) { // DO NOT CHANGE THIS LINE!
-
- //alert(chartid);
- }
-
- // extend page with Chart_Rendered function
- TKChucdanh_summary.Chart_Rendered =
- function(chart, chartid) { // DO NOT CHANGE THIS LINE!
-
- //alert(chartid);
- }
- </script>
- <?php } ?>
- <?php if ($TKChucdanh->Export == "") { ?>
- <script language="JavaScript" type="text/javascript">
- <!--
-
- // Write your client script here, no need to add script tags.
- //-->
-
- </script>
- <?php } ?>
- <?php if ($TKChucdanh->Export == "" || $TKChucdanh->Export == "print" || $TKChucdanh->Export == "email") { ?>
- <script src="<?php echo EWRPT_FUSIONCHARTS_FREE_JSCLASS_FILE; ?>" type="text/javascript"></script>
- <?php } ?>
- <?php if ($TKChucdanh->Export == "") { ?>
- <div id="ewrpt_PopupFilter"><div class="bd"></div></div>
- <script src="phprptjs/ewrptpop.js" type="text/javascript"></script>
- <script type="text/javascript">
-
- // popup fields
- <?php $jsdata = ewrpt_GetJsData($TKChucdanh->name, $TKChucdanh->name->FldType); ?>
- ewrpt_CreatePopup("TKChucdanh_name", [<?php echo $jsdata ?>]);
- </script>
- <?php } ?>
- <?php if ($TKChucdanh->Export == "" || $TKChucdanh->Export == "print" || $TKChucdanh->Export == "email") { ?>
- <!-- Table Container (Begin) -->
- <table id="ewContainer" cellspacing="0" cellpadding="0" border="0">
- <!-- Top Container (Begin) -->
- <tr><td colspan="3"><div id="ewTop" class="phpreportmaker">
- <!-- top slot -->
- <a name="top"></a>
- <?php } ?>
- <p class="phpreportmaker ewTitle"><?php echo $TKChucdanh->TableCaption() ?>
- <?php $TKChucdanh_summary->ExportOptions->Render("body"); ?></p>
- <?php $TKChucdanh_summary->ShowPageHeader(); ?>
- <?php $TKChucdanh_summary->ShowMessage(); ?>
- <br><br>
- <?php if ($TKChucdanh->Export == "" || $TKChucdanh->Export == "print" || $TKChucdanh->Export == "email") { ?>
- </div></td></tr>
- <!-- Top Container (End) -->
- <tr>
- <!-- Left Container (Begin) -->
- <td style="vertical-align: top;"><div id="ewLeft" class="phpreportmaker">
- <!-- Left slot -->
- </div></td>
- <!-- Left Container (End) -->
- <!-- Center Container - Report (Begin) -->
- <td style="vertical-align: top;" class="ewPadding"><div id="ewCenter" class="phpreportmaker">
- <!-- center slot -->
- <?php } ?>
- <!-- summary report starts -->
- <div id="report_summary">
- <?php if ($TKChucdanh->ShowCurrentFilter) { ?>
- <div id="ewrptFilterList">
- <?php $TKChucdanh_summary->ShowFilterList() ?>
- </div>
- <br>
- <?php } ?>
- <table class="ewGrid" cellspacing="0"><tr>
- <td class="ewGridContent">
- <?php if ($TKChucdanh->Export == "") { ?>
- <div class="ewGridUpperPanel">
- <form action="<?php echo ewrpt_CurrentPage() ?>" name="ewpagerform" id="ewpagerform" class="ewForm">
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td style="white-space: nowrap;">
- <?php if (!isset($Pager)) $Pager = new crPrevNextPager($TKChucdanh_summary->StartGrp, $TKChucdanh_summary->DisplayGrps, $TKChucdanh_summary->TotalGrps) ?>
- <?php if ($Pager->RecordCount > 0) { ?>
- <table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Page") ?> </span></td>
- <!--first page button-->
- <?php if ($Pager->FirstButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/firstdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <!--previous page button-->
- <?php if ($Pager->PrevButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/prevdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <!--current page number-->
- <td><input type="text" name="pageno" id="pageno" value="<?php echo $Pager->CurrentPage ?>" size="4"></td>
- <!--next page button-->
- <?php if ($Pager->NextButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/nextdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <!--last page button-->
- <?php if ($Pager->LastButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/lastdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <td><span class="phpreportmaker"> <?php echo $ReportLanguage->Phrase("of") ?> <?php echo $Pager->PageCount ?></span></td>
- </tr></table>
- </td>
- <td> </td>
- <td>
- <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>
- <?php } else { ?>
- <?php if ($TKChucdanh_summary->Filter == "0=101") { ?>
- <span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("EnterSearchCriteria") ?></span>
- <?php } else { ?>
- <span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("NoRecord") ?></span>
- <?php } ?>
- <?php } ?>
- </td>
- <?php if ($TKChucdanh_summary->TotalGrps > 0) { ?>
- <td style="white-space: nowrap;"> </td>
- <td align="right" style="vertical-align: top; white-space: nowrap;"><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("GroupsPerPage"); ?>
- <select name="<?php echo EWRPT_TABLE_GROUP_PER_PAGE; ?>" onchange="this.form.submit();">
- <option value="1"<?php if ($TKChucdanh_summary->DisplayGrps == 1) echo " selected=\"selected\"" ?>>1</option>
- <option value="2"<?php if ($TKChucdanh_summary->DisplayGrps == 2) echo " selected=\"selected\"" ?>>2</option>
- <option value="3"<?php if ($TKChucdanh_summary->DisplayGrps == 3) echo " selected=\"selected\"" ?>>3</option>
- <option value="4"<?php if ($TKChucdanh_summary->DisplayGrps == 4) echo " selected=\"selected\"" ?>>4</option>
- <option value="5"<?php if ($TKChucdanh_summary->DisplayGrps == 5) echo " selected=\"selected\"" ?>>5</option>
- <option value="10"<?php if ($TKChucdanh_summary->DisplayGrps == 10) echo " selected=\"selected\"" ?>>10</option>
- <option value="20"<?php if ($TKChucdanh_summary->DisplayGrps == 20) echo " selected=\"selected\"" ?>>20</option>
- <option value="50"<?php if ($TKChucdanh_summary->DisplayGrps == 50) echo " selected=\"selected\"" ?>>50</option>
- <option value="ALL"<?php if ($TKChucdanh->getGroupPerPage() == -1) echo " selected=\"selected\"" ?>><?php echo $ReportLanguage->Phrase("AllRecords") ?></option>
- </select>
- </span></td>
- <?php } ?>
- </tr>
- </table>
- </form>
- </div>
- <?php } ?>
- <!-- Report Grid (Begin) -->
- <div class="ewGridMiddlePanel">
- <table class="<?php echo $TKChucdanh_summary->ReportTableClass ?>" cellspacing="0">
- <?php
-
- // Set the last group to display if not export all
- if ($TKChucdanh->ExportAll && $TKChucdanh->Export <> "") {
- $TKChucdanh_summary->StopGrp = $TKChucdanh_summary->TotalGrps;
- } else {
- $TKChucdanh_summary->StopGrp = $TKChucdanh_summary->StartGrp + $TKChucdanh_summary->DisplayGrps - 1;
- }
-
- // Stop group <= total number of groups
- if (intval($TKChucdanh_summary->StopGrp) > intval($TKChucdanh_summary->TotalGrps))
- $TKChucdanh_summary->StopGrp = $TKChucdanh_summary->TotalGrps;
- $TKChucdanh_summary->RecCount = 0;
-
- // Get first row
- if ($TKChucdanh_summary->TotalGrps > 0) {
- $TKChucdanh_summary->GetGrpRow(1);
- $TKChucdanh_summary->GrpCount = 1;
- }
- while (($rsgrp && !$rsgrp->EOF && $TKChucdanh_summary->GrpCount <= $TKChucdanh_summary->DisplayGrps) || $TKChucdanh_summary->ShowFirstHeader) {
-
- // Show header
- if ($TKChucdanh_summary->ShowFirstHeader) {
- ?>
- <thead>
- <tr>
- <td class="ewTableHeader">
- <?php if ($TKChucdanh->Export <> "") { ?>
- <?php echo $TKChucdanh->name->FldCaption() ?>
- <?php } else { ?>
- <table cellspacing="0" class="ewTableHeaderBtn"><tr>
- <?php if ($TKChucdanh->SortUrl($TKChucdanh->name) == "") { ?>
- <td style="vertical-align: bottom;"><?php echo $TKChucdanh->name->FldCaption() ?></td>
- <?php } else { ?>
- <td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $TKChucdanh->SortUrl($TKChucdanh->name) ?>',2);"><?php echo $TKChucdanh->name->FldCaption() ?></td><td style="width: 10px;">
- <?php if ($TKChucdanh->name->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($TKChucdanh->name->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
- <?php } ?>
- <td style="width: 20px;" align="right"><a href="#" onclick="ewrpt_ShowPopup(this.name, 'TKChucdanh_name', false, '<?php echo $TKChucdanh->name->RangeFrom; ?>', '<?php echo $TKChucdanh->name->RangeTo; ?>');return false;" name="x_name<?php echo $TKChucdanh_summary->Cnt[0][0]; ?>" id="x_name<?php echo $TKChucdanh_summary->Cnt[0][0]; ?>"><img src="phprptimages/popup.gif" width="15" height="14" border="0" alt="<?php echo $ReportLanguage->Phrase("Filter") ?>"></a></td>
- </tr></table>
- <?php } ?>
- </td>
- <td class="ewTableHeader">
- <?php if ($TKChucdanh->Export <> "") { ?>
- <?php echo $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->FldCaption() ?>
- <?php } else { ?>
- <table cellspacing="0" class="ewTableHeaderBtn"><tr>
- <?php if ($TKChucdanh->SortUrl($TKChucdanh->Count28DISTINCT_tbl__employee2Eid29) == "") { ?>
- <td style="vertical-align: bottom;"><?php echo $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->FldCaption() ?></td>
- <?php } else { ?>
- <td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $TKChucdanh->SortUrl($TKChucdanh->Count28DISTINCT_tbl__employee2Eid29) ?>',2);"><?php echo $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->FldCaption() ?></td><td style="width: 10px;">
- <?php if ($TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
- <?php } ?>
- </tr></table>
- <?php } ?>
- </td>
- <td class="ewTableHeader">
- <?php if ($TKChucdanh->Export <> "") { ?>
- <?php echo $TKChucdanh->Count28tbl__employee2Egender29->FldCaption() ?>
- <?php } else { ?>
- <table cellspacing="0" class="ewTableHeaderBtn"><tr>
- <?php if ($TKChucdanh->SortUrl($TKChucdanh->Count28tbl__employee2Egender29) == "") { ?>
- <td style="vertical-align: bottom;"><?php echo $TKChucdanh->Count28tbl__employee2Egender29->FldCaption() ?></td>
- <?php } else { ?>
- <td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $TKChucdanh->SortUrl($TKChucdanh->Count28tbl__employee2Egender29) ?>',2);"><?php echo $TKChucdanh->Count28tbl__employee2Egender29->FldCaption() ?></td><td style="width: 10px;">
- <?php if ($TKChucdanh->Count28tbl__employee2Egender29->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($TKChucdanh->Count28tbl__employee2Egender29->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
- <?php } ?>
- </tr></table>
- <?php } ?>
- </td>
- <td class="ewTableHeader">
- <?php if ($TKChucdanh->Export <> "") { ?>
- <?php echo $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->FldCaption() ?>
- <?php } else { ?>
- <table cellspacing="0" class="ewTableHeaderBtn"><tr>
- <?php if ($TKChucdanh->SortUrl($TKChucdanh->Count28tbl__profile2Ejoined_party_date29) == "") { ?>
- <td style="vertical-align: bottom;"><?php echo $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->FldCaption() ?></td>
- <?php } else { ?>
- <td class="ewPointer" onmousedown="ewrpt_Sort(event,'<?php echo $TKChucdanh->SortUrl($TKChucdanh->Count28tbl__profile2Ejoined_party_date29) ?>',2);"><?php echo $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->FldCaption() ?></td><td style="width: 10px;">
- <?php if ($TKChucdanh->Count28tbl__profile2Ejoined_party_date29->getSort() == "ASC") { ?><img src="phprptimages/sortup.gif" width="10" height="9" border="0"><?php } elseif ($TKChucdanh->Count28tbl__profile2Ejoined_party_date29->getSort() == "DESC") { ?><img src="phprptimages/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
- <?php } ?>
- </tr></table>
- <?php } ?>
- </td>
- </tr>
- </thead>
- <tbody>
- <?php
- $TKChucdanh_summary->ShowFirstHeader = FALSE;
- }
-
- // Build detail SQL
- $sWhere = ewrpt_DetailFilterSQL($TKChucdanh->name, $TKChucdanh->SqlFirstGroupField(), $TKChucdanh->name->GroupValue());
- if ($TKChucdanh_summary->Filter != "")
- $sWhere = "($TKChucdanh_summary->Filter) AND ($sWhere)";
- $sSql = ewrpt_BuildReportSql($TKChucdanh->SqlSelect(), $TKChucdanh->SqlWhere(), $TKChucdanh->SqlGroupBy(), $TKChucdanh->SqlHaving(), $TKChucdanh->SqlOrderBy(), $sWhere, $TKChucdanh_summary->Sort);
- $rs = $conn->Execute($sSql);
- $rsdtlcnt = ($rs) ? $rs->RecordCount() : 0;
- if ($rsdtlcnt > 0)
- $TKChucdanh_summary->GetRow(1);
- while ($rs && !$rs->EOF) { // Loop detail records
- $TKChucdanh_summary->RecCount++;
-
- // Render detail row
- $TKChucdanh->ResetCSS();
- $TKChucdanh->RowType = EWRPT_ROWTYPE_DETAIL;
- $TKChucdanh_summary->RenderRow();
- ?>
- <tr<?php echo $TKChucdanh->RowAttributes(); ?>>
- <td<?php echo $TKChucdanh->name->CellAttributes(); ?>>
- <span<?php echo $TKChucdanh->name->ViewAttributes(); ?>><?php echo $TKChucdanh->name->GroupViewValue; ?></span></td>
- <td<?php echo $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CellAttributes() ?>>
- <span<?php echo $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->ViewAttributes(); ?>><?php echo $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->ListViewValue(); ?></span></td>
- <td<?php echo $TKChucdanh->Count28tbl__employee2Egender29->CellAttributes() ?>>
- <span<?php echo $TKChucdanh->Count28tbl__employee2Egender29->ViewAttributes(); ?>><?php echo $TKChucdanh->Count28tbl__employee2Egender29->ListViewValue(); ?></span></td>
- <td<?php echo $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CellAttributes() ?>>
- <span<?php echo $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->ViewAttributes(); ?>><?php echo $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->ListViewValue(); ?></span></td>
- </tr>
- <?php
-
- // Accumulate page summary
- $TKChucdanh_summary->AccumulateSummary();
-
- // Get next record
- $TKChucdanh_summary->GetRow(2);
-
- // Show Footers
- ?>
- <?php
- } // End detail records loop
- ?>
- <?php
-
- // Next group
- $TKChucdanh_summary->GetGrpRow(2);
- $TKChucdanh_summary->GrpCount++;
- } // End while
- ?>
- </tbody>
- <tfoot>
- </tfoot>
- </table>
- </div>
- <?php if ($TKChucdanh_summary->TotalGrps > 0) { ?>
- <?php if ($TKChucdanh->Export == "") { ?>
- <div class="ewGridLowerPanel">
- <form action="<?php echo ewrpt_CurrentPage() ?>" name="ewpagerform" id="ewpagerform" class="ewForm">
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td style="white-space: nowrap;">
- <?php if (!isset($Pager)) $Pager = new crPrevNextPager($TKChucdanh_summary->StartGrp, $TKChucdanh_summary->DisplayGrps, $TKChucdanh_summary->TotalGrps) ?>
- <?php if ($Pager->RecordCount > 0) { ?>
- <table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Page") ?> </span></td>
- <!--first page button-->
- <?php if ($Pager->FirstButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/firstdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <!--previous page button-->
- <?php if ($Pager->PrevButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/prevdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <!--current page number-->
- <td><input type="text" name="pageno" id="pageno" value="<?php echo $Pager->CurrentPage ?>" size="4"></td>
- <!--next page button-->
- <?php if ($Pager->NextButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/nextdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <!--last page button-->
- <?php if ($Pager->LastButton->Enabled) { ?>
- <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>
- <?php } else { ?>
- <td><img src="phprptimages/lastdisab.gif" alt="<?php echo $ReportLanguage->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
- <?php } ?>
- <td><span class="phpreportmaker"> <?php echo $ReportLanguage->Phrase("of") ?> <?php echo $Pager->PageCount ?></span></td>
- </tr></table>
- </td>
- <td> </td>
- <td>
- <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>
- <?php } else { ?>
- <?php if ($TKChucdanh_summary->Filter == "0=101") { ?>
- <span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("EnterSearchCriteria") ?></span>
- <?php } else { ?>
- <span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("NoRecord") ?></span>
- <?php } ?>
- <?php } ?>
- </td>
- <?php if ($TKChucdanh_summary->TotalGrps > 0) { ?>
- <td style="white-space: nowrap;"> </td>
- <td align="right" style="vertical-align: top; white-space: nowrap;"><span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("GroupsPerPage"); ?>
- <select name="<?php echo EWRPT_TABLE_GROUP_PER_PAGE; ?>" onchange="this.form.submit();">
- <option value="1"<?php if ($TKChucdanh_summary->DisplayGrps == 1) echo " selected=\"selected\"" ?>>1</option>
- <option value="2"<?php if ($TKChucdanh_summary->DisplayGrps == 2) echo " selected=\"selected\"" ?>>2</option>
- <option value="3"<?php if ($TKChucdanh_summary->DisplayGrps == 3) echo " selected=\"selected\"" ?>>3</option>
- <option value="4"<?php if ($TKChucdanh_summary->DisplayGrps == 4) echo " selected=\"selected\"" ?>>4</option>
- <option value="5"<?php if ($TKChucdanh_summary->DisplayGrps == 5) echo " selected=\"selected\"" ?>>5</option>
- <option value="10"<?php if ($TKChucdanh_summary->DisplayGrps == 10) echo " selected=\"selected\"" ?>>10</option>
- <option value="20"<?php if ($TKChucdanh_summary->DisplayGrps == 20) echo " selected=\"selected\"" ?>>20</option>
- <option value="50"<?php if ($TKChucdanh_summary->DisplayGrps == 50) echo " selected=\"selected\"" ?>>50</option>
- <option value="ALL"<?php if ($TKChucdanh->getGroupPerPage() == -1) echo " selected=\"selected\"" ?>><?php echo $ReportLanguage->Phrase("AllRecords") ?></option>
- </select>
- </span></td>
- <?php } ?>
- </tr>
- </table>
- </form>
- </div>
- <?php } ?>
- <?php } ?>
- </td></tr></table>
- </div>
- <!-- Summary Report Ends -->
- <?php if ($TKChucdanh->Export == "" || $TKChucdanh->Export == "print" || $TKChucdanh->Export == "email") { ?>
- </div><br></td>
- <!-- Center Container - Report (End) -->
- <!-- Right Container (Begin) -->
- <td style="vertical-align: top;"><div id="ewRight" class="phpreportmaker">
- <!-- Right slot -->
- </div></td>
- <!-- Right Container (End) -->
- </tr>
- <!-- Bottom Container (Begin) -->
- <tr><td colspan="3"><div id="ewBottom" class="phpreportmaker">
- <!-- Bottom slot -->
- </div><br></td></tr>
- <!-- Bottom Container (End) -->
- </table>
- <!-- Table Container (End) -->
- <?php } ?>
- <?php $TKChucdanh_summary->ShowPageFooter(); ?>
- <?php if (EWRPT_DEBUG_ENABLED) echo ewrpt_DebugMsg(); ?>
- <?php
-
- // Close recordsets
- if ($rsgrp) $rsgrp->Close();
- if ($rs) $rs->Close();
- ?>
- <?php if ($TKChucdanh->Export == "") { ?>
- <script language="JavaScript" type="text/javascript">
- <!--
-
- // Write your table-specific startup script here
- // document.write("page loaded");
- //-->
-
- </script>
- <?php } ?>
- <?php include_once "phprptinc/footer.php"; ?>
- <?php
- $TKChucdanh_summary->Page_Terminate();
- ?>
- <?php
-
- //
- // Page class
- //
- class crTKChucdanh_summary {
-
- // Page ID
- var $PageID = 'summary';
-
- // Table name
- var $TableName = 'TKChucdanh';
-
- // Page object name
- var $PageObjName = 'TKChucdanh_summary';
-
- // Page name
- function PageName() {
- return ewrpt_CurrentPage();
- }
-
- // Page URL
- function PageUrl() {
- $PageUrl = ewrpt_CurrentPage() . "?";
- global $TKChucdanh;
- if ($TKChucdanh->UseTokenInUrl) $PageUrl .= "t=" . $TKChucdanh->TableVar . "&"; // Add page token
- return $PageUrl;
- }
-
- // Export URLs
- var $ExportPrintUrl;
- var $ExportExcelUrl;
- var $ExportWordUrl;
- var $ExportPdfUrl;
- var $ReportTableClass;
-
- // Message
- function getMessage() {
- return @$_SESSION[EWRPT_SESSION_MESSAGE];
- }
-
- function setMessage($v) {
- if (@$_SESSION[EWRPT_SESSION_MESSAGE] <> "") { // Append
- $_SESSION[EWRPT_SESSION_MESSAGE] .= "<br>" . $v;
- } else {
- $_SESSION[EWRPT_SESSION_MESSAGE] = $v;
- }
- }
-
- // Show message
- function ShowMessage() {
- $sMessage = $this->getMessage();
- $this->Message_Showing($sMessage);
- if ($sMessage <> "") { // Message in Session, display
- echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
- $_SESSION[EWRPT_SESSION_MESSAGE] = ""; // Clear message in Session
- }
- }
- var $PageHeader;
- var $PageFooter;
-
- // Show Page Header
- function ShowPageHeader() {
- $sHeader = $this->PageHeader;
- $this->Page_DataRendering($sHeader);
- if ($sHeader <> "") { // Header exists, display
- echo "<p><span class=\"phpreportmaker\">" . $sHeader . "</span></p>";
- }
- }
-
- // Show Page Footer
- function ShowPageFooter() {
- $sFooter = $this->PageFooter;
- $this->Page_DataRendered($sFooter);
- if ($sFooter <> "") { // Fotoer exists, display
- echo "<p><span class=\"phpreportmaker\">" . $sFooter . "</span></p>";
- }
- }
-
- // Validate page request
- function IsPageRequest() {
- global $TKChucdanh;
- if ($TKChucdanh->UseTokenInUrl) {
- if (ewrpt_IsHttpPost())
- return ($TKChucdanh->TableVar == @$_POST("t"));
- if (@$_GET["t"] <> "")
- return ($TKChucdanh->TableVar == @$_GET["t"]);
- } else {
- return TRUE;
- }
- }
-
- //
- // Page class constructor
- //
- function crTKChucdanh_summary() {
- global $conn, $ReportLanguage;
-
- // Language object
- $ReportLanguage = new crLanguage();
-
- // Table object (TKChucdanh)
- $GLOBALS["TKChucdanh"] = new crTKChucdanh();
- $GLOBALS["Table"] =& $GLOBALS["TKChucdanh"];
-
- // Initialize URLs
- $this->ExportPrintUrl = $this->PageUrl() . "export=print";
- $this->ExportExcelUrl = $this->PageUrl() . "export=excel";
- $this->ExportWordUrl = $this->PageUrl() . "export=word";
- $this->ExportPdfUrl = $this->PageUrl() . "export=pdf";
-
- // Page ID
- if (!defined("EWRPT_PAGE_ID"))
- define("EWRPT_PAGE_ID", 'summary', TRUE);
-
- // Table name (for backward compatibility)
- if (!defined("EWRPT_TABLE_NAME"))
- define("EWRPT_TABLE_NAME", 'TKChucdanh', TRUE);
-
- // Start timer
- $GLOBALS["gsTimer"] = new crTimer();
-
- // Open connection
- $conn = ewrpt_Connect();
-
- // Export options
- $this->ExportOptions = new crListOptions();
- $this->ExportOptions->Tag = "span";
- $this->ExportOptions->Separator = " ";
- }
-
- //
- // Page_Init
- //
- function Page_Init() {
- global $gsExport, $gsExportFile, $ReportLanguage, $Security;
- global $TKChucdanh;
-
- // Get export parameters
- if (@$_GET["export"] <> "") {
- $TKChucdanh->Export = $_GET["export"];
- }
- $gsExport = $TKChucdanh->Export; // Get export parameter, used in header
- $gsExportFile = $TKChucdanh->TableVar; // Get export file, used in header
- if ($TKChucdanh->Export == "excel") {
- header('Content-Type: application/vnd.ms-excel;charset=utf-8');
- header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
- }
- if ($TKChucdanh->Export == "word") {
- header('Content-Type: application/vnd.ms-word;charset=utf-8');
- header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
- }
-
- // Setup export options
- $this->SetupExportOptions();
-
- // Global Page Loading event (in userfn*.php)
- Page_Loading();
-
- // Page Load event
- $this->Page_Load();
- }
-
- // Set up export options
- function SetupExportOptions() {
- global $ReportLanguage, $TKChucdanh;
-
- // Printer friendly
- $item =& $this->ExportOptions->Add("print");
- $item->Body = "<a href=\"" . $this->ExportPrintUrl . "\">" . $ReportLanguage->Phrase("PrinterFriendly") . "</a>";
- $item->Visible = TRUE;
-
- // Export to Excel
- $item =& $this->ExportOptions->Add("excel");
- $item->Body = "<a href=\"" . $this->ExportExcelUrl . "\">" . $ReportLanguage->Phrase("ExportToExcel") . "</a>";
- $item->Visible = TRUE;
-
- // Export to Word
- $item =& $this->ExportOptions->Add("word");
- $item->Body = "<a href=\"" . $this->ExportWordUrl . "\">" . $ReportLanguage->Phrase("ExportToWord") . "</a>";
- $item->Visible = TRUE;
-
- // Export to Pdf
- $item =& $this->ExportOptions->Add("pdf");
- $item->Body = "<a href=\"" . $this->ExportPdfUrl . "\">" . $ReportLanguage->Phrase("ExportToPDF") . "</a>";
- $item->Visible = FALSE;
-
- // Uncomment codes below to show export to Pdf link
- // $item->Visible = FALSE;
- // Export to Email
-
- $item =& $this->ExportOptions->Add("email");
- $item->Body = "<a name=\"emf_TKChucdanh\" id=\"emf_TKChucdanh\" href=\"javascript:void(0);\" onclick=\"ewrpt_EmailDialogShow({lnk:'emf_TKChucdanh',hdr:ewLanguage.Phrase('ExportToEmail')});\">" . $ReportLanguage->Phrase("ExportToEmail") . "</a>";
- $item->Visible = FALSE;
-
- // Reset filter
- $item =& $this->ExportOptions->Add("resetfilter");
- $item->Body = "<a href=\"" . ewrpt_CurrentPage() . "?cmd=reset\">" . $ReportLanguage->Phrase("ResetAllFilter") . "</a>";
- $item->Visible = TRUE;
- $this->SetupExportOptionsExt();
-
- // Hide options for export
- if ($TKChucdanh->Export <> "")
- $this->ExportOptions->HideAllOptions();
-
- // Set up table class
- if ($TKChucdanh->Export == "word" || $TKChucdanh->Export == "excel" || $TKChucdanh->Export == "pdf")
- $this->ReportTableClass = "ewTable";
- else
- $this->ReportTableClass = "ewTable ewTableSeparate";
- }
-
- //
- // Page_Terminate
- //
- function Page_Terminate($url = "") {
- global $conn;
- global $ReportLanguage;
- global $TKChucdanh;
-
- // Page Unload event
- $this->Page_Unload();
-
- // Global Page Unloaded event (in userfn*.php)
- Page_Unloaded();
-
- // Export to Email (use ob_file_contents for PHP)
- if ($TKChucdanh->Export == "email") {
- $sContent = ob_get_contents();
- $this->ExportEmail($sContent);
- ob_end_clean();
-
- // Close connection
- $conn->Close();
- header("Location: " . ewrpt_CurrentPage());
- exit();
- }
-
- // Export to PDF (use ob_file_contents for PHP)
- if ($TKChucdanh->Export == "pdf") {
- $sContent = ob_get_contents();
- $this->ExportPDF($sContent);
- ob_end_clean();
-
- // Close connection
- $conn->Close();
- }
-
- // Close connection
- $conn->Close();
-
- // Go to URL if specified
- if ($url <> "") {
- if (!EWRPT_DEBUG_ENABLED && ob_get_length())
- ob_end_clean();
- header("Location: " . $url);
- }
- exit();
- }
-
- // Initialize common variables
- var $ExportOptions; // Export options
-
- // Paging variables
- var $RecCount = 0; // Record count
- var $StartGrp = 0; // Start group
- var $StopGrp = 0; // Stop group
- var $TotalGrps = 0; // Total groups
- var $GrpCount = 0; // Group count
- var $DisplayGrps = 20; // Groups per page
- var $GrpRange = 10;
- var $Sort = "";
- var $Filter = "";
- var $UserIDFilter = "";
-
- // Clear field for ext filter
- var $ClearExtFilter = "";
- var $FilterApplied;
- var $ShowFirstHeader;
- var $Cnt, $Col, $Val, $Smry, $Mn, $Mx, $GrandSmry, $GrandMn, $GrandMx;
- var $TotCount;
-
- //
- // Page main
- //
- function Page_Main() {
- global $TKChucdanh;
- global $rs;
- global $rsgrp;
- global $gsFormError;
-
- // Aggregate variables
- // 1st dimension = no of groups (level 0 used for grand total)
- // 2nd dimension = no of fields
-
- $nDtls = 4;
- $nGrps = 2;
- $this->Val =& ewrpt_InitArray($nDtls, 0);
- $this->Cnt =& ewrpt_Init2DArray($nGrps, $nDtls, 0);
- $this->Smry =& ewrpt_Init2DArray($nGrps, $nDtls, 0);
- $this->Mn =& ewrpt_Init2DArray($nGrps, $nDtls, NULL);
- $this->Mx =& ewrpt_Init2DArray($nGrps, $nDtls, NULL);
- $this->GrandSmry =& ewrpt_InitArray($nDtls, 0);
- $this->GrandMn =& ewrpt_InitArray($nDtls, NULL);
- $this->GrandMx =& ewrpt_InitArray($nDtls, NULL);
-
- // Set up if accumulation required
- $this->Col = array(FALSE, TRUE, TRUE, TRUE);
-
- // Set up groups per page dynamically
- $this->SetUpDisplayGrps();
- $TKChucdanh->name->SelectionList = "";
- $TKChucdanh->name->DefaultSelectionList = "";
- $TKChucdanh->name->ValueList = "";
-
- // Load default filter values
- $this->LoadDefaultFilters();
-
- // Load custom filters
- $TKChucdanh->Filters_Load();
-
- // Set up popup filter
- $this->SetupPopup();
-
- // Extended filter
- $sExtendedFilter = "";
-
- // Build popup filter
- $sPopupFilter = $this->GetPopupFilter();
-
- //ewrpt_SetDebugMsg("popup filter: " . $sPopupFilter);
- if ($sPopupFilter <> "") {
- if ($this->Filter <> "")
- $this->Filter = "($this->Filter) AND ($sPopupFilter)";
- else
- $this->Filter = $sPopupFilter;
- }
-
- // Check if filter applied
- $this->FilterApplied = $this->CheckFilter();
- $this->ExportOptions->GetItem("resetfilter")->Visible = $this->FilterApplied;
-
- // Get sort
- $this->Sort = $this->GetSort();
-
- // Get total group count
- $sGrpSort = ewrpt_UpdateSortFields($TKChucdanh->SqlOrderByGroup(), $this->Sort, 2); // Get grouping field only
- $sSql = ewrpt_BuildReportSql($TKChucdanh->SqlSelectGroup(), $TKChucdanh->SqlWhere(), $TKChucdanh->SqlGroupBy(), $TKChucdanh->SqlHaving(), $TKChucdanh->SqlOrderByGroup(), $this->Filter, $sGrpSort);
- $this->TotalGrps = $this->GetGrpCnt($sSql);
- if ($this->DisplayGrps <= 0) // Display all groups
- $this->DisplayGrps = $this->TotalGrps;
- $this->StartGrp = 1;
-
- // Show header
- $this->ShowFirstHeader = ($this->TotalGrps > 0);
-
- //$this->ShowFirstHeader = TRUE; // Uncomment to always show header
- // Set up start position if not export all
-
- if ($TKChucdanh->ExportAll && $TKChucdanh->Export <> "")
- $this->DisplayGrps = $this->TotalGrps;
- else
- $this->SetUpStartGroup();
-
- // Hide all options if export
- if ($TKChucdanh->Export <> "") {
- $this->ExportOptions->HideAllOptions();
- }
-
- // Get current page groups
- $rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
-
- // Init detail recordset
- $rs = NULL;
- }
-
- // Check level break
- function ChkLvlBreak($lvl) {
- global $TKChucdanh;
- switch ($lvl) {
- case 1:
- return (is_null($TKChucdanh->name->CurrentValue) && !is_null($TKChucdanh->name->OldValue)) ||
- (!is_null($TKChucdanh->name->CurrentValue) && is_null($TKChucdanh->name->OldValue)) ||
- ($TKChucdanh->name->GroupValue() <> $TKChucdanh->name->GroupOldValue());
- }
- }
-
- // Accummulate summary
- function AccumulateSummary() {
- $cntx = count($this->Smry);
- for ($ix = 0; $ix < $cntx; $ix++) {
- $cnty = count($this->Smry[$ix]);
- for ($iy = 1; $iy < $cnty; $iy++) {
- $this->Cnt[$ix][$iy]++;
- if ($this->Col[$iy]) {
- $valwrk = $this->Val[$iy];
- if (is_null($valwrk) || !is_numeric($valwrk)) {
-
- // skip
- } else {
- $this->Smry[$ix][$iy] += $valwrk;
- if (is_null($this->Mn[$ix][$iy])) {
- $this->Mn[$ix][$iy] = $valwrk;
- $this->Mx[$ix][$iy] = $valwrk;
- } else {
- if ($this->Mn[$ix][$iy] > $valwrk) $this->Mn[$ix][$iy] = $valwrk;
- if ($this->Mx[$ix][$iy] < $valwrk) $this->Mx[$ix][$iy] = $valwrk;
- }
- }
- }
- }
- }
- $cntx = count($this->Smry);
- for ($ix = 1; $ix < $cntx; $ix++) {
- $this->Cnt[$ix][0]++;
- }
- }
-
- // Reset level summary
- function ResetLevelSummary($lvl) {
-
- // Clear summary values
- $cntx = count($this->Smry);
- for ($ix = $lvl; $ix < $cntx; $ix++) {
- $cnty = count($this->Smry[$ix]);
- for ($iy = 1; $iy < $cnty; $iy++) {
- $this->Cnt[$ix][$iy] = 0;
- if ($this->Col[$iy]) {
- $this->Smry[$ix][$iy] = 0;
- $this->Mn[$ix][$iy] = NULL;
- $this->Mx[$ix][$iy] = NULL;
- }
- }
- }
- $cntx = count($this->Smry);
- for ($ix = $lvl; $ix < $cntx; $ix++) {
- $this->Cnt[$ix][0] = 0;
- }
-
- // Reset record count
- $this->RecCount = 0;
- }
-
- // Accummulate grand summary
- function AccumulateGrandSummary() {
- $this->Cnt[0][0]++;
- $cntgs = count($this->GrandSmry);
- for ($iy = 1; $iy < $cntgs; $iy++) {
- if ($this->Col[$iy]) {
- $valwrk = $this->Val[$iy];
- if (is_null($valwrk) || !is_numeric($valwrk)) {
-
- // skip
- } else {
- $this->GrandSmry[$iy] += $valwrk;
- if (is_null($this->GrandMn[$iy])) {
- $this->GrandMn[$iy] = $valwrk;
- $this->GrandMx[$iy] = $valwrk;
- } else {
- if ($this->GrandMn[$iy] > $valwrk) $this->GrandMn[$iy] = $valwrk;
- if ($this->GrandMx[$iy] < $valwrk) $this->GrandMx[$iy] = $valwrk;
- }
- }
- }
- }
- }
-
- // Get group count
- function GetGrpCnt($sql) {
- global $conn;
- global $TKChucdanh;
- $rsgrpcnt = $conn->Execute($sql);
- $grpcnt = ($rsgrpcnt) ? $rsgrpcnt->RecordCount() : 0;
- if ($rsgrpcnt) $rsgrpcnt->Close();
- return $grpcnt;
- }
-
- // Get group rs
- function GetGrpRs($sql, $start, $grps) {
- global $conn;
- global $TKChucdanh;
- $wrksql = $sql;
- if ($start > 0 && $grps > -1)
- $wrksql .= " LIMIT " . ($start-1) . ", " . ($grps);
- $rswrk = $conn->Execute($wrksql);
- return $rswrk;
- }
-
- // Get group row values
- function GetGrpRow($opt) {
- global $rsgrp;
- global $TKChucdanh;
- if (!$rsgrp)
- return;
- if ($opt == 1) { // Get first group
-
- //$rsgrp->MoveFirst(); // NOTE: no need to move position
- $TKChucdanh->name->setDbValue(""); // Init first value
- } else { // Get next group
- $rsgrp->MoveNext();
- }
- if (!$rsgrp->EOF)
- $TKChucdanh->name->setDbValue($rsgrp->fields[0]);
- if ($rsgrp->EOF) {
- $TKChucdanh->name->setDbValue("");
- }
- }
-
- // Get row values
- function GetRow($opt) {
- global $rs;
- global $TKChucdanh;
- if (!$rs)
- return;
- if ($opt == 1) { // Get first row
-
- // $rs->MoveFirst(); // NOTE: no need to move position
- } else { // Get next row
- $rs->MoveNext();
- }
- if (!$rs->EOF) {
- if ($opt <> 1) {
- if (is_array($TKChucdanh->name->GroupDbValues))
- $TKChucdanh->name->setDbValue(@$TKChucdanh->name->GroupDbValues[$rs->fields('name')]);
- else
- $TKChucdanh->name->setDbValue(ewrpt_GroupValue($TKChucdanh->name, $rs->fields('name')));
- }
- $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->setDbValue($rs->fields('Count(DISTINCT tbl__employee.id)'));
- $TKChucdanh->Count28tbl__employee2Egender29->setDbValue($rs->fields('Count(tbl__employee.gender)'));
- $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->setDbValue($rs->fields('Count(tbl__profile.joined_party_date)'));
- $this->Val[1] = $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CurrentValue;
- $this->Val[2] = $TKChucdanh->Count28tbl__employee2Egender29->CurrentValue;
- $this->Val[3] = $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CurrentValue;
- } else {
- $TKChucdanh->name->setDbValue("");
- $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->setDbValue("");
- $TKChucdanh->Count28tbl__employee2Egender29->setDbValue("");
- $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->setDbValue("");
- }
- }
-
- // Set up starting group
- function SetUpStartGroup() {
- global $TKChucdanh;
-
- // Exit if no groups
- if ($this->DisplayGrps == 0)
- return;
-
- // Check for a 'start' parameter
- if (@$_GET[EWRPT_TABLE_START_GROUP] != "") {
- $this->StartGrp = $_GET[EWRPT_TABLE_START_GROUP];
- $TKChucdanh->setStartGroup($this->StartGrp);
- } elseif (@$_GET["pageno"] != "") {
- $nPageNo = $_GET["pageno"];
- if (is_numeric($nPageNo)) {
- $this->StartGrp = ($nPageNo-1)*$this->DisplayGrps+1;
- if ($this->StartGrp <= 0) {
- $this->StartGrp = 1;
- } elseif ($this->StartGrp >= intval(($this->TotalGrps-1)/$this->DisplayGrps)*$this->DisplayGrps+1) {
- $this->StartGrp = intval(($this->TotalGrps-1)/$this->DisplayGrps)*$this->DisplayGrps+1;
- }
- $TKChucdanh->setStartGroup($this->StartGrp);
- } else {
- $this->StartGrp = $TKChucdanh->getStartGroup();
- }
- } else {
- $this->StartGrp = $TKChucdanh->getStartGroup();
- }
-
- // Check if correct start group counter
- if (!is_numeric($this->StartGrp) || $this->StartGrp == "") { // Avoid invalid start group counter
- $this->StartGrp = 1; // Reset start group counter
- $TKChucdanh->setStartGroup($this->StartGrp);
- } elseif (intval($this->StartGrp) > intval($this->TotalGrps)) { // Avoid starting group > total groups
- $this->StartGrp = intval(($this->TotalGrps-1)/$this->DisplayGrps) * $this->DisplayGrps + 1; // Point to last page first group
- $TKChucdanh->setStartGroup($this->StartGrp);
- } elseif (($this->StartGrp-1) % $this->DisplayGrps <> 0) {
- $this->StartGrp = intval(($this->StartGrp-1)/$this->DisplayGrps) * $this->DisplayGrps + 1; // Point to page boundary
- $TKChucdanh->setStartGroup($this->StartGrp);
- }
- }
-
- // Set up popup
- function SetupPopup() {
- global $conn, $ReportLanguage;
- global $TKChucdanh;
-
- // Initialize popup
- // Build distinct values for name
-
- $bNullValue = FALSE;
- $bEmptyValue = FALSE;
- $sSql = ewrpt_BuildReportSql($TKChucdanh->name->SqlSelect, $TKChucdanh->SqlWhere(), $TKChucdanh->SqlGroupBy(), $TKChucdanh->SqlHaving(), $TKChucdanh->name->SqlOrderBy, $this->Filter, "");
- $rswrk = $conn->Execute($sSql);
- while ($rswrk && !$rswrk->EOF) {
- $TKChucdanh->name->setDbValue($rswrk->fields[0]);
- if (is_null($TKChucdanh->name->CurrentValue)) {
- $bNullValue = TRUE;
- } elseif ($TKChucdanh->name->CurrentValue == "") {
- $bEmptyValue = TRUE;
- } else {
- $TKChucdanh->name->GroupViewValue = ewrpt_DisplayGroupValue($TKChucdanh->name,$TKChucdanh->name->GroupValue());
- ewrpt_SetupDistinctValues($TKChucdanh->name->ValueList, $TKChucdanh->name->GroupValue(), $TKChucdanh->name->GroupViewValue, FALSE);
- }
- $rswrk->MoveNext();
- }
- if ($rswrk)
- $rswrk->Close();
- if ($bEmptyValue)
- ewrpt_SetupDistinctValues($TKChucdanh->name->ValueList, EWRPT_EMPTY_VALUE, $ReportLanguage->Phrase("EmptyLabel"), FALSE);
- if ($bNullValue)
- ewrpt_SetupDistinctValues($TKChucdanh->name->ValueList, EWRPT_NULL_VALUE, $ReportLanguage->Phrase("NullLabel"), FALSE);
-
- // Process post back form
- if (ewrpt_IsHttpPost()) {
- $sName = @$_POST["popup"]; // Get popup form name
- if ($sName <> "") {
- $cntValues = (is_array(@$_POST["sel_$sName"])) ? count($_POST["sel_$sName"]) : 0;
- if ($cntValues > 0) {
- $arValues = ewrpt_StripSlashes($_POST["sel_$sName"]);
- if (trim($arValues[0]) == "") // Select all
- $arValues = EWRPT_INIT_VALUE;
- $_SESSION["sel_$sName"] = $arValues;
- $_SESSION["rf_$sName"] = ewrpt_StripSlashes(@$_POST["rf_$sName"]);
- $_SESSION["rt_$sName"] = ewrpt_StripSlashes(@$_POST["rt_$sName"]);
- $this->ResetPager();
- }
- }
-
- // Get 'reset' command
- } elseif (@$_GET["cmd"] <> "") {
- $sCmd = $_GET["cmd"];
- if (strtolower($sCmd) == "reset") {
- $this->ClearSessionSelection('name');
- $this->ResetPager();
- }
- }
-
- // Load selection criteria to array
- // Get Chá?Šc danh selected values
-
- if (is_array(@$_SESSION["sel_TKChucdanh_name"])) {
- $this->LoadSelectionFromSession('name');
- } elseif (@$_SESSION["sel_TKChucdanh_name"] == EWRPT_INIT_VALUE) { // Select all
- $TKChucdanh->name->SelectionList = "";
- }
- }
-
- // Reset pager
- function ResetPager() {
-
- // Reset start position (reset command)
- global $TKChucdanh;
- $this->StartGrp = 1;
- $TKChucdanh->setStartGroup($this->StartGrp);
- }
-
- // Set up number of groups displayed per page
- function SetUpDisplayGrps() {
- global $TKChucdanh;
- $sWrk = @$_GET[EWRPT_TABLE_GROUP_PER_PAGE];
- if ($sWrk <> "") {
- if (is_numeric($sWrk)) {
- $this->DisplayGrps = intval($sWrk);
- } else {
- if (strtoupper($sWrk) == "ALL") { // display all groups
- $this->DisplayGrps = -1;
- } else {
- $this->DisplayGrps = 20; // Non-numeric, load default
- }
- }
- $TKChucdanh->setGroupPerPage($this->DisplayGrps); // Save to session
-
- // Reset start position (reset command)
- $this->StartGrp = 1;
- $TKChucdanh->setStartGroup($this->StartGrp);
- } else {
- if ($TKChucdanh->getGroupPerPage() <> "") {
- $this->DisplayGrps = $TKChucdanh->getGroupPerPage(); // Restore from session
- } else {
- $this->DisplayGrps = 20; // Load default
- }
- }
- }
-
- function RenderRow() {
- global $conn, $rs, $Security;
- global $TKChucdanh;
- if ($TKChucdanh->RowTotalType == EWRPT_ROWTOTAL_GRAND) { // Grand total
-
- // Get total count from sql directly
- $sSql = ewrpt_BuildReportSql($TKChucdanh->SqlSelectCount(), $TKChucdanh->SqlWhere(), $TKChucdanh->SqlGroupBy(), $TKChucdanh->SqlHaving(), "", $this->Filter, "");
- $rstot = $conn->Execute($sSql);
- if ($rstot) {
- $this->TotCount = ($rstot->RecordCount()>1) ? $rstot->RecordCount() : $rstot->fields[0];
- $rstot->Close();
- } else {
- $this->TotCount = 0;
- }
-
- // Get total from sql directly
- $sSql = ewrpt_BuildReportSql($TKChucdanh->SqlSelectAgg(), $TKChucdanh->SqlWhere(), $TKChucdanh->SqlGroupBy(), $TKChucdanh->SqlHaving(), "", $this->Filter, "");
- $sSql = $TKChucdanh->SqlAggPfx() . $sSql . $TKChucdanh->SqlAggSfx();
- $rsagg = $conn->Execute($sSql);
- if ($rsagg) {
- $this->GrandSmry[1] = $rsagg->fields("sum_count28distinct_tbl__employee2eid29");
- $this->GrandSmry[2] = $rsagg->fields("sum_count28tbl__employee2egender29");
- $this->GrandSmry[3] = $rsagg->fields("sum_count28tbl__profile2ejoined_party_date29");
- $rsagg->Close();
- } else {
-
- // Accumulate grand summary from detail records
- $sSql = ewrpt_BuildReportSql($TKChucdanh->SqlSelect(), $TKChucdanh->SqlWhere(), $TKChucdanh->SqlGroupBy(), $TKChucdanh->SqlHaving(), "", $this->Filter, "");
- $rs = $conn->Execute($sSql);
- if ($rs) {
- $this->GetRow(1);
- while (!$rs->EOF) {
- $this->AccumulateGrandSummary();
- $this->GetRow(2);
- }
- $rs->Close();
- }
- }
- }
-
- // Call Row_Rendering event
- $TKChucdanh->Row_Rendering();
-
- //
- // Render view codes
- //
-
- if ($TKChucdanh->RowType == EWRPT_ROWTYPE_TOTAL) { // Summary row
-
- // name
- $TKChucdanh->name->GroupViewValue = $TKChucdanh->name->GroupOldValue();
- $TKChucdanh->name->CellAttrs["class"] = ($TKChucdanh->RowGroupLevel == 1) ? "ewRptGrpSummary1" : "ewRptGrpField1";
- $TKChucdanh->name->GroupViewValue = ewrpt_DisplayGroupValue($TKChucdanh->name, $TKChucdanh->name->GroupViewValue);
- $TKChucdanh->name->GroupSummaryOldValue = $TKChucdanh->name->GroupSummaryValue;
- $TKChucdanh->name->GroupSummaryValue = $TKChucdanh->name->GroupViewValue;
- $TKChucdanh->name->GroupSummaryViewValue = ($TKChucdanh->name->GroupSummaryOldValue <> $TKChucdanh->name->GroupSummaryValue) ? $TKChucdanh->name->GroupSummaryValue : " ";
-
- // Count(DISTINCT tbl__employee.id)
- $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->SumViewValue = $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->SumValue;
- $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CellAttrs["class"] = ($TKChucdanh->RowTotalType == EWRPT_ROWTOTAL_PAGE || $TKChucdanh->RowTotalType == EWRPT_ROWTOTAL_GRAND) ? "ewRptGrpAggregate" : "ewRptGrpSummary" . $TKChucdanh->RowGroupLevel;
-
- // Count(tbl__employee.gender)
- $TKChucdanh->Count28tbl__employee2Egender29->SumViewValue = $TKChucdanh->Count28tbl__employee2Egender29->SumValue;
- $TKChucdanh->Count28tbl__employee2Egender29->CellAttrs["class"] = ($TKChucdanh->RowTotalType == EWRPT_ROWTOTAL_PAGE || $TKChucdanh->RowTotalType == EWRPT_ROWTOTAL_GRAND) ? "ewRptGrpAggregate" : "ewRptGrpSummary" . $TKChucdanh->RowGroupLevel;
-
- // Count(tbl__profile.joined_party_date)
- $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->SumViewValue = $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->SumValue;
- $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CellAttrs["class"] = ($TKChucdanh->RowTotalType == EWRPT_ROWTOTAL_PAGE || $TKChucdanh->RowTotalType == EWRPT_ROWTOTAL_GRAND) ? "ewRptGrpAggregate" : "ewRptGrpSummary" . $TKChucdanh->RowGroupLevel;
-
- // name
- $TKChucdanh->name->HrefValue = "";
- } else {
-
- // name
- $TKChucdanh->name->GroupViewValue = $TKChucdanh->name->GroupValue();
- $TKChucdanh->name->CellAttrs["class"] = "ewRptGrpField1";
- $TKChucdanh->name->GroupViewValue = ewrpt_DisplayGroupValue($TKChucdanh->name, $TKChucdanh->name->GroupViewValue);
- if ($TKChucdanh->name->GroupValue() == $TKChucdanh->name->GroupOldValue() && !$this->ChkLvlBreak(1))
- $TKChucdanh->name->GroupViewValue = " ";
-
- // Count(DISTINCT tbl__employee.id)
- $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->ViewValue = $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CurrentValue;
- $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CellAttrs["class"] = ($this->RecCount % 2 <> 1) ? "ewTableAltRow" : "ewTableRow";
-
- // Count(tbl__employee.gender)
- $TKChucdanh->Count28tbl__employee2Egender29->ViewValue = $TKChucdanh->Count28tbl__employee2Egender29->CurrentValue;
- $TKChucdanh->Count28tbl__employee2Egender29->CellAttrs["class"] = ($this->RecCount % 2 <> 1) ? "ewTableAltRow" : "ewTableRow";
-
- // Count(tbl__profile.joined_party_date)
- $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->ViewValue = $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CurrentValue;
- $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CellAttrs["class"] = ($this->RecCount % 2 <> 1) ? "ewTableAltRow" : "ewTableRow";
-
- // name
- $TKChucdanh->name->HrefValue = "";
-
- // Count(DISTINCT tbl__employee.id)
- $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->HrefValue = "";
-
- // Count(tbl__employee.gender)
- $TKChucdanh->Count28tbl__employee2Egender29->HrefValue = "";
-
- // Count(tbl__profile.joined_party_date)
- $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->HrefValue = "";
- }
-
- // Call Cell_Rendered event
- if ($TKChucdanh->RowType == EWRPT_ROWTYPE_TOTAL) { // Summary row
-
- // name
- $CurrentValue = $TKChucdanh->name->GroupViewValue;
- $ViewValue =& $TKChucdanh->name->GroupViewValue;
- $ViewAttrs =& $TKChucdanh->name->ViewAttrs;
- $CellAttrs =& $TKChucdanh->name->CellAttrs;
- $HrefValue =& $TKChucdanh->name->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->name, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
-
- // Count(DISTINCT tbl__employee.id)
- $CurrentValue = $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->SumValue;
- $ViewValue =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->SumViewValue;
- $ViewAttrs =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->ViewAttrs;
- $CellAttrs =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CellAttrs;
- $HrefValue =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->Count28DISTINCT_tbl__employee2Eid29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
-
- // Count(tbl__employee.gender)
- $CurrentValue = $TKChucdanh->Count28tbl__employee2Egender29->SumValue;
- $ViewValue =& $TKChucdanh->Count28tbl__employee2Egender29->SumViewValue;
- $ViewAttrs =& $TKChucdanh->Count28tbl__employee2Egender29->ViewAttrs;
- $CellAttrs =& $TKChucdanh->Count28tbl__employee2Egender29->CellAttrs;
- $HrefValue =& $TKChucdanh->Count28tbl__employee2Egender29->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->Count28tbl__employee2Egender29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
-
- // Count(tbl__profile.joined_party_date)
- $CurrentValue = $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->SumValue;
- $ViewValue =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->SumViewValue;
- $ViewAttrs =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->ViewAttrs;
- $CellAttrs =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CellAttrs;
- $HrefValue =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->Count28tbl__profile2Ejoined_party_date29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
- } else {
-
- // name
- $CurrentValue = $TKChucdanh->name->GroupValue();
- $ViewValue =& $TKChucdanh->name->GroupViewValue;
- $ViewAttrs =& $TKChucdanh->name->ViewAttrs;
- $CellAttrs =& $TKChucdanh->name->CellAttrs;
- $HrefValue =& $TKChucdanh->name->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->name, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
-
- // Count(DISTINCT tbl__employee.id)
- $CurrentValue = $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CurrentValue;
- $ViewValue =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->ViewValue;
- $ViewAttrs =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->ViewAttrs;
- $CellAttrs =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->CellAttrs;
- $HrefValue =& $TKChucdanh->Count28DISTINCT_tbl__employee2Eid29->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->Count28DISTINCT_tbl__employee2Eid29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
-
- // Count(tbl__employee.gender)
- $CurrentValue = $TKChucdanh->Count28tbl__employee2Egender29->CurrentValue;
- $ViewValue =& $TKChucdanh->Count28tbl__employee2Egender29->ViewValue;
- $ViewAttrs =& $TKChucdanh->Count28tbl__employee2Egender29->ViewAttrs;
- $CellAttrs =& $TKChucdanh->Count28tbl__employee2Egender29->CellAttrs;
- $HrefValue =& $TKChucdanh->Count28tbl__employee2Egender29->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->Count28tbl__employee2Egender29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
-
- // Count(tbl__profile.joined_party_date)
- $CurrentValue = $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CurrentValue;
- $ViewValue =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->ViewValue;
- $ViewAttrs =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->ViewAttrs;
- $CellAttrs =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->CellAttrs;
- $HrefValue =& $TKChucdanh->Count28tbl__profile2Ejoined_party_date29->HrefValue;
- $TKChucdanh->Cell_Rendered($TKChucdanh->Count28tbl__profile2Ejoined_party_date29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue);
- }
-
- // Call Row_Rendered event
- $TKChucdanh->Row_Rendered();
- }
-
- function SetupExportOptionsExt() {
- global $ReportLanguage, $TKChucdanh;
- }
-
- // Clear selection stored in session
- function ClearSessionSelection($parm) {
- $_SESSION["sel_TKChucdanh_$parm"] = "";
- $_SESSION["rf_TKChucdanh_$parm"] = "";
- $_SESSION["rt_TKChucdanh_$parm"] = "";
- }
-
- // Load selection from session
- function LoadSelectionFromSession($parm) {
- global $TKChucdanh;
- $fld =& $TKChucdanh->fields($parm);
- $fld->SelectionList = @$_SESSION["sel_TKChucdanh_$parm"];
- $fld->RangeFrom = @$_SESSION["rf_TKChucdanh_$parm"];
- $fld->RangeTo = @$_SESSION["rt_TKChucdanh_$parm"];
- }
-
- // Load default value for filters
- function LoadDefaultFilters() {
- global $TKChucdanh;
-
- /**
- * Set up default values for non Text filters
- */
-
- /**
- * Set up default values for extended filters
- * function SetDefaultExtFilter(&$fld, $so1, $sv1, $sc, $so2, $sv2)
- * Parameters:
- * $fld - Field object
- * $so1 - Default search operator 1
- * $sv1 - Default ext filter value 1
- * $sc - Default search condition (if operator 2 is enabled)
- * $so2 - Default search operator 2 (if operator 2 is enabled)
- * $sv2 - Default ext filter value 2 (if operator 2 is enabled)
- */
-
- /**
- * Set up default values for popup filters
- */
-
- // Field name
- // $TKChucdanh->name->DefaultSelectionList = array("val1", "val2");
-
- $TKChucdanh->name->DefaultSelectionList = "";
- $TKChucdanh->name->SelectionList = $TKChucdanh->name->DefaultSelectionList;
- }
-
- // Check if filter applied
- function CheckFilter() {
- global $TKChucdanh;
-
- // Check name popup filter
- if (!ewrpt_MatchedArray($TKChucdanh->name->DefaultSelectionList, $TKChucdanh->name->SelectionList))
- return TRUE;
- return FALSE;
- }
-
- // Show list of filters
- function ShowFilterList() {
- global $TKChucdanh;
- global $ReportLanguage;
-
- // Initialize
- $sFilterList = "";
-
- // Field name
- $sExtWrk = "";
- $sWrk = "";
- if (is_array($TKChucdanh->name->SelectionList))
- $sWrk = ewrpt_JoinArray($TKChucdanh->name->SelectionList, ", ", EWRPT_DATATYPE_STRING);
- if ($sExtWrk <> "" || $sWrk <> "")
- $sFilterList .= $TKChucdanh->name->FldCaption() . "<br>";
- if ($sExtWrk <> "")
- $sFilterList .= " $sExtWrk<br>";
- if ($sWrk <> "")
- $sFilterList .= " $sWrk<br>";
-
- // Show Filters
- if ($sFilterList <> "")
- echo $ReportLanguage->Phrase("CurrentFilters") . "<br>$sFilterList";
- }
-
- // Return poup filter
- function GetPopupFilter() {
- global $TKChucdanh;
- $sWrk = "";
- if (is_ar