<!DOCTYPE html>
<html lang="mr">
<head>
    <meta charset="UTF-8">
    <title>Receipt</title>
    <style>
        body {
            font-family: 'Mangal', Devanagari, serif;
            padding: 40px;
        }
        .header, .footer {
            text-align: center;
        }
        .content {
            margin-top: 30px;
        }
        .line {
            border-bottom: 1px solid #000;
            display: inline-block;
            min-width: 100px;
        }
        .points {
            margin-top: 20px;
        }
        .points li {
            margin-bottom: 10px;
            margin-left: 5%;
        }
        p {
            font-size: 18px;
        }
        table {
            width: 100%;
            margin-top: 20px;
            border-collapse: collapse; /* Ensure borders collapse to a single line */
        }
        th, td {
            padding: 8px 12px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2; /* Add a light grey background to header */
        }
        /* Border style only for the second table */
        .bordered-table th, .bordered-table td {
            border: 1px solid #000; /* Adding border to cells */
        }
        .sub-header {
            margin-top: 20px;
        }
    </style>
</head>
<body>

    <div class="header">
        @php
        $logoData1 = file_get_contents(public_path('admin/images/favicon.png'));
        $base641Logo = base64_encode($logoData1);
        @endphp
        <img src="data:image/png;base64,{{ $base641Logo }}" alt="Logo" style="float:left;" height="150" width="150">
        <div class="rox">
            <h2>MIRA BHAYANDAR MUNICIPAL CORPORATION</h2>
            <p>Indira Gandhi Bhavan, Chattrapati Shivaji Maharaj Marg, Bhayandar(W), Dist -Thane </p>
            <p>Tel Nos. 022-28192828/ 28193028/ 28181183/ 28181353/ 28145985.</p>
            <h3>( बांधकाम/विद्युत ) विभाग</h3>
        </div>
    </div>

    <hr style="1px solid #000; height:5px; background-color:#000;">

    <div class="sub-header">
        <p>Receipt No.: {{ str_pad($data->id, 4, '0', STR_PAD_LEFT) }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            Date: <span>{{ \Carbon\Carbon::parse($paymentdata->created_at)->format('d/m/Y') }}</span></p>
    </div>

    <table>

         <tr>
            <td><strong>Account name:</strong></td>
            <td>Mira Bhayandar Municipal Corporation General Fund</td>
             <td><strong>Bank Name</strong></td>
            <td>Bank of Baroda</td>
        </tr>

         <tr>
            <td><strong>Account No :</strong></td>
            <td>**********0569</td>
             <td><strong>IFSC Code</strong></td>
            <td>BARB0DBBHAW</td>
        </tr>
        <tr>
            <td><strong>Application No:</strong></td>
            <td>{{ $data->application_no }}</td>
             <td><strong>Payment Date:</strong></td>
            <td>{{ \Carbon\Carbon::parse($paymentdata->created_at)->format('d/m/Y') }}</td>
        </tr>

        <tr>
            <td><strong>Applicant Name :</strong></td>
            <td>{{ $data->applicant_name }}</td>
              <td><strong>Verified Date :</strong></td>
            <td></td>
        </tr>
        <tr>
            <td><strong>Applicant Mobile No :</strong></td>
            <td>{{  $data->mobile_no }}</td>
             <td><strong>Transaction No :</strong></td>
            <td>{{ $paymentdata->orderno }}</td>
        </tr>
        <tr>
            <td><strong>Reference No :</strong></td>
            <td></td>
            <td><strong>Service Name :</strong></td>
            <td>Gardens Filming and Photography Permission</td>
        </tr>
        <tr>
            <td><strong>Received From :</strong></td>
            <td></td>
        </tr>
         <tr>
            <td><strong>PTAX SAC Number  :</strong></td>
            <td></td>
        </tr>
          <tr>
            <td><strong>Demand Note Reference No  :</strong></td>
            <td></td>
        </tr>
    </table>

    <!-- Table with borders applied -->
    <table class="bordered-table">
        <thead>
            <tr>
                <th>Sr No</th>
                <th>Description</th>
                <th>Amount</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>1.</td>
                <td>Certificate Charges</td>
                <td>Rs.{{ $paymentdata->amount }}</td>
            </tr>

        </tbody>
        <tfoot>
            <tr>
                <td></td>
                <td >Gross Amount</td>
                <td>Rs. {{ $paymentdata->amount }}</td>
            </tr>

        </tfoot>
    </table>
     <?php
    $number = $paymentdata->amount;
    $no = floor($number);
    $point = round($number - $no, 2) * 100;
    $hundred = null;
    $digits_1 = strlen($no);
    $i = 0;
    $str = [];
    $words = ['0' => '', '1' => 'one', '2' => 'two', '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six', '7' => 'seven', '8' => 'eight', '9' => 'nine', '10' => 'ten', '11' => 'eleven', '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' => 'nineteen', '20' => 'twenty', '30' => 'thirty', '40' => 'forty', '50' => 'fifty', '60' => 'sixty', '70' => 'seventy', '80' => 'eighty', '90' => 'ninety'];
    $digits = ['', 'hundred', 'thousand', 'lakh', 'crore'];
    while ($i < $digits_1) {
        $divider = $i == 2 ? 10 : 100;
        $number = floor($no % $divider);
        $no = floor($no / $divider);
        $i += $divider == 10 ? 1 : 2;
        if ($number) {
            $plural = ($counter = count($str)) && $number > 9 ? 's' : null;
            $hundred = $counter == 1 && $str[0] ? ' and ' : null;
            $str[] = $number < 21 ? $words[$number] . ' ' . $digits[$counter] . $plural . ' ' . $hundred : $words[floor($number / 10) * 10] . ' ' . $words[$number % 10] . ' ' . $digits[$counter] . $plural . ' ' . $hundred;
        } else {
            $str[] = null;
        }
    }
    $str = array_reverse($str);
    $result = implode('', $str);
    $title = 'Amount In Word :- ';
    $points = $point ? ' and ' . $words[floor($point / 10) * 10] . ' ' . $words[$point % 10] . ' Paise' : '';
    echo '<strong>' . $title . "Rupees " . ucfirst(trim($result)) . $points . '</strong>';
    ?>
      <p style="margin-top:40%; text-align:center;">Note : This is Computer generated Receipt, hence no Signature require.</p>

</body>
</html>
