PageRenderTime 57ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/jf/PHPReportMaker/Templates/phprpt50.zip/Script/rpt-summary.php

http://tinkerportal.googlecode.com/
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

  1. <!--##session phpconfig##-->
  2. <!--##
  3. nSearchFlds = 0 ' number of search fields
  4. ' Group Fields variables
  5. Dim arrGrpFlds
  6. sGroupFldNames = SYSTEMFUNCTIONS.GroupByFieldNames ' List of Group Field Names
  7. If sGroupFldNames = "" Then
  8. nGrps = 0
  9. Else
  10. arrGrps = split(sGroupFldNames, vbCrLf)
  11. nGrps = UBound(arrGrps)+1 ' Number of Group Fields
  12. ' Group field array
  13. Redim arrGrpFlds(10,nGrps-1)
  14. For i = 0 to nGrps-1
  15. Set FIELD = TABLE.Fields(arrGrps(i))
  16. sFldVar = FIELD.FldVar
  17. ' Get first group field name and type
  18. If i = 0 Then
  19. sFirstGrpFldName = FIELD.FldName
  20. sFirstGrpFldParm = FIELD.FldParm
  21. sFirstGrpFldObj = sTblVar & "->" & sFirstGrpFldParm
  22. sFirstGrpFldSql = ew_FieldSqlName(FIELD)
  23. sFirstGrpFldGroupByType = FIELD.FldGroupByType
  24. sFirstGrpFldGroupByInterval = FIELD.FldGroupByInterval
  25. sFirstGrpDbGrpSql = ew_DbGrpSql(sFirstGrpFldGroupByType, sFirstGrpFldGroupByInterval)
  26. SetupFldVar()
  27. End If
  28. arrGrpFlds(0,i) = FIELD.FldName ' field name
  29. arrGrpFlds(1,i) = FIELD.FldVar ' field variable
  30. arrGrpFlds(2,i) = FIELD.FldCaption ' field caption
  31. If FIELD.FldType = 201 Or FIELD.FldType = 203 Then ' memo field
  32. arrGrpFlds(3,i) = False ' skip popup filter if memo field
  33. Else
  34. arrGrpFlds(3,i) = IsPopupFilter(FIELD) ' generate popup filter
  35. End If
  36. If IsPopupFilter(FIELD) Then nSearchFlds = nSearchFlds + 1
  37. arrGrpFlds(4,i) = FIELD.FldFilterName ' Popup filter name
  38. arrGrpFlds(5,i) = FIELD.FldType ' field type
  39. If FIELD.FldUseRange Then ' field use range
  40. arrGrpFlds(6,i) = "true"
  41. Else
  42. arrGrpFlds(6,i) = "false"
  43. End If
  44. arrGrpFlds(7,i) = FIELD.FldGroupByShowSummary ' show summary required
  45. arrGrpFlds(8,i) = FIELD.FldGroupByType ' field grouping type
  46. arrGrpFlds(9,i) = FIELD.FldGroupByInterval ' field grouping interval
  47. arrGrpFlds(10,i) = ew_DbGrpSql(FIELD.FldGroupByType, FIELD.FldGroupByInterval) ' field grouping sql
  48. Next
  49. End If
  50. ' Detail Fields variables
  51. Dim arrDtlFlds, arrSmry
  52. Redim arrDtlFlds(6,0)
  53. Redim arrSmry(3,1)
  54. arrSmry(0,0) = "Sum": arrSmry(1,0) = "Avg": arrSmry(2,0) = "Min": arrSmry(3,0) = "Max"
  55. arrSmry(0,1) = False: arrSmry(1,1) = False: arrSmry(2,1) = False: arrSmry(3,1) = False
  56. nDtls = 0
  57. For i = 1 to TABLE.Fields.Count
  58. Set FIELD = TABLE.Fields.Seq(i)
  59. If FIELD.FldList And FIELD.FldGroupBy <= 0 And FIELD.FldGenerate Then
  60. Redim Preserve arrDtlFlds(6,nDtls)
  61. Redim Preserve arrSmry(3,nDtls+2)
  62. arrDtlFlds(0,nDtls) = FIELD.FldName ' field name
  63. arrDtlFlds(1,nDtls) = FIELD.FldVar ' field variable
  64. arrDtlFlds(2,nDtls) = FIELD.FldCaption ' field caption
  65. If FIELD.FldType = 201 Or FIELD.FldType = 203 Then ' memo field
  66. arrDtlFlds(3,nDtls) = False ' skip popup filter if memo field
  67. Else
  68. arrDtlFlds(3,nDtls) = IsPopupFilter(FIELD) ' generate popup filter
  69. End If
  70. If IsPopupFilter(FIELD) Then nSearchFlds = nSearchFlds + 1
  71. arrDtlFlds(4,nDtls) = FIELD.FldFilterName ' Popup filter name
  72. arrDtlFlds(5,nDtls) = FIELD.FldType ' field type
  73. If FIELD.FldUseRange Then ' field use range
  74. arrDtlFlds(6,nDtls) = "true"
  75. Else
  76. arrDtlFlds(6,nDtls) = "false"
  77. End If
  78. arrSmry(0,nDtls+2) = FIELD.FldRptAggSum ' agg sum
  79. arrSmry(0,1) = arrSmry(0,1) Or arrSmry(0,nDtls+2)
  80. arrSmry(1,nDtls+2) = FIELD.FldRptAggAvg ' agg avg
  81. arrSmry(1,1) = arrSmry(1,1) Or arrSmry(1,nDtls+2)
  82. arrSmry(2,nDtls+2) = FIELD.FldRptAggMin ' agg min
  83. arrSmry(2,1) = arrSmry(2,1) Or arrSmry(2,nDtls+2)
  84. arrSmry(3,nDtls+2) = FIELD.FldRptAggMax ' agg max
  85. arrSmry(3,1) = arrSmry(3,1) Or arrSmry(3,nDtls+2)
  86. nDtls = nDtls + 1
  87. End If
  88. Next
  89. bHasSummaryFields = (arrSmry(0,1) Or arrSmry(1,1) Or arrSmry(2,1) Or arrSmry(3,1))
  90. bShowDetails = TABLE.TblRptShowDetails
  91. If nGrps <= 0 And Not (bHasSummaryFields And (TABLE.TblRptShowPageTotal Or TABLE.TblRptShowGrandTotal)) Then bShowDetails = True
  92. If Not bShowDetails And bHasSummaryFields Then
  93. bShowSummaryView = TABLE.TblRptShowSummaryView ' Use summary view
  94. Else
  95. bShowSummaryView = False
  96. End If
  97. ' Remove grouping fields without show summary
  98. If bShowSummaryView Then
  99. Dim nGrps2, arrGrpFlds2
  100. nGrps2 = nGrps
  101. arrGrpFlds2 = arrGrpFlds
  102. For i = nGrps2-1 to 0 Step -1
  103. If Not arrGrpFlds(7,i) Then ' Show summary not enabled for last group
  104. If i = nGrps-1 Then
  105. nGrps = nGrps - 1
  106. Else
  107. nGrps = 0 ' Incorrect setting, show detail/summary instead
  108. End If
  109. If nGrps > 0 Then
  110. ReDim Preserve arrGrpFlds(UBound(arrGrpFlds,1),nGrps-1)
  111. Else
  112. arrGrpFlds = arrGrpFlds2
  113. nGrps = nGrps2
  114. bShowDetails = True
  115. bShowSummaryView = False
  116. Exit For
  117. End If
  118. End If
  119. Next
  120. End If
  121. ' Calculate slot size
  122. If bShowSummaryView Then
  123. nSlots = nGrps
  124. For i = 2 to UBound(arrSmry,2)
  125. For j = 0 to UBound(arrSmry,1)
  126. If arrSmry(j,i) Then nSlots = nSlots + 1
  127. Next
  128. Next
  129. Else
  130. nSlots = nGrps + nDtls
  131. End If
  132. bShowYearSelection = False ' Crosstab only
  133. ##-->
  134. <!--##/session##-->
  135. <?php
  136. <!--##session phpmain##-->
  137. // Initialize common variables
  138. var $ExportOptions; // Export options
  139. // Paging variables
  140. var $RecCount = 0; // Record count
  141. var $StartGrp = 0; // Start group
  142. var $StopGrp = 0; // Stop group
  143. var $TotalGrps = 0; // Total groups
  144. var $GrpCount = 0; // Group count
  145. var $DisplayGrps = <!--##=iGrpPerPage##-->; // Groups per page
  146. var $GrpRange = 10;
  147. var $Sort = "";
  148. var $Filter = "";
  149. var $UserIDFilter = "";
  150. // Clear field for ext filter
  151. var $ClearExtFilter = "";
  152. var $FilterApplied;
  153. var $ShowFirstHeader;
  154. var $Cnt, $Col, $Val, $Smry, $Mn, $Mx, $GrandSmry, $GrandMn, $GrandMx;
  155. var $TotCount;
  156. //
  157. // Page main
  158. //
  159. function Page_Main() {
  160. global $<!--##=sTblVar##-->;
  161. global $rs;
  162. global $rsgrp;
  163. <!--## If bTableHasUserIDFld Then ##-->
  164. global $Security;
  165. <!--## End If ##-->
  166. global $gsFormError;
  167. <!--## If bTableHasUserIDFld Then ##-->
  168. // Set up User ID
  169. $this->UserIDFilter = $<!--##=sTblVar##-->->GetUserIDFilter();
  170. $this->Filter = $this->UserIDFilter;
  171. <!--## End If ##-->
  172. // Aggregate variables
  173. // 1st dimension = no of groups (level 0 used for grand total)
  174. // 2nd dimension = no of fields
  175. $nDtls = <!--##=nDtls+1##-->;
  176. $nGrps = <!--##=nGrps+1##-->;
  177. $this->Val =& ewrpt_InitArray($nDtls, 0);
  178. $this->Cnt =& ewrpt_Init2DArray($nGrps, $nDtls, 0);
  179. $this->Smry =& ewrpt_Init2DArray($nGrps, $nDtls, 0);
  180. $this->Mn =& ewrpt_Init2DArray($nGrps, $nDtls, NULL);
  181. $this->Mx =& ewrpt_Init2DArray($nGrps, $nDtls, NULL);
  182. $this->GrandSmry =& ewrpt_InitArray($nDtls, 0);
  183. $this->GrandMn =& ewrpt_InitArray($nDtls, NULL);
  184. $this->GrandMx =& ewrpt_InitArray($nDtls, NULL);
  185. // Set up if accumulation required
  186. <!--##
  187. accum = "FALSE" ' first column not used
  188. For i = 0 to nDtls-1
  189. If arrSmry(0,i+2) Or arrSmry(1,i+2) Or _
  190. arrSmry(2,i+2) Or arrSmry(3,i+2) Then
  191. accum = accum & ", TRUE"
  192. Else
  193. accum = accum & ", FALSE"
  194. End If
  195. Next
  196. ##-->
  197. $this->Col = array(<!--##=accum##-->);
  198. <!--## If sGrpPerPageList <> "" Then ##-->
  199. // Set up groups per page dynamically
  200. $this->SetUpDisplayGrps();
  201. <!--## End If ##-->
  202. <!--## If nGrps > 0 Then ##-->
  203. <!--##
  204. ' Group popup & selection values
  205. For i = 0 to nGrps-1
  206. bGenFilter = arrGrpFlds(3,i)
  207. If bGenFilter Then
  208. sFldVar = arrGrpFlds(1,i)
  209. SetupFldVar()
  210. ##-->
  211. $<!--##=sFldObj##-->->SelectionList = "";
  212. $<!--##=sFldObj##-->->DefaultSelectionList = "";
  213. $<!--##=sFldObj##-->->ValueList = "";
  214. <!--##
  215. End If
  216. Next
  217. ##-->
  218. <!--## End If ##-->
  219. <!--##
  220. ' Detail popup & selection values
  221. For i = 0 to nDtls-1
  222. bGenFilter = arrDtlFlds(3,i)
  223. If bGenFilter Then
  224. sFldVar = arrDtlFlds(1,i)
  225. SetupFldVar()
  226. ##-->
  227. $<!--##=sFldObj##-->->SelectionList = "";
  228. $<!--##=sFldObj##-->->DefaultSelectionList = "";
  229. $<!--##=sFldObj##-->->ValueList = "";
  230. <!--##
  231. End If
  232. Next
  233. ##-->
  234. <!--## If bReportExtFilter Or nSearchFlds > 0 Then ##-->
  235. // Load default filter values
  236. $this->LoadDefaultFilters();
  237. <!--## End If ##-->
  238. <!--## If SYSTEMFUNCTIONS.ServerScriptExist("Table","Filters_Load") Then ##-->
  239. // Load custom filters
  240. $<!--##=sTblVar##-->->Filters_Load();
  241. <!--## End If ##-->
  242. // Set up popup filter
  243. $this->SetupPopup();
  244. // Extended filter
  245. $sExtendedFilter = "";
  246. <!--## If bReportExtFilter Then ##-->
  247. // Get dropdown values
  248. $this->GetExtendedFilterValues();
  249. // Build extended filter
  250. $sExtendedFilter = $this->GetExtendedFilter();
  251. if ($sExtendedFilter <> "") {
  252. if ($this->Filter <> "")
  253. $this->Filter = "($this->Filter) AND ($sExtendedFilter)";
  254. else
  255. $this->Filter = $sExtendedFilter;
  256. }
  257. <!--## End If ##-->
  258. // Build popup filter
  259. $sPopupFilter = $this->GetPopupFilter();
  260. //ewrpt_SetDebugMsg("popup filter: " . $sPopupFilter);
  261. if ($sPopupFilter <> "") {
  262. if ($this->Filter <> "")
  263. $this->Filter = "($this->Filter) AND ($sPopupFilter)";
  264. else
  265. $this->Filter = $sPopupFilter;
  266. }
  267. <!--## If bReportExtFilter Or nSearchFlds > 0 Then ##-->
  268. // Check if filter applied
  269. $this->FilterApplied = $this->CheckFilter();
  270. <!--## Else ##-->
  271. // No filter
  272. $this->FilterApplied = FALSE;
  273. <!--## End If ##-->
  274. <!--## If TABLE.TblShowBlankListPage Then ##-->
  275. // Requires search criteria
  276. if ($this->Filter == $this->UserIDFilter || $gsFormError != "")
  277. $this->Filter = "0=101";
  278. <!--## End If ##-->
  279. $this->ExportOptions->GetItem("resetfilter")->Visible = $this->FilterApplied;
  280. // Get sort
  281. $this->Sort = $this->GetSort();
  282. <!--## If nGrps > 0 Then ##-->
  283. // Get total group count
  284. $sGrpSort = ewrpt_UpdateSortFields($<!--##=sTblVar##-->->SqlOrderByGroup(), $this->Sort, 2); // Get grouping field only
  285. $sSql = ewrpt_BuildReportSql($<!--##=sTblVar##-->->SqlSelectGroup(), $<!--##=sTblVar##-->->SqlWhere(), $<!--##=sTblVar##-->->SqlGroupBy(), $<!--##=sTblVar##-->->SqlHaving(), $<!--##=sTblVar##-->->SqlOrderByGroup(), $this->Filter, $sGrpSort);
  286. $this->TotalGrps = $this->GetGrpCnt($sSql);
  287. <!--## Else ##-->
  288. // Get total count
  289. $sSql = ewrpt_BuildReportSql($<!--##=sTblVar##-->->SqlSelect(), $<!--##=sTblVar##-->->SqlWhere(), $<!--##=sTblVar##-->->SqlGroupBy(), $<!--##=sTblVar##-->->SqlHaving(), $<!--##=sTblVar##-->->SqlOrderBy(), $this->Filter, $this->Sort);
  290. $this->TotalGrps = $this->GetCnt($sSql);
  291. <!--## End If ##-->
  292. if ($this->DisplayGrps <= 0) // Display all groups
  293. $this->DisplayGrps = $this->TotalGrps;
  294. $this->StartGrp = 1;
  295. // Show header
  296. $this->ShowFirstHeader = ($this->TotalGrps > 0);
  297. //$this->ShowFirstHeader = TRUE; // Uncomment to always show header
  298. // Set up start position if not export all
  299. if ($<!--##=sTblVar##-->->ExportAll && $<!--##=sTblVar##-->->Export <> "")
  300. $this->DisplayGrps = $this->TotalGrps;
  301. else
  302. $this->SetUpStartGroup();
  303. // Hide all options if export
  304. if ($<!--##=sTblVar##-->->Export <> "") {
  305. $this->ExportOptions->HideAllOptions();
  306. }
  307. <!--## If nGrps > 0 Then ##-->
  308. // Get current page groups
  309. $rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
  310. // Init detail recordset
  311. $rs = NULL;
  312. <!--## Else ##-->
  313. // Get current page records
  314. $rs = $this->GetRs($sSql, $this->StartGrp, $this->DisplayGrps);
  315. <!--## End If ##-->
  316. }
  317. <!--##/session##-->
  318. ?>
  319. <!--##session report_content##-->
  320. <!--##=sChartExpStart##-->
  321. <!--##include rpt-chartcommon-ext.php/chart_js_ext##-->
  322. <!--##=sChartExpEnd##-->
  323. <!--##=sExpStart##-->
  324. <div id="ewrpt_PopupFilter"><div class="bd"></div></div>
  325. <script src="<!--##=ew_FolderPath("_js")##-->/ewrptpop.js" type="text/javascript"></script>
  326. <script type="text/javascript">
  327. // popup fields
  328. <!--##
  329. For i = 0 to nGrps-1
  330. bGenFilter = arrGrpFlds(3,i)
  331. If bGenFilter Then
  332. sFldVar = arrGrpFlds(1,i)
  333. SetupFldVar()
  334. If arrGrpFlds(8,i) <> "" And arrGrpFlds(8,i) <> "n" Then ' grouping required
  335. ##-->
  336. <?php $jsdata = ewrpt_GetJsData($<!--##=sFldObj##-->, EWRPT_DATATYPE_NONE); ?>
  337. <!--##
  338. Else
  339. ##-->
  340. <?php $jsdata = ewrpt_GetJsData($<!--##=sFldObj##-->, $<!--##=sFldObj##-->->FldType); ?>
  341. <!--##
  342. End If
  343. ##-->
  344. ewrpt_CreatePopup("<!--##=sSessionFldVar##-->", [<?php echo $jsdata ?>]);
  345. <!--##
  346. End If
  347. Next
  348. For i = 0 to nDtls-1
  349. bGenFilter = arrDtlFlds(3,i)
  350. If bGenFilter Then
  351. sFldVar = arrDtlFlds(1,i)
  352. SetupFldVar()
  353. ##-->
  354. <?php $jsdata = ewrpt_GetJsData($<!--##=sFldObj##-->, $<!--##=sFldObj##-->->FldType); ?>
  355. ewrpt_CreatePopup("<!--##=sSessionFldVar##-->", [<?php echo $jsdata ?>]);
  356. <!--##
  357. End If
  358. Next
  359. ##-->
  360. </script>
  361. <!--##=sExpEnd##-->
  362. <!--##=sChartExpStart##-->
  363. <!-- Table Container (Begin) -->
  364. <table id="ewContainer" cellspacing="0" cellpadding="0" border="0">
  365. <!-- Top Container (Begin) -->
  366. <tr><td colspan="3"><div id="ewTop" class="phpreportmaker">
  367. <!-- top slot -->
  368. <a name="top"></a>
  369. <!--##=sChartExpEnd##-->
  370. <p class="phpreportmaker ewTitle"><?php echo $<!--##=sTblVar##-->->TableCaption() ?>
  371. &nbsp;&nbsp;<?php $<!--##=sPageObj##-->->ExportOptions->Render("body"); ?></p>
  372. <!--##include rpt-phpcommon.php/header-message##-->
  373. <!--##include rpt-phpcommon.php/common-message##-->
  374. <!--## If Not bShowReport And Not bShowChart Then ##-->
  375. <p class="ewMessage"><!--##@NoReportOrCharts##--></p>
  376. <!--## End If ##-->
  377. <br /><br />
  378. <!--##=sChartExpStart##-->
  379. <!--##
  380. ' Generate charts (on top)
  381. For i = 1 to TABLE.Charts.Count
  382. Set CHART = TABLE.Charts.Seq(i)
  383. If IsShowChart(CHART) And CHART.ChartPosition = 1 Then
  384. sChartVar = CHART.ChartVar
  385. sChartId = sChartVar
  386. If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
  387. ##-->
  388. <a name="cht_<!--##=sChartId##-->"></a>
  389. <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
  390. <!--##include rpt-chartcommon.php/chart_common##-->
  391. <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
  392. <!--##include rpt-chartcommon.php/chart_config##-->
  393. <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
  394. <!--##include rpt-chartcommon.php/chart_content##-->
  395. <br /><br />
  396. <!--##
  397. End If
  398. Next
  399. ##-->
  400. </div></td></tr>
  401. <!-- Top Container (End) -->
  402. <tr>
  403. <!-- Left Container (Begin) -->
  404. <!--##
  405. CurCellPadding = ""
  406. If ew_ChartCount(2) > 0 Then CurCellPadding = " class=""ewPadding"""
  407. ##-->
  408. <td style="vertical-align: top;"<!--##=CurCellPadding##-->><div id="ewLeft" class="phpreportmaker">
  409. <!-- Left slot -->
  410. <!--##
  411. ' Generate charts (on left)
  412. For i = 1 to TABLE.Charts.Count
  413. Set CHART = TABLE.Charts.Seq(i)
  414. If IsShowChart(CHART) And CHART.ChartPosition = 2 Then
  415. sChartVar = CHART.ChartVar
  416. sChartId = sChartVar
  417. If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
  418. ##-->
  419. <a name="cht_<!--##=sChartId##-->"></a>
  420. <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
  421. <!--##include rpt-chartcommon.php/chart_common##-->
  422. <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
  423. <!--##include rpt-chartcommon.php/chart_config##-->
  424. <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
  425. <!--##include rpt-chartcommon.php/chart_content##-->
  426. <br /><br />
  427. <!--##
  428. End If
  429. Next
  430. ##-->
  431. </div></td>
  432. <!-- Left Container (End) -->
  433. <!-- Center Container - Report (Begin) -->
  434. <!--##
  435. CurCellPadding = ""
  436. If bShowReport Then CurCellPadding = " class=""ewPadding"""
  437. ##-->
  438. <td style="vertical-align: top;"<!--##=CurCellPadding##-->><div id="ewCenter" class="phpreportmaker">
  439. <!-- center slot -->
  440. <!--##=sChartExpEnd##-->
  441. <!--## If bShowReport Then ##-->
  442. <!-- summary report starts -->
  443. <!--##=sSkipPdfExpStart##-->
  444. <div id="report_summary">
  445. <!--##include rpt-extfilter.php/report_extfilter_html##-->
  446. <table class="ewGrid" cellspacing="0"><tr>
  447. <td class="ewGridContent">
  448. <!--##=sSkipPdfExpEnd##-->
  449. <!--## If bTopPageLink Then ##-->
  450. <!--##=sExpStart##-->
  451. <div class="ewGridUpperPanel">
  452. <!--##include rpt-pager.php/phppager##-->
  453. </div>
  454. <!--##=sExpEnd##-->
  455. <!--## End If ##-->
  456. <!-- Report Grid (Begin) -->
  457. <!--##=sSkipPdfExpStart##-->
  458. <div class="ewGridMiddlePanel">
  459. <!--##=sSkipPdfExpEnd##-->
  460. <table class="<?php echo $<!--##=sPageObj##-->->ReportTableClass ?>" cellspacing="0">
  461. <?php
  462. // Set the last group to display if not export all
  463. if ($<!--##=sTblVar##-->->ExportAll && $<!--##=sTblVar##-->->Export <> "") {
  464. $<!--##=sPageObj##-->->StopGrp = $<!--##=sPageObj##-->->TotalGrps;
  465. } else {
  466. $<!--##=sPageObj##-->->StopGrp = $<!--##=sPageObj##-->->StartGrp + $<!--##=sPageObj##-->->DisplayGrps - 1;
  467. }
  468. // Stop group <= total number of groups
  469. if (intval($<!--##=sPageObj##-->->StopGrp) > intval($<!--##=sPageObj##-->->TotalGrps))
  470. $<!--##=sPageObj##-->->StopGrp = $<!--##=sPageObj##-->->TotalGrps;
  471. $<!--##=sPageObj##-->->RecCount = 0;
  472. // Get first row
  473. if ($<!--##=sPageObj##-->->TotalGrps > 0) {
  474. <!--## If nGrps > 0 Then ##-->
  475. $<!--##=sPageObj##-->->GetGrpRow(1);
  476. <!--## Else ##-->
  477. $<!--##=sPageObj##-->->GetRow(1);
  478. <!--## End If ##-->
  479. $<!--##=sPageObj##-->->GrpCount = 1;
  480. }
  481. <!--## If nGrps > 0 Then ##-->
  482. while (($rsgrp && !$rsgrp->EOF && $<!--##=sPageObj##-->->GrpCount <= $<!--##=sPageObj##-->->DisplayGrps) || $<!--##=sPageObj##-->->ShowFirstHeader) {
  483. <!--## Else ##-->
  484. while (($rs && !$rs->EOF && $<!--##=sPageObj##-->->GrpCount <= $<!--##=sPageObj##-->->DisplayGrps) || $<!--##=sPageObj##-->->ShowFirstHeader) {
  485. <!--## End If ##-->
  486. // Show header
  487. if ($<!--##=sPageObj##-->->ShowFirstHeader) {
  488. ?>
  489. <thead>
  490. <tr>
  491. <!--##
  492. For i = 0 to nGrps-1
  493. lvl = i + 1
  494. sFldName = arrGrpFlds(0,i)
  495. sFldVar = arrGrpFlds(1,i)
  496. SetupFldVar()
  497. bGenFilter = arrGrpFlds(3,i)
  498. sUseRange = arrGrpFlds(6,i)
  499. Set FIELD = TABLE.Fields(sFldName)
  500. sTDStyle = FieldTD_Header(FIELD)
  501. sJsSort = " class=""ewPointer"" onmousedown=""ewrpt_Sort(event,'<?php echo $" & sTblVar & "->SortUrl($"& sFldObj & ") ?>'," & iSortType & ");"""
  502. ##-->
  503. <td class="ewTableHeader">
  504. <?php if ($<!--##=sTblVar##-->->Export <> "") { ?>
  505. <?php echo $<!--##=sFldObj##-->->FldCaption() ?>
  506. <?php } else { ?>
  507. <table cellspacing="0" class="ewTableHeaderBtn"<!--##=sTDStyle##-->><tr>
  508. <?php if ($<!--##=sTblVar##-->->SortUrl($<!--##=sFldObj##-->) == "") { ?>
  509. <td style="vertical-align: bottom;"><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td>
  510. <?php } else { ?>
  511. <td<!--##=sJsSort##-->><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td><td style="width: 10px;">
  512. <?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>
  513. <?php } ?>
  514. <!--## If bGenFilter Then ##-->
  515. <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>
  516. <!--## End If ##-->
  517. </tr></table>
  518. <?php } ?>
  519. </td>
  520. <!--##
  521. Next
  522. ##-->
  523. <!--## If bShowSummaryView Then ' Summary view ##-->
  524. <!--##
  525. For i = 2 to UBound(arrSmry,2)
  526. For j = 0 to UBound(arrSmry,1)
  527. If arrSmry(j,i) Then
  528. sSrcFldName = arrDtlFlds(0,i-2)
  529. sSrcFldVar = arrDtlFlds(1,i-2)
  530. sSrcFldParm = Mid(sSrcFldVar,3)
  531. sSrcFldObj = sTblVar & "->" & sSrcFldParm
  532. sSummaryType = arrSmry(j,0)
  533. ##-->
  534. <td class="ewTableHeader"><?php echo $<!--##=sSrcFldObj##-->->FldCaption() ?> (<!--##=SummaryCaption(sSummaryType)##-->)</td>
  535. <!--##
  536. End If
  537. Next
  538. Next
  539. ##-->
  540. <!--## Else ' Detail view ##-->
  541. <!--##
  542. For i = 0 to nDtls-1
  543. sFldName = arrDtlFlds(0,i)
  544. sFldVar = arrDtlFlds(1,i)
  545. SetupFldVar()
  546. bGenFilter = arrDtlFlds(3,i)
  547. sUseRange = arrDtlFlds(6,i)
  548. Set FIELD = TABLE.Fields(sFldName)
  549. sTDStyle = FieldTD_Header(FIELD)
  550. sJsSort = " class=""ewPointer"" onmousedown=""ewrpt_Sort(event,'<?php echo $" & sTblVar & "->SortUrl($"& sFldObj & ") ?>'," & iSortType & ");"""
  551. ##-->
  552. <td class="ewTableHeader">
  553. <?php if ($<!--##=sTblVar##-->->Export <> "") { ?>
  554. <?php echo $<!--##=sFldObj##-->->FldCaption() ?>
  555. <?php } else { ?>
  556. <table cellspacing="0" class="ewTableHeaderBtn"<!--##=sTDStyle##-->><tr>
  557. <?php if ($<!--##=sTblVar##-->->SortUrl($<!--##=sFldObj##-->) == "") { ?>
  558. <td style="vertical-align: bottom;"><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td>
  559. <?php } else { ?>
  560. <td<!--##=sJsSort##-->><?php echo $<!--##=sFldObj##-->->FldCaption() ?></td><td style="width: 10px;">
  561. <?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>
  562. <?php } ?>
  563. <!--## If bGenFilter Then ##-->
  564. <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>
  565. <!--## End If ##-->
  566. </tr></table>
  567. <?php } ?>
  568. </td>
  569. <!--##
  570. Next
  571. ##-->
  572. <!--## End If ' End Summary/Detail View ##-->
  573. </tr>
  574. </thead>
  575. <tbody>
  576. <?php
  577. $<!--##=sPageObj##-->->ShowFirstHeader = FALSE;
  578. }
  579. <!--## If nGrps = 0 Then ##-->
  580. $<!--##=sPageObj##-->->RecCount++;
  581. <!--## Else ##-->
  582. // Build detail SQL
  583. $sWhere = ewrpt_DetailFilterSQL($<!--##=sFirstGrpFldObj##-->, $<!--##=sTblVar##-->->SqlFirstGroupField(), $<!--##=sFirstGrpFldObj##-->->GroupValue());
  584. if ($<!--##=sPageObj##-->->Filter != "")
  585. $sWhere = "($<!--##=sPageObj##-->->Filter) AND ($sWhere)";
  586. $sSql = ewrpt_BuildReportSql($<!--##=sTblVar##-->->SqlSelect(), $<!--##=sTblVar##-->->SqlWhere(), $<!--##=sTblVar##-->->SqlGroupBy(), $<!--##=sTblVar##-->->SqlHaving(), $<!--##=sTblVar##-->->SqlOrderBy(), $sWhere, $<!--##=sPageObj##-->->Sort);
  587. $rs = $conn->Execute($sSql);
  588. $rsdtlcnt = ($rs) ? $rs->RecordCount() : 0;
  589. if ($rsdtlcnt > 0)
  590. $<!--##=sPageObj##-->->GetRow(1);
  591. while ($rs && !$rs->EOF) { // Loop detail records
  592. $<!--##=sPageObj##-->->RecCount++;
  593. <!--## End If ##-->
  594. // Render detail row
  595. $<!--##=sTblVar##-->->ResetCSS();
  596. $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_DETAIL;
  597. $<!--##=sPageObj##-->->RenderRow();
  598. ?>
  599. <!--## If bShowDetails Then ' Show details ##-->
  600. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  601. <!--##
  602. For i = 0 to nGrps-1
  603. lvl = i + 1
  604. sFldName = arrGrpFlds(0,i)
  605. sFldVar = arrGrpFlds(1,i)
  606. SetupFldVar()
  607. Set FIELD = TABLE.Fields(sFldName)
  608. ##-->
  609. <td<?php echo $<!--##=sFldObj##-->->CellAttributes(); ?>><!--##=SYSTEMFUNCTIONS.FieldGroupView##--></td>
  610. <!--##
  611. Next
  612. For i = 0 to nDtls-1
  613. sFldName = arrDtlFlds(0,i)
  614. sFldVar = arrDtlFlds(1,i)
  615. SetupFldVar()
  616. Set FIELD = TABLE.Fields(sFldName)
  617. ##-->
  618. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldView##--></td>
  619. <!--##
  620. Next
  621. ##-->
  622. </tr>
  623. <!--## End If ' End show detail ##-->
  624. <?php
  625. // Accumulate page summary
  626. $<!--##=sPageObj##-->->AccumulateSummary();
  627. // Get next record
  628. $<!--##=sPageObj##-->->GetRow(2);
  629. <!--## If nGrps <= 0 Then ##-->
  630. $<!--##=sPageObj##-->->GrpCount++;
  631. <!--## Else ##-->
  632. // Show Footers
  633. ?>
  634. <!--##
  635. For i = nGrps-1 to 0 Step -1
  636. lvl = i + 1
  637. If lvl = 1 Then
  638. ##-->
  639. <?php
  640. } // End detail records loop
  641. ?>
  642. <!--##
  643. End If
  644. If arrGrpFlds(7,i) Then ' show summary required
  645. Set FIELD = TABLE.Fields(arrGrpFlds(0,i))
  646. sFldVar = arrGrpFlds(1,i)
  647. SetupFldVar()
  648. sSummary = "ewrpt_DisplayGroupValue($" & sFldObj & ", $" & sFldObj & "->GroupValue())"
  649. ##-->
  650. <?php
  651. <!--## If lvl > 1 Then ##-->
  652. if ($<!--##=sPageObj##-->->ChkLvlBreak(<!--##=lvl##-->)) {
  653. <!--## End If ##-->
  654. ?>
  655. <!--## If bShowSummaryView Then ' Summary view ##-->
  656. <?php
  657. <!--##
  658. For x = 2 to UBound(arrSmry,2)
  659. k = x-1
  660. sFldName = arrDtlFlds(0,k-1)
  661. Set FIELD = TABLE.Fields(sFldName)
  662. sFldVar = arrDtlFlds(1,k-1)
  663. SetupFldVar()
  664. ##-->
  665. $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[<!--##=lvl##-->][<!--##=k##-->];
  666. <!--##
  667. For j = 0 to UBound(arrSmry,1)
  668. If arrSmry(j,x) Then
  669. ##-->
  670. <!--## If j = 0 Then ' SUM ##-->
  671. $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]; // Load SUM
  672. <!--## ElseIf j = 1 Then ' AVG ##-->
  673. $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
  674. <!--## ElseIf j = 2 Then ' MIN ##-->
  675. $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[<!--##=lvl##-->][<!--##=k##-->]; // Load MIN
  676. <!--## ElseIf j = 3 Then ' MAX ##-->
  677. $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[<!--##=lvl##-->][<!--##=k##-->]; // Load MAX
  678. <!--## End If ##-->
  679. <!--##
  680. End If
  681. Next
  682. Next
  683. ##-->
  684. $<!--##=sTblVar##-->->ResetCSS();
  685. $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
  686. $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GROUP;
  687. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
  688. $<!--##=sTblVar##-->->RowGroupLevel = <!--##=lvl##-->;
  689. $<!--##=sPageObj##-->->RenderRow();
  690. ?>
  691. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  692. <!--##
  693. sSmryGrpFldParm = Mid(arrGrpFlds(1,lvl-1),3)
  694. sSmryGrpFldObj = sTblVar & "->" & sSmryGrpFldParm
  695. For x = 0 to nGrps-1
  696. sFldName = arrGrpFlds(0,x)
  697. Set FIELD = TABLE.Fields(sFldName)
  698. sGrpFldParm = Mid(arrGrpFlds(1,x),3)
  699. sGrpFldObj = sTblVar & "->" & sGrpFldParm
  700. If x = lvl-1 Then
  701. ##-->
  702. <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldGroupView##-->&nbsp;(<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->Cnt[<!--##=lvl##-->][0],0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td>
  703. <!--##
  704. ElseIf x < lvl Then
  705. ##-->
  706. <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryGroupView##--></td>
  707. <!--##
  708. Else
  709. ##-->
  710. <td<?php echo $<!--##=sSmryGrpFldObj##-->->CellAttributes() ?>>&nbsp;</td>
  711. <!--##
  712. End If
  713. Next
  714. For x = 2 to UBound(arrSmry,2)
  715. sFldName = arrDtlFlds(0,x-2)
  716. Set FIELD = TABLE.Fields(sFldName)
  717. sFldVar = arrDtlFlds(1,x-2)
  718. SetupFldVar()
  719. For j = 0 to UBound(arrSmry,1)
  720. If arrSmry(j,x) Then
  721. ##-->
  722. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
  723. <!--##
  724. End If
  725. Next
  726. Next
  727. ##-->
  728. </tr>
  729. <!--## Else ' Detail view ##-->
  730. <?php
  731. $<!--##=sTblVar##-->->ResetCSS();
  732. $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
  733. $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GROUP;
  734. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
  735. $<!--##=sTblVar##-->->RowGroupLevel = <!--##=lvl##-->;
  736. $<!--##=sPageObj##-->->RenderRow();
  737. ?>
  738. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  739. <!--##
  740. For j = 0 to i-1
  741. sGrpFldParm = Mid(arrGrpFlds(1,j),3)
  742. sGrpFldObj = sTblVar & "->" & sGrpFldParm
  743. ##-->
  744. <!--## If bShowDetails Then ##-->
  745. <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>>&nbsp;</td>
  746. <!--## Else ##-->
  747. <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><?php echo $<!--##=sGrpFldObj##-->->GroupSummaryViewValue; ?></td>
  748. <!--## End If ##-->
  749. <!--##
  750. Next
  751. ##-->
  752. <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>
  753. <!--##
  754. For j = 0 to UBound(arrSmry,1)
  755. If arrSmry(j,1) Then
  756. ##-->
  757. <?php
  758. $<!--##=sTblVar##-->->ResetCSS();
  759. <!--##
  760. For k = 1 to nDtls
  761. If arrSmry(j,k+1) Then
  762. sFldName = arrDtlFlds(0,k-1)
  763. Set FIELD = TABLE.Fields(sFldName)
  764. sFldVar = arrDtlFlds(1,k-1)
  765. SetupFldVar()
  766. ##-->
  767. $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[<!--##=lvl##-->][<!--##=k##-->];
  768. <!--## If j = 0 Then ' SUM ##-->
  769. $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]; // Load SUM
  770. <!--## ElseIf j = 1 Then ' AVG ##-->
  771. $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0)? $<!--##=sPageObj##-->->Smry[<!--##=lvl##-->][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
  772. <!--## ElseIf j = 2 Then ' MIN ##-->
  773. $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[<!--##=lvl##-->][<!--##=k##-->]; // Load MIN
  774. <!--## ElseIf j = 3 Then ' MAX ##-->
  775. $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[<!--##=lvl##-->][<!--##=k##-->]; // Load MAX
  776. <!--## End If ##-->
  777. <!--##
  778. End If
  779. Next
  780. ##-->
  781. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_<!--##=UCase(arrSmry(j,0))##-->;
  782. $<!--##=sPageObj##-->->RenderRow();
  783. ?>
  784. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  785. <!--##
  786. For k = 0 to i-1
  787. sGrpFldParm = Mid(arrGrpFlds(1,k),3)
  788. sGrpFldObj = sTblVar & "->" & sGrpFldParm
  789. ##-->
  790. <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>>&nbsp;</td>
  791. <!--##
  792. Next
  793. sGrpFldParm = Mid(arrGrpFlds(1,i),3)
  794. sGrpFldObj = sTblVar & "->" & sGrpFldParm
  795. ##-->
  796. <td colspan="<!--##=nGrps-i##-->"<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>><!--##=SummaryCaption(arrSmry(j,0))##--></td>
  797. <!--##
  798. For k = 1 to nDtls
  799. sFldName = arrDtlFlds(0,k-1)
  800. sFldVar = arrDtlFlds(1,k-1)
  801. SetupFldVar()
  802. If arrSmry(j,k+1) Then
  803. Set FIELD = TABLE.Fields(sFldName)
  804. ##-->
  805. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
  806. <!--##
  807. Else
  808. ##-->
  809. <td<?php echo $<!--##=sGrpFldObj##-->->CellAttributes() ?>>&nbsp;</td>
  810. <!--##
  811. End If
  812. Next
  813. ##-->
  814. </tr>
  815. <!--##
  816. End If
  817. Next
  818. ##-->
  819. <!--## End If ' End Summary/Detail view ##-->
  820. <?php
  821. // Reset level <!--##=lvl##--> summary
  822. $<!--##=sPageObj##-->->ResetLevelSummary(<!--##=lvl##-->);
  823. <!--## If lvl > 1 Then ' v3 ##-->
  824. } // End check level check
  825. <!--## End If ' v3 ##-->
  826. ?>
  827. <!--##
  828. End If
  829. Next
  830. ##-->
  831. <?php
  832. <!--## If nGrps > 0 Then ##-->
  833. // Next group
  834. $<!--##=sPageObj##-->->GetGrpRow(2);
  835. $<!--##=sPageObj##-->->GrpCount++;
  836. <!--## End If ##-->
  837. <!--## End If ##-->
  838. } // End while
  839. ?>
  840. </tbody>
  841. <tfoot>
  842. <!--## If TABLE.TblRptShowPageTotal Then ##-->
  843. <?php if (intval(@$<!--##=sPageObj##-->->Cnt[0][<!--##=nDtls##-->]) > 0) { ?>
  844. <?php
  845. $<!--##=sTblVar##-->->ResetCSS();
  846. $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
  847. $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_PAGE;
  848. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
  849. $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptPageSummary";
  850. $<!--##=sPageObj##-->->RenderRow();
  851. ?>
  852. <!--## If bShowSummaryView Then ' Summary view ##-->
  853. <?php
  854. <!--##
  855. For i = 2 to UBound(arrSmry,2)
  856. k = i-1
  857. sFldName = arrDtlFlds(0,k-1)
  858. Set FIELD = TABLE.Fields(sFldName)
  859. sFldVar = arrDtlFlds(1,k-1)
  860. SetupFldVar()
  861. ##-->
  862. $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[0][<!--##=k##-->];
  863. <!--##
  864. For j = 0 to UBound(arrSmry,1)
  865. If arrSmry(j,i) Then
  866. ##-->
  867. <!--## If j = 0 Then ' SUM ##-->
  868. $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]; // Load SUM
  869. <!--## ElseIf j = 1 Then ' AVG ##-->
  870. $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
  871. <!--## ElseIf j = 2 Then ' MIN ##-->
  872. $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[0][<!--##=k##-->]; // Load MIN
  873. <!--## ElseIf j = 3 Then ' MAX ##-->
  874. $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[0][<!--##=k##-->]; // Load MAX
  875. <!--## End If ##-->
  876. <!--##
  877. End If
  878. Next
  879. Next
  880. ##-->
  881. $<!--##=sTblVar##-->->ResetCSS();
  882. $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
  883. $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_PAGE;
  884. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
  885. $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptPageSummary";
  886. $<!--##=sPageObj##-->->RenderRow();
  887. ?>
  888. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  889. <!--##
  890. For i = 0 to nGrps-1
  891. If i = 0 Then
  892. ##-->
  893. <td><!--##@RptPageTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->Cnt[0][<!--##=nDtls##-->],0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td>
  894. <!--##
  895. Else
  896. ##-->
  897. <td>&nbsp;</td>
  898. <!--##
  899. End If
  900. Next
  901. For i = 2 to UBound(arrSmry,2)
  902. sFldName = arrDtlFlds(0,i-2)
  903. Set FIELD = TABLE.Fields(sFldName)
  904. sFldVar = arrDtlFlds(1,i-2)
  905. SetupFldVar()
  906. For j = 0 to UBound(arrSmry,1)
  907. If arrSmry(j,i) Then
  908. ##-->
  909. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
  910. <!--##
  911. End If
  912. Next
  913. Next
  914. ##-->
  915. </tr>
  916. <!--## Else ' Detail view ##-->
  917. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>><td colspan="<!--##=nSlots##-->"><!--##@RptPageTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->Cnt[0][<!--##=nDtls##-->],0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td></tr>
  918. <!--##
  919. For j = 0 to UBound(arrSmry,1)
  920. If arrSmry(j,1) Then
  921. ##-->
  922. <?php
  923. $<!--##=sTblVar##-->->ResetCSS();
  924. <!--##
  925. For k = 1 to nDtls
  926. If arrSmry(j,k+1) Then
  927. sFldName = arrDtlFlds(0,k-1)
  928. Set FIELD = TABLE.Fields(sFldName)
  929. sFldVar = arrDtlFlds(1,k-1)
  930. SetupFldVar()
  931. ##-->
  932. $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->Cnt[0][<!--##=k##-->];
  933. <!--## If j = 0 Then ' SUM ##-->
  934. $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]; // Load SUM
  935. <!--## ElseIf j = 1 Then ' AVG ##-->
  936. $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->Smry[0][<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
  937. <!--## ElseIf j = 2 Then ' MIN ##-->
  938. $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->Mn[0][<!--##=k##-->]; // Load MIN
  939. <!--## ElseIf j = 3 Then ' MAX ##-->
  940. $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->Mx[0][<!--##=k##-->]; // Load MAX
  941. <!--## End If ##-->
  942. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_<!--##=UCase(arrSmry(j,0))##-->;
  943. <!--##
  944. End If
  945. Next
  946. ##-->
  947. $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptPageSummary";
  948. $<!--##=sPageObj##-->->RenderRow();
  949. ?>
  950. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  951. <!--##
  952. If nGrps > 0 Then
  953. ##-->
  954. <td colspan="<!--##=nGrps##-->" class="ewRptGrpAggregate"><!--##=SummaryCaption(arrSmry(j,0))##--></td>
  955. <!--##
  956. End If
  957. ##-->
  958. <!--##
  959. For k = 1 to nDtls
  960. sFldName = arrDtlFlds(0,k-1)
  961. sFldVar = arrDtlFlds(1,k-1)
  962. SetupFldVar()
  963. If arrSmry(j,k+1) Then
  964. Set FIELD = TABLE.Fields(sFldName)
  965. If nGrps = 0 Then
  966. sSmryCaption = SummaryCaption(arrSmry(j,0))
  967. Else
  968. sSmryCaption = ""
  969. End If
  970. If sSmryCaption <> "" Then sSmryCaption = sSmryCaption & "<?php echo $ReportLanguage->Phrase(""RptSeparator""); ?>"
  971. ##-->
  972. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=sSmryCaption##--><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
  973. <!--##
  974. Else
  975. ##-->
  976. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>>&nbsp;</td>
  977. <!--##
  978. End If
  979. Next
  980. ##-->
  981. </tr>
  982. <!--##
  983. End If
  984. Next
  985. ##-->
  986. <!--## End If ' End Summary/Detail view ##-->
  987. <!-- tr class="ewRptPageSummary"><td colspan="<!--##=nSlots##-->"><span class="phpreportmaker">&nbsp;<br /></span></td></tr -->
  988. <?php } ?>
  989. <!--## End If ##-->
  990. <!--## If TABLE.TblRptShowGrandTotal Then ##-->
  991. <?php
  992. if ($<!--##=sPageObj##-->->TotalGrps > 0) {
  993. $<!--##=sTblVar##-->->ResetCSS();
  994. $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
  995. $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GRAND;
  996. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
  997. $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptGrandSummary";
  998. $<!--##=sPageObj##-->->RenderRow();
  999. ?>
  1000. <!-- tr><td colspan="<!--##=nSlots##-->"><span class="phpreportmaker">&nbsp;<br /></span></td></tr -->
  1001. <!--## If bShowSummaryView Then ' Summary view ##-->
  1002. <?php
  1003. <!--##
  1004. For i = 2 to UBound(arrSmry,2)
  1005. k = i-1
  1006. sFldName = arrDtlFlds(0,k-1)
  1007. Set FIELD = TABLE.Fields(sFldName)
  1008. sFldVar = arrDtlFlds(1,k-1)
  1009. SetupFldVar()
  1010. ##-->
  1011. $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->TotCount;
  1012. <!--##
  1013. For j = 0 to UBound(arrSmry,1)
  1014. If arrSmry(j,i) Then
  1015. ##-->
  1016. <!--## If j = 0 Then ' SUM ##-->
  1017. $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]; // Load SUM
  1018. <!--## ElseIf j = 1 Then ' AVG ##-->
  1019. $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
  1020. <!--## ElseIf j = 2 Then ' MIN ##-->
  1021. $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->GrandMn[<!--##=k##-->]; // Load MIN
  1022. <!--## ElseIf j = 3 Then ' MAX ##-->
  1023. $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->GrandMx[<!--##=k##-->]; // Load MAX
  1024. <!--## End If ##-->
  1025. <!--##
  1026. End If
  1027. Next
  1028. Next
  1029. ##-->
  1030. $<!--##=sTblVar##-->->ResetCSS();
  1031. $<!--##=sTblVar##-->->RowType = EWRPT_ROWTYPE_TOTAL;
  1032. $<!--##=sTblVar##-->->RowTotalType = EWRPT_ROWTOTAL_GRAND;
  1033. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_FOOTER;
  1034. $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptGrandSummary";
  1035. $<!--##=sPageObj##-->->RenderRow();
  1036. ?>
  1037. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  1038. <!--##
  1039. For i = 0 to nGrps-1
  1040. If i = 0 Then
  1041. ##-->
  1042. <td><!--##@RptGrandTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->TotCount,0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td>
  1043. <!--##
  1044. Else
  1045. ##-->
  1046. <td>&nbsp;</td>
  1047. <!--##
  1048. End If
  1049. Next
  1050. For i = 2 to UBound(arrSmry,2)
  1051. sFldName = arrDtlFlds(0,i-2)
  1052. Set FIELD = TABLE.Fields(sFldName)
  1053. sFldVar = arrDtlFlds(1,i-2)
  1054. SetupFldVar()
  1055. For j = 0 to UBound(arrSmry,1)
  1056. If arrSmry(j,i) Then
  1057. ##-->
  1058. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
  1059. <!--##
  1060. End If
  1061. Next
  1062. Next
  1063. ##-->
  1064. </tr>
  1065. <!--## Else ' Detail view ##-->
  1066. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>><td colspan="<!--##=nSlots##-->"><!--##@RptGrandTotal##--> (<?php echo ewrpt_FormatNumber($<!--##=sPageObj##-->->TotCount,0,-2,-2,-2); ?><!--##@RptDtlRec##-->)</td></tr>
  1067. <!--##
  1068. For j = 0 to UBound(arrSmry,1)
  1069. If arrSmry(j,1) Then
  1070. ##-->
  1071. <?php
  1072. $<!--##=sTblVar##-->->ResetCSS();
  1073. <!--##
  1074. For k = 1 to nDtls
  1075. If arrSmry(j,k+1) Then
  1076. sFldName = arrDtlFlds(0,k-1)
  1077. Set FIELD = TABLE.Fields(sFldName)
  1078. sFldVar = arrDtlFlds(1,k-1)
  1079. SetupFldVar()
  1080. ##-->
  1081. $<!--##=sFldObj##-->->Count = $<!--##=sPageObj##-->->TotCount;
  1082. <!--## If j = 0 Then ' SUM ##-->
  1083. $<!--##=sFldObj##-->->SumValue = $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]; // Load SUM
  1084. <!--## ElseIf j = 1 Then ' AVG ##-->
  1085. $<!--##=sFldObj##-->->AvgValue = ($<!--##=sFldObj##-->->Count > 0) ? $<!--##=sPageObj##-->->GrandSmry[<!--##=k##-->]/$<!--##=sFldObj##-->->Count : 0; // Load AVG
  1086. <!--## ElseIf j = 2 Then ' MIN ##-->
  1087. $<!--##=sFldObj##-->->MinValue = $<!--##=sPageObj##-->->GrandMn[<!--##=k##-->]; // Load MIN
  1088. <!--## ElseIf j = 3 Then ' MAX ##-->
  1089. $<!--##=sFldObj##-->->MaxValue = $<!--##=sPageObj##-->->GrandMx[<!--##=k##-->]; // Load MAX
  1090. <!--## End If ##-->
  1091. $<!--##=sTblVar##-->->RowTotalSubType = EWRPT_ROWTOTAL_<!--##=UCase(arrSmry(j,0))##-->;
  1092. <!--##
  1093. End If
  1094. Next
  1095. ##-->
  1096. $<!--##=sTblVar##-->->RowAttrs["class"] = "ewRptGrandSummary";
  1097. $<!--##=sPageObj##-->->RenderRow();
  1098. ?>
  1099. <tr<?php echo $<!--##=sTblVar##-->->RowAttributes(); ?>>
  1100. <!--##
  1101. If nGrps > 0 Then
  1102. ##-->
  1103. <td colspan="<!--##=nGrps##-->" class="ewRptGrpAggregate"><!--##=SummaryCaption(arrSmry(j,0))##--></td>
  1104. <!--##
  1105. End If
  1106. ##-->
  1107. <!--##
  1108. For k = 1 to nDtls
  1109. sFldName = arrDtlFlds(0,k-1)
  1110. sFldVar = arrDtlFlds(1,k-1)
  1111. SetupFldVar()
  1112. If arrSmry(j,k+1) Then
  1113. Set FIELD = TABLE.Fields(sFldName)
  1114. If nGrps = 0 Then
  1115. sSmryCaption = SummaryCaption(arrSmry(j,0))
  1116. Else
  1117. sSmryCaption = ""
  1118. End If
  1119. If sSmryCaption <> "" Then sSmryCaption = sSmryCaption & "<?php echo $ReportLanguage->Phrase(""RptSeparator""); ?>"
  1120. ##-->
  1121. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>><!--##=sSmryCaption##--><!--##=SYSTEMFUNCTIONS.FieldSummaryView(arrSmry(j,0))##--></td>
  1122. <!--##
  1123. Else
  1124. ##-->
  1125. <td<?php echo $<!--##=sFldObj##-->->CellAttributes() ?>>&nbsp;</td>
  1126. <!--##
  1127. End If
  1128. Next
  1129. ##-->
  1130. </tr>
  1131. <!--##
  1132. End If
  1133. Next
  1134. ##-->
  1135. <!--## End If ' End Summary/Detail view ##-->
  1136. <?php } ?>
  1137. <!--## End If ##-->
  1138. </tfoot>
  1139. </table>
  1140. <!--##=sSkipPdfExpStart##-->
  1141. </div>
  1142. <!--##=sSkipPdfExpEnd##-->
  1143. <!--## If bBottomPageLink Then ##-->
  1144. <!--## If bTopPageLink Then ##-->
  1145. <?php if ($<!--##=sPageObj##-->->TotalGrps > 0) { ?>
  1146. <!--## End If ##-->
  1147. <!--##=sExpStart##-->
  1148. <div class="ewGridLowerPanel">
  1149. <!--##include rpt-pager.php/phppager##-->
  1150. </div>
  1151. <!--##=sExpEnd##-->
  1152. <!--## If bTopPageLink Then ##-->
  1153. <?php } ?>
  1154. <!--## End If ##-->
  1155. <!--## End If ##-->
  1156. <!--##=sSkipPdfExpStart##-->
  1157. </td></tr></table>
  1158. </div>
  1159. <!--##=sSkipPdfExpEnd##-->
  1160. <!-- Summary Report Ends -->
  1161. <!--## End If ' End Show Report ##-->
  1162. <!--##=sChartExpStart##-->
  1163. </div><br /></td>
  1164. <!-- Center Container - Report (End) -->
  1165. <!-- Right Container (Begin) -->
  1166. <!--##
  1167. CurCellPadding = ""
  1168. If ew_ChartCount(3) > 0 Then CurCellPadding = " class=""ewPadding"""
  1169. ##-->
  1170. <td style="vertical-align: top;"<!--##=CurCellPadding##-->><div id="ewRight" class="phpreportmaker">
  1171. <!-- Right slot -->
  1172. <!--##
  1173. ' Generate charts (on right)
  1174. For i = 1 to TABLE.Charts.Count
  1175. Set CHART = TABLE.Charts.Seq(i)
  1176. If IsShowChart(CHART) And CHART.ChartPosition = 3 Then
  1177. sChartVar = CHART.ChartVar
  1178. sChartId = sChartVar
  1179. If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
  1180. ##-->
  1181. <a name="cht_<!--##=sChartId##-->"></a>
  1182. <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
  1183. <!--##include rpt-chartcommon.php/chart_common##-->
  1184. <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
  1185. <!--##include rpt-chartcommon.php/chart_config##-->
  1186. <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
  1187. <!--##include rpt-chartcommon.php/chart_content##-->
  1188. <br /><br />
  1189. <!--##
  1190. End If
  1191. Next
  1192. ##-->
  1193. </div></td>
  1194. <!-- Right Container (End) -->
  1195. </tr>
  1196. <!-- Bottom Container (Begin) -->
  1197. <!--##
  1198. CurCellPadding = ""
  1199. If ew_ChartCount(4) > 0 Then CurCellPadding = " class=""ewPadding"""
  1200. ##-->
  1201. <tr><td colspan="3"<!--##=CurCellPadding##-->><div id="ewBottom" class="phpreportmaker">
  1202. <!-- Bottom slot -->
  1203. <!--##
  1204. ' Generate charts (on bottom)
  1205. For i = 1 to TABLE.Charts.Count
  1206. Set CHART = TABLE.Charts.Seq(i)
  1207. If IsShowChart(CHART) And CHART.ChartPosition = 4 Then
  1208. sChartVar = CHART.ChartVar
  1209. sChartId = sChartVar
  1210. If PROJ.OutputNameLCase Then sChartId = LCase(sChartId)
  1211. ##-->
  1212. <a name="cht_<!--##=sChartId##-->"></a>
  1213. <div id="div_<!--##=sTblVar##-->_<!--##=sChartVar##-->"></div>
  1214. <!--##include rpt-chartcommon.php/chart_common##-->
  1215. <!--##include rpt-chartcommon-ext.php/chart_common_ext##-->
  1216. <!--##include rpt-chartcommon.php/chart_config##-->
  1217. <!--##include rpt-chartcommon-ext.php/chart_config_ext##-->
  1218. <!--##include rpt-chartcommon.php/chart_content##-->
  1219. <!--##=sChartSkipEmailExpStart##-->
  1220. <a href="#top"><!--##@Top##--></a>
  1221. <!--##=sChartSkipEmailExpEnd##-->
  1222. <br /><br />
  1223. <!--##
  1224. End If
  1225. Next
  1226. ##-->
  1227. </div><br /></td></tr>
  1228. <!-- Bottom Container (End) -->
  1229. </table>
  1230. <!-- Table Container (End) -->
  1231. <!--##=sChartExpEnd##-->
  1232. <!--##include rpt-phpcommon.php/footer-message##-->
  1233. <?php
  1234. // Close recordsets
  1235. if ($rsgrp) $rsgrp->Close();
  1236. if ($rs) $rs->Close();
  1237. ?>
  1238. <!--##/session##-->
  1239. <?php
  1240. <!--##session phpfunction##-->
  1241. <!--## If nGrps > 0 Then ##-->
  1242. // Check level break
  1243. function ChkLvlBreak($lvl) {
  1244. global $<!--##=sTblVar##-->;
  1245. switch ($lvl) {
  1246. <!--##
  1247. For i = 0 to nGrps-1
  1248. sFldVar = arrGrpFlds(1,i)
  1249. SetupFldVar()
  1250. If i > 0 Then
  1251. sChk = " || $this->ChkLvlBreak(" & i & "); // Recurse upper level"
  1252. Else
  1253. sChk = ";"
  1254. End If
  1255. fld = "$" & sFldObj & "->CurrentValue"
  1256. oldfld = "$" & sFldObj & "->OldValue"
  1257. grpfld = "$" & sFldObj & "->GroupValue()"
  1258. grpoldfld = "$" & sFldObj & "->GroupOldValue()"
  1259. ##-->
  1260. case <!--##=i+1##-->:
  1261. return (is_null(<!--##=fld##-->) && !is_null(<!--##=oldfld##-->)) ||
  1262. (!is_null(<!--##=fld##-->) && is_null(<!--##=oldfld##-->)) ||
  1263. (<!--##=grpfld##--> <> <!--##=grpoldfld##-->)<!--##=sChk##-->
  1264. <!--##
  1265. Next
  1266. ##-->
  1267. }
  1268. }
  1269. <!--## End If ##-->
  1270. // Accummulate summary
  1271. function AccumulateSummary() {
  1272. $cntx = count($this->Smry);
  1273. for ($ix = 0; $ix < $cntx; $ix++) {
  1274. $cnty = count($this->Smry[$ix]);
  1275. for ($iy = 1; $iy < $cnty; $iy++) {
  1276. $this->Cnt[$ix][$iy]++;
  1277. if ($this->Col[$iy]) {
  1278. $valwrk = $this->Val[$iy];
  1279. if (is_null($valwrk) || !is_numeric($valwrk)) {
  1280. // skip
  1281. } else {
  1282. $this->Smry[$ix][$iy] += $valwrk;
  1283. if (is_null($this->Mn[$ix][$iy])) {
  1284. $this->Mn[$ix][$iy] = $valwrk;
  1285. $this->Mx[$ix][$iy] = $valwrk;
  1286. } else {
  1287. if ($this->Mn[$ix][$iy] > $valwrk) $this->Mn[$ix][$iy] = $valwrk;
  1288. if ($this->Mx[$ix][$iy] < $valwrk) $this->Mx[$ix][$iy] = $valwrk;
  1289. }
  1290. }
  1291. }
  1292. }
  1293. }
  1294. $cntx = count($this->Smry);
  1295. for ($ix = 1; $ix < $cntx; $ix++) {
  1296. $this->Cnt[$ix][0]++;
  1297. }
  1298. }
  1299. // Reset level summary
  1300. function ResetLevelSummary($lvl) {
  1301. // Clear summary values
  1302. $cntx = count($this->Smry);
  1303. for ($ix = $lvl; $ix < $cntx; $ix++) {
  1304. $cnty = count($this->Smry[$ix]);
  1305. for ($iy = 1; $iy < $cnty; $iy++) {
  1306. $this->Cnt[$ix][$iy] = 0;
  1307. if ($this->Col[$iy]) {
  1308. $this->Smry[$ix][$iy] = 0;
  1309. $this->Mn[$ix][$iy] = NULL;
  1310. $this->Mx[$ix][$iy] = NULL;
  1311. }
  1312. }
  1313. }
  1314. $cntx = count($this->Smry);
  1315. for ($ix = $lvl; $ix < $cntx; $ix++) {
  1316. $this->Cnt[$ix][0] = 0;
  1317. }
  1318. // Reset record count
  1319. $this->RecCount = 0;
  1320. }
  1321. // Accummulate grand summary
  1322. function AccumulateGrandSummary() {
  1323. $this->Cnt[0][0]++;
  1324. $cntgs = count($this->GrandSmry);
  1325. for ($iy = 1; $iy < $cntgs; $iy++) {
  1326. if ($this->Col[$iy]) {
  1327. $valwrk = $this->Val[$iy];
  1328. if (is_null($valwrk) || !is_numeric($valwrk)) {
  1329. // skip
  1330. } else {
  1331. $this->GrandSmry[$iy] += $valwrk;
  1332. if (is_null($this->GrandMn[$iy])) {
  1333. $this->GrandMn[$iy] = $valwrk;
  1334. $this->GrandMx[$iy] = $valwrk;
  1335. } else {
  1336. if ($this->GrandMn[$iy] > $valwrk) $this->GrandMn[$iy] = $valwrk;
  1337. if ($this->GrandMx[$iy] < $valwrk) $this->GrandMx[$iy] = $valwrk;
  1338. }
  1339. }
  1340. }
  1341. }
  1342. }
  1343. <!--## If nGrps > 0 Then ##-->
  1344. // Get group count
  1345. function GetGrpCnt($sql) {
  1346. global $conn;
  1347. global $<!--##=sTblVar##-->;
  1348. $rsgrpcnt = $conn->Execute($sql);
  1349. $grpcnt = ($rsgrpcnt) ? $rsgrpcnt->RecordCount() : 0;
  1350. if ($rsgrpcnt) $rsgrpcnt->Close();
  1351. return $grpcnt;
  1352. }
  1353. // Get group rs
  1354. function GetGrpRs($sql, $start, $grps) {
  1355. global $conn;
  1356. global $<!--##=sTblVar##-->;
  1357. $wrksql = $sql;
  1358. <!--## If bDBMySql Or bDBPostgreSql Then ##-->
  1359. if ($start > 0 && $grps > -1)
  1360. <!--## If bDBMySql Then ##-->
  1361. $wrksql .= " LIMIT " . ($start-1) . ", " . ($grps);
  1362. <!--## ElseIf bDBPostgreSql Then ##-->
  1363. $wrksql .= " LIMIT " . ($grps) . " OFFSET " . ($start-1);
  1364. <!--## End If ##-->
  1365. <!--## End If ##-->
  1366. $rswrk = $conn->Execute($wrksql);
  1367. <!--## If Not (bDBMySql Or bDBPostgreSql) Then ##-->
  1368. if ($start > 1)
  1369. $rswrk->Move($start - 1);
  1370. <!--## End If ##-->
  1371. return $rswrk;
  1372. }
  1373. // Get group row values
  1374. function GetGrpRow($opt) {
  1375. global $rsgrp;
  1376. global $<!--##=sTblVar##-->;
  1377. if (!$rsgrp)
  1378. return;
  1379. if ($opt == 1) { // Get first group
  1380. //$rsgrp->MoveFirst(); // NOTE: no need to move position
  1381. $<!--##=sFirstGrpFldObj##-->->setDbValue(""); // Init first value
  1382. } else { // Get next group
  1383. $rsgrp->MoveNext();
  1384. }
  1385. if (!$rsgrp->EOF)
  1386. $<!--##=sFirstGrpFldObj##-->->setDbValue($rsgrp->fields[0]);
  1387. if ($rsgrp->EOF) {
  1388. $<!--##=sFirstGrpFldObj##-->->setDbValue("");
  1389. }
  1390. }
  1391. <!--## Else ##-->
  1392. // Get count
  1393. function GetCnt($sql) {
  1394. global $conn;
  1395. $rscnt = $conn->Execute($sql);
  1396. $cnt = ($rscnt) ? $rscnt->RecordCount() : 0;
  1397. if ($rscnt) $rscnt->Close();
  1398. return $cnt;
  1399. }
  1400. // Get rs
  1401. function GetRs($sql, $start, $grps) {
  1402. global $conn;
  1403. $wrksql = $sql;
  1404. <!--## If bDBMySql Or bDBPostgreSql Then ##-->
  1405. if ($start > 0 && $grps > -1)
  1406. <!--## If bDBMySql Then ##-->
  1407. $wrksql .= " LIMIT " . ($start-1) . ", " . ($grps);
  1408. <!--## ElseIf bDBPostgreSql Then ##-->
  1409. $wrksql .= " LIMIT " . ($grps) . " OFFSET " . ($start-1);

Large files files are truncated, but you can click here to view the full file