<html>
<head>
    <style type="text/css" media="all">

       
        #design {
            font-family: Serif;
            border-collapse: collapse;
            width: 100%;
        }

        #design td,
        #design th,
        #design thead, 
        #design tbody {
            border: 1px solid #000;
            font-size: 12px;
        }

        * {
            margin: 2px;
            padding: 2px;
        }
    </style>
</head>
<body>
        
    
            
        <div class="card-body">
            <table class="table table-striped table-bordered " id="salesSumarryTable">
                <thead>
                   
                    <tr>
                       <th>Customer Name</th>
                        <th>Mobile Number</th>
                        <th>Store</th>
                        <th>Registration Date</th>
                        <th>Total Visit</th>
                        <th>Total Amount</th>                       
                        <th>SPS Plan</th>  
                         <th> Discount (%) </th> 
                        <th>Last Visit Date</th>
                        <th>Days Before</th>        
                    </tr>
                </thead>
                 @php $gtotalorder = $gtotalamount = 0 ; @endphp
                @if(!empty($orders))
                <tbody>
                   
                    @foreach($orders as $key => $order)  
                      @php 
                                $gtotalorder = $gtotalorder + $order['totalorder'];
                                $gtotalamount = $gtotalamount + $order['totalamount'];
                      @endphp
                              
                            <tr>
                                <td >{{$order['customer_name']}}</td>
                                <td >{{$order['mobile_number']}}</td>
                               
                                <td >{{$order['store']}}</td>
                                <td >{{$order['plan_date']}}</td>
                                <td >{{$order['totalorder']}}</td>
                                <td >{{$order['totalamount']}}</td>
                                <td >{{$order['plan_name']}}</td>
                                <td >{{$order['discount_sal']}}</td>
                                <td >{{$order['lastvisite']}}</td>
                                <td >{{$order['days']}}</td>
                                       
                            </tr>
                    @endforeach
                </tbody> 
                 <tfoot>
                            <tr>
                                <td colspan='4'></td>                             
                                <td> {{$gtotalorder}}</td>
                                <td> {{$gtotalamount}} </td>
                                 <td colspan='4'></td> 
                            </tr>                   
                </tfoot>
                
                @endif
            </table>
        
    </div> 
</body>
</html>
