| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin View: Content tab preview export invoice |
| 4 |
* @author hungkv |
| 5 |
* @since 3.2.7.8 |
| 6 |
* @version 1.0.2 |
| 7 |
*/ |
| 8 |
|
| 9 |
/** |
| 10 |
* Prevent loading this file directly |
| 11 |
*/ |
| 12 |
defined( 'ABSPATH' ) || exit(); |
| 13 |
/** |
| 14 |
* @var $order LP_Order |
| 15 |
*/ |
| 16 |
if ( ! isset( $order ) || ! isset( $currency_symbol ) ) { |
| 17 |
return; |
| 18 |
} |
| 19 |
|
| 20 |
$order_date = new LP_Datetime( $order->get_data( 'order_date' ) ); |
| 21 |
?> |
| 22 |
|
| 23 |
<div class="lp-invoice__header"> |
| 24 |
<div class="lp-invoice__hleft"> |
| 25 |
<h1><?php echo esc_html__( 'Invoice', 'learnpress' ); ?></h1> |
| 26 |
</div> |
| 27 |
<div class="lp-invoice__hright"> |
| 28 |
<?php |
| 29 |
echo wp_sprintf( '<p class="invoice-field invoice-title">%s</p>', esc_html( get_bloginfo( 'name' ) ) ); |
| 30 |
echo wp_sprintf( |
| 31 |
'<p class="invoice-field invoice-date">%s: %s</p>', |
| 32 |
esc_html__( 'Order Date', 'learnpress' ), |
| 33 |
$order_date->format( LP_Datetime::I18N_FORMAT_HAS_TIME ) |
| 34 |
); |
| 35 |
echo wp_sprintf( '<p class="invoice-field invoice-no">%s: %s</p>', esc_html__( 'Invoice No.', 'learnpress' ), esc_attr( $order->get_order_number() ) ); |
| 36 |
echo wp_sprintf( '<p class="invoice-field invoice-customer">%s: %s</p>', esc_html__( 'Customer', 'learnpress' ), esc_html( $order->get_customer_name() ) ); |
| 37 |
echo wp_sprintf( '<p class="invoice-field invoice-email">%s: %s</p>', esc_html__( 'Email', 'learnpress' ), esc_html( $order->get_user( 'email' ) ) ); |
| 38 |
?> |
| 39 |
<p class="invoice-field invoice-method"> |
| 40 |
<?php |
| 41 |
$method_title = $order->get_payment_method_title(); |
| 42 |
$user_ip = $order->get_user_ip_address(); |
| 43 |
if ( $method_title && $user_ip ) { |
| 44 |
printf( 'Pay via <strong>%s</strong> at <strong>%s</strong>', apply_filters( 'learn-press/order-payment-method-title', $method_title, $order ), $user_ip ); |
| 45 |
} elseif ( $method_title ) { |
| 46 |
printf( 'Pay via <strong>%s</strong>', apply_filters( 'learn-press/order-payment-method-title', $method_title, $order ) ); |
| 47 |
} elseif ( $user_ip ) { |
| 48 |
printf( 'User IP <strong>%s</strong>', $user_ip ); |
| 49 |
} |
| 50 |
?> |
| 51 |
</p> |
| 52 |
</div> |
| 53 |
</div> |
| 54 |
<div class="lp-invoice__body"> |
| 55 |
<h4 class="order-data-heading"><?php echo esc_html__( 'Order details', 'learnpress' ); ?></h4> |
| 56 |
<div class="order-items"> |
| 57 |
<table id="tab_customers" class="table table-striped list-order-items"> |
| 58 |
<colgroup> |
| 59 |
<col> |
| 60 |
<col> |
| 61 |
<col> |
| 62 |
<col> |
| 63 |
</colgroup> |
| 64 |
<thead> |
| 65 |
<tr class='warning'> |
| 66 |
<th class="column-name"><?php _e( 'Item', 'learnpress' ); ?></th> |
| 67 |
<th class="column-price"><?php _e( 'Cost', 'learnpress' ); ?></th> |
| 68 |
<th class="column-quantity"><?php _e( 'Quantity', 'learnpress' ); ?></th> |
| 69 |
<th class="column-total align-right"><?php _e( 'Amount', 'learnpress' ); ?></th> |
| 70 |
</tr> |
| 71 |
</thead> |
| 72 |
<tbody> |
| 73 |
<?php |
| 74 |
$filter = array( |
| 75 |
'p' => 0, |
| 76 |
'limit' => '9999', |
| 77 |
); |
| 78 |
|
| 79 |
$items = $order->get_items_filter( $filter ); |
| 80 |
if ( $items ) : |
| 81 |
?> |
| 82 |
<?php foreach ( $items as $item ) : ?> |
| 83 |
<tr> |
| 84 |
<td><?php echo esc_html( $item['name'] ); ?></td> |
| 85 |
<td><?php echo learn_press_format_price( $item['total'] ?? 0, $currency_symbol ?? '$' ); ?></td> |
| 86 |
<td>x <?php echo $item['quantity'] ?? 0; ?></td> |
| 87 |
<td><?php echo learn_press_format_price( $item['total'] ?? 0, $currency_symbol ?? '$' ); ?></td> |
| 88 |
</tr> |
| 89 |
<?php endforeach; ?> |
| 90 |
<?php endif; ?> |
| 91 |
</tbody> |
| 92 |
<tfoot> |
| 93 |
<tr> |
| 94 |
<td></td> |
| 95 |
<td></td> |
| 96 |
<td><?php echo esc_html__( 'Sub Total', 'learnpress' ); ?></td> |
| 97 |
<td><?php echo learn_press_format_price( $order->get_data( 'order_subtotal' ), $currency_symbol ); ?></td> |
| 98 |
</tr> |
| 99 |
<tr> |
| 100 |
<td></td> |
| 101 |
<td></td> |
| 102 |
<td><?php _e( 'Total', 'learnpress' ); ?></td> |
| 103 |
<td><?php echo learn_press_format_price( $order->get_data( 'order_total' ), $currency_symbol ); ?></td> |
| 104 |
</tr> |
| 105 |
</tfoot> |
| 106 |
</table> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
|