public function loadBizRecs($bIncludeSpon, $bIncludeGiftSum) { //----------------------------------------------------------------------- // //----------------------------------------------------------------------- $clsACO = new madmin_aco(); $this->bizRecs = array(); $sqlStr = "SELECT\n pe_lKeyID,\n pe_strLName,\n pe_strAddr1, pe_strAddr2,\n pe_strCity, pe_strState, pe_strCountry,\n pe_strZip, pe_strPhone, pe_strCell, pe_strEmail,\n pe_lAttributedTo, pe_strImportID, pe_strImportID, pe_strNotes,\n pe_strFax, pe_strWebSite,\n pe_lOriginID, pe_lLastUpdateID, pe_lBizIndustryID,\n tblIndustry.lgen_strListItem AS strIndustry,\n\n pe_lACO, aco_strFlag, aco_strName, aco_strCurrencySymbol,\n tblAttrib.lgen_strListItem AS strAttrib,\n\n usersC.us_strFirstName AS strCFName, usersC.us_strLastName AS strCLName,\n usersL.us_strFirstName AS strLFName, usersL.us_strLastName AS strLLName,\n UNIX_TIMESTAMP(pe_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(pe_dteLastUpdate) AS dteLastUpdate\n {$this->sqlSelectExtra}\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 LEFT JOIN lists_generic AS tblIndustry ON pe_lBizIndustryID = tblIndustry.lgen_lKeyID\n LEFT JOIN lists_generic AS tblAttrib ON pe_lAttributedTo = tblAttrib.lgen_lKeyID\n WHERE pe_bBiz\n {$this->sqlWhereExtra}\n AND NOT pe_bRetired\n {$this->sqlOrderExtra}\n {$this->sqlLimitExtra};"; $query = $this->db->query($sqlStr); $this->lNumBizRecs = $query->num_rows(); if ($this->lNumBizRecs == 0) { $this->bizRecs[0] = null; } else { $idx = 0; if ($bIncludeGiftSum) { $clsGifts = new mdonations(); $clsGifts->bUseDateRange = false; $clsGifts->cumulativeOpts = new stdClass(); $clsGifts->cumulativeOpts->enumCumulativeSource = 'biz'; } if ($bIncludeSpon) { $clsSpon = new msponsorship(); } foreach ($query->result() as $row) { $this->bizRecs[$idx] = new stdclass(); $biz =& $this->bizRecs[$idx]; $biz->lKeyID = $lBID = $this->lBID = $row->pe_lKeyID; $biz->strBizName = $row->pe_strLName; $biz->strSafeName = htmlspecialchars($biz->strBizName); $biz->lIndustryID = $row->pe_lBizIndustryID; $biz->strIndustry = $row->strIndustry; $biz->strAddr1 = $row->pe_strAddr1; $biz->strAddr2 = $row->pe_strAddr2; $biz->strCity = $row->pe_strCity; $biz->strState = $row->pe_strState; $biz->strCountry = $row->pe_strCountry; $biz->strZip = $row->pe_strZip; $biz->strPhone = $row->pe_strPhone; $biz->strCell = $row->pe_strCell; $biz->strFax = $row->pe_strFax; $biz->strWebSite = $row->pe_strWebSite; $biz->strAddress = strBuildAddress($biz->strAddr1, $biz->strAddr2, $biz->strCity, $biz->strState, $biz->strCountry, $biz->strZip, true); $biz->strEmail = $row->pe_strEmail; $biz->strEmailFormatted = strBuildEmailLink($biz->strEmail, '', false, ''); $biz->strNotes = $row->pe_strNotes; $biz->lACO = $row->pe_lACO; $biz->strACO = $row->aco_strName; $biz->strCurSymbol = $row->aco_strCurrencySymbol; $biz->strFlag = $row->aco_strFlag; $biz->strFlagImage = $clsACO->strFlagImage($biz->strFlag, $biz->strACO); $biz->lAttributedTo = $row->pe_lAttributedTo; $biz->strAttrib = $row->strAttrib; $biz->lImportID = $row->pe_strImportID; $biz->strImportRecID = $row->pe_strImportID; $biz->lOriginID = $row->pe_lOriginID; $biz->lLastUpdateID = $row->pe_lLastUpdateID; $biz->dteOrigin = $row->dteOrigin; $biz->dteLastUpdate = $row->dteLastUpdate; $biz->strStaffCFName = $row->strCFName; $biz->strStaffCLName = $row->strCLName; $biz->strStaffLFName = $row->strLFName; $biz->strStaffLLName = $row->strLLName; $biz->contactList = $this->contactList(true, false, false); //------------------- // sponsorship //------------------- if ($bIncludeSpon) { $clsSpon->sponsorshipInfoViaPID($lBID); $biz->lNumSponsorship = $lNumSpons = $clsSpon->lNumSponsors; if ($lNumSpons == 0) { $biz->sponInfo = null; } else { $biz->sponInfo = $clsSpon->sponInfo; } } //------------------- // cumulative gifts //------------------- if ($bIncludeGiftSum) { $clsGifts->lPeopleID = $lBID; $clsGifts->cumulativeOpts->enumMoneySet = 'all'; $clsGifts->cumulativeOpts->bSoft = false; $clsGifts->cumulativeDonation($clsACO, $biz->lNumHardGifts); $biz->lNumACODonationGroups_hard = $clsGifts->lNumCumulative; $biz->donationsViaACO_hard = $clsGifts->cumulative; $clsGifts->cumulativeOpts->bSoft = true; $clsGifts->cumulativeDonation($clsACO, $biz->lNumSoftGifts); $biz->lNumACODonationGroups_soft = $clsGifts->lNumCumulative; $biz->donationsViaACO_soft = $clsGifts->cumulative; } else { $biz->lNumACODonationGroups_hard = $biz->donationsViaACO_hard = $biz->lNumACODonationGroups_soft = $biz->donationsViaACO_soft = null; } ++$idx; } } }
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; } } }