<style>
    table {
        border:1px solid #ccc;
    }

    th {
        border:1px solid #ccc;
        padding:0px;
        margin:0px;
        background-color: #eaeaea;
    }

    td {
        border:1px solid #ccc;
        padding:0px;
        margin:0px;
    }

    .scroll {
        overflow-x:scroll;
        overflow-y:visible;
    }

</style>
<table width="100%" style="border:0px; padding:0px; margin:0px;">
    <tr>
        <td style="border:0px;"><h3><i class="fa fa-clock-o"></i> Month Totals: <?php echo date("F",strtotime($this->year."-".$this->month."-01")) ?> <?php echo $this->year ?></h3></td>
        <td style="border:0px;" class="text-right"><?php echo $this->startDate ?> - <?php echo $this->endDate ?></td>
    </tr>
</table>
<table width="100%">
    <thead>
    <tr>
       <th style="width:150px;"></th>
       <?php
           foreach($this->codes as $code)
           {
               echo "<th>$code</th>";
           }
       ?>
        <th>Totals</th>
    </tr>
    </thead>
    <tbody>
    <?php
    $grandTotal = 0;
    foreach($this->report as $account)
    {

        echo "<tr>";
        echo "<td style='border-bottom:1px solid #ccc;'><b>".$account['userInfo']['lastName'].", ".$account['userInfo']['firstName']."</b></td>";

        foreach($account['totals'] as $totals)
        {
            echo "<td class='text-center' style='border-bottom:1px solid #ccc;'>";
            if($totals == 0)
            {
                echo " - ";
            }
            else
            {
                echo $totals;
            }

            echo "</td>";
        }

        $accountTotal = 0;
        foreach($account['totals'] as $total)
        {
            $accountTotal = $accountTotal + $total;
            $grandTotal = $grandTotal + $total;
        }

        echo "<td class='text-center'><b>$accountTotal</b></td>";
        echo "</tr>";
    }

    $codeCount = count($account['totals'])+2;
    echo "
            <tr>
                <td class='text-center' colspan=\"$codeCount\"><b>Total Pay Period Hours:</b> $grandTotal </td>
            </tr>
        ";
    ?>
    </tbody>
</table>
