<?php
require_once('../config.php');
require_once('../../db.php');
include('currency.php');
//function gregorian dates is month, day, year
function daysDifference($endDate, $beginDate)
{
    $date_parts1 = explode("/", $beginDate);
    $date_parts2 = explode("/", $endDate);
    $start_date  = gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
    $end_date    = gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
    return $end_date - $start_date;
}
//total guest based on the first room
$roomsearchtotal  = '0';
$room_code        = '';
$room_name        = '';
$room_capacity    = '';
$room_inventory   = '';
$room_price       = '';
$arrayroomssearch = array();
//Variables guests=$guests
$hotelid   = mysqli_escape_string($conn, $_GET['hotelid']);
$hotelname = mysqli_escape_string($conn, $_GET['hotelname']);
$guests    = mysqli_escape_string($conn, $_GET['guests']);
$maxguests    = mysqli_escape_string($conn, $_GET['maxguests']);
$khotelcity = mysqli_escape_string($conn, $_GET['city']);
$guests = mysqli_escape_string($conn, $_GET['guests']);
require_once('../data-bgo/booking-data-in-get.php');
require_once('../data-bgo/booking-data-send.php');
//calculate days between checkin and checkout
$diasestadia      = daysDifference($checkout, $checkin);
require_once('../libraries-bgo/hotel-rooms.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bookingo</title>
</head>

<body>

			
			<div class="HotelListTitlesContent">
                  <div class="HotelListDetailsAvailable roomheadertitle">
                    <p>Available room types</p>
                  </div>
                  <div class="HotelListDetailsPerson roomheadertitle">
                    <p>Max Persons</p>
                  </div>
                  <div class="HotelListDetailsRate roomheadertitle">
                    <p>Rate</p>
                  </div>
                  <div class="HomeDetailsBookNow roomheadertitle">
                    <p>Book Now</p>
                  </div>
            </div>
			<?php
				if ($roomsearchtotal > 0) {
					for ($kk = 1; $kk <= $roomsearchtotal; $kk++) {
						$arrk = $kk - 1;
						$roomprice = $arrayroomssearch[$arrk]['room_price'];
						$finalprice = $roomprice*$finaltotal;
			?>
                
                <div class="HotelListDescriptionContent">
                  <div class="HotelListDescriptionAvailable">
                    <p class="roomdatacontenttxt"><?php echo $arrayroomssearch[$arrk]['room_name']; ?></p>
                  </div>
                  <div class="HotelListDescriptionPerson">
                    <p class="roomdatacontenttxt"><?php echo $arrayroomssearch[$arrk]['room_capacity']; ?></p>
                  </div>
                  <div class="HotelListDescriptionsRate">
                    <p class="roomdatacontenttxtsize">From <?php echo $currencysymbol . number_format($finalprice, 2, '.', ''); ?></p>
                  </div>
                  <div class="HotelListDescriptionBookNow ">
                    <a href='<?php echo "checkout.php?hotelid=".$hotelid."&hotelname=".$hotelname."&city=$khotelcity&element_id=&longitud=&latitud=&room_code=".$arrayroomssearch[$arrk]['room_code']."&room_name=".$arrayroomssearch[$arrk]['room_name']."&taxfee=".$arrayroomssearch[$arrk]['taxfee']."&ratekey=".$arrayroomssearch[$arrk]['ratekey']."&ratecode=".$arrayroomssearch[$arrk]['ratecode']."&ota_priority=".$arrayroomssearch[$arrk]['ota']."&".$datosbusqueda."&baseC=".$newcurrency; ?>'><input type="button" class="btn btn-primary radius fr pull-right" value="Book Now!"></a>
                  </div>
                </div>
                <?php }
					 } else { ?>
					 <span><center>No avalaible room in this moment <?php echo $totalpersons; ?></center></span>
                <?php }	?>

</body>
</html>