function writeSingleICatRow($icat, $strIndent, $bShowLinks, $enumReportType)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $lICatID = $icat->lKeyID;
    $bTop = $strIndent == '';
    if ($bShowLinks) {
        if ($icat->lNumItems == 0 && $icat->lNumChildren == 0) {
            $strLinkRemCat = strLinkRem_ICat($lICatID, 'Remove inventory category', true, true);
        } else {
            $strLinkRemCat = strCantDelete('A category can only be removed if there are no sub-categories and no associated items');
        }
        $strLinkEditCat = strLinkEdit_InventoryCat($lICatID, 'Edit inventory category', true);
    } else {
        $strLinkRemCat = '';
        $strLinkEditCat = '';
    }
    $strItems = '';
    if ($icat->lNumItems > 0) {
        $strItems = strLinkView_InventoryItemsByCat($lICatID, $enumReportType, 'View items', true);
    }
    if ($bShowLinks) {
        $strItems .= '  ' . strLinkAdd_InventoryItem($lICatID, 'Add item', true);
    }
    echoT('
         <tr class="makeStripe">
            <td class="enpRpt" style="text-align: center; width: 60px;">' . str_pad($lICatID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . $strLinkEditCat . '
            </td>
            <td class="enpRpt" style="text-align: center; width: 30px;">' . $strLinkRemCat . '
            </td>
            <td class="enpRpt" style="width: 180pt; ' . ($bTop ? 'font-weight: bold;' : '') . '">' . '<span style="color: gray;">' . $strIndent . '</span>&nbsp;' . htmlspecialchars($icat->strCatName) . '
            </td>
            <td class="enpRpt" style="text-align: center; width: 80px;">' . $icat->lNumItems . $strItems . '
            </td>
            <td class="enpRpt" style="text-align: left;">' . nl2br(htmlspecialchars($icat->strNotes)) . '
            </td>
         </tr>');
}
function htmlVocList($bShowEditLink, $clsVocs, $bCenterTable = true)
{
    //---------------------------------------------------------------------
    // user must call $this->loadClientVocabulary prior to this call
    //---------------------------------------------------------------------
    $strVocTable = '
         <table class="enpRpt' . ($bCenterTable ? 'C' : '') . '">
            <tr>
               <td class="enpRptLabel" rowspan="2" style="vertical-align:bottom;">
                  Vocabulary ID
               </td>';
    if ($bShowEditLink) {
        $strVocTable .= '
               <td class="enpRptLabel" rowspan="2" style="vertical-align:bottom;">
                  &nbsp;&nbsp;&nbsp;&nbsp;
               </td>';
    }
    $strVocTable .= '
               <td class="enpRptLabel" rowspan="2" style="vertical-align:bottom;">
                  Name
               </td>
               <td class="enpRptLabel" colspan="6" style="text-align: center">
                  Vocabulary
               </td>
            </tr>
            <tr>
               <td class="enpRptLabel">
                  Sponsor <font style="font-weight: normal;">(s)</font>
               </td>
               <td class="enpRptLabel">
                  Sponsor <font style="font-weight: normal;">(p)</font>
               </td>
               <td class="enpRptLabel">
                  Client <font style="font-weight: normal;">(s)</font>
               </td>
               <td class="enpRptLabel">
                  Client <font style="font-weight: normal;">(p)</font>
               </td>
               <td class="enpRptLabel">
                  Location <font style="font-weight: normal;">(s)</font>
               </td>
               <td class="enpRptLabel">
                  Location <font style="font-weight: normal;">(p)</font>
               </td>
            </tr>';
    foreach ($clsVocs as $clsVoc) {
        if (!$clsVoc->bRetired) {
            $lKeyID = $clsVoc->lKeyID;
            if ($clsVoc->bProtected || !$bShowEditLink) {
                $strLinkEdit = '';
                if ($bShowEditLink) {
                    $strRemRow = '<td class="enpRpt">' . strCantDelete('Default vocabulary can\'t be removed') . '</td>';
                } else {
                    $strRemRow = '';
                }
            } else {
                $strLinkEdit = strLinkEdit_ClientVoc($lKeyID, 'Edit client vocabulary', true);
                $strRemRow = '<td class="enpRpt">' . strLinkRem_ClientVoc($lKeyID, 'Remove client vocabulary', true, true) . '</td>';
            }
            $strVocTable .= '
               <tr class="makeStripe">
                  <td class="enpRpt" style="text-align: center;">' . $strLinkEdit . ' ' . str_pad($lKeyID, 5, '0', STR_PAD_LEFT) . '
                  </td>' . $strRemRow . '<td class="enpRpt" style="text-align: left;">' . htmlspecialchars($clsVoc->strVocTitle) . '
                  </td>

                  <td class="enpRpt">' . htmlspecialchars($clsVoc->strSponsorS) . '
                  </td>
                  <td class="enpRpt">' . htmlspecialchars($clsVoc->strSponsorP) . '
                  </td>
                  <td class="enpRpt">' . htmlspecialchars($clsVoc->strClientS) . '
                  </td>
                  <td class="enpRpt">' . htmlspecialchars($clsVoc->strClientP) . '
                  </td>
                  <td class="enpRpt">' . htmlspecialchars($clsVoc->strLocS) . '
                  </td>
                  <td class="enpRpt">' . htmlspecialchars($clsVoc->strLocP) . '
                  </td>
               </tr>';
        }
    }
    $strVocTable .= '</table>';
    return $strVocTable;
}
   </tr>
   <tr>
      <td class="enpRptLabel" colspan="2">
         &nbsp;
      </td>
      <td class="enpRptLabel">
         List Item
      </td>
   </tr>
<?php 
    foreach ($listItems as $clsItem) {
        $lListID = $clsItem->lKeyID;
        $strListItem = $clsItem->strListItem;
        if ($strListItem == $strBlockEdit) {
            $strLinkEdit = '&nbsp;';
            $strLinkRem = strCantDelete('Default entry can\'t be removed');
        } else {
            $strLinkEdit = strLinkEdit_GenericListItem($lListID, $strListType, 'edit', true);
            $strLinkRem = strLinkRem_GenericListItem($lListID, $strListType, 'Remove list item', true, true);
        }
        echoT('<tr>
                    <td class="enpRpt" align="center">' . $strLinkEdit . '
                    </td>
                    <td class="enpRpt" align="center">' . $strLinkRem . '
                    </td>
                    <td class="enpRpt" align="left" width="300">' . htmlspecialchars($clsItem->strListItem) . '
                    </td>
                </tr>');
    }
    echoT('</table><br>');
}
            <td class="enpRptLabel" >
               Commitment
            </td>
            <td class="enpRptLabel" >
               ACO
            </td>
            <td class="enpRptLabel" >
               # Sponsors
            </td>
         </tr>
         ');
 foreach ($sponProg as $clsSingleCat) {
     $lSPID = $clsSingleCat->lSPID;
     // don't remove basic sponsorship
     if ($lSPID == 1) {
         $strRem = strCantDelete('Basic sponsorship can\'t be removed.');
     } else {
         $strRem = strLinkRem_SponProg($lSPID, 'Retire sponsorship program', true, true);
     }
     echoT('
         <tr>
            <td class="enpRpt" style="text-align: center;">' . strLinkEdit_SponProg($lSPID, 'Edit sponsorship program', true) . ' ' . str_pad($lSPID, 5, '0', STR_PAD_LEFT) . '
            </td>
            <td class="enpRpt"  style="text-align: center;">' . $strRem . ' 
            </td>
            
            <td class="enpRpt">' . htmlspecialchars($clsSingleCat->strProg) . '
            </td>
            <td class="enpRpt" style="text-align: right;">' . $clsSingleCat->strCurrencySymbol . ' ' . number_format($clsSingleCat->curDefMonthlyCommit, 2) . '
            </td>
            <td class="enpRpt" style="text-align: center;">' . $clsSingleCat->strFlagImg . '
         <td class="enpRptLabel">
            Contact Info
         </td>
         <td class="enpRptLabel" style="width: 200pt;">
            Notes
         </td>
      </tr>');
foreach ($locations as $loc) {
    $lLocID = $loc->lKeyID;
    $bActive = $loc->bActive;
    $strLabel = $bActive ? 'Set Inactive' : 'Set Active';
    $bAllowDelete = $loc->lNumPatients + $loc->lNumVolMgrs + $loc->lNumVols == 0;
    if ($bAllowDelete) {
        $strDelLink = strLinkRem_Location($lLocID, 'Remove location', true, true, '');
    } else {
        $strDelLink = strCantDelete('To remove this location, you must first remove the location\'s patients, volunteers, and volunteer managers.');
        //'<img src="'.base_url().'images/misc/'.IMGLINK_NODELETE.'">';
    }
    if ($bActive) {
        $strColor = '#000';
        if ($lNumActive > 1) {
            $strLinkActInAct = strLink_LocActiveInactive($lLocID, !$bActive, $strLabel, true);
        } else {
            $strLinkActInAct = '&nbsp;';
        }
    } else {
        $strLinkActInAct = strLink_LocActiveInactive($lLocID, !$bActive, $strLabel, true);
        $strColor = '#999';
    }
    echoT('
         <tr class="makeStripe">
function strClientStatusCatTable(&$statCats, &$statCatsEntries, $bShowLinks, $bCenterTable)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $lCols = $bShowLinks ? 5 : 4;
    $strOut = '<table class="enpRpt' . ($bCenterTable ? 'C' : '') . '">
            <tr>
               <td class="enpRptTitle" colspan="' . $lCols . '">
                  Client Status Categories
               </td>
            </tr>';
    $strOut .= '<tr>
               <td class="enpRptLabel" style="vertical-align: middle;">
                  Category ID
               </td>';
    if ($bShowLinks) {
        $strOut .= '<td class="enpRptLabel" style="vertical-align: middle;">
                  &nbsp;
               </td>';
    }
    $strOut .= '<td class="enpRptLabel" style="vertical-align: middle;">
                  Category
               </td>
               <td class="enpRptLabel" style="width: 200pt;">
                  Description
               </td>
               <td class="enpRptLabel" style="vertical-align: middle;">
                  Entries
               </td>
            </tr>';
    foreach ($statCats as $clsCat) {
        $lKeyID = $clsCat->lKeyID;
        if ($bShowLinks && !$clsCat->bProtected) {
            $strLinkEdit = strLinkEdit_ClientStatCat($lKeyID, 'Edit client status category', true) . ' ';
            $strLinkEntries = strLinkView_ClientStatEntries($lKeyID, 'View/edit/add entries', true) . ' ' . strLinkView_ClientStatEntries($lKeyID, 'View/edit/add entries', false);
            $strLinkRemove = strLinkRem_ClientCatEntry($lKeyID, 'Remove this status category', true, true);
        } else {
            $strLinkEdit = '';
            $strLinkEntries = '';
            $strLinkRemove = strCantDelete('Default category can not be removed');
        }
        $strOut .= '<tr class="makeStripe">
                  <td class="enpRpt" style="text-align: center; vertical-align: top;  width: 70pt;">' . $strLinkEdit . str_pad($lKeyID, 5, '0', STR_PAD_LEFT) . '
                  </td>';
        if ($bShowLinks) {
            $strOut .= '<td class="enpRpt" style="vertical-align: top;">' . $strLinkRemove . '
                  </td>';
        }
        $strOut .= '<td class="enpRpt" style="vertical-align: top;">' . htmlspecialchars($clsCat->strCatName) . '
                  </td>
                  <td class="enpRpt" style="vertical-align: top; width: 200pt;">' . nl2br(htmlspecialchars($clsCat->strDescription)) . '
                  </td>
                  <td class="enpRpt" style="text-align: left; vertical-align: top; width: 200pt;">';
        if (is_null($statCatsEntries[$lKeyID][0]->lKeyID)) {
            $strOut .= '<i>No entries</i><br>';
        } else {
            $strOut .= '<ul style="list-style-type: square; display:inline; margin-left: 0; padding: 0pt;">';
            foreach ($statCatsEntries[$lKeyID] as $clsE) {
                $strOut .= '<li style="margin-left: 20px;">' . htmlspecialchars($clsE->strStatusEntry) . '</li>';
            }
            $strOut .= '</ul>';
        }
        $strOut .= $strLinkEntries . '
                  </td>
               </tr>';
    }
    $strOut .= '</table>';
    return $strOut;
}
         </td>
         <td class="enpRptLabel">
           # Clients
         </td>
         <td class="enpRptLabel">
           # Sponsors
         </td>
         <td class="enpRptLabel">
           Allow<br>Medical Recs
         </td>
      </tr>
<?php 
foreach ($locations as $clsLoc) {
    $lCLID = $clsLoc->lKeyID;
    if ($clsLoc->lNumberClients > 0) {
        $strLinkRemove = strCantDelete('Location can\'t be removed until all clients are transfered');
    } else {
        $strLinkRemove = strLinkRem_ClientLocation($lCLID, 'Remove client location', true, true);
    }
    echoT('
              <tr class="makeStripe">
                 <td class="enpRpt" style="text-align: center; width: 60pt;">' . strLinkView_ClientLocation($lCLID, 'View client location', true, 'id="cLocView_' . $lCLID . '"') . ' ' . str_pad($lCLID, 5, '0', STR_PAD_LEFT) . '
                 </td>
                 <td class="enpRpt" style="text-align: center; width: 18pt;">' . $strLinkRemove . '
                 </td>
                 <td class="enpRpt" style=" width: 160pt;"><b>' . htmlspecialchars($clsLoc->strLocation) . '</b><br>');
    echoT($clsLoc->strSponProg);
    $lNumSponsors = $clsLoc->lNumSponsors;
    if ($lNumSponsors > 0) {
        $strLinkSpon = strLinkView_SponsorsViaLocProg($lCLID, 'View sponsors for this location', true);
    } else {