public function getBooking()
 {
     return Booking::getById($this->booking);
 }
Example #2
0
 public function getbookinginfoAction()
 {
     $id = $this->getRequest()->getParam('id');
     $Booking = Booking::getById($id);
     $response = array('code' => 'Request error!');
     if ($Booking) {
         $response = $Booking->toArray();
         $response['hotel'] = $Booking->getHotel();
         $response['code'] = 'SUCCESS';
     }
     echo json_encode($response);
 }
 private function doPayBillAction()
 {
     $id = WebRequest::getInt("id");
     $items = Bill_item::getIdListByBooking($id);
     $total = 0;
     foreach ($items as $i) {
         $bi = Bill_item::getById($i);
         $total += $bi->getPrice();
     }
     $inv = new Bill_item();
     $inv->setBooking(Booking::getById($id));
     $inv->setName("Payment");
     $inv->setPrice(-$total);
     $inv->save();
     global $cScriptPath;
     $this->mHeaders[] = "Location: {$cScriptPath}/Billing?action=view&id=" . $id;
 }
 private function doDeleteBookingAction()
 {
     $bid = WebRequest::getInt("id");
     if ($bid < 1) {
         throw new Exception("BookingId too small");
     }
     if (Booking::getById($bid) == null) {
         throw new Exception("Booking does not exist");
     }
     Booking::getById($bid)->delete();
     global $cScriptPath;
     $this->mHeaders[] = "Location: {$cScriptPath}/Bookings";
 }