</td>
         <td class="enpRptLabel">
            Activity
         </td>
         <td class="enpRptLabel">
            Duration
         </td>
      </tr>');
$sngDuration = 0.0;
foreach ($pvInfo as $pvRec) {
    $lVisitID = $pvRec->pvRecID;
    $strDuration = pvisit\strMinutesToHoursMin($pvRec->lDuration, true);
    $sngDuration += $pvRec->lDuration;
    echoT('
         <tr class="makeStripe">
            <td class="enpRpt">' . str_pad($lVisitID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_PVisit($lVisitID, 'View patient visit record', true) . '
            </td>
            <td class="enpRpt">' . date('m/d/Y', $pvRec->dteDOV) . '
            </td>
            <td class="enpRpt">' . htmlspecialchars($pvRec->strVolLName . ', ' . $pvRec->strVolFName) . '<br>' . $pvRec->strVolAddress . '
            </td>
            <td class="enpRpt">' . htmlspecialchars($pvRec->strPatientLName . ', ' . $pvRec->strPatientFName) . '<br>' . $pvRec->strPatientAddress . '
            </td>
            <td class="enpRpt">' . htmlspecialchars($pvRec->strLocation) . '
            </td>
            <td class="enpRpt">' . htmlspecialchars($pvRec->strActivity) . '
            </td>
            <td class="enpRpt">' . $strDuration . '
            </td>
         </tr>');
}
function showPatientVisits($attributes, $clsRpt, $patient, $lPatientID, $lNumPVRecs, $pVisits)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $attributes->bCloseDiv = false;
    $attributes->divID = 'pVisits';
    $attributes->divImageID = 'pVisitsDivImg';
    openBlock('Patient Visits', '', $attributes);
    if ($lNumPVRecs == 0) {
        echoT('<i>No visits have been recorded for this patient.</i>');
    } else {
        echoT('
            <table class="enpRpt">
               <tr>
                  <td class="enpRptLabel">
                     visit ID
                  </td>
                  <td class="enpRptLabel">
                     Date of Visit
                  </td>
                  <td class="enpRptLabel">
                     Volunteer
                  </td>
                  <td class="enpRptLabel">
                     Location
                  </td>
                  <td class="enpRptLabel">
                     Activity
                  </td>
               </tr>');
        foreach ($pVisits as $pV) {
            $lVisitID = $pV->lKeyID;
            $lVolID = $pV->lVolID;
            echoT('
                  <tr class="makeStripe">
                     <td class="enpRpt" style="text-align: center;">' . str_pad($lVisitID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_PVisit($lVisitID, 'View visit record', true) . '
                     </td>
                     <td class="enpRpt" style="text-align: center;">' . date('D m/d/Y', $pV->dteVisit) . '
                     </td>
                     <td class="enpRpt">' . strLinkView_VolRecord($lVolID, 'View volunteer record', true) . '&nbsp;' . htmlspecialchars($pV->strVolLName . ', ' . $pV->strVolFName) . '
                     </td>
                     <td class="enpRpt">' . htmlspecialchars($pV->strLocation) . '
                     </td>
                     <td class="enpRpt">' . htmlspecialchars($pV->strActivity) . '
                     </td>
                  </tr>');
        }
        echoT('
            </table>');
    }
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
function showPVisitInfo($pVisits)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    echoT('
         <td class="enpRpt" style="width: 270pt; vertical-align: top;">');
    if (count($pVisits) == 0) {
        echoT('<i>No patient visits</i>');
    } else {
        foreach ($pVisits as $pV) {
            $lVisitID = $pV->pvRecID;
            echoT('<table width="100%" cellpadding="0" style="border: 1px solid #ccc; margin-bottom: 5px;">');
            echoT('
               <tr>
                  <td style="width: 60pt; vertical-align: top;">
                     <b>Volunteer:</b>
                  </td>
                  <td>' . htmlspecialchars($pV->strVolLName . ', ' . $pV->strVolFName) . '
                  </td>
               </tr>');
            echoT('
               <tr>
                  <td style="width: 60pt; vertical-align: top;">
                     <b>Date of Visit:</b>
                  </td>
                  <td>' . date('m/d/Y', $pV->dteDOV) . '&nbsp;' . strLinkView_PVisit($lVisitID, 'Patient Visit', true) . '
                  </td>
               </tr>');
            echoT('
               <tr>
                  <td style="width: 60pt; vertical-align: top;">
                     <b>Location:</b>
                  </td>
                  <td>' . htmlspecialchars($pV->strLocation) . '
                  </td>
               </tr>');
            echoT('
               <tr>
                  <td style="width: 60pt; vertical-align: top;">
                     <b>Activity:</b>
                  </td>
                  <td>' . htmlspecialchars($pV->strActivity) . '
                  </td>
               </tr>');
            echoT('
               <tr>
                  <td style="width: 60pt; vertical-align: top;">
                     <b>Duration:</b>
                  </td>
                  <td>' . number_format($pV->lDuration / 60, 2) . ' hrs
                  </td>
               </tr>');
            echoT('</table>');
        }
    }
    echoT('</td>' . "\n");
}
function displayPatientVisits(&$pVisits, &$displayFields, $strVolSafeName)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    echoT('<br>
         <table class="enpRptC">
            <tr>
               <td class="enpRptTitle" colspan="10">
                  Patient Visits by volunteer ' . $strVolSafeName . '
               </td>
            </tr>
            <tr>
               <td class="enpRptLabel">&nbsp;</td>
               <td class="enpRptLabel">Patient</td>
               <td class="enpRptLabel">Date / Time of Visit</td>
               <td class="enpRptLabel">Person Served</td>
               <td class="enpRptLabel">Activity</td>
               <td class="enpRptLabel">Interventions</td>
               <td class="enpRptLabel">Visit Info</td>
            </tr>');
    foreach ($pVisits as $pV) {
        // visit info
        $strVI = 'For this visit, the patient was' . strMultiDDL2UL($pV->status) . 'During my visit, I' . strMultiDDL2UL($pV->tasks);
        $lVisitID = $pV->lKeyID;
        $strDateOfVisit = date('l, F jS, Y', $pV->dteVisit) . '<br>' . date('g:i A', $pV->lStartTime) . ' / ' . pvisit\strMinutesToHoursMin($pV->lDuration);
        $strPS = '<ul style="margin-top: 0px; margin-left: -25px; margin-bottom: 0px;">' . "\n";
        $strPS .= strAddListElement($pV->ps_bPatient, 'Patient');
        $strPS .= strAddListElement($pV->ps_bCaregiver, 'Caregiver');
        $strPS .= strAddListElement($pV->ps_bBereaved, 'Bereaved');
        $strPS .= strAddListElement($pV->ps_bOther, 'Other');
        $strPS .= '</ul>' . "\n";
        if ($pV->ps_strNotes != '') {
            $strPS .= nl2br(htmlspecialchars($pV->ps_strNotes));
        }
        // activity
        $strAct = htmlspecialchars($pV->strActivity);
        if ($pV->act_strNotes != '') {
            $strAct .= '<br>' . nl2br(htmlspecialchars($pV->act_strNotes));
        }
        // intervention
        $strInt = '<ul style="margin-top: 0px; margin-left: -25px; margin-bottom: 0px;">' . "\n";
        $strInt .= strAddListElement($pV->in_bCompanionship, 'Companionship');
        $strInt .= strAddListElement($pV->in_bCaregiverRelief, 'Caregiver Relief');
        $strInt .= strAddListElement($pV->in_bEmotionalSupport, 'Emotional Support');
        $strInt .= strAddListElement($pV->in_bSocialization, 'Socialization');
        $strInt .= strAddListElement($pV->in_bBereavement, 'Bereavement');
        $strInt .= strAddListElement($pV->in_bTelephoneCall, 'Telephone Call');
        $strInt .= strAddListElement($pV->in_bExcursionErrands, 'Excursions / Errands');
        $strInt .= strAddListElement($pV->in_bMusicPetArt, 'Music / Pet / Art');
        $strInt .= strAddListElement($pV->in_bFoodPrep, 'Food Preparation');
        $strInt .= strAddListElement($pV->in_bHouseholdChores, 'Household Chores');
        $strInt .= strAddListElement($pV->in_bOther, 'Other');
        $strInt .= '</ul>' . "\n";
        if ($pV->in_strNotes != '') {
            $strInt .= nl2br(htmlspecialchars($pV->in_strNotes));
        }
        echoT('
            <tr class="makeStripe">
               <td class="enpRpt" style="text-align: center;">' . str_pad($lVisitID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_PVisit($lVisitID, 'View patient visit record', true, 'id="pv' . $lVisitID . '"') . '
               </td>
               <td class="enpRpt" style="width: 100pt;">' . htmlspecialchars($pV->strPatientLName . ', ' . $pV->strPatientFName) . '
               </td>
               <td class="enpRpt">' . $strDateOfVisit . '</td>
               <td class="enpRpt">' . $strPS . '</td>
               <td class="enpRpt">' . $strAct . '</td>
               <td class="enpRpt">' . $strInt . '</td>
               <td class="enpRpt" style="width: 210pt;">' . $strVI . '</td>

         ');
    }
    echoT('</table><br><br>');
}