Advertisement
Beee

bookings-event-printable.php

Mar 25th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.65 KB | None | 0 0
  1. <?php
  2. /*
  3.  * This page displays a printable view of bookings for a single event.
  4.  */
  5. global $EM_Event;
  6. ?>
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10.     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  11.     <title><?php echo sprintf(__('Bookings for %s','dbem'), $EM_Event->name); ?></title>
  12.     <link rel="stylesheet" href="<?php echo bloginfo('wpurl') ?>/wp-content/plugins/events-manager/includes/css/events_manager.css" type="text/css" media="screen" />
  13.     <link rel="stylesheet" href="<?php echo bloginfo('wpurl') ?>/wp-content/themes/v3/assets/css/plugin-tweaks.css" type="text/css" media="screen" />
  14. </head>
  15. <body id="printable">
  16.     <div id="container">
  17.     <h1><?php echo sprintf(__('Bookings for %s','dbem'), $EM_Event->name); ?></h1>
  18.     <p><?php echo $EM_Event->output("#j #F #Y"); ?> @ <?php echo $EM_Event->output("#_LOCATION, #_ADDRESS, #_TOWN (#_LOCATIONCOUNTRY)"); ?></p>  
  19.     <h3 class='hide'><?php _e('Bookings', 'dbem');?></h3>
  20.     <table id="bookings-table">
  21.         <tr>
  22.             <th scope='col'><?php _e('Name', 'dbem')?></th>
  23.             <th scope='col'><?php _e('Spaces', 'dbem')?></th>
  24.             <th scope='col'><?php _e('Total', 'dbem')?></th>
  25.             <th scope='col'><?php _e('Status', 'dbem')?></th>
  26.         </tr>
  27.         <?php $pending = 0; ?>
  28.         <?php foreach($EM_Event->get_bookings()->bookings as $EM_Booking) {      
  29.             // if ( $EM_Booking->status != 1) {
  30.             ?>
  31.         <tr>
  32.             <td class=''><?php echo $EM_Booking->person->get_name(); ?></td>
  33.             <td class=''><?php echo $EM_Booking->get_spaces(); ?></td>
  34.             <td class=''><?php echo $EM_Booking->get_price(true); ?></td>
  35.             <?php
  36.                 if ( $EM_Booking->get_status() != 'Approved' ) {
  37.                     if ( $EM_Booking->get_spaces() == 1 ) {
  38.                         $pending++;
  39.                     } else if ( $EM_Booking->get_spaces() > 1 ) {
  40.                         $pending = $pending + $EM_Booking->get_spaces();
  41.                     }
  42.                 }
  43.             ?>
  44.             <td class='payment-status'><?php echo $EM_Booking->get_status(); ?></td>
  45.         </tr>
  46.     <?php
  47.             // }
  48.         }
  49.     ?>
  50.     <tr id='booked-spaces'>
  51.             <td class='xtotal-label' class=''><?php _e('Approved registrations', 'dbem')?>:</td>
  52.             <td colspan='2' class=''>&nbsp;</td>
  53.             <?php
  54.                 echo "<td class='spaces-number' class=''>";
  55.                 echo $EM_Event->get_bookings()->get_booked_spaces();
  56.                 echo "</td>";
  57.             ?>
  58.         </tr>
  59.     <tr id='available-spaces'>
  60.             <td class='xtotal-label' class=''><?php _e('Pending registrations', 'dbem')?>:</td>
  61.             <td colspan='2' class=''>&nbsp;</td>
  62.             <?php
  63.                 echo "<td class='spaces-number' class=''>";
  64.                 echo $pending;
  65.                 echo "</td>";
  66.             ?>
  67.         </tr>
  68.         <tr id='available-spaces'>
  69.             <td class='xtotal-label' class=''><?php _e('Available places', 'dbem')?>:</td>  
  70.             <td colspan='2' class=''>&nbsp;</td>
  71.             <?php
  72.                 $booked_places      = $EM_Event->get_bookings()->get_booked_spaces(); // confirmed bookings
  73.                 $booked_places      += $pending;
  74.                 $available              = $EM_Event->get_spaces() - $booked_places;
  75.             ?>
  76.             <td class='spaces-number' class=''><?php echo $available; ?></td>
  77.         </tr>
  78.         <tr id='total-price'>
  79.             <td class='xtotal-label' class=''><?php _e('Total approved registrations', 'dbem')?>:</td>
  80.             <td colspan='2' class=''>&nbsp;</td>
  81.             <?php
  82.                 $approvedtotal = $EM_Booking->get_price() * $EM_Event->get_bookings()->get_booked_spaces();
  83.                 $total = 0;
  84.                 foreach($EM_Event->get_bookings()->bookings as $EM_Booking) {
  85.                     if ($EM_Event->get_bookings()->get_booked_spaces() > 1 ) {
  86.                         $a = $EM_Booking->get_price();
  87.                     } else {
  88.                         $a = $EM_Booking->get_price() * $EM_Event->get_bookings()->get_spaces();           
  89.                     }
  90.                     $total += $a;
  91.                 }
  92.             ?>
  93.             <td class='spaces-number' class=''><?php echo $EM_Booking->format_price($approvedtotal); ?></td>
  94.         </tr>
  95.     </table>  
  96.     </div>
  97. </body>
  98. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement