eventsmanager

Admin-Bookings summary page - Amount Paid

Jun 18th, 2015
515
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. This snippet will get the amount paid when you edit the bookings in the admin-dashboard and use Offline payment "Add Offline Payment"
  3. */
  4.  
  5. function my_em_bookings_table_cols_template_amtpaid($template, $EM_Bookings_Table){
  6. $template['amt_paid'] = 'Amount Paid';
  7. return $template;
  8. }
  9. add_action('em_bookings_table_cols_template', 'my_em_bookings_table_cols_template_amtpaid',10,2);
  10.  
  11. function my_em_custom_booking_form_cols_amtpaid($val, $col, $EM_Booking, $EM_Bookings_Table, $csv){
  12. global $wpdb;
  13.  
  14. $paid_amount = $wpdb->get_var('SELECT sum(transaction_total_amount) FROM wp_em_transactions WHERE booking_id = '.$EM_Booking->booking_id);
  15.  
  16. $val = em_get_currency_formatted($paid_amount);
  17.  
  18. return $val;
  19. }
  20. add_filter('em_bookings_table_rows_col','my_em_custom_booking_form_cols_amtpaid', 10, 5);
RAW Paste Data