<?php $__env->startSection('title','General Ledger'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1>General ledger</h1><p>Posted journal activity with running account balance.</p></div></div><div class="card-erp"><div class="card-erp-body"><form class="row g-2 align-items-end"><div class="col-md-5"><label class="form-label">Account</label><select name="account_id" class="form-select"><?php $__currentLoopData = $accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($a->id); ?>" <?php if($selected?->id===$a->id): echo 'selected'; endif; ?>><?php echo e($a->code); ?> · <?php echo e($a->name_en); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-md-2"><label class="form-label">From</label><input type="date" class="form-control" name="date_from" value="<?php echo e(request('date_from')); ?>"></div><div class="col-md-2"><label class="form-label">To</label><input type="date" class="form-control" name="date_to" value="<?php echo e(request('date_to')); ?>"></div><div class="col-md-3"><button class="btn btn-dark w-100">Run ledger</button></div></form></div><div class="table-responsive"><table class="table table-dense"><thead><tr><th>Date</th><th>Journal</th><th>Reference</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><?php $running=0; ?> <?php $__empty_1 = true; $__currentLoopData = $lines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $line): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> <?php $running+=(float)$line->debit-(float)$line->credit; ?> <tr><td><?php echo e($line->journalEntry->entry_date->format('d M Y')); ?></td><td><?php echo e($line->journalEntry->journal_no); ?></td><td><?php echo e($line->journalEntry->reference_number); ?></td><td><?php echo e($line->description); ?></td><td class="text-end"><?php echo e(number_format((float)$line->debit,2)); ?></td><td class="text-end"><?php echo e(number_format((float)$line->credit,2)); ?></td><td class="text-end fw-bold"><?php echo e(number_format($running,2)); ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="7" class="text-center text-muted py-5">No posted activity for this account.</td></tr><?php endif; ?></tbody></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 C:\xampp\htdocs\saudi\resources\views/accounts/ledger.blade.php ENDPATH**/ ?>