Seasonal pricing for the face.

I am trying to manage the seasonal prices of hotel rooms.

The only way I can do this is to use:

A = Room rate

B = room service charge

Imagine that there is a roomId column in the table, which is omitted below.

| DayDate   |EndDate   |  A  |  B
-----------------------------------------------
| 2010/07/1 |2010/07/2 | 200 |  40
| 2010/07/3 |2010/07/4 | 150 |  40
| 2010/07/5 |2010/07/5 | 150 |  50
| 2010/07/6 |2010/07/7 | 200 |  50
| 2010/07/8 |2010/07/9 | 100 |  60

etc .. (the table is taken from another question).

The problem is this: I do not want my seasons to be year-specific. The seasons for rooms should not change year after year. I do not want my users to enter seasonal data several times.

I will also have thousands of rooms, so I don’t know how to make it easily manageable.

I am using mysql and php.

+3
source share
2 answers
Create Table Prices
    (
    MonthStart int not null
    , DayStart int not null
    , MonthEnd int not null
    , DayEnd int not null
    , A int  not null
    , B int not null
    )

Insert Prices( MonthStart, DayStart, MonthEnd, DayEnd, A, B )
Select 7, 1, 7, 2, 200, 40
Union All Select 7, 3, 7, 4, 150, 40
Union All Select 7, 5, 7, 5, 150, 50
Union All Select 7, 6, 7, 7, 200, 50
Union All Select 7, 8, 7, 9, 100, 60

, , . , , . , , - :

Create Table Prices
    (
    MonthStart int not null
    , DayStart int not null
    , A int  not null
    , B int not null
    , Constraint PK_Prices Primary Key ( MonthStart, DayStart )
    )

Insert Prices( MonthStart, DayStart, A, B )
Select 7, 1, 200, 40
Union All Select 7, 2, 200, 40
Union All Select 7, 3, 150, 40
Union All Select 7, 4, 150, 40
Union All Select 7, 5, 150, 50
Union All Select 7, 6, 200, 50
Union All Select 7, 7, 200, 50
Union All Select 7, 8, 100, 60
Union All Select 7, 9, 100, 60
+1

, . , season_id. , season_id. Season_id .

+2

Source: https://habr.com/ru/post/1786038/


All Articles