Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel Ekeroth 1 post 21 karma points
    Dec 02, 2011 @ 14:56
    Daniel Ekeroth
    0

    Deducting booked rooms from available rooms

    Hi guys,

    This is my first post here, but could not for my life find a solution to my problem.

    I'm building a booking system where I first have a Property i.e (house #1) and under this Property there are a variety of rooms i.e (1 bed, 2 bed and 3 bed) and beneath these there are bookings from a certain date to a different date.

    I have the date check all in place and that works but what I need to do is to deduct the value of the bookings that clash with the selected date.

    Let's say the customer chooses to book a bed in a 3 bed room but 3 bookings interfer with the selected dates then it should show up as not available however if only 2 bookings interfer with the selected dates it should show as available.

    My current code looks as follows;
     <xsl:variable name="bedCount" select="availableBeds"/>
        <xsl:for-each select="current()/Occupancy">
          <xsl:choose>
            <!-- Booking begins after selected start date and selected end date is before booking begins -->
            <xsl:when test="umbraco.library:DateGreaterThan(umbraco.library:FormatDateTime(bookedFrom, 'yyyy-MM-dd'), $fromDate) and umbraco.library:DateGreaterThanOrEqual(umbraco.library:FormatDateTime(bookedFrom, 'yyyy-MM-dd'), $toDate)">
              Not booked!
            </xsl:when>
            <!-- Booking begins before selected start date and ends before selected start date -->
            <xsl:when test="umbraco.library:DateGreaterThanOrEqual($fromDate,umbraco.library:FormatDateTime(bookedFrom, 'yyyy-MM-dd')) and umbraco.library:DateGreaterThanOrEqual($fromDate,umbraco.library:FormatDateTime(bookedTo, 'yyyy-MM-dd'))">
              Not booked!
            </xsl:when>
          </xsl:choose>
        </xsl:for-each>
        <xsl:value-of select="count(current()/Occupancy [umbraco.library:DateGraterThanOrEqual($fromDate, umbraco.library:FormatDateTime(bookedFrom, 'yyyy-MM-dd'))]"/>)

Please Sign in or register to post replies

Write your reply to:

Draft