<table id="example77" class="table table-striped table-bordered" style="width:100%">
    <thead>
        <tr>
            <th>Sr.No</th>
            <th>Receipt No</th>
            <th>Patient Name</th>
            <th>Procedure</th>
            <th>Amount</th>
            <th>Payment Date</th>
            <th>Payment Mode</th>
        </tr>
    </thead>
    <tbody>
        @php $i=1;
       
        
        @endphp
        @foreach($data as $result)
        
        <tr>
            <td>{{$i}}</td>
            <td>{{$result->id}}</td>
            <td>{{$result->PatientName}}</td>
            <td>{{$result->InvStName}}</td>
            <td>{{number_format($result->Amount,2)}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->CreatedDate)))}}</td>
            <td>{{$result->PayMode}}</td>
          
        </tr>
        @php $i++;@endphp
        @endforeach
        <tr>
           
             <td>{{$i}}</td>
             <td></td>
             <td></td>
             <th>Total </th>
             <th>{{number_format($sum,2)}}</th>
             <td></td>
             <td></td>
           
             
         
           
            
        </tr>
    </tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
    $('#example77').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>