function strSponsorSummaryViaCID($bTerse, $clsClient)
{
    //-----------------------------------------------------------------
    // assumes $clsClient in the form of $this->clients[$idx]
    //-----------------------------------------------------------------
    $strOut = '';
    if ($clsClient->lNumSponsors <= 0) {
        return '&nbsp;';
    }
    if ($bTerse) {
        $strOut = '<table width="100%" class="enpRpt">';
        foreach ($clsClient->sponsors as $clsSpon) {
            $lSponID = $clsSpon->lKeyID;
            $bInactive = $clsSpon->bInactive;
            if ($bInactive) {
                $strStyle = 'color: #999; font-style:italic;';
            } else {
                $strStyle = '';
            }
            $strOut .= '<tr>
                  <td  class="enpRpt" style="' . $strStyle . '">' . strLinkView_Sponsorship($lSponID, 'View sponsorship', true) . '&nbsp;' . str_pad($lSponID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . $clsSpon->strSafeNameFL . '
                  </td>
                </tr>';
        }
        $strOut .= '</table>';
    } else {
        echo __FILE__ . ' ' . __LINE__ . '<br>' . "\n";
        die;
    }
    return $strOut;
}
function writeAutoChargeRow($clsACInfo)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $lCID = $clsACInfo->lKeyID;
    $lSponID = $clsACInfo->lSponsorshipID;
    $bBiz = $clsACInfo->bBiz;
    $lFID = $clsACInfo->lForeignID;
    $lClientID = $clsACInfo->lClientID;
    if (is_null($lClientID)) {
        $strClientRow = 'n/a';
    } else {
        $strClientRow = strLinkView_ClientRecord($lClientID, 'View Client', true) . ' ' . str_pad($lClientID, 5, '0', STR_PAD_LEFT) . ' ' . $clsACInfo->strClientSafeNameFL . ' / ' . htmlspecialchars($clsACInfo->strLocation);
    }
    if ($bBiz) {
        $strFLink = strLinkView_BizRecord($lFID, 'View business record', true);
    } else {
        $strFLink = strLinkView_PeopleRecord($lFID, 'View people record', true);
    }
    echoT('
      <tr>
         <td class="enpRpt" style="text-align:center">' . strLinkView_SponsorCharge($lCID, 'View charge record', true) . '&nbsp;' . str_pad($lCID, 5, '0', STR_PAD_LEFT) . '
         </td>');
    echoT('
         <td class="enpRpt" style="text-align:center">' . strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . '&nbsp;' . str_pad($lSponID, 5, '0', STR_PAD_LEFT) . '
         </td>');
    //------------------------------
    // sponsor
    //------------------------------
    echoT('
         <td class="enpRpt">' . $strFLink . '&nbsp;' . $clsACInfo->strSponSafeNameFL . '
         </td>');
    //------------------------------
    // charge
    //------------------------------
    echoT('
         <td class="enpRpt" style="text-align: right;">' . $clsACInfo->strCurSymbol . '&nbsp;' . number_format($clsACInfo->curChargeAmnt, 2) . '&nbsp;' . $clsACInfo->strFlagImage . '
         </td>');
    //------------------------------
    // client
    //------------------------------
    echoT('
         <td class="enpRpt">' . $strClientRow . '
         </td>');
    echoT('
      </tr>');
}
function showGiftSponsorInfo(&$clsRpt, $lGiftID, $lFID, $gifts, &$spon)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $bMismo = $lFID == $spon->lForeignID;
    $lSponID = $spon->lKeyID;
    $lClientID = $spon->lClientID;
    if (is_null($lClientID)) {
        $strClientID = '<i>not set</i>';
    } else {
        $strClientID = str_pad($lClientID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_ClientRecord($lClientID, 'View client record', true) . '&nbsp;' . $spon->strClientSafeNameFL;
    }
    openBlock('Sponsorship' . "\n", strLinkView_Sponsorship($lSponID, 'View sponsorship', true) . '&nbsp;' . strLinkView_Sponsorship($lSponID, 'View sponsorship', false) . "\n");
    echoT($clsRpt->openReport());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Sponsor ID:') . $clsRpt->writeCell(str_pad($spon->lKeyID, 5, '0', STR_PAD_LEFT)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Sponsor:') . $clsRpt->writeCell($spon->strSponSafeNameLF . ($bMismo ? ' (same as donor)' : '')) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Sponsorship program:') . $clsRpt->writeCell(htmlspecialchars($spon->strSponProgram)) . $clsRpt->closeRow());
    echoT($clsRpt->openRow() . $clsRpt->writeLabel('Client:') . $clsRpt->writeCell($strClientID) . $clsRpt->closeRow());
    echoT($clsRpt->closeReport(''));
    closeBlock();
}
function showSingleSponsorshipInfo($clsRpt, $strTitle, $clsSpon)
{
    //---------------------------------------------------------------------
    // use for single sponsorship
    //---------------------------------------------------------------------
    $attributes = new stdClass();
    $attributes->lTableWidth = 900;
    $attributes->divID = 'ssponDiv';
    $attributes->divImageID = 'ssponDivImg';
    openBlock($strTitle, '', $attributes);
    $clsRpt->openReport();
    if ($clsSpon->lNumSponsors == 0) {
        echoT('<i>(no sponsorships)</i><br>');
    } else {
        foreach ($clsSpon->sponInfo as $idx => $spon) {
            echoT($clsRpt->openRow() . $clsRpt->writeLabel('Sponsor ID:') . $clsRpt->writeCell(strLinkView_Sponsorship($spon->lKeyID, 'view sponsorship', true) . ' ' . str_pad($spon->lKeyID, 5, '0', STR_PAD_LEFT)) . $clsRpt->closeRow());
            $lFID = $spon->lForeignID;
            if ($spon->bSponBiz) {
                $strLinkFID = strLinkView_Biz($lFID, 'View business record', true);
            } else {
                $strLinkFID = strLinkView_PeopleRecord($lFID, 'View people record', true);
            }
            echoT($clsRpt->openRow() . $clsRpt->writeLabel('Sponsor:') . $clsRpt->writeCell($strLinkFID . ' ' . str_pad($lFID, 5, '0', STR_PAD_LEFT) . ' ' . $spon->strSponSafeNameFL) . $clsRpt->closeRow() . $clsRpt->openRow() . $clsRpt->writeLabel('Sponsorship Program:') . $clsRpt->writeCell(htmlspecialchars($spon->strSponProgram)) . $clsRpt->closeRow() . $clsRpt->openRow() . $clsRpt->writeLabel('Client:'));
            if (is_null($spon->lClientID)) {
                echoT($clsRpt->writeCell('<i>Client not set</i>'));
            } else {
                echoT($clsRpt->writeCell(strLinkView_Client($spon->lClientID, 'View client record', true) . ' ' . $spon->strClientSafeNameFL . ' (' . htmlspecialchars($spon->strLocation) . ')'));
            }
            echoT($clsRpt->closeRow());
        }
    }
    echoT($clsRpt->closeReport());
    $attributes = new stdClass();
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
function showSponsorsPayments(&$sponInfo, &$clsForm, &$linkOpts, &$validation)
{
    //                 $strSort, $lSponProgID, $lStartRec, $lRecsPerPage){
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    openSponsorPaymentTable($clsForm, $linkOpts);
    foreach ($sponInfo as $spon) {
        $lSponID = $spon->lKeyID;
        $lFID = $spon->lForeignID;
        echoT('<input type="hidden" name="hdnAOCID[' . $lSponID . ']" value="' . $spon->lCommitACO . '">' . "\n");
        echoT('<input type="hidden" name="hdnFID[' . $lSponID . ']"   value="' . $spon->lForeignID . '">' . "\n");
        if ($spon->bSponBiz) {
            $strFLink = 'bizID: ' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_BizRecord($lFID, 'View business record (new window)', true, 'target="_blank"');
        } else {
            $strFLink = 'peopleID: ' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_PeopleRecord($lFID, 'View people record (new window)', true, 'target="_blank"');
        }
        $strRadioName = 'rdoPayType' . $lSponID;
        $lClientID = $spon->lClientID;
        if (is_null($lClientID)) {
            $strClient = 'client: n/a';
        } else {
            $strClient = 'client: ' . str_pad($lClientID, 6, '0', STR_PAD_LEFT) . strLinkView_ClientRecord($lClientID, 'View client record (new window)', true, 'target="_blank"') . '&nbsp;' . $spon->strClientSafeNameFL;
        }
        echoT('
         <tr class="makeStripe">
            <td class="enpRpt" style="text-align: center;">' . str_pad($lSponID, 6, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_Sponsorship($lSponID, 'View sponsorship (new window)', true, 'target="_blank"') . '
            </td>');
        echoT('
            <td class="enpRpt" style="width: 230pt;"><b>' . $spon->strSponSafeNameLF . '</b><br>' . $strFLink . '<br>' . $strClient . '<br>
               program: ' . htmlspecialchars($spon->strSponProgram) . '
            </td>');
        echoT('
            <td class="enpRpt" style="text-align: right;">' . $spon->strCommitACOCurSym . '&nbsp;' . number_format($spon->curCommitment, 2) . '&nbsp;' . $spon->strCommitACOFlagImg . '
            </td>');
        echoT('
            <td class="enpRpt" style="vertical-align: top;">' . $spon->strCommitACOCurSym . '&nbsp;' . '<input type="text"
                     name="' . $spon->strAmountFN . '" style="width: 60pt; text-align: right;"
                     onChange="bUserDataEntered = true;"
                     value="' . $spon->txtAmount . '">' . $validation->amount[$lSponID] . '<br><span style="font-size: 8pt;">' . $spon->strLastPay . '</span>
            </td>');
        echoT('
            <td class="enpRpt">
               <table cellpadding="0" cellspacing="0">
                  <tr>
                     <td style="text-align: right; font-size: 8pt;">
                        check #:
                     </td>
                     <td>
                        <input type="text" style="width: 60pt;"
                           onChange="bUserDataEntered = true;"
                           name="' . $spon->strCheckFN . '"
                           value="' . $spon->txtCheckNum . '">
                     </tr>');
        echoT('     <tr>
                     <td style="text-align: right; vertical-align: top; font-size: 8pt; padding-top: 4px;">
                        payment type:
                     </td>
                     <td>' . $spon->strDDLPayType . $validation->paymentType[$lSponID] . '
                     </td>
                  </tr>');
        //----------------------
        // Payment Date
        //----------------------
        echoT('     <tr>
                     <td style="text-align: right; vertical-align: top; font-size: 8pt; padding-top: 6px;">
                        payment date:
                     </td>
                     <td>' . $clsForm->strGenericDatePicker('', 'txtPayDate' . $lSponID, true, $spon->txtPayDate, 'frmBatchPayments', 'datepicker' . $lSponID, '', true) . $validation->paymentDate[$lSponID] . '
                     </td>
                  </tr>');
        echoT('
               </table>
            </td>');
        echoT('
         </tr>');
        echoT(strDatePicker('datepicker' . $lSponID, true));
    }
    closeSponsorPaymentTable();
}
 public function strHTMLOneLineLink($clsSingleRem)
 {
     /*---------------------------------------------------------------------
           sample call:
           $clsRem->loadReminders();
     
           if ($clsRem->lNumReminders > 0){
              foreach ($clsRem->reminders as $clsSingleRem){
                 $strRemLink = $clsRem->strHTMLOneLineLink($clsSingleRem);
              }
           }
        ---------------------------------------------------------------------*/
     global $genumDateFormat;
     $enumRemType = $clsSingleRem->enumSource;
     $lFID = $clsSingleRem->lForeignID;
     switch ($enumRemType) {
         case CENUM_CONTEXT_PEOPLE:
             $people = new mpeople();
             $people->lPeopleID = $lFID;
             $people->peopleInfoLight();
             $strRemLink = 'people reminder for ' . $people->strSafeName . strLinkView_PeopleRecord($lFID, 'View people record', true);
             break;
         case CENUM_CONTEXT_BIZ:
             $clsBiz = new mbiz();
             $clsBiz->lBID = $lFID;
             $clsBiz->bizInfoLight();
             $strRemLink = 'business reminder for ' . $clsBiz->strSafeName . strLinkView_BizRecord($lFID, 'View business record', true);
             break;
         case CENUM_CONTEXT_CLIENT:
             $clsClient = new mclients();
             $clsClient->loadClientsViaClientID($lFID);
             $strRemLink = 'client reminder for ' . $clsClient->clients[0]->strSafeName . ' ' . strLinkView_ClientRecord($lFID, 'View client record', true);
             break;
         case CENUM_CONTEXT_GIFT:
             $clsGifts = new mdonations();
             $clsGifts->loadGiftViaGID($lFID);
             $gift = $clsGifts->gifts[0];
             $strRemLink = 'gift reminder for ' . $gift->strACOCurSymbol . number_format($gift->gi_curAmnt, 2) . ' ' . $gift->strSafeName . ' of ' . date($genumDateFormat, $gift->gi_dteDonation) . ' ' . strLinkView_GiftsRecord($lFID, 'View gift record', true);
             break;
         case CENUM_CONTEXT_USER:
             $clsUser = new muser_accts();
             $clsUser->loadSingleUserRecord($lFID);
             $user =& $clsUser->userRec[0];
             $strRemLink = 'user reminder for ' . $user->strSafeName . ' ' . strLinkView_User($lFID, 'View user record', true);
             break;
         case CENUM_CONTEXT_SPONSORSHIP:
             $cSpon = new msponsorship();
             $cSpon->sponsorInfoViaID($lFID);
             $strRemLink = 'sponsorship reminder for sponsor ' . $cSpon->sponInfo[0]->strSponSafeNameFL . ' ' . strLinkView_Sponsorship($lFID, 'View sponsorship record', true);
             break;
         case CENUM_CONTEXT_LOCATION:
         case CENUM_CONTEXT_VOLUNTEER:
         default:
             screamForHelp($enumRemType . ': Switch type not implemented</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__);
             break;
     }
     return $strRemLink;
 }
 }
 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 = '&nbsp;';
 } else {
     $strClientLink = strLinkView_ClientRecord($lClientID, 'View client record', true) . '&nbsp;';
 }
 echoT('
         <tr class="makeStripe">
            <td class="enpRpt" style="text-align: center;">' . strLinkView_SponsorPayment($lPayID, 'View payment record', true) . '&nbsp;' . str_pad($lPayID, 5, '0', STR_PAD_LEFT) . '
            </td>
            <td class="enpRpt" style="text-align: center;">' . strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . '&nbsp;' . str_pad($lSponID, 5, '0', STR_PAD_LEFT) . '
            </td>
            <td class="enpRpt" style="text-align: center;">' . $strLinkDonor . '&nbsp;' . 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) . '&nbsp;' . $payrec->strFlagImage . '
            </td>
            <td class="enpRpt" style="text-align: center;">' . date($genumDateFormat, $payrec->dtePayment) . '
            </td>
            <td class="enpRpt">' . $strLinkSpon . '&nbsp;' . htmlspecialchars($payrec->strSponSafeNameLF) . '
            </td>
            <td class="enpRpt">' . $strClientLink . htmlspecialchars($payrec->strClientSafeNameFL) . '
            </td>
 public function sponsorChargeHTMLSummary()
 {
     //-----------------------------------------------------------------------
     // assumes user has called $clsSCP->loadChargeRecord()
     //-----------------------------------------------------------------------
     global $gdteNow, $genumDateFormat;
     $params = array('enumStyle' => 'terse');
     $clsRpt = new generic_rpt($params);
     $clsRpt->setBreadCrumbs();
     $cRec = $this->chargeRec;
     $bBiz = $cRec->bBiz;
     if ($bBiz) {
         $strLinkPeopleBiz = strLinkView_Biz($cRec->lForeignID, 'View business record', true);
     } else {
         $strLinkPeopleBiz = strLinkView_People($cRec->lForeignID, 'View people record', true);
     }
     $lSponID = $cRec->lSponsorshipID;
     $clsRpt->openReport('', '');
     $clsRpt->openRow(false);
     $clsRpt->writeLabel(' Sponsor:');
     $clsRpt->writeCell($strLinkPeopleBiz . ' ' . str_pad($cRec->lForeignID, 5, '0', STR_PAD_LEFT) . ' ' . $cRec->strSponSafeNameFL);
     $clsRpt->closeRow();
     $clsRpt->openRow(false);
     $clsRpt->writeLabel('Sponsor ID:');
     $clsRpt->writeCell(strLinkView_Sponsorship($lSponID, 'View sponsorship', true) . ' ' . str_pad($lSponID, 5, '0', STR_PAD_LEFT));
     $clsRpt->closeRow();
     if (is_null($cRec->lClientID)) {
         $strClient = '<i>not set</i>';
     } else {
         $strClient = strLinkView_Client($cRec->lClientID, 'View client record', true) . ' ' . str_pad($cRec->lClientID, 5, '0', STR_PAD_LEFT) . ' ' . $cRec->strClientSafeNameFL;
     }
     $clsRpt->openRow(false);
     $clsRpt->writeLabel('Client:');
     $clsRpt->writeCell($strClient);
     $clsRpt->closeRow();
     $clsRpt->openRow(false);
     $clsRpt->writeLabel('Status:');
     $clsRpt->writeCell($cRec->bInactive ? 'Inactive' : 'Active');
     $clsRpt->closeRow();
     $clsRpt->openRow(false);
     $clsRpt->writeLabel('Charge ID:');
     $clsRpt->writeCell(str_pad($cRec->lKeyID, 5, '0', STR_PAD_LEFT));
     $clsRpt->closeRow();
     $clsRpt->openRow(false);
     $clsRpt->writeLabel('Amount:');
     $clsRpt->writeCell($cRec->strCurSymbol . ' ' . number_format($cRec->curChargeAmnt, 2) . ' ' . $cRec->strFlagImage);
     $clsRpt->closeRow();
     $clsRpt->openRow(false);
     $clsRpt->writeLabel('Date of Charge:');
     $clsRpt->writeCell(date($genumDateFormat, $cRec->dteCharge));
     $clsRpt->closeRow();
     $clsRpt->closeReport(true);
 }
function showClientSponsorInfo($clsRpt, $lCID, $clsClient)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $genumDateFormat;
    $attributes = new stdClass();
    $attributes->lTableWidth = 900;
    $attributes->divID = 'clientSpon';
    $attributes->divImageID = 'clientSponDivImg';
    openBlock('Sponsorships', '', $attributes);
    if ($clsClient->clients[0]->lNumSponsors == 0) {
        echoT('<i>There are currently no sponsors for this ' . $clsClient->clients[0]->cv_strVocClientS . '</i><br>');
    } else {
        $clsRpt->openReport();
        foreach ($clsClient->clients[0]->sponsors as $clsCSpon) {
            $bInactive = $clsCSpon->bInactive;
            if ($bInactive) {
                $strSpanStart = '<span style="color: #999;"><i>';
                $strSpanStop = '</i></span>';
                $strInactive = ' (inactive since ' . date($genumDateFormat, $clsCSpon->dteInactive) . ')';
            } else {
                $strSpanStart = $strSpanStop = $strInactive = '';
            }
            echoT(strLinkView_Sponsorship($clsCSpon->lKeyID, 'View sponsorship', true) . $strSpanStart . str_pad($clsCSpon->lKeyID, 5, '0', STR_PAD_LEFT) . ' ' . $clsCSpon->strSafeNameFL . $strInactive . $strSpanStop . '<br>');
        }
        $clsRpt->closeReport();
    }
    $attributes = new stdClass();
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
 private function loadSponsorshipContext()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->clsSpon = new msponsorship();
     $this->clsSpon->sponsorInfoViaID($this->lForeignID);
     $this->strContextLabel = 'sponsorship record';
     $sponRec = $this->clsSpon->sponInfo[0];
     $this->strContextName = $sponRec->strSponProgram;
     $this->strContextViewLink = strLinkView_Sponsorship($this->lForeignID, 'View sponsorship record', true);
 }
示例#11
0
function contextNameLink($enumType, $lForeignID, &$strContextName, &$strContextLink)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $CI =& get_instance();
    $strContextLink = str_pad($lForeignID, 5, '0', STR_PAD_LEFT);
    switch ($enumType) {
        case CENUM_CONTEXT_PEOPLE:
            $CI->clsPeople->loadPeopleViaPIDs($lForeignID, false, false);
            $strContextName = $CI->clsPeople->people[0]->strFName . ' ' . $CI->clsPeople->people[0]->strLName;
            $strContextLink .= strLinkView_PeopleRecord($lForeignID, 'View people record', true);
            break;
        case CENUM_CONTEXT_CLIENT:
            $CI->clsClients->loadClientsViaClientID($lForeignID);
            $strContextName = $CI->clsClients->clients[0]->strFName . ' ' . $CI->clsClients->clients[0]->strLName;
            $strContextLink .= strLinkView_ClientRecord($lForeignID, 'View client record', true);
            break;
        case CENUM_CONTEXT_GIFT:
            $CI->clsGifts->loadGiftViaGID($lForeignID);
            $strContextName = 'Donation by ' . $CI->clsGifts->gifts[0]->strSafeName;
            $strContextLink .= strLinkView_GiftsRecord($lForeignID, 'View gift record', true);
            break;
        case CENUM_CONTEXT_BIZ:
            $CI->clsBiz->loadBizRecsViaBID($lForeignID);
            $strContextName = $CI->clsBiz->bizRecs[0]->strSafeName;
            $strContextLink .= strLinkView_BizRecord($lForeignID, 'View business record', true);
            break;
        case CENUM_CONTEXT_SPONSORSHIP:
            $CI->clsSpon->sponsorInfoViaID($lForeignID);
            $strContextName = 'Sponsor ' . $CI->clsSpon->sponInfo[0]->strSponSafeNameFL;
            $strContextLink .= strLinkView_Sponsorship($lForeignID, 'View sponsorship record', true);
            break;
        case CENUM_CONTEXT_VOLUNTEER:
            $CI->clsVol->loadVolRecsViaVolID($lForeignID, true);
            $strContextName = $CI->clsVol->volRecs[0]->strSafeNameFL;
            $strContextLink .= strLinkView_Volunteer($lForeignID, 'View volunteer record', true);
            break;
        case CENUM_CONTEXT_LOCATION:
            $CI->clsLoc->loadLocationRec($lForeignID);
            $strContextName = $CI->clsLoc->strLocation;
            $strContextLink .= strLinkView_ClientLocation($lForeignID, 'View client location record', true);
            break;
        case CENUM_CONTEXT_ORGANIZATION:
            $CI->clsLoc->loadLocationRec($lForeignID);
            $strContextName = $CI->clsChapter->chapterRec->strSafeChapterName;
            $strContextLink .= strLinkView_OrganizationRecord($lForeignID, 'View your organization record', true);
            break;
        default:
            screamForHelp($enumType . ': feature not available yet<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
            break;
    }
}
function strLinkView_ViaRecType($enumSearchType, $lFKey01 = null, $lFKey02 = null)
{
    //-----------------------------------------------------------------
    //
    //-----------------------------------------------------------------
    switch ($enumSearchType) {
        case CENUM_CONTEXT_HOUSEHOLD:
            return strLinkView_Household($lFKey01, $lFKey02, 'View household', true);
            break;
        case CENUM_CONTEXT_PEOPLE:
            return strLinkView_PeopleRecord($lFKey01, 'View people record', true);
            break;
        case CENUM_CONTEXT_BIZ:
            return strLinkView_BizRecord($lFKey01, 'View business/prganization record', true);
            break;
        case CENUM_CONTEXT_CLIENT:
            return strLinkView_ClientRecord($lFKey01, 'View client record', true);
            break;
        case CENUM_CONTEXT_SPONSORSHIP:
            return strLinkView_Sponsorship($lFKey01, 'View sponsor record', true);
            break;
        default:
            screamForHelp($enumSearchType . ': invalid link type<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__);
            break;
    }
}
    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 = '&nbsp;' . $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 = '&nbsp;' . 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 . '&nbsp;' . 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) . '&nbsp' . $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;
        }
    }
            </td>
         </tr>');
foreach ($clients as $client) {
    $lCID = $client->lClientID;
    if ($client->lNumSponsors == 0) {
        $strSponsors = '<br><i>No sponsors</i>';
    } else {
        $strSponsors = '<br><b><i>Sponsors</i></b><br><ul style="margin-top: 0px; margin-left:-10px;">';
        foreach ($client->sponsors as $spon) {
            if ($spon->bInactive) {
                $strSStart = '<font style="color: #999;">';
                $strSEnd = ' (inactive)</font>';
            } else {
                $strSStart = $strSEnd = '';
            }
            $strSponsors .= '<li>' . $strSStart . strLinkView_Sponsorship($spon->lKeyID, 'View sponsorship', true) . '&nbsp;' . htmlspecialchars($spon->strFName . ' ' . $spon->strLName) . $strSEnd . '</li>' . "\n";
        }
        $strSponsors .= '</ul>';
    }
    echoT('
         <tr class="makeStripe">
            <td class="enpRpt" style="text-align: center; width: 40pt" nowrap>' . str_pad($lCID, 6, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_ClientRecord($lCID, 'View client record', true) . '
            </td>
            <td class="enpRpt">' . htmlspecialchars($client->strClientLName . ', ' . $client->strClientFName) . $strSponsors . '
            </td>
            <td class="enpRpt" style="width: 270pt;">' . strEnrollmentTable($cprog, $lCID, $client->lNumEnrollments, $client->erecs) . '
            </td>
         </tr>');
}
echoT('
      </table>');
示例#15
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;
 }
         $strActiveDates = 'sponsor dates: ' . date($genumDateFormat, $sponRec->dteStart) . ' - ' . date($genumDateFormat, $sponRec->dteInactive);
     } else {
         $strIStyle = '';
         $strActiveDates = 'sponsor since: ' . date($genumDateFormat, $sponRec->dteStart);
     }
 } else {
     $strIStyle = '';
 }
 echoT('
      <tr class="makeStripe">');
 //----------------------
 // sponsor ID
 //----------------------
 if ($showFields->bSponID) {
     echoT('
          <td class="enpRpt" style="' . $strIStyle . '">' . strLinkView_Sponsorship($lSponsorID, 'View sponsorship record', true, 'id="viewSponRec_' . $lSponsorID . '"') . '&nbsp;' . str_pad($lSponsorID, 5, '0', STR_PAD_LEFT) . '
          </td>');
 }
 //---------------------------
 // active state
 //---------------------------
 if ($showFields->bActiveInactive) {
     echoT('
          <td class="enpRpt" style="' . $strIStyle . '">' . $strActiveDates . '
          </td>');
 }
 //---------------------------
 // sponsor name
 //---------------------------
 if ($showFields->bName) {
     if ($sponRec->bSponBiz) {
示例#17
0
 private function strPeopleBasedGroupRptHTML($enumContext)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     switch ($enumContext) {
         case CENUM_CONTEXT_PEOPLE:
             $strIDLabel = 'PeopleID';
             $strInner = ' INNER JOIN people_names ON pe_lKeyID=gm_lForeignID ';
             $strFID = ' pe_lKeyID AS lFID ';
             break;
         case CENUM_CONTEXT_BIZ:
             $strIDLabel = 'businessID';
             $strInner = ' INNER JOIN people_names ON pe_lKeyID=gm_lForeignID ';
             $strFID = ' pe_lKeyID AS lFID ';
             break;
         case CENUM_CONTEXT_VOLUNTEER:
             $strIDLabel = 'volunteerID';
             $strInner = ' INNER JOIN volunteers   ON vol_lKeyID    = gm_lForeignID ' . ' INNER JOIN people_names ON vol_lPeopleID = pe_lKeyID ';
             $strFID = ' pe_lKeyID, vol_lKeyID AS lFID ';
             break;
         case CENUM_CONTEXT_SPONSORSHIP:
             $strIDLabel = 'sponsorID';
             $strInner = ' INNER JOIN sponsor   ON sp_lKeyID        = gm_lForeignID ' . ' INNER JOIN people_names ON sp_lForeignID = pe_lKeyID ';
             $strFID = ' pe_lKeyID, sp_lKeyID AS lFID ';
             break;
         default:
             screamForHelp($enumContext . ': group type not yet available<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__);
             break;
     }
     $strOut = '<table class="enpRptC">
              <tr>
                 <td class="enpRptLabel">' . $strIDLabel . '
                 </td>
                 <td class="enpRptLabel">
                    Name
                 </td>
                 <td class="enpRptLabel">
                    Address
                 </td>
                 <td class="enpRptLabel">
                    Phone/Email
                 </td>
                 <td class="enpRptLabel">
                    Group Membership
                 </td>
              </tr>' . "\n";
     $sqlStr = "SELECT\n             {$strFID},\n             pe_strLName, pe_strFName, pe_strAddr1, pe_strAddr2,\n             pe_strCity, pe_strState, pe_strCountry, pe_strZip, pe_strPhone, pe_strCell, pe_strEmail\n          FROM tmpGroupMatch\n             {$strInner}\n          ORDER BY gm_lKeyID;";
     $query = $this->db->query($sqlStr);
     foreach ($query->result() as $row) {
         $lFID = $row->lFID;
         if ($row->pe_strEmail . '' == '') {
             $strEmail = '';
         } else {
             $strEmail = '<br>' . mailto($row->pe_strEmail, $row->pe_strEmail);
         }
         $this->groupMembershipViaFID($enumContext, $lFID);
         /*
            tip for preventing that pesky line break before a list
            http://stackoverflow.com/questions/1682873/how-do-i-prevent-a-line-break-occurring-before-an-unordered-list
            ul.errorlist {list-style-type: none; display:inline; margin-left: 0; padding-left: 0;}
            ul.errorlist li {display: inline; color:red; font-size: 0.8em; margin-left: 0px; padding-left: 10px;}
         */
         $strGroupList = '<ul style="list-style-type: square; display:inline; margin-left: 0; padding-left: 0;">';
         foreach ($this->arrMemberInGroups as $grpMember) {
             $strGroupList .= '<li style="margin-left: 20px; padding-left: 3px;">' . htmlspecialchars($grpMember->strGroupName) . '</li>';
         }
         $strGroupList .= '</ul>';
         switch ($enumContext) {
             case CENUM_CONTEXT_PEOPLE:
                 $strLink = strLinkView_PeopleRecord($lFID, 'View people record', true) . '&nbsp;';
                 break;
             case CENUM_CONTEXT_BIZ:
                 $strLink = strLinkView_BizRecord($lFID, 'View people record', true) . '&nbsp;';
                 break;
             case CENUM_CONTEXT_VOLUNTEER:
                 $strLink = strLinkView_Volunteer($lFID, 'View volunteer record', true) . '&nbsp;';
                 break;
             case CENUM_CONTEXT_SPONSORSHIP:
                 $strLink = strLinkView_Sponsorship($lFID, 'View sponsor record', true) . '&nbsp;';
                 break;
             default:
                 screamForHelp($enumContext . ': group type not yet available<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__);
                 break;
         }
         $bBiz = $enumContext == CENUM_CONTEXT_BIZ;
         $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: 160px;">' . htmlspecialchars($row->pe_strLName . ($bBiz ? '' : ', ' . $row->pe_strFName)) . '
               </td>
               <td class="enpRpt" style="width: 200px;">' . strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true) . '
               </td>
               <td class="enpRpt" style="width: 120px;">' . htmlspecialchars(strPhoneCell($row->pe_strPhone, $row->pe_strCell)) . $strEmail . '
               </td>
               <td class="enpRpt" style="width: 200px;">' . $strGroupList . '
               </td>
            </tr>' . "\n";
         $strOut .= '</tr>' . "\n";
     }
     $strOut .= '</table>' . "\n";
     return $strOut;
 }
 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) . '&nbsp;' . 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) . '&nbsp;' . 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) . '&nbsp;' . str_pad($lPayerID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . htmlspecialchars($row->strPayerLName) . ' (business)';
             } else {
                 $strName = strLinkView_PeopleRecord($lPayerID, 'View people record', true) . '&nbsp;' . str_pad($lPayerID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . 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) . '&nbsp;' . str_pad($lSponsorFID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . htmlspecialchars($row->strSponLName) . ' (business)';
                 } else {
                     $strName = strLinkView_PeopleRecord($lSponsorFID, 'View people record', true) . '&nbsp;' . str_pad($lSponsorFID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . 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;
 }
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 = '&nbsp;';
        $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 = '&nbsp;';
        }
        $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 = '&nbsp;';
    }
    $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>');
}
This client's record can not be removed because it is associated with
the following sponsorships:

   <table>
<?php 
foreach ($sponsors as $sponsor) {
    $lSponID = $sponsor->lKeyID;
    echoT('
          <tr>
             <td>' . strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . ' ' . str_pad($lSponID, 5, '0', STR_PAD_LEFT) . '
             </td>
             <td>' . $sponsor->strSafeNameFL . '
             </td>
          </tr>');
}
?>
   </table>
 foreach ($pastDue as $pd) {
     $lSponID = $pd->lSponID;
     $curCommit = $pd->curCommit;
     $curCharges = $pd->curCharges;
     $curPayments = $pd->curPayments;
     $curBal = $curCharges - $curPayments;
     $lMonthsPast = (int) ($curBal / $curCommit);
     $curCommitTot += $curCommit;
     $curChargeTot += $curCharges;
     $curPayTot += $curPayments;
     $curBalTot += $curBal;
     $bInactive = $pd->bInactive;
     $strInactive = $bInactive ? 'color: #777;' : '';
     echoT('
            <tr class="makeStripe">
               <td class="enpRpt" style="width: 50pt; text-align: center;' . $strInactive . '">' . str_pad($lSponID, 5, '0', STR_PAD_LEFT) . ' ' . strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . '
               </td>
               <td class="enpRpt" style="width: 150pt;' . $strInactive . '">' . $pd->strSponSafeNameLF . ($bInactive ? ' (inactive)' : '') . '
               </td>
               <td class="enpRpt" style="width: 100pt;' . $strInactive . '">' . $pd->strClientSafeNameLF . '
               </td>
               <td class="enpRpt" style="width: 50pt; text-align: right; padding-right: 5pt;' . $strInactive . '">' . number_format($curCommit, 2) . '
               </td>
               <td class="enpRpt" style="width: 50pt; text-align: right; padding-right: 5pt;' . $strInactive . '">' . number_format($curCharges, 2) . '
               </td>
               <td class="enpRpt" style="width: 50pt; text-align: right; padding-right: 5pt;' . $strInactive . '">' . number_format($curPayments, 2) . '
               </td>
               <td class="enpRpt" style="width: 50pt; text-align: right; padding-right: 5pt;' . $strInactive . '"><b>' . number_format($curBal, 2) . '</b>
               </td>
               <td class="enpRpt" style="width: 30pt; text-align: center;' . $strInactive . '"><b>' . number_format($lMonthsPast) . '</b>
               </td>
 foreach ($sponInfo as $sponsor) {
     $lSponID = $sponsor->lKeyID;
     $bBiz = $sponsor->bSponBiz;
     $lForeignID = $sponsor->lForeignID;
     $lClientID = $sponsor->lClientID;
     $bInactive = $sponsor->bInactive;
     $dteInactive = $sponsor->dteInactive;
     if ($bInactive) {
         $strSpanInactive = '<span style="color: #999;">';
         $strStopSpan = '</span>';
     } else {
         $strSpanInactive = $strStopSpan = '';
     }
     echoT($clsRpt->openRow(true));
     if ($showFields->bSponsorID) {
         echoT($clsRpt->writeCell(strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . '&nbsp;' . $strSpanInactive . str_pad($lSponID, 5, '0', STR_PAD_LEFT) . $strStopSpan, '40', $strStyleExtra = 'text-align: center;'));
     }
     if ($showFields->bName) {
         if ($bBiz) {
             $strLink = strLinkView_BizRecord($lForeignID, 'View Business Record', true);
             $strName = htmlspecialchars($sponsor->strSponsorLName) . ' <i>(business)</i>';
         } else {
             $strLink = strLinkView_PeopleRecord($lForeignID, 'View People Record', true);
             $strName = htmlspecialchars($sponsor->strSponsorLName . ', ' . $sponsor->strSponsorFName);
         }
         $strName .= '<br>' . $strLink . '&nbsp;' . str_pad($lForeignID, 5, '0', STR_PAD_LEFT);
         if ($showFields->bSponAddr) {
             $strName .= '<br>' . $sponsor->strAddr;
         }
         echoT($clsRpt->writeCell($strSpanInactive . $strName . $strStopSpan, 175));
     }
 } else {
     foreach ($sponInfo as $sponsor) {
         $lSponID = $sponsor->lKeyID;
         $bBiz = $sponsor->bSponBiz;
         $lForeignID = $sponsor->lForeignID;
         $lClientID = $sponsor->lClientID;
         $bInactive = $sponsor->bInactive;
         $strColorInactive = $bInactive ? 'color: #999;' : '';
         if (is_null($lClientID) && !$bInactive) {
             $strLinkAddClient = '<br><br>' . strLinkAdd_ClientToSpon($lSponID, 'Add client to this sponsorship', true) . '&nbsp;' . strLinkAdd_ClientToSpon($lSponID, 'Add client to this sponsorship', false);
         } else {
             $strLinkAddClient = '';
         }
         echoT($clsRpt->openRow(true));
         if ($showFields->bSponsorID) {
             echoT($clsRpt->writeCell(strLinkView_Sponsorship($lSponID, 'View sponsorship record', true) . '&nbsp;' . str_pad($lSponID, 5, '0', STR_PAD_LEFT), '40', 'text-align: center;' . $strColorInactive));
         }
         if ($showFields->bName) {
             if ($bBiz) {
                 $strLink = strLinkView_BizRecord($lForeignID, 'View Business Record', true);
                 $strName = htmlspecialchars($sponsor->strSponsorLName) . ' <i>(business)</i>';
             } else {
                 $strLink = strLinkView_PeopleRecord($lForeignID, 'View People Record', true);
                 $strName = htmlspecialchars($sponsor->strSponsorLName . ', ' . $sponsor->strSponsorFName);
             }
             $strName .= '<br>' . $strLink . '&nbsp;' . str_pad($lForeignID, 5, '0', STR_PAD_LEFT);
             if ($showFields->bSponAddr) {
                 $strName .= '<br>' . $sponsor->strAddr;
             }
             echoT($clsRpt->writeCell($strName, 175, $strColorInactive));
         }