<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bank 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;
        }

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

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

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

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

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

        .bank-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-danger {
            background: #f8d7da;
            color: #721c24;
        }

        .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;
            }

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

            .bank-book-table th,
            .bank-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">
        <d style="text-align: center; margin-bottom: 30px;">
                <h1 style="margin: 0; font-size: 32px; font-weight: bold;">STARUP MIND</h1>
                <p style="margin: 5px 0 0; font-size: 16px;">Your Trusted Technology Partner</p>

        <!-- Report Title -->
        <div class="report-title">BANK 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>
            <?php if($bankAccountId): ?>
                <br>
                Account: <strong><?php echo e($bankAccounts->find($bankAccountId)->bank_name ?? ''); ?> - <?php echo e($bankAccounts->find($bankAccountId)->account_name ?? ''); ?></strong>
            <?php else: ?>
                <br>
                Account: <strong>All Accounts</strong>
            <?php endif; ?>
        </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 Deposits</div>
                <div class="summary-card-value"><?php echo e(number_format($totalDeposits, 2)); ?></div>
            </div>
            <div class="summary-card">
                <div class="summary-card-label">Total Withdrawals</div>
                <div class="summary-card-value"><?php echo e(number_format($totalWithdrawals, 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="bank-book-table">
            <thead>
                <tr>
                    <th style="width: 8%;">Date</th>
                    <th style="width: 8%;">Type</th>
                    <th style="width: 18%;">Account</th>
                    <th style="width: 20%;">Details</th>
                    <th style="width: 10%;">Deposits</th>
                    <th style="width: 10%;">Withdrawals</th>
                    <th style="width: 10%;">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">Deposit</span>
                            <?php else: ?>
                                <span class="badge badge-danger">Withdrawal</span>
                            <?php endif; ?>
                        </td>
                        <td><?php echo e($transaction->bankAccount->bank_name ?? '-'); ?></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="7" class="text-center">No transactions found for the selected period.</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>

        <!-- Verification Section -->
        <table class="bank-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 Deposits</strong></td>
                <td style="text-align: right;"><strong><?php echo e(number_format($totalDeposits, 2)); ?></strong></td>
            </tr>
            <tr style="background: #ecf0f1;">
                <td><strong>Less: Total Withdrawals</strong></td>
                <td style="text-align: right;"><strong>(<?php echo e(number_format($totalWithdrawals, 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\sarvice-accounts\accounting-system\resources\views/reports/bank-book-print.blade.php ENDPATH**/ ?>