<?php $__env->startSection('title',$statement==='profit-loss'?'Profit & Loss':'Balance Sheet'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1><?php echo e($statement==='profit-loss'?'Profit & loss':'Balance sheet'); ?></h1><p>Generated directly from posted journal entries.</p></div><form><div class="input-group input-group-sm"><input type="date" name="date_to" class="form-control" value="<?php echo e(request('date_to',now()->toDateString())); ?>"><button class="btn btn-dark">Run</button></div></form></div><div class="card-erp"><div class="table-responsive"><table class="table table-dense"><thead><tr><th>Code</th><th>Account</th><th>Type</th><th class="text-end">Balance</th></tr></thead><tbody><?php $net=0; ?> <?php $__currentLoopData = $accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $raw=(float)($a->debit_total??0)-(float)($a->credit_total??0);$balance=in_array($a->type,['liability','equity','income'])?-$raw:$raw;$net+=$statement==='profit-loss'&&$a->type==='income'?-abs($balance):$balance; ?> <?php if(abs($balance)>.004): ?><tr><td><?php echo e($a->code); ?></td><td><?php echo e($a->name_en); ?><small class="d-block text-muted" dir="rtl"><?php echo e($a->name_ar); ?></small></td><td><?php echo e(strtoupper($a->type)); ?></td><td class="text-end fw-bold"><?php echo e(number_format(abs($balance),2)); ?></td></tr><?php endif; ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></tbody><tfoot><tr><th colspan="3" class="text-end"><?php echo e($statement==='profit-loss'?'NET RESULT':'NET BALANCE'); ?></th><th class="text-end">SAR <?php echo e(number_format(abs($net),2)); ?></th></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 C:\xampp\htdocs\saudi\resources\views\accounts\statement.blade.php ENDPATH**/ ?>