<table id="example2" class="table table-striped table-bordered" style="width:100%">
        <thead>
            <tr>
            <th>Sr.No</th>
           <th>Receipt. No</th>
           <th>MRD. No</th>
           <th>Patient Name</th>
           <th>Procedure</th>
           <th>Proc. Amount</th>
           <th>Payment Mode</th>
           @if($paymode == 'Cheque')
           <th>Cheque No</th>
           <th>Cheque Deposite On</th>
           <th>Cheque Credit Date</th>
           @endif
           <th>Date</th>
        </tr>
        </thead>
        <tbody>
        @php $i=1;@endphp
        @foreach($data as $result)
        <tr>
             <td>{{$i}}</td>
             <td>{{$result->ReceiptNo}}</td>
             <td>{{$result->MrdNo}}</td>
             <td>{{$result->PatientName}}</td>
             <td>{{$result->Procedures}}</td>
             <td>&#8377;{{number_format($result->Amount,2)}}</td>
             <td>{{$result->PayMode}}</td>
             @if($paymode == 'Cheque')
             <td>{{$result->ChequeNo}}</td>
             @if($result->ChqDep == '')
             <td>-</td>
             @else
             <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->ChqDep)))}}</td>
             @endif

             @if($result->ChqDate == '')
             <td>-</td>
             @else
             <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->ChqDate)))}}</td>
             @endif
             @endif
             <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->CreatedDate)))}}</td>
         
           
            
        </tr>
        @php $i++;@endphp
        @endforeach

        <tr>
             <td>{{$i}}</td>
             <td></td>
             <td></td>
             <td></td>
             <th>Total </th>
         
            <th>&#8377;{{number_format($sum,2)}}</th>
            @if($paymode == 'Cheque')
            <td></td>
             <td></td>
             <td></td>
            @endif
             <td></td>
             <td></td>
           
             
            
        </tr>
        </tbody>
    </table>
    <script type="text/javascript">
$(document).ready(function() {
    $('#example2').DataTable({
        "scrollX": true,
        dom: 'Bfrtip',
        buttons: [

            'excelHtml5'

        ]
    });
});
</script>