Пример #1
0
 function strVolHoursTFSumReport($sRpt, $lStartRec, $lRecsPerPage)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $strOut = '<b>Time Frame: ' . $sRpt->strDateRange . '</b><br><br>';
     $strLimit = " LIMIT {$lStartRec}, {$lRecsPerPage} ";
     $sqlStr = "SELECT pe_strLName, pe_strFName, tmp_lVolID,\n              tmp_dHoursScheduled, tmp_dHoursUnscheduled\n           FROM {$sRpt->tmpTable}\n              INNER JOIN volunteers   ON tmp_lVolID    = vol_lKeyID\n              INNER JOIN people_names ON vol_lPeopleID = pe_lKeyID\n           ORDER BY pe_strLName, pe_strFName, pe_strMName, pe_lKeyID\n           {$strLimit};";
     $query = $this->db->query($sqlStr);
     $lNumRows = $query->num_rows();
     if ($lNumRows == 0) {
         $strOut .= '<i>There are no records that meet your search criteria.</i>';
     } else {
         $strOut .= '<table class="enpRptC" style="width: 450pt;">
            <tr>
               <td class="enpRptTitle" colspan="5">
                  Volunteer Hours
               </td>
            </tr>
            <tr>
               <td class="enpRptLabel">
                  vol ID
               </td>
               <td class="enpRptLabel">
                  Volunteer
               </td>
               <td class="enpRptLabel">
                  Scheduled<br>Hours
               </td>
               <td class="enpRptLabel">
                  Unscheduled<br>Hours
               </td>
               <td class="enpRptLabel">
                  Total
               </td>
            </tr>';
         $sngTotS = $sngTotU = 0.0;
         foreach ($query->result() as $row) {
             $lVolID = (int) $row->tmp_lVolID;
             $strOut .= '
               <tr class="makeStripe">
                  <td class="enpRpt" style="text-align: center; width: 40pt;">' . str_pad($lVolID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_Volunteer($lVolID, 'View volunteer record', true, ' id="vrec' . $lVolID . '" ') . '
                  </td>
                  <td class="enpRpt">' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '
                  </td>
                  <td class="enpRpt" style="text-align: right; width: 40pt;">' . number_format($row->tmp_dHoursScheduled, 2) . '&nbsp;' . strLinkView_VolHrsViaVolID($lVolID, true, 'View details', true) . '
                  </td>
                  <td class="enpRpt" style="text-align: right; width: 40pt;">' . number_format($row->tmp_dHoursUnscheduled, 2) . '&nbsp;' . strLinkView_VolHrsViaVolID($lVolID, false, 'View details', true) . '
                  </td>
                  <td class="enpRpt" style="text-align: right; width: 40pt;">' . number_format($row->tmp_dHoursScheduled + $row->tmp_dHoursUnscheduled, 2) . '
                  </td>
               </tr>';
             $sngTotS += $row->tmp_dHoursScheduled;
             $sngTotU += $row->tmp_dHoursUnscheduled;
         }
         $strOut .= '
               <tr >
                  <td class="enpRptLabel" colspan="2">
                     Total
                  </td>
                  <td class="enpRpt" style="text-align: right; padding-right: 15pt;"><b>' . number_format($sngTotS, 2) . '</b>
                  </td>
                  <td class="enpRpt" style="text-align: right; padding-right: 15pt;"><b>' . number_format($sngTotU, 2) . '</b>
                  </td>
                  <td class="enpRpt" style="text-align: right;"><b>' . number_format($sngTotS + $sngTotU, 2) . '</b>
                  </td>
               </tr>';
         $strOut .= '</table>';
     }
     return $strOut;
 }
 function strShiftJobCodesSummaryViaMonth($strMoYr, $sRpt, $bAllJobCodes)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     //      global $genumDateFormat;
     $strTmpTable = 'tmpJCSumMo';
     $this->buildTmpTabJobCodeSumMo($sRpt, $strTmpTable);
     $sqlStr = "SELECT pe_strLName, pe_strFName, tmp_lVolID,\n              tmp_dHoursScheduled, tmp_dHoursUnscheduled,\n              jc.lgen_strListItem AS strJobCode\n           FROM {$strTmpTable}\n              INNER JOIN volunteers           ON tmp_lVolID    = vol_lKeyID\n              INNER JOIN people_names         ON vol_lPeopleID = pe_lKeyID\n              LEFT  JOIN lists_generic AS jc  ON tmp_lJobCode  = jc.lgen_lKeyID\n           ORDER BY pe_strLName, pe_strFName, pe_strMName, pe_lKeyID, strJobCode;";
     $query = $this->db->query($sqlStr);
     $numRows = $query->num_rows();
     if ($numRows == 0) {
         return '<br><i>There are no records that meet your search criteria.</i>';
     }
     $strOut = '
         <table class="enpRptC" style="width: 600pt;">
             <tr>
                <td colspan="6" class="enpRptTitle">
                   Job Code Summary: ' . $strMoYr . '
                </td>
             </tr>
            <tr>
               <td class="enpRptLabel">
                  vol ID
               </td>
               <td class="enpRptLabel">
                  Volunteer
               </td>
               <td class="enpRptLabel">
                  Job Code
               </td>
               <td class="enpRptLabel">
                  Scheduled<br>Hours
               </td>
               <td class="enpRptLabel">
                  Unscheduled<br>Hours
               </td>
               <td class="enpRptLabel">
                  Total
               </td>
            </tr>';
     $sngTotS = $sngTotU = 0.0;
     $lVIDHold = -999;
     foreach ($query->result() as $row) {
         $lVolID = (int) $row->tmp_lVolID;
         if ($lVIDHold != $lVolID) {
             $lVIDHold = $lVolID;
             $strName = htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName);
         } else {
             $strName = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;"';
         }
         if (is_null($row->strJobCode)) {
             $strJobCode = '<i>No job code</i>';
         } else {
             $strJobCode = htmlspecialchars($row->strJobCode);
         }
         $strOut .= '
            <tr class="makeStripe">
               <td class="enpRpt" style="text-align: center; width: 40pt;">' . str_pad($lVolID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_Volunteer($lVolID, 'View volunteer record', true, ' id="vrec' . $lVolID . '" ') . '
               </td>
               <td class="enpRpt">' . $strName . '
               </td>
               <td class="enpRpt">' . $strJobCode . '
               </td>
               <td class="enpRpt" style="text-align: right; width: 40pt;">' . number_format($row->tmp_dHoursScheduled, 2) . '&nbsp;' . strLinkView_VolHrsViaVolID($lVolID, true, 'View details', true) . '
               </td>
               <td class="enpRpt" style="text-align: right; width: 40pt;">' . number_format($row->tmp_dHoursUnscheduled, 2) . '&nbsp;' . strLinkView_VolHrsViaVolID($lVolID, false, 'View details', true) . '
               </td>
               <td class="enpRpt" style="text-align: right; width: 40pt;">' . number_format($row->tmp_dHoursScheduled + $row->tmp_dHoursUnscheduled, 2) . '
               </td>
            </tr>';
         $sngTotS += $row->tmp_dHoursScheduled;
         $sngTotU += $row->tmp_dHoursUnscheduled;
     }
     $strOut .= '
            <tr >
               <td class="enpRptLabel" colspan="3">
                  Total
               </td>
               <td class="enpRpt" style="text-align: right; padding-right: 15pt;"><b>' . number_format($sngTotS, 2) . '</b>
               </td>
               <td class="enpRpt" style="text-align: right; padding-right: 15pt;"><b>' . number_format($sngTotU, 2) . '</b>
               </td>
               <td class="enpRpt" style="text-align: right;"><b>' . number_format($sngTotS + $sngTotU, 2) . '</b>
               </td>
            </tr>';
     $strOut .= '</table><br><br>' . "\n";
     return $strOut;
 }
function showVolHours($clsRpt, $volRec, $dTotHours, $dTotUnHours, $lVolID)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $attributes = new stdClass();
    $attributes->lTableWidth = 900;
    $attributes->divID = 'volHrs';
    $attributes->divImageID = 'volHrsDivImg';
    openBlock('Volunteer Hours <span style="font-size: 9pt;">(' . number_format($dTotHours + $dTotUnHours, 2) . ' hrs.)</span>', '', $attributes);
    $clsRpt->openReport();
    echoT('
      <table>
         <tr>
            <td style="padding-right: 20pt;">
               <b>Scheduled:</b>
            </td>
            <td style="text-align: right; ">' . number_format($dTotHours, 2) . ' hours
            </td>
            <td>' . strLinkView_VolHrsViaVolID($lVolID, true, 'View details', true) . '
            </td>
         </tr>');
    echoT('
         <tr>
            <td style="vertical-align: bottom;">
               <b>Unscheduled:</b>
            </td>
            <td style="vertical-align: bottom; text-align: right;">' . number_format($dTotUnHours, 2) . ' hours
            </td>
            <td>' . strLinkView_VolHrsViaVolID($lVolID, false, 'View details', true) . '&nbsp;&nbsp;&nbsp;' . strLinkAdd_VolUnschedHrs($lVolID, 'Log hours for an unscheduled activity', true) . '&nbsp;' . strLinkAdd_VolUnschedHrs($lVolID, 'Log volunteer activity', false) . '
            </td>
         </tr>
         <tr>
            <td style="vertical-align: bottom;">
               <b>Total:</b>
            </td>
            <td style="vertical-align: bottom; text-align: right;">' . number_format($dTotHours + $dTotUnHours, 2) . ' hours ' . '
            </td>
            <td>' . strLinkView_VolDetailHrsViaYrMon(null, null, $lVolID, 'View All', true) . '
            </td>
         </tr>
      </table>');
    $clsRpt->closeReport();
    $attributes = new stdClass();
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}