Jump to content

looking to SUM 2 separate columns as each.. not together.


freebs

Recommended Posts

Add your styling to the <td>s etc when the $tdata is being built EG

    foreach ($res as $row) {
        $tot_value += $row['value'];
        $tot_balance += $row['balance'];               // accumulate totals as they are fetched
        $tdata .= "<tr><td>{$row['work_order']}</td>
                       <td>{$row['customer']}</td>
                       <td>{$row['description']}</td>";
        $tdata .= '<td class="ra">' . toCurrency($row['value']) . '</td>';               // right-align cell
        $tdata .= '<td class="ra">' . toCurrency($row['balance']) . '</td>';             // right-align cell               
        $tdata .= "<td>{$row['status']}</td>
                   <td>{$row['notes']}</td></tr>";
    }
    $tdata .= "<tr><th colspan='3' class='ra'>Totals</th><td class='ra total'>" . toCurrency($tot_value) . '</td><td class="ra total">' . toCurrency($tot_balance) . "</td><td colspan='2'></td></tr>";

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.