<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/css">
 body {
        margin-top: 0px;
        margin-left: 0px;
        margin-right: 0px;
        margin-bottom: 0px;

    }

    table,
    th,
    td {
        border: 1px solid #CCCCCC;
        border-collapse: collapse;
        
    }

    .font {
        font-family: Arial;
    }

    .mainheading {
        font-size: 12px;
    }

    .subheading {
        font-size: 12px;
    }
@media    print {
        @page    {
            margin-top: 30px;
            margin-bottom: 30px;
        }

        .noPrint {
            display: none;
        }
    }

.addrfont {font-family: "Poppins Light";
        font-size: 9pt;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;

        color: #000000;
}
.tdbrd1 {border: 1px solid #ada9a9;
        border-collapse: collapse;
        font-family: Poppins;
        font-size: 11px;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;

        color: #4C4C4C;
}
.tophdfnt {font-family: "Poppins Medium";
        font-size: 14pt;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;

        color: #000000;
        letter-spacing: 0.3mm;
}
.txtdegree {        border-collapse: collapse;
        font-family: "Poppins Light";
        font-size: 8pt;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;
        color: #424242;
        word-spacing: normal;
}
.txtdrname {font-family: "Poppins Light";
        font-size: 9pt;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;

        color: #000000;
}
.tophdfnt {
        font-family: "Poppins Medium";
        font-size: 13pt;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;

        color: #000000;
        letter-spacing: 0.3mm;
    }
.alltextfont {
        font-family: Poppins;
        font-size: 12px;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;

        color: #4C4C4C;
    }
.txtnabhlogo {font-family: "Poppins Medium";
        font-size: 7pt;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        font-variant: normal;
        letter-spacing: 0.2mm color: #000000;
        letter-spacing: 0.3mm;
}
</style>
</head>
<script type="text/javascript">
  // window.print();
  // window.onafterprint = window.close;	
</script>

<body>
<table width="700" border="0" cellspacing="0" cellpadding="2" >
<tr class="noPrint">
            <td style="float:right;"><button align="center" style="text-align:center;font-size: 18px;width: 100px;"
                    onclick="window.print();" class="noPrint">Print</button>            </td>
        </tr>
  <tr>
    <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="tdbrd1">
      <tr>
        <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-bottom: 10px;padding-top:10px;">
          <tr>
            <td width="35%" align="center" valign="middle" ><img src="{{url('logo.jpg')}}"></td>
            <td width="39%" align="center" valign="middle"><span class="txtdegree"><strong>Khaparde Garden, Near Irwin Square,<br>
              Netradan Road,
              Amravati -444601<br>
              Ph:(0721) 2663151
              | Mob :
              8698249358</strong><br>
              website : www.deshmukheyehospital.com</span></td>
            <td width="26%" align="center" valign="middle"><img src="{{url('nabh.jpg')}}"></td>
          </tr>
        </table></td>
      </tr> 
    </table>
      <br />
      <table width="100%" border="0" cellspacing="0" cellpadding="3">
        <tr>
          <td align="center" valign="top" bgcolor="#CCCCCC" class="tophdfnt">BILL </td>
        </tr>
        <tr>
          <td><table width="100%" border="0" cellspacing="0" cellpadding="4" >
            <tr>
              <td width="15%" align="left" valign="top" class="alltextfont ">Bill No </td>
              <td width="3%" align="center" valign="top" ><span class="style42">:</span></td>
              <td width="46%" align="left" valign="middle" class="alltextfont " >&nbsp;{{$BillNo}}</td>
              <td width="18%" align="left" valign="top" class="alltextfont ">Bill Date</td>
              <td width="2%" align="center" valign="top" >:</td>
              <td width="16%" align="left" valign="middle" class="alltextfont ">&nbsp;{{date("d/m/Y", strtotime(str_replace('-', '/',$data[0]->BillDate)))}}</td>
            </tr>
            <tr>
              <td align="left" valign="top" class="alltextfont ">Name</td>
              <td align="center" valign="top" class="alltextfont "><span class="style42">:</span></td>
              <td align="left" valign="middle" class="alltextfont ">&nbsp;{{$data[0]->PatientName}}</td>
              <td class="alltextfont ">Operation Date </td>
              <td >:</td>
              <td align="left" valign="middle" class="alltextfont " >&nbsp;{{date("d/m/Y", strtotime(str_replace('-', '/',$data[0]->OperationDate)))}}</td>
              
              
          </tr>
            <tr>
              
              
              <td class="alltextfont ">MRD. NO </td>
              <td >:</td>
              <td align="left" valign="middle" class="alltextfont " >&nbsp;{{$data[0]->MrdNo}}</td>
              <td align="left" valign="top" class="alltextfont ">Age / Gender </td>
              <td align="center" valign="top" class="alltextfont "><span class="style42">:</span></td>
              <td align="left" valign="middle" class="alltextfont ">&nbsp;{{$data[0]->AgeGender}}</td>
          </tr>
            <tr>
              <td align="left" valign="top" class="alltextfont ">Address </td>
              <td align="center" valign="top" class="alltextfont "><span class="style42">:</span></td>
              <td align="left" valign="middle" class="alltextfont ">&nbsp;{{$data[0]->Address}}</td>
            <td class="alltextfont ">Mobile</td>
              <td >:</td>
              <td align="left" valign="middle" class="alltextfont " >&nbsp;{{$data[0]->Phone}}</td>
             
           
              </tr>
            <tr>
              <td align="left" valign="top" class="alltextfont ">Payment For </td>
              <td align="center" valign="top" class="alltextfont "><span class="style42">:</span></td>
              <td align="left" valign="middle" class="alltextfont " colspan="4">&nbsp;{{$data[0]->Diagnosis}}</td>
           
           
              </tr>
            </table></td>
        </tr>
        
        
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="center" valign="top" bgcolor="#CCCCCC" class="alltextfont" ><strong>DETAILS</strong></td>
        </tr>
        <tr>
          <td><table width="100%" border="0" cellspacing="3" cellpadding="10">
            <tr>
              <td width="76%" align="left" valign="top" bgcolor="#CCCCCC" class="alltextfont ">Particulars</td>
              <td width="24%" align="right" valign="top" bgcolor="#CCCCCC" class="alltextfont ">Amount</td>
            </tr>
            @php $total=0;@endphp;
            @foreach($data2 as $result)
            @php $total+=$result->Amount;@endphp
                        <tr>
            <td align="left" valign="top" class="alltextfont">&nbsp;{{$result->Name}}</td>
            <td align="right" valign="top" class="alltextfont">&nbsp;&#8377;{{number_format($result->Amount,2)}}</td>
          </tr>
          @endforeach
                      <tr>
              
            <tr>
            <td align="right" valign="top" class="alltextfont"><strong>Subtotal : </strong> </td>
            <td align="right" valign="top" class="alltextfont"><strong>&nbsp;&#8377;{{number_format($total,2)}}</strong></td>
          </tr>
            <!-- <tr>
            <td align="right" valign="top"><span class="style65">Balance : </span></td>
            <td align="right" valign="top">&nbsp;&#8377;0.00</td>
          </tr>
          <tr>
            <td align="right" valign="top"><span class="style65">Gross Amount : </span></td>
            <td align="right" valign="top">&nbsp;&#8377;18,000.00</td>
          </tr> -->

          @php $number = $total;@endphp
<?php
$no = floor($number);
   $point = round($number - $no, 2) * 100;
   $hundred = null;
   $digits_1 = strlen($no);
   $i = 0;
   $str = array();
   $words = array(
    '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 = array('', '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);
  $result2 = implode('', $str);
  $points = ($point) ?
    "." . $words[$point / 10] . " " . 
          $words[$point = $point % 10] : '';
  ?>
          <tr>
            <td align="left" valign="top" class="alltextfont">
            <strong> In Words : <?php echo $result2 . "RUPEES  " . $points . "";?>  </strong><br>
              <strong>Payment Mode : </strong> {{$data[0]->PayMode}}
            </td>
            <td align="right" valign="top">&nbsp;</td>
          </tr>
          
            
            </table></td>
        </tr>
        <br><br>
        <tr style="padding-top:20px;">
          
          <td align="right" valign="bottom" height="100" class="alltextfont" style="padding-top:30px;">
           
            For Deshmukh Eye Hospital </td>
        </tr>
        
    </table></td></tr>
</table>
</body>
</html>
