public function getCashOutHistoryTransaction()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $idResto = Generic::mustCheck($_GET['id_restaurant'], "No ID Restaurant Found");
     $rt = new MasterRestoTransactionModel();
     $arrTrans = $rt->getWhere("id_restaurant='{$idResto}' AND type_transaction='2' ORDER BY datetime_transaction DESC ");
     $result['transactions'] = array();
     foreach ($arrTrans as $trans) {
         unset($b);
         $b['id_transaction'] = $trans->id_transaction;
         $b['id_restaurant'] = $trans->id_restaurant;
         $b['gross_amount'] = (double) $trans->gross_amount;
         $b['net_amount'] = (double) $trans->net_amount;
         $b['type_transaction'] = $trans->type_transaction;
         $b['datetime_transaction'] = $trans->datetime_transaction;
         $b['approved'] = $trans->approved == "1";
         $result['transactions'][] = $b;
     }
     $json['status_code'] = 1;
     $json['results'] = $result;
     echo json_encode($json);
     die;
 }
 public function setInvitation()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $json = array();
     $json['status_code'] = 1;
     $id_order = Generic::mustCheck($_GET['id_order'], "NO ID Order found!");
     $result = $this->setInvitationStatus("1", $id_order);
     if ($result) {
         $json['status_code'] = 1;
         $json['status_message'] = "Success!";
     } else {
         $json['status_code'] = 0;
         $json['status_message'] = "Failed!";
     }
     echo json_encode($json);
     die;
 }
 public function setCashOutPaid()
 {
     $idRequest = Generic::mustCheck($_GET['id_request'], "Required ID Request");
     $cashOutModel = new MasterCashOutRequestModel();
     $cashOutModel->getByID($idRequest);
     $restoTrans = new MasterRestoTransactionModel();
     $arrRestoTrans = $restoTrans->getWhere("type_transaction = '2' AND id_request = '{$idRequest}'");
     if (count($arrRestoTrans) <= 0) {
         Generic::errorMsg("Transaction not found");
     }
     if ($cashOutModel->status == "1") {
         Generic::errorMsg("This Request Already Paid");
     }
     $rt = new MasterRestoTransactionModel();
     $rt->getByID($arrRestoTrans[0]->id_transaction);
     $rt->approved = "1";
     $rt->save();
     $cashOutModel->status = "1";
     $cashOutModel->save();
     $json['status_code'] = 1;
     $json['status_message'] = "Request status set to Paid";
     echo json_encode($json);
     die;
 }
 public function scan()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $id_user = isset($_GET['id_user']) ? addslashes($_GET['id_user']) : "";
     if (!$id_user) {
         Generic::errorMsg("Please login!");
     }
     if (!User::checkUserID($id_user)) {
         Generic::errorMsg("ID User not found!");
     }
     $QR = Generic::mustCheck($_GET['QR'], "No QR found!");
     $objOrder = new MasterOrderModel();
     // check, QR validapakah table free
     // table status = 0, occupied, 1 is free
     if (!Mastertable::isQRValid($QR)) {
         Generic::errorMsg("Invalid QR Code");
     }
     $objUser = new UserModel();
     $objUser->getByID($id_user);
     $objTable = Mastertable::getTableBYQR($QR);
     $id_table = $objTable[0]->id_table;
     $objTable = Mastertable::getTableID($id_table);
     $isTableFree = MasterTable::isTableFree($objTable);
     // Table free
     if ($isTableFree) {
         $paymentMethod = Generic::mustCheck($_GET['payment_method'], "Payment Method Required");
         $this->requestRestoPermission($objUser, $objTable, $paymentMethod);
     } else {
         $objOrder = MasterOrder::getActiveOrderByTableID($id_table);
         Generic::checkCountWithMsg($objOrder, "Empty ID Order!");
         $this->requestJoinTable($objUser, $objOrder);
     }
     die;
 }
 public function getCategoriesByResto()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $idRestaurant = Generic::mustCheck($_GET['id_restaurant'], Keys::$ERR_NOT_FOUND_ID_RESTAURANT);
     $objResto = new MasterRestaurantModel();
     $objResto->getByID($idRestaurant);
     if (!Generic::IsNullOrEmptyString($objResto->id_categories)) {
         $arrCategories = explode(",", $objResto->id_categories);
     } else {
         $arrCategories = array();
     }
     $categories = array();
     foreach ($arrCategories as $idCat) {
         $c = new MasterCategoryModel();
         $c->getByID($idCat);
         if ($c->id_category) {
             $categories[] = $c->name;
         }
     }
     //        pr($arrCategories);
     //        pr($categories);
     $results['categories'] = $categories;
     $rawTags = array();
     $id_dish = isset($_GET['id_dish']) ? addslashes($_GET['id_dish']) : "";
     if ($id_dish) {
         $dish = new MasterDishModel();
         $dish->getByID($id_dish);
         $tagsIds = explode(",", $dish->dish_tags);
         if (count($tagsIds) != 0) {
             foreach ($tagsIds as $tagsId) {
                 if ($tagsId == null || $tagsId == "") {
                     continue;
                 }
                 $dishTag = new MasterDishTagModel();
                 $dishTag->getByID($tagsId);
                 $b["id_tag"] = $dishTag->id_tag;
                 $b["name"] = $dishTag->name;
                 $rawTags[] = $b;
             }
         }
     }
     $results['raw_tags'] = $rawTags;
     Generic::finish($results);
 }
 public function clearTable()
 {
     $idTable = Generic::mustCheck($_GET['id_table']);
     $d = Util::clearTable($idTable);
     if ($d) {
         Generic::finish($d);
     } else {
         Generic::errorMsg("Failed");
     }
 }
 public function updateRestoMRFee()
 {
     $idsResto = Generic::mustCheck($_POST['id_restaurant'], "No Restaurant IDs Found");
     $fee = Generic::mustCheck($_POST['fee'], "No Fee Found");
     if (!is_numeric($fee)) {
         Generic::errorMsg("Fee Must Numbers");
     }
     if (doubleval($fee) > 100) {
         Generic::errorMsg("Fee Max 100%");
     }
     $ids = explode(',', $idsResto);
     if (count($ids) <= 0) {
         Generic::errorMsg("Empty Id");
     }
     $updateAll = in_array('0', $ids);
     if ($updateAll) {
         $r = new MasterRestaurantModel();
         $arrR = $r->getAll();
         foreach ($arrR as $singleR) {
             unset($resto);
             $resto = new MasterRestaurantModel();
             $resto->getByID($singleR->id_restaurant);
             $log = new LogDiscFeeModel();
             $log->id_reference = $singleR->id_restaurant;
             $log->change_type = "Fee MR";
             $log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee;
             $log->change_to = $fee;
             $log->change_date_time = leap_mysqldate();
             $log->save();
             $resto->mr_fee = $fee;
             $resto->save();
         }
     } else {
         foreach ($ids as $id) {
             unset($resto);
             $resto = new MasterRestaurantModel();
             $resto->getByID($id);
             $log = new LogDiscFeeModel();
             $log->id_reference = $id;
             $log->change_type = "Fee MR";
             $log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee;
             $log->change_to = $fee;
             $log->change_date_time = leap_mysqldate();
             $log->save();
             $resto->mr_fee = $fee;
             $resto->save();
         }
     }
     $json['status_code'] = 1;
     $json['status_message'] = "success";
     echo json_encode($json);
     die;
 }
 public function userUpdateProfile()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $idUser = Generic::mustCheck($_POST['id_user'], "ID user required");
     $fullName = Generic::mustCheck($_POST['full_name'], "Empty Full Name");
     $userName = Generic::mustCheck($_POST['user_name'], "Empty User Name");
     $email = Generic::mustCheck($_POST['email'], "Empty Email");
     $password = Generic::mustCheck($_POST['pwd'], "Empty Password");
     $idCuisine = Generic::mustCheck($_POST['pref_cuisine'], "Cuisine Not Selected");
     $birthday = Generic::mustCheck($_POST['birthday'], "Empty Birthday");
     $phoneNo = Generic::mustCheck($_POST['phone_no'], "Empty Phone Number");
     $fbId = Generic::IsNullOrEmptyString($_POST['fb_id']) ? "" : $_POST['fb_id'];
     $latitude = Generic::IsNullOrEmptyString($_POST['lat']) ? "" : $_POST['lat'];
     $longitude = Generic::IsNullOrEmptyString($_POST['long']) ? "" : $_POST['long'];
     $district = Generic::IsNullOrEmptyString($_POST['district']) ? "" : $_POST['district'];
     $city = Generic::IsNullOrEmptyString($_POST['city']) ? "" : $_POST['city'];
     $pic = Generic::IsNullOrEmptyString($_POST['pic']) ? "" : MasterRestaurant::savePic($_POST['pic']);
     ///START OF LOVELY VALIDATION TIME
     if (!Generic::isValidUserName($userName)) {
         Generic::errorMsg("Username must only contains alphanumeric (and/or) \\'.\\', \\'-\\', \\'_\\'");
     }
     if (!Generic::isValidUserNameLength($userName)) {
         Generic::errorMsg("Max username length is 20");
     }
     if (!Generic::isValidEmail($email)) {
         Generic::errorMsg("Email format not valid");
     }
     if (!Generic::isValidPassword($password)) {
         Generic::errorMsg("Password must contain minimum 5 character and no whitespace");
     }
     $user = new UserModel();
     $user->getByID($idUser);
     if ($birthday != $user->birthday) {
         Generic::errorMsg("Birthday cannot be changed");
     }
     if ($userName != $user->user_name) {
         Generic::errorMsg("Username cannot be changed");
     }
     if (!Generic::IsNullOrEmptyString($user->fb_id) && $fbId != $user->fb_id) {
         Generic::errorMsg("Facebook cannot be changed");
     } else {
         $user->fb_id = $fbId;
     }
     ///END OF LOVELY VALIDATION TIME, HOW SAD :(
     $user->full_name = $fullName;
     $user->email = $email;
     $user->password = $password;
     $user->id_cuisine = $idCuisine;
     $user->phone_no = $phoneNo;
     if (!Generic::IsNullOrEmptyString($pic)) {
         $user->pic = $pic;
     }
     if (!Generic::IsNullOrEmptyString($latitude)) {
         $user->latitude = $latitude;
         $user->last_lat = $latitude;
     }
     if (!Generic::IsNullOrEmptyString($longitude)) {
         $user->longitude = $longitude;
         $user->last_long = $longitude;
     }
     if (!Generic::IsNullOrEmptyString($district)) {
         $user->district = $district;
         $user->last_district = $district;
     }
     if (!Generic::IsNullOrEmptyString($city)) {
         $user->city = $city;
         $user->last_city = $city;
     }
     $user->status = "1";
     $uid = $user->save();
     if (!$uid) {
         Generic::errorMsg("Failed Creating User");
     } else {
         $json['status_code'] = 1;
         $json['results']['fb_id'] = $user->fb_id;
         $json['results']['id_user'] = $idUser;
         $json['results']['user_name'] = $user->user_name;
         $json['results']['full_name'] = $user->full_name;
         $json['results']['email'] = $user->email;
         $json['results']['pic'] = Generic::insertImageUrl($user->pic);
         echo json_encode($json);
         die;
     }
 }
 public function dailyReport()
 {
     $id_restaurant = Generic::mustCheck($_GET["id_restaurant"], "No ID Restaurant Found!");
     global $db;
     $o = new MasterOrderModel();
     $arrOrder = $o->getWhere("id_restaurant='{$id_restaurant}' GROUP BY date(datetime_order) ");
     pr($arrOrder);
     die;
 }
 public function getHomeResults()
 {
     $idHome = Generic::mustCheck($_GET['id_home'], "ID Not Found");
     $currentLat = !Generic::IsNullOrEmptyString($_GET['latitude']) ? $_GET['latitude'] : "";
     $currentLong = !Generic::IsNullOrEmptyString($_GET['longitude']) ? $_GET['longitude'] : "";
     $home = new HomeModel();
     $home->getByID($idHome);
     if ($home->status != "1") {
         Generic::errorMsg("Not Active Home");
     }
     $page = addslashes($_GET['page']);
     if ($page == "" || $page < 1) {
         Generic::errorMsg("No Page Found");
     }
     $limit = addslashes($_GET['limit']);
     if ($limit == "" || $limit < 1) {
         Generic::errorMsg("Limit Error");
     }
     $begin = ($page - 1) * $limit;
     $extraQ = " LIMIT {$begin},{$limit}";
     $key = "key";
     $results = array();
     $searchType = $home->search_type;
     $searchTerm = $home->search_term;
     $query = $home->query;
     switch ($searchType) {
         case "0":
             break;
         case "1":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("restaurant_type='{$searchTerm}' AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "2":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("FIND_IN_SET('{$searchTerm}', id_categories) AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "3":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("id_cuisine='{$searchTerm}' AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "4":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("name LIKE '%{$query}%' AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "5":
             $dish = new MasterDishModel();
             $results = $dish->getWhere("'{$searchTerm}' IN (dish_tags) ORDER BY id_dish DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $dish->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $dish->crud_add_photourl;
             $key = "Dish";
             break;
         case "6":
             $dish = new MasterDishModel();
             $results = $dish->getWhere("name LIKE '%{$query}%' ORDER BY id_dish DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $dish->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $dish->crud_add_photourl;
             $key = "Dish";
             break;
         case "8888":
             break;
         default:
             break;
     }
     $json["results"]["latitude"] = $currentLat;
     $json["results"]["longitude"] = $currentLong;
     $json["results"][$key] = array();
     foreach ($results as $o) {
         $sem = array();
         foreach ($exp as $attr) {
             if (in_array($attr, $arrPicsToAddPhotoUrl)) {
                 $sem[$attr] = Generic::insertImageUrl($o->{$attr});
             } else {
                 $sem[$attr] = stripslashes($o->{$attr});
             }
         }
         if ($searchType == "5" || $searchType == "6") {
             $sem['nama_restaurant'] = MasterRestaurant::getRestoNameByIDResto($o->id_restaurant);
         }
         if ($currentLat != "" && $currentLong != "") {
             $sem["distance"] = sqrt(pow(69.09999999999999 * ($o->latitude - $currentLat), 2) + pow(69.09999999999999 * ($currentLong - $o->longitude) * cos($o->latitude / 57.3), 2));
         } else {
             $sem["distance"] = 0;
         }
         //            $json["results"]["search_type"] = Generic::homeSearchType($searchType);
         $json["results"][$key][] = $sem;
     }
     $json['status_code'] = 1;
     echo json_encode($json);
     die;
 }
 public function getBalanceById()
 {
     $dokuId = Generic::mustCheck($_GET['doku_id'], "ID not found");
     $this->WORDS = Util::sha1HMAC($this->getDataCheckBalance($dokuId), $this->CLIENT_SECRET);
     $params = array($this->KEY_CLIENT_ID => $this->CLIENT_ID, $this->KEY_ACCESS_TOKEN => $this->ACCESS_TOKEN, $this->KEY_ACCOUNT_ID => $dokuId, $this->KEY_WORDS => $this->WORDS);
     echo Util::httpPost($this->API_CHECK_BALANCE, $params);
     die;
 }
 public function pushByLocation()
 {
     $idUsers = Generic::mustCheck($_POST['id_users'], "IDs User not Found");
     $title = Generic::mustCheck($_POST['title'], "Title not Found");
     $message = Generic::mustCheck($_POST['message'], "Message not Found");
     $image = Generic::IsNullOrEmptyString($_POST['image']) ? "" : $_POST['image'];
     if (Generic::IsNullOrEmptyString($idUsers)) {
         Generic::errorMsg("Empty IDs User");
     }
     $arrIdUser = explode(',', $idUsers);
     $results['id_users'] = $idUsers;
     $results['title'] = $title;
     $results['message'] = $message;
     $results['image'] = $image;
     $trackerModel = Util::getTrackerModelByCode(Keys::$TRACKER_PUSH);
     if (!$trackerModel) {
         Generic::errorMsg("Failed To Fetch Tracker Model");
     } else {
         $trackerModel->title = $title;
         $trackerModel->message = $message;
         $trackerModel->image = $image;
         $trackerModel->id_from = 0;
         $trackerModel->id_reference = 0;
         $trackerModel->id_to = $idUsers;
         $trackerModel->readed = "0";
         $trackerModel->answered = "1";
         $trackerModel->canceled = "0";
         $trackerModel->status = "1";
         $trackerModel->type = Push::$typeMRPushByLocation;
         $idTracker = $trackerModel->save();
     }
     foreach ($arrIdUser as $idUser) {
         //saving log
         $pLog = new MasterPushLoggerModel();
         $pLog->from_id = 0;
         $pLog->to_id = $idUser;
         $pLog->title = $title;
         $pLog->message = $message;
         //type 3 : MR to User
         $pLog->type = Push::$pushLogMRToUser;
         $pLog->push_code = Push::$typeMRPushByLocation;
         $pLog->datetime_notif = leap_mysqldate();
         $pLog->id_reference = $image;
         $pLog->status = "1";
         $pLog->save();
     }
     $_POST["ids"] = implode(',', $arrIdUser);
     $_POST["msg"] = $title;
     $_POST["json"] = $idTracker;
     //json_encode($j);
     $_POST["type"] = Push::$typeMRPushByCuisine;
     $push = new PushTo();
     $results['user_count'] = count($arrIdUser);
     $results['push'] = $push->usersMR();
     Generic::finish($results);
 }
 public function updateRestoMRDiscount()
 {
     $idsResto = Generic::mustCheck($_POST['id_restaurant'], "No Restaurant IDs Found");
     $disc = Generic::mustCheck($_POST['discount'], "No Discount Found");
     if (!is_numeric($disc)) {
         Generic::errorMsg("Discount Must Numbers");
     }
     if (strlen(trim($disc)) > 2) {
         Generic::errorMsg("Discount Max 2 Digits");
     }
     $ids = explode(',', $idsResto);
     if (count($ids) <= 0) {
         Generic::errorMsg("Empty Id");
     }
     $updateAll = in_array('0', $ids);
     if ($updateAll) {
         $r = new MasterRestaurantModel();
         $arrR = $r->getAll();
         foreach ($arrR as $singleR) {
             unset($resto);
             $resto = new MasterRestaurantModel();
             $resto->getByID($singleR->id_restaurant);
             unset($logdisc);
             $logdisc = new LogDiscFeeModel();
             $logdisc->id_reference = $resto->id_restaurant;
             $logdisc->change_type = "Discount MR";
             $logdisc->change_from = Generic::IsNullOrEmptyString($resto->disc_mr) ? "0" : $resto->disc_mr;
             $logdisc->change_to = $disc;
             $logdisc->change_date_time = leap_mysqldate();
             $logdisc->save();
             $resto->disc_mr = $disc;
             $resto->save();
         }
     } else {
         foreach ($ids as $id) {
             unset($resto);
             $resto = new MasterRestaurantModel();
             $resto->getByID($id);
             unset($logdisc);
             $logdisc = new LogDiscFeeModel();
             $logdisc->id_reference = $resto->id_restaurant;
             $logdisc->change_type = "Discount MR";
             $logdisc->change_from = Generic::IsNullOrEmptyString($resto->disc_mr) ? "0" : $resto->disc_mr;
             $logdisc->change_to = $disc;
             $logdisc->change_date_time = leap_mysqldate();
             $logdisc->save();
             $resto->disc_mr = $disc;
             $resto->save();
         }
     }
     $json['status_code'] = 1;
     $json['status_message'] = "success";
     echo json_encode($json);
     die;
 }
 public function loadPaymentToken()
 {
     $idUser = Generic::mustCheck($_GET['id_user'], "ID User Required");
     $user = new UserModel();
     $user->getByID($idUser);
     if (Generic::IsNullOrEmptyString($user->id_user)) {
         Generic::errorMsg("User Not Found");
     }
     $results['payment_token'] = Generic::IsNullOrEmptyString($user->payment_token) ? "" : $user->payment_token;
     $results['payment_id'] = Generic::IsNullOrEmptyString($user->payment_id) ? "" : $user->payment_id;
     $results['payment_type'] = Generic::IsNullOrEmptyString($user->payment_type) ? "" : $user->payment_type;
     $results['has_token'] = Generic::IsNullOrEmptyString($user->payment_token) ? false : true;
     $results['default_cash'] = Generic::IsNullOrEmptyString($user->payment_type) || $user->payment_type == "0" ? true : false;
     Generic::finish($results);
 }
 public function getMyOrders()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $idUser = Generic::mustCheck($_GET["id_user"], "ID User Not Found");
     $arrStatusOK = implode(',', Helper::getDefaultOrderStatusOK());
     $stPaymentUnpaid = Keys::$PAYMENT_STATUS_UNPAID;
     $o = new MasterOrderModel();
     //        $arrOrder = $o->getWhere("
     //        (id_user='******' OR FIND_IN_SET('$idUser', user_guest_id))
     //        AND status_progress !='9'
     //        AND (status_payment ='0' OR status_payment='$stPaymentUnpaid')
     //        AND status != 0
     //         ");
     $arrOrder = $o->getWhere("\n        (id_user='******' OR FIND_IN_SET('{$idUser}', user_guest_id))\n        AND status_progress !='9'\n        AND status_progress !='4'\n        AND status != 0\n         ");
     $results["status_code"] = 1;
     $results["results"] = array();
     foreach ($arrOrder as $order) {
         //            $order = new MasterOrderModel();
         $od["id_order"] = $order->id_order;
         $resto = new MasterRestaurantModel();
         $resto->getByID($order->id_restaurant);
         $od["name"] = $resto->name;
         $od["image_logo"] = Generic::insertImageUrl($resto->image_logo);
         $od["order_now"] = $order->order_now;
         if ($order->id_user == $idUser) {
             $od['isLeader'] = "1";
         } else {
             $od['isLeader'] = "0";
         }
         if ($order->type_order == "1") {
             $od["type_order"] = "Dine In";
         } elseif ($order->type_order == "3") {
             $od["type_order"] = "Take Away";
         } else {
             $od["type_order"] = "Not defined";
         }
         $od["status_progress"] = $order->status_progress;
         $od['datetime_order'] = $order->datetime_order;
         if ($order->id_table == "0" || $order->id_table == "") {
             $od['table_number'] = "0";
         } else {
             $table = new MasterTableModel();
             $table->getByID($order->id_table);
             $od['table_number'] = $table->table_number;
         }
         $od['order_number'] = $order->order_number;
         $results["results"][] = $od;
     }
     echo json_encode($results);
     die;
 }
 public function controlIsCategoryIdValid()
 {
     $idCat = Generic::mustCheck($_GET['id_category'], "BOOO!");
     if ($this->isCategoryIdValid($idCat)) {
         echo "<h1>VALID</h1>";
     } else {
         echo "<h1>NOT VALID</h1>";
     }
 }