<?php $__env->startSection('title', __('Customer Ledger').' - '.$customer->name); ?>
<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-body p-4">
        <?php echo $__env->make('reports.partials.header', ['title' => __('Customer Ledger'), 'period' => $customer->name], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
        <div class="d-flex justify-content-between align-items-start gap-3 mb-3">
            <div><h5><?php echo e($customer->name); ?></h5><span class="text-muted"><?php echo e($customer->phone); ?></span></div>
            <div class="text-end"><small><?php echo e(__('Current Due')); ?></small><h5 class="text-danger money"><?php echo e(number_format($customer->balance, 2)); ?> <?php echo e($moneyCode); ?></h5><button onclick="window.print()" class="btn btn-light btn-sm no-print"><i class="fa-solid fa-print me-1"></i><?php echo e(__('Print')); ?></button></div>
        </div>
        <div class="table-responsive">
            <table class="table mt-3">
                <thead><tr><th><?php echo e(__('Date')); ?></th><th><?php echo e(__('Description')); ?></th><th><?php echo e(__('Reference')); ?></th><th class="text-end"><?php echo e(__('Debit')); ?></th><th class="text-end"><?php echo e(__('Credit')); ?></th><th class="text-end"><?php echo e(__('Balance')); ?></th></tr></thead>
                <tbody>
                    <?php ($balance = 0); ?>
                    <?php $__currentLoopData = $entries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $entry): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php ($balance += $entry['debit'] - $entry['credit']); ?>
                        <tr><td><?php echo e(\App\Support\DualDate::format($entry['date'], 'd M Y')); ?></td><td><?php echo e($entry['description']); ?></td><td><?php echo e($entry['reference']); ?></td><td class="text-danger text-end money"><?php echo e($entry['debit'] ? number_format($entry['debit'], 2) : '-'); ?></td><td class="text-success text-end money"><?php echo e($entry['credit'] ? number_format($entry['credit'], 2) : '-'); ?></td><td class="text-end fw-bold money"><?php echo e(number_format($balance, 2)); ?></td></tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<?php if(!empty($appSettings['report_footer'])): ?><p class="text-center text-muted small mt-3"><?php echo e($appSettings['report_footer']); ?></p><?php endif; ?>
<?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\TradeERP\resources\views/reports/customer-ledger.blade.php ENDPATH**/ ?>