<table id="example8" class="table table-striped table-bordered " style="width:100%">
    <thead>
        <tr>
            <th>Sr.No</th>
            <th>MRD No</th>
            <th>IPD No</th>
            <th>Eye</th>
            <th>Name</th>
            <th>Mobile</th>
            <th>Age</th>
            <th>Gender</th>
            <th>Consl Date</th>
            <th>Surgery Dt</th>
            <th>Srg.Nm</th>
            <th>Surgery Name</th>
             <th>Confirm for Surgery</th>
             <th>Counselor</th>
            <th>Amount</th>
            <th>IOL</th>
             <th>Type</th>
            <th>Payment 1 </th>
            <th>Amount 1 </th>
            <th>Payment 2 </th>
            <th>Amount 2 </th>
            <th>Payment 3 </th>
            <th>Amount 3 </th>
            <th>NEFT </th>
            <th>Amount  </th>
            
        </tr>
    </thead>
    <tbody>
        <?php $i=1;
        use App\Http\Controllers\ConsentController;
        foreach($data as $result){
          $SurgeonName = $result->SurgeonName;
          $docname = (new ConsentController)->getSurgeonName($SurgeonName);?>
        <tr>
            <td>{{$i}}</td>
            <td>{{$result->MrdNo}}</td>
            <td>{{$result->IpdNo}}</td>
            <td>{{$result->Eye}}</td>
           <td>{{$result->PatientName}}</td>
            <td>{{$result->Phone}}</td>
            <td>{{$result->Age}}</td>
            <td>{{$result->Gender}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->CounsellingDate)))}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->SurgeryDate)))}}</td>
            <td>{{$docname}}</td>
            <td>{{$result->SurgeryName}}</td>
            <td><?= $result->ConfirmSurgery ?></td>
            <td><?= $result->CounsellingDoneBy ?></td>
            <td>{{$result->SurgeryCharges}}</td>
            <td>{{$result->Iol}}</td>
             <td>
    @if(!empty($result->payment_type1)) {{ $result->payment_type1 }}<br> @endif
    @if(!empty($result->payment_type2)) {{ $result->payment_type2 }}<br> @endif
    @if(!empty($result->payment_type3)) {{ $result->payment_type3 }}<br> @endif
    @if(!empty($result->payment_type4)) {{ $result->payment_type4 }} @endif
</td>
            <td>{{$result->Payment1}}</td>
           <td>{{$result->Amount1}}</td>
           <td>{{$result->Payment2}}</td>
           <td>{{$result->Amount2}}</td>
           <td>{{$result->Payment3}}</td>
           <td>{{$result->Amount3}}</td>
           <td>{{$result->Payment4}}</td>
           <td>{{$result->Amount4}}</td>
           
        </tr>
        <?php $i++;}?>
        
    </tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
    $('#example8').DataTable({
        scrollX: true,             // Horizontal scroll
        fixedHeader: true,         // Fix thead at top
        pageLength: 5000,           // Show 500 rows
        dom: 'Bfrtip',             // Export buttons on top
        buttons: ['excelHtml5'],    // Excel export
        "scrollY": "400px"
    });
});
</script>