/jf/PHPReportMaker/Templates/phprpt50.zip/Script/rpt-summary.php
PHP | 2035 lines | 1719 code | 154 blank | 162 comment | 119 complexity | d708bc1fd888b9956df307bf9e4b6eb3 MD5 | raw file
Possible License(s): LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <!--##session phpconfig##-->
- <!--##
- nSearchFlds = 0 ' number of search fields
-
- ' Group Fields variables
- Dim arrGrpFlds
- sGroupFldNames = SYSTEMFUNCTIONS.GroupByFieldNames ' List of Group Field Names
- If sGroupFldNames = "" Then
- nGrps = 0
- Else
- arrGrps = split(sGroupFldNames, vbCrLf)
- nGrps = UBound(arrGrps)+1 ' Number of Group Fields
- ' Group field array
- Redim arrGrpFlds(10,nGrps-1)
- For i = 0 to nGrps-1
- Set FIELD = TABLE.Fields(arrGrps(i))
- sFldVar = FIELD.FldVar
- ' Get first group field name and type
- If i = 0 Then
- sFirstGrpFldName = FIELD.FldName
- sFirstGrpFldParm = FIELD.FldParm
- sFirstGrpFldObj = sTblVar & "->" & sFirstGrpFldParm
- sFirstGrpFldSql = ew_FieldSqlName(FIELD)
- sFirstGrpFldGroupByType = FIELD.FldGroupByType
- sFirstGrpFldGroupByInterval = FIELD.FldGroupByInterval
- sFirstGrpDbGrpSql = ew_DbGrpSql(sFirstGrpFldGroupByType, sFirstGrpFldGroupByInterval)
- SetupFldVar()
- End If
- arrGrpFlds(0,i) = FIELD.FldName ' field name
- arrGrpFlds(1,i) = FIELD.FldVar ' field variable
- arrGrpFlds(2,i) = FIELD.FldCaption ' field caption
- If FIELD.FldType = 201 Or FIELD.FldType = 203 Then ' memo field
- arrGrpFlds(3,i) = False ' skip popup filter if memo field
- Else
- arrGrpFlds(3,i) = IsPopupFilter(FIELD) ' generate popup filter
- End If
- If IsPopupFilter(FIELD) Then nSearchFlds = nSearchFlds + 1
- arrGrpFlds(4,i) = FIELD.FldFilterName ' Popup filter name
- arrGrpFlds(5,i) = FIELD.FldType ' field type
- If FIELD.FldUseRange Then ' field use range
- arrGrpFlds(6,i) = "true"
- Else
- arrGrpFlds(6,i) = "false"
- End If
- arrGrpFlds(7,i) = FIELD.FldGroupByShowSummary ' show summary required
- arrGrpFlds(8,i) = FIELD.FldGroupByType ' field grouping type
- arrGrpFlds(9,i) = FIELD.FldGroupByInterval ' field grouping interval
- arrGrpFlds(10,i) = ew_DbGrpSql(FIELD.FldGroupByType, FIELD.FldGroupByInterval) ' field grouping sql
- Next
- End If
-
- ' Detail Fields variables
- Dim arrDtlFlds, arrSmry
- Redim arrDtlFlds(6,0)
- Redim arrSmry(3,1)
- arrSmry(0,0) = "Sum": arrSmry(1,0) = "Avg": arrSmry(2,0) = "Min": arrSmry(3,0) = "Max"
- arrSmry(0,1) = False: arrSmry(1,1) = False: arrSmry(2,1) = False: arrSmry(3,1) = False
- nDtls = 0
- For i = 1 to TABLE.Fields.Count
- Set FIELD = TABLE.Fields.Seq(i)
- If FIELD.FldList And FIELD.FldGroupBy <= 0 And FIELD.FldGenerate Then
- Redim Preserve arrDtlFlds(6,nDtls)
- Redim Preserve arrSmry(3,nDtls+2)
- arrDtlFlds(0,nDtls) = FIELD.FldName ' field name
- arrDtlFlds(1,nDtls) = FIELD.FldVar ' field variable
- arrDtlFlds(2,nDtls) = FIELD.FldCaption ' field caption
- If FIELD.FldType = 201 Or FIELD.FldType = 203 Then ' memo field
- arrDtlFlds(3,nDtls) = False ' skip popup filter if memo field
- Else
- arrDtlFlds(3,nDtls) = IsPopupFilter(FIELD) ' generate popup filter
- End If
- If IsPopupFilter(FIELD) Then nSearchFlds = nSearchFlds + 1
- arrDtlFlds(4,nDtls) = FIELD.FldFilterName ' Popup filter name
- arrDtlFlds(5,nDtls) = FIELD.FldType ' field type
- If FIELD.FldUseRange Then ' field use range
- arrDtlFlds(6,nDtls) = "true"
- Else
- arrDtlFlds(6,nDtls) = "false"
- End If
- arrSmry(0,nDtls+2) = FIELD.FldRptAggSum ' agg sum
- arrSmry(0,1) = arrSmry(0,1) Or arrSmry(0,nDtls+2)
- arrSmry(1,nDtls+2) = FIELD.FldRptAggAvg ' agg avg
- arrSmry(1,1) = arrSmry(1,1) Or arrSmry(1,nDtls+2)
- arrSmry(2,nDtls+2) = FIELD.FldRptAggMin ' agg min
- arrSmry(2,1) = arrSmry(2,1) Or arrSmry(2,nDtls+2)
- arrSmry(3,nDtls+2) = FIELD.FldRptAggMax ' agg max
- arrSmry(3,1) = arrSmry(3,1) Or arrSmry(3,nDtls+2)
- nDtls = nDtls + 1
- End If
- Next
-
- bHasSummaryFields = (arrSmry(0,1) Or arrSmry(1,1) Or arrSmry(2,1) Or arrSmry(3,1))
- bShowDetails = TABLE.TblRptShowDetails
- If nGrps <= 0 And Not (bHasSummaryFields And (TABLE.TblRptShowPageTotal Or TABLE.TblRptShowGrandTotal)) Then bShowDetails = True
- If Not bShowDetails And bHasSummaryFields Then
- bShowSummaryView = TABLE.TblRptShowSummaryView ' Use summary view
- Else
- bShowSummaryView = False
- End If
-
- ' Remove grouping fields without show summary
- If bShowSummaryView Then
- Dim nGrps2, arrGrpFlds2
- nGrps2 = nGrps
- arrGrpFlds2 = arrGrpFlds
- For i = nGrps2-1 to 0 Step -1
- If Not arrGrpFlds(7,i) Then ' Show summary not enabled for last group
- If i = nGrps-1 Then
- nGrps = nGrps - 1
- Else
- nGrps = 0 ' Incorrect setting, show detail/summary instead
- End If
- If nGrps > 0 Then
- ReDim Preserve arrGrpFlds(UBound(arrGrpFlds,1),nGrps-1)
- Else
- arrGrpFlds = arrGrpFlds2
- nGrps = nGrps2
- bShowDetails = True
- bShowSummaryView = False
- Exit For
- End If
- End If
- Next
- End If
-
- ' Calculate slot size
- If bShowSummaryView Then
- nSlots = nGrps
- For i = 2 to UBound(arrSmry,2)
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,i) Then nSlots = nSlots + 1
- Next
- Next
- Else
- nSlots = nGrps + nDtls
- End If
-
- bShowYearSelection = False ' Crosstab only
- ##-->
- <!--##/session##-->
-
-
- <?php
- <!--##session phpmain##-->
-
- // 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 = <!--##=iGrpPerPage##-->; // 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 $<!--##=sTblVar##-->;
- global $rs;
- global $rsgrp;
- <!--## If bTableHasUserIDFld Then ##-->
- global $Security;
- <!--## End If ##-->
- global $gsFormError;
-
- <!--## If bTableHasUserIDFld Then ##-->
- // Set up User ID
- $this->UserIDFilter = $<!--##=sTblVar##-->->GetUserIDFilter();
- $this->Filter = $this->UserIDFilter;
- <!--## End If ##-->
-
- // Aggregate variables
- // 1st dimension = no of groups (level 0 used for grand total)
- // 2nd dimension = no of fields
- $nDtls = <!--##=nDtls+1##-->;
- $nGrps = <!--##=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
- <!--##
- accum = "FALSE" ' first column not used
- For i = 0 to nDtls-1
- If arrSmry(0,i+2) Or arrSmry(1,i+2) Or _
- arrSmry(2,i+2) Or arrSmry(3,i+2) Then
- accum = accum & ", TRUE"
- Else
- accum = accum & ", FALSE"
- End If
- Next
- ##-->
- $this->Col = array(<!--##=accum##-->);
-
- <!--## If sGrpPerPageList <> "" Then ##-->
- // Set up groups per page dynamically
- $this->SetUpDisplayGrps();
- <!--## End If ##-->
-
- <!--## If nGrps > 0 Then ##-->
- <!--##
- ' Group popup & selection values
- For i = 0 to nGrps-1
- bGenFilter = arrGrpFlds(3,i)
- If bGenFilter Then
- sFldVar = arrGrpFlds(1,i)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->SelectionList = "";
- $<!--##=sFldObj##-->->DefaultSelectionList = "";
- $<!--##=sFldObj##-->->ValueList = "";
- <!--##
- End If
- Next
- ##-->
- <!--## End If ##-->
-
- <!--##
- ' Detail popup & selection values
- For i = 0 to nDtls-1
- bGenFilter = arrDtlFlds(3,i)
- If bGenFilter Then
- sFldVar = arrDtlFlds(1,i)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->SelectionList = "";
- $<!--##=sFldObj##-->->DefaultSelectionList = "";
- $<!--##=sFldObj##-->->ValueList = "";
- <!--##
- End If
- Next
- ##-->
-
- <!--## If bReportExtFilter Or nSearchFlds > 0 Then ##-->
- // Load default filter values
- $this->LoadDefaultFilters();
- <!--## End If ##-->
-
- <!--## If SYSTEMFUNCTIONS.ServerScriptExist("Table","Filters_Load") Then ##-->
- // Load custom filters
- $<!--##=sTblVar##-->->Filters_Load();
- <!--## End If ##-->
-
- // Set up popup filter
- $this->SetupPopup();
-
- // Extended filter
- $sExtendedFilter = "";
-
- <!--## If bReportExtFilter Then ##-->
- // Get dropdown values
- $this->GetExtendedFilterValues();
-
- // Build extended filter
- $sExtendedFilter = $this->GetExtendedFilter();
- if ($sExtendedFilter <> "") {
- if ($this->Filter <> "")
- $this->Filter = "($this->Filter) AND ($sExtendedFilter)";
- else
- $this->Filter = $sExtendedFilter;
- }
- <!--## End If ##-->
-
- // 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;
- }
-
- <!--## If bReportExtFilter Or nSearchFlds > 0 Then ##-->
- // Check if filter applied
- $this->FilterApplied = $this->CheckFilter();
- <!--## Else ##-->
- // No filter
- $this->FilterApplied = FALSE;
- <!--## End If ##-->
-
- <!--## If TABLE.TblShowBlankListPage Then ##-->
- // Requires search criteria
- if ($this->Filter == $this->UserIDFilter || $gsFormError != "")
- $this->Filter = "0=101";
- <!--## End If ##-->
-
- $this->ExportOptions->GetItem("resetfilter")->Visible = $this->FilterApplied;
-
- // Get sort
- $this->Sort = $this->GetSort();
-
- <!--## If nGrps > 0 Then ##-->
- // Get total group count
- $sGrpSort = ewrpt_UpdateSortFields($<!--##=sTblVar##-->->SqlOrderByGroup(), $this->Sort, 2); // Get grouping field only
- $sSql = ewrpt_BuildReportSql($<!--##=sTblVar##-->->SqlSelectGroup(), $<!--##=sTblVar##-->->SqlWhere(), $<!--##=sTblVar##-->->SqlGroupBy(), $<!--##=sTblVar##-->->SqlHaving(), $<!--##=sTblVar##-->->SqlOrderByGroup(), $this->Filter, $sGrpSort);
- $this->TotalGrps = $this->GetGrpCnt($sSql);
- <!--## Else ##-->
- // Get total count
- $sSql = ewrpt_BuildReportSql($<!--##=sTblVar##-->->SqlSelect(), $<!--##=sTblVar##-->->SqlWhere(), $<!--##=sTblVar##-->->SqlGroupBy(), $<!--##=sTblVar##-->->SqlHaving(), $<!--##=sTblVar##-->->SqlOrderBy(), $this->Filter, $this->Sort);
- $this->TotalGrps = $this->GetCnt($sSql);
- <!--## End If ##-->
-
- 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 ($<!--##=sTblVar##-->->ExportAll && $<!--##=sTblVar##-->->Export <> "")
- $this->DisplayGrps = $this->TotalGrps;
- else
- $this->SetUpStartGroup();
-
- // Hide all options if export
- if ($<!--##=sTblVar##-->->Export <> "") {
- $this->ExportOptions->HideAllOptions();
- }
-
- <!--## If nGrps > 0 Then ##-->
- // Get current page groups
- $rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
-
- // Init detail recordset
- $rs = NULL;
- <!--## Else ##-->
- // Get current page records
- $rs = $this->GetRs($sSql, $this->StartGrp, $this->DisplayGrps);
- <!--## End If ##-->
-
- }
-
- <!--##/session##-->
- ?>
-
-
- <!--##session report_content##-->
- <!--##=sChartExpStart##-->
- <!--##include rpt-chartcommon-ext.php/chart_js_ext##-->
- <!--##=sChartExpEnd##-->
- <!--##=sExpStart##-->
- <div id="ewrpt_PopupFilter"><div class="bd"></div></div>
- <script src="<!--##=ew_FolderPath("_js")##-->/ewrptpop.js" type="text/javascript"></script>
- <script type="text/javascript">
- // popup fields
- <!--##
- For i = 0 to nGrps-1
- bGenFilter = arrGrpFlds(3,i)
- If bGenFilter Then
- sFldVar = arrGrpFlds(1,i)
- SetupFldVar()
- If arrGrpFlds(8,i) <> "" And arrGrpFlds(8,i) <> "n" Then ' grouping required
- ##-->
- <?php $jsdata = ewrpt_GetJsData($<!--##=sFldObj##-->, EWRPT_DATATYPE_NONE); ?>
- <!--##
- Else
- ##-->
- <?php $jsdata = ewrpt_GetJsData($<!--##=sFldObj##-->, $<!--##=sFldObj##-->->FldType); ?>
- <!--##
- End If
- ##-->
- ewrpt_CreatePopup("<!--##=sSessionFldVar##-->", [<?php echo $jsdata ?>]);
- <!--##
- End If
- Next
-
- For i = 0 to nDtls-1
- bGenFilter = arrDtlFlds(3,i)
- If bGenFilter Then
- sFldVar = arrDtlFlds(1,i)
- SetupFldVar()
- ##-->
- <?php $jsdata = ewrpt_GetJsData($<!--##=sFldObj##-->, $<!--##=sFldObj##-->->FldType); ?>
- ewrpt_CreatePopup("<!--##=sSessionFldVar##-->", [<?php echo $jsdata ?>]);
- <!--##
- End If
- Next
- ##-->
- </script>
- <!--##=sExpEnd##-->
-
- <!--##=sChartExpStart##-->
- <!-- 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>
- <!--##=sChartExpEnd##-->
-
- <p class="phpreportmaker ewTitle"><?php echo $<!--##=sTblVar##-->->TableCaption() ?>
- <?php $<!--##=sPageObj##-->->ExportOptions->Render("body"); ?></p>
-
- <!--##include rpt-phpcommon.php/header-message##-->
- <!--##include rpt-phpcommon.php/common-message##-->
-
- <!--## If Not bShowReport And Not bShowChart Then ##-->
- <p class="ewMessage"><!--##@NoReportOrCharts##--></p>
- <!--## End If ##-->
- <br /><br />
-
- <!--##=sChartExpStart##-->
- <!--##
- ' Generate charts (on top)
- For i = 1 to TABLE.Charts.Count
- Set CHART = TABLE.Charts.Seq(i)
- If IsShowChart(CHART) And CHART.ChartPosition = 1 Then
- sChartVar = CHART.ChartVar
- sChartId = sChartVar
- If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
- ##-->
- <a name="cht_<!--##=sChartId##-->"></a>
- <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
- <!--##include rpt-chartcommon.php/chart_common##-->
- <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
- <!--##include rpt-chartcommon.php/chart_config##-->
- <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
- <!--##include rpt-chartcommon.php/chart_content##-->
- <br /><br />
- <!--##
- End If
- Next
- ##-->
-
- </div></td></tr>
- <!-- Top Container (End) -->
- <tr>
-
- <!-- Left Container (Begin) -->
- <!--##
- CurCellPadding = ""
- If ew_ChartCount(2) > 0 Then CurCellPadding = " class=""ewPadding"""
- ##-->
- <td style="vertical-align: top;"<!--##=CurCellPadding##-->><div id="ewLeft" class="phpreportmaker">
- <!-- Left slot -->
-
- <!--##
- ' Generate charts (on left)
- For i = 1 to TABLE.Charts.Count
- Set CHART = TABLE.Charts.Seq(i)
- If IsShowChart(CHART) And CHART.ChartPosition = 2 Then
- sChartVar = CHART.ChartVar
- sChartId = sChartVar
- If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
- ##-->
- <a name="cht_<!--##=sChartId##-->"></a>
- <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
- <!--##include rpt-chartcommon.php/chart_common##-->
- <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
- <!--##include rpt-chartcommon.php/chart_config##-->
- <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
- <!--##include rpt-chartcommon.php/chart_content##-->
- <br /><br />
- <!--##
- End If
- Next
- ##-->
- </div></td>
- <!-- Left Container (End) -->
-
- <!-- Center Container - Report (Begin) -->
- <!--##
- CurCellPadding = ""
- If bShowReport Then CurCellPadding = " class=""ewPadding"""
- ##-->
- <td style="vertical-align: top;"<!--##=CurCellPadding##-->><div id="ewCenter" class="phpreportmaker">
- <!-- center slot -->
- <!--##=sChartExpEnd##-->
-
- <!--## If bShowReport Then ##-->
- <!-- summary report starts -->
- <!--##=sSkipPdfExpStart##-->
- <div id="report_summary">
-
- <!--##include rpt-extfilter.php/report_extfilter_html##-->
-
- <table class="ewGrid" cellspacing="0"><tr>
- <td class="ewGridContent">
- <!--##=sSkipPdfExpEnd##-->
-
- <!--## If bTopPageLink Then ##-->
- <!--##=sExpStart##-->
- <div class="ewGridUpperPanel">
- <!--##include rpt-pager.php/phppager##-->
- </div>
- <!--##=sExpEnd##-->
- <!--## End If ##-->
-
- <!-- Report Grid (Begin) -->
- <!--##=sSkipPdfExpStart##-->
- <div class="ewGridMiddlePanel">
- <!--##=sSkipPdfExpEnd##-->
-
- <table class="<?php echo $<!--##=sPageObj##-->->ReportTableClass ?>" cellspacing="0">
-
- <?php
- // Set the last group to display if not export all
- if ($<!--##=sTblVar##-->->ExportAll && $<!--##=sTblVar##-->->Export <> "") {
- $<!--##=sPageObj##-->->StopGrp = $<!--##=sPageObj##-->->TotalGrps;
- } else {
- $<!--##=sPageObj##-->->StopGrp = $<!--##=sPageObj##-->->StartGrp + $<!--##=sPageObj##-->->DisplayGrps - 1;
- }
-
- // Stop group <= total number of groups
- if (intval($<!--##=sPageObj##-->->StopGrp) > intval($<!--##=sPageObj##-->->TotalGrps))
- $<!--##=sPageObj##-->->StopGrp = $<!--##=sPageObj##-->->TotalGrps;
-
- $<!--##=sPageObj##-->->RecCount = 0;
-
- // Get first row
- if ($<!--##=sPageObj##-->->TotalGrps > 0) {
- <!--## If nGrps > 0 Then ##-->
- $<!--##=sPageObj##-->->GetGrpRow(1);
- <!--## Else ##-->
- $<!--##=sPageObj##-->->GetRow(1);
- <!--## End If ##-->
- $<!--##=sPageObj##-->->GrpCount = 1;
- }
-
- <!--## If nGrps > 0 Then ##-->
- while (($rsgrp && !$rsgrp->EOF && $<!--##=sPageObj##-->->GrpCount <= $<!--##=sPageObj##-->->DisplayGrps) || $<!--##=sPageObj##-->->ShowFirstHeader) {
- <!--## Else ##-->
- while (($rs && !$rs->EOF && $<!--##=sPageObj##-->->GrpCount <= $<!--##=sPageObj##-->->DisplayGrps) || $<!--##=sPageObj##-->->ShowFirstHeader) {
- <!--## End If ##-->
-
- // Show header
- if ($<!--##=sPageObj##-->->ShowFirstHeader) {
- ?>
- <thead>
- <tr>
- <!--##
- For i = 0 to nGrps-1
- lvl = i + 1
- sFldName = arrGrpFlds(0,i)
- sFldVar = arrGrpFlds(1,i)
- SetupFldVar()
- bGenFilter = arrGrpFlds(3,i)
- sUseRange = arrGrpFlds(6,i)
- Set FIELD = TABLE.Fields(sFldName)
- sTDStyle = FieldTD_Header(FIELD)
- sJsSort = " class=""ewPointer"" onmousedown=""ewrpt_Sort(event,'<?php echo $" & sTblVar & "->SortUrl($"& sFldObj & ") ?>'," & iSortType & ");"""
- ##-->
- <td class="ewTableHeader">
- <?php if ($<!--##=sTblVar##-->->Export <> "") { ?>
- <?php echo $<!--##=sFldObj##-->->FldCaption() ?>
- <?php } else { ?>
- <table cellspacing="0" class="ewTableHeaderBtn"<!--##=sTDStyle##-->><tr>
- <?php if ($<!--##=sTblVar##-->->SortUrl($<!--##=sFldObj##-->) == "") { ?>
- <td style="vertical-align: bottom;"><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td>
- <?php } else { ?>
- <td<!--##=sJsSort##-->><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td><td style="width: 10px;">
- <?php if ($<!--##=sFldObj##-->->getSort() == "ASC") { ?><img src="<!--##=ew_FolderPath("_images")##-->/sortup.gif" width="10" height="9" border="0"><?php } elseif ($<!--##=sFldObj##-->->getSort() == "DESC") { ?><img src="<!--##=ew_FolderPath("_images")##-->/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
- <?php } ?>
- <!--## If bGenFilter Then ##-->
- <td style="width: 20px;" align="right"><a href="#" onclick="ewrpt_ShowPopup(this.name, '<!--##=sSessionFldVar##-->', <!--##=sUseRange##-->, '<?php echo $<!--##=sFldObj##-->->RangeFrom; ?>', '<?php echo $<!--##=sFldObj##-->->RangeTo; ?>');return false;" name="<!--##=sFldVar##--><?php echo $<!--##=sPageObj##-->->Cnt[0][0]; ?>" id="<!--##=sFldVar##--><?php echo $<!--##=sPageObj##-->->Cnt[0][0]; ?>"><img src="<!--##=ew_FolderPath("_images")##-->/popup.gif" width="15" height="14" border="0" alt="<!--##@Filter##-->"></a></td>
- <!--## End If ##-->
- </tr></table>
- <?php } ?>
- </td>
- <!--##
- Next
- ##-->
-
- <!--## If bShowSummaryView Then ' Summary view ##-->
-
- <!--##
- For i = 2 to UBound(arrSmry,2)
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,i) Then
- sSrcFldName = arrDtlFlds(0,i-2)
- sSrcFldVar = arrDtlFlds(1,i-2)
- sSrcFldParm = Mid(sSrcFldVar,3)
- sSrcFldObj = sTblVar & "->" & sSrcFldParm
- sSummaryType = arrSmry(j,0)
- ##-->
- <td class="ewTableHeader"><?php echo $<!--##=sSrcFldObj##-->->FldCaption() ?> (<!--##=SummaryCaption(sSummaryType)##-->)</td>
- <!--##
- End If
- Next
- Next
- ##-->
-
- <!--## Else ' Detail view ##-->
-
- <!--##
- For i = 0 to nDtls-1
- sFldName = arrDtlFlds(0,i)
- sFldVar = arrDtlFlds(1,i)
- SetupFldVar()
- bGenFilter = arrDtlFlds(3,i)
- sUseRange = arrDtlFlds(6,i)
- Set FIELD = TABLE.Fields(sFldName)
- sTDStyle = FieldTD_Header(FIELD)
- sJsSort = " class=""ewPointer"" onmousedown=""ewrpt_Sort(event,'<?php echo $" & sTblVar & "->SortUrl($"& sFldObj & ") ?>'," & iSortType & ");"""
- ##-->
- <td class="ewTableHeader">
- <?php if ($<!--##=sTblVar##-->->Export <> "") { ?>
- <?php echo $<!--##=sFldObj##-->->FldCaption() ?>
- <?php } else { ?>
- <table cellspacing="0" class="ewTableHeaderBtn"<!--##=sTDStyle##-->><tr>
- <?php if ($<!--##=sTblVar##-->->SortUrl($<!--##=sFldObj##-->) == "") { ?>
- <td style="vertical-align: bottom;"><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td>
- <?php } else { ?>
- <td<!--##=sJsSort##-->><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td><td style="width: 10px;">
- <?php if ($<!--##=sFldObj##-->->getSort() == "ASC") { ?><img src="<!--##=ew_FolderPath("_images")##-->/sortup.gif" width="10" height="9" border="0"><?php } elseif ($<!--##=sFldObj##-->->getSort() == "DESC") { ?><img src="<!--##=ew_FolderPath("_images")##-->/sortdown.gif" width="10" height="9" border="0"><?php } ?></td>
- <?php } ?>
- <!--## If bGenFilter Then ##-->
- <td style="width: 20px;" align="right"><a href="#" onclick="ewrpt_ShowPopup(this.name, '<!--##=sSessionFldVar##-->', <!--##=sUseRange##-->, '<?php echo $<!--##=sFldObj##-->->RangeFrom; ?>', '<?php echo $<!--##=sFldObj##-->->RangeTo; ?>');return false;" name="<!--##=sFldVar##--><?php echo $<!--##=sPageObj##-->->Cnt[0][0]; ?>" id="<!--##=sFldVar##--><?php echo $<!--##=sPageObj##-->->Cnt[0][0]; ?>"><img src="<!--##=ew_FolderPath("_images")##-->/popup.gif" width="15" height="14" border="0" alt="<!--##@Filter##-->"></a></td>
- <!--## End If ##-->
- </tr></table>
- <?php } ?>
- </td>
- <!--##
- Next
- ##-->
-
- <!--## End If ' End Summary/Detail View ##-->
-
- </tr>
- </thead>
- <tbody>
- <?php
- $<!--##=sPageObj##-->->ShowFirstHeader = FALSE;
- }
-
- <!--## If nGrps = 0 Then ##-->
- $<!--##=sPageObj##-->->RecCount++;
- <!--## Else ##-->
- // Build detail SQL
- $sWhere = ewrpt_DetailFilterSQL($<!--##=sFirstGrpFldObj##-->, $<!--##=sTblVar##-->->SqlFirstGroupField(), $<!--##=sFirstGrpFldObj##-->->GroupValue());
- if ($<!--##=sPageObj##-->->Filter != "")
- $sWhere = "($<!--##=sPageObj##-->->Filter) AND ($sWhere)";
- $sSql = ewrpt_BuildReportSql($<!--##=sTblVar##-->->SqlSelect(), $<!--##=sTblVar##-->->SqlWhere(), $<!--##=sTblVar##-->->SqlGroupBy(), $<!--##=sTblVar##-->->SqlHaving(), $<!--##=sTblVar##-->->SqlOrderBy(), $sWhere, $<!--##=sPageObj##-->->Sort);
- $rs = $conn->Execute($sSql);
- $rsdtlcnt = ($rs) ? $rs->RecordCount() : 0;
- if ($rsdtlcnt > 0)
- $<!--##=sPageObj##-->->GetRow(1);
- while ($rs && !$rs->EOF) { // Loop detail records
- $<!--##=sPageObj##-->->RecCount++;
- <!--## End If ##-->
-
- // Render detail row
- $<!--##=sTblVar##-->->ResetCSS();
- $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_DETAIL;
- $<!--##=sPageObj##-->->RenderRow();
- ?>
-
- <!--## If bShowDetails Then ' Show details ##-->
-
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- For i = 0 to nGrps-1
- lvl = i + 1
- sFldName = arrGrpFlds(0,i)
- sFldVar = arrGrpFlds(1,i)
- SetupFldVar()
- Set FIELD = TABLE.Fields(sFldName)
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes(); ?>><!--##=SYSTEMFUNCTIONS.FieldGroupView##--></td>
- <!--##
- Next
-
- For i = 0 to nDtls-1
- sFldName = arrDtlFlds(0,i)
- sFldVar = arrDtlFlds(1,i)
- SetupFldVar()
- Set FIELD = TABLE.Fields(sFldName)
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldView##--></td>
- <!--##
- Next
- ##-->
- </tr>
-
- <!--## End If ' End show detail ##-->
-
- <?php
- // Accumulate page summary
- $<!--##=sPageObj##-->->AccumulateSummary();
-
- // Get next record
- $<!--##=sPageObj##-->->GetRow(2);
-
- <!--## If nGrps <= 0 Then ##-->
- $<!--##=sPageObj##-->->GrpCount++;
- <!--## Else ##-->
- // Show Footers
- ?>
- <!--##
- For i = nGrps-1 to 0 Step -1
- lvl = i + 1
- If lvl = 1 Then
- ##-->
- <?php
- } // End detail records loop
- ?>
- <!--##
- End If
- If arrGrpFlds(7,i) Then ' show summary required
- Set FIELD = TABLE.Fields(arrGrpFlds(0,i))
- sFldVar = arrGrpFlds(1,i)
- SetupFldVar()
- sSummary = "ewrpt_DisplayGroupValue($" & sFldObj & ", $" & sFldObj & "->GroupValue())"
- ##-->
- <?php
- <!--## If lvl > 1 Then ##-->
- if ($<!--##=sPageObj##-->->ChkLvlBreak(<!--##=lvl##-->)) {
- <!--## End If ##-->
- ?>
-
- <!--## If bShowSummaryView Then ' Summary view ##-->
-
- <?php
- <!--##
- For x = 2 to UBound(arrSmry,2)
- k = x-1
- sFldName = arrDtlFlds(0,k-1)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[<!--##=lvl##-->][<!--##=k##-->];
- <!--##
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,x) Then
- ##-->
- <!--## If j = 0 Then ' SUM ##-->
- $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]; // Load SUM
- <!--## ElseIf j = 1 Then ' AVG ##-->
- $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
- <!--## ElseIf j = 2 Then ' MIN ##-->
- $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[<!--##=lvl##-->][<!--##=k##-->]; // Load MIN
- <!--## ElseIf j = 3 Then ' MAX ##-->
- $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[<!--##=lvl##-->][<!--##=k##-->]; // Load MAX
- <!--## End If ##-->
- <!--##
- End If
- Next
- Next
- ##-->
- $<!--##=sTblVar##-->->ResetCSS();
- $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
- $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GROUP;
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
- $<!--##=sTblVar##-->->RowGroupLevel = <!--##=lvl##-->;
- $<!--##=sPageObj##-->->RenderRow();
- ?>
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- sSmryGrpFldParm = Mid(arrGrpFlds(1,lvl-1),3)
- sSmryGrpFldObj = sTblVar & "->" & sSmryGrpFldParm
- For x = 0 to nGrps-1
- sFldName = arrGrpFlds(0,x)
- Set FIELD = TABLE.Fields(sFldName)
- sGrpFldParm = Mid(arrGrpFlds(1,x),3)
- sGrpFldObj = sTblVar & "->" & sGrpFldParm
- If x = lvl-1 Then
- ##-->
- <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldGroupView##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->Cnt[<!--##=lvl##-->][0],0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td>
- <!--##
- ElseIf x < lvl Then
- ##-->
- <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryGroupView##--></td>
- <!--##
- Else
- ##-->
- <td<?php echo $<!--##=sSmryGrpFldObj##-->->CellAttributes() ?>> </td>
- <!--##
- End If
- Next
-
- For x = 2 to UBound(arrSmry,2)
- sFldName = arrDtlFlds(0,x-2)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,x-2)
- SetupFldVar()
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,x) Then
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
- <!--##
- End If
- Next
- Next
- ##-->
- </tr>
-
- <!--## Else ' Detail view ##-->
-
- <?php
- $<!--##=sTblVar##-->->ResetCSS();
- $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
- $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GROUP;
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
- $<!--##=sTblVar##-->->RowGroupLevel = <!--##=lvl##-->;
- $<!--##=sPageObj##-->->RenderRow();
- ?>
-
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- For j = 0 to i-1
- sGrpFldParm = Mid(arrGrpFlds(1,j),3)
- sGrpFldObj = sTblVar & "->" & sGrpFldParm
- ##-->
- <!--## If bShowDetails Then ##-->
- <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>> </td>
- <!--## Else ##-->
- <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><?php echo $<!--##=sGrpFldObj##-->->GroupSummaryViewValue; ?></td>
- <!--## End If ##-->
- <!--##
- Next
- ##-->
- <td colspan="<!--##=nSlots-i##-->"<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##@RptSumHead##--> <?php echo $<!--##=sFldObj##-->->FldCaption() ?>: <?php echo $<!--##=sFldObj##-->->GroupViewValue; ?> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->Cnt[<!--##=lvl##-->][0],0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td></tr>
-
- <!--##
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,1) Then
- ##-->
- <?php
- $<!--##=sTblVar##-->->ResetCSS();
- <!--##
- For k = 1 to nDtls
- If arrSmry(j,k+1) Then
- sFldName = arrDtlFlds(0,k-1)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[<!--##=lvl##-->][<!--##=k##-->];
- <!--## If j = 0 Then ' SUM ##-->
- $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]; // Load SUM
- <!--## ElseIf j = 1 Then ' AVG ##-->
- $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0)? $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
- <!--## ElseIf j = 2 Then ' MIN ##-->
- $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[<!--##=lvl##-->][<!--##=k##-->]; // Load MIN
- <!--## ElseIf j = 3 Then ' MAX ##-->
- $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[<!--##=lvl##-->][<!--##=k##-->]; // Load MAX
- <!--## End If ##-->
- <!--##
- End If
- Next
- ##-->
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_<!--##=UCase(arrSmry(j,0))##-->;
- $<!--##=sPageObj##-->->RenderRow();
- ?>
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- For k = 0 to i-1
- sGrpFldParm = Mid(arrGrpFlds(1,k),3)
- sGrpFldObj = sTblVar & "->" & sGrpFldParm
- ##-->
- <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>> </td>
- <!--##
- Next
- sGrpFldParm = Mid(arrGrpFlds(1,i),3)
- sGrpFldObj = sTblVar & "->" & sGrpFldParm
- ##-->
- <td colspan="<!--##=nGrps-i##-->"<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><!--##=SummaryCaption(arrSmry(j,0))##--></td>
- <!--##
- For k = 1 to nDtls
- sFldName = arrDtlFlds(0,k-1)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- If arrSmry(j,k+1) Then
- Set FIELD = TABLE.Fields(sFldName)
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
- <!--##
- Else
- ##-->
- <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>> </td>
- <!--##
- End If
- Next
- ##-->
- </tr>
-
- <!--##
- End If
- Next
- ##-->
-
- <!--## End If ' End Summary/Detail view ##-->
-
- <?php
- // Reset level <!--##=lvl##--> summary
- $<!--##=sPageObj##-->->ResetLevelSummary(<!--##=lvl##-->);
-
- <!--## If lvl > 1 Then ' v3 ##-->
- } // End check level check
- <!--## End If ' v3 ##-->
-
- ?>
- <!--##
- End If
- Next
- ##-->
- <?php
-
- <!--## If nGrps > 0 Then ##-->
- // Next group
- $<!--##=sPageObj##-->->GetGrpRow(2);
- $<!--##=sPageObj##-->->GrpCount++;
- <!--## End If ##-->
-
- <!--## End If ##-->
-
- } // End while
-
- ?>
- </tbody>
- <tfoot>
- <!--## If TABLE.TblRptShowPageTotal Then ##-->
- <?php if (intval(@$<!--##=sPageObj##-->->Cnt[0][<!--##=nDtls##-->]) > 0) { ?>
- <?php
- $<!--##=sTblVar##-->->ResetCSS();
- $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
- $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_PAGE;
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
- $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptPageSummary";
- $<!--##=sPageObj##-->->RenderRow();
- ?>
-
- <!--## If bShowSummaryView Then ' Summary view ##-->
-
- <?php
- <!--##
- For i = 2 to UBound(arrSmry,2)
- k = i-1
- sFldName = arrDtlFlds(0,k-1)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[0][<!--##=k##-->];
- <!--##
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,i) Then
- ##-->
- <!--## If j = 0 Then ' SUM ##-->
- $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]; // Load SUM
- <!--## ElseIf j = 1 Then ' AVG ##-->
- $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
- <!--## ElseIf j = 2 Then ' MIN ##-->
- $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[0][<!--##=k##-->]; // Load MIN
- <!--## ElseIf j = 3 Then ' MAX ##-->
- $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[0][<!--##=k##-->]; // Load MAX
- <!--## End If ##-->
- <!--##
- End If
- Next
- Next
- ##-->
- $<!--##=sTblVar##-->->ResetCSS();
- $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
- $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_PAGE;
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
- $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptPageSummary";
- $<!--##=sPageObj##-->->RenderRow();
- ?>
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- For i = 0 to nGrps-1
- If i = 0 Then
- ##-->
- <td><!--##@RptPageTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->Cnt[0][<!--##=nDtls##-->],0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td>
- <!--##
- Else
- ##-->
- <td> </td>
- <!--##
- End If
- Next
-
- For i = 2 to UBound(arrSmry,2)
- sFldName = arrDtlFlds(0,i-2)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,i-2)
- SetupFldVar()
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,i) Then
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
- <!--##
- End If
- Next
- Next
- ##-->
- </tr>
-
- <!--## Else ' Detail view ##-->
-
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>><td colspan="<!--##=nSlots##-->"><!--##@RptPageTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->Cnt[0][<!--##=nDtls##-->],0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td></tr>
-
- <!--##
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,1) Then
- ##-->
- <?php
- $<!--##=sTblVar##-->->ResetCSS();
- <!--##
- For k = 1 to nDtls
- If arrSmry(j,k+1) Then
- sFldName = arrDtlFlds(0,k-1)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[0][<!--##=k##-->];
- <!--## If j = 0 Then ' SUM ##-->
- $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]; // Load SUM
- <!--## ElseIf j = 1 Then ' AVG ##-->
- $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
- <!--## ElseIf j = 2 Then ' MIN ##-->
- $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[0][<!--##=k##-->]; // Load MIN
- <!--## ElseIf j = 3 Then ' MAX ##-->
- $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[0][<!--##=k##-->]; // Load MAX
- <!--## End If ##-->
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_<!--##=UCase(arrSmry(j,0))##-->;
- <!--##
- End If
- Next
- ##-->
- $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptPageSummary";
- $<!--##=sPageObj##-->->RenderRow();
- ?>
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- If nGrps > 0 Then
- ##-->
- <td colspan="<!--##=nGrps##-->" class="ewRptGrpAggregate"><!--##=SummaryCaption(arrSmry(j,0))##--></td>
- <!--##
- End If
- ##-->
-
- <!--##
- For k = 1 to nDtls
- sFldName = arrDtlFlds(0,k-1)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- If arrSmry(j,k+1) Then
- Set FIELD = TABLE.Fields(sFldName)
- If nGrps = 0 Then
- sSmryCaption = SummaryCaption(arrSmry(j,0))
- Else
- sSmryCaption = ""
- End If
- If sSmryCaption <> "" Then sSmryCaption = sSmryCaption & "<?php echo $ReportLanguage->Phrase(""RptSeparator""); ?>"
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=sSmryCaption##--><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
- <!--##
- Else
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>> </td>
- <!--##
- End If
- Next
- ##-->
- </tr>
- <!--##
- End If
- Next
- ##-->
-
- <!--## End If ' End Summary/Detail view ##-->
-
- <!-- tr class="ewRptPageSummary"><td colspan="<!--##=nSlots##-->"><span class="phpreportmaker"> <br /></span></td></tr -->
- <?php } ?>
- <!--## End If ##-->
- <!--## If TABLE.TblRptShowGrandTotal Then ##-->
- <?php
- if ($<!--##=sPageObj##-->->TotalGrps > 0) {
- $<!--##=sTblVar##-->->ResetCSS();
- $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
- $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GRAND;
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
- $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptGrandSummary";
- $<!--##=sPageObj##-->->RenderRow();
- ?>
-
- <!-- tr><td colspan="<!--##=nSlots##-->"><span class="phpreportmaker"> <br /></span></td></tr -->
-
- <!--## If bShowSummaryView Then ' Summary view ##-->
-
- <?php
- <!--##
- For i = 2 to UBound(arrSmry,2)
- k = i-1
- sFldName = arrDtlFlds(0,k-1)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->TotCount;
- <!--##
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,i) Then
- ##-->
- <!--## If j = 0 Then ' SUM ##-->
- $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]; // Load SUM
- <!--## ElseIf j = 1 Then ' AVG ##-->
- $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
- <!--## ElseIf j = 2 Then ' MIN ##-->
- $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->GrandMn[<!--##=k##-->]; // Load MIN
- <!--## ElseIf j = 3 Then ' MAX ##-->
- $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->GrandMx[<!--##=k##-->]; // Load MAX
- <!--## End If ##-->
- <!--##
- End If
- Next
- Next
- ##-->
- $<!--##=sTblVar##-->->ResetCSS();
- $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
- $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GRAND;
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
- $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptGrandSummary";
- $<!--##=sPageObj##-->->RenderRow();
- ?>
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- For i = 0 to nGrps-1
- If i = 0 Then
- ##-->
- <td><!--##@RptGrandTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->TotCount,0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td>
- <!--##
- Else
- ##-->
- <td> </td>
- <!--##
- End If
- Next
-
- For i = 2 to UBound(arrSmry,2)
- sFldName = arrDtlFlds(0,i-2)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,i-2)
- SetupFldVar()
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,i) Then
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
- <!--##
- End If
- Next
- Next
- ##-->
- </tr>
-
- <!--## Else ' Detail view ##-->
-
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>><td colspan="<!--##=nSlots##-->"><!--##@RptGrandTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->TotCount,0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td></tr>
-
- <!--##
- For j = 0 to UBound(arrSmry,1)
- If arrSmry(j,1) Then
- ##-->
- <?php
- $<!--##=sTblVar##-->->ResetCSS();
- <!--##
- For k = 1 to nDtls
- If arrSmry(j,k+1) Then
- sFldName = arrDtlFlds(0,k-1)
- Set FIELD = TABLE.Fields(sFldName)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- ##-->
- $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->TotCount;
- <!--## If j = 0 Then ' SUM ##-->
- $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]; // Load SUM
- <!--## ElseIf j = 1 Then ' AVG ##-->
- $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
- <!--## ElseIf j = 2 Then ' MIN ##-->
- $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->GrandMn[<!--##=k##-->]; // Load MIN
- <!--## ElseIf j = 3 Then ' MAX ##-->
- $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->GrandMx[<!--##=k##-->]; // Load MAX
- <!--## End If ##-->
- $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_<!--##=UCase(arrSmry(j,0))##-->;
- <!--##
- End If
- Next
- ##-->
- $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptGrandSummary";
- $<!--##=sPageObj##-->->RenderRow();
- ?>
- <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
- <!--##
- If nGrps > 0 Then
- ##-->
- <td colspan="<!--##=nGrps##-->" class="ewRptGrpAggregate"><!--##=SummaryCaption(arrSmry(j,0))##--></td>
- <!--##
- End If
- ##-->
- <!--##
- For k = 1 to nDtls
- sFldName = arrDtlFlds(0,k-1)
- sFldVar = arrDtlFlds(1,k-1)
- SetupFldVar()
- If arrSmry(j,k+1) Then
- Set FIELD = TABLE.Fields(sFldName)
- If nGrps = 0 Then
- sSmryCaption = SummaryCaption(arrSmry(j,0))
- Else
- sSmryCaption = ""
- End If
- If sSmryCaption <> "" Then sSmryCaption = sSmryCaption & "<?php echo $ReportLanguage->Phrase(""RptSeparator""); ?>"
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=sSmryCaption##--><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
- <!--##
- Else
- ##-->
- <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>> </td>
- <!--##
- End If
- Next
- ##-->
- </tr>
- <!--##
- End If
- Next
- ##-->
-
- <!--## End If ' End Summary/Detail view ##-->
-
- <?php } ?>
- <!--## End If ##-->
- </tfoot>
- </table>
- <!--##=sSkipPdfExpStart##-->
- </div>
- <!--##=sSkipPdfExpEnd##-->
-
- <!--## If bBottomPageLink Then ##-->
- <!--## If bTopPageLink Then ##-->
- <?php if ($<!--##=sPageObj##-->->TotalGrps > 0) { ?>
- <!--## End If ##-->
- <!--##=sExpStart##-->
- <div class="ewGridLowerPanel">
- <!--##include rpt-pager.php/phppager##-->
- </div>
- <!--##=sExpEnd##-->
- <!--## If bTopPageLink Then ##-->
- <?php } ?>
- <!--## End If ##-->
- <!--## End If ##-->
-
- <!--##=sSkipPdfExpStart##-->
- </td></tr></table>
- </div>
- <!--##=sSkipPdfExpEnd##-->
- <!-- Summary Report Ends -->
-
- <!--## End If ' End Show Report ##-->
-
- <!--##=sChartExpStart##-->
- </div><br /></td>
- <!-- Center Container - Report (End) -->
-
- <!-- Right Container (Begin) -->
- <!--##
- CurCellPadding = ""
- If ew_ChartCount(3) > 0 Then CurCellPadding = " class=""ewPadding"""
- ##-->
- <td style="vertical-align: top;"<!--##=CurCellPadding##-->><div id="ewRight" class="phpreportmaker">
- <!-- Right slot -->
- <!--##
- ' Generate charts (on right)
- For i = 1 to TABLE.Charts.Count
- Set CHART = TABLE.Charts.Seq(i)
- If IsShowChart(CHART) And CHART.ChartPosition = 3 Then
- sChartVar = CHART.ChartVar
- sChartId = sChartVar
- If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
- ##-->
- <a name="cht_<!--##=sChartId##-->"></a>
- <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
- <!--##include rpt-chartcommon.php/chart_common##-->
- <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
- <!--##include rpt-chartcommon.php/chart_config##-->
- <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
- <!--##include rpt-chartcommon.php/chart_content##-->
- <br /><br />
- <!--##
- End If
- Next
- ##-->
- </div></td>
- <!-- Right Container (End) -->
- </tr>
-
- <!-- Bottom Container (Begin) -->
- <!--##
- CurCellPadding = ""
- If ew_ChartCount(4) > 0 Then CurCellPadding = " class=""ewPadding"""
- ##-->
- <tr><td colspan="3"<!--##=CurCellPadding##-->><div id="ewBottom" class="phpreportmaker">
- <!-- Bottom slot -->
- <!--##
- ' Generate charts (on bottom)
- For i = 1 to TABLE.Charts.Count
- Set CHART = TABLE.Charts.Seq(i)
- If IsShowChart(CHART) And CHART.ChartPosition = 4 Then
- sChartVar = CHART.ChartVar
- sChartId = sChartVar
- If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
- ##-->
- <a name="cht_<!--##=sChartId##-->"></a>
- <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
- <!--##include rpt-chartcommon.php/chart_common##-->
- <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
- <!--##include rpt-chartcommon.php/chart_config##-->
- <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
- <!--##include rpt-chartcommon.php/chart_content##-->
- <!--##=sChartSkipEmailExpStart##-->
- <a href="#top"><!--##@Top##--></a>
- <!--##=sChartSkipEmailExpEnd##-->
- <br /><br />
- <!--##
- End If
- Next
- ##-->
- </div><br /></td></tr>
- <!-- Bottom Container (End) -->
-
- </table>
- <!-- Table Container (End) -->
- <!--##=sChartExpEnd##-->
-
- <!--##include rpt-phpcommon.php/footer-message##-->
- <?php
- // Close recordsets
- if ($rsgrp) $rsgrp->Close();
- if ($rs) $rs->Close();
- ?>
- <!--##/session##-->
-
-
- <?php
- <!--##session phpfunction##-->
-
- <!--## If nGrps > 0 Then ##-->
- // Check level break
- function ChkLvlBreak($lvl) {
- global $<!--##=sTblVar##-->;
- switch ($lvl) {
- <!--##
- For i = 0 to nGrps-1
- sFldVar = arrGrpFlds(1,i)
- SetupFldVar()
- If i > 0 Then
- sChk = " || $this->ChkLvlBreak(" & i & "); // Recurse upper level"
- Else
- sChk = ";"
- End If
- fld = "$" & sFldObj & "->CurrentValue"
- oldfld = "$" & sFldObj & "->OldValue"
- grpfld = "$" & sFldObj & "->GroupValue()"
- grpoldfld = "$" & sFldObj & "->GroupOldValue()"
- ##-->
- case <!--##=i+1##-->:
- return (is_null(<!--##=fld##-->) && !is_null(<!--##=oldfld##-->)) ||
- (!is_null(<!--##=fld##-->) && is_null(<!--##=oldfld##-->)) ||
- (<!--##=grpfld##--> <> <!--##=grpoldfld##-->)<!--##=sChk##-->
- <!--##
- Next
- ##-->
- }
- }
- <!--## End If ##-->
-
- // 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;
- }
- }
- }
- }
- }
-
- <!--## If nGrps > 0 Then ##-->
- // Get group count
- function GetGrpCnt($sql) {
- global $conn;
- global $<!--##=sTblVar##-->;
-
- $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 $<!--##=sTblVar##-->;
-
- $wrksql = $sql;
- <!--## If bDBMySql Or bDBPostgreSql Then ##-->
- if ($start > 0 && $grps > -1)
- <!--## If bDBMySql Then ##-->
- $wrksql .= " LIMIT " . ($start-1) . ", " . ($grps);
- <!--## ElseIf bDBPostgreSql Then ##-->
- $wrksql .= " LIMIT " . ($grps) . " OFFSET " . ($start-1);
- <!--## End If ##-->
- <!--## End If ##-->
-
- $rswrk = $conn->Execute($wrksql);
-
- <!--## If Not (bDBMySql Or bDBPostgreSql) Then ##-->
- if ($start > 1)
- $rswrk->Move($start - 1);
- <!--## End If ##-->
-
- return $rswrk;
- }
-
- // Get group row values
- function GetGrpRow($opt) {
- global $rsgrp;
- global $<!--##=sTblVar##-->;
-
- if (!$rsgrp)
- return;
-
- if ($opt == 1) { // Get first group
- //$rsgrp->MoveFirst(); // NOTE: no need to move position
- $<!--##=sFirstGrpFldObj##-->->setDbValue(""); // Init first value
- } else { // Get next group
- $rsgrp->MoveNext();
- }
-
- if (!$rsgrp->EOF)
- $<!--##=sFirstGrpFldObj##-->->setDbValue($rsgrp->fields[0]);
-
- if ($rsgrp->EOF) {
- $<!--##=sFirstGrpFldObj##-->->setDbValue("");
- }
-
- }
-
- <!--## Else ##-->
-
- // Get count
- function GetCnt($sql) {
- global $conn;
- $rscnt = $conn->Execute($sql);
- $cnt = ($rscnt) ? $rscnt->RecordCount() : 0;
- if ($rscnt) $rscnt->Close();
- return $cnt;
- }
-
- // Get rs
- function GetRs($sql, $start, $grps) {
- global $conn;
- $wrksql = $sql;
- <!--## If bDBMySql Or bDBPostgreSql Then ##-->
- if ($start > 0 && $grps > -1)
- <!--## If bDBMySql Then ##-->
- $wrksql .= " LIMIT " . ($start-1) . ", " . ($grps);
- <!--## ElseIf bDBPostgreSql Then ##-->
- $wrksql .= " LIMIT " . ($grps) . " OFFSET " . ($start-1);
…
Large files files are truncated, but you can click here to view the full file