<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <link rel="stylesheet" href="{{ asset('vendor/bootstrap/dist/css/bootstrap.min.css') }}">
        <style type="text/css">
            @import url("https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800");
            @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600,700");
            @import url("https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700");
            @import url("https://fonts.googleapis.com/css?family=Roboto:400,500,700");
            @import url("https://fonts.googleapis.com/css?family=Nunito:400,600,700");
        </style>
    </head>
    <body>
        @php
            $ticket_date_crt = date("d-M-Y", strtotime($ticket_date));
        @endphp
        <span style="text-align: center;"><u><b>{{$org_name}}</b></u><br></span>
        <span style="text-align: center;"><u><b>CONSOLIDATED REPORT FOR THE INVOICE DATE {{$ticket_date_crt}}</b></u><br></span>
        <table width="100%" class="table" style="font-size: 70%;" border="1">
            <thead class="thead-info">
                <tr>
                    <th>Sl No</th>
                    <th>Facility Name</th>
                    <th># of Tickets</th>
                    <th># of Adults</th>
                    <th># of Child</th>
                    <th>Online Amount</th>
                    <th>Offline (Cash)</th>
                    <th>Offline (Card)</th>
                    <th>Offline (UPI)</th>
                    <th>Refund Amount</th>
                    <th>Net Amount</th>
                </tr>
            </thead>
            <tbody>
                @php
                    $n = 0;
                    $total_online_amt = 0;
                    $total_cash_amt = 0;
                    $total_card_amt = 0;
                    $total_upi_amt = 0;
                    $total_refund_amt = 0;
                    $total_net_amt = 0;
                @endphp
                @foreach($facility_list as $facility_id)
                    @if($ticket_count[$facility_id]!=0)
                        @php
                            $n++;
                        @endphp
                        <tr>
                            <td>{{$n}}</td>
                            <td>
                                @if(isset($facility_name[$facility_id]))
                                    {{$facility_name[$facility_id]}}
                                @endif
                            </td>
                            <td>
                                @if(isset($ticket_count[$facility_id]))
                                    {{$ticket_count[$facility_id]}}
                                @endif
                            </td>
                            <td>
                                @if(isset($adult_count[$facility_id]))
                                    {{$adult_count[$facility_id]}}
                                @endif
                            </td>
                            <td>
                                @if(isset($child_count[$facility_id]))
                                    {{$child_count[$facility_id]}}
                                @endif
                            </td>
                            <td style="text-align: center;">
                                @if(isset($online_ticket_amount[$facility_id]))
                                    {{$online_ticket_amount[$facility_id]}}
                                    @php
                                        $total_online_amt += $online_ticket_amount[$facility_id];
                                    @endphp
                                @endif
                            </td>
                            <td style="text-align: center;">
                                @if(isset($cash_ticket_amount[$facility_id]))
                                    {{$cash_ticket_amount[$facility_id]}}
                                    @php
                                        $total_cash_amt += $cash_ticket_amount[$facility_id];
                                    @endphp
                                @endif
                            </td>
                            <td style="text-align: center;">
                                @if(isset($card_ticket_amount[$facility_id]))
                                    {{$card_ticket_amount[$facility_id]}}
                                    @php
                                        $total_card_amt += $card_ticket_amount[$facility_id];
                                    @endphp
                                @endif
                            </td>
                            <td style="text-align: center;">
                                @if(isset($upi_ticket_amount[$facility_id]))
                                    {{$upi_ticket_amount[$facility_id]}}
                                    @php
                                        $total_upi_amt += $upi_ticket_amount[$facility_id];
                                    @endphp
                                @endif
                            </td>
                            <td style="text-align: center;">
                                @if(isset($refund_amount[$facility_id]))
                                    {{$refund_amount[$facility_id]}}
                                    @php
                                        $total_refund_amt += $refund_amount[$facility_id];
                                    @endphp
                                @endif
                            </td>
                            <td style="text-align: center;">
                                @if(isset($totalamount[$facility_id]))
                                    {{$totalamount[$facility_id]}}
                                    @php
                                        $total_net_amt += $totalamount[$facility_id];
                                    @endphp
                                @endif
                            </td>                                                                    
                        </tr>
                    @endif
                @endforeach
            </tbody>
            <tfoot class="tfoot-info">
                <tr>
                    <th>Total</th>
                    <th>&nbsp;</th>
                    <th>&nbsp;</th>
                    <th>&nbsp;</th>
                    <th>&nbsp;</th>
                    <th align="right">{{$total_online_amt}}</th>
                    <th align="right">{{$total_cash_amt}}</th>
                    <th align="right">{{$total_card_amt}}</th>
                    <th align="right">{{$total_upi_amt}}</th>
                    <th align="right">{{$total_refund_amt}}</th>
                    <th align="right">{{$total_net_amt}}</th>
                </tr>
            </tfoot>
        </table>
    </body>
</html>
                                    