<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?> <?php $__env->slot('header', null, []); ?> <div class="d-flex flex-wrap justify-content-between align-items-center gap-2"><div><h2 class="h4 mb-0">Account Statement</h2><p class="text-muted mb-0">Customer collections, other income and business expenses</p></div><div class="d-flex gap-2"><a class="btn btn-outline-success" href="<?php echo e(route('admin.accounts.statement.export', request()->query())); ?>">Export CSV</a><button onclick="window.print()" class="btn btn-outline-secondary">Print</button><?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('accounts.manage')): ?><button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#accountEntry">Add entry</button><?php endif; ?></div></div> <?php $__env->endSlot(); ?>
<form class="card border-0 shadow-sm mb-4 d-print-none"><div class="card-body row g-3 align-items-end"><div class="col-md-3"><label class="form-label">From</label><input type="date" name="from" value="<?php echo e($filters['from'] ?? ''); ?>" class="form-control"></div><div class="col-md-3"><label class="form-label">To</label><input type="date" name="to" value="<?php echo e($filters['to'] ?? ''); ?>" class="form-control"></div><div class="col-md-2"><label class="form-label">Type</label><select name="type" class="form-select"><option value="">All</option><option value="income" <?php if(($filters['type']??'')==='income'): echo 'selected'; endif; ?>>Income</option><option value="expense" <?php if(($filters['type']??'')==='expense'): echo 'selected'; endif; ?>>Expense</option></select></div><div class="col-md-2"><label class="form-label">Method</label><select name="method" class="form-select"><option value="">All</option><?php $__currentLoopData = ['cash','bank','bkash','nagad','other']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($m); ?>" <?php if(($filters['method']??'')===$m): echo 'selected'; endif; ?>><?php echo e(ucfirst($m)); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-md-2"><button class="btn btn-dark w-100">Filter</button></div></div></form>
<div class="row g-3 mb-4"><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Opening</small><h3><?php echo e(app(\App\Services\CurrencyService::class)->format($opening)); ?></h3></div></div></div><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Income</small><h3 class="text-success"><?php echo e(app(\App\Services\CurrencyService::class)->format($income)); ?></h3></div></div></div><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Expense</small><h3 class="text-danger"><?php echo e(app(\App\Services\CurrencyService::class)->format($expense)); ?></h3></div></div></div><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Closing</small><h3><?php echo e(app(\App\Services\CurrencyService::class)->format($opening+$income-$expense)); ?></h3></div></div></div></div>
<div class="card border-0 shadow-sm"><div class="table-responsive"><table class="table table-hover align-middle mb-0" style="min-width:900px"><thead><tr><th>Date</th><th>Source</th><th>Category / Description</th><th>Method</th><th>Reference</th><th class="text-end">Income</th><th class="text-end">Expense</th><th class="text-end">Balance</th><th class="d-print-none"></th></tr></thead><tbody><?php ($balance=$opening); ?> <?php if(($filters['from']??null)): ?><tr class="table-light"><td><?php echo e($filters['from']); ?></td><td>Opening</td><td>Opening balance</td><td></td><td></td><td></td><td></td><td class="text-end fw-bold"><?php echo e(number_format($balance,2)); ?></td><td></td></tr><?php endif; ?> <?php $__empty_1 = true; $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> <?php ($balance += $row['income']-$row['expense']); ?><tr><td><?php echo e($row['date']?->format('d M Y')); ?></td><td><span class="badge <?php echo e($row['source']==='billing'?'bg-info text-dark':'bg-secondary'); ?>"><?php echo e(ucfirst($row['source'])); ?></span></td><td><strong><?php echo e($row['category']); ?></strong><div class="small text-muted"><?php echo e($row['description']); ?></div></td><td><?php echo e(ucfirst($row['method'])); ?></td><td><?php echo e($row['reference'] ?: '-'); ?></td><td class="text-end text-success"><?php echo e($row['income'] ? number_format($row['income'],2):'-'); ?></td><td class="text-end text-danger"><?php echo e($row['expense'] ? number_format($row['expense'],2):'-'); ?></td><td class="text-end fw-bold"><?php echo e(number_format($balance,2)); ?></td><td class="d-print-none"><?php if($row['source']==='manual' && auth()->user()->can('accounts.manage')): ?><form method="post" action="<?php echo e(route('admin.accounts.transactions.destroy',$row['id'])); ?>" onsubmit="return confirm('Delete this entry?')"><?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?><button class="btn btn-sm btn-outline-danger">Delete</button></form><?php endif; ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="9" class="text-center py-4">No transactions found.</td></tr><?php endif; ?></tbody></table></div></div>
<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('accounts.manage')): ?><div class="modal fade" id="accountEntry" tabindex="-1"><div class="modal-dialog"><form method="post" action="<?php echo e(route('admin.accounts.transactions.store')); ?>" class="modal-content"><?php echo csrf_field(); ?><div class="modal-header"><h5 class="modal-title">Add account entry</h5><button type="button" class="btn-close" data-bs-dismiss="modal"></button></div><div class="modal-body row g-3"><div class="col-6"><label class="form-label">Type *</label><select name="type" class="form-select" required><option value="income">Income</option><option value="expense">Expense</option></select></div><div class="col-6"><label class="form-label">Date *</label><input type="date" name="transaction_date" value="<?php echo e(now()->toDateString()); ?>" class="form-control" required></div><div class="col-7"><label class="form-label">Category *</label><input name="category" list="accountCategories" class="form-control" required><datalist id="accountCategories"><option>Office Rent</option><option>Staff Salary</option><option>Electricity</option><option>Bandwidth Purchase</option><option>Equipment Sale</option><option>Other Income</option><option>Maintenance</option></datalist></div><div class="col-5"><label class="form-label">Amount *</label><input type="number" name="amount" step="0.01" min="0.01" class="form-control" required></div><div class="col-6"><label class="form-label">Method *</label><select name="payment_method" class="form-select" required><?php $__currentLoopData = ['cash','bank','bkash','nagad','other']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($m); ?>"><?php echo e(ucfirst($m)); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-6"><label class="form-label">Reference</label><input name="reference" class="form-control"></div><div class="col-12"><label class="form-label">Description</label><textarea name="description" class="form-control"></textarea></div></div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button><button class="btn btn-primary">Save</button></div></form></div></div><?php endif; ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH D:\herd\billing\laravel-app\resources\views\admin\accounts\statement.blade.php ENDPATH**/ ?>