Пример #1
0
 function Page_Main()
 {
     global $CustomView2;
     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 = 2;
     $nGrps = 1;
     $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, FALSE);
     // Set up groups per page dynamically
     $this->SetUpDisplayGrps();
     // 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;
         }
     }
     // No filter
     $this->FilterApplied = FALSE;
     // Get sort
     $this->Sort = $this->GetSort();
     // Get total count
     $sSql = ewrpt_BuildReportSql($CustomView2->SqlSelect(), $CustomView2->SqlWhere(), $CustomView2->SqlGroupBy(), $CustomView2->SqlHaving(), $CustomView2->SqlOrderBy(), $this->Filter, $this->Sort);
     $this->TotalGrps = $this->GetCnt($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 ($CustomView2->ExportAll && $CustomView2->Export != "") {
         $this->DisplayGrps = $this->TotalGrps;
     } else {
         $this->SetUpStartGroup();
     }
     // Get current page records
     $rs = $this->GetRs($sSql, $this->StartGrp, $this->DisplayGrps);
 }
Пример #2
0
 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;
 }
Пример #3
0
function &ewrpt_Init2DArray($len1, $len2, $value)
{
    return ewrpt_InitArray($len1, ewrpt_InitArray($len2, $value));
}
Пример #4
0
 function RenderRow()
 {
     global $conn, $Security;
     global $Crosstab1;
     // Set up summary values
     $colcnt = $this->ColCount;
     $Crosstab1->SummaryCellAttrs = ewrpt_InitArray($colcnt, NULL);
     $Crosstab1->SummaryViewAttrs = ewrpt_InitArray($colcnt, NULL);
     $Crosstab1->SummaryCurrentValue = ewrpt_InitArray($colcnt, NULL);
     $Crosstab1->SummaryViewValue = ewrpt_InitArray($colcnt, NULL);
     if ($Crosstab1->RowTotalType == EWRPT_ROWTOTAL_GRAND) {
         // Grand total
         // aggregate sql
         $sSql = ewrpt_BuildReportSql($this->SqlSelectAggWork, $Crosstab1->SqlWhere(), $Crosstab1->SqlGroupByAgg(), "", "", $this->Filter, "");
         $rsagg = $conn->Execute($sSql);
         if ($rsagg && !$rsagg->EOF) {
             $rsagg->MoveFirst();
         }
     }
     for ($i = 1; $i <= $this->ColCount; $i++) {
         if ($this->Col[$i]->Visible) {
             if ($Crosstab1->RowType == EWRPT_ROWTYPE_DETAIL) {
                 // Detail row
                 $thisval = $this->Val[$i];
             } elseif ($Crosstab1->RowTotalType == EWRPT_ROWTOTAL_GROUP) {
                 // Group total
                 $thisval = $this->Smry[$i][$Crosstab1->RowGroupLevel];
             } elseif ($Crosstab1->RowTotalType == EWRPT_ROWTOTAL_PAGE) {
                 // Page total
                 $thisval = $this->Smry[$i][0];
             } elseif ($Crosstab1->RowTotalType == EWRPT_ROWTOTAL_GRAND) {
                 // Grand total
                 $thisval = $rsagg && !$rsagg->EOF ? $rsagg->fields[$i + 0 - 1] : 0;
             }
             $Crosstab1->SummaryCurrentValue[$i - 1] = $thisval;
         }
     }
     if ($Crosstab1->RowTotalType == EWRPT_ROWTOTAL_GRAND) {
         // Grand total
         if ($rsagg) {
             $rsagg->Close();
         }
     }
     // Call Row_Rendering event
     $Crosstab1->Row_Rendering();
     /* --------------------
     		'  Render view codes
     		' --------------------- */
     if ($Crosstab1->RowType == EWRPT_ROWTYPE_TOTAL) {
         // Summary row
         // First Name
         $Crosstab1->First_Name->GroupViewValue = $Crosstab1->First_Name->GroupOldValue();
         $Crosstab1->First_Name->CellAttrs["class"] = $Crosstab1->RowGroupLevel == 1 ? "ewRptGrpSummary1" : "ewRptGrpField1";
         // Last Name
         $Crosstab1->Last_Name->GroupViewValue = $Crosstab1->Last_Name->GroupOldValue();
         $Crosstab1->Last_Name->CellAttrs["class"] = $Crosstab1->RowGroupLevel == 2 ? "ewRptGrpSummary2" : "ewRptGrpField2";
         // Set up summary values
         $scvcnt = count($Crosstab1->SummaryCurrentValue);
         for ($i = 0; $i < $scvcnt; $i++) {
             $Crosstab1->SummaryViewValue[$i] = $Crosstab1->SummaryCurrentValue[$i];
             $Crosstab1->SummaryViewAttrs[$i]["style"] = "";
             $Crosstab1->SummaryCellAttrs[$i]["style"] = "";
             $Crosstab1->SummaryCellAttrs[$i]["class"] = $Crosstab1->RowTotalType == EWRPT_ROWTOTAL_GROUP ? "ewRptGrpSummary" . $Crosstab1->RowGroupLevel : "";
         }
     } else {
         // First Name
         $Crosstab1->First_Name->GroupViewValue = $Crosstab1->First_Name->GroupValue();
         $Crosstab1->First_Name->CellAttrs["class"] = "ewRptGrpField1";
         if ($Crosstab1->First_Name->GroupValue() == $Crosstab1->First_Name->GroupOldValue() && !$this->ChkLvlBreak(1)) {
             $Crosstab1->First_Name->GroupViewValue = "&nbsp;";
         }
         // Last Name
         $Crosstab1->Last_Name->GroupViewValue = $Crosstab1->Last_Name->GroupValue();
         $Crosstab1->Last_Name->CellAttrs["class"] = "ewRptGrpField2";
         if ($Crosstab1->Last_Name->GroupValue() == $Crosstab1->Last_Name->GroupOldValue() && !$this->ChkLvlBreak(2)) {
             $Crosstab1->Last_Name->GroupViewValue = "&nbsp;";
         }
         // Set up summary values
         $scvcnt = count($Crosstab1->SummaryCurrentValue);
         for ($i = 0; $i < $scvcnt; $i++) {
             $Crosstab1->SummaryViewValue[$i] = $Crosstab1->SummaryCurrentValue[$i];
             $Crosstab1->SummaryViewAttrs[$i]["style"] = "";
             $Crosstab1->SummaryCellAttrs[$i]["style"] = "";
             $Crosstab1->SummaryCellAttrs[$i]["class"] = $this->RecCount % 2 != 1 ? "ewTableAltRow" : "ewTableRow";
         }
     }
     // First Name
     $Crosstab1->First_Name->HrefValue = "";
     // Last Name
     $Crosstab1->Last_Name->HrefValue = "";
     // Call Row_Rendered event
     $Crosstab1->Row_Rendered();
 }