title: Display a row with total amount of shift wise
body: <p>I provide staff members to a site. They work shit wise Day and Night.
  To make monthly Invoice I display the staff according to Shift wise.<br>
  Like</p>
  
  <pre><code> Day Shift
   Emp Name      Days     Amount
     A            30       1200
     B            25       1000
   Night Shift
     C            27       1100
     D            26       1050
  </code></pre>
  
  <p>I want to display a row with total Amount Shift Wise
  I have this code</p>
  
  <pre><code> &lt;?php 
   $temp='';
   foreach ( $rows as $row) 
  
  {
  </code></pre>
  
  <p>///To Display Shift Row///////</p>
  
  <pre><code>    if($temp!=$row-&gt;shift_type) 
      {
       ?&gt;
     &lt;tr&gt;&lt;td style="font-weight:bold"&gt;&lt;?php echo $row-&gt;shift_type;?&gt; Shift&lt;/td&gt;&lt;/tr&gt;  
     &lt;tr style=" border-top:3px solid #CCC"&gt;
  
     &lt;th style="text-align:center"&gt;Staff Name&lt;/th&gt;
  
     &lt;th style="text-align:center"&gt; Days&lt;/th&gt;
     &lt;th style="text-align:center"&gt; Amount&lt;/th&gt;
     &lt;/tr&gt;
     &lt;?php $temp = $row-&gt;shift_type;
      }
  ?&gt;
  </code></pre>
  
  <p>////To Display Staff Members with Salry////
       
         first_name.$row->last_name; ?></p>
  
  <pre><code>   &lt;td align="center"&gt;&lt;?php  echo $row-&gt;week_days; ?&gt;&lt;/td&gt;
     &lt;td align="center"&gt;$&lt;?php echo $weekdaysamount= $row-&gt;week_days*$row-&gt;week_day_rate; 
     $totalweekdaysamount+=$weekdaysamount;?&gt;
    &lt;/td&gt;
  
    &lt;/tr&gt;
    &lt;?php  }   ?&gt;
  </code></pre>
  
  <p>This make the total of all rows . I want a row with total of Shift wise.
  Should be like this</p>
  
  <pre><code> Day Shift
      Emp Name      Days     Amount
       A            30       1200
       B            25       1000
      Total                  2200   
   Night Shift
       C            27       1100
       D            26       1050
      Total                  2150
  </code></pre>