<table id="example" class="table table-striped table-bordered" style="width:100%">
        <thead>
            <tr>
            <th>Sr.No</th>
           <th>Mrd. No</th>
           <th>Name</th>
           <th>Fees</th>
           <th>Payment Mode</th>
           <th>Age/Gender</th>
           <th>Consultant</th>
           <th>Optometrist</th>
           <th>Users</th>
           <th>Date</th>
           <th>Out Time</th>
          
            </tr>
        </thead>
        <tbody>
        @php $i=1;@endphp
        @foreach($data as $result)
        <tr>
             <td>{{$i}}</td>
             <td>{{$result->MrdNo}}</td>
             <td>{{strtoupper(strtolower($result->PatientName))}}</td>
             <td>{{number_format($result->Amount,2)}}</td>
             <td>{{$result->PayMode}}</td>
             <td>{{$result->Age}}/{{$result->Gender}}</td>
          
             <td>{{$result->ConsultantName}}</td>
             <td>{{$result->ConfirmOpto}}</td>
<td>{{$result->CreatedByName}}</td>

             <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->InDate)))}}</td>
         
             <td>{{date("h:i a", strtotime(str_replace('-', '/',$result->OutTime)))}}</td>
            
        </tr>
        @php $i++;@endphp
        @endforeach

        <tr>
             <td>{{$i}}</td>
             <td></td>
             <th>Total </th>
         
            <th>{{number_format($sum,2)}}</th>
             <td></td>
             <td></td>
             <td></td>
          
             <td></td>
             <td></td>
             <td></td>
             <td></td>
          
             
            
        </tr>
        </tbody>
    </table>
    <script type="text/javascript">
$(document).ready(function() {
    $('#example').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>