/** * method getListDish() get all Dish of restaurants * @param no * @return Gui html * @author thanhtuan */ public function getListDish($date) { // make $to from $from $from = new DateTime($date); $to = new DateTime($date); $to->modify("+1 day"); $dao = new FoodDAO(); $arr = $dao->getListFoodWithUnitPrice($from->format('Y-m-d H:i:s'), $to->format('Y-m-d H:i:s')); $data = "<p>Chọn món ăn nhập vào hóa đơn</p>"; $data .= "<table>\r\n\t\t<tr>\r\n\t\t<th><input type='checkbox' id='checkAllCBox' onclick='checkAllCBoxClicked();'></input></th>\r\n\t\t<th>Món ăn</th>\r\n\t\t<th>Giá thành</th>\r\n\t\t</tr>"; foreach ($arr as $value) { $TenMonAn = isset($value["TenMonAn"]) ? $value["TenMonAn"] : ""; $DonGia = isset($value["DonGia"]) ? $value["DonGia"] : ""; $data = $data . "<tr>"; $data = $data . "<td><input type='checkbox' value=\"" . $value["MaChiTietThucDon_MonAn"] . "\"></input></td>"; $data = $data . "<td>{$TenMonAn}</td>"; $data = $data . "<td>{$DonGia}</td>"; $data = $data . "</tr>"; } $data = $data . "</table>"; return $data; }
/** * Statictics by time. * @param MongoDate $from * @param MongoDate $to * @return array */ private function staticticsFoodByTime($from, $to) { $fDao = new FoodDAO(); $d = new MongoDate(strtotime($to)); // echo date("Y-m-d H:i:s", $d->sec); $foodWithUnitPrices = $fDao->getListFoodWithUnitPrice($from, $to); // 2. Compute total values $result = array(); foreach ($foodWithUnitPrices as $key => $food) { $temp["MaMonAn"] = $food["MaMonAn"]; $temp["TenMonAn"] = $food["TenMonAn"]; $revenues = $fDao->getFoodAmout($food["MaChiTietThucDon_MonAn"]); $temp["TongDoanhThu"] = $revenues == null ? 0 : $revenues; $result[] = $temp; } return $result; }