function showCProgARecFields(&$clsRpt, &$cprog, &$arec)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $genumDateFormat;
    echoT($clsRpt->openRow() . $clsRpt->writeLabel($cprog->strSafeEnrollLabel . ' Record:') . $clsRpt->writeCell(str_pad($arec->lEnrollID, 5, '0', STR_PAD_LEFT) . ' ' . strLinkView_CProgEnrollRec($cprog->lEnrollmentTableID, $arec->lClientID, $arec->lEnrollID, 'View enrollment record', true)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Attendance Log:') . $clsRpt->writeCell(strLinkView_CProgAttendanceViaCID($cprog->lAttendanceTableID, $arec->lEnrollID, $arec->lClientID, 'View attendance records', true) . ' ' . strLinkView_CProgAttendanceViaCID($cprog->lAttendanceTableID, $arec->lEnrollID, $arec->lClientID, 'View attendance records', false)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Attendance Date:') . $clsRpt->writeCell(date($genumDateFormat, $arec->dteAttendance)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Duration:') . $clsRpt->writeCell(number_format($arec->dDuration, 2)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Case Notes:') . $clsRpt->writeCell(nl2br(htmlspecialchars($arec->strCaseNotes))) . $clsRpt->closeRow());
}
function strEnrollmentTable(&$cprog, $lCID, $lNumEnrollments, $erecs)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $genumDateFormat;
    $lATableID = $cprog->lAttendanceTableID;
    if ($lNumEnrollments == 0) {
        return '<i>No enrollments</i>';
    }
    $strOut = '<table class="enpRpt" width="100%">
            <tr>
               <td class="enpRptLabel" style="background-color: #e6e6e6; 
                        vertical-align: middle; text-align: center; width: 120pt;" rowspan="2">
                  ' . $cprog->strSafeEnrollLabel . ' Dates
               </td>
               <td class="enpRptLabel" style="background-color: #e6e6e6; 
                         vertical-align: middle; text-align: center; width: 40pt;" rowspan="2">
                  Active?
               </td>
               <td class="enpRptLabel" style="background-color: #e6e6e6; text-align: center;" colspan="2">
                  ' . $cprog->strSafeAttendLabel . '
               </td>
            </tr>
            <tr>
               <td class="enpRptLabel" style="background-color: #e6e6e6; text-align: center;"">
                  # Days
               </td>
               <td class="enpRptLabel" style="background-color: #e6e6e6; text-align: center;"">
                  # Hours
               </td>
            </tr>';
    foreach ($erecs as $erec) {
        $eRecID = $erec->lKeyID;
        $strLinkERec = strLinkView_CProgEnrollRec($cprog->lEnrollmentTableID, $lCID, $eRecID, 'View enrollment record', true);
        if (is_null($erec->dteEnd) || $erec->dteEnd == 0) {
            $strDateEnd = 'ongoing';
        } else {
            $strDateEnd = date($genumDateFormat, $erec->dteEnd);
        }
        if (isset($erec->strFlagsTable)) {
            $strCFlags = '&nbsp;' . $erec->strFlagsTable;
        } else {
            $strCFlags = '';
        }
        $strOut .= '
               <tr>
                  <td class="enpRpt">' . $strLinkERec . '&nbsp;' . date($genumDateFormat, $erec->dteStart) . ' - ' . $strDateEnd . $strCFlags . '
                  </td>
                  <td class="enpRpt" style="text-align: center;">' . ($erec->bCurrentlyEnrolled ? 'Yes' : 'No') . '
                  </td>
                  <td class="enpRpt" style="text-align: center;">' . $erec->lNumDaysAttended . '
                  </td>
                  <td class="enpRpt" style="text-align: center;">' . number_format($erec->sngNumHours, 2) . '&nbsp;' . strLinkView_CProgAttendanceViaCID($lATableID, $eRecID, $lCID, 'View attendance', true) . '
                  </td>
               </tr>';
    }
    $strOut .= '</table>';
    return $strOut;
}