<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Receipt Voucher Print</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      margin: 0;
      background: #fff;
    }

    .receipt-box {
      border: 0.8px solid #000;
      padding: 20px;
      max-width: 500px;
      margin: 40px auto;
      background: #fff;
    }

    .logo {
      text-align: center;
      margin-bottom: 10px;
    }

    .logo img {
      height: 100px;
    }

    .centered {
      text-align: center;
      margin: 10px 0;
    }

    .field-row {
      display: flex;
      justify-content: space-between;
      margin: 8px 0;
    }

    .field-row span {
      font-weight: bold;
    }

    .bordered {
      border: 0.8px solid #000;
      padding: 6px 10px;
      min-width: 80px;
      text-align: center;
    }

    .double-box {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-bottom: 15px;
    }

    hr {
      margin: 15px 0;
      border: 0.8px solid #000;
    }

    .print-btn {
      text-align: center;
      margin-bottom: 40px;
    }

    .print-btn button {
      background-color: #2e7d32;
      color: white;
      padding: 10px 20px;
      border: none;
      font-size: 16px;
      cursor: pointer;
    }

    .print-btn button:hover {
      background-color: #1b5e20;
    }

    @media print {
      .print-btn {
        display: none;
      }
    }
  </style>
</head>
<body>

            <div class="receipt-box">

  <div class="logo">
    <img src="<?= base_url() . 'assets/uploads/logos/' . $biller->logo; ?>" alt="BM Trading Co Logo">
  </div>

  <div class="field-row">
    <span>MAC Address:</span> <span>e4e11287ad6d</span>
  </div>

  <div class="centered" style="margin-top: 20px;">
    <div>سند القبض</div>
    <div style="font-weight: bold;">Receipt Voucher</div>
  </div>

  <div class="double-box">
    <div class="bordered"><?= $this->sma->formatMoney(($return_sale ? ($inv->grand_total+$return_sale->grand_total) : $inv->grand_total) - ($return_sale ? ($inv->paid+$return_sale->paid) : $inv->paid)); ?></div>
    <div class="bordered">BALANCE AMOUNT</div>
  </div>

  <div class="centered" style="font-weight: bold; margin-top: 10px;">
    المبلغ المدفوع
  </div>

  <div class="double-box">
    <div class="bordered"><?php echo $this->sma->formatMoney($payment->amount); ?></div>
    
  </div>

  <div class="field-row">
    <span>Date:</span> <span><?= $this->sma->hrld($payment->date); ?></span>
  </div>

  <div class="field-row" style="flex-direction: column;">
    <span>Received from Mr/Ms:</span>
    <span><?= $customer->company ? $customer->company : $customer->name; ?></span>
  </div>

  <div class="field-row">
    <span>The Amount:</span> <span><?php echo $this->sma->formatMoney($payment->amount); ?></span>
  </div>

  <div class="field-row">
    <span>Bank:</span> <span>________________</span>
  </div>

  <div class="field-row">
    <span>Cash/Cheque:</span> <span><?php echo lang($payment->paid_by);
                                if ($payment->paid_by == 'gift_card' || $payment->paid_by == 'CC') {
                                    echo ' (' . $payment->cc_no . ')';
                                } elseif ($payment->paid_by == 'Cheque') {
                                    echo ' (' . $payment->cheque_no . ')';
                                }
                                ?></span>
  </div>

  <div class="field-row">
    <span>For:</span> <span>________________________</span>
  </div>

  <hr>

  <div class="field-row">
    <span>Received by:</span> <span>________________________</span>
  </div>
</div>


<div class="print-btn">
  <button onclick="window.print()">PRINT</button>
</div>

</body>
</html>