<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cash Book Report</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.5;
            color: #333;
            background: #f5f5f5;
        }

        @media print {
            body {
                background: white;
            }
            .no-print {
                display: none !important;
            }
        }

        .report-container {
            max-width: 12in;
            margin: 20px auto;
            padding: 30px;
            background: white;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .report-header {
            border-bottom: 3px solid #2c3e50;
            margin-bottom: 20px;
            padding-bottom: 15px;
        }

        .company-logo {
            font-size: 24px;
            font-weight: bold;
            color: #2c3e50;
            margin-bottom: 5px;
        }

        .company-info {
            font-size: 11px;
            color: #666;
            line-height: 1.4;
        }

        .report-title {
            text-align: center;
            font-size: 18px;
            font-weight: bold;
            color: #2c3e50;
            margin-top: 15px;
            margin-bottom: 10px;
        }

        .report-period {
            text-align: center;
            font-size: 12px;
            color: #666;
            margin-bottom: 20px;
        }

        .summary-cards {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
            margin-bottom: 20px;
        }

        .summary-card {
            border: 1px solid #ddd;
            padding: 12px;
            border-radius: 4px;
            background: #f9f9f9;
        }

        .summary-card-label {
            font-size: 10px;
            color: #666;
            text-transform: uppercase;
            font-weight: 600;
            margin-bottom: 5px;
        }

        .summary-card-value {
            font-size: 14px;
            font-weight: bold;
            color: #2c3e50;
        }

        .cash-book-table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            font-size: 11px;
        }

        .cash-book-table thead {
            background: #34495e;
            color: white;
        }

        .cash-book-table th {
            padding: 10px 8px;
            text-align: left;
            font-weight: 600;
            border: 1px solid #34495e;
        }

        .cash-book-table td {
            padding: 8px;
            border: 1px solid #ddd;
            border-bottom: 1px solid #e0e0e0;
        }

        .cash-book-table tbody tr:nth-child(even) {
            background: #f9f9f9;
        }

        .cash-book-table tbody tr:hover {
            background: #f0f0f0;
        }

        .text-center {
            text-align: center;
        }

        .text-end {
            text-align: right;
        }

        .badge {
            display: inline-block;
            padding: 3px 6px;
            border-radius: 3px;
            font-size: 9px;
            font-weight: 600;
        }

        .badge-success {
            background: #d4edda;
            color: #155724;
        }

        .badge-warning {
            background: #fff3cd;
            color: #856404;
        }

        .badge-secondary {
            background: #e2e3e5;
            color: #383d41;
        }

        .print-button {
            display: inline-block;
            margin: 20px auto;
            padding: 10px 20px;
            background: #3498db;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }

        .print-button:hover {
            background: #2980b9;
        }

        .no-print-container {
            text-align: center;
            margin: 20px 0;
        }

        .section-title {
            font-size: 12px;
            font-weight: bold;
            color: #2c3e50;
            margin-bottom: 8px;
            margin-top: 15px;
            padding-bottom: 5px;
            border-bottom: 2px solid #34495e;
        }

        @media print {
            .print-button {
                display: none;
            }

            .report-container {
                box-shadow: none;
                margin: 0;
                padding: 30px;
            }
        }

        @media (max-width: 1024px) {
            .summary-cards {
                grid-template-columns: repeat(2, 1fr);
            }

            .report-container {
                max-width: 100%;
                margin: 0;
                padding: 15px;
            }

            .cash-book-table {
                font-size: 10px;
            }

            .cash-book-table th,
            .cash-book-table td {
                padding: 6px 4px;
            }
        }
    </style>
</head>
<body>
    <div class="no-print-container no-print">
        <button class="print-button" onclick="window.print()">🖨️ Print Report</button>
    </div>

    <div class="report-container">
        <!-- Report Header -->
        <div class="report-header">
            <div class="company-logo">JANNAT ACCOUNTING SYSTEM</div>
            <div class="company-info">
                Cash Book Report<br>
                Generated on <?php echo e(now()->format('d M Y, H:i A')); ?>

            </div>
        </div>

        <!-- Report Title -->
        <div class="report-title">CASH BOOK</div>
        <div class="report-period">
            Period: <strong><?php echo e(\Carbon\Carbon::parse($fromDate)->format('d M Y')); ?></strong> to
            <strong><?php echo e(\Carbon\Carbon::parse($toDate)->format('d M Y')); ?></strong>
        </div>

        <!-- Summary Cards -->
        <div class="summary-cards">
            <div class="summary-card">
                <div class="summary-card-label">Opening Balance</div>
                <div class="summary-card-value"><?php echo e(number_format($openingBalance, 2)); ?></div>
            </div>
            <div class="summary-card">
                <div class="summary-card-label">Total Receipts</div>
                <div class="summary-card-value"><?php echo e(number_format($totalReceipts, 2)); ?></div>
            </div>
            <div class="summary-card">
                <div class="summary-card-label">Total Payments</div>
                <div class="summary-card-value"><?php echo e(number_format($totalPayments, 2)); ?></div>
            </div>
            <div class="summary-card">
                <div class="summary-card-label">Closing Balance</div>
                <div class="summary-card-value"><?php echo e(number_format($closingBalance, 2)); ?></div>
            </div>
        </div>

        <!-- Transactions Table -->
        <div class="section-title">Transaction Details</div>
        <table class="cash-book-table">
            <thead>
                <tr>
                    <th style="width: 8%;">Date</th>
                    <th style="width: 8%;">Type</th>
                    <th style="width: 25%;">Details</th>
                    <th style="width: 10%;">Receipts</th>
                    <th style="width: 10%;">Payments</th>
                    <th style="width: 12%;">Balance</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td class="text-center"><?php echo e($transaction->date->format('d/m/y')); ?></td>
                        <td class="text-center">
                            <?php if($transaction->type == 'income'): ?>
                                <span class="badge badge-success">Income</span>
                            <?php else: ?>
                                <span class="badge badge-warning">Expense</span>
                            <?php endif; ?>
                        </td>
                        <td><?php echo e(substr($transaction->details ?? '-', 0, 30)); ?></td>
                        <td class="text-end">
                            <?php if($transaction->type == 'income'): ?>
                                <?php echo e(number_format($transaction->amount, 2)); ?>

                            <?php else: ?>
                                -
                            <?php endif; ?>
                        </td>
                        <td class="text-end">
                            <?php if($transaction->type == 'expense'): ?>
                                <?php echo e(number_format($transaction->amount, 2)); ?>

                            <?php else: ?>
                                -
                            <?php endif; ?>
                        </td>
                        <td class="text-end"><strong><?php echo e(number_format($transaction->balance_after, 2)); ?></strong></td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="6" class="text-center">No transactions found for the selected period.</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>

        <!-- Verification Section -->
        <table class="cash-book-table" style="margin-top: 30px;">
            <tr style="background: #ecf0f1;">
                <td><strong>Opening Balance</strong></td>
                <td style="text-align: right;"><strong><?php echo e(number_format($openingBalance, 2)); ?></strong></td>
            </tr>
            <tr style="background: #ecf0f1;">
                <td><strong>Add: Total Receipts</strong></td>
                <td style="text-align: right;"><strong><?php echo e(number_format($totalReceipts, 2)); ?></strong></td>
            </tr>
            <tr style="background: #ecf0f1;">
                <td><strong>Less: Total Payments</strong></td>
                <td style="text-align: right;"><strong>(<?php echo e(number_format($totalPayments, 2)); ?>)</strong></td>
            </tr>
            <tr style="background: #34495e; color: white; font-weight: bold;">
                <td>Closing Balance</td>
                <td style="text-align: right;"><?php echo e(number_format($closingBalance, 2)); ?></td>
            </tr>
        </table>

        <!-- Footer -->
        <div style="margin-top: 40px; padding-top: 20px; border-top: 1px solid #ddd; text-align: center; font-size: 10px; color: #666;">
            <p>This is a computer-generated report. No signature required.</p>
            <p>Report Generated on <?php echo e(now()->format('d M Y')); ?> at <?php echo e(now()->format('H:i A')); ?></p>
        </div>
    </div>
</body>
</html>
<?php /**PATH C:\Users\startup sabbir\Desktop\jannat\accounting-system\resources\views/reports/cash-book-print.blade.php ENDPATH**/ ?>