<?php $__env->startSection('title','Reports & VAT'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1><?php echo e($report['title']); ?></h1><p>Operational, inventory, aging, profitability, and Saudi VAT reports from posted transactions.</p></div><a class="btn btn-light border btn-dense" href="<?php echo e(route('reports.export',request()->query())); ?>"><i class="bi bi-file-earmark-excel me-1"></i>Export Excel</a></div>
<div class="card-erp"><div class="card-erp-body"><form class="row g-2 align-items-end"><div class="col-lg-4"><label class="form-label">Report</label><select name="type" class="form-select"><?php $__currentLoopData = $catalog; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group=>$reports): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><optgroup label="<?php echo e($group); ?>"><?php $__currentLoopData = $reports; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($key); ?>" <?php if($type===$key): echo 'selected'; endif; ?>><?php echo e($label); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></optgroup><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-md-3 col-lg-2"><label class="form-label">From date</label><input type="date" name="date_from" class="form-control" value="<?php echo e($from); ?>"></div><div class="col-md-3 col-lg-2"><label class="form-label">To date / as of</label><input type="date" name="date_to" class="form-control" value="<?php echo e($to); ?>"></div><div class="col-md-2"><button class="btn btn-dark w-100">Run report</button></div><div class="col-lg-2 text-end text-muted small">Screen limit: 50<br>Excel: all rows</div></form></div></div>
<div class="row g-2 mb-2"><?php $__currentLoopData = [['Taxable sales',$vat['taxable_sales']],['Output VAT',$vat['output_vat']],['Taxable purchases',$vat['taxable_purchases']],['Input VAT',$vat['input_vat']],['VAT difference',$vat['difference']]]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$label,$value]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><div class="col-6 col-md"><div class="card-erp stat-card"><div class="label"><?php echo e($label); ?></div><div class="value"><?php echo e(number_format((float)$value,2)); ?></div><small class="text-muted">SAR</small></div></div><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></div>
<div class="d-flex flex-wrap gap-2 mb-2"><?php if(auth()->user()->hasPermission('accounts.view_reports')): ?><a href="<?php echo e(route('accounts.trial-balance')); ?>" class="btn btn-sm btn-light border">Trial balance</a><a href="<?php echo e(route('accounts.statement','profit-loss')); ?>" class="btn btn-sm btn-light border">Profit & loss</a><a href="<?php echo e(route('accounts.statement','balance-sheet')); ?>" class="btn btn-sm btn-light border">Balance sheet</a><?php endif; ?> <?php if(auth()->user()->hasPermission('accounts.view')): ?><a href="<?php echo e(route('accounts.ledger')); ?>" class="btn btn-sm btn-light border">General ledger</a><?php endif; ?> <?php if(auth()->user()->hasPermission('inventory.view')): ?><a href="<?php echo e(route('stock-ledger.index')); ?>" class="btn btn-sm btn-light border">Stock ledger</a><?php endif; ?> <?php if(auth()->user()->hasPermission('inventory.view_reports')): ?><a href="<?php echo e(route('expiry-report.index')); ?>" class="btn btn-sm btn-light border">Batch / expiry</a><?php endif; ?></div>
<div class="card-erp"><div class="table-responsive"><table class="table table-dense"><thead><tr><?php $__currentLoopData = $report['columns']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $column): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><th class="<?php echo e(($column[2]??'')==='money'||($column[2]??'')==='qty'?'text-end':''); ?>"><?php echo e($column[1]); ?></th><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></tr></thead><tbody><?php $__empty_1 = true; $__currentLoopData = $report['rows']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><?php $__currentLoopData = $report['columns']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $column): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php ($value=$row[$column[0]]??null); ?><td class="<?php echo e(($column[2]??'')==='money'||($column[2]??'')==='qty'?'text-end':''); ?>"><?php if(($column[2]??'')==='money'): ?><?php echo e(number_format((float)$value,2)); ?><?php elseif(($column[2]??'')==='qty'): ?><?php echo e(number_format((float)$value,4)); ?><?php elseif($column[0]==='arabic'): ?><span dir="rtl"><?php echo e($value); ?></span><?php else: ?><?php echo e($value); ?><?php endif; ?></td><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="<?php echo e(count($report['columns'])); ?>" class="text-center text-muted py-5">No posted data for the selected report and date range.</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\reports\index.blade.php ENDPATH**/ ?>