function Page_Main()
 {
     global $rs;
     global $rsgrp;
     global $Security;
     global $gsFormError;
     global $gbDrillDownInPanel;
     global $ReportBreadcrumb;
     global $ReportLanguage;
     // Set up groups per page dynamically
     $this->SetUpDisplayGrps();
     // Set up Breadcrumb
     if ($this->Export == "") {
         $this->SetupBreadcrumb();
     }
     // Get sort
     $this->Sort = $this->GetSort();
     // Popup values and selections
     $this->YEAR__dateCreated->SelectionList = "";
     $this->YEAR__dateCreated->DefaultSelectionList = "";
     $this->YEAR__dateCreated->ValueList = "";
     // Load custom filters
     $this->Page_FilterLoad();
     // Set up popup filter
     $this->SetupPopup();
     // Handle Ajax popup
     $this->ProcessAjaxPopup();
     // Restore filter list
     $this->RestoreFilterList();
     // Extended filter
     $sExtendedFilter = "";
     // Add year filter
     if ($this->YEAR__dateCreated->SelectionList != "") {
         if ($this->Filter != "") {
             $this->Filter .= " AND ";
         }
         $this->Filter .= "YEAR(`dateCreated`) = " . $this->YEAR__dateCreated->SelectionList;
     }
     // Load columns to array
     $this->GetColumns();
     // Build popup filter
     $sPopupFilter = $this->GetPopupFilter();
     //ewr_SetDebugMsg("popup filter: " . $sPopupFilter);
     ewr_AddFilter($this->Filter, $sPopupFilter);
     // Check if filter applied
     $this->FilterApplied = $this->CheckFilter();
     // Call Page Selecting event
     $this->Page_Selecting($this->Filter);
     $this->SearchOptions->GetItem("resetfilter")->Visible = $this->FilterApplied;
     // Get total group count
     $sGrpSort = ewr_UpdateSortFields($this->getSqlOrderByGroup(), $this->Sort, 2);
     // Get grouping field only
     $sSql = ewr_BuildReportSql($this->getSqlSelectGroup(), $this->getSqlWhere(), $this->getSqlGroupBy(), "", $this->getSqlOrderByGroup(), $this->Filter, $sGrpSort);
     $this->TotalGrps = $this->GetGrpCnt($sSql);
     if ($this->DisplayGrps <= 0 || $this->DrillDown) {
         // Display all groups
         $this->DisplayGrps = $this->TotalGrps;
     }
     $this->StartGrp = 1;
     // Show header
     $this->ShowHeader = $this->TotalGrps > 0;
     // Set up start position if not export all
     if ($this->ExportAll && $this->Export != "") {
         $this->DisplayGrps = $this->TotalGrps;
     } else {
         $this->SetUpStartGroup();
     }
     // Set no record found message
     if ($this->TotalGrps == 0) {
         if ($this->Filter == "0=101") {
             $this->setWarningMessage($ReportLanguage->Phrase("EnterSearchCriteria"));
         } else {
             $this->setWarningMessage($ReportLanguage->Phrase("NoRecord"));
         }
     }
     // Hide export options if export
     if ($this->Export != "") {
         $this->ExportOptions->HideAllOptions();
     }
     // Hide search/filter options if export/drilldown
     if ($this->Export != "" || $this->DrillDown) {
         $this->SearchOptions->HideAllOptions();
         $this->FilterOptions->HideAllOptions();
     }
     // Get total groups
     $rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
     // Init detail recordset
     $rs = NULL;
     // Set up column attributes
     $this->dateCreated->ViewAttrs["style"] = "";
     $this->dateCreated->CellAttrs["style"] = "vertical-align: top;";
     $this->SetupFieldCount();
 }
예제 #2
0
 function GetPopupFilter()
 {
     $sWrk = "";
     if ($this->DrillDown) {
         return "";
     }
     if (is_array($this->invid->SelectionList)) {
         $sFilter = ewr_FilterSQL($this->invid, "[invid]", EWR_DATATYPE_NUMBER);
         // Call Page Filtering event
         $this->Page_Filtering($this->invid, $sFilter, "popup");
         $this->invid->CurrentFilter = $sFilter;
         ewr_AddFilter($sWrk, $sFilter);
     }
     return $sWrk;
 }
예제 #3
0
 function GetPopupFilter()
 {
     $sWrk = "";
     if ($this->DrillDown) {
         return "";
     }
     if (!$this->ExtendedFilterExist($this->timeta)) {
         if (is_array($this->timeta->SelectionList)) {
             $sFilter = ewr_FilterSQL($this->timeta, "messages.timeta", EWR_DATATYPE_DATE);
             // Call Page Filtering event
             $this->Page_Filtering($this->timeta, $sFilter, "popup");
             $this->timeta->CurrentFilter = $sFilter;
             ewr_AddFilter($sWrk, $sFilter);
         }
     }
     return $sWrk;
 }
 function BuildExtendedFilter(&$fld, &$FilterClause, $Default = FALSE, $SaveFilter = FALSE)
 {
     $sWrk = ewr_GetExtendedFilter($fld, $Default);
     if (!$Default) {
         $this->Page_Filtering($fld, $sWrk, "extended", $fld->SearchOperator, $fld->SearchValue, $fld->SearchCondition, $fld->SearchOperator2, $fld->SearchValue2);
     }
     if ($sWrk != "") {
         ewr_AddFilter($FilterClause, $sWrk);
         if ($SaveFilter) {
             $fld->CurrentFilter = $sWrk;
         }
     }
 }
예제 #5
0
 function Page_Main()
 {
     global $ReportLanguage;
     $GLOBALS["Page"] =& $this;
     $post = ewr_StripSlashes($_POST);
     if (count($post) == 0) {
         die("Missing post data.");
     }
     //$sql = $qs->getValue("s");
     $sql = @$post["s"];
     $sql = ewr_Decrypt($sql);
     if ($sql == "") {
         die("Missing SQL.");
     }
     // Field delimiter
     $dlm = @$post["dlm"];
     $dlm = ewr_Decrypt($dlm);
     // Language object
     $ReportLanguage = new crLanguage();
     if (strpos($sql, "{filter}") > 0) {
         $filters = "";
         for ($i = 0; $i < 5; $i++) {
             // Get the filter values (for "IN")
             $filter = ewr_Decrypt(@$post["f" . $i]);
             if ($filter != "") {
                 $value = @$post["v" . $i];
                 if ($value == "") {
                     if ($i > 0) {
                         // Empty parent field
                         //continue; // Allow
                         ewr_AddFilter($filters, "1=0");
                     }
                     // Disallow
                     continue;
                 }
                 $arValue = explode(",", $value);
                 $fldtype = intval(@$post["t" . $i]);
                 $wrkfilter = "";
                 for ($j = 0, $cnt = count($arValue); $j < $cnt; $j++) {
                     if ($wrkfilter != "") {
                         $wrkfilter .= " OR ";
                     }
                     $val = $arValue[$j];
                     if ($val == EWR_NULL_VALUE) {
                         $wrkfilter .= str_replace(" = {filter_value}", " IS NULL", $filter);
                     } elseif ($val == EWR_NOT_NULL_VALUE) {
                         $wrkfilter .= str_replace(" = {filter_value}", " IS NOT NULL", $filter);
                     } elseif ($val == EWR_EMPTY_VALUE) {
                         $wrkfilter .= str_replace(" = {filter_value}", " = ''", $filter);
                     } else {
                         $wrkfilter .= str_replace("{filter_value}", ewr_QuotedValue($val, ewr_FieldDataType($fldtype)), $filter);
                     }
                 }
                 ewr_AddFilter($filters, $wrkfilter);
             }
         }
         $sql = str_replace("{filter}", $filters != "" ? $filters : "1=1", $sql);
     }
     // Get the query value (for "LIKE" or "=")
     $value = ewr_AdjustSql(@$_GET["q"]);
     // Get the query value from querystring
     if ($value == "") {
         $value = ewr_AdjustSql(@$post["q"]);
     }
     // Get the value from post
     if ($value != "") {
         $sql = preg_replace('/LIKE \'(%)?\\{query_value\\}%\'/', ewr_Like('\'$1{query_value}%\''), $sql);
         $sql = str_replace("{query_value}", $value, $sql);
     }
     // Replace {query_value_n}
     preg_match_all('/\\{query_value_(\\d+)\\}/', $sql, $out);
     $cnt = count($out[0]);
     for ($i = 0; $i < $cnt; $i++) {
         $j = $out[1][$i];
         $v = ewr_AdjustSql(@$post["q" . $j]);
         $sql = str_replace("{query_value_" . $j . "}", $v, $sql);
     }
     $ds = @$post["ds"];
     // Date search type
     $df = @$post["df"];
     // Date format
     $this->GetLookupValues($sql, $ds, $df, $dlm);
 }