function Page_Main()
 {
     global $Report13;
     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 = 1;
     $nGrps = 6;
     $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);
     // Set up groups per page dynamically
     $this->SetUpDisplayGrps();
     $Report13->First_Name->SelectionList = "";
     $Report13->First_Name->DefaultSelectionList = "";
     $Report13->First_Name->ValueList = "";
     $Report13->Paper_Name->SelectionList = "";
     $Report13->Paper_Name->DefaultSelectionList = "";
     $Report13->Paper_Name->ValueList = "";
     // Load default filter values
     $this->LoadDefaultFilters();
     // 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();
     // Get sort
     $this->Sort = $this->GetSort();
     // Get total group count
     $sGrpSort = ewrpt_UpdateSortFields($Report13->SqlOrderByGroup(), $this->Sort, 2);
     // Get grouping field only
     $sSql = ewrpt_BuildReportSql($Report13->SqlSelectGroup(), $Report13->SqlWhere(), $Report13->SqlGroupBy(), $Report13->SqlHaving(), $Report13->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 ($Report13->ExportAll && $Report13->Export != "") {
         $this->DisplayGrps = $this->TotalGrps;
     } else {
         $this->SetUpStartGroup();
     }
     // Get current page groups
     $rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
     // Init detail recordset
     $rs = NULL;
 }
Example #2
0
function ewrpt_BuildReportSql($sSelect, $sWhere, $sGroupBy, $sHaving, $sOrderBy, $sFilter, $sSort)
{
    $sDbWhere = $sWhere;
    if ($sDbWhere != "") {
        $sDbWhere = "(" . $sDbWhere . ")";
    }
    if ($sFilter != "") {
        if ($sDbWhere != "") {
            $sDbWhere .= " AND ";
        }
        $sDbWhere .= "(" . $sFilter . ")";
    }
    $sDbOrderBy = ewrpt_UpdateSortFields($sOrderBy, $sSort, 1);
    $sSql = $sSelect;
    if ($sDbWhere != "") {
        $sSql .= " WHERE " . $sDbWhere;
    }
    if ($sGroupBy != "") {
        $sSql .= " GROUP BY " . $sGroupBy;
    }
    if ($sHaving != "") {
        $sSql .= " HAVING " . $sHaving;
    }
    if ($sDbOrderBy != "") {
        $sSql .= " ORDER BY " . $sDbOrderBy;
    }
    return $sSql;
}
 function Page_Main()
 {
     global $Crosstab1;
     global $rs;
     global $rsgrp;
     global $gsFormError;
     // Get sort
     $this->Sort = $this->GetSort();
     // Set up groups per page dynamically
     $this->SetUpDisplayGrps();
     // Popup values and selections
     // Set up popup filter
     $this->SetupPopup();
     // Extended filter
     $sExtendedFilter = "";
     // Load columns to array
     $this->GetColumns();
     // 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;
         }
     }
     // No filter
     $this->FilterApplied = FALSE;
     // Get total group count
     $sGrpSort = ewrpt_UpdateSortFields($Crosstab1->SqlOrderByGroup(), $this->Sort, 2);
     // Get grouping field only
     $sSql = ewrpt_BuildReportSql($Crosstab1->SqlSelectGroup(), $Crosstab1->SqlWhere(), $Crosstab1->SqlGroupBy(), "", $Crosstab1->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 ($Crosstab1->ExportAll && $Crosstab1->Export != "") {
         $this->DisplayGrps = $this->TotalGrps;
     } else {
         $this->SetUpStartGroup();
     }
     // Get total groups
     $rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
     // Init detail recordset
     $rs = NULL;
     // Set up column attributes
     $Crosstab1->Total_Marks->ViewAttrs["style"] = "";
     $Crosstab1->Total_Marks->CellAttrs["style"] = "vertical-align: top;";
 }