<?php $__env->startSection('title', 'General Ledger'); ?>
<?php $__env->startSection('page_title', 'General Ledger'); ?>
<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Home</a></li><li class="breadcrumb-item active">General Ledger</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-4"><label class="form-label small">Account</label>
                <select name="account_id" class="form-select form-select-sm js-select2">
                    <option value="">— Select account —</option>
                    <?php $__currentLoopData = $accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($a->id); ?>" <?php if($account && $account->id==$a->id): echo 'selected'; endif; ?>><?php echo e($a->label); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select></div>
            <div class="col-md-3"><label class="form-label small">From</label><input type="date" name="from" value="<?php echo e($from); ?>" class="form-control form-control-sm"></div>
            <div class="col-md-3"><label class="form-label small">To</label><input type="date" name="to" value="<?php echo e($to); ?>" class="form-control form-control-sm"></div>
            <div class="col-md-2"><button class="btn btn-sm btn-primary w-100"><i class="bi bi-search me-1"></i>View</button></div>
        </form>
    </div></div>

    <?php if($account): ?>
        <div class="card"><div class="card-body">
            <h6 class="mb-3"><?php echo e($account->label); ?></h6>
            <table class="table table-sm align-middle">
                <thead><tr><th>Date</th><th>Entry</th><th>Description</th><th class="text-end">Debit</th><th class="text-end">Credit</th><th class="text-end">Balance</th></tr></thead>
                <tbody>
                    <tr class="table-light"><td colspan="5" class="fw-semibold">Opening Balance</td><td class="text-end fw-semibold"><?php echo e(number_format($opening, 2)); ?></td></tr>
                    <?php $__empty_1 = true; $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td class="small"><?php echo e($r['date']->format('d M Y')); ?></td>
                            <td class="small"><?php echo e($r['entry']); ?></td>
                            <td class="small"><?php echo e($r['description']); ?></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>
                            <td class="text-end"><?php echo e(number_format($r['balance'], 2)); ?></td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr><td colspan="6" class="text-center text-muted py-3">No transactions in this period.</td></tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div></div>
    <?php else: ?>
        <div class="card"><div class="card-body text-center text-muted py-4">Select an account to view its ledger.</div></div>
    <?php endif; ?>
<?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/ledger.blade.php ENDPATH**/ ?>