<?php $__env->startSection('content'); ?>
    <div class="container-fluid">
        <div class="page-titles">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="javascript:void(0)">Reports</a></li>
                <li class="breadcrumb-item active"><a href="javascript:void(0)">Financial Report</a></li>
            </ol>
        </div>
        <div class="row">
            <div class="col-12">
                <div class="card card-primary">
                    <div class="card-body"> 
                        <div class="form-row">
                            <div class="form-group col-6">
                                <?php
                                    $date_from_crt = date("d-M-Y", strtotime($date_from));
                                    $date_to_crt = date("d-M-Y", strtotime($date_to));
                                ?>
                                <u><b>FINANCIAL STATEMENT (<?php echo e($date_from_crt); ?> to <?php echo e($date_to_crt); ?>)</b></u>
                            </div>
                            <div class="form-group col-6">
                                <span style="text-align: right; padding-right:20px; "> 
                                    <form class="form-horizontal" action="<?php echo e(URL::to('/financial_report_pdf')); ?>" method="post" autocomplete="off">
                                        <!-- CSRF Token -->
                                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">  
                                        <button type="submit" class="btn btn-xs btn-info pull-right" id="reg_btn" >Generate PDF</button>
                                        <input type="hidden" name="date_from" id="date_from" value="<?php echo e($date_from); ?>">
                                        <input type="hidden" name="date_to" id="date_to" value="<?php echo e($date_to); ?>">
                                        <input type="hidden" name="user_id" id="user_id" value="<?php echo e($user_id); ?>">
                                        <input type="hidden" name="organisation_id" id="organisation_id" value="<?php echo e($organisation_id); ?>">
                                    </form>
                                </span>
                            </div>
                        </div>                
                        <div class="table-responsive"> 
                            <?php $__currentLoopData = $facilities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $facility): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <table class="table table-sm table-responsive-lg mb-0" style="font-size:90%;">
                                    <div class="card-header">
                                        <span style="color: blue;"><b><?php echo e(strtoupper($facility->facility_name)); ?></b></span>
                                    </div>
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Date</th>
                                            <th>Show Time</th>
                                            <th># of Adults</th>
                                            <th># of Children</th>
                                            <th>Amount</th>
                                        </tr>
                                    </thead>
                                    <?php                                                        
                                        $facility_id = $facility->id;
                                        $total_adults =0;
                                        $total_children = 0;
                                        $totalamount=0;
                                        //dd($ticket_date_arr);
                                    ?>
                                    <!-- regular show -->
                                        <?php if(isset($flg[$facility_id])): ?>
                                            <?php if($flg[$facility_id]==1): ?>
                                                <tr>
                                                    <td colspan="6">
                                                        <b style="color: green;">REGULAR SHOW</b>
                                                    </td>
                                                </tr>
                                                <?php
                                                    $n = 0;
                                                ?> 
                                                                                           
                                                    <?php if(isset($ticket_array[$facility_id])): ?>
                                                        <?php $__currentLoopData = $ticket_array[$facility_id]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tickets): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <?php if($tickets['noofadults']): ?>
                                                                <?php
                                                                    $n++;
                                                                    if($total_adults)
                                                                    {
                                                                        $total_adults = $total_adults+$tickets['noofadults'];
                                                                    }
                                                                    else
                                                                    {
                                                                        $total_adults = $tickets['noofadults'];
                                                                    }
                                                                    if($total_children)
                                                                    {
                                                                        $total_children = $total_children+$tickets['noofchildren'];
                                                                    }
                                                                    else
                                                                    {
                                                                        $total_children = $tickets['noofchildren'];
                                                                    }
                                                                    if($totalamount)
                                                                    {
                                                                        $totalamount = $totalamount+$tickets['amount'];
                                                                    }
                                                                    else
                                                                    {
                                                                        $totalamount = $tickets['amount'];
                                                                    }
                                                                ?>
                                                                <tr>
                                                                    <td><?php echo e($n); ?></td>
                                                                    <td><?php echo e(date("d-M-Y", strtotime($tickets['date']))); ?></td>
                                                                    <td><?php echo e($tickets['showtime']); ?></td>
                                                                    <td style="text-align: center;"><?php echo e($tickets['noofadults']); ?></td>
                                                                    <td style="text-align: center;"><?php echo e($tickets['noofchildren']); ?></td>
                                                                    <td style="text-align: right;"><i class='fa fa-rupee'></i>&nbsp;<?php echo e($tickets['amount']); ?></td>
                                                                </tr>
                                                            <?php endif; ?>             
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php endif; ?>                                                      
                                                
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    <!-- end -->

                                    <!--special shows-->
                                    
                                        <?php if(isset($splflg[$facility_id])): ?>
                                            <?php if($splflg[$facility_id]==1): ?>
                                                <tr>
                                                    <td colspan="6">
                                                        <b style="color: green;">SPECIAL SHOW</b>
                                                    </td>
                                                </tr>
                                                <?php
                                                    $n = 0;
                                                ?>  
                                                                                              
                                                    <?php if(isset($spl_ticket_array[$facility_id])): ?>                                               
                                                        <?php $__currentLoopData = $spl_ticket_array[$facility_id]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $spl_tickets): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <?php if($spl_tickets['noofadults']): ?>
                                                                <?php
                                                                    $n++;
                                                                    if($total_adults)
                                                                    {
                                                                        $total_adults = $total_adults+$spl_tickets['noofadults'];
                                                                    }
                                                                    else
                                                                    {
                                                                        $total_adults = $spl_tickets['noofadults'];
                                                                    }
                                                                    if($total_children)
                                                                    {
                                                                        $total_children = $total_children+$spl_tickets['noofchildren'];
                                                                    }
                                                                    else
                                                                    {
                                                                        $total_children = $spl_tickets['noofchildren'];
                                                                    }
                                                                    if($totalamount)
                                                                    {
                                                                        $totalamount = $totalamount+$spl_tickets['amount'];
                                                                    }
                                                                    else
                                                                    {
                                                                        $totalamount = $spl_tickets['amount'];
                                                                    }
                                                                ?>
                                                                <tr>
                                                                    <td><?php echo e($n); ?></td>
                                                                    <td><?php echo e(date("d-M-Y", strtotime($spl_tickets['date']))); ?></td>
                                                                    <td><?php echo e($spl_tickets['showtime']); ?></td>
                                                                    <td style="text-align: center;"><?php echo e($spl_tickets['noofadults']); ?></td>
                                                                    <td style="text-align: center;"><?php echo e($spl_tickets['noofchildren']); ?></td>
                                                                    <td style="text-align: right;"><i class='fa fa-rupee'></i>&nbsp;<?php echo e($spl_tickets['amount']); ?></td>
                                                                </tr>
                                                            <?php endif; ?>             
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php endif; ?>                                                     
                                                
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    <!-- end -->

                                    <tr>
                                        <td><b>Total</b></td>
                                        <td></td>
                                        <td></td>
                                        <td style="text-align: center;"><b><?php echo e($total_adults); ?></b></td>
                                        <td style="text-align: center;"><b><?php echo e($total_children); ?></b></td>
                                        <td style="text-align: right;"><i class='fa fa-rupee'></i>&nbsp;<b><?php echo e($totalamount); ?></b></td>
                                    </tr> 
                                </table>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>                                       
                    </div>
                </div>
            </div>
        </div>
    </div>
    
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.default', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/ksstmorg/resources/views/Reports/financial_report_list.blade.php ENDPATH**/ ?>