Example #1
0
 public function loadVolRecs()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     $this->volRecs = array();
     $clsPeople = new mpeople();
     if ($this->strOrderExtra . '' == '') {
         $this->strOrderExtra = ' ORDER BY pe_strLName, pe_strFName, pe_strMName, vol_lKeyID ';
     }
     $sqlStr = "SELECT\n            vol_lKeyID, vol_lPeopleID, vol_bInactive, vol_lRegFormID,\n            vol_Notes, vol_bRetired, vol_lOriginID, vol_lLastUpdateID,\n            UNIX_TIMESTAMP(vol_dteInactive) AS dteInactive,\n\n            vreg_strFormName, vreg_strURLHash,\n\n            pe_strLName, pe_strFName,\n            pe_strMName, pe_bRetired,\n            pe_strPreferredName, pe_strTitle,\n            pe_strAddr1, pe_strAddr2,\n            pe_strCity,  pe_strState,\n            pe_strZip,   pe_strCountry,\n            pe_strEmail, pe_strPhone, pe_strCell,\n            pe_lHouseholdID,\n\n            UNIX_TIMESTAMP(vol_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(vol_dteLastUpdate) AS dteLastUpdate,\n            uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n            ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n         FROM volunteers\n            INNER JOIN people_names        ON vol_lPeopleID  = pe_lKeyID\n            INNER JOIN admin_users   AS uc ON uc.us_lKeyID   = vol_lOriginID\n            INNER JOIN admin_users   AS ul ON ul.us_lKeyID   = vol_lLastUpdateID\n            LEFT  JOIN vol_reg             ON vol_lRegFormID = vreg_lKeyID\n\n         WHERE\n            NOT vol_bRetired AND NOT pe_bRetired\n            {$this->strWhereExtra}\n         {$this->strOrderExtra}\n         {$this->sqlLimitExtra};";
     $query = $this->db->query($sqlStr);
     $this->lNumVolRecs = $numRows = $query->num_rows();
     if ($numRows == 0) {
         $this->volRecs[0] = new stdClass();
         $vRec =& $this->volRecs[0];
         $vRec->lKeyID = $vRec->lPeopleID = $vRec->lHouseholdID = $vRec->bInactive = $vRec->Notes = $vRec->bRetired = $vRec->dteInactive = $vRec->strLName = $vRec->strFName = $vRec->strMName = $vRec->strSafeNameFL = $vRec->bRetired = $vRec->strAddr1 = $vRec->strAddr2 = $vRec->strCity = $vRec->strState = $vRec->strZip = $vRec->strCountry = $vRec->strEmail = $vRec->strPhone = $vRec->strCell = $vRec->lOriginID = $vRec->lLastUpdateID = $vRec->dteOrigin = $vRec->dteLastUpdate = $vRec->strUCFName = $vRec->strUCLName = $vRec->strULFName = $vRec->strULLName = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->volRecs[$idx] = new stdClass();
             $vRec =& $this->volRecs[$idx];
             $vRec->lKeyID = (int) $row->vol_lKeyID;
             $vRec->lPeopleID = (int) $row->vol_lPeopleID;
             $vRec->lHouseholdID = $lHID = (int) $row->pe_lHouseholdID;
             $vRec->strHouseholdName = $clsPeople->strHouseholdNameViaHID($lHID);
             $vRec->bInactive = $row->vol_bInactive;
             $vRec->Notes = $row->vol_Notes;
             $vRec->bRetired = $row->vol_bRetired;
             $vRec->dteInactive = $row->dteInactive;
             $vRec->strLName = $strLName = $row->pe_strLName;
             $vRec->strFName = $strFName = $row->pe_strFName;
             $vRec->strMName = $strMName = $row->pe_strMName;
             $vRec->strTitle = $strTitle = $row->pe_strTitle;
             $vRec->strPreferred = $strPreferred = $row->pe_strPreferredName;
             $vRec->lRegFormID = (int) $row->vol_lRegFormID;
             $vRec->strFormName = $row->vreg_strFormName;
             $vRec->strURLHash = $row->vreg_strURLHash;
             $vRec->strSafeName = $vRec->strSafeNameFL = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $vRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $vRec->bRetired = $row->pe_bRetired;
             $vRec->strAddr1 = $row->pe_strAddr1;
             $vRec->strAddr2 = $row->pe_strAddr2;
             $vRec->strCity = $row->pe_strCity;
             $vRec->strState = $row->pe_strState;
             $vRec->strZip = $row->pe_strZip;
             $vRec->strCountry = $row->pe_strCountry;
             $vRec->strEmail = $strEmail = $row->pe_strEmail;
             $vRec->strEmailFormatted = strBuildEmailLink($strEmail, '', false, '');
             $vRec->strPhone = $row->pe_strPhone;
             $vRec->strCell = $row->pe_strCell;
             $vRec->strAddress = strBuildAddress($vRec->strAddr1, $vRec->strAddr2, $vRec->strCity, $vRec->strState, $vRec->strCountry, $vRec->strZip, true);
             $vRec->lOriginID = $row->vol_lOriginID;
             $vRec->lLastUpdateID = $row->vol_lLastUpdateID;
             $vRec->dteOrigin = $row->dteOrigin;
             $vRec->dteLastUpdate = $row->dteLastUpdate;
             $vRec->strUCFName = $row->strUCFName;
             $vRec->strUCLName = $row->strUCLName;
             $vRec->strULFName = $row->strULFName;
             $vRec->strULLName = $row->strULLName;
             ++$idx;
         }
     }
 }
 public function loadClientsGeneric()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     global $glclsDTDateFormat;
     customClient_AAYHF_01($strInnerAAYHF, $strFieldsAAYHF, $bAAYHF_Beacon);
     $strOrder = $this->strClientOrder;
     if ($strOrder == '') {
         $strOrder = ' cl_strLocation, cr_strLName, cr_strFName, cr_strMName, cr_lKeyID ';
     }
     $clsDateTime = new dl_date_time();
     $sqlStr = "SELECT\n               cr_lKeyID, cr_strFName, cr_strMName, cr_strLName,\n               cr_dteEnrollment,\n               cr_dteBirth, cr_dteDeath, cr_enumGender,\n               cr_lLocationID, cl_strCountry, cr_lStatusCatID, cr_lVocID,\n               cr_lMaxSponsors, cr_strBio, cr_bNoLongerAtLocation,\n               cr_bRetired, cr_lOriginID, cr_lLastUpdateID,\n               UNIX_TIMESTAMP(cr_dteOrigin)     AS dteOrigin,\n               UNIX_TIMESTAMP(cr_dteLastUpdate) AS dteLastUpdate,\n               cl_strLocation, cl_bEnableEMR,\n               cr_lAttributedTo, lgen_strListItem,\n\n               cr_strAddr1,      cr_strAddr2,\n               cr_strCity,       cr_strState,      cr_strCountry,\n               cr_strZip,        cr_strPhone,      cr_strCell, cr_strEmail,\n\n               -- ------------------------\n               -- vocabulary\n               -- ------------------------\n               cv_strVocTitle,\n               cv_strVocClientS, cv_strVocClientP,\n               cv_strVocSponsorS, cv_strVocSponsorP,\n               cv_strVocLocS, cv_strVocLocP,\n               cv_strVocSubLocS, cv_strVocSubLocP,\n\n               -- ------------------------\n               -- current status\n               -- ------------------------\n               csh_lKeyID, csh_lStatusID,\n               csh_dteStatusDate,\n               csh_bIncludeNotesInPacket, csh_strStatusTxt,\n\n               cst_lClientStatusCatID, cst_strStatus, cst_bAllowSponsorship,\n               cst_bShowInDir, cst_bDefault,\n               curStatSCat.csc_strCatName     AS curStat_strCatName,\n               defSCat.csc_strCatName         AS defStat_strCatName,\n\n               uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n               ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n               {$strFieldsAAYHF}\n\n            FROM client_records\n               {$this->strInnerExtra}\n               {$strInnerAAYHF}\n               LEFT JOIN client_location                    ON cr_lLocationID = cl_lKeyID\n               LEFT JOIN lists_client_vocab                 ON cr_lVocID      = cv_lKeyID\n\n               LEFT JOIN client_status                      ON csh_lClientID   = cr_lKeyID\n               LEFT JOIN lists_client_status_entries        ON csh_lStatusID   = cst_lKeyID\n               LEFT JOIN client_status_cats AS curStatSCat  ON cst_lClientStatusCatID = curStatSCat.csc_lKeyID\n               LEFT JOIN client_status_cats AS defSCat      ON cr_lStatusCatID        = defSCat.csc_lKeyID\n\n               INNER JOIN admin_users  AS uc ON uc.us_lKeyID=cr_lOriginID\n               INNER JOIN admin_users  AS ul ON ul.us_lKeyID=cr_lLastUpdateID\n\n               LEFT  JOIN lists_generic      ON cr_lAttributedTo=lgen_lKeyID\n            WHERE 1\n               AND NOT cr_bRetired\n\n                 -- ---------------------------------------\n                 -- subquery to find most current status\n                 -- ---------------------------------------\n               AND csh_lKeyID=(SELECT csh_lKeyID\n                               FROM client_status\n                               WHERE csh_lClientID=cr_lKeyID\n                                  AND NOT csh_bRetired\n                               ORDER BY csh_dteStatusDate DESC, csh_lKeyID DESC\n                               LIMIT 0,1)\n\n               {$this->strExtraClientWhere}\n            ORDER BY {$strOrder}\n            {$this->strClientLimit};";
     $query = $this->db->query($sqlStr);
     $this->lNumClients = $numRows = $query->num_rows();
     $this->clients = array();
     if ($numRows == 0) {
         $this->clients[0] = new stdClass();
         $client =& $this->clients[0];
         $client->lKeyID = $client->strFName = $client->strMName = $client->strLName = $client->dteEnrollment = $client->dteBirth = $client->dteDeath = $client->enumGender = $client->lLocationID = $client->lStatusCatID = $client->lVocID = $client->lMaxSponsors = $client->strBio = $client->lAttribID = $client->strAttrib = $client->bRetired = $client->lOriginID = $client->lLastUpdateID = $client->dteOrigin = $client->dteLastUpdate = $client->strLocation = $client->strLocCountry = $client->strAddr1 = $client->strAddr2 = $client->strCity = $client->strState = $client->strCountry = $client->strZip = $client->strPhone = $client->strCell = $client->strEmail = $client->strAddress = $client->cv_strVocTitle = $client->cv_strVocClientS = $client->cv_strVocClientP = $client->cv_strVocSponsorS = $client->cv_strVocSponsorP = $client->cv_strVocLocS = $client->cv_strVocLocP = $client->cv_strVocSubLocS = $client->cv_strVocSubLocP = $client->curStat_lStatRecKeyID = $client->curStat_lStatusID = $client->curStat_dteStatus = $client->curStat_bIncludeNotesInPacket = $client->curStat_strStatusNotes = $client->curStat_lClientStatusCatID = $client->curStat_strStatus = $client->curStat_bAllowSponsorship = $client->curStat_bShowInDir = $client->curStat_bDefaultStatus = $client->curStat_strStatusCatName = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->clients[$idx] = new stdClass();
             $client =& $this->clients[$idx];
             $client->lKeyID = (int) $row->cr_lKeyID;
             $client->strFName = $row->cr_strFName;
             $client->strMName = $row->cr_strMName;
             $client->strLName = $row->cr_strLName;
             $client->strSafeName = htmlspecialchars($row->cr_strFName . ' ' . $row->cr_strLName);
             $client->strSafeNameLF = htmlspecialchars($row->cr_strLName . ', ' . $row->cr_strFName);
             $client->dteEnrollment = dteMySQLDate2Unix($row->cr_dteEnrollment);
             $client->dteBirth = $mySQLdteBirth = $row->cr_dteBirth;
             $client->dteDeath = $row->cr_dteDeath;
             $client->enumGender = $row->cr_enumGender;
             $client->lLocationID = $row->cr_lLocationID;
             $client->lStatusCatID = $row->cr_lStatusCatID;
             $client->strStatusCatName = $row->defStat_strCatName;
             //------------------------------
             // client address/contact
             //------------------------------
             $client->strAddr1 = $row->cr_strAddr1;
             $client->strAddr2 = $row->cr_strAddr2;
             $client->strCity = $row->cr_strCity;
             $client->strState = $row->cr_strState;
             $client->strCountry = $row->cr_strCountry;
             $client->strZip = $row->cr_strZip;
             $client->strPhone = $row->cr_strPhone;
             $client->strCell = $row->cr_strCell;
             $client->strEmail = $row->cr_strEmail;
             $client->strEmailFormatted = strBuildEmailLink($client->strEmail, '', false, '');
             $client->strAddress = strBuildAddress($client->strAddr1, $client->strAddr2, $client->strCity, $client->strState, $client->strCountry, $client->strZip, true);
             //------------------------------
             // client age/birth day info
             //------------------------------
             if (is_null($mySQLdteBirth)) {
                 $client->objClientBirth = null;
                 $client->lAgeYears = null;
                 $client->strClientAgeBDay = '(age n/a)';
             } else {
                 $client->objClientBirth = new dl_date_time();
                 $client->objClientBirth->setDateViaMySQL(0, $mySQLdteBirth);
                 $client->strClientAgeBDay = $client->objClientBirth->strPeopleAge(0, $mySQLdteBirth, $client->lAgeYears, $glclsDTDateFormat);
             }
             $client->lVocID = $row->cr_lVocID;
             $client->lMaxSponsors = $row->cr_lMaxSponsors;
             $client->strBio = $row->cr_strBio;
             $client->bRetired = $row->cr_bRetired;
             $client->lOriginID = $row->cr_lOriginID;
             $client->lLastUpdateID = $row->cr_lLastUpdateID;
             $client->strLocation = $row->cl_strLocation;
             $client->strLocCountry = $row->cl_strCountry;
             $client->bEnableEMR = $row->cl_bEnableEMR;
             $client->cv_strVocTitle = $row->cv_strVocTitle;
             $client->cv_strVocClientS = $row->cv_strVocClientS;
             $client->cv_strVocClientP = $row->cv_strVocClientP;
             $client->cv_strVocSponsorS = $row->cv_strVocSponsorS;
             $client->cv_strVocSponsorP = $row->cv_strVocSponsorP;
             $client->cv_strVocLocS = $row->cv_strVocLocS;
             $client->cv_strVocLocP = $row->cv_strVocLocP;
             $client->cv_strVocSubLocS = $row->cv_strVocSubLocS;
             $client->cv_strVocSubLocP = $row->cv_strVocSubLocP;
             //---------------------------------
             // status fields - current status
             //---------------------------------
             $client->curStat_lStatRecKeyID = $row->csh_lKeyID;
             $client->curStat_lStatusID = $row->csh_lStatusID;
             $client->curStat_dteStatus = dteMySQLDate2Unix($row->csh_dteStatusDate);
             $client->curStat_bIncludeNotesInPacket = $row->csh_bIncludeNotesInPacket;
             $client->curStat_strStatusNotes = $row->csh_strStatusTxt;
             $client->curStat_lClientStatusCatID = $row->cst_lClientStatusCatID;
             $client->curStat_strStatus = $row->cst_strStatus;
             $client->curStat_bAllowSponsorship = $row->cst_bAllowSponsorship;
             $client->curStat_bShowInDir = $row->cst_bShowInDir;
             $client->curStat_bDefaultStatus = $row->cst_bDefault;
             $client->curStat_strStatusCatName = $row->curStat_strCatName;
             $client->lAttribID = $row->cr_lAttributedTo;
             $client->strAttrib = $row->lgen_strListItem;
             $client->dteOrigin = $row->dteOrigin;
             $client->dteLastUpdate = $row->dteLastUpdate;
             $client->ucstrFName = $row->strUCFName;
             $client->ucstrLName = $row->strUCLName;
             $client->ulstrFName = $row->strULFName;
             $client->ulstrLName = $row->strULLName;
             $client->strFlagsTable = '';
             //------------------
             // sponsors
             //------------------
             $this->loadSponsorshipInfo($client->lKeyID, true, $client->lNumSponsors, $client->sponsors);
             //------------------
             // custom fields
             //------------------
             addClientFields_AAYHF_Beacon($bAAYHF_Beacon, $client, $row);
             ++$idx;
         }
     }
     if ($this->bDebug) {
         $this->dumpClientRecs();
     }
 }
Example #3
0
 function loadContactNameDirectoryPage($strWhereExtra, $lStartRec, $lRecsPerPage)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $sqlLimitExtra = " LIMIT {$lStartRec}, {$lRecsPerPage} ";
     $this->sqlWhereExtra = $strWhereExtra;
     $sqlStr = "SELECT\n               pe_lKeyID, pe_strLName, pe_strFName, pe_strMName,\n               pe_strTitle, pe_strPreferredName,\n               pe_strAddr1,\n               pe_strAddr2,\n               pe_strCity,\n               pe_strState,\n               pe_strCountry,\n               pe_strZip,\n               pe_strPhone,\n               pe_strCell,\n               pe_strEmail\n            FROM biz_contacts\n               INNER JOIN people_names ON bc_lContactID=pe_lKeyID\n            WHERE NOT pe_bBiz\n               AND NOT pe_bRetired\n               AND NOT bc_bRetired\n               {$strWhereExtra}\n            GROUP BY pe_lKeyID\n            ORDER BY\n               pe_strLName, pe_strFName, pe_strMName, pe_lKeyID\n            {$sqlLimitExtra};";
     $query = $this->db->query($sqlStr);
     $this->lNumContactsNames = $numRows = $query->num_rows();
     $this->contactsNames = array();
     if ($numRows > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->contactsNames[$idx] = new stdClass();
             $cRec =& $this->contactsNames[$idx];
             $cRec->lPeopleID = $row->pe_lKeyID;
             $cRec->strFName = $strFName = $row->pe_strFName;
             $cRec->strLName = $strLName = $row->pe_strLName;
             $cRec->strMName = $strMName = $row->pe_strMName;
             $cRec->strTitle = $strTitle = $row->pe_strTitle;
             $cRec->strPreferred = $strPreferred = $row->pe_strPreferredName;
             $cRec->strSafeName = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $cRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $cRec->strAddr1 = $row->pe_strAddr1;
             $cRec->strAddr2 = $row->pe_strAddr2;
             $cRec->strCity = $row->pe_strCity;
             $cRec->strState = $row->pe_strState;
             $cRec->strCountry = $row->pe_strCountry;
             $cRec->strZip = $row->pe_strZip;
             $cRec->strPhone = $row->pe_strPhone;
             $cRec->strCell = $row->pe_strCell;
             $cRec->strEmail = $row->pe_strEmail;
             $cRec->strEmailFormatted = strBuildEmailLink($cRec->strEmail, '', false, '');
             $cRec->strAddress = strBuildAddress($cRec->strAddr1, $cRec->strAddr2, $cRec->strCity, $cRec->strState, $cRec->strCountry, $cRec->strZip, true);
             $cRec->biz = $this->bizViaContactPID($cRec->lPeopleID, $cRec->lNumBiz);
             ++$idx;
         }
     }
 }
Example #4
0
 public function loadVolRecs()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     $this->volRecs = array();
     if ($this->strOrderExtra . '' == '') {
         $this->strOrderExtra = ' ORDER BY vol_strLName, vol_strFName, vol_strMName, vol_lKeyID ';
     }
     $sqlStr = "SELECT\n            vol_lKeyID, vol_lChapterID, ch_strChapterName,\n            userAcct.us_lKeyID AS lAcctID, vol_bInactive,\n            vol_strNotes, vol_bRetired, vol_lOriginID, vol_lLastUpdateID,\n            UNIX_TIMESTAMP(vol_dteInactive) AS dteInactive,\n\n            vol_strLName, vol_strFName,\n            vol_strMName, vol_bRetired,\n            vol_strPreferredName, vol_strTitle,\n            vol_strAddr1, vol_strAddr2,\n            vol_strCity,  vol_strState,\n            vol_strZip,   vol_strCountry,\n            vol_strEmail, vol_strPhone, vol_strCell,\n            vol_dteBirthDate,\n\n            vol_lAttributedTo, Attrib.lgen_strListItem AS strAttrib,\n\n            UNIX_TIMESTAMP(vol_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(vol_dteLastUpdate) AS dteLastUpdate,\n            uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n            ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n         FROM volunteers\n            INNER JOIN admin_chapters      ON ch_lKeyID      = vol_lChapterID\n            INNER JOIN admin_users   AS uc ON uc.us_lKeyID   = vol_lOriginID\n            INNER JOIN admin_users   AS ul ON ul.us_lKeyID   = vol_lLastUpdateID\n            LEFT  JOIN lists_generic AS Attrib   ON vol_lAttributedTo = Attrib.lgen_lKeyID\n            LEFT  JOIN admin_users   AS userAcct ON vol_lKeyID = userAcct.us_lVolID\n\n         WHERE\n            NOT vol_bRetired\n            {$this->strWhereExtra}\n         {$this->strOrderExtra}\n         {$this->sqlLimitExtra};";
     $query = $this->db->query($sqlStr);
     $this->lNumVolRecs = $numRows = $query->num_rows();
     if ($numRows == 0) {
         $this->volRecs[0] = new stdClass();
         $vRec =& $this->volRecs[0];
         $vRec->lKeyID = $vRec->lPeopleID = $vRec->lHouseholdID = $vRec->bInactive = $vRec->strNotes = $vRec->bRetired = $vRec->dteInactive = $vRec->strLName = $vRec->strFName = $vRec->strMName = $vRec->strSafeNameFL = $vRec->bRetired = $vRec->strAddr1 = $vRec->strAddr2 = $vRec->strCity = $vRec->strState = $vRec->strZip = $vRec->strCountry = $vRec->strEmail = $vRec->strPhone = $vRec->strCell = $vRec->lOriginID = $vRec->lLastUpdateID = $vRec->dteOrigin = $vRec->dteLastUpdate = $vRec->strUCFName = $vRec->strUCLName = $vRec->strULFName = $vRec->strULLName = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->volRecs[$idx] = new stdClass();
             $vRec =& $this->volRecs[$idx];
             $vRec->lKeyID = (int) $row->vol_lKeyID;
             $vRec->lAcctID = (int) $row->lAcctID;
             $vRec->lChapterID = (int) $row->vol_lChapterID;
             $vRec->strChapterName = $row->ch_strChapterName;
             $vRec->bInactive = (bool) $row->vol_bInactive;
             $vRec->bActive = !$vRec->bInactive;
             $vRec->strNotes = $row->vol_strNotes;
             $vRec->dteInactive = $row->dteInactive;
             $vRec->strLName = $strLName = $row->vol_strLName;
             $vRec->strFName = $strFName = $row->vol_strFName;
             $vRec->strMName = $strMName = $row->vol_strMName;
             $vRec->strTitle = $strTitle = $row->vol_strTitle;
             $vRec->strPreferred = $strPreferred = $row->vol_strPreferredName;
             $vRec->strSafeName = $vRec->strSafeNameFL = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $vRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $vRec->bRetired = (bool) $row->vol_bRetired;
             $vRec->strAddr1 = $row->vol_strAddr1;
             $vRec->strAddr2 = $row->vol_strAddr2;
             $vRec->strCity = $row->vol_strCity;
             $vRec->strState = $row->vol_strState;
             $vRec->strZip = $row->vol_strZip;
             $vRec->strCountry = $row->vol_strCountry;
             $vRec->strEmail = $strEmail = $row->vol_strEmail;
             $vRec->strEmailFormatted = strBuildEmailLink($strEmail, '', false, '');
             $vRec->strNotes = $row->vol_strNotes;
             $vRec->mdteBirthDate = $row->vol_dteBirthDate;
             $vRec->strPhone = $row->vol_strPhone;
             $vRec->strCell = $row->vol_strCell;
             $vRec->strAddress = strBuildAddress($vRec->strAddr1, $vRec->strAddr2, $vRec->strCity, $vRec->strState, $vRec->strCountry, $vRec->strZip, true);
             $vRec->lAttributedTo = $row->vol_lAttributedTo;
             $vRec->strAttrib = $row->strAttrib;
             $vRec->lOriginID = $row->vol_lOriginID;
             $vRec->lLastUpdateID = $row->vol_lLastUpdateID;
             $vRec->dteOrigin = $row->dteOrigin;
             $vRec->dteLastUpdate = $row->dteLastUpdate;
             $vRec->strUCFName = $row->strUCFName;
             $vRec->strUCLName = $row->strUCLName;
             $vRec->strULFName = $row->strULFName;
             $vRec->strULLName = $row->strULLName;
             ++$idx;
         }
     }
 }
Example #5
0
    public function loadPatientsGeneric()
    {
        //-----------------------------------------------------------------------
        //
        //-----------------------------------------------------------------------
        global $glclsDTDateFormat, $gstrPassPhrase;
        $strOrder = $this->strClientOrder;
        if ($strOrder == '') {
            $strOrder = ' 
              AES_DECRYPT(cr_strLName, SHA2(' . strPrepStr($gstrPassPhrase) . ',256)), 
              AES_DECRYPT(cr_strFName, SHA2(' . strPrepStr($gstrPassPhrase) . ',256)), 
              AES_DECRYPT(cr_strMName, SHA2(' . strPrepStr($gstrPassPhrase) . ',256)), 
              cr_lKeyID ';
        }
        $sqlStr = 'SELECT
               cr_lKeyID,
               cr_bActive, cr_dteInactive, cr_dteEnrollment,
               cr_enumGender,

               AES_DECRYPT(cr_dteBirth,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS dteBirth,
               AES_DECRYPT(cr_dteDeath,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS dteDeath,
               AES_DECRYPT(cr_strTitle,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strTitle,
               AES_DECRYPT(cr_strFName,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strFName,
               AES_DECRYPT(cr_strMName,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strMName,
               AES_DECRYPT(cr_strLName,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strLName,
               AES_DECRYPT(cr_strAddr1,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strAddr1,
               AES_DECRYPT(cr_strAddr2,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strAddr2,
               AES_DECRYPT(cr_strCity,      SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strCity,
               AES_DECRYPT(cr_strState,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strState,
               AES_DECRYPT(cr_strCountry,   SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strCountry,
               AES_DECRYPT(cr_strZip,       SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strZip,
               AES_DECRYPT(cr_strPhone,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strPhone,
               AES_DECRYPT(cr_strCell,      SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strCell,
               AES_DECRYPT(cr_strEmail,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strEmail,
               AES_DECRYPT(cr_strBio,       SHA2(' . strPrepStr($gstrPassPhrase) . ",256)) AS strBio,\n\n               cr_bRetired, cr_lOriginID, cr_lLastUpdateID,\n               UNIX_TIMESTAMP(cr_dteOrigin)     AS dteOrigin,\n               UNIX_TIMESTAMP(cr_dteLastUpdate) AS dteLastUpdate,\n\n               uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n               ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n            FROM patient_records\n               {$this->strInnerExtra}\n\n               INNER JOIN admin_users  AS uc ON uc.us_lKeyID=cr_lOriginID\n               INNER JOIN admin_users  AS ul ON ul.us_lKeyID=cr_lLastUpdateID\n\n            WHERE 1\n               AND NOT cr_bRetired\n\n               {$this->strExtraClientWhere}\n            ORDER BY {$strOrder}\n            {$this->strClientLimit};";
        $query = $this->db->query($sqlStr);
        $this->lNumPatients = $numRows = $query->num_rows();
        $this->patients = array();
        if ($numRows == 0) {
            $this->patients[0] = new stdClass();
            $patient =& $this->patients[0];
            $patient->lKeyID = $patient->strTitle = $patient->strFName = $patient->strMName = $patient->strLName = $patient->dteEnrollment = $patient->dteBirth = $patient->dteDeath = $patient->enumGender = $patient->strBio = $patient->bRetired = $patient->lOriginID = $patient->lLastUpdateID = $patient->dteOrigin = $patient->dteLastUpdate = $patient->strAddr1 = $patient->strAddr2 = $patient->strCity = $patient->strState = $patient->strCountry = $patient->strZip = $patient->strPhone = $patient->strCell = $patient->strEmail = $patient->strAddress = null;
        } else {
            $idx = 0;
            foreach ($query->result() as $row) {
                $this->patients[$idx] = new stdClass();
                $patient =& $this->patients[$idx];
                $patient->lKeyID = (int) $row->cr_lKeyID;
                $patient->strTitle = $row->strTitle;
                $patient->strFName = $row->strFName;
                $patient->strMName = $row->strMName;
                $patient->strLName = $row->strLName;
                $patient->strSafeName = htmlspecialchars($row->strFName . ' ' . $row->strMName . ' ' . $row->strLName);
                $patient->strSafeNameLF = htmlspecialchars($row->strLName . ', ' . $row->strFName . ' ' . $row->strMName);
                $patient->dteEnrollment = dteMySQLDate2Unix($row->cr_dteEnrollment);
                $patient->dteBirth = $mySQLdteBirth = $row->dteBirth;
                $patient->dteDeath = $row->dteDeath;
                $patient->enumGender = $row->cr_enumGender;
                $patient->bActive = (bool) $row->cr_bActive;
                $patient->mdteInactive = $row->cr_dteInactive;
                //------------------------------
                // client address/contact
                //------------------------------
                $patient->strAddr1 = $row->strAddr1;
                $patient->strAddr2 = $row->strAddr2;
                $patient->strCity = $row->strCity;
                $patient->strState = $row->strState;
                $patient->strCountry = $row->strCountry;
                $patient->strZip = $row->strZip;
                $patient->strPhone = $row->strPhone;
                $patient->strCell = $row->strCell;
                $patient->strEmail = $row->strEmail;
                $patient->strEmailFormatted = strBuildEmailLink($patient->strEmail, '', false, '');
                $patient->strAddress = strBuildAddress($patient->strAddr1, $patient->strAddr2, $patient->strCity, $patient->strState, $patient->strCountry, $patient->strZip, true);
                /*
                               //------------------------------
                               // client age/birth day info
                               //------------------------------
                            if (is_null($mySQLdteBirth)){
                               $patient->objClientBirth = null;
                               $patient->lAgeYears      = null;
                               $patient->strClientAgeBDay = '(age n/a)';
                            }else {
                               $patient->objClientBirth = new dl_date_time;
                               $patient->objClientBirth->setDateViaMySQL(0, $mySQLdteBirth);
                               $patient->strClientAgeBDay =
                                          $patient->objClientBirth->strPeopleAge(0, $mySQLdteBirth,
                                               $patient->lAgeYears, $glclsDTDateFormat);
                            }
                */
                $patient->strBio = $row->strBio;
                $patient->bRetired = $row->cr_bRetired;
                $patient->lOriginID = $row->cr_lOriginID;
                $patient->lLastUpdateID = $row->cr_lLastUpdateID;
                $patient->dteOrigin = $row->dteOrigin;
                $patient->dteLastUpdate = $row->dteLastUpdate;
                $patient->ucstrFName = $row->strUCFName;
                $patient->ucstrLName = $row->strUCLName;
                $patient->ulstrFName = $row->strULFName;
                $patient->ulstrLName = $row->strULLName;
                ++$idx;
            }
        }
        if ($this->bDebug) {
            $this->dumpClientRecs();
        }
    }
    function findSimilarPeopleBizNames($bPeople, $strFName, $strLName, &$lNumMatches, &$matches)
    {
        //---------------------------------------------------------------------
        //
        //---------------------------------------------------------------------
        if ($bPeople) {
            $strWhereExtra = ' AND pe_strFName SOUNDS LIKE ' . strPrepStr($strFName) . ' AND NOT pe_bBiz ';
        } else {
            $strWhereExtra = ' AND pe_bBiz ';
        }
        $lNumMatches = 0;
        $matches = array();
        $sqlStr = 'SELECT
            pe_lKeyID, pe_strFName, pe_strLName, pe_enumGender,
            pe_strAddr1, pe_strAddr2, pe_strCity, pe_strState, pe_strCountry,
            pe_strZip, pe_strPhone, pe_strCell, pe_strEmail,

            UNIX_TIMESTAMP(pe_dteOrigin) AS dteOrigin,
            UNIX_TIMESTAMP(pe_dteLastUpdate) AS dteLastUpdate,
            uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,
            ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName

         FROM people_names
            INNER JOIN admin_users  AS uc ON uc.us_lKeyID=pe_lOriginID
            INNER JOIN admin_users  AS ul ON ul.us_lKeyID=pe_lLastUpdateID

         WHERE  pe_strLName SOUNDS LIKE ' . strPrepStr($strLName) . ' ' . $strWhereExtra . '               
            AND NOT pe_bRetired
         ORDER BY pe_strLName, pe_strFName, pe_lKeyID;';
        $query = $this->db->query($sqlStr);
        $lNumMatches = $query->num_rows();
        if ($lNumMatches > 0) {
            $idx = 0;
            foreach ($query->result() as $row) {
                $matches[$idx] = new stdClass();
                $match =& $matches[$idx];
                $match->lKeyID = (int) $row->pe_lKeyID;
                $match->strFName = $row->pe_strFName;
                $match->strLName = $row->pe_strLName;
                $match->strSafeName = htmlspecialchars($row->pe_strFName . ' ' . $row->pe_strLName);
                $match->strSafeNameLF = htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName);
                $match->strAddr1 = $row->pe_strAddr1;
                $match->strAddr2 = $row->pe_strAddr2;
                $match->strCity = $row->pe_strCity;
                $match->strState = $row->pe_strState;
                $match->strCountry = $row->pe_strCountry;
                $match->strZip = $row->pe_strZip;
                $match->strPhone = $row->pe_strPhone;
                $match->strCell = $row->pe_strCell;
                $match->strEmail = $row->pe_strEmail;
                $match->strEmailFormatted = strBuildEmailLink($match->strEmail, '', false, '');
                $match->strAddress = strBuildAddress($match->strAddr1, $match->strAddr2, $match->strCity, $match->strState, $match->strCountry, $match->strZip, true);
                $match->dteOrigin = $row->dteOrigin;
                $match->dteLastUpdate = $row->dteLastUpdate;
                $match->ucstrFName = $row->strUCFName;
                $match->ucstrLName = $row->strUCLName;
                $match->ulstrFName = $row->strULFName;
                $match->ulstrLName = $row->strULLName;
                ++$idx;
            }
        }
    }
         }
     }
     echoT('
           <td class="enpRpt" style="width: 130pt;' . $strIStyle . '">' . '<b>' . $sponRec->strSponSafeNameLF . '</b>' . '<br>' . $strLinkFID . $strHonoree . '<br>
             program: ' . htmlspecialchars($sponRec->strSponProgram) . '
          </td>');
 }
 //---------------------------
 // address / contact
 //---------------------------
 if ($showFields->bAddress) {
     echoT('
          <td class="enpRpt" style="width: 130pt;' . $strIStyle . '">' . strBuildAddress($sponRec->strSponAddr1, $sponRec->strSponAddr2, $sponRec->strSponCity, $sponRec->strSponState, $sponRec->strSponCountry, $sponRec->strSponZip, true));
     if ($showFields->bPhoneEmail) {
         if ($sponRec->strSponEmail . '' != '') {
             echoT(strBuildEmailLink($sponRec->strSponEmail, '<br>', false, ' style="' . $strIStyle . '"'));
         }
         $strPhone = strPhoneCell($sponRec->strSponPhone, $sponRec->strSponPhone, true, true);
         if ($strPhone != '') {
             echoT('<br>' . $strPhone);
         }
     }
     echoT('
          </td>');
 }
 //---------------------------
 // client
 //---------------------------
 if ($showFields->bClient) {
     $lClientID = $sponRec->lClientID;
     if (is_null($lClientID)) {
Example #8
0
 private function strAttribRptSponsor(&$sRpt, $strLimit, $strAttrib, $strLabel)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat;
     $this->load->model('sponsorship/msponsorship', 'clsSpon');
     $params = array('enumStyle' => 'enpRptC');
     $clsRpt = new generic_rpt($params);
     //      $this->load->helper('dl_util/email_web');
     $this->clsSpon->sponsorInfoGenericViaWhere(" AND sp_lAttributedTo {$strAttrib} ", $strLimit);
     $strOut = '<br>' . $clsRpt->openReport();
     $strOut .= $clsRpt->writeTitle('Sponsorships ' . $strLabel, '', '', 7);
     $strOut .= $clsRpt->openRow(true);
     $strOut .= $clsRpt->writeLabel('SponsorID', 60) . $clsRpt->writeLabel('Active', 90) . $clsRpt->writeLabel('Sponsor', 150) . $clsRpt->writeLabel('Address') . $clsRpt->writeLabel('Client') . $clsRpt->writeLabel('Commitment') . $clsRpt->closeRow();
     foreach ($this->clsSpon->sponInfo as $sponRec) {
         $lSponID = $sponRec->lKeyID;
         $lFID = $sponRec->lForeignID;
         if ($sponRec->bInactive) {
             $strIStyle = 'color: #999;';
             $strActiveDates = 'sponsor dates: ' . date($genumDateFormat, $sponRec->dteStart) . ' - ' . date($genumDateFormat, $sponRec->dteInactive);
         } else {
             $strIStyle = '';
             $strActiveDates = 'sponsor since: ' . date($genumDateFormat, $sponRec->dteStart);
         }
         $strOut .= $clsRpt->openRow(true);
         $strOut .= $clsRpt->writeCell(strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . '&nbsp;' . str_pad($lSponID, 5, '0', STR_PAD_LEFT), 60, $strIStyle);
         //---------------------------
         // active state
         //---------------------------
         $strOut .= $clsRpt->writeCell($strActiveDates, '', $strIStyle);
         if ($sponRec->bSponBiz) {
             $strLinkFID = 'business ID: ' . strLinkView_BizRecord($lFID, 'View business record', true);
         } else {
             $strLinkFID = 'people ID: ' . strLinkView_PeopleRecord($lFID, 'View people record', true);
         }
         $strLinkFID .= str_pad($lFID, 5, '0', STR_PAD_LEFT);
         //---------------------------
         // sponsor name
         //---------------------------
         $strHonoree = '';
         if ($sponRec->bHonoree) {
             $lHFID = $sponRec->lHonoreeID;
             if ($sponRec->bHonBiz) {
                 $strLinkHFID = 'business ID: ' . strLinkView_BizRecord($lHFID, 'View business record', true);
             } else {
                 $strLinkHFID = 'people ID: ' . strLinkView_PeopleRecord($lHFID, 'View people record', true);
             }
             $strLinkHFID .= str_pad($lHFID, 5, '0', STR_PAD_LEFT);
             $strHonoree = '<br><br>Honoree: ' . $sponRec->strHonSafeNameLF . '<br>' . $strLinkHFID;
         }
         $strContact = '<b>' . $sponRec->strSponSafeNameLF . '</b>' . '<br>' . $strLinkFID . $strHonoree . '<br>
             program: ' . htmlspecialchars($sponRec->strSponProgram);
         $strOut .= $clsRpt->writeCell($strContact, '', $strIStyle);
         //---------------------------
         // address / contact
         //---------------------------
         $strAddr = strBuildAddress($sponRec->strSponAddr1, $sponRec->strSponAddr2, $sponRec->strSponCity, $sponRec->strSponState, $sponRec->strSponCountry, $sponRec->strSponZip, true);
         if ($sponRec->strSponEmail . '' != '') {
             $strAddr .= strBuildEmailLink($sponRec->strSponEmail, '<br>', false, ' style="' . $strIStyle . '"');
         }
         $strPhone = strPhoneCell($sponRec->strSponPhone, $sponRec->strSponPhone, true, true);
         if ($strPhone != '') {
             $strAddr .= '<br>' . $strPhone;
         }
         $strOut .= $clsRpt->writeCell($strAddr, '', $strIStyle);
         //---------------------------
         // client
         //---------------------------
         $lClientID = $sponRec->lClientID;
         if (is_null($lClientID)) {
             if ($sponRec->bInactive) {
                 $strClientInfo = '<i>Client not set</i>';
             } else {
                 $strClientInfo = '<i>Client not set</i><br>' . strLinkAdd_ClientToSpon($lSponID, 'Add client to sponsorship', false);
             }
         } else {
             $strClientInfo = '<b>' . $sponRec->strClientSafeNameLF . '</b><br>' . 'client ID: ' . strLinkView_ClientRecord($lClientID, 'View client record', true) . str_pad($lClientID, 5, '0', STR_PAD_LEFT) . '<br>' . htmlspecialchars($sponRec->strLocation) . '<br>' . 'birth/age: ' . $sponRec->strClientAgeBDay;
             $strClientInfo .= '<br>' . htmlspecialchars($sponRec->strLocation);
         }
         $strOut .= $clsRpt->writeCell($strClientInfo, '', $strIStyle);
         //---------------------------
         // financial commitment
         //---------------------------
         $strOut .= $clsRpt->writeCell($sponRec->strCommitACOCurSym . ' ' . number_format($sponRec->curCommitment, 2) . ' ' . $sponRec->strCommitACOFlagImg . '<br>' . strLinkView_SponsorFinancials($lSponID, 'View sponsorship financials', true) . strLinkView_SponsorFinancials($lSponID, 'View financials', false), '', $strIStyle);
         $strOut .= $clsRpt->closeRow();
     }
     $strOut .= $clsRpt->closeReport();
     return $strOut;
 }
 function loadPeople($bIncludeSpon, $bIncludeGiftSum, $bPeople)
 {
     //------------------------------------------------------------------------------
     //
     //------------------------------------------------------------------------------
     $clsACO = new madmin_aco();
     $this->people = array();
     if ($bIncludeSpon) {
         $clsSpon = new msponsorship();
     }
     $sqlStr = "SELECT\n            pe_lKeyID,\n            pe_lHouseholdID,   pe_strTitle,      pe_strFName,\n            pe_strMName,       pe_strLName,      pe_strPreferredName,\n            pe_strSalutation,  pe_strAddr1,      pe_strAddr2,\n            pe_strCity,        pe_strState,      pe_strCountry,\n            pe_strZip,         pe_strPhone,      pe_strCell, pe_strEmail,\n            pe_enumGender,     pe_strNotes,      pe_bNoGiftAcknowledge,\n            pe_lAttributedTo,  pe_strImportID,\n            pe_lOriginID,      pe_lLastUpdateID,\n            tblAttrib.lgen_strListItem AS strAttrib,\n\n            pe_lACO, aco_strFlag, aco_strName, aco_strCurrencySymbol,\n\n            pe_dteBirthDate,\n            pe_dteDeathDate,\n            usersC.us_strFirstName AS strCFName, usersC.us_strLastName AS strCLName,\n            usersL.us_strFirstName AS strLFName, usersL.us_strLastName AS strLLName,\n            pe_dteExpire,\n            UNIX_TIMESTAMP(pe_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(pe_dteLastUpdate) AS dteLastUpdate\n         FROM people_names\n            INNER JOIN admin_users AS usersC ON pe_lOriginID    = usersC.us_lKeyID\n            INNER JOIN admin_users AS usersL ON pe_lLastUpdateID= usersL.us_lKeyID\n            INNER JOIN admin_aco             ON pe_lACO         = aco_lKeyID\n            {$this->sqlInnerExtra}\n            LEFT  JOIN lists_generic AS tblAttrib ON pe_lAttributedTo=tblAttrib.lgen_lKeyID\n\n         WHERE 1\n            {$this->sqlWhereExtra}\n            AND " . ($bPeople ? 'NOT ' : '') . "pe_bBiz\n            AND NOT pe_bRetired\n         {$this->sqlOrderExtra}\n         {$this->sqlLimitExtra};";
     $query = $this->db->query($sqlStr);
     $this->lNumPeople = $query->num_rows();
     if ($this->lNumPeople == 0) {
         $this->people[0] = new stdClass();
         $pRec =& $this->people[0];
         $pRec->lKeyID = $pRec->lHouseholdID = $pRec->bHOH = $pRec->strHouseholdName = $pRec->strTitle = $pRec->strFName = $pRec->strMName = $pRec->strLName = $pRec->strPreferredName = $pRec->strSafeName = $pRec->strSafeNameLF = null;
         $pRec->strSalutation = $pRec->strAddr1 = $pRec->strAddr2 = $pRec->strCity = $pRec->strState = $pRec->strCountry = $pRec->strZip = $pRec->strPhone = $pRec->strCell = $pRec->strAddress = null;
         $pRec->strEmail = $pRec->strEmailFormatted = $pRec->enumGender = $pRec->lACO = $pRec->strACO = $pRec->strCurSymbol = $pRec->strFlag = $pRec->strFlagImage = $pRec->bNoGiftAcknowledge = $pRec->lAttributedTo = $pRec->strAttrib = $pRec->lImportID = $pRec->strImportRecID = $pRec->dteExpire = $pRec->lOriginID = $pRec->lLastUpdateID = $pRec->dteMysqlBirthDate = $pRec->dteMysqlDeath = $pRec->dteOrigin = $pRec->dteLastUpdate = $pRec->strStaffCFName = $pRec->strStaffCLName = $pRec->strStaffLFName = $pRec->strStaffLLName = null;
     } else {
         $idx = 0;
         if ($bIncludeGiftSum) {
             $clsGifts = new mdonations();
             $clsGifts->bUseDateRange = false;
             $clsGifts->cumulativeOpts = new stdClass();
             $clsGifts->cumulativeOpts->enumCumulativeSource = 'people';
         }
         foreach ($query->result() as $row) {
             $this->people[$idx] = new stdClass();
             $pRec =& $this->people[$idx];
             $pRec->lKeyID = $lPID = $row->pe_lKeyID;
             $pRec->lHouseholdID = $lHID = $row->pe_lHouseholdID;
             $pRec->bHOH = $lHID == $lPID;
             $pRec->strHouseholdName = $this->strHouseholdNameViaHID($lHID);
             $pRec->strTitle = $strTitle = $row->pe_strTitle;
             $pRec->strFName = $strFName = $row->pe_strFName;
             $pRec->strMName = $strMName = $row->pe_strMName;
             $pRec->strLName = $strLName = $row->pe_strLName;
             $pRec->strPreferredName = $strPreferred = $row->pe_strPreferredName;
             $pRec->strSafeName = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $pRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $pRec->strSalutation = $row->pe_strSalutation;
             $pRec->strAddr1 = $row->pe_strAddr1;
             $pRec->strAddr2 = $row->pe_strAddr2;
             $pRec->strCity = $row->pe_strCity;
             $pRec->strState = $row->pe_strState;
             $pRec->strCountry = $row->pe_strCountry;
             $pRec->strZip = $row->pe_strZip;
             $pRec->strPhone = $row->pe_strPhone;
             $pRec->strCell = $row->pe_strCell;
             $pRec->strAddress = strBuildAddress($pRec->strAddr1, $pRec->strAddr2, $pRec->strCity, $pRec->strState, $pRec->strCountry, $pRec->strZip, true);
             $pRec->strEmail = $row->pe_strEmail;
             $pRec->strEmailFormatted = strBuildEmailLink($pRec->strEmail, '', false, '');
             $pRec->enumGender = $row->pe_enumGender;
             $pRec->lACO = $row->pe_lACO;
             $pRec->strACO = $row->aco_strName;
             $pRec->strCurSymbol = $row->aco_strCurrencySymbol;
             $pRec->strFlag = $row->aco_strFlag;
             $pRec->strFlagImage = $clsACO->strFlagImage($pRec->strFlag, $pRec->strACO);
             $pRec->bNoGiftAcknowledge = $row->pe_bNoGiftAcknowledge;
             $pRec->lAttributedTo = $row->pe_lAttributedTo;
             $pRec->strAttrib = $row->strAttrib;
             $pRec->lImportID = $row->pe_strImportID;
             $pRec->strImportRecID = $row->pe_strImportID;
             $pRec->dteExpire = dteMySQLDate2Unix($row->pe_dteExpire);
             $pRec->lOriginID = $row->pe_lOriginID;
             $pRec->lLastUpdateID = $row->pe_lLastUpdateID;
             $pRec->dteMysqlBirthDate = $row->pe_dteBirthDate;
             $pRec->dteMysqlDeath = $row->pe_dteDeathDate;
             $pRec->strNotes = $row->pe_strNotes;
             $pRec->dteOrigin = $row->dteOrigin;
             $pRec->dteLastUpdate = $row->dteLastUpdate;
             $pRec->strStaffCFName = $row->strCFName;
             $pRec->strStaffCLName = $row->strCLName;
             $pRec->strStaffLFName = $row->strLFName;
             $pRec->strStaffLLName = $row->strLLName;
             //-------------------
             // sponsorship
             //-------------------
             if ($bIncludeSpon) {
                 $clsSpon->sponsorshipInfoViaPID($lPID);
                 $pRec->lNumSponsorship = $lNumSpons = $clsSpon->lNumSponsors;
                 if ($lNumSpons == 0) {
                     $pRec->sponInfo = null;
                 } else {
                     $pRec->sponInfo = $clsSpon->sponInfo;
                 }
             }
             //-------------------
             // cumulative gifts
             //-------------------
             if ($bIncludeGiftSum) {
                 $clsGifts->lPeopleID = $lPID;
                 $clsGifts->cumulativeOpts->enumMoneySet = 'all';
                 $clsGifts->cumulativeOpts->bSoft = false;
                 $clsGifts->cumulativeDonation($clsACO, $pRec->lTotHardGifts);
                 $pRec->lNumACODonationGroups_hard = $clsGifts->lNumCumulative;
                 $pRec->donationsViaACO_hard = $clsGifts->cumulative;
                 $clsGifts->cumulativeOpts->bSoft = true;
                 $clsGifts->cumulativeDonation($clsACO, $pRec->lTotSoftGifts);
                 $pRec->lNumACODonationGroups_soft = $clsGifts->lNumCumulative;
                 $pRec->donationsViaACO_soft = $clsGifts->cumulative;
             } else {
                 $pRec->lNumACODonationGroups_hard = $pRec->donationsViaACO_hard = $pRec->lNumACODonationGroups_soft = $pRec->donationsViaACO_soft = null;
             }
             ++$idx;
         }
     }
 }
 $lPID = $contact->PID;
 if ($bHOH) {
     $strHOH = '<b>';
     $strEndHOH = '</b> <span class="smaller">(head)</span>';
     $bHOH = false;
 } else {
     $strHOH = strLinkSpecial_MakeHOH($lPID, $lHouseholdID, 'Make head-of-household', true) . ' ' . strLinkRem_PersonFromHousehold($lPID, $lHouseholdID, 'Remove from household', true, true, '');
     $strEndHOH = '';
 }
 $strAddr = strBuildAddress($contact->strAddr1, $contact->strAddr2, $contact->strCity, $contact->strState, $contact->strCountry, $contact->strZip, true);
 if ($strAddr != '') {
     $strAddr .= '<br><br>';
 }
 $strEmail = $contact->strEmail;
 if ($strEmail != '') {
     $strAddr .= strBuildEmailLink($strEmail, '', false, '') . '<br>';
 }
 $strPhone = $contact->strPhone;
 if ($strPhone != '') {
     $strAddr .= $strPhone;
 }
 if (bAllowAccess('showGiftHistory')) {
     if ($contact->lNumACODonationGroups_hard + $contact->lNumACODonationGroups_soft > 0) {
         $strLinkGiftHistory = '<br>' . strLinkView_GiftsHistory($lPID, 'Gift history', true) . ' ' . strLinkView_GiftsHistory($lPID, 'Gift history', false);
     }
 }
 echoT($clsRpt->openRow(true));
 echoT($clsRpt->writeCell(strLinkView_PeopleRecord($lPID, 'View people record', true) . '&nbsp;' . str_pad($lPID, 5, '0', STR_PAD_LEFT), 60));
 echoT($clsRpt->writeCell($strHOH, 60));
 echoT($clsRpt->writeCell($contact->strSafeNameLF, 60));
 echoT($clsRpt->writeCell($strAddr, 60));