bataraguru
Programmer
Hi guys,
I'm currently on a project for my company developing a resort booking system.
So far this is what i've done, i know its really messy.
2 input from form 'ChkInDate' & 'ChkOutDate' and 2 input from database 'ChkInDate' & 'ChkOutDate'. The system should compare there date that user can know weather he/she can book the room or not.
Is there any way that i can simplify my code or anyone else have a very short way represent my code.
thank you so much..
I'm currently on a project for my company developing a resort booking system.
So far this is what i've done, i know its really messy.
2 input from form 'ChkInDate' & 'ChkOutDate' and 2 input from database 'ChkInDate' & 'ChkOutDate'. The system should compare there date that user can know weather he/she can book the room or not.
Code:
<cfloop query="SearchRoom">
<cfif DateCompare(#ChkInDate#,#form.ChkInDate#) EQ 0>
Cannot book 1...
<cfelseif DateCompare(#ChkInDate#,#form.ChkOutDate#) EQ 0>
Can book
<cfelseif DateCompare(#ChkInDate#,#form.ChkInDate#) EQ -1 AND DateCompare(#ChkOutDate#,#form.ChkOutDate#) EQ 1>
Cannot book 2...
<cfelseif DateCompare(#ChkInDate#,#form.ChkInDate#) EQ 1 AND DateCompare(#ChkOutDate#,#form.ChkOutDate#) EQ -1>
Cannot book 3...
<cfelseif DateCompare(#ChkInDate#,#form.ChkInDate#) EQ 0 AND DateCompare(#ChkOutDate#,#form.ChkOutDate#) EQ 0>
Cannot book 4
<cfelseif DateCompare(#ChkInDate#,#form.ChkInDate#) EQ -1 AND DateCompare(#ChkOutDate#,#form.ChkOutDate#) EQ -1>
Cannot book 5
<cfelseif DateCompare(#ChkInDate#,#form.ChkInDate#) EQ 1 AND DateCompare(#ChkOutDate#,#form.ChkOutDate#) EQ 1 AND DateCompare(#ChkOutDate#,#form.ChkInDate#) EQ 1>
Cannot book 5
<cfelse>
</cfif>
</cfloop>
thank you so much..