<div class="table-responsive" id="result">
    <table id="dataTable" class="table table-bordered table-striped">
        <thead class="bg-gray-50">
            <tr>
                <th>ID</th>
                <th>Username</th>
                <th>Client IP</th>
                <th>MAC Address</th>
                <th>Download</th>
                <th>Upload</th>
                <th>Login</th>
                <th>Logout</th>
                <th>Reason</th>
            </tr>
        </thead>
        <tbody>
            @php
                $total_down = 0;
                $total_up = 0;
            @endphp
            @foreach ($list as $r)
                <tr>
                    <td>{{ $r->acctuniqueid }}</td>
                    <td>{{ $r->username }}</td>
                    <td>{{ $r->framedipaddress }}</td>
                    <td>{{ $r->callingstationid }}</td>
                    <td style="text-align:right">
                        {{ round(($r->acctoutputoctets) / 8388608, 2) }} MB
                    </td>
                    <td style="text-align:right">
                        {{ round(($r->acctinputoctets) / 8388608, 2) }} MB
                    </td>
                    <td>{{ $r->acctstarttime }}</td>
                    <td>{{ $r->acctstoptime }}</td>
                    <td>{{ $r->acctterminatecause }}</td>
                    @php($total_down += round(($r->acctoutputoctets) / 8388608, 2))
                    @php($total_up += round(($r->acctinputoctets) / 8388608, 2))
                </tr>
            @endforeach


            <tr>
                <td colspan="4" style="text-align:right"><strong>Total</strong></td>
                <td style="text-align:right"><strong>{{ number_format($total_down/1024, 2) }}</strong> GB</td>
                <td style="text-align:right"><strong>{{ number_format($total_up/1024, 2) }}</strong> GB</td>
                <td colspan="3"></td>
            </tr>
        </tbody>
    </table>
</div>
