Ejemplo n.º 1
0
function showPatientAssoc($attributes, $clsRpt, $volRec, $lVolID, $volClient)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $bActive = $volRec->bActive;
    $attributes->bCloseDiv = false;
    $attributes->divID = 'pAssoc';
    $attributes->divImageID = 'pAssocDivImg';
    $attributes->lUnderscoreWidth = 400;
    if ($bActive) {
        $strLinkAddNewA = strLinkAdd_PatientAssociation($lVolID, 'Add patient association', true) . ' ' . strLinkAdd_PatientAssociation($lVolID, 'Add patient association', false);
    } else {
        $strLinkAddNewA = '';
    }
    openBlock('Volunteer/Patient Associations', $strLinkAddNewA, $attributes);
    if (count($volClient) == 0) {
        echoT('<i>No associated patients</i>');
    } else {
        echoT('
            <table class="enpRpt">
               <tr>
                  <td class="enpRptLabel">
                     Patient ID
                  </td>
                  <td class="enpRptLabel">
                     Patient
                  </td>
                  <td class="enpRptLabel">
                     Status
                  </td>');
        if ($bActive) {
            echoT('
                  <td class="enpRptLabel">
                     &nbsp;
                  </td>
                  <td class="enpRptLabel">
                     &nbsp;
                  </td>');
        }
        echoT('
               </tr>');
        foreach ($volClient as $vc) {
            $bVCActive = $vc->bActive;
            if ($bVCActive) {
                $strALabel = 'Set inactive';
                $lRowSpan = 3;
                $strNameColor = '#000';
            } else {
                $strALabel = 'Set active';
                $lRowSpan = 2;
                $strNameColor = '#999';
            }
            $lAssocID = $vc->lKeyID;
            $lPatientID = $vc->lPatientID;
            echoT('
               <tr class="makeStripe">
                  <td style="vertical-align: top; color: ' . $strNameColor . ';" class="enpRpt">' . strLinkView_PatientRecord($lPatientID, 'View patient record', true) . '&nbsp;' . str_pad($lPatientID, 5, '0', STR_PAD_LEFT) . '
                  </td>');
            echoT('
                  <td style="vertical-align: top; padding-right: 8px; color: ' . $strNameColor . ';" class="enpRpt">' . htmlspecialchars($vc->patient->strLName . ', ' . $vc->patient->strFName) . '
                  </td>');
            echoT('
                  <td style="vertical-align: top; padding-right: 8px; color: ' . $strNameColor . ';" class="enpRpt">' . ($bVCActive ? '<b>Active</b>' : 'Inactive') . '
                  </td>');
            if ($bActive) {
                if ($bVCActive) {
                    echoT('
                     <td style="vertical-align: top;" class="enpRpt">' . strLinkAdd_HospicePVist($lVolID, $vc->lPatientID, 'Add patient visit', true) . '&nbsp;' . strLinkAdd_HospicePVist($lVolID, $vc->lPatientID, 'Add patient visit', false) . '
                     </td>');
                } else {
                    echoT('
                     <td style="vertical-align: top;" class="enpRpt">&nbsp;</td>');
                }
                echoT('
                     <td style="vertical-align: top;" class="enpRpt">' . strLink_VolAssocActiveInactive($lVolID, $lAssocID, !$bActive, $strALabel, true) . '&nbsp;' . strLink_VolAssocActiveInactive($lVolID, $lAssocID, !$bActive, $strALabel, false) . '
                     </td>');
            }
            echoT('
               </tr>');
        }
        echoT('</table>');
    }
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
                $lPatientID = $vc->lPatientID;
                if ($bInactive) {
                    $strNameColor = '#999';
                }
                $strPatients .= '<tr>
                     <td style="vertical-align: top; padding-right: 8px; color: ' . $strNameColor . ';" rowspan=' . $lRowSpan . '>' . htmlspecialchars($vc->patient->strLName . ', ' . $vc->patient->strFName) . '
                     </td>';
                if (!$bInactive && $bVAActive) {
                    $strPatients .= '
                     <td style="vertical-align: top;">' . strLinkAdd_HospicePVist($lVolID, $vc->lPatientID, 'Patient visit', true, ' id="addVisit_' . $lVolID . '_' . $vc->lPatientID . '" ') . '&nbsp;' . strLinkAdd_HospicePVist($lVolID, $vc->lPatientID, 'Patient visit', false) . '
                     </td>
                  </tr>
                  <tr>';
                }
                if (!$bInactive) {
                    $strPatients .= '
                        <td style="vertical-align: top;">' . strLink_VolAssocActiveInactive($lVolID, $lAssocID, !$bVAActive, $strALabel, true) . '&nbsp;' . strLink_VolAssocActiveInactive($lVolID, $lAssocID, !$bVAActive, $strALabel, false) . '
                        </td>
                     </tr>
                     <tr>
                        <td style="vertical-align: top; padding-bottom: 8px;">' . strLinkView_PatientRecord($lPatientID, 'View patient record', true) . '&nbsp;patient ID: ' . str_pad($lPatientID, 5, '0', STR_PAD_LEFT) . '
                        </td>';
                }
                $strPatients .= '
                  </tr>';
            }
            echoT($clsRpt->writeCell($strPatients . '</table>' . $strLinkAddNewAssoc, $lPatientWidth, $strColor));
        }
    }
    echoT($clsRpt->closeReport());
}