0

Solutions are there for small hotels

The table has two fields for dates and I can indicate from what day and on what day to occupy a hotel room. But you also need to count those days when he is not busy for the last two months, then from today and two months in advance. Can you tell me how to solve this? What solutions are there for small hotels?

10 replies

null
    • Fred
    • 8 mths ago
    • Reported - view

    The first part is an interesting question.

    Here is one way. I have two tables (Rooms and Reservations) and a Dashboard. On the Dashboard there is a reference field to Rooms called 'Select a Room'. I put the following in a field called: 'Days Empty (Last 60 Days)'

    let roomNum := record(Rooms,number('Select a Room'));
    let getPast2MonthResv := roomNum.Reservations[var d := SDate;
            d > today() - 60 and d < today()];
    let getActiveResvDays := for loop1 in getPast2MonthResv do
            days(loop1.SDate, loop1.EDate)
        end;
    60 - sum(getActiveResvDays)
    

    Line 1: uses the record() command to get the record Id of the selected room.

    Line 2-3: finds all related records in Reservations that have a SDate that is greater than today - 60 days and less than today.

    Line 4-6: takes the records found above and figures out how many days each reservation was and creates an array

    Line 7: then subtracts the sum of the days reserved from 60

    • Fred
    • 8 mths ago
    • Reported - view

    Sorry to keep posting, but here is a simpler code:

    let getPast2MonthResv := 'Select a Room'.Reservations[var d := SDate;
            d > today() - 60 and d < today()];
    let getActiveResvDays := for loop1 in getPast2MonthResv do
            days(loop1.SDate, loop1.EDate)
        end;
    60 - sum(getActiveResvDays)
    

    Silly me forgot that 'Select a Room' is a reference field so it is a direct link to the record. No need to use the record() command to get the record again.

    If 'Select a Room' was a dynamic choice field then you would need the record() command, but since it isn't in my test I don't need it.

      • iliper LTD
      • iliper_LTD
      • 8 mths ago
      • Reported - view

       create the first table called "Select a Room"  in this table, we will arrange all the hotel rooms.

      After we create a table "Dashboard" with Field Data1 and Data2, and create a link to the first table "Select a Room"

      and Second Table

      Do we need another table where all the data will be shown? or will everything be here?

      • iliper LTD
      • iliper_LTD
      • 8 mths ago
      • Reported - view

       I installed the database and we will update it when we find the way and I think something will work out if everyone connects. Based on the structure of this table, give solutions and I will update the database and everyone will be able to watch

    • Fred
    • 8 mths ago
    • Reported - view
     said:
    Do we need another table where all the data will be shown? or will everything be here?

     Take a look at my first comment. There are two data tables (Rooms and Reservations). The Dashboard has a button to create Reservations for a selected Room.

    You can add a view in the Dashboard that will bring up the Reservations for the selected Room.

      • iliper LTD
      • iliper_LTD
      • 8 mths ago
      • Reported - view

       pleas, can you create a database with these functions, you will make me happy

      • Fred
      • 8 mths ago
      • Reported - view

      If I remember correctly you do these things in your other DB. Why don't you give it a try and I'll help troubleshoot.

      • iliper LTD
      • iliper_LTD
      • 8 mths ago
      • Reported - view

       This is a new database and has nothing to do with the first one. The first one was created to account for a small casino, and it works excellently. Now I'm doing for a small hotel. We were looking for a ready-made program, but we never found anything that suited us. That's why we decided to create it ourselves, and it will do what we need. If you need to watch the first program, we made and you were a great help, I'm happy to share it with you. Send me your email and I will forward it to you. You made a great contribution to its creation and we remember this

    • Fred
    • 8 mths ago
    • Reported - view
     said:
    That's why we decided to create it ourselves, and it will do what we need.

    But all of the skills learned in your casino DB carries over to the hotel DB.

    Anyways, I've had a few moments so I've created a test DB you can look at.

      • iliper LTD
      • iliper_LTD
      • 8 mths ago
      • Reported - view

        I changed the design a little and everything that will be scripted later was transferred to the section for developers. Added mandatory requirements for renting an apartment or villa. I wanted to make all the fields clear after pressing the button, but I couldn't. You use different formulas than I used earlier, your formulas are much shorter)

Content aside

  • 8 mths agoLast active
  • 10Replies
  • 112Views
  • 2 Following