

<div class="container-fluid">
    <!-- ============================================================== -->
    <!-- Start Page Content -->
    <!-- ============================================================== -->
    <div class="row">
        <div class="col-md-12">
            <button type="button" class="btn btn-info" onclick="printReport()" style="overflow: hidden">Print</button>
            <div class="card card-body" id="printableArea">
                <h3 class="text-center"><?php echo $report_head?></h3>
                <h6 class="text-center">Report of: <?php echo $report_date?></h6>
                <hr class="report_title_hr">
                <?php

                if($order){
                    foreach ($order as $master) {
                        ?>
                        <div class="all-patient-box">
                            <div class="row">
                                <div class="col-md-12">
                                    <table class="table patient_master_table">
                                        <tbody>
                                            <tr>
                                                <th width="15%">Order Date</th>
                                                <td width="5%">:</td>
                                                <td><?php echo date('d-F-Y',strtotime($master['created_date']))?></td>
                                            </tr>
                                            <tr>
                                                <th width="15%">Total</th>
                                                <td width="5%">:</td>
                                                <td><?php echo $master['total']?></td>
                                            </tr>
                                            <tr>
                                                <th width="15%">Discount Offer</th>
                                                <td width="5%">:</td>
                                                <td><?php echo $master['discount_offer']?>%</td>
                                            </tr>
                                            <tr>
                                                <th width="15%">Discount Amount</th>
                                                <td width="5%">:</td>
                                                <td><?php echo $master['discount_amount']?></td>
                                            </tr>
                                            <tr>
                                                <th width="15%">Grand Total</th>
                                                <td width="5%">:</td>
                                                <td><?php echo $master['grand_total']?></td>
                                            </tr>
                                            <tr>
                                                <th width="15%">Paid Amount</th>
                                                <td width="5%">:</td>
                                                <td><?php echo $master['paid_amount']?></td>
                                            </tr>
                                            <tr>
                                                <th width="15%">Source</th>
                                                <td width="5%">:</td>
                                                <td><?php echo $master['source']?></td>
                                            </tr> 
                                            
                                        </tbody>
                                    </table>
                                </div>
                                <div class="col-md-12">
                                    <p class="patient_details_report_head">Order Details</p>
                                    <?php
                                    $ci =& get_instance();
                                    $ci->load->model('report/OrderReportModel','ReportModel');
                                    $test_details=$ci->ReportModel->getSingleOrderDetailsData($master['order_id']);

                                    ?>
                                    <table class="table table-bordered custom_report_table">
                                       <thead>
                                        <tr>
                                            <th width="10%">#</th>
                                            <th width="30%">Product</th>
                                            <th width="20%" class="text-right">Unit Price</th>
                                            <th width="20%" class="text-right">Quantity</th>
                                            <th width="20%" class="text-right">Sub-Total</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        $i=1;
                                        foreach ($test_details as $data) {
                                            ?>
                                            <tr>
                                                <td><?php echo $i;?></td>
                                                <td><?php echo $data['product_name'];?></td>
                                                <td class="text-right"><?php echo $data['unit_price'];?></td>
                                                <td class="text-right"><?php echo $data['qty'];?></td>
                                                <td class="text-right"><?php echo $data['total'];?></td>
                                            </tr>
                                            <?php
                                            $i++;
                                        }
                                        ?>
                                    </tbody>
                                </table>
                            </div>
                                
                            </div>
                        </div>
                        <?php
                    }
                }
                else{
                    ?>
                    <p class="text-center text-danger">There is no data for <?php echo $report_date?></p>
                    <?php
                }

                ?>
            </div>
        </div>
    </div>
</div>