<table id="example3" class="table table-striped table-bordered dt-responsive nowrap" style="width:100%">
    <thead>
        <tr>
            <th>Sr.No</th>
            <th>Bill No</th>
            <th>Sale Date</th>
            <th>Patient Name</th>
            <th>Subtotal</th>
            <th>Advance</th>
            <th>Paid</th>
            <th>Payment Mode</th>
        </tr>
    </thead>
    <tbody>
        @php $i=1;@endphp
        @foreach($data as $result)
        @if($result->Roll == 1)
        @php $PaidAmount = 0; @endphp
        @else
        @php $PaidAmount = $result->PaidAmount; @endphp
        @endif
        <tr>
            <td>{{$i}}</td>
            <td>{{$result->BillNo}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->SaleDate)))}}</td>
            <td>{{$result->PatientName}}</td>
            <td>&#8377;{{$result->SubTotal}}</td>
            <td>&#8377;{{$result->Advance}}</td>
            <td>&#8377;{{$PaidAmount}}</td>
            <td>{{$result->PayMode}}</td>
        </tr>
        @php $i++;@endphp
        @endforeach
        
    </tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
    $('#example3').DataTable({
        "scrollX": true,
        dom: 'Bfrtip',
        "pageLength": 200,
        buttons: [

            'excelHtml5'

        ]
    });
});
</script>