<?php $__env->startSection('title','Supplier Statement'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1><?php echo e($supplier->name_en); ?></h1><p><?php echo e($supplier->supplier_code); ?> · <?php echo e($supplier->name_ar); ?> · VAT <?php echo e($supplier->vat_number?:'Not registered'); ?></p></div><div class="text-end"><small class="text-muted d-block">Outstanding payable</small><strong class="fs-4 text-accent">SAR <?php echo e(number_format((float)$supplier->outstanding_balance,2)); ?></strong></div></div><div class="card-erp"><div class="table-responsive"><table class="table table-dense"><thead><tr><th>Date</th><th>Reference</th><th>Transaction</th><th>Description</th><th class="text-end">Debit</th><th class="text-end">Credit</th><th class="text-end">Running payable</th></tr></thead><tbody><?php $running=0; ?> <?php $__currentLoopData = $openings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $o): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $d=$o->type==='advance'?(float)$o->amount:0;$c=$o->type==='payable'?(float)$o->amount:0;$running+=$c-$d; ?> <tr><td><?php echo e($o->opening_date->format('d M Y')); ?></td><td><?php echo e($o->reference); ?></td><td>Opening balance</td><td><?php echo e(ucfirst($o->type)); ?></td><td class="text-end"><?php echo e(number_format($d,2)); ?></td><td class="text-end"><?php echo e(number_format($c,2)); ?></td><td class="text-end fw-bold"><?php echo e(number_format($running,2)); ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php $__currentLoopData = $entries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $e): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $running+=(float)$e->credit-(float)$e->debit; ?> <tr><td><?php echo e($e->transaction_date->format('d M Y')); ?></td><td><?php echo e($e->reference_number); ?></td><td><?php echo e(str_replace('_',' ',$e->transaction_type)); ?></td><td><?php echo e($e->description); ?></td><td class="text-end"><?php echo e(number_format((float)$e->debit,2)); ?></td><td class="text-end"><?php echo e(number_format((float)$e->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(); ?> <?php if(!$openings->count()&&!$entries->count()): ?><tr><td colspan="7" class="text-center text-muted py-5">No account activity.</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\suppliers\statement.blade.php ENDPATH**/ ?>