} else { $strLinkDonor = strLinkView_PeopleRecord($lDonorID, 'View people record of payer', true); } if ($bBizSponsor) { $strLinkSpon = strLinkView_BizRecord($lSponFID, 'View business record of sponsor', true); } else { $strLinkSpon = strLinkView_PeopleRecord($lSponFID, 'View people record of sponsor', true); } if (is_null($lClientID)) { $strClientLink = ' '; } else { $strClientLink = strLinkView_ClientRecord($lClientID, 'View client record', true) . ' '; } echoT(' <tr class="makeStripe"> <td class="enpRpt" style="text-align: center;">' . strLinkView_SponsorPayment($lPayID, 'View payment record', true) . ' ' . str_pad($lPayID, 5, '0', STR_PAD_LEFT) . ' </td> <td class="enpRpt" style="text-align: center;">' . strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . ' ' . str_pad($lSponID, 5, '0', STR_PAD_LEFT) . ' </td> <td class="enpRpt" style="text-align: center;">' . $strLinkDonor . ' ' . str_pad($lDonorID, 5, '0', STR_PAD_LEFT) . ' </td> <td class="enpRpt">' . htmlspecialchars($payrec->strImportID) . ' </td> <td class="enpRpt">' . $payrec->strDonorSafeNameLF . ' </td> <td class="enpRpt" style="text-align: right;">' . number_format($payrec->curPaymentAmnt, 2) . ' ' . $payrec->strFlagImage . ' </td> <td class="enpRpt" style="text-align: center;">' . date($genumDateFormat, $payrec->dtePayment) . ' </td> <td class="enpRpt">' . $strLinkSpon . ' ' . htmlspecialchars($payrec->strSponSafeNameLF) . ' </td>
function strSponMonthIncomeReport(&$sRpt, &$displayData, $lStartRec, $lRecsPerPage) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; $strOut = ''; $strLimit = " LIMIT {$lStartRec}, {$lRecsPerPage} "; $this->sponIncomeViaMonthVars($sRpt, $lYear, $lMonth, $lACOID); $cACO = new madmin_aco(); $cACO->loadCountries(false, true, true, $lACOID); $cCountry = $cACO->countries[0]; $strOut = '<table class="enpView"> <tr> <td class="enpViewLabel" colspan="2" style="text-align: left; font-size: 13pt;"> Sponsorship Income </td> </tr> <tr> <td class="enpViewLabel"> Accounting Country: </td> <td class="enpView">' . $cCountry->strName . ' ' . $cCountry->strCurrencySymbol . ' ' . $cCountry->strFlagImg . ' </td> </tr> <tr> <td class="enpViewLabel"> Month: </td> <td class="enpView">' . strXlateMonth($lMonth) . ' ' . $lYear . ' </td> </tr> </table>'; $sqlStr = "SELECT\n gi_lKeyID, gi_lSponsorID,\n gi_dteDonation,\n gi_curAmnt, gi_lForeignID, sp_lForeignID,\n payer.pe_bBiz AS bPayerBiz, payer.pe_strLName AS strPayerLName, payer.pe_strFName AS strPayerFName,\n payer.pe_strAddr1, payer.pe_strAddr2, payer.pe_strCity, payer.pe_strState, payer.pe_strZip, payer.pe_strCountry,\n spon.pe_bBiz AS bSponBiz, spon.pe_strLName AS strSponLName, spon.pe_strFName AS strSponFName\n FROM gifts\n INNER JOIN people_names AS payer ON gi_lForeignID=payer.pe_lKeyID\n INNER JOIN sponsor ON gi_lSponsorID=sp_lKeyID\n INNER JOIN people_names AS spon ON sp_lForeignID=spon.pe_lKeyID\n\n WHERE NOT gi_bRetired\n AND gi_lACOID={$lACOID}\n AND MONTH(gi_dteDonation)={$lMonth}\n AND YEAR (gi_dteDonation)={$lYear}\n AND gi_lSponsorID IS NOT NULL\n ORDER BY gi_dteDonation, gi_lKeyID\n {$strLimit};"; $query = $this->db->query($sqlStr); $lNumRows = $query->num_rows(); if ($lNumRows > 0) { $strOut .= ' <table class="enpRptC"> <tr> <td class="enpRptLabel"> Payment ID </td> <td class="enpRptLabel"> Sponsor ID </td> <td class="enpRptLabel"> Amount </td> <td class="enpRptLabel"> Date </td> <td class="enpRptLabel"> Payer </td> <td class="enpRptLabel"> Sponsor </td> </tr>'; foreach ($query->result() as $row) { $lPayID = $row->gi_lKeyID; $lSponsorID = $row->gi_lSponsorID; $lSponsorFID = $row->sp_lForeignID; $lPayerID = $row->gi_lForeignID; // gift ID $strOut .= ' <tr> <td class="enpRpt" style="text-align: center;">' . strLinkView_SponsorPayment($lPayID, 'View payment record', true) . ' ' . str_pad($lPayID, 5, '0', STR_PAD_LEFT) . ' </td>'; // sponsor ID $strOut .= ' <td class="enpRpt" style="text-align: center;">' . strLinkView_Sponsorship($lSponsorID, 'View sponsorship record', true) . ' ' . str_pad($lSponsorID, 5, '0', STR_PAD_LEFT) . ' </td>'; // Amount $strOut .= ' <td class="enpRpt" style="text-align: right; padding-left: 14px;">' . number_format($row->gi_curAmnt, 2) . ' </td>'; // Date $strOut .= ' <td class="enpRpt" style="text-align: right;">' . date($genumDateFormat, dteMySQLDate2Unix($row->gi_dteDonation)) . ' </td>'; // Payer if ($row->bPayerBiz) { $strName = strLinkView_BizRecord($lPayerID, 'View business record', true) . ' ' . str_pad($lPayerID, 5, '0', STR_PAD_LEFT) . ' ' . htmlspecialchars($row->strPayerLName) . ' (business)'; } else { $strName = strLinkView_PeopleRecord($lPayerID, 'View people record', true) . ' ' . str_pad($lPayerID, 5, '0', STR_PAD_LEFT) . ' ' . htmlspecialchars($row->strPayerLName . ', ' . $row->strPayerFName); } $strOut .= ' <td class="enpRpt" >' . $strName . ' </td>'; // Sponsor if ($lPayerID == $lSponsorFID) { $strName = '<span style="color: #999; font-style: italic;">(same as payer)'; } else { if ($row->bSponBiz) { $strName = strLinkView_BizRecord($lSponsorFID, 'View business record', true) . ' ' . str_pad($lSponsorFID, 5, '0', STR_PAD_LEFT) . ' ' . htmlspecialchars($row->strSponLName) . ' (business)'; } else { $strName = strLinkView_PeopleRecord($lSponsorFID, 'View people record', true) . ' ' . str_pad($lSponsorFID, 5, '0', STR_PAD_LEFT) . ' ' . htmlspecialchars($row->strSponLName . ', ' . $row->strSponFName); } } $strOut .= ' <td class="enpRpt" >' . $strName . ' </td>'; $strOut . ' </tr>'; } $strOut .= '</table>'; } else { $strOut .= '<br><br><i>There are no records that match your search criteria</i><br>'; } return $strOut; }
private function giftNotesSearch(&$results) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; $results->strLabel = 'Gift notes'; $results->lNumResults = 0; $cACO = new madmin_aco(); $sqlStr = 'SELECT gi_lKeyID, gi_lForeignID, gi_curAmnt, gi_lACOID, gi_dteDonation, gi_strNotes, pe_strLName, pe_strFName, pe_bBiz, gi_lSponsorID FROM gifts INNER JOIN people_names ON pe_lKeyID=gi_lForeignID WHERE NOT gi_bRetired AND NOT pe_bRetired AND ' . $this->textSearchWhere('gi_strNotes') . ' ORDER BY pe_strLName, pe_strFName, gi_lKeyID;'; $query = $this->db->query($sqlStr); $results->lNumResults = $lNumRows = $query->num_rows(); if ($lNumRows > 0) { $idx = 0; $results->matches = array(); foreach ($query->result() as $row) { $results->matches[$idx] = new stdClass(); $match =& $results->matches[$idx]; $lGiftID = $row->gi_lKeyID; $lFID = $row->gi_lForeignID; $strFID = str_pad($lFID, 5, '0', STR_PAD_LEFT); $bBiz = $row->pe_bBiz; $lACOID = $row->gi_lACOID; $bSponPay = !is_null($row->gi_lSponsorID); $cACO->loadCountries(false, false, true, $lACOID); $giftACO =& $cACO->countries[0]; if ($bSponPay) { $match->links = 'Sponsor Payment ID ' . str_pad($lGiftID, 5, '0', STR_PAD_LEFT) . strLinkView_SponsorPayment($lGiftID, 'View payment record', true) . ' '; } else { $match->links = 'Gift ID ' . str_pad($lGiftID, 5, '0', STR_PAD_LEFT) . strLinkView_GiftsRecord($lGiftID, 'View gift record', true) . ' '; } $match->searchInfo = 'Donation record of ' . $giftACO->strCurrencySymbol . ' ' . number_format($row->gi_curAmnt, 2) . ' ' . $giftACO->strFlagImg . ' of ' . date($genumDateFormat, dteMySQLDate2Unix($row->gi_dteDonation)) . ' by '; if ($bBiz) { $match->links .= 'Business ID: ' . $strFID . strLinkView_BizRecord($lFID, 'View business record', true); $match->searchInfo .= htmlspecialchars($row->pe_strLName); } else { $match->links .= 'People ID: ' . $strFID . strLinkView_PeopleRecord($lFID, 'View people record', true); $match->searchInfo .= htmlspecialchars($row->pe_strFName . ' ' . $row->pe_strLName); } $match->text = $row->gi_strNotes; $match->textHighlighted = $this->highlightMatchedText($row->gi_strNotes); ++$idx; } } }
function writeGiftHistoryRow($idx, $lPID, $clsGH, &$curTotal) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; $lGiftID = $clsGH->gi_lKeyID; $lDonorID = $clsGH->gi_lForeignID; $lSponsorID = $clsGH->gi_lSponsorID; $bSoft = $lDonorID != $lPID; $bBiz = $clsGH->pe_bBiz; if ($bSoft) { if ($bBiz) { $strLink = strLinkView_BizRecord($lDonorID, 'View business record ' . str_pad($lDonorID, 5, '0', STR_PAD_LEFT), true) . ' '; } else { $strLink = strLinkView_PeopleRecord($lDonorID, 'View people record ' . str_pad($lDonorID, 5, '0', STR_PAD_LEFT), true) . ' '; } $strFontStyle = 'font-style:italic; color: #666;'; } else { $strLink = ''; $strFontStyle = ''; } if ($bBiz) { $strDonor = htmlspecialchars($clsGH->pe_strLName); } else { $strDonor = htmlspecialchars($clsGH->pe_strLName . ', ' . $clsGH->pe_strFName); } if ($clsGH->gi_bGIK) { $strGH = '<br><small>in-kind: ' . $clsGH->strGIK . '</small>'; } else { $strGH = ''; } if (is_null($lSponsorID)) { $strSponID = ' '; $strGiftLink = strLinkView_GiftsRecord($lGiftID, 'View gift record', true); } else { if (bAllowAccess('showSponsors')) { $strSponID = strLinkView_Sponsorship($lSponsorID, 'view sponsorship', true) . ' ' . str_pad($lSponsorID, 5, '0', STR_PAD_LEFT); } else { $strSponID = ' '; } $strGiftLink = strLinkView_SponsorPayment($lGiftID, 'View sponsorship payment record', true); } $strFlags = ''; if ($clsGH->bHon) { $strFlags .= ' H'; } if ($clsGH->bMem) { $strFlags .= ' M'; } $strFlags = trim($strFlags); if ($strFlags == '') { $strFlags = ' '; } $curTotal += $clsGH->gi_curAmnt; echoT(' <tr class="makeStripe"> <td class="enpRpt" style="' . $strFontStyle . ' text-align:center; width: 15pt;">' . $idx . ' </td> <td class="enpRpt" style="' . $strFontStyle . ' width: 50pt;">' . $strGiftLink . ' ' . str_pad($lGiftID, 5, '0', STR_PAD_LEFT) . ' </td> <td class="enpRpt" style="text-align: right;' . $strFontStyle . ' width: 60pt;">' . number_format($clsGH->gi_curAmnt, 2) . ' </td> <td class="enpRpt" style="text-align: center;' . $strFontStyle . ' width: 60pt;">' . date($genumDateFormat, $clsGH->gi_dteDonation) . ' </td> <td class="enpRpt" style="' . $strFontStyle . ' width: 140pt;">' . $strLink . $strDonor . ' </td> <td class="enpRpt" style="' . $strFontStyle . ' width: 70pt;">' . htmlspecialchars($clsGH->ga_strAccount) . ' </td> <td class="enpRpt" style="' . $strFontStyle . ' width: 130pt;">' . htmlspecialchars($clsGH->gc_strCampaign) . $strGH . ' </td>'); if (bAllowAccess('showSponsors')) { echoT(' <td class="enpRpt" style="text-align: center;' . $strFontStyle . ' width: 50pt;">' . $strSponID . ' </td>'); } echoT(' <td class="enpRpt" style="text-align: center;' . $strFontStyle . ' width: 30pt;">' . $strFlags . ' </td> </tr>'); }
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 writeSponPaymentList($lNumPayments, &$payHistory, $lSponForeignID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; foreach ($payHistory as $clsP) { if ($lSponForeignID == $clsP->lPayerID) { $strPayer = $clsP->strPayerSafeNameFL . ' (sponsor)'; } else { if ($clsP->bDonorBiz) { $strPayer = strLinkView_BizRecord($clsP->lPayerID, 'View business record', true) . ' '; } else { $strPayer = strLinkView_PeopleRecord($clsP->lPayerID, 'View people record', true) . ' '; } $strPayer .= $clsP->strPayerSafeNameFL . ' (THIRD PARTY PAYER)'; } echoT(' <tr> <td class="enpRpt" style="text-align: center;">' . strLinkView_SponsorPayment($clsP->lKeyID, 'View payment record', true) . ' ' . str_pad($clsP->lKeyID, 5, '0', STR_PAD_LEFT) . ' </td> <td class="enpRpt">' . date($genumDateFormat, $clsP->dtePayment) . ' </td> <td class="enpRpt" style="text-align: right;">' . $clsP->strCurSymbol . ' ' . number_format($clsP->curPayment, 2) . ' ' . $clsP->strFlagImage . ' </td> <td class="enpRpt" style="text-align: left;">' . $strPayer . ' </td> </tr> '); } }