function dbem_email_rsvp_booking()
{
    $booker = array();
    $bookerName = $_POST['bookerName'];
    $bookerEmail = $_POST['bookerEmail'];
    $bookerPhone = $_POST['bookerPhone'];
    $bookedSeats = $_POST['bookedSeats'];
    $event_id = $_GET['event_id'];
    $event = dbem_get_event($event_id);
    $available_seats = dbem_get_available_seats($event_id);
    $reserved_seats = dbem_get_booked_seats($event_id);
    if ($event['event_contactperson_id'] != "") {
        $contact_id = $event['event_contactperson_id'];
    } else {
        $contact_id = get_option('dbem_default_contact_person');
    }
    $contact_name = dbem_get_user_name($contact_id);
    $contact_body = dbem_replace_placeholders(get_option('dbem_contactperson_email_body'), $event);
    $booker_body = dbem_replace_placeholders(get_option('dbem_respondent_email_body'), $event);
    // email specific placeholders
    $placeholders = array('#_CONTACTPERSON' => $contact_name, '#_RESPNAME' => $bookerName, '#_RESPEMAIL' => $bookerEmail, '#_SPACES' => $bookedSeats, '#_RESERVEDSPACES' => $reserved_seats, '#_AVAILABLESPACES' => $available_seats);
    foreach ($placeholders as $key => $value) {
        $contact_body = str_replace($key, $value, $contact_body);
        $booker_body = str_replace($key, $value, $booker_body);
    }
    $contact_email = dbem_get_user_email($contact_id);
    dbem_send_mail(__("New booking", 'dbem'), $contact_body, $contact_email);
    dbem_send_mail(__('Reservation confirmed', 'dbem'), $booker_body, $bookerEmail);
}
function dbem_printable_booking_report($event_id)
{
    $event = dbem_get_event($event_id);
    $bookings = dbem_get_bookings_for($event_id);
    $available_seats = dbem_get_available_seats($event_id);
    $booked_seats = dbem_get_booked_seats($event_id);
    $stylesheet = get_bloginfo('url') . "/wp-content/plugins/events-manager/events_manager.css";
    ?>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
			"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html>
		<head>
			<meta http-equiv="Content-type" content="text/html; charset=utf-8">
			<title>Bookings for <?php 
    echo $event['event_name'];
    ?>
</title>
			 <link rel="stylesheet" href="<?php 
    echo $stylesheet;
    ?>
" type="text/css" media="screen" />
			
		</head>
		<body id="printable">
			<div id="container">
			<h1>Bookings for <?php 
    echo $event['event_name'];
    ?>
</h1> 
			<p><?php 
    echo dbem_replace_placeholders("#d #M #Y", $event);
    ?>
</p>
			<p><?php 
    echo dbem_replace_placeholders("#_LOCATION, #_ADDRESS, #_TOWN", $event);
    ?>
</p>   
			<h2><?php 
    _e('Bookings data', 'dbem');
    ?>
</h2>
			<table id="bookings-table">
				<tr>
					<th scope='col'><?php 
    _e('Name', 'dbem');
    ?>
</th>
					<th scope='col'><?php 
    _e('E-mail', 'dbem');
    ?>
</th>
					<th scope='col'><?php 
    _e('Phone number', 'dbem');
    ?>
</th> 
					<th scope='col'><?php 
    _e('Seats', 'dbem');
    ?>
</th> 
				<?php 
    foreach ($bookings as $booking) {
        ?>
				<tr>
					
					<td><?php 
        echo $booking['person_name'];
        ?>
</td> 
					<td><?php 
        echo $booking['person_email'];
        ?>
</td>
					<td><?php 
        echo $booking['person_phone'];
        ?>
</td>
					<td class='seats-number'><?php 
        echo $booking['booking_seats'];
        ?>
</td> 
				</tr>
			   <?php 
    }
    ?>
			  	<tr id='booked-seats'>
					<td colspan='2'>&nbsp;</td>
					<td class='total-label'><?php 
    _e('Booked', 'dbem');
    ?>
:</td>
					<td class='seats-number'><?php 
    echo $booked_seats;
    ?>
</td>
				</tr>
				<tr id='available-seats'>
					<td colspan='2'>&nbsp;</td> 
					<td class='total-label'><?php 
    _e('Available', 'dbem');
    ?>
:</td>  
					<td class='seats-number'><?php 
    echo $available_seats;
    ?>
</td>
				</tr>
			</table>  
			</div>
		</body>
		</html>
		<?php 
    die;
}