B
Bart Van der Donck
Hello,
The following data are prices for holiday houses. Say '20' represents
midweek 5feb-9feb, '21' is weekend 10feb-11feb, '22' is midweek
12feb-16feb, etc
Prices are in the following format:
$price_midweek{20} = 38.15;
$price_weekend{21} = 44.78;
$price_midweek{22} = 34.84;
$price_weekend{23} = 43.98;
$price_midweek{24} = 39.94;
$price_weekend{25} = 48.17;
$price_midweek{26} = 36.04;
$price_weekend{27} = 47.09;
# 28 not available
$price_weekend{29} = 44.36;
$price_midweek{30} = 40.08;
$price_weekend{31} = 41.33;
$price_fullweek{20} = 57.22;
$price_fullweek{21} = 57.22;
$price_fullweek{22} = 61.79;
$price_fullweek{23} = 61.79;
$price_fullweek{24} = 58.40;
$price_fullweek{25} = 58.40;
$price_fullweek{26} = 58.86;
$price_fullweek{27} = 58.86;
$price_fullweek{28} = 59.54;
$price_fullweek{29} = 59.54;
# 30 and 31 not available
The prices of %price_fullweek always have priority.
$price_fullweek{20} is always the same as $price_fullweek{21},
$price_fullweek{22} is always the same as $price_fullweek{23},
$price_fullweek{24} is always the same as $price_fullweek{25}, etc.
Suppose customer wants a holiday from 22 to 26, then the price would
be 61.79 (= full week price of (midweek 22 and weekend 23)) + 58.40 (=
full week price of (midweek 24 and weekend 25)) + 36.04 (price of
midweek 26), thus total 156.23.
The price for 28 can only be booked when it's in its covering week;
because $price_weekend{28} or $price_midweek{28} don't exist.
If 30 and 31 would be in the booking, then the prices of weekend
+midweek are taken (40.08+41.33) because %price_fullweek holds no
entry for 30 and 31.
It's only possible to stay in period ranges that follow each other
(like 20-21-22-23 or 25-26-27 etc).
Is it possible to calculate the total price under such circumstances ?
Thanks very much,
The following data are prices for holiday houses. Say '20' represents
midweek 5feb-9feb, '21' is weekend 10feb-11feb, '22' is midweek
12feb-16feb, etc
Prices are in the following format:
$price_midweek{20} = 38.15;
$price_weekend{21} = 44.78;
$price_midweek{22} = 34.84;
$price_weekend{23} = 43.98;
$price_midweek{24} = 39.94;
$price_weekend{25} = 48.17;
$price_midweek{26} = 36.04;
$price_weekend{27} = 47.09;
# 28 not available
$price_weekend{29} = 44.36;
$price_midweek{30} = 40.08;
$price_weekend{31} = 41.33;
$price_fullweek{20} = 57.22;
$price_fullweek{21} = 57.22;
$price_fullweek{22} = 61.79;
$price_fullweek{23} = 61.79;
$price_fullweek{24} = 58.40;
$price_fullweek{25} = 58.40;
$price_fullweek{26} = 58.86;
$price_fullweek{27} = 58.86;
$price_fullweek{28} = 59.54;
$price_fullweek{29} = 59.54;
# 30 and 31 not available
The prices of %price_fullweek always have priority.
$price_fullweek{20} is always the same as $price_fullweek{21},
$price_fullweek{22} is always the same as $price_fullweek{23},
$price_fullweek{24} is always the same as $price_fullweek{25}, etc.
Suppose customer wants a holiday from 22 to 26, then the price would
be 61.79 (= full week price of (midweek 22 and weekend 23)) + 58.40 (=
full week price of (midweek 24 and weekend 25)) + 36.04 (price of
midweek 26), thus total 156.23.
The price for 28 can only be booked when it's in its covering week;
because $price_weekend{28} or $price_midweek{28} don't exist.
If 30 and 31 would be in the booking, then the prices of weekend
+midweek are taken (40.08+41.33) because %price_fullweek holds no
entry for 30 and 31.
It's only possible to stay in period ranges that follow each other
(like 20-21-22-23 or 25-26-27 etc).
Is it possible to calculate the total price under such circumstances ?
Thanks very much,