Hello:
I got stuck again....
In my Hotel Reservation script all reservations are saved in a flat file which name is the room number. (example: Data/room1-101.dat).
Reservations are saved in the following manner.
This means there are three reservations:
First: starts 4/25/2009 ends same day (it is reservation for one day)
Second: starts 4/26/2009 ends same day (it is reservation for one day)
Third: starts 4/10/2009 and ends 4/20/2009 (reservation for 10 days).
I have a script that is supposed to show the reserved rooms in a table representing any given month named: Reserved_Rooms. cgi. Free rooms are green color. Reserved rooms are different colors.
My problem is that I cannot display all the resevations saved in Data/room1-101.dat . If you are able to open in a browser the script attached (Reserved_Rooms .cgi), and you look at the table it only shows the reservation in the forth line.
Room 106 has the same reservations as 101 but I shifted the order. Again it only shows the reservation on 4th line.
in Reserved_Rooms. cgi the first Blue column to the left shows all the room numbers followed to the right with column digits representing the day of the months (up to 31).
The coloring of rooms is determined by a snippet of code in Reserved_Rooms. cgi (lines 328 through 340) as follows:
I have tried inserting a foreach loop inside the for loop, in order to display each line of the flat file Data/room1-101.dat, in the following manner but it didnt work:
The color meaning is:
Light gray, used room (any day prior to today)
Dark gray (room being used today)
Red, any reserved room not used yet (future reservation any date beyond today)
Green, any free room.
Hope you can straight me out... I want the script to display all reservations.
(Attached scripts in bundle Reserve.zip)
Thanx beforehand
VirtualWeb
I got stuck again....
In my Hotel Reservation script all reservations are saved in a flat file which name is the room number. (example: Data/room1-101.dat).
Reservations are saved in the following manner.
Code:
3 John Smith|||||||||Day:,Eve:|25|4|2009|25|4|2009|11|30 James Taylor|||||||||Day:,Eve:|26|4|2009|26|4|2009|11|30 Peter Willam|||||||||Day:,Eve:|10|4|2009|20|4|2009|11|30
First: starts 4/25/2009 ends same day (it is reservation for one day)
Second: starts 4/26/2009 ends same day (it is reservation for one day)
Third: starts 4/10/2009 and ends 4/20/2009 (reservation for 10 days).
I have a script that is supposed to show the reserved rooms in a table representing any given month named: Reserved_Rooms. cgi. Free rooms are green color. Reserved rooms are different colors.
My problem is that I cannot display all the resevations saved in Data/room1-101.dat . If you are able to open in a browser the script attached (Reserved_Rooms .cgi), and you look at the table it only shows the reservation in the forth line.
Room 106 has the same reservations as 101 but I shifted the order. Again it only shows the reservation on 4th line.
in Reserved_Rooms. cgi the first Blue column to the left shows all the room numbers followed to the right with column digits representing the day of the months (up to 31).
The coloring of rooms is determined by a snippet of code in Reserved_Rooms. cgi (lines 328 through 340) as follows:
Code:
for($ca=0;$ca<=$Rooms_Reserved;$ca++)
{
($Client_Name,$O1,$O2,$O3,$O4,$O5,$O6,$O7,$O8,$O9,$Start_Date,$Start_Month,$Start_Year,$End_Date,$End_Month,$End_Year,$Check_Out_Hour,$Check_Out_Min)=split (/\|/,$data[$ca]);
if($is == $sday) {$width ='30';}else{$width ='10';}
if(($is < $sday)&&($is >= $Start_Date)&&($is <= $End_Date)&&($year == $Start_Year)){$bgcolor = '#9A9A9A';$Checkbox = '';}
elsif(($is == $sday)&&($is >= $Start_Date)&&($is <= $End_Date)&&($year == $Start_Year)){$bgcolor = '#707070';$Checkbox = '';}
elsif(($is > $sday)&&($is >= $Start_Date)&&($is <= $End_Date)&&($year == $Start_Year)){$bgcolor = '#FF0000';$Checkbox = '';}
else{$bgcolor = '#00FF00';}
if(($bgcolor eq '#00FF00')&&($is >= $sday))
{$Checkbox = "<input type=checkbox name=\"RoomNum\" value=\"$is-$i-$rooms[$m-1]\">";}## (date-type-rumnum ###
elsif($is < $sday){$Checkbox = '';}
}# END OF for($ca=0;$ca<=$Rooms_Reserved;$ca++)
Code:
for($ca=0;$ca<=$Rooms_Reserved;$ca++)
{
push(@All_Reservations, $data[$ca]);
foreach $line (@All_Reservations){
($Client_Name,$O1,$O2,$O3,$O4,$O5,$O6,$O7,$O8,$O9,$Start_Date,$Start_Month,$Start_Year,$End_Date,$End_Month,$End_Year,$Check_Out_Hour,$Check_Out_Min)=split (/\|/,$line);
if($is == $sday) {$width ='30';}else{$width ='10';}
if(($is < $sday)&&($is >= $Start_Date)&&($is <= $End_Date)&&($year == $Start_Year)){$bgcolor = '#9A9A9A';$Checkbox = '';}
elsif(($is == $sday)&&($is >= $Start_Date)&&($is <= $End_Date)&&($year == $Start_Year)){$bgcolor = '#707070';$Checkbox = '';}
elsif(($is > $sday)&&($is >= $Start_Date)&&($is <= $End_Date)&&($year == $Start_Year)){$bgcolor = '#FF0000';$Checkbox = '';}
else{$bgcolor = '#00FF00';}
if(($bgcolor eq '#00FF00')&&($is >= $sday))
{$Checkbox = "<input type=checkbox name=\"RoomNum\" value=\"$is-$i-$rooms[$m-1]\">";}## (date-type-rumnum ###
elsif($is < $sday){$Checkbox = '';}
}# END OF foreach $line (@All_Reservations){
}# END OF for($ca=0;$ca<=$Rooms_Reserved;$ca++)
The color meaning is:
Light gray, used room (any day prior to today)
Dark gray (room being used today)
Red, any reserved room not used yet (future reservation any date beyond today)
Green, any free room.
Hope you can straight me out... I want the script to display all reservations.
(Attached scripts in bundle Reserve.zip)
Thanx beforehand
VirtualWeb
Comment