Extra Room Service in Booking Application

Hi, i tried to see other posts here about this question but i just wanted to know if i was thinking correctly and what is missing (since it does not show the guest name after typing the room number and the booking price adds the amount of room service but from other bookings, and it is giving an error in when i test the delete booking with some FK constraint from room service...)

I also attached the oml for this application.

In the Extra Room Service of the Bookings application i did the following:

Homepage local variables:

  • Local Variable “RoomService” type RoomService
  • local variable “room number” integer
  • local variable “last name” text
  • local variable “first name” text
  • local variable “isValidRoom” boolean

HomePage web screen:

  • A RoomService Form with:

       1st container:

                      Input stored in the “room number” local variable – OnChange Destination OnRoom_RoomNumberChange

                      If with condition IsRoomValid

                                    True – shows web block with “last name, first name”

                                    False – shows text “Enter a valid room number”

       2nd container:

                      Combo box:

Variable: RoomService.RoomServiceType

Source entity: RoomServiceType

Source attribute: Name

              3rd container:

                             Input stored in RoomService.Amount variable

Screen action OnRoom_RoomNumberChange

              1st Aggregate GetRoomsWithBookings

                             Sources: Room, Booking and Status

                             4 Filters: Room.RoomNumber = RoomNumber | Booking.CheckInDate <= CurrDate() | Booking.StatusId=Entities.Status.CheckedIn | Booking.CheckOutDate >= CurrDate()

              2nd if condition “GetRoomsWithBookings.List.Current.Booking.Id = NullIdentifier()”



                                       Last name = GetRoomsWithBookings.List.Current.Booking.GuestLastName

                                       Fist Name = GetRoomsWithBookings.List.Current.Booking.GuestFirstName

                                       RoomService.BookingId= GetRoomsWithBookings.List.Current.Booking.Id




                                          IsValidRoom = False

                                          Ajax refresh RoomServiceForm


HomePage Screen – “Request” Button


                             RoomService.Date= CurrDate()

                             Run Server action – CreateOrUpdateRoomService

                                           Source: RoomService

                             Ajax Refresh – RoomServiceForm

Now I need to calculate the new price in the booking check-out

In the preparation of the “Confirm checkout” web screen

              Local variable BookingPrice (currency type) – to hold the new booking price

              Aggregate GetRoomsWithBookings

                             Sources: Booking, Room and RoomService´

                             Filters: Booking.Id = BookingId

                                           Booking.Id = RoomService.BookingId


                 BookingPrice = BookingPrice + GetRoomsWithBookings.List.Current.TotalPrice (TotalPrice is a column with number of nights * price per night) + GetRoomsWithBookings.List.Current.RoomService.Amount (Amount of room service requested since we do not have price for those extra room services)

Form of the “Confirm checkout” web screen

              Added a input widget which shows the amount of extra room services

                             Variable: RoomForm.Record.RoomService.Amount

              And the “Total” input widget has as variable the “Booking price”

Best regards,

Tiago Ferreira


Rank: #16

Hi Tiago,

Let's see if I can answer all your questions.

1 - Not showing the Guest number is because you forgot to do an ajax refresh on OnRoom_RoomNumberChange when the room is valid. you also need to set "IsValidRoom" to true.

2 - Wrong value on check out. on GetRoomsWithBookings you need to sum the RoomService.Amount and booking should be with or without room service because not all the rooms will have room service

3 -  on the delete error. you need to check if the booking has room service. if yes you can't delete it.

in attachment I your module with some changes.