<?php
    use Carbon\Carbon;

    // Use created_at as repayment date
    $repaymentDate = Carbon::parse($getData->repaymentDate)->format('d M Y');
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Repayment Receipt</title>
    <style>
        body {
            width: 270px; /* For 80mm POS printers. Use 180px for 58mm */
            font-family: 'Courier New', Courier, monospace;
            font-size: 12px;
            padding: 5px;
            margin: 0 auto;
        }

        .center {
            text-align: center;
        }

        .bold {
            font-weight: bold;
        }

        .line {
            border-top: 1px dashed #000;
            margin: 5px 0;
        }

        .receipt-section {
            margin: 5px 0;
        }

        .label {
            display: inline-block;
            width: 110px;
        }

        img.logo {
            max-width: 80px;
            margin-bottom: 5px;
        }

        @media print {
            @page {
                size: auto;
                margin: 0;
            }

            .no-print {
                display: none;
            }
        }
    </style>

    <script>
        // Get current print time in JS (local time)
        function setPrintTime() {
            const now = new Date();
            const printTime = now.toLocaleString('en-GB', {
                day: '2-digit', month: 'short', year: 'numeric',
                hour: '2-digit', minute: '2-digit', hour12: true
            });
            document.getElementById("printTime").textContent = printTime;
        }

        window.onload = function () {
            setPrintTime();
            window.print();
        };
    </script>
</head>
<body>
    <div class="center">
        
        <img src="<?php echo e(asset('assets/img/logo.png')); ?>" alt="Logo" class="logo">
        <div class="bold">MICROFINANCE</div>
        <div>Sagama Rd, Akkaraipattu</div>
        <div>067-2277276 / 077-2242265</div>
    </div>

    <div class="line"></div>
    <div class="center bold">REPAYMENT RECEIPT</div>
    <div class="center"><strong>Repayment Date:</strong> <?php echo e($repaymentDate); ?></div>
    <div class="center"><strong>Printed Date:</strong> <span id="printTime"></span></div>
    <div class="line"></div>

    <div class="receipt-section">
        <div><span class="label">Txn ID</span>: <?php echo e($getData->transectionId); ?></div>
        <div><span class="label">FO Name</span>: <?php echo e($getmemApproverDetails->name); ?></div>
    </div>

    <div class="receipt-section">
        <div class="bold">Member Info</div>
        <div><span class="label">Name</span>: <?php echo e($getmemDetails->firstName); ?> <?php echo e($getmemDetails->lastName); ?></div>
        <div><span class="label">NIC</span>: <?php echo e($getmemDetails->nicNumber); ?></div>
        <div><span class="label">Member No</span>: <?php echo e($getmemDetails->oldAccountNumber); ?></div>
    </div>

    <div class="receipt-section">
        <div class="bold">Loan Payment</div>
        <div><span class="label">Loan ID</span>: <?php echo e($getloanDetails->id); ?></div>

        <div><span class="label">Loan Amount</span>: Rs. <?php echo e(number_format($getloanDetails->principal, 2)); ?></div>
        <div><span class="label">Principal</span>: Rs. <?php echo e(number_format($getData->principalAmount, 2)); ?></div>
        <div><span class="label">Interest</span>: Rs. <?php echo e(number_format($getData->interest, 2)); ?></div>
        <div><span class="label">Total Paid</span>: Rs. <?php echo e(number_format($getData->repaymentAmount, 2)); ?></div>
        <div><span class="label">Outstanding</span>: Rs. <?php echo e(number_format($getData->lastLoanBalance, 2)); ?></div>
    </div>

    <div class="receipt-section">
        <div class="bold">Saving Payment</div>
        <div><span class="label">This Payment</span>: Rs. <?php echo e(number_format($getData->savingAmount, 2)); ?></div>
        <div><span class="label">Total Saving</span>: Rs. <?php echo e(number_format($getmemSavDetails->totalAmount, 2)); ?></div>
    </div>

    <div class="line"></div>
    <div class="center">Thank you!</div>
    <div class="center">Better Life for All</div>
</body>
</html>
<?php /**PATH /home/techhdyz/new.technathi.cloud/resources/views/receipts/repayment_recipet.blade.php ENDPATH**/ ?>