public function loadBasicBizInfo() { //----------------------------------------------------------------------- // //----------------------------------------------------------------------- global $gbDev; $clsACO = new madmin_aco(); if (is_null($this->lBID)) { screamForHelp('BIZ ID NOT SET!<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__); } $sqlStr = "SELECT\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,\n pe_lOriginID, pe_lLastUpdateID, pe_lBizIndustryID, lgen_strListItem,\n\n pe_lACO, aco_strFlag, aco_strName, aco_strCurrencySymbol,\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 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 ON pe_lBizIndustryID = lgen_lKeyID\n WHERE pe_lKeyID={$this->lBID}\n AND NOT pe_bRetired;"; $query = $this->db->query($sqlStr); $numRows = $query->num_rows(); // $result = mysql_query($sqlStr); // if (bSQLError('SQL error on line '.__LINE__.', file '.__FILE__.', function '.__FUNCTION__, $sqlStr) ) { // screamForHelp('Unexpected SQL error'); // }else{ // $numRows = mysql_num_rows($result); if ($numRows == 0) { if ($gbDev) { echo '<font face="monospace" style="font-size: 8pt;">' . __FILE__ . ' Line: <b>' . __LINE__ . ":</b><br><b>\$sqlStr=</b><br>" . nl2br($sqlStr) . "<br><br></font>\n"; } screamForHelp('UNEXPECTED EOF<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__, true); } else { // $row = mysql_fetch_array($result); $row = $query->row(); $this->strBizName = $row->pe_strLName; $this->strSafeName = htmlspecialchars($this->strBizName); $this->lIndustryID = $row->pe_lBizIndustryID; $this->strIndustry = $row->lgen_strListItem; $this->strAddr1 = $row->pe_strAddr1; $this->strAddr2 = $row->pe_strAddr2; $this->strCity = $row->pe_strCity; $this->strState = $row->pe_strState; $this->strCountry = $row->pe_strCountry; $this->strZip = $row->pe_strZip; $this->strPhone = $row->pe_strPhone; $this->strCell = $row->pe_strCell; $this->strAddress = strBuildAddress($this->strAddr1, $this->strAddr2, $this->strCity, $this->strState, $this->strCountry, $this->strZip, true); $this->strEmail = $row->pe_strEmail; $this->strEmailFormatted = strBuildEmailLink($this->strEmail, '', false, ''); $this->lACO = $row->pe_lACO; $this->strACO = $row->aco_strName; $this->strCurSymbol = $row->aco_strCurrencySymbol; $this->strFlag = $row->aco_strFlag; $this->strFlagImage = $clsACO->strFlagImage($this->strFlag, $this->strACO); $this->lAttributedTo = $row->pe_lAttributedTo; $this->lImportID = $row->pe_strImportID; $this->strImportRecID = $row->pe_strImportID; $this->lOriginID = $row->pe_lOriginID; $this->lLastUpdateID = $row->pe_lLastUpdateID; $this->dteOrigin = $row->dteOrigin; $this->dteLastUpdate = $row->dteLastUpdate; $this->strStaffCFName = $row->strCFName; $this->strStaffCLName = $row->strCLName; $this->strStaffLFName = $row->strLFName; $this->strStaffLLName = $row->strLLName; $this->contactList(true, false, false); } // } }
function loadAuctions() { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $this->auctions = array(); $sqlStr = "SELECT\n auc_lKeyID, auc_strAuctionName, auc_strDescription,\n auc_dteAuctionDate,\n\n auc_strLocation, auc_strContact, auc_strPhone, auc_strEmail,\n auc_lDefaultBidSheet, abs_lKeyID, abs_lTemplateID, abs_strSheetName,\n auc_lCampaignID, gc_strCampaign,\n ga_lKeyID, ga_strAccount,\n\n auc_lACOID,\n aco_strFlag, aco_strCurrencySymbol, aco_strName,\n\n auc_lOriginID, auc_lLastUpdateID,\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(auc_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(auc_dteLastUpdate) AS dteLastUpdate\n\n FROM gifts_auctions\n INNER JOIN admin_users AS usersC ON auc_lOriginID = usersC.us_lKeyID\n INNER JOIN admin_users AS usersL ON auc_lLastUpdateID = usersL.us_lKeyID\n INNER JOIN admin_aco ON auc_lACOID = aco_lKeyID\n INNER JOIN gifts_campaigns ON auc_lCampaignID = gc_lKeyID\n INNER JOIN gifts_accounts ON gc_lAcctID = ga_lKeyID\n LEFT JOIN gifts_auctions_bidsheets ON abs_lKeyID = auc_lDefaultBidSheet\n\n WHERE NOT auc_bRetired\n {$this->strWhereExtra}\n ORDER BY auc_dteAuctionDate DESC, auc_strAuctionName, auc_lKeyID;"; $query = $this->db->query($sqlStr); $this->lNumAuctions = $lNumAuctions = $query->num_rows(); if ($lNumAuctions == 0) { $this->auctions[0] = new stdClass(); $auction =& $this->auctions[0]; $auction->lKeyID = $auction->strAuctionName = $auction->strSafeName = $auction->strDescription = $auction->dteAuction = $auction->mdteAuction = $auction->lDefaultBidSheet = $auction->lBidsheetID = $auction->lTemplateID = $auction->tInfo = $auction->strLocation = $auction->strContact = $auction->strPhone = $auction->strEmail = $auction->lCampaignID = $auction->strCampaign = $auction->lAccountID = $auction->strAccount = $auction->lACOID = $auction->strFlag = $auction->strCurrencySymbol = $auction->strACOName = $auction->auc_lOriginID = $auction->auc_lLastUpdateID = $auction->strCFName = $auction->strCLName = $auction->strLFName = $auction->strLLName = $auction->dteOrigin = $auction->dteLastUpdate = null; } else { $idx = 0; $cACO = new madmin_aco(); foreach ($query->result() as $row) { $this->auctions[$idx] = new stdClass(); $auction =& $this->auctions[$idx]; $auction->lKeyID = $row->auc_lKeyID; $auction->strAuctionName = $row->auc_strAuctionName; $auction->strSafeName = htmlspecialchars($row->auc_strAuctionName); $auction->strDescription = $row->auc_strDescription; $auction->dteAuction = dteMySQLDate2Unix($row->auc_dteAuctionDate); $auction->mdteAuction = $row->auc_dteAuctionDate; $auction->lDefaultBidSheet = $row->auc_lDefaultBidSheet; $auction->lBidsheetID = $row->abs_lKeyID; $auction->lTemplateID = $lTemplateID = $row->abs_lTemplateID; if (is_null($lTemplateID)) { $auction->tInfo = null; } else { strXlateTemplate($lTemplateID, $auction->tInfo); } $auction->strSheetName = $row->abs_strSheetName; $auction->lCampaignID = $row->auc_lCampaignID; $auction->strCampaign = $row->gc_strCampaign; $auction->lAccountID = $row->ga_lKeyID; $auction->strAccount = $row->ga_strAccount; $auction->strLocation = $row->auc_strLocation; $auction->strContact = $row->auc_strContact; $auction->strPhone = $row->auc_strPhone; $auction->strEmail = $row->auc_strEmail; $auction->lACOID = $row->auc_lACOID; $auction->strCurrencySymbol = $row->aco_strCurrencySymbol; $auction->strACOName = $row->aco_strName; $auction->strFlag = $row->aco_strFlag; $auction->strFlagImg = $cACO->strFlagImage($auction->strFlag, $auction->strACOName); $auction->auc_lOriginID = $row->auc_lOriginID; $auction->auc_lLastUpdateID = $row->auc_lLastUpdateID; $auction->strCFName = $row->strCFName; $auction->strCLName = $row->strCLName; $auction->strLFName = $row->strLFName; $auction->strLLName = $row->strLLName; $auction->dteOrigin = $row->dteOrigin; $auction->dteLastUpdate = $row->dteLastUpdate; ++$idx; } } }
public function loadPaymentRecords() { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $clsACO = new madmin_aco(); $this->paymentRec = array(); $sqlStr = "SELECT\n gi_lKeyID,\n\n gi_lForeignID, gi_lSponsorID, gi_curAmnt, gi_lACOID,\n gi_dteDonation,\n gi_strCheckNum, gi_strImportID,\n gi_lPaymentType, listPayType.lgen_strListItem AS strPaymentType,\n gi_bRetired,\n\n gi_lOriginID, gi_lLastUpdateID,\n UNIX_TIMESTAMP(gi_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(gi_dteLastUpdate) AS dteLastUpdate,\n\n aco_strFlag, aco_strName, aco_strCurrencySymbol,\n\n sp_lForeignID, sp_bInactive, sp_lClientID,\n pSpon.pe_bBiz AS bSponBiz, pSpon.pe_strFName AS strSponFName, pSpon.pe_strLName AS strSponLName,\n pDon.pe_bBiz AS bDonorBiz, pDon.pe_strFName AS strDonorFName, pDon.pe_strLName AS strDonorLName,\n cr_strFName, cr_strLName,\n cr_lLocationID, cl_strLocation,\n\n usersC.us_strFirstName AS strCFName, usersC.us_strLastName AS strCLName,\n usersL.us_strFirstName AS strLFName, usersL.us_strLastName AS strLLName\n\n FROM gifts\n INNER JOIN admin_aco ON gi_lACOID = aco_lKeyID\n INNER JOIN sponsor ON sp_lKeyID = gi_lSponsorID\n INNER JOIN people_names AS pSpon ON sp_lForeignID = pSpon.pe_lKeyID\n INNER JOIN people_names AS pDon ON gi_lForeignID = pDon.pe_lKeyID\n\n INNER JOIN admin_users AS usersC ON gi_lOriginID = usersC.us_lKeyID\n INNER JOIN admin_users AS usersL ON gi_lLastUpdateID = usersL.us_lKeyID\n\n LEFT JOIN lists_generic AS listPayType ON gi_lPaymentType = listPayType.lgen_lKeyID\n LEFT JOIN client_records ON sp_lClientID = cr_lKeyID\n LEFT JOIN client_location ON cr_lLocationID = cl_lKeyID\n WHERE NOT gi_bRetired {$this->strPayWhere}\n {$this->strPayOrderExtra}\n {$this->strLimit};"; $query = $this->db->query($sqlStr); $this->lNumPayRecs = $numRows = $query->num_rows(); if ($numRows == 0) { $this->paymentRec[0] = new stdClass(); $payRec =& $this->paymentRec[0]; $payRec->lKeyID = $payRec->curPaymentAmnt = $payRec->dtePayment = $payRec->strCheckNum = $payRec->lPaymentType = $payRec->strPaymentType = $payRec->strImportID = $payRec->bRetired = $payRec->lACOID = $payRec->strACO = $payRec->strCurSymbol = $payRec->strFlag = $payRec->strFlagImage = null; //-------------------------- // Sponsor/client fields //-------------------------- $payRec->lSponsorshipID = $payRec->lSponPeopleID = $payRec->bInactive = $payRec->lClientID = $payRec->bSponBiz = $payRec->strSponFName = $payRec->strSponLName = $payRec->strSponSafeNameFL = $payRec->strClientFName = $payRec->strClientLName = $payRec->strClientSafeNameFL = $payRec->lLocationID = $payRec->strLocation = null; //-------------------------- // Donor fields //-------------------------- $payRec->lDonorID = $payRec->bDonorBiz = $payRec->strDonorFName = $payRec->strDonorLName = $payRec->strDonorSafeNameFL = $payRec->lOriginID = $payRec->lLastUpdateID = $payRec->dteOrigin = $payRec->dteLastUpdate = $payRec->strStaffCFName = $payRec->strStaffCLName = $payRec->strStaffLFName = $payRec->strStaffLLName = null; } else { $idx = 0; foreach ($query->result() as $row) { $this->paymentRec[$idx] = new stdClass(); $payRec =& $this->paymentRec[$idx]; $payRec->lKeyID = (int) $row->gi_lKeyID; $payRec->curPaymentAmnt = (double) $row->gi_curAmnt; $payRec->dtePayment = dteMySQLDate2Unix($row->gi_dteDonation); $payRec->strCheckNum = $row->gi_strCheckNum; $payRec->lPaymentType = $row->gi_lPaymentType; $payRec->strPaymentType = $row->strPaymentType; $payRec->strImportID = $row->gi_strImportID; $payRec->bRetired = $row->gi_bRetired; //--------------- // ACO fields //--------------- $payRec->lACOID = (int) $row->gi_lACOID; $payRec->strACO = $row->aco_strName; $payRec->strCurSymbol = $row->aco_strCurrencySymbol; $payRec->strFlag = $row->aco_strFlag; $payRec->strFlagImage = $clsACO->strFlagImage($row->aco_strFlag, $row->aco_strName); //-------------------------- // Sponsor/client fields //-------------------------- $payRec->lSponsorshipID = $row->gi_lSponsorID; $payRec->lSponPeopleID = $row->sp_lForeignID; $payRec->bInactive = $row->sp_bInactive; $payRec->lClientID = $row->sp_lClientID; $payRec->bSponBiz = $row->bSponBiz; $payRec->strSponFName = $row->strSponFName; $payRec->strSponLName = $row->strSponLName; if ($payRec->bSponBiz) { $payRec->strSponSafeNameFL = $payRec->strSponSafeNameLF = htmlspecialchars($row->strSponLName); } else { $payRec->strSponSafeNameFL = htmlspecialchars($row->strSponFName . ' ' . $row->strSponLName); $payRec->strSponSafeNameLF = htmlspecialchars($row->strSponLName . ', ' . $row->strSponFName); } $payRec->strClientFName = $row->cr_strFName; $payRec->strClientLName = $row->cr_strLName; $payRec->strClientSafeNameFL = htmlspecialchars($row->cr_strFName . ' ' . $row->cr_strLName); $payRec->lLocationID = $row->cr_lLocationID; $payRec->strLocation = $row->cl_strLocation; //-------------------------- // Donor fields //-------------------------- $payRec->lDonorID = $row->gi_lForeignID; $payRec->bDonorBiz = $row->bDonorBiz; $payRec->strDonorFName = $row->strDonorFName; $payRec->strDonorLName = $row->strDonorLName; if ($payRec->bSponBiz) { $payRec->strDonorSafeNameFL = $payRec->strDonorSafeNameLF = htmlspecialchars($row->strSponLName); } else { $payRec->strDonorSafeNameFL = htmlspecialchars($row->strDonorFName . ' ' . $row->strDonorLName); $payRec->strDonorSafeNameLF = htmlspecialchars($row->strDonorLName . ', ' . $row->strDonorFName); } //-------------------------- // Record info //-------------------------- $payRec->lOriginID = $row->gi_lOriginID; $payRec->lLastUpdateID = $row->gi_lLastUpdateID; $payRec->dteOrigin = $row->dteOrigin; $payRec->dteLastUpdate = $row->dteLastUpdate; $payRec->strStaffCFName = $row->strCFName; $payRec->strStaffCLName = $row->strCLName; $payRec->strStaffLFName = $row->strLFName; $payRec->strStaffLLName = $row->strLLName; ++$idx; } } }
function loadIItems($sqlWhere, &$lNumItems, &$items, $bLoadStatus = false) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $clsACO = new madmin_aco(); $items = array(); $sqlStr = "SELECT\n ivi_lKeyID, ivi_strItemName, ivi_strItemSNa, ivi_strItemSNb,\n ivi_strLocation, ivi_strDescription, ivi_lCategoryID,\n ivi_strRParty,\n ivi_dteObtained, ivi_dteRemInventory, ivi_dteReportedLost,\n ivi_bAvailForLoan,\n ivi_strLostNotes,\n ivi_lFlaggedLostByID, ivi_lRemInventoryByID,\n\n ivc_strCatName,\n ivi_lOriginID, ivi_lLastUpdateID,\n UNIX_TIMESTAMP(ivi_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(ivi_dteLastUpdate) AS dteLastUpdate,\n\n ivi_curEstValue, ivi_lACOID, aco_strFlag, aco_strCurrencySymbol, aco_strName,\n\n uc.us_strFirstName AS strCFName, uc.us_strLastName AS strCLName,\n ul.us_strFirstName AS strLFName, ul.us_strLastName AS strLLName,\n ur.us_strFirstName AS strRemInvFName, ur.us_strLastName AS strRemInvLName,\n ulost.us_strFirstName AS strLostFName, ulost.us_strLastName AS strLostLName\n\n FROM inv_items\n INNER JOIN admin_users AS uc ON uc.us_lKeyID = ivi_lOriginID\n INNER JOIN admin_users AS ul ON ul.us_lKeyID = ivi_lLastUpdateID\n LEFT JOIN admin_users AS ur ON ur.us_lKeyID = ivi_lRemInventoryByID\n LEFT JOIN admin_users AS ulost ON ulost.us_lKeyID = ivi_lFlaggedLostByID\n INNER JOIN inv_cats ON ivc_lKeyID = ivi_lCategoryID\n INNER JOIN admin_aco ON ivi_lACOID = aco_lKeyID\n\n WHERE NOT ivi_bRetired {$sqlWhere}\n ORDER BY ivi_strItemName, ivi_lKeyID;"; $query = $this->db->query($sqlStr); $lNumItems = $query->num_rows(); if ($lNumItems == 0) { $items[0] = new stdClass(); $item =& $items[0]; $item->lKeyID = null; $item->strItemName = $item->strItemSNa = $item->strItemSNb = $item->strLocation = $item->strDescription = $item->lCategoryID = $item->strCatName = $item->dteObtained = $item->strRParty = null; $item->bAvailForLoan = $item->dteRemInventory = $item->lRemInventoryByID = $item->strRemInvFName = $item->strRemInvLName = null; $item->dteReportedLost = $item->bLost = $item->strLostNotes = $item->lFlaggedLostByID = $item->strLostFName = $item->strLostLName = null; $item->curEstValue = $item->lACOID = $item->strFlagImg = $item->strACOCurSymbol = $item->strACOCountry = $item->strFormattedAmnt = null; $item->lOriginID = $item->lLastUpdateID = $item->ucstrFName = $item->ucstrLName = $item->ulstrFName = $item->ulstrLName = $item->dteOrigin = $item->dteLastUpdate = null; } else { $idx = 0; foreach ($query->result() as $row) { $items[$idx] = new stdClass(); $item =& $items[$idx]; $item->lKeyID = $lIItemID = (int) $row->ivi_lKeyID; $item->strItemName = $row->ivi_strItemName; $item->strItemSNa = $row->ivi_strItemSNa; $item->strItemSNb = $row->ivi_strItemSNb; $item->strLocation = $row->ivi_strLocation; $item->strDescription = $row->ivi_strDescription; $item->lCategoryID = (int) $row->ivi_lCategoryID; $item->strCatName = $row->ivc_strCatName; $item->dteObtained = dteMySQLDate2Unix($row->ivi_dteObtained); $item->strRParty = $row->ivi_strRParty; $item->bAvailForLoan = (bool) $row->ivi_bAvailForLoan; $item->dteRemInventory = dteMySQLDate2Unix($row->ivi_dteRemInventory); $item->bRemoved = !is_null($item->dteRemInventory); $item->lRemInventoryByID = $row->ivi_lRemInventoryByID; $item->strRemInvFName = $row->strRemInvFName; $item->strRemInvLName = $row->strRemInvLName; $item->dteReportedLost = dteMySQLDate2Unix($row->ivi_dteReportedLost); $item->bLost = !is_null($item->dteReportedLost); $item->strLostNotes = $row->ivi_strLostNotes; $item->lFlaggedLostByID = $row->ivi_lFlaggedLostByID; $item->strLostFName = $row->strLostFName; $item->strLostLName = $row->strLostLName; $item->curEstValue = (double) $row->ivi_curEstValue; $item->lACOID = (int) $row->ivi_lACOID; $item->strFlagImg = $clsACO->strFlagImage($row->aco_strFlag, $row->aco_strName); $item->strACOCurSymbol = $row->aco_strCurrencySymbol; $item->strACOCountry = $row->aco_strName; $item->strFormattedAmnt = $item->strACOCurSymbol . ' ' . number_format($item->curEstValue, 2) . ' ' . $item->strFlagImg; $item->lOriginID = (int) $row->ivi_lOriginID; $item->lLastUpdateID = (int) $row->ivi_lLastUpdateID; $item->ucstrFName = $row->strCFName; $item->ucstrLName = $row->strCLName; $item->ulstrFName = $row->strLFName; $item->ulstrLName = $row->strLLName; $item->dteOrigin = (int) $row->dteOrigin; $item->dteLastUpdate = (int) $row->dteLastUpdate; if ($bLoadStatus) { $item->statProps = new stdClass(); $item->statProps->bAvail = $item->bAvailForLoan; $item->statProps->bLost = $item->bLost; $item->statProps->bCheckedOut = $this->bItemCheckedOutInfo($lIItemID, $item->statProps->strCO_To, $item->statProps->cicoID, $item->statProps->dteCO); $item->statProps->bRemovedFromInv = $item->bRemoved; $item->strStatus = cico\strItemStatus($item->statProps); } ++$idx; } } }
function getFulfillments(&$lNumFulfill, &$fulfillment, $lPledgeID, $dteOnOrAfter, $dteBefore) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $clsACO = new madmin_aco(); $lNumFulfill = 0; $fulfillment = array(); $sqlStr = "SELECT gi_lKeyID, gi_lForeignID,\n gi_dteDonation,\n gi_curAmnt, gi_strCheckNum,\n pe_lKeyID, pe_bBiz, pe_strFName, pe_strLName,\n gi_lACOID, aco_strFlag, aco_strCurrencySymbol, aco_strName\n FROM gifts\n INNER JOIN people_names ON pe_lKeyID = gi_lForeignID\n INNER JOIN admin_aco ON gi_lACOID = aco_lKeyID\n WHERE gi_lPledgeID={$lPledgeID}\n AND NOT gi_bRetired "; if (!is_null($dteOnOrAfter)) { $sqlStr .= ' AND gi_dteDonation >= ' . strPrepDate($dteOnOrAfter) . "\n"; } if (!is_null($dteBefore)) { $sqlStr .= ' AND gi_dteDonation < ' . strPrepDate($dteBefore) . "\n"; } $sqlStr .= 'ORDER BY gi_dteDonation, gi_lKeyID;'; $query = $this->db->query($sqlStr); $lNumFulfill = $query->num_rows(); if ($lNumFulfill > 0) { $idx = 0; foreach ($query->result() as $row) { $fulfillment[$idx] = new stdClass(); $gift =& $fulfillment[$idx]; $gift->lKeyID = (int) $row->gi_lKeyID; $gift->lForeignID = (int) $row->gi_lForeignID; $gift->curAmnt = (double) $row->gi_curAmnt; $gift->dteDonation = dteMySQLDate2Unix($row->gi_dteDonation); $gift->mdteDonation = $row->gi_dteDonation; $gift->strCheckNum = $row->gi_strCheckNum; $gift->lFID = (int) $row->pe_lKeyID; $gift->bBiz = (bool) $row->pe_bBiz; $gift->strFName = $row->pe_strFName; $gift->strLName = $row->pe_strLName; if ($gift->bBiz) { $gift->strSafeName = $gift->strSafeNameLF = htmlspecialchars($row->pe_strLName); } else { $gift->strSafeName = htmlspecialchars($row->pe_strFName . ' ' . $row->pe_strLName); $gift->strSafeNameLF = htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName); } $gift->lACOID = (int) $row->gi_lACOID; $gift->strFlagImg = $clsACO->strFlagImage($row->aco_strFlag, $row->aco_strName); $gift->strACOCurSymbol = $row->aco_strCurrencySymbol; $gift->strACOCountry = $row->aco_strName; $gift->strFormattedAmnt = $gift->strACOCurSymbol . ' ' . number_format($gift->curAmnt, 2) . ' ' . $gift->strFlagImg; ++$idx; } } }
function strDepositLogReport(&$sRpt, $lStartRec, $lRecsPerPage) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; $strLimit = " LIMIT {$lStartRec}, {$lRecsPerPage} "; $clsACO = new madmin_aco(); $sqlStr = "SELECT dl_lKeyID,\n dl_lACOID, dl_dteStart, dl_dteEnd, \n dl_strBank, dl_strAccount, dl_strNotes, dl_bRetired,\n dl_lOriginID, dl_lLastUpdateID,\n usersC.us_strFirstName AS strCFName, usersC.us_strLastName AS strCLName,\n usersL.us_strFirstName AS strLFName, usersL.us_strLastName AS strLLName,\n\n aco_strFlag, aco_strCurrencySymbol, aco_strName,\n\n UNIX_TIMESTAMP(dl_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(dl_dteLastUpdate) AS dteLastUpdate\n\n FROM deposit_log\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\n {$strLimit};"; $query = $this->db->query($sqlStr); $lNumRows = $query->num_rows(); if ($lNumRows == 0) { return '<br><i>There are no deposits in your database.</i><br><br>'; } $strOut = strLinkAdd_Deposit('Add new deposit', true) . ' ' . strLinkAdd_Deposit('Add new deposit', false) . '<br> <table class="enpRptC"> <tr> <td class="enpRptTitle" colspan="7"> Deposit Log </td> </tr> <tr> <td class="enpRptLabel"> Deposit ID </td> <td class="enpRptLabel"> ACO </td> <td class="enpRptLabel"> Period </td> <td class="enpRptLabel"> # Entries </td> <td class="enpRptLabel"> Total </td> <td class="enpRptLabel"> Bank / Account </td> <td class="enpRptLabel" style="width: 150pt;"> Notes </td> </tr>'; foreach ($query->result() as $row) { $lDepositID = $row->dl_lKeyID; $lNumEntries = $this->lNumGiftsViaDeposit($lDepositID, $curTot); if ($row->dl_strBank == '' & $row->dl_strAccount == '') { $strBA = ' '; } else { $strBA = '<b>Bank: </b>' . htmlspecialchars($row->dl_strBank) . '<br>' . '<b>Account: </b>' . htmlspecialchars($row->dl_strAccount); } $strOut .= ' <tr class="makeStripe"> <td class="enpRpt" style="text-align: center;">' . str_pad($lDepositID, 5, '0', STR_PAD_LEFT) . ' ' . strLinkView_DepositEntry($lDepositID, 'View deposit entry', true) . ' </td> <td class="enpRpt">' . htmlspecialchars($row->aco_strName) . ' ' . $row->aco_strCurrencySymbol . ' ' . $clsACO->strFlagImage($row->aco_strFlag, $row->aco_strName) . ' </td> <td class="enpRpt">' . date($genumDateFormat, dteMySQLDate2Unix($row->dl_dteStart)) . ' - ' . date($genumDateFormat, dteMySQLDate2Unix($row->dl_dteEnd)) . ' </td> <td class="enpRpt" style="text-align: center;">' . number_format($lNumEntries) . ' </td> <td class="enpRpt" style="text-align: right;">' . number_format($curTot, 2) . ' </td> <td class="enpRpt">' . $strBA . ' </td> <td class="enpRpt" style="width: 150pt;">' . nl2br(htmlspecialchars($row->dl_strNotes)) . ' </td> </tr>'; } $strOut .= '</table><br><br>'; return $strOut; }
function loadChapterInfo() { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $clsACO = new madmin_aco(); if (is_null($this->lChapterID)) { screamForHelp('CHAPTER ID NOT SET<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__); } $sqlStr = "SELECT\n ch_lKeyID,\n ch_strChapterName, ch_strAddress1, ch_strAddress2,\n ch_strCity, ch_strState, ch_strCountry, ch_strZip,\n ch_strFax, ch_strPhone, ch_strBannerTagLine,\n ch_strEmail, ch_strEmailCalDistr, ch_strWebSite,\n ch_strDefAreaCode, ch_strDefState, ch_strDefCountry,\n ch_lPW_MinLen, ch_bPW_UpperLower, ch_bPW_Number,\n ch_bUS_DateFormat, ch_lDefaultACO, ch_lTimeZone,\n ch_vocZip, ch_vocState, ch_vocJobSkills,\n aco_strFlag, aco_strCurrencySymbol, aco_strName,\n ch_bRetired,\n\n ch_lOrigID, ch_lLastUpdateID,\n UNIX_TIMESTAMP(ch_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(ch_dteLastUpdate) AS dteLastUpdate,\n\n tz_strTimeZone,\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(ch_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(ch_dteLastUpdate) AS dteLastUpdate\n\n FROM admin_chapters\n INNER JOIN admin_users AS usersC ON ch_lOrigID = usersC.us_lKeyID\n INNER JOIN admin_users AS usersL ON ch_lLastUpdateID = usersL.us_lKeyID\n INNER JOIN admin_aco ON ch_lDefaultACO = aco_lKeyID\n INNER JOIN lists_tz ON ch_lTimeZone = tz_lKeyID\n\n WHERE ch_lKeyID={$this->lChapterID};"; $query = $this->db->query($sqlStr); $numRows = $query->num_rows(); if ($numRows == 0) { echo "<br><br>{$sqlStr}<br><br>"; screamForHelp('EOF error on line ' . __LINE__ . ', file ' . __FILE__ . ', function ' . __FUNCTION__); } else { $row = $query->row(); $this->chapterRec = new stdClass(); $this->chapterRec->lKeyID = (int) $row->ch_lKeyID; $this->chapterRec->strChapterName = $row->ch_strChapterName; $this->chapterRec->strSafeChapterName = htmlspecialchars($row->ch_strChapterName); $this->chapterRec->strBannerTagLine = $row->ch_strBannerTagLine; $this->chapterRec->strAddress1 = $row->ch_strAddress1; $this->chapterRec->strAddress2 = $row->ch_strAddress2; $this->chapterRec->strCity = $row->ch_strCity; $this->chapterRec->strState = $row->ch_strState; $this->chapterRec->strCountry = $row->ch_strCountry; $this->chapterRec->strZip = $row->ch_strZip; $this->chapterRec->strAddress = strBuildAddress($this->chapterRec->strAddress1, $this->chapterRec->strAddress2, $this->chapterRec->strCity, $this->chapterRec->strState, $this->chapterRec->strCountry, $this->chapterRec->strZip, true); $this->chapterRec->strFax = $row->ch_strFax; $this->chapterRec->strPhone = $row->ch_strPhone; $this->chapterRec->strEmail = $row->ch_strEmail; $this->chapterRec->strEmailCalDistLists = $row->ch_strEmailCalDistr; $this->chapterRec->strWebSite = $row->ch_strWebSite; $this->chapterRec->lTimeZoneID = (int) $row->ch_lTimeZone; $this->chapterRec->strTimeZone = $row->tz_strTimeZone; $this->chapterRec->strDefAreaCode = $row->ch_strDefAreaCode; $this->chapterRec->strDefState = $row->ch_strDefState; $this->chapterRec->strDefCountry = $row->ch_strDefCountry; $this->chapterRec->bUS_DateFormat = (bool) $row->ch_bUS_DateFormat; $this->chapterRec->lDefaultACO = (int) $row->ch_lDefaultACO; $this->chapterRec->strFlag = $row->aco_strFlag; $this->chapterRec->strFlagImg = $clsACO->strFlagImage($row->aco_strFlag, $row->aco_strName); $this->chapterRec->strCurrencySymbol = $row->aco_strCurrencySymbol; $this->chapterRec->strCountryName = $row->aco_strName; $this->chapterRec->lPW_MinLen = $row->ch_lPW_MinLen; $this->chapterRec->bPW_UpperLower = (bool) $row->ch_bPW_UpperLower; $this->chapterRec->bPW_Number = (bool) $row->ch_bPW_Number; $this->chapterRec->bRetired = (bool) $row->ch_bRetired; $this->chapterRec->strStaffCFName = $row->strCFName; $this->chapterRec->strStaffCLName = $row->strCLName; $this->chapterRec->strStaffLFName = $row->strLFName; $this->chapterRec->strStaffLLName = $row->strLLName; $this->chapterRec->vocabulary = new stdClass(); $this->chapterRec->vocabulary->vocZip = $row->ch_vocZip; $this->chapterRec->vocabulary->vocState = $row->ch_vocState; $this->chapterRec->vocabulary->vocJobSkills = $row->ch_vocJobSkills; $this->chapterRec->dteOrigin = $row->dteOrigin; $this->chapterRec->dteLastUpdate = $row->dteLastUpdate; } }
public function strDonationViewTable($sqlStr, $bIncludeAck, $bShowACO, $strTitle = '') { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; if ($bShowACO) { $clsACO = new madmin_aco(); } $query = $this->db->query($sqlStr); if ($query->num_rows() == 0) { return '<br><br><i>There are no donations that match your search criteria.</i>'; } else { $strOut = ' <table class="enpRptC" style="width: 100%;">' . $strTitle . ' <tr> <td class="enpRptLabel" style="width: 70px;"> giftID </td> <td class="enpRptLabel" style="width: 80px;"> Amount </td> <td class="enpRptLabel" style="width: 90px;"> Date </td> <td class="enpRptLabel" style="width: 200px;"> Donor </td> <td class="enpRptLabel" style="width: 110px;"> Account </td> <td class="enpRptLabel" style="width: 130px;"> Campaign </td> <td class="enpRptLabel" style="width: 90px;"> In-Kind? </td>'; if ($bIncludeAck) { $strOut .= ' <td class="enpRptLabel" style=""> Acknowledged? </td>'; } $strOut .= ' </tr>'; foreach ($query->result() as $row) { $lGiftID = $row->gi_lKeyID; $bBiz = $row->pe_bBiz; $bSpon = !is_null($row->gi_lSponsorID); $lPeopleID = $row->pe_lKeyID; if ($bShowACO) { $strFlagImg = ' ' . $clsACO->strFlagImage($row->aco_strFlag, $row->aco_strName); } else { $strFlagImg = ''; } if ($bIncludeAck) { if ($row->gi_bAck) { $strAlignAck = 'left'; $strAck = 'Yes - ' . date($genumDateFormat, dteMySQLDate2Unix($row->gi_dteAck)) . ' by ' . htmlspecialchars($row->us_strFirstName . ' ' . $row->us_strLastName); } else { $strAlignAck = 'center'; $strAck = '-'; } } if ($bSpon) { $strLinkViewRec = strLinkView_SponsorPayment($lGiftID, 'View sponsorship payment record', true); $sponLink = ' ' . strLinkView_Sponsorship($row->gi_lSponsorID, 'View sponsorship', true); } else { $strLinkViewRec = strLinkView_GiftsRecord($lGiftID, 'View gift record', true); $sponLink = ''; } if ($row->gi_bGIK) { $strAlign = 'left'; $strGIK = htmlspecialchars($row->strGIK); } else { $strAlign = 'center'; $strGIK = '-'; } if ($bBiz) { $strName = htmlspecialchars($row->pe_strLName); $strLink = strLinkView_BizRecord($lPeopleID, 'View business/organization record', true); } else { $strName = htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName); $strLink = strLinkView_PeopleRecord($lPeopleID, 'View people record', true); } $strOut .= ' <tr class="makeStripe"> <td class="enpRpt" style="width: 50px; text-align: center;">' . $strLinkViewRec . ' ' . str_pad($lGiftID, 5, '0', STR_PAD_LEFT) . ' </td> <td class="enpRpt" style="width: 60px; text-align: right; padding-right: 5px;">' . number_format($row->gi_curAmnt, 2) . $strFlagImg . ' </td> <td class="enpRpt" style="text-align: left;">' . date($genumDateFormat, dteMySQLDate2Unix($row->gi_dteDonation)) . ' </td> <td class="enpRpt" style="text-align: left;">' . $strLink . str_pad($lPeopleID, 5, '0', STR_PAD_LEFT) . ' ' . $strName . ' </td> <td class="enpRpt" style="text-align: left;">' . htmlspecialchars($row->ga_strAccount) . ' </td> <td class="enpRpt" style="text-align: left;">' . htmlspecialchars($row->gc_strCampaign) . $sponLink . ' </td> <td class="enpRpt" style="text-align: ' . $strAlign . ';">' . $strGIK . ' </td>'; if ($bIncludeAck) { $strOut .= ' <td class="enpRpt" style="text-align: ' . $strAlignAck . ';">' . $strAck . ' </td>'; } $strOut .= ' </tr>'; } $strOut .= '</table>' . "\n"; 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; } } }