public static function getAllOrderDetailsByIDOrder($id_order)
 {
     $objOrderDetails = new OrderDetailModel();
     $arrOrderDetails = $objOrderDetails->getWhere("id_order='{$id_order}' ORDER BY status_progress ASC, id_dish ASC");
     //        MasterDish::checkCount($arrOrderDetails);
     $orderdetails = array();
     if (count($arrOrderDetails) > 0) {
         $exp = explode(",", str_replace(" ", "", $objOrderDetails->crud_webservice_allowed));
         foreach ($arrOrderDetails as $order) {
             $sem = array();
             foreach ($exp as $attr) {
                 $sem[$attr] = stripslashes($order->{$attr});
             }
             $sem['name'] = MasterDish::getDishNameByID($order->id_dish);
             $orderdetails[] = $sem;
         }
     }
     return $orderdetails;
 }
 public static function getOrderDetailsByIDOrderAndUserID($id_order, $id_user)
 {
     $objOrderDetails = new OrderDetailModel();
     $objUser = new UserModel();
     $objUser->getByID($id_user);
     $arrOrderDetails = $objOrderDetails->getWhere("id_order='{$id_order}' AND id_user='******'");
     //        MasterDish::checkCount($arrOrderDetails);
     if (count($arrOrderDetails) > 0) {
         $exp = explode(",", str_replace(" ", "", $objOrderDetails->crud_webservice_allowed));
         $orderdetails = array();
         foreach ($arrOrderDetails as $order) {
             $sem = array();
             foreach ($exp as $attr) {
                 $sem[$attr] = stripslashes($order->{$attr});
             }
             $sem['name'] = MasterDish::getDishNameByID($order->id_dish);
             $sem['image_user'] = _BPATH . _PHOTOURL . $objUser->pic;
             $orderdetails[] = $sem;
         }
     }
     return $orderdetails;
 }
    public function viewOrderDetail()
    {
        $id_order = isset($_GET['id_order']) ? addslashes($_GET['id_order']) : "";
        global $db;
        //        $id_order = '350';
        $q = "SELECT * FROM menurevo__order_detail WHERE id_order='{$id_order}'";
        $arrOrderDetail = $db->query($q, 2);
        $q = "SELECT * FROM menurevo__ms_order WHERE id_order='{$id_order}'";
        $arrOrder = $db->query($q, 2);
        //         echo $q;
        ?>

        <div class="well">

            <table class="table responsive"style="background: #dedede; width: 100%;" >
                <tr>
                    <td style="width: 50%;">

                        <h2>Take Away Order ID <?php 
        echo $id_order;
        ?>
                            , Order No. <?php 
        echo $arrOrder[0]->order_number;
        ?>
</h2>
                        <br>
                        <table class="table responsive" style="background: #dedede;">
                            <tr >
                                <td>
                                    Server : <?php 
        echo $arrOrder[0]->server_name;
        ?>
                                </td> 
                                <td style="text-align: right;">
                                    <?php 
        echo $arrOrder[0]->datetime_order;
        ?>
                                </td> 
                            </tr>  
                            <tr>
                                <td>
                                    Total :
                                </td>
                                <td style="text-align: right;">
                                    <?php 
        echo Generic::formatRupiah($arrOrder[0]->total_cost);
        ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Disc Resto :
                                </td>
                                <td style="text-align: right;">
                                    <?php 
        echo Generic::formatRupiah($arrOrder[0]->disc_resto);
        ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Disc Bank :
                                </td>
                                <td style="text-align: right;">
                                    <?php 
        echo Generic::formatRupiah($arrOrder[0]->disc_bank);
        ?>
                                </td>

                            </tr>
                            <tr>
                                <td>
                                    Tax PB1 :
                                </td>
                                <td style="text-align: right;">
                                    <?php 
        echo Generic::formatRupiah($arrOrder[0]->tax_pb1);
        ?>
                                </td>

                            </tr>
                            <tr>
                                <td>
                                    Service Charge :
                                </td>
                                <td style="text-align: right;">
                                    <?php 
        echo Generic::formatRupiah($arrOrder[0]->service_charge);
        ?>
                                </td>

                            </tr>

                            <tr>
                                <td>
                                    Other Charge :
                                </td>
                                <td style="text-align: right;">
                                    <?php 
        echo Generic::formatRupiah($arrOrder[0]->other_charge);
        ?>
                                </td>

                            </tr>

                            <tr>
                                <td style="font-size: large;">
                                    <strong> Grand Total : </strong>
                                </td>
                                <td style="text-align: right; font-size: large;">
                                    <strong><?php 
        echo Generic::formatRupiah($arrOrder[0]->grand_total);
        ?>
 </strong>
                                </td>
                            </tr>

                            <tr>
                                <td style="font-size: large;">

                                </td>
                                <td style="text-align: right; font-size: medium;">
                                    <button id='close_<?php 
        echo $id_order;
        ?>
'><strong>Close</strong></button>
                                </td>
                            <script>
                                $('#close_<?php 
        echo $id_order;
        ?>
').click(function () {
                                    lwclose(window.selected_page);
                                });
                            </script>
                </tr>
            </table>
        </td>
        <td style="width: 50%;">
            <table class="table responsive" style="background: #dedede;vertical-align:middle;border-radius: 25px;">
                <tr >

                    <td style="border-top:0px;border-bottom:1px;"> <h2>Order Details</h2>

                    </td>

                </tr>
                <?php 
        foreach ($arrOrderDetail as $detail) {
            ?>
                    <tr style="border-bottom:1px;border-top:1px;">
                        <td><h3><strong><?php 
            echo $detail->quantity;
            ?>
</strong></h3></td>
                        <td><?php 
            echo MasterDish::getDishNameByID($detail->id_dish);
            ?>
                            <br/>
                            <?php 
            echo Generic::formatRupiah($detail->price);
            ?>
</td>
                        <td><?php 
            //= $detail->status;
            ?>
                            <button type="button" id="button6"  style="width: 100%;" class="btn btn-success">Paid</button>
                        </td>
                    </tr>
                    <?php 
        }
        ?>
            </table>
            <?php 
        //                        pr($arrOrderDetail);
        ?>
</td>
        </tr>
        </table>


        </div>
        <?php 
    }