public static function htmlShowSupplierSelect()
 {
     $suppliers = MongoDatabase::getAllDataFrom("NhaCungCap");
     $html = '<select id="selectSupplier" onchange="javascript:supplierSelectOnChange(this)">';
     $html .= '<option value="-1">' . "Chọn nhà cung cấp" . '</option>';
     foreach ($suppliers as $supplier) {
         $html .= '<option value="' . $supplier["MaNCC"] . '">' . $supplier["TenNCC"] . '</option>';
     }
     $html .= '</select>';
     return $html;
 }
 /**
  * search all booking with datetime, customer name or customer id.
  * @param string $date
  * @param string $cusName
  * @param string $cusID
  * @return array booking info.
  */
 public function search($from, $to, $cusName, $cusID)
 {
     $condition = $this->createConditionToSearch($from, $to, $cusName, $cusID);
     $data = MongoDatabase::getAllDataFrom("PhieuDatCho", $condition);
     $result = array();
     foreach ($data as $booking) {
         $booking["NgayLap"] = date('Y-M-d h:i:s', $booking["NgayLap"]->sec);
         $result[] = $booking;
     }
     return $result;
 }
 /**
  * get contract detail by contract id
  * @param unknown_type $contractID
  */
 public function getContractDetail($contractID)
 {
     $condition = array('MaHopDong' => $contractID);
     $keys = array('_id' => 0, 'MNL' => 1, 'SOLUONGMAX' => 1, 'SOLUONGMIN' => 1);
     $contractDetails = MongoDatabase::getAllDataFrom("ChiTietHopDong", $condition);
     $result = array();
     $temp = array();
     foreach ($contractDetails as $contractDetail) {
         $temp["MaCTHD"] = $contractDetail["MaCTHD"];
         $temp["MaNL"] = $contractDetail["MNL"];
         $temp["SOLUONGMAX"] = $contractDetail["SOLUONGMAX"];
         $temp["SOLUONGMIN"] = $contractDetail["SOLUONGMIN"];
         $temp["TenNL"] = $this->getMaterialName($contractDetail["MNL"]);
         $result[] = $temp;
     }
     return $result;
 }
 /**
  * @param unknown_type $fromDate
  * @param unknown_type $toDate
  * @return multitype:multitype:unknown Ambigous <unknown>  
  */
 public function getListFoodWithUnitPrice($fromDate, $toDate)
 {
     // get menus on date.
     $keys = array('_id' => 0, 'MaTD' => 1);
     $condition = array("NgayLap" => array('$gte' => new MongoDate(strtotime($fromDate)), '$lte' => new MongoDate(strtotime($toDate))));
     $menus = MongoDatabase::getAllDataFrom("ThucDon", $condition, $keys);
     // get foods from menu
     $result = array();
     $temp = array();
     $keys1 = array("_id" => 0, "MaMonAn" => 1, "MaChiTiet" => 1, "DonGia" => 1);
     foreach ($menus as $menu) {
         $foodWithUnitPrice = MongoDatabase::getAllDataFrom("ChiTietThucDon_MonAn", array("MaTD" => $menu["MaTD"]), $keys1);
         foreach ($foodWithUnitPrice as $food_menu) {
             $temp["MaChiTietThucDon_MonAn"] = $food_menu["MaChiTiet"];
             $temp["DonGia"] = $food_menu["DonGia"];
             $temp["MaMonAn"] = $food_menu["MaMonAn"];
             $food = MongoDatabase::getOneDataFrom("MonAn", "MaMonAn=" . $food_menu["MaMonAn"]);
             $temp["TenMonAn"] = $food["TenMonAn"];
             $result[] = $temp;
         }
     }
     return $result;
 }
 /**
  * get all restaurant in system.
  * @return array
  */
 public function getAllRestaurant()
 {
     return MongoDatabase::getAllDataFrom($this::CollectionName);
 }
 /**
  * @param string $bill_food_id bill food id
  */
 private function getMenuFoodsByBill_Food_ID($bill_food_id)
 {
     $condition = array('MaChiTiet' => $bill_food_id);
     $keys = array('_id' => 0);
     $foods = MongoDatabase::getAllDataFrom("ChiTietThucDon_MonAn", $condition, $keys);
     return $foods == null ? null : $foods[0];
 }
 /**
  * get all ingredientType 
  * @param null
  * @return ingredientType array 
  * @author hathao298@gmail.com
  */
 public function getAllIngredientType()
 {
     $key = array("_id" => 0, "MaLoaiNL" => 1, "TenLoaiNL" => 1);
     return MongoDatabase::getAllDataFrom("LoaiNguyenLieu", null, $key);
 }
 public function getAllStaff()
 {
     $array = MongoDatabase::getAllDataFrom("nhanvien", null);
     return $array;
 }
 /**
  * get all ingredient info
  * @param null
  * @return ingredient array include "MaNL, TenNL, TenLoaiNL, SoLuong, SoLuongToiThieu, SoLuongToiDa"
  * @author hathao298@gmail.com
  */
 public function getAllIngredient()
 {
     return MongoDatabase::getAllDataFrom("NguyenLieu");
 }
 public function getAllMenu()
 {
     return MongoDatabase::getAllDataFrom("ThucDon");
 }