function executeItem($sSQL, $sCaption, $sAggregateBy) { $oDB = new dclDB(); if ($oDB->query($sSQL) != -1) { $oTable = CreateObject('dcl.htmlTable'); $oTable->setInline(true); $oTable->setCaption($sCaption); $oTable->addColumn($sAggregateBy, 'html'); $oTable->addColumn('Count', 'numeric'); $aData = array(); $iTotal = 0; $sFilterProduct = ''; if (isset($_REQUEST['products'])) { $aProducts = DCL_Sanitize::ToIntArray($_REQUEST['products']); if (count($aProducts) == 1) { $sFilterProduct = '&filterProduct=' . $aProducts[0]; } } while ($oDB->next_record()) { if ($sAggregateBy == STR_WO_STATUS) { array_push($aData, array('<a href="' . menuLink('', 'menuAction=htmlWorkorders.show&filterStatus=' . $oDB->f(0) . $sFilterProduct) . '">' . $oDB->f(1) . '</a>', $oDB->f(2))); } else { array_push($aData, array('<a href="' . menuLink('', 'menuAction=htmlWorkorders.show&filterPriority=' . $oDB->f(0) . $sFilterProduct) . '">' . $oDB->f(1) . '</a>', $oDB->f(2))); } $iTotal += $oDB->f(2); } $oTable->setData($aData); $oTable->addFooter('Total'); $oTable->addFooter($iTotal); $oTable->render(); } }