$attributes->bStartOpen = true;
$lVolID = $pVisit->lVolID;
$lPVRecID = $pVisit->lKeyID;
$lPatientID = $pVisit->lPatientID;
if ($gbVolMgr) {
    $strLinkRem = '        ' . strLinkRem_PVisit($lVolID, $lPVRecID, 'Remove', true, true) . ' ' . strLinkRem_PVisit($lVolID, $lPVRecID, 'Remove', false, true);
    $strLinkEdit = strLinkEdit_PVisit($lVolID, $lPVRecID, $lPatientID, true, 'Edit record', ' id="editURec_' . $lPVRecID . '" ') . ' ' . strLinkEdit_PVisit($lVolID, $lPVRecID, $lPatientID, false, 'Edit record', ' id="editURec1_' . $lPVRecID . '" ');
} else {
    $strLinkRem = $strLinkEdit = '';
}
openBlock('Patient Visit', $strLinkEdit . $strLinkRem);
showGeneralPVisitInfo($attributes, $clsRpt, $pVisit);
showPersonServed($attributes, $clsRpt, $pVisit);
showLocation($attributes, $clsRpt, $pVisit);
showActivity($attributes, $clsRpt, $pVisit);
showInterventions($attributes, $clsRpt, $pVisit);
showVisitDetails($attributes, $clsRpt, $pVisit);
showPVisitStats($attributes, $clsRpt, $pVisit);
closeBlock();
function showVisitDetails($attributes, $clsRpt, $pVisit)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $attributes->bCloseDiv = false;
    $attributes->divID = 'pVDet';
    $attributes->divImageID = 'pVDetDivImg';
    openBlock('Visit Details', '', $attributes);
    echoT($clsRpt->openReport());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('For this Visit, the Patient Was:') . $clsRpt->writeCell(strMultiDDL2UL($pVisit->status)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('During the Visit, the Volunteer:') . $clsRpt->writeCell(strMultiDDL2UL($pVisit->tasks)) . $clsRpt->closeRow());
echoT(form_open('hospice/patient_visit/addEditPatientVisit/' . $lVolID . '/' . $lPVRecID . '/' . $lPatientID, $attributes));
$clsForm = new generic_form();
$clsForm->strLabelClass = $clsForm->strLabelRowLabelClass = $clsForm->strLabelClassRequired = 'enpViewLabel';
$clsForm->strTitleClass = 'enpViewTitle';
$clsForm->strEntryClass = 'enpView';
$clsForm->bValueEscapeHTML = false;
openBlock(($bNew ? 'New ' : 'Update ') . 'Patient Visit', '');
echoT('<table class="enpView">');
echoT($clsForm->strLabelRow('patientID', $strPatientID, 1));
echoT($clsForm->strLabelRow('Patient', $patient->strSafeName, 1));
echoT($clsForm->strLabelRow('Visited By', $volRec->strSafeNameFL, 1));
showVisitBase($clsForm, $formData);
showPersonServed($clsForm, $formData);
showLocation($clsForm, $formData);
showActivity($clsForm, $formData);
showInterventions($clsForm, $formData);
showVisitInfo($clsForm, $formData);
echoT($clsForm->strSubmitEntry('Save', 1, 'cmdSubmit', 'text-align: center; width: 80pt;'));
echoT('</table>' . form_close());
closeBlock();
function showVisitInfo(&$clsForm, &$formData)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    echoT($clsForm->strTitleRow('Visit Information: <span style="font-size: 9pt;"><i>Check all that apply</i></span>', 2, 'font-size: 13pt; border-bottom: 2px solid #000; padding-top: 10px;'));
    $clsForm->strStyleExtraLabel = 'padding-top: 4px;';
    // Patient Status
    $clsForm->strExtraFieldText = '</td><td style="vertical-align: top;">When you made your visit,<br>the patient was...</td></tr></table>' . '<span style="font-size: 8pt;"><i>CTRL-Click to select more than one entry</span></i>' . form_error('ddlM_PatientStatus');
    echoT($clsForm->strLabelRow('Patient Status', '<table border="0"><tr><td>' . $formData->ddlM_PatientStatus, 1));
    // Visit Tasks