<div class="card card-primary card-outline">
    <div class="card-header bg-primary disabled color-palette">

        <h5 class="m-0">Viewing Leger for Account : <?php echo $Account->account_name; ?> <a href="" onclick="printDiv('printableDiv');" class="btn btn-success btn-sm float-right">Print</a></h5>

    </div>

    <div class="card-body" id="printableDiv">
        <h3 class="text-center"><?php echo $this->session->userdata("CompanyName"); ?></h3>
        <h5 class="text-center">Ledger Details for <?php echo $Account->account_name; ?> (<?php echo $Account->account_code; ?>)</h5>

        <?php $TableData = $Transactions; ?>
        <table class="table table-bordered table-striped dataTable">
            <thead>
                <tr>
                    <th>Sn</th>

                    <th>Narration</th>
                    <th>JV#</th>
                    <th>Dr</th>
                    <th>Cr</th>
                    <th>Balance</th>


                </tr>
            </thead>
            <tbody>
                <?php $r = 0;
                $drTotal = 0;
                $crTotal = 0;
                $balance = 0;
                foreach ($TableData as $TableRow) : $r++; ?>
                    <tr>
                        <td><?php echo $r; ?></td>

                        <td><?php echo $TableRow->narration; ?></td>
                        <td><?php echo (isset($TableRow->Voucher)) ? linkVoucher($TableRow->Voucher->voucher_id) : "OB"; ?></td>
                        <td><?php echo myCurrency($TableRow->dr);
                            $drTotal += $TableRow->dr; ?></td>
                        <td><?php echo myCurrency($TableRow->cr);
                            $crTotal += $TableRow->cr; ?></td>
                        <?php $balance += $TableRow->dr;
                        $balance -= $TableRow->cr; ?>
                        <td><?php echo ($balance != 0) ? myCurrency($balance) : showNill(); ?></td>


                    </tr>
                <?php endforeach; ?>
                <?php while ($r < 15) : ?>
                    <tr>
                        <td>&nbsp;</td>

                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                <?php $r++;
                endwhile; ?>
            <tbody>
            <tfoot>
                <tr>
                    <td colspan="3" class="text-right">Total</td>

                    <td><?php echo myCurrency($drTotal); ?></td>
                    <td><?php echo myCurrency($drTotal); ?></td>
                    <td><?php echo myCurrency($balance); ?></td>
                </tr>
                <tr>
                    <td colspan="6" class="text-right">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="6" class="text-right">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="6" class="text-right">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="6" class="text-center">
                        <div class="row">
                            <div class="col-2"><span class="underline-text"><?php echo $this->session->userdata("loggedUser"); ?></span></div>
                            <div class="col-2 offset-3">______________</div>
                            <div class="col-2 offset-3">______________</div>
                        </div>
                        <div class="row">
                            <div class="col-2">Entered By</div>
                            <div class="col-2 offset-3">Checked By</div>
                            <div class="col-2 offset-3">Approved By</div>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>

    </div>
</div>