

<?php $__env->startSection('title', 'Day Book / Cash Book'); ?>

<?php $__env->startSection('content'); ?>
<div class="card mb-4">
    <div class="card-header border-bottom">
        <h4 class="card-title mb-0">Day Book / Cash Book</h4>
    </div>
    <div class="card-body">
        <form method="GET" action="<?php echo e(route('accounting.reports.day-book')); ?>">
            <div class="row g-3 align-items-end">
                <div class="col-md-3">
                    <label class="form-label">Date</label>
                    <input type="date" name="date" class="form-control" value="<?php echo e($date); ?>">
                </div>
                <div class="col-md-3 d-flex gap-2">
                    <button type="submit" class="btn btn-primary w-100">
                        <i class="fas fa-filter me-2"></i>Filter
                    </button>
                    <a href="<?php echo e(route('accounting.reports.day-book')); ?>" class="btn btn-secondary w-100">
                        <i class="fas fa-times me-2"></i>Clear
                    </a>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="card">
    <div class="card-header bg-light d-flex justify-content-between align-items-center">
        <h5 class="mb-0">Transactions<?php echo e($date ? ' on ' . \Carbon\Carbon::parse($date)->format('F d, Y') : ' (All Dates)'); ?></h5>
    </div>
    
    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover table-bordered mb-0">
                <thead class="table-light">
                    <tr>
                        <th width="15%">Time</th>
                        <th width="20%">Account</th>
                        <th width="15%">Reference</th>
                        <th width="20%">Remarks</th>
                        <th width="15%" class="text-end">Debit In (Rs)</th>
                        <th width="15%" class="text-end">Credit Out (Rs)</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $txn): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($txn->created_at->format('H:i')); ?></td>
                            <td>
                                <strong><?php echo e($txn->account->name ?? 'N/A'); ?></strong>
                                <?php if(isset($txn->chartOfAccount)): ?>
                                    <div class="small text-muted"><?php echo e($txn->chartOfAccount->name); ?></div>
                                <?php endif; ?>
                            </td>
                            <td>
                                <?php if($txn->reference_type): ?>
                                    <span class="badge bg-light text-dark border">
                                        <?php echo e(class_basename($txn->reference_type)); ?> #<?php echo e($txn->reference_id); ?>

                                    </span>
                                <?php else: ?>
                                    -
                                <?php endif; ?>
                            </td>
                            <td><?php echo e($txn->remarks); ?></td>
                            <td class="text-end text-danger fw-bold">
                                <?php echo e($txn->transaction_type == 'debit' ? number_format($txn->amount, 2) : '-'); ?>

                            </td>
                            <td class="text-end text-success fw-bold">
                                <?php echo e($txn->transaction_type == 'credit' ? number_format($txn->amount, 2) : '-'); ?>

                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="6" class="text-center py-4 text-muted">No transactions recorded on this date.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
                <tfoot class="table-light fs-5 fw-bold">
                    <tr>
                        <td colspan="4" class="text-end">Daily Totals:</td>
                        <td class="text-end text-danger">Rs. <?php echo e(number_format($totalDebit, 2)); ?></td>
                        <td class="text-end text-success">Rs. <?php echo e(number_format($totalCredit, 2)); ?></td>
                    </tr>
                </tfoot>
            </table>
        </div>
    </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:\laragon\www\habibcables-ERP\resources\views\accounting\reports\day_book.blade.php ENDPATH**/ ?>