function showClientInfo($clsRpt, $lCID, $clsClient, $clsDateTime, $bShowAddNew, $lSponID, $bViewOnly, $strClientPreLabel = '')
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $gbDateFormatUS, $genumDateFormat, $glclsDTDateFormat;
    if (is_null($lCID)) {
        if ($bViewOnly) {
            $attributes = new stdClass();
            $attributes->lTableWidth = 900;
            $attributes->divID = 'clientA';
            $attributes->divImageID = 'clientADivImg';
            openBlock('Client Information', '', $attributes);
        } else {
            openBlock('Client Information', '');
        }
        echoT('<i>No client has been linked to this sponsorship.</i>');
        if ($bShowAddNew) {
            echoT('&nbsp;&nbsp;&nbsp;' . strLinkAdd_ClientToSpon($lSponID, 'Add client to this sponsorship', true) . '&nbsp' . strLinkAdd_ClientToSpon($lSponID, 'Add client to this sponsorship', false) . '&nbsp');
        }
        if ($bViewOnly) {
            $attributes = new stdClass();
            $attributes->bCloseDiv = true;
            closeBlock($attributes);
        } else {
            closeBlock();
        }
    } else {
        $clsC = $clsClient->clients[0];
        if ($bShowAddNew) {
            echoT(strLinkAdd_Client('Add new client', true) . ' ' . strLinkAdd_Client('Add new client', false) . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . strLinkSpecial_SearchClient('Search clients', true) . '&nbsp;' . strLinkSpecial_SearchClient('Search clients', false) . '<br>');
        }
        if (isset($clsC->strFlagsTable)) {
            $strCFlags = '&nbsp;' . $clsC->strFlagsTable;
        } else {
            $strCFlags = '';
        }
        if ($bViewOnly) {
            $strBlockLink = strLinkView_ClientRecord($lCID, 'View client record', true) . '&nbsp;' . strLinkView_ClientRecord($lCID, 'View client record', false);
            $strVocLink = '';
            $strLinkLocation = '';
            $strLinkStatCat = '';
            $strLinkStatHist = '';
            $strLinkRem = '';
            $attributes = new stdClass();
            $attributes->lTableWidth = 900;
            $attributes->divID = 'clientB';
            $attributes->divImageID = 'clientBDivImg';
            openBlock($strClientPreLabel . $clsClient->clients[0]->cv_strVocClientS, $strBlockLink . $strCFlags, $attributes);
        } else {
            /*
                     $strBlockLink    = strLinkEdit_Client       ($lCID, 'Edit client record', true ).'&nbsp;'
                                       .strLinkEdit_Client       ($lCID, 'Edit client record', false).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
                                       .strLinkView_ClientAssessmentViaCID($lCID, 'Client Assessments', true ).'&nbsp;'
                                       .strLinkView_ClientAssessmentViaCID($lCID, 'Client Assessments', false);
            */
            $strBlockLink = strLinkEdit_Client($lCID, 'Edit client record', true) . '&nbsp;' . strLinkEdit_Client($lCID, 'Edit client record', false);
            $strVocLink = strLinkEdit_ClientRecVoc($lCID, 'Edit this client\'s vocabulary', true) . '&nbsp;';
            $strLinkLocation = strLinkView_ClientsViaLocation($clsC->lLocationID, 'View this location\'s directory', true);
            $strLinkStatCat = strLinkEdit_ClientRecStatCat($lCID, 'Edit this client\'s status category', true) . '&nbsp;';
            $strLinkStatHist = strLinkView_ClientStatusHistory($lCID, 'status history', true);
            $strLinkRem = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . strLinkRem_Client($lCID, 'Remove client record', true, true);
            openBlock($strClientPreLabel . $clsClient->clients[0]->cv_strVocClientS, $strBlockLink . $strCFlags . $strLinkRem);
        }
        echoT($clsRpt->openReport() . $clsRpt->openRow() . $clsRpt->writeLabel('Client ID:') . $clsRpt->writeCell(str_pad($lCID, 5, '0', STR_PAD_LEFT)) . $clsRpt->closeRow() . $clsRpt->openRow() . $clsRpt->writeLabel('Name:') . $clsRpt->writeCell(htmlspecialchars($clsC->strFName . ' ' . $clsC->strMName . ' ' . $clsC->strLName . ' (' . $clsC->enumGender . ')')) . $clsRpt->closeRow() . $clsRpt->openRow() . $clsRpt->writeLabel('Enrollment Date:') . $clsRpt->writeCell(date($genumDateFormat, $clsC->dteEnrollment)) . $clsRpt->closeRow());
        //---------------
        // birthday
        //---------------
        $mdteBirth = $clsC->dteBirth;
        $clsDateTime->setDateViaMySQL(0, $mdteBirth);
        $strAgeBDay = $clsDateTime->strPeopleAge(0, $mdteBirth, $lAgeYears, $glclsDTDateFormat);
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Birth Date:') . $clsRpt->writeCell($strAgeBDay) . $clsRpt->closeRow());
        //---------------
        // location
        //---------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Location:') . $clsRpt->writeCell($strLinkLocation . htmlspecialchars($clsC->strLocation)) . $clsRpt->closeRow() . $clsRpt->openRow() . $clsRpt->writeLabel('Max # of Sponsors:') . $clsRpt->writeCell($clsC->lMaxSponsors) . $clsRpt->closeRow());
        //------------------------
        // Address
        //------------------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Address:') . $clsRpt->writeCell($clsC->strAddress) . $clsRpt->closeRow());
        //------------------------
        // Email
        //------------------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Email:') . $clsRpt->writeCell($clsC->strEmailFormatted) . $clsRpt->closeRow());
        //------------------------
        // Phone
        //------------------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Phone:') . $clsRpt->writeCell(htmlspecialchars(strPhoneCell($clsC->strPhone, $clsC->strCell))) . $clsRpt->closeRow());
        //---------------
        // Vocabulary
        //---------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Vocabulary:') . $clsRpt->writeCell($strVocLink . $clsC->cv_strVocTitle) . $clsRpt->closeRow());
        //------------------
        // Status Category
        //------------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Status Category:') . $clsRpt->writeCell($strLinkStatCat . $clsC->strStatusCatName) . $clsRpt->closeRow() . $clsRpt->openRow() . $clsRpt->writeLabel('Current Status:') . $clsRpt->writeCell($strLinkStatHist . $clsC->curStat_strStatus . ' <small>(set on ' . date($genumDateFormat, $clsC->curStat_dteStatus) . ')</small>') . $clsRpt->closeRow());
        //------------------
        // Attributed To
        //------------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Attributed To:') . $clsRpt->writeCell(htmlspecialchars($clsC->strAttrib)) . $clsRpt->closeRow());
        //------------------
        // Bio
        //------------------
        echoT($clsRpt->openRow() . $clsRpt->writeLabel('Bio:') . $clsRpt->writeCell(nl2br(htmlspecialchars($clsC->strBio))) . $clsRpt->closeRow());
        echoT($clsRpt->closeReport());
        if ($bViewOnly) {
            $attributes = new stdClass();
            $attributes->bCloseDiv = true;
            closeBlock($attributes);
        } else {
            closeBlock();
        }
    }
}
function showClientStatusInfo($clsRpt, $lCID, $clsClient, &$clientStatus, $lNumClientStatus)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $genumDateFormat;
    $attributes = new stdClass();
    $attributes->lTableWidth = 900;
    $attributes->divID = 'clientStat';
    $attributes->divImageID = 'clientStatDivImg';
    openBlock($clsClient->clients[0]->cv_strVocClientS . ' Status History', strLinkView_ClientStatusHistory($lCID, 'View status history', true), $attributes);
    if ($lNumClientStatus == 0) {
        echoT('<i>There are no status records for this ' . $clsClient->clients[0]->cv_strVocClientS . '</i><br>');
        closeBlock();
        return;
    }
    showStatusHistory(false, false, $clientStatus, $lNumClientStatus, $lCID, "80%");
    $attributes = new stdClass();
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
 private function clientStatusSearch(&$results)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat;
     $results->strLabel = 'Client Status';
     $results->lNumResults = 0;
     $sqlStr = 'SELECT csh_lKeyID, csh_lClientID, csh_lStatusID,
            csh_dteStatusDate,
            csh_strStatusTxt,
            cr_strFName, cr_strLName, cr_lLocationID, cl_strLocation
         FROM client_status
            INNER JOIN client_records  ON cr_lKeyID      = csh_lClientID
            INNER JOIN client_location ON cr_lLocationID = cl_lKeyID
         WHERE NOT csh_bRetired AND ' . $this->textSearchWhere('csh_strStatusTxt') . '
         ORDER BY csh_dteStatusDate, csh_lKeyID;';
     $query = $this->db->query($sqlStr);
     $results->lNumResults = $lNumRows = $query->num_rows();
     if ($lNumRows > 0) {
         $idx = 0;
         $results->matches = array();
         foreach ($query->result() as $row) {
             $results->matches[$idx] = new stdClass();
             $lClientID = $row->csh_lClientID;
             $match =& $results->matches[$idx];
             $match->links = 'Client ID ' . str_pad($lClientID, 5, '0', STR_PAD_LEFT) . strLinkView_ClientRecord($lClientID, 'View client record', true) . '&nbsp;&nbsp;' . 'Client Status ID: ' . str_pad($row->csh_lKeyID, 5, '0', STR_PAD_LEFT) . strLinkView_ClientStatusHistory($lClientID, 'View client status', true);
             $match->searchInfo = 'Client status record for ' . htmlspecialchars($row->cr_strFName . ' ' . $row->cr_strLName) . '
                         (' . htmlspecialchars($row->cl_strLocation) . ') of ' . date($genumDateFormat, dteMySQLDate2Unix($row->csh_dteStatusDate));
             $match->text = $row->csh_strStatusTxt;
             $match->textHighlighted = $this->highlightMatchedText($row->csh_strStatusTxt);
             ++$idx;
         }
     }
 }