示例#1
0
     $amt = $record["hours"];
     $logs[$col][LOG_ID] = $ID;
     $totals[$col] += abs($amt);
     if ($amt < 0 && $_STATE->mode == "t") {
         //dups in tabular are combined into one
         $amt += -$logs[$col][LOG_DS];
         //sum both hours as a neg number
         $ID = -$ID;
         //recID also shows as negative (we won't allow edit)
     }
     $logs[$col][LOG_DSP] = $amt;
     $recsav = $record;
 }
 if (count($_STATE->records) > 0) {
     //get the last row - if there were any
     onerow($recsav, $logs);
 }
 $grand = 0;
 for ($ndx = 0; $ndx < $_STATE->columns[COL_COUNT]; $ndx++) {
     $grand += $totals[$ndx];
 }
 if ($_STATE->mode == "l") {
     //list
     echo "<tr>\n";
     echo "  <td colspan='4'></td><td>Total:</td><td class='number'>" . $grand, "</td><td></td>\n";
     echo "</tr>\n";
 } else {
     //tabular
     echo "<tr>\n";
     echo "<td colspan='3'></td><td style='text-align:right'>project Totals:</td>\n";
     for ($ndx = 0; $ndx < $_STATE->columns[COL_COUNT]; $ndx++) {
示例#2
0
           echo "  </tr>\n";
       }
       //end function onerow()
       reset($_STATE->records);
       $totals = array();
       //totals: sessions, attendance
       $logs = array();
       for ($ndx = 0; $ndx < $_STATE->columns[COL_COUNT]; $ndx++) {
           //save one row's worth of data:
           $totals[] = array(0, 0);
           $logs[] = array(0, 0, 0);
           //$logs[][0,1]=>sessions/attendance, $logs[][2]=>timelog_id
       }
       //if ($_STATE->mode == "l") { //---begin LIST STYLE---
       foreach ($_STATE->records as $ID => $record) {
           onerow($record, $logs);
           $totals[$record["column"]][0] += $record["session_count"];
           $totals[$record["column"]][1] += $record["attendance"];
       }
       $grand = array(0, 0);
       for ($ndx = 0; $ndx < $_STATE->columns[COL_COUNT]; $ndx++) {
           $grand[0] += $totals[$ndx][0];
           $grand[1] += $totals[$ndx][1];
       }
       //}
       ?>
 <tr>
   <td colspan="3"></td>
   <td>Totals:</td><td class='number'><?php 
       echo $grand[0];
       ?>