function loadReportEnrolless(&$sRpt)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->sqlWhere = " AND cp_lKeyID {$sRpt->strCProgIn} ";
     $this->loadClientPrograms();
     $erecs = array();
     foreach ($this->cprogs as $cprog) {
         // note - interesting debate over where to use IN or temp table
         // http://stackoverflow.com/questions/1532366/mysql-number-of-items-within-in-clause
         // load the enrollees
         $this->extractCProgFields($cprog, $lETableID, $lATableID, $strETable, $strEFNPrefix, $strATable, $strAFNPrefix);
         $sqlStr = "SELECT {$strEFNPrefix}" . "_lForeignKey AS lClientID,\n                {$strEFNPrefix}" . "_lKeyID AS lERecID,\n                {$strEFNPrefix}" . "_dteStart AS mdteStart,\n                {$strEFNPrefix}" . "_dteEnd   AS mdteEnd\n             FROM {$strETable}\n             WHERE NOT {$strEFNPrefix}" . "_bRetired " . $this->strActivelyEnrolledDuringTimeFrameWhere($cprog, $sRpt->dteStart, $sRpt->dteEnd) . "\n             ORDER BY {$strEFNPrefix}" . "_lKeyID;";
         $query = $this->db->query($sqlStr);
         $lNumERecs = $query->num_rows();
         if ($lNumERecs > 0) {
             foreach ($query->result() as $row) {
                 $lClientID = $row->lClientID;
                 if (!isset($erecs[$lClientID])) {
                     $erecs[$lClientID] = new stdClass();
                     $erec =& $erecs[$lClientID];
                     $erec->programs = array();
                     $erec->lProgCnt = 0;
                 }
                 $lCnt = $erec->lProgCnt;
                 $erec->programs[$lCnt] = new stdClass();
                 $erec->programs[$lCnt]->strProgName = $cprog->strProgramName;
                 $erec->programs[$lCnt]->lCProgID = $cprog->lKeyID;
                 $erec->programs[$lCnt]->lETableID = $cprog->lEnrollmentTableID;
                 $erec->programs[$lCnt]->lERecID = $row->lERecID;
                 $erec->programs[$lCnt]->dteStart = dteMySQLDate2Unix($row->mdteStart);
                 $erec->programs[$lCnt]->dteEnd = dteMySQLDate2Unix($row->mdteEnd);
                 ++$erec->lProgCnt;
             }
         }
     }
     $this->lNumEnrollees = count($erecs);
     $this->enrollees = array();
     if ($this->lNumEnrollees > 0) {
         $strIn = implode(', ', array_keys($erecs));
         $sqlStr = "SELECT\n                  cr_lKeyID, cr_strFName, cr_strLName\n               FROM client_records\n               WHERE\n                  cr_lKeyID IN ({$strIn})\n                  AND NOT cr_bRetired\n               ORDER BY cr_strLName, cr_strFName, cr_lKeyID;";
         $query = $this->db->query($sqlStr);
         $lNumCRecs = $query->num_rows();
         if ($lNumCRecs > 0) {
             $idx = 0;
             foreach ($query->result() as $row) {
                 $lClientID = (int) $row->cr_lKeyID;
                 $this->enrollees[$idx] = new stdClass();
                 $crec =& $this->enrollees[$idx];
                 $crec->lClientID = $lClientID;
                 $crec->strCFName = $row->cr_strFName;
                 $crec->strCLName = $row->cr_strLName;
                 $crec->programs = arrayCopy($erecs[$lClientID]->programs);
                 ++$idx;
             }
         }
     }
 }
 function loadPackages()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $packages = array();
     $sqlStr = "SELECT\n            ap_lKeyID, ap_lAuctionID, ap_strPackageName,\n            ap_curMinBidAmnt, ap_curReserveAmnt, ap_curMinBidInc,\n            ap_curBuyItNowAmnt, ap_curWinBidAmnt,\n            ap_strDescription, ap_strInternalNotes, ap_lBidWinnerID, ap_dteWinnerContact,\n            ap_lBidSheetID, abs_lKeyID, abs_lTemplateID, abs_strSheetName,\n            ap_lGiftID, gi_curAmnt,\n\n            bwPeople.pe_bBiz AS bw_bBiz, bwPeople.pe_strFName AS bw_strFName, bwPeople.pe_strLName AS bw_strLName,\n\n            auc_strAuctionName, auc_lDefaultBidSheet, auc_dteAuctionDate,\n            auc_lACOID, aco_strFlag, aco_strCurrencySymbol,\n\n            ap_lOriginID, ap_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(ap_dteOrigin) AS dteOrigin,\n            UNIX_TIMESTAMP(ap_dteLastUpdate) AS dteLastUpdate\n\n         FROM gifts_auctions_packages\n            INNER JOIN gifts_auctions           ON ap_lAuctionID    = auc_lKeyID\n            INNER JOIN admin_aco                ON auc_lACOID       = aco_lKeyID\n            INNER JOIN admin_users AS usersC    ON ap_lOriginID     = usersC.us_lKeyID\n            INNER JOIN admin_users AS usersL    ON ap_lLastUpdateID = usersL.us_lKeyID\n            LEFT  JOIN gifts                    ON ap_lGiftID       = gi_lKeyID\n            LEFT  JOIN gifts_auctions_bidsheets ON abs_lKeyID       = ap_lBidSheetID\n            LEFT  JOIN people_names AS bwPeople ON pe_lKeyID        = ap_lBidWinnerID\n\n         WHERE NOT auc_bRetired AND NOT ap_bRetired\n            {$this->strWhereExtra}\n         ORDER BY ap_strPackageName, ap_lKeyID;";
     $query = $this->db->query($sqlStr);
     $this->lNumPackages = $query->num_rows();
     if ($this->lNumPackages == 0) {
         $this->packages[0] = new stdClass();
         $package =& $this->packages[0];
         $package->lKeyID = $package->lAuctionID = $package->lACOID = $package->strFlag = $package->strCurrencySymbol = $package->strAuctionName = $package->dteAuction = $package->strPackageName = $package->strPackageSafeName = $package->curMinBidAmnt = $package->curReserveAmnt = $package->curMinBidInc = $package->curBuyItNowAmnt = $package->curWinBidAmnt = $package->curActualGiftAmnt = $package->strDescription = $package->strInternalNotes = $package->lBidWinnerID = $package->dteContacted = $package->mdteContacted = $package->lGiftID = $package->lOriginID = $package->lLastUpdateID = $package->strCFName = $package->strCLName = $package->strLFName = $package->strLLName = $package->dteOrigin = $package->dteLastUpdate = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->packages[$idx] = new stdClass();
             $package =& $this->packages[$idx];
             $package->lKeyID = $row->ap_lKeyID;
             $package->lAuctionID = $row->ap_lAuctionID;
             $package->strAuctionName = $row->auc_strAuctionName;
             $package->dteAuction = dteMySQLDate2Unix($row->auc_dteAuctionDate);
             $package->lACOID = $row->auc_lACOID;
             $package->strFlag = $row->aco_strFlag;
             $package->strCurrencySymbol = $row->aco_strCurrencySymbol;
             $package->strPackageName = $row->ap_strPackageName;
             $package->strPackageSafeName = htmlspecialchars($row->ap_strPackageName);
             $package->curMinBidAmnt = $row->ap_curMinBidAmnt;
             $package->curBuyItNowAmnt = $row->ap_curBuyItNowAmnt;
             $package->curReserveAmnt = $row->ap_curReserveAmnt;
             $package->curMinBidInc = $row->ap_curMinBidInc;
             $package->curWinBidAmnt = $row->ap_curWinBidAmnt;
             $package->curActualGiftAmnt = $row->gi_curAmnt;
             $package->strDescription = $row->ap_strDescription;
             $package->strInternalNotes = $row->ap_strInternalNotes;
             $package->lBidSheetID = $row->ap_lBidSheetID;
             if (is_null($package->lBidSheetID)) {
                 $package->lBidSheetID = $row->auc_lDefaultBidSheet;
             }
             $package->lTemplateID = $lTemplateID = $row->abs_lTemplateID;
             if (is_null($lTemplateID)) {
                 $package->tInfo = null;
             } else {
                 strXlateTemplate($lTemplateID, $package->tInfo);
             }
             $package->strSheetName = $row->abs_strSheetName;
             $package->lBidWinnerID = $row->ap_lBidWinnerID;
             $package->bw_bBiz = $row->bw_bBiz;
             $package->bw_strFName = $row->bw_strFName;
             $package->bw_strLName = $row->bw_strLName;
             if (is_null($package->lBidWinnerID)) {
                 $package->bw_strSafeName = 'not set';
             } else {
                 if ($package->bw_bBiz) {
                     $package->bw_strSafeName = htmlspecialchars($package->bw_strLName) . ' (business)';
                 } else {
                     $package->bw_strSafeName = htmlspecialchars($package->bw_strFName . ' ' . $package->bw_strLName);
                 }
             }
             $package->dteContacted = dteMySQLDate2Unix($row->ap_dteWinnerContact);
             $package->mdteContacted = $row->ap_dteWinnerContact;
             $package->lGiftID = $row->ap_lGiftID;
             $package->lOriginID = $row->ap_lOriginID;
             $package->lLastUpdateID = $row->ap_lLastUpdateID;
             $package->strCFName = $row->strCFName;
             $package->strCLName = $row->strCLName;
             $package->strLFName = $row->strLFName;
             $package->strLLName = $row->strLLName;
             $package->dteOrigin = $row->dteOrigin;
             $package->dteLastUpdate = $row->dteLastUpdate;
             ++$idx;
         }
     }
 }
 function strUnJobCodesDetailsViaMonth($strMoYr, $sRpt, $bAllJobCodes)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat;
     $strOut = '<br><br>
         <table class="enpRptC" style="width: 600pt;">
             <tr>
                <td colspan="4" class="enpRptTitle">
                   Job Code Details for Unschedule Volunteers: ' . $strMoYr . '
                </td>
             </tr>
             <tr>
                <td class="enpRptLabel">
                   Date
                </td>
                <td class="enpRptLabel">
                   Volunteer
                </td>
                <td class="enpRptLabel">
                   Job Code
                </td>
                <td class="enpRptLabel">
                   Hours
                </td>
             </tr>
             ';
     if ($bAllJobCodes) {
         $strWhereJC = '';
     } else {
         $strWhereJC = ' AND vsa_lJobCode=' . $sRpt->lJobCodeID . ' ';
     }
     $sqlStr = 'SELECT vsa_lJobCode, vsa_dHoursWorked, vsa_lVolID,
         jc.lgen_strListItem AS strJobCode, vsa_dteActivityDate,
         pe_strFName, pe_strLName
      FROM vol_events_dates_shifts_assign
         INNER JOIN volunteers                     ON vol_lKeyID            = vsa_lVolID
         INNER JOIN people_names                   ON vol_lPeopleID         = pe_lKeyID
         LEFT  JOIN lists_generic   AS jc          ON vsa_lJobCode          = jc.lgen_lKeyID
      WHERE NOT vsa_bRetired
         AND YEAR (vsa_dteActivityDate)=' . $sRpt->lYear . '
         AND MONTH(vsa_dteActivityDate)=' . $sRpt->lMonth . '
         AND vsa_dHoursWorked > 0
         ' . $strWhereJC . '
      ORDER BY strJobCode, vsa_dteActivityDate, pe_strLName, pe_strFName, pe_lKeyID;';
     $query = $this->db->query($sqlStr);
     $numRows = $query->num_rows();
     $idx = 0;
     $sngTotHrs = 0.0;
     if ($numRows > 0) {
         foreach ($query->result() as $row) {
             $dteActivity = dteMySQLDate2Unix($row->vsa_dteActivityDate);
             $strJobCode = $row->strJobCode . '' == '' ? '(not set)' : htmlspecialchars($row->strJobCode);
             $strOut .= '
             <tr class="makeStripe">
                <td class="enpRpt" style="width: 130pt;">' . date($genumDateFormat, $dteActivity) . '
                </td>
                <td class="enpRpt" style="width: 130pt;">' . strLinkView_Volunteer($row->vsa_lVolID, 'Volunteer Record', true) . '&nbsp;' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '
                </td>
                <td class="enpRpt" style="width: 100pt;">' . $strJobCode . '
                </td>
                <td class="enpRpt" style="width: 35pt; padding-right: 10px; text-align: right;">' . number_format($row->vsa_dHoursWorked, 2) . '
                </td>
             </tr>';
             $sngTotHrs += $row->vsa_dHoursWorked;
         }
     }
     $strOut .= '
       <tr>
          <td class="enpRpt" colspan="3"><b>
             Total:</b>
          </td>
          <td class="enpRpt" style="width: 35pt; padding-right: 10px; text-align: right;"><b>' . number_format($sngTotHrs, 2) . '</b>
          </td>
       </tr>';
     $strOut .= '</table>' . "\n";
     return $strOut;
 }
 function strDDLAuctions($strName, $lMatchID, $bAddBlank)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat;
     $strOut = '<select name="' . $strName . '">' . "\n";
     if ($bAddBlank) {
         $strOut .= '<option value="-1">&nbsp;</option>' . "\n";
     }
     $sqlStr = "SELECT\n            auc_lKeyID, auc_strAuctionName, auc_dteAuctionDate\n         FROM gifts_auctions\n         WHERE NOT auc_bRetired\n         ORDER BY auc_strAuctionName, auc_lKeyID;";
     $query = $this->db->query($sqlStr);
     $lNumAuctions = $query->num_rows();
     if ($lNumAuctions > 0) {
         foreach ($query->result() as $row) {
             $lKeyID = $row->auc_lKeyID;
             $strOut .= '<option value="' . $lKeyID . '" ' . ($lKeyID == $lMatchID ? 'SELECTED' : '') . '>' . htmlspecialchars($row->auc_strAuctionName) . '&nbsp;(' . date($genumDateFormat, dteMySQLDate2Unix($row->auc_dteAuctionDate)) . ')' . '</option>' . "\n";
         }
     }
     $strOut .= '</select>' . "\n";
     return $strOut;
 }
示例#5
0
 private function loadImgDocInfoViaContext($enumContext, $imgDoc, $row)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat, $glChapterID;
     $lFID = (int) $imgDoc->lForeignID;
     switch ($enumContext) {
         case CENUM_CONTEXT_CLIENT:
             $imgDoc->strNameLabel = 'Client';
             $imgDoc->strName = strLinkView_ClientRecord($lFID, 'View Client Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->cr_strLName . ', ' . $row->cr_strFName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->cr_strAddr1, $row->cr_strAddr2, $row->cr_strCity, $row->cr_strState, $row->cr_strCountry, $row->cr_strZip, true);
             $strPhone = strPhoneCell($row->cr_strPhone, $row->cr_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_PEOPLE:
             $imgDoc->strNameLabel = 'Name';
             $imgDoc->strName = strLinkView_PeopleRecord($lFID, 'View People Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_LOCATION:
             $imgDoc->strNameLabel = 'Client Location';
             $imgDoc->strName = strLinkView_ClientLocation($lFID, 'View client location', true) . '&nbsp;' . htmlspecialchars($row->cl_strLocation);
             break;
         case CENUM_CONTEXT_GRANTPROVIDER:
             $imgDoc->strNameLabel = 'Funder/Provider';
             $imgDoc->strName = strLinkView_GrantProvider($lFID, 'View funder/provider', true) . '&nbsp;' . htmlspecialchars($row->gpr_strGrantOrg);
             break;
         case CENUM_CONTEXT_INVITEM:
             $imgDoc->strNameLabel = 'Inventory Item';
             $imgDoc->strName = strLinkView_InventoryItem($lFID, 'View inventory item', true) . '&nbsp;' . htmlspecialchars($row->ivi_strItemName);
             break;
         case CENUM_CONTEXT_AUCTION:
             $imgDoc->strNameLabel = 'Silent Auction';
             $imgDoc->strName = strLinkView_AuctionRecord($lFID, 'View Auction', true) . '&nbsp;' . htmlspecialchars($row->auc_strAuctionName) . ' (' . date($genumDateFormat, dteMySQLDate2Unix($row->auc_dteAuctionDate)) . ')';
             break;
         case CENUM_CONTEXT_AUCTIONITEM:
             $imgDoc->strNameLabel = 'Auction Item';
             $imgDoc->strName = strLinkView_AuctionItem($lFID, 'View Auction Item', true) . '&nbsp;' . 'item: ' . htmlspecialchars($row->ait_strItemName) . '<br>package: ' . htmlspecialchars($row->ap_strPackageName) . '<br>auction: ' . htmlspecialchars($row->auc_strAuctionName);
             break;
         case CENUM_CONTEXT_AUCTIONPACKAGE:
             $imgDoc->strNameLabel = 'Auction Package';
             $imgDoc->strName = strLinkView_AuctionPackageRecord($lFID, 'View Auction Package', true) . '&nbsp;' . 'package: ' . htmlspecialchars($row->ap_strPackageName) . '<br>auction: ' . htmlspecialchars($row->auc_strAuctionName);
             break;
         case CENUM_CONTEXT_BIZ:
             $imgDoc->strNameLabel = 'Business/Organization Name';
             $imgDoc->strName = strLinkView_BizRecord($lFID, 'View Business/Organization Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_SPONSORSHIP:
             $bBiz = (bool) $row->pe_bBiz;
             if ($bBiz) {
                 $imgDoc->strNameLabel = 'Sponsor (Business/organization)';
                 $imgDoc->strName = strLinkView_PeopleRecord($lFID, 'View People Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '</b>';
             } else {
                 $imgDoc->strNameLabel = 'Sponsor (Individual)';
                 $imgDoc->strName = strLinkView_BizRecord($lFID, 'View Business/Organization Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName) . '</b>';
             }
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_ORGANIZATION:
             $imgDoc->strNameLabel = 'Your organization';
             $imgDoc->strName = strLinkView_OrganizationRecord($lFID, 'View organization record', true) . '&nbsp;' . htmlspecialchars($row->ch_strChapterName);
             break;
         case CENUM_CONTEXT_STAFF:
             $imgDoc->strNameLabel = 'Staff Member';
             $imgDoc->strName = strLinkView_User($lFID, 'View staff member record', true) . '&nbsp;' . htmlspecialchars($row->strFirstName . ' ' . $row->strLastName);
             break;
         case CENUM_CONTEXT_VOLUNTEER:
             $imgDoc->strNameLabel = 'Name';
             $imgDoc->strName = strLinkView_Volunteer($lFID, 'View Volunteer Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         default:
             screamForHelp($enumContext . ': image context not currently implemented<br>error on line  <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
             break;
     }
 }
 function clientsEnrolledViaProgID($lProgID, $cprog, $bCurrentlyEnrolledOnly, &$lNumClients, &$clients, $bEncludeEnrollment = false)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $strETable = $cprog->strEnrollmentTable;
     $strEFNPrefix = $cprog->strETableFNPrefix;
     $strERecStartFN = $strEFNPrefix . '_dteStart';
     $strERecEndFN = $strEFNPrefix . '_dteEnd';
     $strActiveFN = $strEFNPrefix . '_bCurrentlyEnrolled';
     if ($bCurrentlyEnrolledOnly) {
         $sqlWhere = " AND {$strActiveFN} ";
     } else {
         $sqlWhere = '';
     }
     $strOrder = 'cr_strLName, cr_strFName, ' . $strEFNPrefix . '_lForeignKey,' . $strEFNPrefix . '_lKeyID ';
     $sqlStr = 'SELECT DISTINCT
          cr_lKeyID,
          cr_strFName, cr_strLName, cr_dteEnrollment,
          cr_dteBirth
      FROM client_records
         INNER JOIN ' . $strETable . ' ON ' . $strEFNPrefix . '_lForeignKey = cr_lKeyID
      WHERE NOT cr_bRetired AND NOT ' . $strEFNPrefix . "_bRetired \n" . $sqlWhere . ' ' . $this->sqlWhereLoadClients . '
      ORDER BY ' . $strOrder . ';';
     $query = $this->db->query($sqlStr);
     $lNumClients = $query->num_rows();
     $clients = array();
     if ($lNumClients > 0) {
         if ($bCurrentlyEnrolledOnly) {
             $strWhereEBase = " AND {$strActiveFN} ";
         } else {
             $strWhereEBase = '';
         }
         $idx = 0;
         foreach ($query->result() as $row) {
             $clients[$idx] = new stdClass();
             $client =& $clients[$idx];
             $client->lClientID = $lClientID = (int) $row->cr_lKeyID;
             $client->strClientFName = $row->cr_strFName;
             $client->strClientLName = $row->cr_strLName;
             $client->dteClientEnrolled = dteMySQLDate2Unix($row->cr_dteEnrollment);
             // not cprogram enrollment date!
             $client->mysqlDteBirth = $row->cr_dteBirth;
             if ($bEncludeEnrollment) {
                 $sqlEWhere = $strWhereEBase . " AND ETable.{$strEFNPrefix}" . "_lForeignKey = {$lClientID} ";
                 $this->loadBaseEFieldRecs($cprog, $client->lNumERecs, $client->erecs, $sqlEWhere);
             }
             ++$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;
         }
     }
 }
 private function strVolScheduleRptHTML(&$query, $strLabel, $strSafeNameFL, $lVolID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat;
     $strOut = '<table class="enpRptC">
         <tr>
            <td class="enpRptTitle" colspan="7">' . $strLabel . ' Volunteer Schedule for ' . $strSafeNameFL . '&nbsp;' . strLinkView_Volunteer($lVolID, 'View volunteer record', true) . '
            </td>
         <tr>';
     $strOut .= '
         <tr>
            <td class="enpRptLabel" style="vertical-align: bottom;">
               Date
            </td>
            <td class="enpRptLabel" style="vertical-align: bottom;">
               Event
            </td>
            <td class="enpRptLabel" style="vertical-align: bottom;">
               Shift
            </td>
            <td class="enpRptLabel" style="vertical-align: bottom;">
               Start
            </td>
            <td class="enpRptLabel" style="vertical-align: bottom;">
               Duration
            </td>
            <td class="enpRptLabel" style="vertical-align: bottom;">
               Hours Logged
            </td>
         <tr>';
     foreach ($query->result() as $row) {
         $lEventID = $row->ved_lVolEventID;
         $lEdateID = $row->vs_lEventDateID;
         $strOut .= '
          <tr class="makeStripe">
             <td class="enpRpt" style="text-align: center; width: 80pt;">' . date($genumDateFormat, dteMySQLDate2Unix($row->ved_dteEvent)) . '
             </td>
             <td class="enpRpt" style="text-align: left; width: 200pt;">' . strLinkView_VolEvent($lEventID, 'View Event', true) . htmlspecialchars($row->vem_strEventName) . '
             </td>
             <td class="enpRpt" style="text-align: left; width: 120pt;">' . strLinkView_VolEventDate($lEdateID, 'View shifts for this date', true) . htmlspecialchars($row->vs_strShiftName) . '
             </td>
             <td class="enpRpt" style="text-align: left; width: 50pt;">' . $row->dteStartTime . '
             </td>
             <td class="enpRpt" style="text-align: left; width: 100pt;">' . $row->strDuration . '
             </td>
             <td class="enpRpt" style="text-align: right; padding-right: 10px;; width: 30pt;">' . number_format($row->vsa_dHoursWorked, 2) . '
             </td>
          </tr>';
     }
     $strOut .= '</table>';
     return $strOut;
 }
 private function clientStatusSearch(&$results)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat;
     $results->strLabel = 'Client Status';
     $results->lNumResults = 0;
     $sqlStr = 'SELECT csh_lKeyID, csh_lClientID, csh_lStatusID,
            csh_dteStatusDate,
            csh_strStatusTxt,
            cr_strFName, cr_strLName, cr_lLocationID, cl_strLocation
         FROM client_status
            INNER JOIN client_records  ON cr_lKeyID      = csh_lClientID
            INNER JOIN client_location ON cr_lLocationID = cl_lKeyID
         WHERE NOT csh_bRetired AND ' . $this->textSearchWhere('csh_strStatusTxt') . '
         ORDER BY csh_dteStatusDate, csh_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();
             $lClientID = $row->csh_lClientID;
             $match =& $results->matches[$idx];
             $match->links = 'Client ID ' . str_pad($lClientID, 5, '0', STR_PAD_LEFT) . strLinkView_ClientRecord($lClientID, 'View client record', true) . '&nbsp;&nbsp;' . 'Client Status ID: ' . str_pad($row->csh_lKeyID, 5, '0', STR_PAD_LEFT) . strLinkView_ClientStatusHistory($lClientID, 'View client status', true);
             $match->searchInfo = 'Client status record for ' . htmlspecialchars($row->cr_strFName . ' ' . $row->cr_strLName) . '
                         (' . htmlspecialchars($row->cl_strLocation) . ') of ' . date($genumDateFormat, dteMySQLDate2Unix($row->csh_dteStatusDate));
             $match->text = $row->csh_strStatusTxt;
             $match->textHighlighted = $this->highlightMatchedText($row->csh_strStatusTxt);
             ++$idx;
         }
     }
 }
 function strVolHoursDetailReport(&$sRpt, $lStartRec, $lRecsPerPage)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat;
     $this->hrsSumOpts($sRpt, $bUseYear, $lYear, $bUseMon, $lMon, $bUseVolID, $lVolID);
     $strLimit = " LIMIT {$lStartRec}, {$lRecsPerPage} ";
     $strTab = 'tmp_vol_hrs';
     $this->buildPopHrsTmp($strTab, $lYear, $lMon, $lVolID);
     $strWhere = '1';
     $strTitle = 'Volunteer Details for ';
     $strFail = 'There are no volunteer hours for ';
     if ($bUseVolID) {
         $cVol = new mvol();
         $cVol->loadVolRecsViaVolID($lVolID, true);
         $vRec =& $cVol->volRecs[0];
         $strSafeName = $vRec->strSafeName;
         $strTitle .= $strSafeName . '&nbsp; &nbsp;';
         $strFail .= $strSafeName . '&nbsp; &nbsp;';
     }
     if ($bUseMon) {
         $strMonth = strXlateMonth($lMon);
         $strTitle .= $strMonth . ' ' . $lYear;
         $strFail .= $strMonth . ' ' . $lYear;
     } else {
         $strTitle .= $lYear;
         $strFail .= $lYear;
     }
     $sqlStr = "SELECT\n             vsa_lKeyID, tmphr_dteVolActivity,\n             tmphr_lVolID, vsa_dHoursWorked, vsa_lEventDateShiftID,\n             lgen_strListItem,\n             vs_strShiftName, vs_lEventDateID, vem_lKeyID, vem_strEventName,\n             pe_strFName, pe_strLName\n\n          FROM {$strTab}\n             INNER JOIN vol_events_dates_shifts_assign ON vsa_lKeyID            = tmphr_lEventAssignID\n             INNER JOIN volunteers                     ON tmphr_lVolID          = vol_lKeyID\n             INNER JOIN people_names                   ON vol_lPeopleID         = pe_lKeyID\n             LEFT  JOIN vol_events_dates_shifts        ON vsa_lEventDateShiftID = vs_lKeyID\n             LEFT  JOIN vol_events_dates               ON vs_lEventDateID       = ved_lKeyID\n             LEFT  JOIN vol_events                     ON ved_lVolEventID       = vem_lKeyID\n             LEFT  JOIN lists_generic                  ON vsa_lActivityID=lgen_lKeyID\n\n          ORDER BY tmphr_dteVolActivity, vsa_lKeyID\n          {$strLimit};";
     $query = $this->db->query($sqlStr);
     $lNumRows = $query->num_rows();
     if ($lNumRows == 0) {
         return '<br><i>' . $strFail . '.</i><br>';
     }
     $strOut = '
      <table class="enpRptC">
         <tr>
            <td colspan="7" class="enpRptTitle">' . $strTitle . '
            </td>
         </tr>';
     $strOut .= '
         <tr>
            <td class="enpRptLabel">
               Date
            </td>
            <td class="enpRptLabel">
               Vol ID
            </td>
            <td class="enpRptLabel">
               Volunteer
            </td>
            <td class="enpRptLabel">
               Event
            </td>
            <td class="enpRptLabel">
               Shift/Activity
            </td>
            <td class="enpRptLabel">
               Hours
            </td>
         </tr>';
     foreach ($query->result() as $row) {
         $lVolID = $row->tmphr_lVolID;
         if (is_null($row->vsa_lEventDateShiftID)) {
             $strEvent = '<i>(unscheduled)</i>';
             $strActivity = strLinkEdit_VolUnschedHrs($lVolID, $row->vsa_lKeyID, 'Edit activity', true, '', 12) . '&nbsp;' . htmlspecialchars($row->lgen_strListItem);
         } else {
             $strEvent = strLinkView_VolEvent($row->vem_lKeyID, 'View event', true) . '&nbsp;' . htmlspecialchars($row->vem_strEventName);
             $strActivity = strLinkView_VolEventDate($row->vs_lEventDateID, 'View event date/shifts', true) . '&nbsp;' . htmlspecialchars($row->vs_strShiftName);
         }
         $strOut .= '
         <tr class="makeStripe">
            <td class="enpRpt">' . date($genumDateFormat, dteMySQLDate2Unix($row->tmphr_dteVolActivity)) . '
            </td>
            <td class="enpRpt">' . str_pad($lVolID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_Volunteer($lVolID, 'View volunteer record', true) . '
            </td>
            <td class="enpRpt">' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '
            </td>
            <td class="enpRpt">' . $strEvent . '
            </td>
            <td class="enpRpt">' . $strActivity . '
            </td>
            <td class="enpRpt" style="text-align: right; padding-right: 3px;">' . number_format($row->vsa_dHoursWorked, 2) . '
            </td>
         </tr>';
     }
     $strOut .= '</table><br>';
     return $strOut;
 }
示例#11
0
 public function loadGroupMembership($enumGroupType, $lGID)
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     $this->groupMembers = array();
     $this->lCntMembersInGroup = 0;
     $this->groupMemLabels = new stdClass();
     if (is_array($lGID)) {
         $strGroupWhere = ' gc_lGroupID IN (' . implode(',', $lGID) . ') ';
     } else {
         $strGroupWhere = " gc_lGroupID={$lGID} ";
     }
     switch ($enumGroupType) {
         case CENUM_CONTEXT_BIZ:
             $this->groupMemLabels->strName = 'Business/Organization';
             $this->groupMemLabels->strAddress = 'Address';
             $this->groupMemLabels->strKey = 'Business ID';
             $sqlStr = "SELECT\n                  gc_lForeignID AS lKeyID, gc_dteAdded,\n                  pe_strLName AS strName,\n                  CONCAT(pe_strAddr1, '\\n',\n                         pe_strAddr2, '\\n',\n                         pe_strCity,  '\\n',\n                         pe_strState,' ', pe_strZip, ' ', pe_strCountry) AS strAddress\n               FROM groups_child\n                  INNER JOIN people_names ON pe_lKeyID=gc_lForeignID\n               WHERE {$strGroupWhere}\n                  AND NOT pe_bRetired\n               ORDER BY pe_strLName, gc_lForeignID;";
             break;
         case CENUM_CONTEXT_PEOPLE:
             $this->groupMemLabels->strName = 'Name';
             $this->groupMemLabels->strAddress = 'Address';
             $this->groupMemLabels->strKey = 'People ID';
             $sqlStr = "SELECT\n                  gc_lForeignID AS lKeyID, gc_dteAdded,\n                  CONCAT(pe_strLName, ', ', pe_strFName) AS strName,\n                  CONCAT(pe_strAddr1, '\\n',\n                         pe_strAddr2, '\\n',\n                         pe_strCity,  '\\n',\n                         pe_strState,' ', pe_strZip, ' ', pe_strCountry) AS strAddress\n               FROM groups_child\n                  INNER JOIN people_names ON pe_lKeyID=gc_lForeignID\n               WHERE {$strGroupWhere}\n                  AND NOT pe_bRetired\n               ORDER BY pe_strLName, pe_strFName, gc_lForeignID;";
             break;
         case CENUM_CONTEXT_CLIENT:
             $this->groupMemLabels->strName = 'Client';
             $this->groupMemLabels->strAddress = 'Location';
             $this->groupMemLabels->strKey = 'client ID';
             $sqlStr = "SELECT\n                  gc_lForeignID AS lKeyID, gc_dteAdded,\n                  CONCAT(cr_strLName, ', ', cr_strFName) AS strName,\n                  cl_strLocation AS strAddress\n               FROM groups_child\n                  INNER JOIN client_records  ON cr_lKeyID      = gc_lForeignID\n                  INNER JOIN client_location ON cr_lLocationID = cl_lKeyID\n               WHERE {$strGroupWhere}\n                  AND NOT cr_bRetired\n               ORDER BY cr_strLName, cr_strFName, gc_lForeignID;";
             break;
         case CENUM_CONTEXT_SPONSORSHIP:
             $this->groupMemLabels->strName = 'Sponsor';
             $this->groupMemLabels->strAddress = 'Address';
             $this->groupMemLabels->strKey = 'sponsor ID';
             $sqlStr = "SELECT\n                  gc_lForeignID AS lKeyID, gc_dteAdded,\n                  CONCAT(pe_strLName, ', ', pe_strFName) AS strName,\n                  CONCAT(pe_strAddr1, '\\n',\n                         pe_strAddr2, '\\n',\n                         pe_strCity,  '\\n',\n                         pe_strState,' ', pe_strZip, ' ', pe_strCountry) AS strAddress\n               FROM groups_child\n                  INNER JOIN sponsor      ON sp_lKeyID     = gc_lForeignID\n                  INNER JOIN people_names ON sp_lForeignID = pe_lKeyID\n               WHERE {$strGroupWhere}\n                  AND NOT pe_bRetired\n                  AND NOT sp_bRetired\n               ORDER BY pe_strLName, pe_strFName, gc_lForeignID;";
             break;
         case CENUM_CONTEXT_STAFF_TS_LOCATIONS:
         case CENUM_CONTEXT_STAFF_TS_PROJECTS:
             $this->groupMemLabels->strName = 'Time Sheet Templates';
             $this->groupMemLabels->strAddress = 'N/A';
             $this->groupMemLabels->strKey = 'template ID';
             $sqlStr = "SELECT\n                  gc_lForeignID AS lKeyID, gc_dteAdded,\n                  ts_strTSName AS strName,\n                  'n/a' AS strAddress\n               FROM groups_child\n                  INNER JOIN staff_timesheets  ON ts_lKeyID = gc_lForeignID\n               WHERE {$strGroupWhere}\n                  AND NOT ts_bRetired\n               ORDER BY ts_strTSName, gc_lForeignID;";
             break;
         case CENUM_CONTEXT_STAFF:
         case CENUM_CONTEXT_USER:
             $this->groupMemLabels->strName = 'User';
             $this->groupMemLabels->strAddress = 'Address';
             $this->groupMemLabels->strKey = 'user ID';
             $sqlStr = "SELECT\n                  gc_lForeignID AS lKeyID, gc_dteAdded,\n                  CONCAT(us_strLastName, ', ', us_strFirstName) AS strName,\n                  CONCAT(us_strAddr1, '\\n',\n                         us_strAddr2, '\\n',\n                         us_strCity,  '\\n',\n                         us_strState,' ', us_strZip, ' ', us_strCountry) AS strAddress\n               FROM groups_child\n                  INNER JOIN admin_users      ON us_lKeyID     = gc_lForeignID\n                  -- INNER JOIN people_names ON sp_lForeignID = pe_lKeyID\n               WHERE {$strGroupWhere}\n                  AND NOT us_bInactive\n               ORDER BY us_strLastName, us_strFirstName, gc_lForeignID;";
             break;
         case CENUM_CONTEXT_VOLUNTEER:
             $this->groupMemLabels->strName = 'Name';
             $this->groupMemLabels->strAddress = 'Address';
             $this->groupMemLabels->strKey = 'vol ID';
             $sqlStr = "SELECT\n                  gc_lForeignID AS lKeyID, gc_dteAdded,\n                  CONCAT(pe_strLName, ', ', pe_strFName) AS strName,\n                  CONCAT(pe_strAddr1, '\\n',\n                         pe_strAddr2, '\\n',\n                         pe_strCity,  '\\n',\n                         pe_strState,' ', pe_strZip, ' ', pe_strCountry) AS strAddress\n               FROM groups_child\n                  INNER JOIN volunteers   ON vol_lKeyID=gc_lForeignID\n                  INNER JOIN people_names ON pe_lKeyID=vol_lPeopleID\n               WHERE {$strGroupWhere}\n                  AND NOT pe_bRetired\n               ORDER BY pe_strLName, pe_strFName, gc_lForeignID;";
             break;
         default:
             screamForHelp($enumGroupType . ': group type not yet available<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__);
             break;
     }
     $query = $this->db->query($sqlStr);
     $this->lCntMembersInGroup = $numRows = $query->num_rows();
     if ($numRows > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->groupMembers[$idx] = new stdClass();
             $this->groupMembers[$idx]->lKeyID = $lKeyID = (int) $row->lKeyID;
             $this->groupMembers[$idx]->dteAdded = dteMySQLDate2Unix($row->gc_dteAdded);
             $this->groupMembers[$idx]->strAddress = str_replace("\n\n", "\n", $row->strAddress);
             $this->groupMembers[$idx]->strName = $strName = trim($row->strName);
             $lNameLenM1 = strlen($strName) - 1;
             if (substr($strName, $lNameLenM1, 1) == ',') {
                 // business sponsorships; remove comma from name
                 $this->groupMembers[$idx]->strName = substr($strName, 0, $lNameLenM1);
             }
             switch ($enumGroupType) {
                 case CENUM_CONTEXT_BIZ:
                     $this->groupMembers[$idx]->strLinkView = strLinkView_BizRecord($lKeyID, 'View business record', true, '');
                     break;
                 case CENUM_CONTEXT_CLIENT:
                     $this->groupMembers[$idx]->strLinkView = strLinkView_ClientRecord($lKeyID, 'View client record', true, '');
                     break;
                 case CENUM_CONTEXT_PEOPLE:
                     $this->groupMembers[$idx]->strLinkView = strLinkView_PeopleRecord($lKeyID, 'View people record', true, '');
                     break;
                 case CENUM_CONTEXT_SPONSORSHIP:
                     $this->groupMembers[$idx]->strLinkView = strLinkView_Sponsorship($lKeyID, 'View sponsorship record', true, '');
                     break;
                 case CENUM_CONTEXT_STAFF_TS_LOCATIONS:
                 case CENUM_CONTEXT_STAFF_TS_PROJECTS:
                     $this->groupMembers[$idx]->strLinkView = strLinkView_TimeSheetTemplateRecord($lKeyID, 'View timesheet template', true);
                     break;
                 case CENUM_CONTEXT_VOLUNTEER:
                     $this->groupMembers[$idx]->strLinkView = strLinkView_Volunteer($lKeyID, 'View volunteer record', true, '');
                     break;
                 case CENUM_CONTEXT_STAFF:
                 case CENUM_CONTEXT_USER:
                     $this->groupMembers[$idx]->strLinkView = strLinkView_User($lKeyID, 'View user record', true, '');
                     break;
                 default:
                     screamForHelp($enumGroupType . ': group type not yet available<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__);
                     break;
             }
             ++$idx;
         }
     }
 }
               Notes
            </td>
         </tr>');
$sngHoursTot = 0.0;
foreach ($nonPVInfo as $nonPVRec) {
    $lVolID = $nonPVRec->lVolID;
    $dHours = $nonPVRec->dHoursWorked;
    if ($dHours == 0) {
        $strHours = '-';
        $strAlign = 'center';
    } else {
        $strHours = number_format($dHours, 2);
        $sngHoursTot += $dHours;
        $strAlign = 'right';
    }
    $dteActivity = dteMySQLDate2Unix($nonPVRec->dteActivity);
    $lActivityID = $nonPVRec->nonPVRecID;
    $strJobCode = $nonPVRec->strJobCode . '';
    if ($strJobCode == '') {
        $strJobCode = '<i>(not set)</i>';
    } else {
        $strJobCode = htmlspecialchars($strJobCode);
    }
    echo '
         <tr class="makeStripe">
            <td class="enpRpt" style="width: 65px; text-align: center;">' . strLinkEdit_VolMgrMiscVolActivity($lActivityID, $lVolID, 'Edit activity', true) . '&nbsp;' . str_pad($lActivityID, 5, '0', STR_PAD_LEFT) . '
            </td>';
    echo '
            <td class="enpRpt" style="width: 25px; text-align: center;">' . strLinkRem_VolUnschedHrs($lVolID, $lActivityID, 'Remove volunteer activity', true, true) . '
            </td>';
    echo '
示例#13
0
 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) . '&nbsp;' . 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 = '&nbsp;';
         } 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) . '&nbsp;' . strLinkView_DepositEntry($lDepositID, 'View deposit entry', true) . '
             </td>
             <td class="enpRpt">' . htmlspecialchars($row->aco_strName) . '&nbsp;' . $row->aco_strCurrencySymbol . '&nbsp;' . $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 loadDocImageGeneric()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->imageDocs = array();
     if ($this->sqlSort . '' == '') {
         $this->sqlSort = ' ORDER BY di_bProfile DESC, di_dteDocImage DESC, di_lKeyID ';
     }
     $sqlStr = "SELECT\n            di_lKeyID, di_enumEntryType, di_enumContextType,\n            di_lForeignID, di_strCaptionTitle, di_strDescription,\n            di_dteDocImage, di_bProfile,\n            di_strUserFN, di_strSystemFN, di_strSystemThumbFN,\n            di_strPath, di_bRetired,\n            di_lOriginID, di_lLastUpdateID,\n            UNIX_TIMESTAMP(di_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(di_dteLastUpdate) AS dteLastUpdate,\n            uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n            ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n         FROM docs_images\n            INNER JOIN admin_users  AS uc ON uc.us_lKeyID=di_lOriginID\n            INNER JOIN admin_users  AS ul ON ul.us_lKeyID=di_lLastUpdateID\n         WHERE NOT di_bRetired {$this->sqlWhereExtra}\n         {$this->sqlSort}\n         {$this->sqlLimit};";
     $query = $this->db->query($sqlStr);
     $this->lNumImageDocs = $lNumRows = $query->num_rows();
     if ($lNumRows == 0) {
         $this->imageDocs[0] = new stdClass();
         $imgDoc =& $this->imageDocs[0];
         $imgDoc->lKeyID = $imgDoc->enumEntryType = $imgDoc->enumContextType = $imgDoc->lForeignID = $imgDoc->strCaptionTitle = $imgDoc->strDescription = $imgDoc->dteDocImage = $imgDoc->dteMysqlDocImage = $imgDoc->bProfile = $imgDoc->strUserFN = $imgDoc->strSystemFN = $imgDoc->strSystemThumbFN = $imgDoc->strPath = $imgDoc->bRetired = $imgDoc->lOriginID = $imgDoc->lLastUpdateID = $imgDoc->dteOrigin = $imgDoc->LastUpdate = $imgDoc->strUCFName = $imgDoc->strUCLName = $imgDoc->strULFName = $imgDoc->strULLName = $imgDoc->imageSize = $imgDoc->sngAspectRatio = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->imageDocs[$idx] = new stdClass();
             $imgDoc =& $this->imageDocs[$idx];
             $imgDoc->lKeyID = (int) $row->di_lKeyID;
             $imgDoc->enumEntryType = $row->di_enumEntryType;
             $imgDoc->enumContextType = $enumContextType = $row->di_enumContextType;
             $imgDoc->lForeignID = $lFID = (int) $row->di_lForeignID;
             $imgDoc->strCaptionTitle = $row->di_strCaptionTitle;
             $imgDoc->strDescription = $row->di_strDescription;
             $imgDoc->dteDocImage = dteMySQLDate2Unix($row->di_dteDocImage);
             $imgDoc->dteMysqlDocImage = $row->di_dteDocImage;
             $imgDoc->bProfile = $row->di_bProfile;
             $imgDoc->strUserFN = $row->di_strUserFN;
             $imgDoc->strSystemFN = $row->di_strSystemFN;
             $imgDoc->strSystemThumbFN = $strThumbFN = $row->di_strSystemThumbFN;
             $imgDoc->strPath = $strPath = $row->di_strPath;
             $imgDoc->bRetired = (bool) $row->di_bRetired;
             $imgDoc->lOriginID = (int) $row->di_lOriginID;
             $imgDoc->lLastUpdateID = (int) $row->di_lLastUpdateID;
             $imgDoc->dteOrigin = (int) $row->dteOrigin;
             $imgDoc->LastUpdate = (int) $row->dteLastUpdate;
             $imgDoc->strUCFName = $row->strUCFName;
             $imgDoc->strUCLName = $row->strUCLName;
             $imgDoc->strULFName = $row->strULFName;
             $imgDoc->strULLName = $row->strULLName;
             if ($this->bLoadContext) {
                 $this->loadNameViaContextFID($imgDoc, $enumContextType, $lFID);
             }
             if ($imgDoc->enumEntryType == CENUM_IMGDOC_ENTRY_IMAGE) {
                 $imgDoc->imageSize = @getimagesize($strPath . '/' . $strThumbFN);
                 if (is_null($imgDoc->imageSize) || $imgDoc->imageSize === false) {
                     $imgDoc->sngAspectRatio = null;
                 } else {
                     $imgDoc->sngAspectRatio = $imgDoc->imageSize[0] / $imgDoc->imageSize[1];
                 }
             } else {
                 $imgDoc->imageSize = null;
                 $imgDoc->sngAspectRatio = null;
             }
             ++$idx;
         }
     }
 }
 public function loadClientXfersViaClientID($lClientID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $sqlStr = "SELECT\n            cx_lKeyID, cx_lClientID,\n            cx_lOldLocID, cx_lOldStatCatID, cx_lOldVocID,\n            cx_lNewLocID, cx_lNewStatCatID, cx_lNewVocID,\n            cx_lLastUpdateID,\n            cl_dteEffectiveDate,\n            UNIX_TIMESTAMP(cx_dteLastUpdate) AS dteLastUpdate,\n\n            oldStatCat.csc_strCatName AS statCatOld,\n            newStatCat.csc_strCatName AS statCatNew,\n\n            oldLoc.cl_strLocation AS locOld,\n            newLoc.cl_strLocation AS locNew,\n\n            oldVoc.cv_strVocTitle AS vocOld,\n            newVoc.cv_strVocTitle AS vocNew\n         FROM client_xfers\n            INNER JOIN client_status_cats AS oldStatCat ON oldStatCat.csc_lKeyID=cx_lOldStatCatID\n            INNER JOIN client_status_cats AS newStatCat ON newStatCat.csc_lKeyID=cx_lNewStatCatID\n\n            INNER JOIN client_location AS oldLoc ON oldLoc.cl_lKeyID=cx_lOldLocID\n            INNER JOIN client_location AS newLoc ON newLoc.cl_lKeyID=cx_lNewLocID\n\n            INNER JOIN lists_client_vocab AS oldVoc ON oldVoc.cv_lKeyID=cx_lOldVocID\n            INNER JOIN lists_client_vocab AS newVoc ON newVoc.cv_lKeyID=cx_lNewVocID\n         WHERE cx_lClientID={$lClientID}\n         ORDER BY cl_dteEffectiveDate, cx_lKeyID;";
     $query = $this->db->query($sqlStr);
     $this->lNumClientXfers = $lNumRows = $query->num_rows();
     $this->clientXfers = array();
     $idx = 0;
     foreach ($query->result() as $row) {
         $this->clientXfers[$idx] = new stdClass();
         $cx =& $this->clientXfers[$idx];
         $cx->lKeyID = (int) $row->cx_lKeyID;
         $cx->lClientID = (int) $row->cx_lClientID;
         $cx->lOldLocID = $row->cx_lOldLocID;
         $cx->lOldStatCatID = $row->cx_lOldStatCatID;
         $cx->lOldVocID = $row->cx_lOldVocID;
         $cx->lNewLocID = $row->cx_lNewLocID;
         $cx->lNewStatCatID = $row->cx_lNewStatCatID;
         $cx->lNewVocID = $row->cx_lNewVocID;
         $cx->lLastUpdateID = $row->cx_lLastUpdateID;
         $cx->dteEffective = dteMySQLDate2Unix($row->cl_dteEffectiveDate);
         $cx->dteLastUpdate = $row->dteLastUpdate;
         $cx->statCatOld = $row->statCatOld;
         $cx->statCatNew = $row->statCatNew;
         $cx->locOld = $row->locOld;
         $cx->locNew = $row->locNew;
         $cx->vocOld = $row->vocOld;
         $cx->vocNew = $row->vocNew;
         ++$idx;
     }
 }
示例#16
0
 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;
         }
     }
 }
 public function packetStatusInfo($lClientID)
 {
     //---------------------------------------------------------------------
     // if packet status not selected, return most recent status
     //---------------------------------------------------------------------
     $sqlStr = "SELECT\n            csh_lKeyID, csh_strStatusTxt, csh_dteStatusDate\n         FROM client_status\n         WHERE\n            NOT csh_bRetired\n            AND csh_lClientID={$lClientID}\n         ORDER BY csh_bIncludeNotesInPacket DESC, csh_dteStatusDate DESC\n         LIMIT 0,1;";
     $query = $this->db->query($sqlStr);
     if ($query->num_rows() == 0) {
         return null;
     }
     $row = $query->row();
     $packetStatus = new stdClass();
     $packetStatus->clientID = $lClientID;
     $packetStatus->statusID = $row->csh_lKeyID;
     $packetStatus->strStatusTxt = $row->csh_strStatusTxt;
     $packetStatus->dteStatus = dteMySQLDate2Unix($row->csh_dteStatusDate);
     return $packetStatus;
 }
 function loadMeasurements()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glclsDTDateFormat;
     $this->measurements = array();
     if ($this->strOrder == '') {
         $strOrder = ' meas_lClientID, dteMeasurement DESC ';
     } else {
         $strOrder = $this->strOrder;
     }
     $sqlStr = "SELECT\n            meas_lKeyID, meas_lClientID,\n            meas_dteMeasurement,\n            meas_sngHeadCircCM, meas_sngWeightKilos, meas_sngHeightCM,\n            meas_strNotes,\n\n            cr_strFName, cr_strMName, cr_strLName, cr_dteEnrollment,\n            cr_dteBirth, cr_enumGender,\n\n            cr_lLocationID, cl_strLocation, cl_strCountry,\n\n            meas_lOriginID, meas_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(meas_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(meas_dteLastUpdate) AS dteLastUpdate\n\n         FROM emr_measurements\n            INNER JOIN admin_users AS usersC   ON meas_lOriginID     = usersC.us_lKeyID\n            INNER JOIN admin_users AS usersL   ON meas_lLastUpdateID = usersL.us_lKeyID\n\n            INNER JOIN client_records   ON meas_lClientID = cr_lKeyID\n            INNER JOIN client_location  ON cr_lLocationID = cl_lKeyID\n\n         WHERE NOT meas_bRetired {$this->strWhereExtra}\n         ORDER BY {$strOrder};";
     $query = $this->db->query($sqlStr);
     $this->lNumMeasure = $lNumMeasure = $query->num_rows();
     if ($lNumMeasure == 0) {
         $this->measurements[0] = new stdClass();
         $measure =& $this->measurements[0];
         $measure->lClientID = $measure->dteMeasurement = $measure->mySQLDateMeasure = $measure->sngHeadCircCM = $measure->sngHeightCM = $measure->sngWeightKilos = $measure->lHeadCircIn = $measure->lHeightIn = $measure->lWeightLBS = $measure->lHeightFt = $measure->lHeightFtIn = $measure->strFName = $measure->strMName = $measure->strLName = $measure->strSafeName = $measure->strSafeNameLF = $measure->dteEnrollment = $measure->dteBirth = $measure->enumGender = $measure->lLocationID = $measure->strLocation = $measure->strLocCountry = null;
         //------------------------------
         // client age/birth day info
         //------------------------------
         $measure->objClientBirth = $measure->strClientAgeBDay = $measure->strNotes = $measure->meas_lOriginID = $measure->meas_lLastUpdateID = $measure->strCFName = $measure->strCLName = $measure->strLFName = $measure->strLLName = $measure->dteOrigin = $measure->dteLastUpdate = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->measurements[$idx] = new stdClass();
             $measure =& $this->measurements[$idx];
             $measure->lKeyID = $row->meas_lKeyID;
             $measure->lClientID = $row->meas_lClientID;
             $measure->dteMeasurement = dteMySQLDate2Unix($row->meas_dteMeasurement);
             $measure->mySQLDateMeasure = $row->meas_dteMeasurement;
             // measurements
             $measure->sngHeadCircCM = $row->meas_sngHeadCircCM;
             $measure->sngHeightCM = $row->meas_sngHeightCM;
             $measure->sngHeightM = $row->meas_sngHeightCM / 100.0;
             $measure->sngWeightKilos = $row->meas_sngWeightKilos;
             $measure->sngBMI = $row->meas_sngWeightKilos / pow($measure->sngHeightM, 2);
             if (is_null($measure->sngHeadCircCM)) {
                 $measure->sngHeadCircIn = null;
             } else {
                 $measure->sngHeadCircIn = round($measure->sngHeadCircCM * CSNG_CM_TO_INCHES, 1);
             }
             if (is_null($measure->sngHeightCM)) {
                 $measure->sngHeightIn = $measure->lHeightFt = $measure->lHeightFtIn = null;
             } else {
                 $measure->sngHeightIn = round($measure->sngHeightCM * CSNG_CM_TO_INCHES, 1);
                 $measure->lHeightFt = (int) ($measure->sngHeightIn / 12);
                 $measure->lHeightFtIn = (int) ($measure->sngHeightIn - $measure->lHeightFt * 12);
             }
             if (is_null($measure->sngWeightKilos)) {
                 $measure->sngWeightLBS = null;
             } else {
                 $measure->sngWeightLBS = round($measure->sngWeightKilos * CSNG_KILOS_TO_LBS, 1);
             }
             // client info
             $measure->strFName = $row->cr_strFName;
             $measure->strMName = $row->cr_strMName;
             $measure->strLName = $row->cr_strLName;
             $measure->strSafeName = htmlspecialchars($row->cr_strFName . ' ' . $row->cr_strLName);
             $measure->strSafeNameLF = htmlspecialchars($row->cr_strLName . ', ' . $row->cr_strFName);
             $measure->dteEnrollment = dteMySQLDate2Unix($row->cr_dteEnrollment);
             $measure->dteBirth = $mySQLdteBirth = $row->cr_dteBirth;
             $measure->enumGender = $row->cr_enumGender;
             $measure->lLocationID = $row->cr_lLocationID;
             $measure->strLocation = $row->cl_strLocation;
             $measure->strLocCountry = $row->cl_strCountry;
             //------------------------------
             // client age/birth day info
             //------------------------------
             if (is_null($mySQLdteBirth)) {
                 $measure->objClientBirth = null;
                 $measure->lAgeYears = null;
                 $measure->strClientAgeBDay = 'n/a';
             } else {
                 $measure->objClientBirth = new dl_date_time();
                 $measure->objClientBirth->setDateViaMySQL(0, $mySQLdteBirth);
                 $measure->strClientAgeBDay = $measure->objClientBirth->strPeopleAge(0, $mySQLdteBirth, $measure->lAgeYears, $glclsDTDateFormat);
             }
             $measure->strNotes = $row->meas_strNotes;
             $measure->meas_lOriginID = $row->meas_lOriginID;
             $measure->meas_lLastUpdateID = $row->meas_lLastUpdateID;
             $measure->strCFName = $row->strCFName;
             $measure->strCLName = $row->strCLName;
             $measure->strLFName = $row->strLFName;
             $measure->strLLName = $row->strLLName;
             $measure->dteOrigin = $row->dteOrigin;
             $measure->dteLastUpdate = $row->dteLastUpdate;
             ++$idx;
         }
     }
 }
 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 loadClientTests(&$lNumTests, &$testInfo)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     if ($this->sqlClientTestsOrder == '') {
         $strOrder = ' cptl_dtePreTest, cptl_lKeyID ';
     } else {
         $strOrder = $this->sqlClientTestsOrder;
     }
     $sqlStr = "SELECT\n            cptl_lKeyID, cptl_lPrePostID, cptl_lClientID,\n            cptl_dtePreTest, cptl_dtePostTest,\n\n            cptl_lOriginID, cptl_lLastUpdateID,\n            UNIX_TIMESTAMP(cptl_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(cptl_dteLastUpdate) AS dteLastUpdate,\n            uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n            ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n         FROM cpp_test_log\n            INNER JOIN admin_users AS uc ON uc.us_lKeyID=cptl_lOriginID\n            INNER JOIN admin_users AS ul ON ul.us_lKeyID=cptl_lLastUpdateID\n\n         WHERE NOT cptl_bRetired {$this->sqlClientTestsWhere}\n         ORDER BY {$strOrder};";
     $query = $this->db->query($sqlStr);
     $lNumTests = $numRows = $query->num_rows();
     $testInfo = array();
     if ($numRows == 0) {
         $testInfo[0] = new stdClass();
         $testTaken =& $testInfo[0];
         $testTaken->lKeyID = $testTaken->lPrePostID = $testTaken->lClientID = $testTaken->dtePreTest = $testTaken->dtePostTest = $testTaken->lOriginID = $testTaken->lLastUpdateID = $testTaken->dteOrigin = $testTaken->dteLastUpdate = $testTaken->strUCFName = $testTaken->strUCLName = $testTaken->strULFName = $testTaken->strULLName = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $testInfo[$idx] = new stdClass();
             $testTaken =& $testInfo[$idx];
             $testTaken->lKeyID = $lTestLogID = (int) $row->cptl_lKeyID;
             $testTaken->lPrePostID = (int) $row->cptl_lPrePostID;
             $testTaken->lClientID = (int) $row->cptl_lClientID;
             $testTaken->dtePreTest = dteMySQLDate2Unix($row->cptl_dtePreTest);
             $testTaken->dtePostTest = dteMySQLDate2Unix($row->cptl_dtePostTest);
             $this->clientScoreSummaryViaTestTaken($lTestLogID, true, $testTaken->lNumRightPre, $testTaken->lNumWrongPre);
             $this->clientScoreSummaryViaTestTaken($lTestLogID, false, $testTaken->lNumRightPost, $testTaken->lNumWrongPost);
             $testTaken->lOriginID = (int) $row->cptl_lOriginID;
             $testTaken->lLastUpdateID = (int) $row->cptl_lLastUpdateID;
             $testTaken->dteOrigin = (int) $row->dteOrigin;
             $testTaken->dteLastUpdate = (int) $row->dteLastUpdate;
             $testTaken->strUCFName = $row->strUCFName;
             $testTaken->strUCLName = $row->strUCLName;
             $testTaken->strULFName = $row->strULFName;
             $testTaken->strULLName = $row->strULLName;
             ++$idx;
         }
     }
 }
 function loadItemHistory($lIItemID, &$lNumHRecs, &$histRecs)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $histRecs = array();
     $sqlStr = "SELECT\n            ih_lKeyID, ih_lItemID, ih_lCICOID, lh_enumOperation, ih_lOriginID,\n            ih_dteLastUpdate,\n            uc.us_strFirstName AS strCFName,\n            uc.us_strLastName  AS strCLName\n         FROM inv_history\n               INNER JOIN admin_users  AS uc    ON uc.us_lKeyID = ih_lOriginID\n         WHERE ih_lItemID={$lIItemID}\n         ORDER BY ih_lKeyID;";
     $query = $this->db->query($sqlStr);
     $lNumHRecs = $query->num_rows();
     if ($lNumHRecs > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $histRecs[$idx] = new stdClass();
             $histRec =& $histRecs[$idx];
             $histRec->lKeyID = (int) $row->ih_lKeyID;
             $histRec->lItemID = (int) $row->ih_lItemID;
             $histRec->lCICOID = $row->ih_lCICOID;
             $histRec->enumOperation = $row->lh_enumOperation;
             $histRec->lOriginID = (int) $row->ih_lOriginID;
             $histRec->dteAction = dteMySQLDate2Unix($row->ih_dteLastUpdate);
             $histRec->strCFName = $row->strCFName;
             $histRec->strCLName = $row->strCLName;
             ++$idx;
         }
     }
 }
 private function loadEventsGeneric($strWhere)
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     $clsEventDates = new mvol_event_dates();
     $clsEventDates->updateStartStopDates();
     $sqlStr = "SELECT\n            vem_lKeyID, vem_strEventName, vem_strDescription,\n            vem_strLocation, vem_strContact, vem_strPhone, vem_strEmail,\n            vem_strWebSite, vem_bRetired,\n            vem_lOriginID, vem_lLastUpdateID,\n            vem_dteEventStartDate, vem_dteEventEndDate,\n\n            UNIX_TIMESTAMP(vem_dteOrigin) AS dteOrigin,\n            UNIX_TIMESTAMP(vem_dteLastUpdate) AS dteLastUpdate,\n\n            uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n            ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n         FROM vol_events\n            INNER JOIN admin_users   AS uc ON uc.us_lKeyID=vem_lOriginID\n            INNER JOIN admin_users   AS ul ON ul.us_lKeyID=vem_lLastUpdateID\n\n         WHERE\n            NOT vem_bRetired\n            {$strWhere}\n         ORDER BY vem_dteEventStartDate, vem_strEventName, vem_lKeyID;";
     $query = $this->db->query($sqlStr);
     $this->lNumEvents = $numRows = $query->num_rows();
     $this->events = array();
     if ($numRows == 0) {
         $this->events[0] = new stdClass();
         $this->events[0]->lKeyID = $this->events[0]->strEventName = $this->events[0]->strDescription = $this->events[0]->strLocation = $this->events[0]->strContact = $this->events[0]->strPhone = $this->events[0]->strEmail = $this->events[0]->strWebSite = $this->events[0]->bRetired = $this->events[0]->lOriginID = $this->events[0]->lLastUpdateID = $this->events[0]->dteEventStart = $this->events[0]->dteEventEnd = $this->events[0]->dteOrigin = $this->events[0]->dteLastUpdate = $this->events[0]->strUCFName = $this->events[0]->strUCLName = $this->events[0]->strULFName = $this->events[0]->strULLName = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->events[$idx] = new stdClass();
             $this->events[$idx]->lKeyID = (int) $row->vem_lKeyID;
             $this->events[$idx]->strEventName = $row->vem_strEventName;
             $this->events[$idx]->strDescription = $row->vem_strDescription;
             $this->events[$idx]->strLocation = $row->vem_strLocation;
             $this->events[$idx]->strContact = $row->vem_strContact;
             $this->events[$idx]->strPhone = $row->vem_strPhone;
             $this->events[$idx]->strEmail = $row->vem_strEmail;
             $this->events[$idx]->strWebSite = $row->vem_strWebSite;
             $this->events[$idx]->bRetired = (bool) $row->vem_bRetired;
             $this->events[$idx]->lOriginID = $row->vem_lOriginID;
             $this->events[$idx]->lLastUpdateID = $row->vem_lLastUpdateID;
             $this->events[$idx]->dteEventStart = dteMySQLDate2Unix($row->vem_dteEventStartDate);
             $this->events[$idx]->dteEventEnd = dteMySQLDate2Unix($row->vem_dteEventEndDate);
             $this->events[$idx]->dteOrigin = $row->dteOrigin;
             $this->events[$idx]->dteLastUpdate = $row->dteLastUpdate;
             $this->events[$idx]->strUCFName = $row->strUCFName;
             $this->events[$idx]->strUCLName = $row->strUCLName;
             $this->events[$idx]->strULFName = $row->strULFName;
             $this->events[$idx]->strULLName = $row->strULLName;
             ++$idx;
         }
     }
 }
示例#23
0
 public function loadSponsorshipInfo($lClientID, $bOrderStartDate, &$lNumSponsors, &$sponsors)
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     $strOrder = $bOrderStartDate ? ' sp_dteStartMoYr, ' : '';
     $sqlStr = "SELECT\n            sp_lKeyID, sp_lForeignID, sp_curCommitment,\n            sp_bInactive, sp_lInactiveCatID,\n            sp_lOriginID, sp_lLastUpdateID,\n            sp_dteStartMoYr,\n            MONTH(sp_dteStartMoYr)           AS lMonthStart,\n            YEAR(sp_dteStartMoYr)            AS lYearStart,\n            sp_dteInactive,\n            UNIX_TIMESTAMP(sp_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(sp_dteLastUpdate) AS dteLastUpdate,\n\n            pe_strFName, pe_strLName, pe_enumGender, pe_bBiz\n\n         FROM sponsor\n            INNER JOIN people_names ON pe_lKeyID=sp_lForeignID\n         WHERE\n            NOT sp_bRetired\n            AND sp_lClientID={$lClientID}\n         ORDER BY {$strOrder} pe_strLName, pe_strFName, sp_lKeyID;";
     $query = $this->db->query($sqlStr);
     $lNumSponsors = $query->num_rows();
     $sponsors = array();
     if ($lNumSponsors > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $sponsors[$idx] = new stdClass();
             $sp =& $sponsors[$idx];
             $sp->lKeyID = (int) $row->sp_lKeyID;
             $sp->lPersonID = (int) $row->sp_lForeignID;
             $sp->curCommitment = (double) $row->sp_curCommitment;
             $sp->bInactive = (bool) $row->sp_bInactive;
             $sp->lInactiveCatID = $row->sp_lInactiveCatID;
             $sp->lOriginID = (int) $row->sp_lOriginID;
             $sp->lLastUpdateID = (int) $row->sp_lLastUpdateID;
             $sp->dteStartMoYr = dteMySQLDate2Unix($row->sp_dteStartMoYr);
             $sp->lMonthStart = (int) $row->lMonthStart;
             $sp->lYearStart = (int) $row->lYearStart;
             $sp->dteInactive = dteMySQLDate2Unix($row->sp_dteInactive);
             $sp->dteOrigin = (int) $row->dteOrigin;
             $sp->dteLastUpdate = (int) $row->dteLastUpdate;
             $sp->bBiz = (bool) $row->pe_bBiz;
             $sp->strFName = $row->pe_strFName;
             $sp->strLName = $row->pe_strLName;
             if ($sp->bBiz) {
                 $sp->strSafeNameFL = htmlspecialchars($row->pe_strLName);
             } else {
                 $sp->strSafeNameFL = htmlspecialchars($row->pe_strFName . ' ' . $row->pe_strLName);
             }
             $sp->enumGender = $row->pe_enumGender;
             ++$idx;
         }
     }
 }
 public function loadShiftsViaVolIDMonth($lMonth, $lYear, $lVolID, &$lNumShifts, &$shifts)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gdteNow;
     $lNumShifts = 0;
     $shifts = array();
     $sqlStr = "SELECT\r\n            vsa_lKeyID, vsa_lEventDateShiftID, vsa_lVolID, vsa_strNotes,\r\n\r\n            vs_lKeyID, vs_lEventDateID, vs_strShiftName, vs_strDescription,\r\n            TIME_FORMAT(vs_dteShiftStartTime, '%l:%i %p') AS dteShiftStartTime, vs_enumDuration,\r\n\r\n            DATE(ved_dteEvent)=DATE(NOW()) AS bToday,\r\n            DATE(ved_dteEvent)>DATE(NOW()) AS bFuture,\r\n            DATE(ved_dteEvent)<DATE(NOW()) AS bPast,\r\n\r\n            ved_lKeyID, ved_lVolEventID, ved_dteEvent,\r\n            vem_lKeyID, vem_strEventName, vem_strDescription\r\n         FROM vol_events_dates_shifts_assign\r\n            INNER JOIN  vol_events_dates_shifts ON vsa_lEventDateShiftID = vs_lKeyID\r\n            INNER JOIN  vol_events_dates        ON vs_lEventDateID       = ved_lKeyID\r\n            INNER JOIN  vol_events              ON ved_lVolEventID       = vem_lKeyID\r\n         WHERE NOT vsa_bRetired\r\n            AND NOT vs_bRetired\r\n            AND NOT vem_bRetired\r\n            AND vsa_lVolID          = {$lVolID}\r\n            AND MONTH(ved_dteEvent) = {$lMonth}\r\n            AND YEAR(ved_dteEvent)  = {$lYear}\r\n         ORDER BY ved_dteEvent, vem_strEventName, vs_dteShiftStartTime, vsa_lKeyID;";
     $query = $this->db->query($sqlStr);
     $lNumShifts = $query->num_rows();
     if ($lNumShifts > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $shifts[$idx] = new stdClass();
             $shift =& $shifts[$idx];
             $shift->lAssignKeyID = $row->vsa_lKeyID;
             $shift->lEventDateShiftID = $row->vsa_lEventDateShiftID;
             $shift->lVolID = $row->vsa_lVolID;
             $shift->strNotes = $row->vsa_strNotes;
             $shift->lEventDateID = $row->vs_lEventDateID;
             $shift->strShiftName = $row->vs_strShiftName;
             $shift->strShiftDescription = $row->vs_strDescription;
             $shift->dteShiftStartTime = $row->dteShiftStartTime;
             $shift->enumDuration = $row->vs_enumDuration;
             $shift->lVolEventID = $row->ved_lVolEventID;
             $shift->mdteEvent = $row->ved_dteEvent;
             $shift->dteEvent = dteMySQLDate2Unix($row->ved_dteEvent);
             $shift->strEventName = $row->vem_strEventName;
             $shift->strEventDescription = $row->vem_strDescription;
             $shift->bToday = $row->bToday;
             $shift->bFuture = $row->bFuture;
             $shift->bPast = $row->bPast;
             ++$idx;
         }
     }
 }
示例#25
0
 function dteMostRecentLogin($lUserID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $sqlStr = "SELECT el_dteLogDate\n         FROM admin_usage_log\n         WHERE el_lUserID={$lUserID}\n            AND el_bLoginSuccessful\n         ORDER BY el_dteLogDate DESC\n         LIMIT 0,1;";
     $query = $this->db->query($sqlStr);
     $numRows = $query->num_rows();
     if ($numRows == 0) {
         return null;
     } else {
         $row = $query->row();
         return dteMySQLDate2Unix($row->el_dteLogDate);
     }
 }
示例#26
0
    public function loadPatientsGeneric()
    {
        //-----------------------------------------------------------------------
        //
        //-----------------------------------------------------------------------
        global $glclsDTDateFormat, $gstrPassPhrase;
        $strOrder = $this->strClientOrder;
        if ($strOrder == '') {
            $strOrder = ' 
              AES_DECRYPT(cr_strLName, SHA2(' . strPrepStr($gstrPassPhrase) . ',256)), 
              AES_DECRYPT(cr_strFName, SHA2(' . strPrepStr($gstrPassPhrase) . ',256)), 
              AES_DECRYPT(cr_strMName, SHA2(' . strPrepStr($gstrPassPhrase) . ',256)), 
              cr_lKeyID ';
        }
        $sqlStr = 'SELECT
               cr_lKeyID,
               cr_bActive, cr_dteInactive, cr_dteEnrollment,
               cr_enumGender,

               AES_DECRYPT(cr_dteBirth,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS dteBirth,
               AES_DECRYPT(cr_dteDeath,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS dteDeath,
               AES_DECRYPT(cr_strTitle,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strTitle,
               AES_DECRYPT(cr_strFName,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strFName,
               AES_DECRYPT(cr_strMName,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strMName,
               AES_DECRYPT(cr_strLName,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strLName,
               AES_DECRYPT(cr_strAddr1,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strAddr1,
               AES_DECRYPT(cr_strAddr2,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strAddr2,
               AES_DECRYPT(cr_strCity,      SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strCity,
               AES_DECRYPT(cr_strState,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strState,
               AES_DECRYPT(cr_strCountry,   SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strCountry,
               AES_DECRYPT(cr_strZip,       SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strZip,
               AES_DECRYPT(cr_strPhone,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strPhone,
               AES_DECRYPT(cr_strCell,      SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strCell,
               AES_DECRYPT(cr_strEmail,     SHA2(' . strPrepStr($gstrPassPhrase) . ',256)) AS strEmail,
               AES_DECRYPT(cr_strBio,       SHA2(' . strPrepStr($gstrPassPhrase) . ",256)) AS strBio,\n\n               cr_bRetired, cr_lOriginID, cr_lLastUpdateID,\n               UNIX_TIMESTAMP(cr_dteOrigin)     AS dteOrigin,\n               UNIX_TIMESTAMP(cr_dteLastUpdate) AS dteLastUpdate,\n\n               uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n               ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n            FROM patient_records\n               {$this->strInnerExtra}\n\n               INNER JOIN admin_users  AS uc ON uc.us_lKeyID=cr_lOriginID\n               INNER JOIN admin_users  AS ul ON ul.us_lKeyID=cr_lLastUpdateID\n\n            WHERE 1\n               AND NOT cr_bRetired\n\n               {$this->strExtraClientWhere}\n            ORDER BY {$strOrder}\n            {$this->strClientLimit};";
        $query = $this->db->query($sqlStr);
        $this->lNumPatients = $numRows = $query->num_rows();
        $this->patients = array();
        if ($numRows == 0) {
            $this->patients[0] = new stdClass();
            $patient =& $this->patients[0];
            $patient->lKeyID = $patient->strTitle = $patient->strFName = $patient->strMName = $patient->strLName = $patient->dteEnrollment = $patient->dteBirth = $patient->dteDeath = $patient->enumGender = $patient->strBio = $patient->bRetired = $patient->lOriginID = $patient->lLastUpdateID = $patient->dteOrigin = $patient->dteLastUpdate = $patient->strAddr1 = $patient->strAddr2 = $patient->strCity = $patient->strState = $patient->strCountry = $patient->strZip = $patient->strPhone = $patient->strCell = $patient->strEmail = $patient->strAddress = null;
        } else {
            $idx = 0;
            foreach ($query->result() as $row) {
                $this->patients[$idx] = new stdClass();
                $patient =& $this->patients[$idx];
                $patient->lKeyID = (int) $row->cr_lKeyID;
                $patient->strTitle = $row->strTitle;
                $patient->strFName = $row->strFName;
                $patient->strMName = $row->strMName;
                $patient->strLName = $row->strLName;
                $patient->strSafeName = htmlspecialchars($row->strFName . ' ' . $row->strMName . ' ' . $row->strLName);
                $patient->strSafeNameLF = htmlspecialchars($row->strLName . ', ' . $row->strFName . ' ' . $row->strMName);
                $patient->dteEnrollment = dteMySQLDate2Unix($row->cr_dteEnrollment);
                $patient->dteBirth = $mySQLdteBirth = $row->dteBirth;
                $patient->dteDeath = $row->dteDeath;
                $patient->enumGender = $row->cr_enumGender;
                $patient->bActive = (bool) $row->cr_bActive;
                $patient->mdteInactive = $row->cr_dteInactive;
                //------------------------------
                // client address/contact
                //------------------------------
                $patient->strAddr1 = $row->strAddr1;
                $patient->strAddr2 = $row->strAddr2;
                $patient->strCity = $row->strCity;
                $patient->strState = $row->strState;
                $patient->strCountry = $row->strCountry;
                $patient->strZip = $row->strZip;
                $patient->strPhone = $row->strPhone;
                $patient->strCell = $row->strCell;
                $patient->strEmail = $row->strEmail;
                $patient->strEmailFormatted = strBuildEmailLink($patient->strEmail, '', false, '');
                $patient->strAddress = strBuildAddress($patient->strAddr1, $patient->strAddr2, $patient->strCity, $patient->strState, $patient->strCountry, $patient->strZip, true);
                /*
                               //------------------------------
                               // client age/birth day info
                               //------------------------------
                            if (is_null($mySQLdteBirth)){
                               $patient->objClientBirth = null;
                               $patient->lAgeYears      = null;
                               $patient->strClientAgeBDay = '(age n/a)';
                            }else {
                               $patient->objClientBirth = new dl_date_time;
                               $patient->objClientBirth->setDateViaMySQL(0, $mySQLdteBirth);
                               $patient->strClientAgeBDay =
                                          $patient->objClientBirth->strPeopleAge(0, $mySQLdteBirth,
                                               $patient->lAgeYears, $glclsDTDateFormat);
                            }
                */
                $patient->strBio = $row->strBio;
                $patient->bRetired = $row->cr_bRetired;
                $patient->lOriginID = $row->cr_lOriginID;
                $patient->lLastUpdateID = $row->cr_lLastUpdateID;
                $patient->dteOrigin = $row->dteOrigin;
                $patient->dteLastUpdate = $row->dteLastUpdate;
                $patient->ucstrFName = $row->strUCFName;
                $patient->ucstrLName = $row->strUCLName;
                $patient->ulstrFName = $row->strULFName;
                $patient->ulstrLName = $row->strULLName;
                ++$idx;
            }
        }
        if ($this->bDebug) {
            $this->dumpClientRecs();
        }
    }
 public function eventsByMonth($lMonth, $lYear, &$monthEvent, $opts = null)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $monthEvent = new stdClass();
     $monthEvent->lMonth = $lMonth;
     $monthEvent->lYear = $lYear;
     $monthEvent->dates = array();
     $strOrder = ' ved_dteEvent, vem_strEventName, vem_lKeyID ';
     if (isset($opts->bOrderViaEvent)) {
         if ($opts->bOrderViaEvent) {
             $strOrder = ' vem_strEventName, vem_lKeyID, ved_dteEvent, vem_lKeyID ';
         }
     }
     $sqlStr = "SELECT\n            ved_lKeyID, ved_lVolEventID, ved_dteEvent,\n            vem_strEventName\n         FROM vol_events_dates\n            INNER JOIN vol_events ON ved_lVolEventID=vem_lKeyID\n\n         WHERE MONTH(ved_dteEvent) = {$lMonth}\n            AND YEAR(ved_dteEvent) = {$lYear}\n            AND NOT vem_bRetired\n         ORDER BY {$strOrder};";
     $query = $this->db->query($sqlStr);
     $monthEvent->lNumDates = $lNumDates = $query->num_rows();
     if ($lNumDates > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $monthEvent->dates[$idx] = new stdClass();
             $monthEvent->dates[$idx]->lDateKeyID = $lDateID = $row->ved_lKeyID;
             $monthEvent->dates[$idx]->lVolEventID = $row->ved_lVolEventID;
             $monthEvent->dates[$idx]->dteEvent = dteMySQLDate2Unix($row->ved_dteEvent);
             $monthEvent->dates[$idx]->strEventName = $row->vem_strEventName;
             $monthEvent->dates[$idx]->shifts = array();
             $this->shiftsByDateID($lDateID, $monthEvent->dates[$idx]->shifts, $monthEvent->dates[$idx]->lNumShifts);
             ++$idx;
         }
     }
 }
 function loadMRRecs($bCProg = false, $bEnrollment = false)
 {
     //---------------------------------------------------------------------
     //  sets the following:
     //    $this->lNumMRRecs  - number of loaded records
     //    $this->mrRecs      - array of data records
     //---------------------------------------------------------------------
     $utable =& $this->userTables[0];
     $lTableID = $utable->lKeyID;
     $bMultiEntry = $utable->bMultiEntry;
     $strFNPrefix = $utable->strFieldPrefix;
     $strFNKeyID = $strFNPrefix . '_lKeyID';
     $strFNFID = $strFNPrefix . '_lForeignKey';
     if ($this->mrSQLOrder == '') {
         if ($bCProg) {
             if ($bEnrollment) {
                 $strOrder = 'ORDER BY ' . $strFNPrefix . '_dteStart, ' . $strFNKeyID . ' ';
             } else {
                 $strOrder = 'ORDER BY ' . $strFNPrefix . '_dteAttendance, ' . $strFNKeyID . ' ';
             }
         } else {
             $strOrder = 'ORDER BY ' . $strFNKeyID . ' DESC';
         }
     } else {
         $strOrder = 'ORDER BY ' . $this->mrSQLOrder;
     }
     $strSelectExtra = '';
     if ($bCProg) {
         $strSelectExtra .= ', ';
         if ($bEnrollment) {
             $strSelectExtra .= $strFNPrefix . '_dteStart                   AS dteMysqlStart,
                 ' . $strFNPrefix . '_dteEnd                     AS dteMysqlEnd,
                 ' . $strFNPrefix . '_bCurrentlyEnrolled         AS bCurrentlyEnrolled ';
         } else {
             $strSelectExtra .= $strFNPrefix . '_dteAttendance                   AS mdteAttendance,
                 ' . $strFNPrefix . '_lEnrollID                       AS lEnrollRecordID,
                 ' . $strFNPrefix . '_dDuration                       AS dDuration,
                 ' . $strFNPrefix . '_strCaseNotes                    AS strCaseNotes ';
         }
     }
     // join the ddl values
     $strFields = $strJoinFields = $strJoin = '';
     if ($utable->lNumFields > 0) {
         foreach ($utable->ufields as $ufield) {
             $enumType = $ufield->enumFieldType;
             if (!($enumType == CS_FT_LOG || $enumType == CS_FT_HEADING)) {
                 $strFN = $ufield->strFieldNameInternal;
                 if ($enumType == CS_FT_DDL) {
                     $strASTable = 'uf_ddl_' . $strFN;
                     $strASField = 'strDDL' . $strFN;
                     $strJoin .= "LEFT JOIN uf_ddl AS {$strASTable} ON {$strFN}= {$strASTable}.ufddl_lKeyID \n";
                     $strJoinFields .= ", {$strASTable}.ufddl_strDDLEntry AS {$strASField} ";
                 }
                 $strFields .= ", {$strFN} \n";
             }
         }
     }
     $strFields = $strFNPrefix . '_lKeyID, ' . $strFNPrefix . '_lForeignKey ' . $strFields . "\n" . $strJoinFields;
     $strSelectExtra .= ', ' . $strFNPrefix . '_lOriginID      AS lOriginID, ' . $strFNPrefix . '_lLastUpdateID  AS lLastUpdateID, ' . $strFNPrefix . '_bRecordEntered AS bRecordEntered,
      UNIX_TIMESTAMP(' . $strFNPrefix . '_dteOrigin)     AS dteOrigin,
      UNIX_TIMESTAMP(' . $strFNPrefix . '_dteLastUpdate) AS dteLastUpdate,
      uc.us_strFirstName  AS strUCFName,  uc.us_strLastName  AS strUCLName,
      ul.us_strFirstName  AS strULFName,  ul.us_strLastName  AS strULLName ';
     $strJoin .= '
      LEFT JOIN admin_users   AS uc  ON uc.us_lKeyID  = ' . $strFNPrefix . '_lOriginID
      LEFT JOIN admin_users   AS ul  ON ul.us_lKeyID  = ' . $strFNPrefix . '_lLastUpdateID ' . "\n";
     if ($bMultiEntry) {
         $strCheckRetired = ' AND NOT ' . $strFNPrefix . '_bRetired ';
     } else {
         $strCheckRetired = '';
     }
     $sqlStr = "SELECT {$strFields} {$this->mrSQLSelect} {$strSelectExtra}\n           FROM {$utable->strDataTableName}\n              {$strJoin}\n           WHERE 1 {$strCheckRetired} {$this->mrSQLWhereExtra}\n           {$strOrder};";
     $query = $this->db->query($sqlStr);
     $this->lNumMRRecs = $numRows = $query->num_rows();
     $this->mrRecs = array();
     if ($numRows == 0) {
         $this->mrRecs[0] = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->mrRecs[$idx] = new stdClass();
             $mrRec =& $this->mrRecs[$idx];
             $mrRec->{$strFNKeyID} = $lDataRecID = $row->{$strFNKeyID};
             $mrRec->{$strFNFID} = $row->{$strFNFID};
             if ($bCProg) {
                 if ($bEnrollment) {
                     $mrRec->dteStart = dteMySQLDate2Unix($row->dteMysqlStart);
                     $mrRec->dteMysqlEnd = $row->dteMysqlEnd;
                     $mrRec->dteEnd = dteMySQLDate2Unix($row->dteMysqlEnd);
                     $mrRec->bCurrentlyEnrolled = (bool) $row->bCurrentlyEnrolled;
                 } else {
                     $mrRec->dteAttendance = dteMySQLDate2Unix($row->mdteAttendance);
                     $mrRec->lEnrollRecordID = (int) $row->lEnrollRecordID;
                     $mrRec->dDuration = (double) $row->dDuration;
                     $mrRec->strCaseNotes = $row->strCaseNotes;
                 }
             }
             $mrRec->bRecordEntered = (bool) $row->bRecordEntered;
             $mrRec->lOriginID = $row->lOriginID;
             $mrRec->lLastUpdateID = $row->lLastUpdateID;
             $mrRec->dteOrigin = $row->dteOrigin;
             $mrRec->dteLastUpdate = $row->dteLastUpdate;
             $mrRec->strUCFName = $row->strUCFName;
             $mrRec->strUCLName = $row->strUCLName;
             $mrRec->strULFName = $row->strULFName;
             $mrRec->strULLName = $row->strULLName;
             if ($bMultiEntry) {
             }
             if ($utable->lNumFields > 0) {
                 foreach ($utable->ufields as $ufield) {
                     $lFieldID = $ufield->pff_lKeyID;
                     $enumType = $ufield->enumFieldType;
                     if (!($enumType == CS_FT_LOG || $enumType == CS_FT_HEADING)) {
                         $strFN = $ufield->strFieldNameInternal;
                         $mrRec->{$strFN} = $row->{$strFN};
                     }
                     // load the ddl text entry
                     if ($enumType == CS_FT_DDL) {
                         $strDDLTextFN = $strFN . '_ddlText';
                         $strDBFN = 'strDDL' . $strFN;
                         $mrRec->{$strDDLTextFN} = $row->{$strDBFN} . '';
                     }
                     // load the multi-ddl text entry
                     if ($enumType == CS_FT_DDLMULTI) {
                         $strDDLMultiFN = $strFN . '_ddlMulti';
                         $this->loadMultiDDLSelects($lTableID, $lFieldID, $lDataRecID, $mrRec->{$strDDLMultiFN});
                     }
                 }
             }
             ++$idx;
         }
     }
 }
示例#29
0
 public function loadHonMem($enumLoadType)
 {
     //-----------------------------------------------------------------
     // $enumLoadType:
     //    via HMID
     //    via GiftID
     //    all
     //    all - Hon Only
     //    all - Mem Only
     //-----------------------------------------------------------------
     $sqlSelect = $strInner = '';
     $bViaGiftID = false;
     switch ($enumLoadType) {
         case 'all':
             $strWhere = '';
             break;
         case 'all - Hon Only':
             $strWhere = ' AND ghm_bHon';
             break;
         case 'all - Mem Only':
             $strWhere = ' AND NOT ghm_bHon';
             break;
         case 'via GiftID':
             $bViaGiftID = true;
             $strWhere = " AND ghml_lGiftID={$this->lGID} ";
             $strInner = ' INNER JOIN gifts_hon_mem_links ON ghml_lHonMemID=ghm_lKeyID ';
             //            $sqlSelect  = ', ghml_lKeyID, ghml_bAck, UNIX_TIMESTAMP(ghml_dteAck) AS dteAck, ghml_lAckByID ';
             $sqlSelect = ', ghml_lKeyID, ghml_bAck, ghml_dteAck, ghml_lAckByID ';
             break;
         case 'via HMID':
             $strWhere = " AND ghm_lKeyID={$this->lHMID} ";
             break;
         default:
             screamForHelp($enumLoadType . ': not implemented yet<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
             break;
     }
     $sqlStr = "SELECT\n            ghm_lKeyID, ghm_lFID, ghm_lMailContactID, ghm_bHon,\n            ghm_bHidden, ghm_bRetired,\n            ghm_lOriginID, ghm_lLastUpdateID,\n            UNIX_TIMESTAMP(ghm_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(ghm_dteLastUpdate) AS dteLastUpdate,\n\n            tblHM.pe_strFName   AS strHM_FName,   tblHM.pe_strLName AS strHM_LName,\n            tblHM.pe_strAddr1   AS strHM_Addr1,   tblHM.pe_strAddr2 AS strHM_Addr2,\n            tblHM.pe_strCity    AS strHM_City,    tblHM.pe_strState AS strHM_State,\n            tblHM.pe_strCountry AS strHM_Country, tblHM.pe_strZip   AS strHM_Zip,\n            tblHM.pe_strPhone   AS strHM_Phone,   tblHM.pe_strCell  AS strHM_Cell,\n\n            tblMC.pe_strFName   AS strMC_FName,   tblMC.pe_strLName AS strMC_LName,\n            tblMC.pe_strAddr1   AS strMC_Addr1,   tblMC.pe_strAddr2 AS strMC_Addr2,\n            tblMC.pe_strCity    AS strMC_City,    tblMC.pe_strState AS strMC_State,\n            tblMC.pe_strCountry AS strMC_Country, tblMC.pe_strZip   AS strMC_Zip,\n            tblMC.pe_strPhone   AS strMC_Phone,   tblMC.pe_strCell  AS strMC_Cell\n            {$sqlSelect}\n\n         FROM lists_hon_mem\n            INNER JOIN people_names AS tblHM ON tblHM.pe_lKeyID=ghm_lFID\n            {$strInner}\n            LEFT  JOIN people_names AS tblMC ON tblMC.pe_lKeyID=ghm_lMailContactID\n\n         WHERE\n            1\n            {$strWhere}\n            AND NOT ghm_bRetired\n\n         ORDER BY NOT ghm_bHon, tblHM.pe_strLName, tblHM.pe_strFName, ghm_lFID, ghm_lKeyID;";
     $query = $this->db->query($sqlStr);
     $this->lNumHonMem = $numRows = $query->num_rows();
     if ($numRows == 0) {
         $this->honMemTable[0] = new stdClass();
         $this->honMemTable[0]->ghm_lKeyID = $this->honMemTable[0]->ghm_lFID = $this->honMemTable[0]->ghm_lMailContactID = $this->honMemTable[0]->ghm_bHon = $this->honMemTable[0]->ghm_bHidden = $this->honMemTable[0]->ghm_strFName = $this->honMemTable[0]->ghm_strLName = $this->honMemTable[0]->ghm_strSafeName = $this->honMemTable[0]->ghm_lOriginID = $this->honMemTable[0]->ghm_lLastUpdateID = $this->honMemTable[0]->dteOrigin = $this->honMemTable[0]->dteLastUpdate = $this->honMemTable[0]->honorMem = $this->honMemTable[0]->mailContact = null;
         if ($bViaGiftID) {
             $this->honMemTable[0]->lHMLinkID = $this->honMemTable[0]->bAck = $this->honMemTable[0]->dteAck = $this->honMemTable[0]->lAckByID = null;
         }
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->honMemTable[$idx] = new stdClass();
             $this->honMemTable[$idx]->ghm_lKeyID = $row->ghm_lKeyID;
             $this->honMemTable[$idx]->ghm_lFID = $row->ghm_lFID;
             $this->honMemTable[$idx]->ghm_lMailContactID = $row->ghm_lMailContactID;
             $this->honMemTable[$idx]->ghm_bHon = $row->ghm_bHon;
             $this->honMemTable[$idx]->ghm_bHidden = $row->ghm_bHidden;
             $this->honMemTable[$idx]->ghm_strFName = $row->strHM_FName;
             $this->honMemTable[$idx]->ghm_strLName = $row->strHM_LName;
             $this->honMemTable[$idx]->ghm_strSafeName = htmlspecialchars($row->strHM_FName . ' ' . $row->strHM_LName);
             $this->honMemTable[$idx]->ghm_lOriginID = $row->ghm_lOriginID;
             $this->honMemTable[$idx]->ghm_lLastUpdateID = $row->ghm_lLastUpdateID;
             $this->honMemTable[$idx]->dteOrigin = $row->dteOrigin;
             $this->honMemTable[$idx]->dteLastUpdate = $row->dteLastUpdate;
             $this->honMemTable[$idx]->honorMem = new stdClass();
             $this->loadHonoree($this->honMemTable[$idx]->honorMem, $row, 'strHM');
             $this->honMemTable[$idx]->mailContact = new stdClass();
             $this->loadHonoree($this->honMemTable[$idx]->mailContact, $row, 'strMC');
             if ($bViaGiftID) {
                 $this->honMemTable[$idx]->lHMLinkID = $row->ghml_lKeyID;
                 $this->honMemTable[$idx]->bAck = $row->ghml_bAck;
                 $this->honMemTable[$idx]->dteAck = dteMySQLDate2Unix($row->ghml_dteAck);
                 $this->honMemTable[$idx]->lAckByID = $row->ghml_lAckByID;
             }
             ++$idx;
         }
     }
 }
 function loadBidSheets()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glChapterID;
     if ($this->strOrderBidSheet == '') {
         $strOrder = ' abs_strSheetName, abs_lKeyID ';
     } else {
         $strOrder = $this->strOrderBidSheet;
     }
     $this->bidSheets = array();
     $sqlStr = "SELECT\n            abs_lKeyID, abs_lTemplateID, abs_strSheetName, abs_strDescription,\n            abs_enumPaperType, abs_lNumSignupPages,\n            abs_strSignUpCol1, abs_strSignUpCol2, abs_strSignUpCol3, abs_strSignUpCol4,\n            abs_lSigunUpColWidth1, abs_lSigunUpColWidth2, abs_lSigunUpColWidth3, abs_lSigunUpColWidth4,\n            abs_bIncludeOrgName, abs_bIncludeOrgLogo, abs_lLogoImgID,\n            abs_bIncludeMinBid, abs_bIncludeMinBidInc, abs_bIncludeBuyItNow, abs_bIncludeReserve,\n            abs_bIncludeDate, abs_bIncludeFooter,\n            abs_bIncludePackageName, abs_bIncludePackageID, abs_bIncludePackageDesc,\n            abs_bIncludePackageImage, abs_bIncludePackageEstValue,\n            abs_bIncludeItemName, abs_bIncludeItemID, abs_bIncludeItemDesc, abs_bIncludeItemImage,\n            abs_bIncludeItemDonor, abs_bIncludeItemEstValue, abs_bIncludeSignup,\n            abs_bReadOnly, abs_bRetired,\n\n            abs_lAuctionID, auc_strAuctionName, auc_dteAuctionDate,\n\n            di_lKeyID, di_strSystemFN, di_strSystemThumbFN, di_strPath, di_strCaptionTitle,\n\n            abs_lOriginID, abs_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(abs_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(abs_dteLastUpdate) AS dteLastUpdate\n\n         FROM gifts_auctions_bidsheets\n            INNER JOIN gifts_auctions ON auc_lKeyID=abs_lAuctionID\n            LEFT  JOIN docs_images ON abs_lLogoImgID=di_lKeyID\n            INNER JOIN admin_users AS usersC   ON abs_lOriginID     = usersC.us_lKeyID\n            INNER JOIN admin_users AS usersL   ON abs_lLastUpdateID = usersL.us_lKeyID\n\n          WHERE NOT abs_bRetired\n            {$this->strWhereExtra}\n          ORDER BY {$strOrder};";
     $query = $this->db->query($sqlStr);
     $this->lNumBidSheets = $lNumBidSheets = $query->num_rows();
     if ($lNumBidSheets == 0) {
         $this->bidSheets[0] = new stdClass();
         $bs =& $this->bidSheets[0];
         $bs->lKeyID = $bs->lTemplateID = $bs->strSheetName = $bs->strDescription = $bs->enumPaperType = $bs->lNumSignupPages = $bs->bIncludeOrgLogo = $bs->lLogoImgID = $bs->lImageID = $bs->strSystemFN = $bs->strSystemThumbFN = $bs->strPath = $bs->strCaptionTitle = $bs->bIncludeOrgName = $bs->bIncludeMinBid = $bs->bIncludeMinBidInc = $bs->bIncludeBuyItNow = $bs->bIncludeReserve = $bs->bIncludeDate = $bs->bIncludeFooter = $bs->bIncludePackageName = $bs->bIncludePackageID = $bs->bIncludePackageDesc = $bs->bIncludePackageImage = $bs->bIncludePackageEstValue = $bs->bIncludeSignup = $bs->bIncludeItemName = $bs->bIncludeItemID = $bs->bIncludeItemDesc = $bs->bIncludeItemImage = $bs->bIncludeItemDonor = $bs->bIncludeItemEstValue = $bs->lAuctionID = $bs->strAuctionName = $bs->dteAuction = $bs->bRetired = $bs->bReadOnly = $bs->lOriginID = $bs->lLastUpdateID = $bs->strCFName = $bs->strCLName = $bs->strLFName = $bs->strLLName = $bs->dteOrigin = $bs->dteLastUpdate = null;
         $bs->signUpCols = array();
         $bs->lNumSignupCols = 0;
         for ($jidx = 1; $jidx <= 4; ++$jidx) {
             $bs->signUpCols[$jidx] = new stdClass();
             $suCol =& $bs->signUpCols[$jidx];
             $suCol->heading = null;
             $suCol->width = null;
             $suCol->bShow = false;
         }
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->bidSheets[$idx] = new stdClass();
             $bs =& $this->bidSheets[$idx];
             $bs->lKeyID = $row->abs_lKeyID;
             $bs->lTemplateID = $row->abs_lTemplateID;
             $bs->strSheetName = $row->abs_strSheetName;
             $bs->strDescription = $row->abs_strDescription;
             $bs->enumPaperType = $row->abs_enumPaperType;
             $bs->lNumSignupPages = $row->abs_lNumSignupPages;
             // bid sheets
             $bs->lNumSignupCols = 0;
             $bs->signUpCols = array();
             for ($jidx = 1; $jidx <= 4; ++$jidx) {
                 $bs->signUpCols[$jidx] = new stdClass();
                 $suCol =& $bs->signUpCols[$jidx];
                 $suCol->heading = $row->{'abs_strSignUpCol' . $jidx};
                 $suCol->width = $row->{'abs_lSigunUpColWidth' . $jidx};
                 $suCol->bShow = !is_null($suCol->heading);
                 if ($suCol->bShow) {
                     ++$bs->lNumSignupCols;
                 }
             }
             $bs->lAuctionID = $lAuctionID = $row->abs_lAuctionID;
             $bs->strAuctionName = $row->auc_strAuctionName;
             $bs->dteAuction = dteMySQLDate2Unix($row->auc_dteAuctionDate);
             $bs->bIncludeOrgLogo = $row->abs_bIncludeOrgLogo;
             $bs->lLogoImgID = $row->abs_lLogoImgID;
             $bs->lImageID = $row->di_lKeyID;
             $bs->strSystemFN = $row->di_strSystemFN;
             $bs->strSystemThumbFN = $row->di_strSystemThumbFN;
             $bs->strPath = $row->di_strPath;
             $bs->strCaptionTitle = $row->di_strCaptionTitle;
             if (is_null($bs->lLogoImgID)) {
                 $bs->strLogoImgTN = null;
                 $bs->strLogoImgLink = null;
             } else {
                 $bs->strLogoImgTN = strImageHTMLTag(CENUM_CONTEXT_AUCTION, CENUM_IMGDOC_ENTRY_IMAGE, $lAuctionID, $bs->strSystemThumbFN);
                 $bs->strLogoImgLink = strLinkHTMLTag(CENUM_CONTEXT_AUCTION, CENUM_IMGDOC_ENTRY_IMAGE, $lAuctionID, $bs->strSystemFN);
             }
             $bs->bIncludeOrgName = $row->abs_bIncludeOrgName;
             $bs->bIncludeMinBid = $row->abs_bIncludeMinBid;
             $bs->bIncludeMinBidInc = $row->abs_bIncludeMinBidInc;
             $bs->bIncludeBuyItNow = $row->abs_bIncludeBuyItNow;
             $bs->bIncludeReserve = $row->abs_bIncludeReserve;
             $bs->bIncludeDate = $row->abs_bIncludeDate;
             $bs->bIncludeFooter = $row->abs_bIncludeFooter;
             $bs->bIncludePackageName = $row->abs_bIncludePackageName;
             $bs->bIncludePackageID = $row->abs_bIncludePackageID;
             $bs->bIncludePackageDesc = $row->abs_bIncludePackageDesc;
             $bs->bIncludePackageImage = $row->abs_bIncludePackageImage;
             $bs->bIncludePackageEstValue = $row->abs_bIncludePackageEstValue;
             $bs->bIncludeSignup = $row->abs_bIncludeSignup;
             $bs->bIncludeItemName = $row->abs_bIncludeItemName;
             $bs->bIncludeItemID = $row->abs_bIncludeItemID;
             $bs->bIncludeItemDesc = $row->abs_bIncludeItemDesc;
             $bs->bIncludeItemImage = $row->abs_bIncludeItemImage;
             $bs->bIncludeItemDonor = $row->abs_bIncludeItemDonor;
             $bs->bIncludeItemEstValue = $row->abs_bIncludeItemEstValue;
             $bs->bIncludeSignup = $row->abs_bIncludeSignup;
             $bs->bRetired = $row->abs_bRetired;
             $bs->bReadOnly = $row->abs_bReadOnly;
             $bs->lOriginID = $row->abs_lOriginID;
             $bs->lLastUpdateID = $row->abs_lLastUpdateID;
             $bs->strCFName = $row->strCFName;
             $bs->strCLName = $row->strCLName;
             $bs->strLFName = $row->strLFName;
             $bs->strLLName = $row->strLLName;
             $bs->dteOrigin = $row->dteOrigin;
             $bs->dteLastUpdate = $row->dteLastUpdate;
             ++$idx;
         }
     }
 }