how to create availability calendar

hi hugh

can you please help me with this code
main_booking___check_in = check in date
main_booking___date_time = actual date
main_booking___roomtype_id = type of room upon booking
$rom = room type

what i want is a calc element to count all data in the '{main_booking}' table where the following is met
conditions:
bookings made today should be displayed provided that the room type is equivalent to the row it will be displayed.

btw
i placed
Code:
return $matched - $actroom;
this is to subtract $queryfrom the actual no of rooms availble or for rent.

Code:
$actroom = '{room_type___standnoof_rooms}';
$rom = '{room_type___room_type}';
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select("COUNT(*)")->from('main_booking');
$query->where{'main_booking___check_in'='main_booking___date_time'} and {'main_booking___roomtype_id'= $rom);
$db->setQuery($query);
$matched = $db->loadResult();
return $matched - $actroom;

thanks
 
Saw your live chat request for me to look at this, I need a little while to finish what I'm in the middle of (a complex piece of coding) otherwise I'll lose the plot.

-- hugh
 
Which calc element is this? I don't see anything like that on your site (the one listed in your My Sites). There's 17 calc elements but none of them look like anything to do with booking.

-- hugh
 
hi hugh

can you please help me with this

$1='{noof_rooms]';
$2='{noof_nights}(standroom_price)';
$total = $1 + $2;
return $total;

i just want to get the total cost for the booking. logically its just "no of rooms plus the product of the standard room price and the number of nights.

thanks
 
Starting variable names with numbers is no valid php code, placeholders need {} and full element names;
so something like
Code:
$v1=(int)'{room_type___noof_rooms}';
$v2=(int)'{room_type___noof_nights}'*(int)'{room_type___standroom_price}';
$total = $v1 + $v2;
return $total;
 
hi troester
thanks so much for the quick reply.

its not working. i placed it on a calc element.
only calc on save is no
ajax calculation is yes.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top