public function strExportImgDocs($bImage, $enumContext)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $strDateFormat = strMysqlDateFormat(false);
     $strDateTimeFormat = strMysqlDateFormat(true);
     $strSiteURL = str_replace('/index.php', '', site_url(''));
     if ($bImage) {
         $strThumb = ' di_strSystemThumbFN          AS `Thumbnail File Name`, ' . "CONCAT(" . strPrepStr($strSiteURL) . ",\n                             SUBSTR(di_strPath, 2), '/', di_strSystemThumbFN)  AS `Thumbnail URL`, ";
     } else {
         $strThumb = '';
     }
     $strFieldNamesSel = "\n            ,\n            di_lKeyID AS `" . ($bImage ? 'imageID' : 'docID') . "`,\n            di_strCaptionTitle AS Caption,\n            di_strDescription  AS Description,\n            DATE_FORMAT(di_dteDocImage, {$strDateFormat}) AS `" . ($bImage ? 'Image' : 'Document') . " Date`,\n            IF(di_bProfile, 'Yes', 'No') AS `Profile?`,\n            di_strUserFN                 AS `User File Name`,\n            di_strSystemFN               AS `System File Name`,\n            CONCAT(" . strPrepStr($strSiteURL) . ", SUBSTR(di_strPath, 2), '/', di_strSystemFN) AS `File URL`,\n            {$strThumb}\n            di_strPath                   AS Path,\n            DATE_FORMAT(di_dteOrigin,     {$strDateTimeFormat}) AS `Record Creation Date`,\n            DATE_FORMAT(di_dteLastUpdate, {$strDateTimeFormat}) AS `Record Last Update` ";
     $strWhereExtra = ' AND di_enumEntryType=' . ($bImage ? "'image'" : "'pdf'") . ' AND NOT di_bRetired ' . ' AND di_enumContextType=' . strPrepStr($enumContext) . ' ';
     $sqlStr = $this->strTmpTableJoinedToContext($enumContext, 'docs_images', $strFieldNamesSel, 'di_lForeignID', false, $strWhereExtra, 'di_lKeyID, ');
     /*
     $zzzlPos = strrpos(__FILE__, '\\'); $zzzlLen=strlen(__FILE__);
     $zzzstrFile=substr(__FILE__, strrpos(__FILE__, '\\',-(($zzzlLen-$zzzlPos)+1)));
     echoT('<font class="debug">'.$zzzstrFile.' Line: <b>'.__LINE__.":</b><br><b>\$sqlStr=</b><br>".nl2br(htmlspecialchars($sqlStr))."<br><br></font>\n");
     die;
     */
     $query = $this->db->query($sqlStr);
     return $this->dbutil->csv_from_result($query);
 }
 function scheduleExport(&$sRpt)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gclsChapterVoc;
     $strDateFormat = strMysqlDateFormat(false);
     $this->entireEventInfo($sRpt->lEventIDs, $lNumEvents, $events);
     $strTempTable = 'tmpExp';
     $this->buildEventScheduleExportTable($strTempTable);
     foreach ($events as $event) {
         $rowFields = array();
         $fieldIDX = 0;
         $this->setExportField($rowFields, $fieldIDX, 'texp_lEventID', (string) $event->lKeyID);
         $this->setExportField($rowFields, $fieldIDX, 'texp_strEventName', strPrepStr($event->strEventName));
         $this->setExportField($rowFields, $fieldIDX, 'texp_strDescription', strPrepStr($event->strDescription));
         $this->setExportField($rowFields, $fieldIDX, 'texp_dteEventStartDate', strPrepDate($event->dteEventStart));
         $this->setExportField($rowFields, $fieldIDX, 'texp_dteEventEndDate', strPrepDate($event->dteEventEnd));
         $this->setExportField($rowFields, $fieldIDX, 'texp_strLocation', strPrepStr($event->strLocation));
         $this->setExportField($rowFields, $fieldIDX, 'texp_strContact', strPrepStr($event->strContact));
         $this->setExportField($rowFields, $fieldIDX, 'texp_strPhone', strPrepStr($event->strPhone));
         $this->setExportField($rowFields, $fieldIDX, 'texp_strEmail', strPrepStr($event->strEmail));
         $this->setExportField($rowFields, $fieldIDX, 'texp_strWebSite', strPrepStr($event->strWebSite));
         if ($event->lNumDates > 0) {
             foreach ($event->dates as $edate) {
                 $this->setExportField($rowFields, $fieldIDX, 'texp_lDateID', (string) $edate->lKeyID);
                 $this->setExportField($rowFields, $fieldIDX, 'texp_dteEventDate', strPrepDate($edate->dteEvent));
                 if ($edate->lNumShifts > 0) {
                     foreach ($edate->shifts as $shift) {
                         $this->setExportField($rowFields, $fieldIDX, 'texp_lShiftID', (string) $shift->lKeyID);
                         $this->setExportField($rowFields, $fieldIDX, 'texp_strShiftName', strPrepStr($shift->strShiftName));
                         $this->setExportField($rowFields, $fieldIDX, 'texp_strShiftDescription', strPrepStr($shift->strDescription));
                         $this->setExportField($rowFields, $fieldIDX, 'texp_dteShiftStartTime', strPrepDateTime($shift->dteEventStartTime));
                         $this->setExportField($rowFields, $fieldIDX, 'texp_enumDuration', strPrepStr($shift->enumDuration));
                         $this->setExportField($rowFields, $fieldIDX, 'texp_lNumVolsNeeded', (string) $shift->lNumVolsNeeded);
                         if ($shift->lNumVols > 0) {
                             foreach ($shift->vols as $vol) {
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_lVolID', (string) $vol->lVolID);
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_lPeopleID', (string) $vol->lPeopleID);
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strFName', strPrepStr($vol->strFName));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strLName', strPrepStr($vol->strLName));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strAddr1', strPrepStr($vol->strAddr1));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strAddr2', strPrepStr($vol->strAddr2));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strCity', strPrepStr($vol->strCity));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strState', strPrepStr($vol->strState));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strCountry', strPrepStr($vol->strCountry));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strZip', strPrepStr($vol->strZip));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strVolPhone', strPrepStr($vol->strPhone));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strCell', strPrepStr($vol->strCell));
                                 $this->setExportField($rowFields, $fieldIDX, 'texp_strVolEmail', strPrepStr($vol->strEmail));
                                 $this->writeTempScheduleExportRow($strTempTable, $rowFields);
                             }
                         } else {
                             $this->writeTempScheduleExportRow($strTempTable, $rowFields);
                         }
                         $this->expClearVolFields($rowFields);
                     }
                     $this->expClearShiftFields($rowFields);
                 } else {
                     $this->writeTempScheduleExportRow($strTempTable, $rowFields);
                 }
             }
             $this->expClearDateFields($rowFields);
         } else {
             $this->writeTempScheduleExportRow($strTempTable, $rowFields);
         }
     }
     $sqlStr = "SELECT\n            texp_lEventID              AS `event ID`,\n            texp_strEventName          AS `Event Name`,\n            texp_strDescription        AS `Event Description`,\n            DATE_FORMAT(texp_dteEventStartDate, {$strDateFormat}) AS `Event Start Date`,\n            DATE_FORMAT(texp_dteEventEndDate,   {$strDateFormat}) AS `Event End Date`,\n            texp_strLocation           AS `Event Location`,\n            texp_strContact            AS `Event Contact`,\n            texp_strPhone              AS `Contact Phone`,\n            texp_strEmail              AS `Contact Email`,\n            texp_strWebSite            AS `Event Web Site`,\n            texp_lDateID               AS `event date ID`,\n            DATE_FORMAT(texp_dteEventDate, {$strDateFormat}) AS `Event Date`,\n            DATE_FORMAT(texp_dteEventDate, '%W')           AS `Event Day of Week`,\n            texp_lShiftID              AS `shift ID`,\n            texp_strShiftName          AS `Shift Name`,\n            texp_strShiftDescription   AS `Shift Description`,\n            DATE_FORMAT(texp_dteShiftStartTime, '%l:%i %p') AS `Shift Start Time`,\n            texp_enumDuration          AS `Duration`,\n            texp_lNumVolsNeeded        AS `Num. Vols Needed`,\n            texp_lVolID                AS `volunteer ID`,\n            texp_lPeopleID             AS `people ID`,\n            texp_strFName              AS `Vol. First Name`,\n            texp_strLName              AS `Vol. Last Name`,\n            texp_strAddr1              AS `Vol. Address 1`,\n            texp_strAddr2              AS `Vol. Address 2`,\n            texp_strCity               AS `Vol. City`,\n            texp_strState              AS `Vol. {$gclsChapterVoc->vocState}`,\n            texp_strCountry            AS `Vol. Country`,\n            texp_strZip                AS `Vol. {$gclsChapterVoc->vocZip}`,\n            texp_strVolPhone           AS `Vol. Phone`,\n            texp_strCell               AS `Vol. Cell`,\n            texp_strVolEmail           AS `Vol. Email`\n\n         FROM {$strTempTable}\n         WHERE 1\n         ORDER BY texp_lKeyID;";
     $query = $this->db->query($sqlStr);
     return $this->dbutil->csv_from_result($query);
 }
 function strVolHoursDetailExport(&$sRpt)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $strDateFormat = strMysqlDateFormat(false);
     $this->hrsSumOpts($sRpt, $bUseYear, $lYear, $bUseMon, $lMon, $bUseVolID, $lVolID);
     $strTab = 'tmp_vol_hrs';
     $this->buildPopHrsTmp($strTab, $lYear, $lMon, $lVolID);
     $sqlStr = "SELECT\n               vsa_lKeyID       AS `Activity ID`,\n               lgen_strListItem AS `Activity`,\n               DATE_FORMAT(tmphr_dteVolActivity, {$strDateFormat}) AS `Date of Activity`,\n               FORMAT(vsa_dHoursWorked, 2) AS `Hours Logged`,\n               IF (vem_lKeyID IS NULL, 'n/a', vem_lKeyID) AS `Event ID`,\n               IF (vem_lKeyID IS NULL, '(unscheduled)', vem_strEventName) AS `Event Name`,\n               IF (vem_lKeyID IS NULL, 'n/a', vs_strShiftName) AS `Shift Name`,\n               vsa_strNotes AS `Notes`, " . strExportFields_Vol() . "\n             FROM {$strTab}\n                INNER JOIN vol_events_dates_shifts_assign ON vsa_lKeyID            = tmphr_lEventAssignID\n                INNER JOIN volunteers                     ON tmphr_lVolID          = vol_lKeyID\n                INNER JOIN people_names AS peepTab        ON vol_lPeopleID         = peepTab.pe_lKeyID\n                LEFT  JOIN vol_events_dates_shifts        ON vsa_lEventDateShiftID = vs_lKeyID\n                LEFT  JOIN vol_events_dates               ON vs_lEventDateID       = ved_lKeyID\n                LEFT  JOIN vol_events                     ON ved_lVolEventID       = vem_lKeyID\n                LEFT  JOIN lists_generic                  ON vsa_lActivityID       = lgen_lKeyID\n\n            ORDER BY tmphr_dteVolActivity, vsa_lKeyID;";
     $query = $this->db->query($sqlStr);
     return $this->dbutil->csv_from_result($query);
 }
 function strDepositLogExport(&$sRpt)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $strDateFormat = strMysqlDateFormat(false);
     $strDateTimeFormat = strMysqlDateFormat(true);
     $strTable = 'tmpDepExport';
     $this->createDepRptTmpTable($strTable);
     $sqlStr = "SELECT \n               dl_lKeyID AS `Deposit ID`,\n               tmp_lNumEntriesID AS `Number of Entries`,\n               tmp_curAmnt       AS `Total Deposit Amount`,\n               dl_lACOID         AS `ACO ID`,                \n               aco_strCurrencySymbol                    AS `Currency Symbol`, \n               aco_strName                              AS `Accounting Country`,\n               DATE_FORMAT(dl_dteStart, {$strDateFormat}) AS `Deposit Start`,\n               DATE_FORMAT(dl_dteEnd,   {$strDateFormat}) AS `Deposit End`,\n               dl_strBank                               AS `Bank`, \n               dl_strAccount                            AS `Bank Account`, \n               dl_strNotes                              AS `Notes`,  \n               CONCAT(usersC.us_strFirstName, ' ', usersC.us_strLastName) AS `Created By`,\n               CONCAT(usersL.us_strFirstName, ' ', usersL.us_strLastName) AS `Last Updated By`,\n\n               DATE_FORMAT(dl_dteOrigin, {$strDateTimeFormat})     AS `Created On`,\n               DATE_FORMAT(dl_dteLastUpdate, {$strDateTimeFormat}) AS `Last Updated On`\n\n             FROM {$strTable}\n               INNER JOIN  deposit_log          ON dl_lKeyID        = tmp_lDepositID\n               INNER JOIN admin_users AS usersC ON dl_lOriginID     = usersC.us_lKeyID\n               INNER JOIN admin_users AS usersL ON dl_lLastUpdateID = usersL.us_lKeyID\n               INNER JOIN admin_aco             ON dl_lACOID        = aco_lKeyID\n            WHERE NOT dl_bRetired\n            ORDER BY dl_dteEnd DESC, dl_lKeyID DESC;";
     $query = $this->db->query($sqlStr);
     return $this->dbutil->csv_from_result($query);
 }
function strExportFields_Client()
{
    /*---------------------------------------------------------------------
              FROM client_records
                 INNER JOIN client_location             ON cr_lLocationID         = cl_lKeyID
                 INNER JOIN client_status_cats          ON cr_lStatusCatID        = csc_lKeyID
                 INNER JOIN lists_client_vocab          ON cr_lVocID              = cv_lKeyID
                 INNER JOIN client_status               ON csh_lClientID          = cr_lKeyID
                 INNER JOIN lists_client_status_entries ON csh_lStatusID          = cst_lKeyID
                 LEFT  JOIN lists_generic               ON cr_lAttributedTo       = lgen_lKeyID
    
       ---------------------------------------------------------------------*/
    global $gclsChapterVoc;
    $strDateFormat = strMysqlDateFormat(false);
    $strDateTimeFormat = strMysqlDateFormat(true);
    return "\n             cr_lKeyID   AS clientID,\n             cr_strLName AS `Last Name`,  cr_strFName AS `First Name`,\n\n             DATE_FORMAT(cr_dteEnrollment, {$strDateFormat}    )    AS `Client Enrollment Date`,\n             DATE_FORMAT(cr_dteBirth,      {$strDateFormat}    )    AS `Client Birth Date`,\n\n             cr_enumGender    AS Gender,\n             cr_lMaxSponsors  AS `Max # Sponsors`,\n             cr_strBio        AS Biography,\n             cr_lVocID        AS `vocabulary ID`,\n\n             cr_lStatusCatID  AS `Status Category ID`,\n             csc_strCatName   AS `Status Category`,\n\n               -- ------------------------\n               -- current status\n               -- ------------------------\n             csh_lKeyID    AS `Client Status ID`,\n             cst_strStatus                          AS `Client Status`,\n             csh_strStatusTxt                       AS `Status Notes`,\n             DATE_FORMAT(csh_dteStatusDate,      {$strDateFormat}    ) AS `Date of Status`,\n--             IF(csh_bIncludeNotesInPacket, 'Yes', 'No') AS `Include Notes In Packet`,\n\n--             cst_lClientStatusCatID                 AS `Client Status Category ID`,\n--             csh_lStatusID                        AS `Status Entry ID`,\n             IF(cst_bAllowSponsorship, 'Yes', 'No') AS `Allows Sponsorship`,\n             IF(cst_bShowInDir,        'Yes', 'No') AS `Show In Directory`,\n             IF(cst_bDefault,          'Yes', 'No') AS `Default Status`,\n          --   curStatSCat.csc_strCatName             AS `Status Category Name`,\n          --   defSCat.csc_strCatName               AS `Default Status Category Name`,\n\n             cr_lLocationID    AS `location ID`,\n             cl_strLocation    AS `Location`,\n             cl_strCountry     AS `Location Country`,\n             cl_strAddress1    AS `Location Address 1`,\n             cl_strAddress2    AS `Location Address 2`,\n             cl_strCity        AS `Location City`,\n             cl_strState       AS `Location {$gclsChapterVoc->vocState}`,\n             cl_strPostalCode  AS `Location {$gclsChapterVoc->vocZip}`,\n\n             cr_strAddr1       AS `Address 1`,\n             cr_strAddr2       AS `Address 2`,\n             cr_strCity        AS City,\n             cr_strState       AS `{$gclsChapterVoc->vocState}`,\n             cr_strCountry     AS Country,\n             cr_strZip         AS `{$gclsChapterVoc->vocZip}`,\n             cr_strPhone       AS Phone,\n             cr_strCell        AS Cell,\n             cr_strEmail       AS Email,\n\n             cr_lVocID         AS `Vocabulary ID`,\n             cv_strVocTitle    AS `Vocabulary Title`,\n             cv_strVocClientS  AS `Voc: Client (singular)`,\n             cv_strVocClientP  AS `Voc: Client (plural)`,\n             cv_strVocSponsorS AS `Voc: Sponsor (singular)`,\n             cv_strVocSponsorP AS `Voc: Sponsor (plural)`,\n             cv_strVocLocS     AS `Voc: Location (singular)`,\n             cv_strVocLocP     AS `Voc: Location (plural)`,\n             cv_strVocSubLocS  AS `Voc: Sub-location (singular)`,\n             cv_strVocSubLocP  AS `Voc: Sub-location (plural)`,\n             lgen_strListItem  AS `Attributed To`,\n\n             DATE_FORMAT(cr_dteOrigin,     {$strDateTimeFormat}) AS `Record Creation Date`,\n             DATE_FORMAT(cr_dteLastUpdate, {$strDateTimeFormat}) AS `Record Last Update`\n             ";
}
 public function searchSponsors(&$local)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $strDateFormat = strMysqlDateFormat(false);
     $sqlStr = "SELECT sp_lKeyID,\n            sp_lClientID, sp_lSponsorProgramID, sp_bInactive,\n            pe_lKeyID, pe_bBiz, pe_strFName, pe_strMName,\n            pe_strLName, pe_strAddr1, pe_strAddr2, pe_strCity,\n            pe_strState, pe_strCountry, pe_strZip,\n            DATE_FORMAT(cr_dteBirth, {$strDateFormat}) AS strClientBDate, cr_enumGender,\n            cr_strFName, cr_strLName, cl_strLocation, cl_strCountry,\n            sc_strProgram\n         FROM sponsor\n            INNER JOIN people_names               ON pe_lKeyID      = sp_lForeignID\n            INNER JOIN lists_sponsorship_programs ON sc_lKeyID      = sp_lSponsorProgramID\n            LEFT  JOIN client_records             ON cr_lKeyID      = sp_lClientID\n            LEFT  JOIN client_location            ON cr_lLocationID = cl_lKeyID\n         WHERE NOT pe_bRetired AND NOT sp_bRetired\n            {$this->strWhereExtra}\n         ORDER BY pe_strLName, pe_strFName, pe_strMName, pe_lKeyID;";
     $query = $local->db->query($sqlStr);
     $numRows = $query->num_rows();
     $clsResult = new stdClass();
     $clsResult->strResult = "\n\n\n\n";
     if ($numRows > 0) {
         foreach ($query->result() as $row) {
             $bBiz = $row->pe_bBiz;
             $lSponID = $row->sp_lKeyID;
             $bInactive = $row->sp_bInactive;
             $this->searchResults[$this->lNumSearchResults] = new stdClass();
             $clsResult = $this->searchResults[$this->lNumSearchResults];
             $clsResult->lKeyID = $row->sp_lKeyID;
             if ($bInactive) {
                 $strStart = '<span style="color: #999;">';
                 $strStop = '</span>';
             } else {
                 $strStart = $strStop = '';
             }
             $clsResult->strResult .= $strStart;
             if ($bBiz) {
                 $clsResult->strResult .= '<b>' . htmlspecialchars($row->pe_strLName) . '</b><br>';
             } else {
                 $clsResult->strResult .= '<b>' . htmlspecialchars($row->pe_strLName) . '</b>, ' . htmlspecialchars($row->pe_strFName) . "<br>\n";
             }
             $clsResult->strResult .= strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true, true) . '<br>' . '<b>program:</b> ' . htmlspecialchars($row->sc_strProgram);
             if (is_null($row->sp_lClientID)) {
                 $clsResult->strResult .= '<br>Client not set';
             } else {
                 $clsResult->strResult .= '<br><br>' . '<b>client:</b> ' . htmlspecialchars($row->cr_strLName . ', ' . $row->cr_strFName) . '<br>' . '<b>birthdate:</b> ' . $row->strClientBDate . '<br>' . '<b>gender:</b> ' . $row->cr_enumGender . '<br>' . '<b>location:</b> ' . htmlspecialchars($row->cl_strLocation . ' / ' . $row->cl_strCountry) . '<br>' . '<b>status:</b> ' . ($bInactive ? 'Inactive' : 'Active');
             }
             $clsResult->strResult .= $strStop;
             ++$this->lNumSearchResults;
         }
     }
 }
示例#7
0
 private function strAttribRptPeopleBiz(&$sRpt, $strLimit, $strAttrib, $bPeople, $strLabel)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $strDateFormat = strMysqlDateFormat(false);
     $strDateTimeFormat = strMysqlDateFormat(true);
     $sqlStr = "SELECT\n             peepTab.pe_lKeyID AS lFID,\n             peepTab.pe_strLName AS strLName, peepTab.pe_strFName AS strFName,\n             peepTab.pe_strAddr1 AS strAddr1, peepTab.pe_strAddr2 AS strAddr2,\n             peepTab.pe_strCity AS strCity, peepTab.pe_strState AS strState,\n             peepTab.pe_strCountry AS strCountry,\n             peepTab.pe_strZip AS strZip, peepTab.pe_strPhone AS strPhone,\n             peepTab.pe_strCell AS strCell, peepTab.pe_strEmail AS strEmail,\n\n             -- peepTab.pe_lACO,\n             -- aco_strName,\n             -- aco_strCurrencySymbol,\n             -- aco_strFlag,\n             peepTab.pe_lHouseholdID,\n             CONCAT('The ', houseTab.pe_strFName,' ', houseTab.pe_strLName, ' Household') AS household,\n\n             DATE_FORMAT(peepTab.pe_dteOrigin, {$strDateTimeFormat}) AS strDateOrigin\n\n          FROM people_names AS peepTab\n             INNER JOIN people_names AS houseTab ON peepTab.pe_lHouseholdID=houseTab.pe_lKeyID\n             -- INNER JOIN admin_aco     ON peepTab.pe_lACO=aco_lKeyID\n          WHERE NOT peepTab.pe_bRetired\n             AND peepTab.pe_lAttributedTo {$strAttrib}\n             AND " . ($bPeople ? 'NOT' : '') . " peepTab.pe_bBiz\n          ORDER BY peepTab.pe_strLName, peepTab.pe_strFName, peepTab.pe_strMName, peepTab.pe_lKeyID\n          {$strLimit};";
     $query = $this->db->query($sqlStr);
     $strOut = '<table class="enpRptC">
         <tr>
            <td class="enpRptTitle" colspan="6">' . ($bPeople ? 'People' : 'Business/Organization') . ' records ' . $strLabel . '
            </td>
         </tr>
         <tr>
            <td class="enpRptLabel">' . ($bPeople ? 'peopleID' : 'businessID') . '
            </td>
            <td class="enpRptLabel">
               Name
            </td>
            <td class="enpRptLabel">
               Address
            </td>
            <td class="enpRptLabel">
               Household
            </td>
            <td class="enpRptLabel">
               Phone/Email
            </td>
            <td class="enpRptLabel">
               Creation Date
            </td>
         </tr>';
     foreach ($query->result() as $row) {
         $lFID = $row->lFID;
         if ($row->strEmail . '' == '') {
             $strEmail = '';
         } else {
             $strEmail = '<br>' . mailto($row->strEmail, $row->strEmail);
         }
         if ($bPeople) {
             $strLink = strLinkView_PeopleRecord($lFID, 'View people record', true) . '&nbsp;';
         } else {
             $strLink = strLinkView_BizRecord($lFID, 'View people record', true) . '&nbsp;';
         }
         $strOut .= '<tr class="makeStripe">
               <td class="enpRpt" style="width: 65px;">' . $strLink . str_pad($lFID, 5, '0', STR_PAD_LEFT) . '
               </td>
               <td class="enpRpt" style="width: 140px;">' . htmlspecialchars($row->strLName . ($bPeople ? ', ' . $row->strFName : '')) . '
               </td>
               <td class="enpRpt" style="width: 190px;">' . strBuildAddress($row->strAddr1, $row->strAddr2, $row->strCity, $row->strState, $row->strCountry, $row->strZip, true) . '
               </td>
               <td class="enpRpt" style="width: 190px;">' . htmlspecialchars($row->household) . '
               </td>
               <td class="enpRpt" style="width: 140px;">' . strPhoneCell($row->strPhone, $row->strCell, true, true) . $strEmail . '
               </td>
               <td class="enpRpt" style="width: 130px; text-align: center;">' . $row->strDateOrigin . '
               </td>
            </tr>' . "\n";
         $strOut .= '</tr>' . "\n";
     }
     $strOut .= '</table><br>';
     return $strOut;
 }