Patient
         </td>
         <td class="enpRptLabel">
            Location
         </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>
 function patientVisitsViaVolDetails($sqlWhereExtra, $strSort, &$lNumVolRecs, &$volRecs)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $volRecs = array();
     $lNumVolRecs = 0;
     $strFNDOV = 'pv_dteVisit';
     $strSort = " vol_strLName, vol_strFName, vol_lKeyID, {$strFNDOV} ";
     $sqlStr = $this->strSQLCommonPatientVisitDetails($sqlWhereExtra, $strSort);
     $query = $this->db->query($sqlStr);
     $numRecs = $query->num_rows();
     if ($numRecs > 0) {
         foreach ($query->result() as $row) {
             $lVID = (int) $row->vol_lKeyID;
             if (!isset($volRecs[$lVID])) {
                 $volRecs[$lVID] = new stdClass();
                 $this->loadPeopleInfo($volRecs[$lVID], $row);
                 $volRecs[$lVID]->pVisits = array();
                 ++$lNumVolRecs;
                 $idx = 0;
             }
             $volRecs[$lVID]->pVisits[$idx] = new stdClass();
             $vRec =& $volRecs[$lVID]->pVisits[$idx];
             $vRec->dteDOV = $row->dteDOV;
             $vRec->pvRecID = (int) $row->pvRecID;
             $vRec->lDuration = (int) $row->pv_lDuration;
             $vRec->strDuration = pvisit\strMinutesToHoursMin($vRec->lDuration);
             $vRec->strLocation = $row->strLocation;
             $vRec->strActivity = $row->strActivity;
             $this->loadPatientInfo($vRec, $row);
             ++$idx;
         }
     }
 }
function showGeneralPVisitInfo($attributes, $clsRpt, $pVisit)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $gbVolMgr;
    $attributes->bCloseDiv = false;
    $attributes->divID = 'pVGen';
    $attributes->divImageID = 'pVGenDivImg';
    openBlock('Visit', '', $attributes);
    echoT($clsRpt->openReport());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Visit ID:') . $clsRpt->writeCell(str_pad($pVisit->lKeyID, 5, '0', STR_PAD_LEFT)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Organization:') . $clsRpt->writeCell(htmlspecialchars($pVisit->strChapterName)) . $clsRpt->closeRow());
    if ($gbVolMgr) {
        $strViewPRec = strLinkView_PatientRecord($pVisit->lPatientID, 'View patient record', true);
        $strViewVRec = strLinkView_VolRecord($pVisit->lVolID, 'View volunteer record', true);
    } else {
        $strViewVRec = $strViewPRec = '';
    }
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Patient:') . $clsRpt->writeCell(htmlspecialchars($pVisit->strPatientLName . ', ' . $pVisit->strPatientFName) . '&nbsp;' . $strViewPRec) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Volunteer:') . $clsRpt->writeCell(htmlspecialchars($pVisit->strVolLName . ', ' . $pVisit->strVolFName) . '&nbsp;' . $strViewVRec) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Date of Visit:') . $clsRpt->writeCell(date('l, F jS, Y', $pVisit->dteVisit)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Time/Duration:') . $clsRpt->writeCell(date('g:i A', $pVisit->lStartTime) . '&nbsp;/&nbsp;' . pvisit\strMinutesToHoursMin($pVisit->lDuration)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Medical Record #:') . $clsRpt->writeCell(htmlspecialchars($pVisit->strMedRec)) . $clsRpt->closeRow());
    echoT($clsRpt->closeReport());
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
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>');
}