<?php $__env->startSection('title', 'Trial Balance'); ?>
<?php $__env->startSection('page_title', 'Trial Balance'); ?>
<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Home</a></li><li class="breadcrumb-item active">Trial Balance</li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="card mb-3"><div class="card-body py-2">
        <form method="GET" class="row g-2 align-items-end">
            <div class="col-md-3"><label class="form-label small">As of</label><input type="date" name="as_of" value="<?php echo e($asOf); ?>" class="form-control form-control-sm"></div>
            <div class="col-md-3"><button class="btn btn-sm btn-primary"><i class="bi bi-search me-1"></i>Generate</button></div>
        </form>
    </div></div>

    <div class="card"><div class="card-body">
        <table class="table table-sm align-middle">
            <thead><tr><th>Code</th><th>Account</th><th>Type</th><th class="text-end">Debit</th><th class="text-end">Credit</th></tr></thead>
            <tbody>
                <?php $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td class="small"><?php echo e($r['account']->code); ?></td>
                        <td><?php echo e($r['account']->name); ?></td>
                        <td><span class="badge bg-soft-<?php echo e($r['account']->type_color); ?> text-capitalize"><?php echo e($r['account']->type); ?></span></td>
                        <td class="text-end"><?php echo e($r['debit'] > 0 ? number_format($r['debit'], 2) : ''); ?></td>
                        <td class="text-end"><?php echo e($r['credit'] > 0 ? number_format($r['credit'], 2) : ''); ?></td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
            <tfoot class="table-light">
                <tr class="fw-bold"><td colspan="3">Total</td><td class="text-end"><?php echo e(number_format($totalDebit, 2)); ?></td><td class="text-end"><?php echo e(number_format($totalCredit, 2)); ?></td></tr>
                <tr><td colspan="5" class="text-center small <?php echo e(abs($totalDebit-$totalCredit) < 0.01 ? 'text-success' : 'text-danger'); ?>">
                    <?php echo e(abs($totalDebit-$totalCredit) < 0.01 ? '✓ In balance' : 'Out of balance by '.number_format(abs($totalDebit-$totalCredit),2)); ?>

                </td></tr>
            </tfoot>
        </table>
    </div></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/u385418287/domains/itartificer.com/public_html/sms-erp/resources/views/accounting/reports/trial-balance.blade.php ENDPATH**/ ?>