Stambro

PDF Invoices & Packing Slips for WooCommerce with WooCommerce Eu Vat & B2B

Nov 25th, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.02 KB | None | 0 0
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
  2.  
  3. <?php do_action( 'wpo_wcpdf_before_document', $this->get_type(), $this->order ); ?>
  4.  
  5. <table class="head container">
  6.     <tr>
  7.         <td class="header">
  8.         <?php
  9.         if ( $this->has_header_logo() ) {
  10.             do_action( 'wpo_wcpdf_before_shop_logo', $this->get_type(), $this->order );
  11.             $this->header_logo();
  12.             do_action( 'wpo_wcpdf_after_shop_logo', $this->get_type(), $this->order );
  13.         } else {
  14.             $this->title();
  15.         }
  16.         ?>
  17.         </td>
  18.         <td class="shop-info">
  19.             <?php do_action( 'wpo_wcpdf_before_shop_name', $this->get_type(), $this->order ); ?>
  20.             <div class="shop-name"><h3><?php $this->shop_name(); ?></h3></div>
  21.             <?php do_action( 'wpo_wcpdf_after_shop_name', $this->get_type(), $this->order ); ?>
  22.             <?php do_action( 'wpo_wcpdf_before_shop_address', $this->get_type(), $this->order ); ?>
  23.             <div class="shop-address"><?php $this->shop_address(); ?></div>
  24.             <?php do_action( 'wpo_wcpdf_after_shop_address', $this->get_type(), $this->order ); ?>
  25.            
  26.         </td>
  27.     </tr>
  28. </table>
  29.  
  30. <?php do_action( 'wpo_wcpdf_before_document_label', $this->get_type(), $this->order ); ?>
  31.  
  32. <h1 class="document-type-label">
  33.     <?php if ( $this->has_header_logo() ) $this->title(); ?>
  34. </h1>
  35.  
  36. <?php do_action( 'wpo_wcpdf_after_document_label', $this->get_type(), $this->order ); ?>
  37.  
  38. <table class="order-data-addresses">
  39.     <tr>
  40.         <td class="address billing-address"><h3>Billing Address</h3>
  41.        
  42.             <!-- <h3><?php _e( 'Billing Address:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3> -->
  43.             <?php do_action( 'wpo_wcpdf_before_billing_address', $this->get_type(), $this->order ); ?>
  44.             <?php $this->billing_address(); ?>
  45.             <?php do_action( 'wpo_wcpdf_after_billing_address', $this->get_type(), $this->order ); ?>
  46.             <?php if ( isset( $this->settings['display_email'] ) ) : ?>
  47.                 <div class="billing-email"><?php $this->billing_email(); ?></div>
  48.             <?php endif; ?>
  49.             <?php if ( isset( $this->settings['display_phone'] ) ) : ?>
  50.                 <div class="billing-phone"><?php $this->billing_phone(); ?></div>
  51.             <?php endif; ?>
  52.            
  53.  
  54.  
  55.             <?php
  56.                 global $wcev_order_model;
  57.                 $vat_number = $wcev_order_model->get_vat_number($order_id);
  58.             ?>
  59.  
  60.             <div class="vat-number">VAT Number: <?php echo $vat_number; ?></div>
  61.  
  62.  
  63.         </td>
  64.         <td class="address shipping-address">
  65.             <?php if ( $this->show_shipping_address() ) : ?>
  66.                 <h3><?php _e( 'Ship To:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
  67.                 <?php do_action( 'wpo_wcpdf_before_shipping_address', $this->get_type(), $this->order ); ?>
  68.                 <?php $this->shipping_address(); ?>
  69.                 <?php do_action( 'wpo_wcpdf_after_shipping_address', $this->get_type(), $this->order ); ?>
  70.                 <?php if ( isset( $this->settings['display_phone'] ) ) : ?>
  71.                     <div class="shipping-phone"><?php $this->shipping_phone(); ?></div>
  72.                 <?php endif; ?>
  73.             <?php endif; ?>
  74.         </td>
  75.         <td class="order-data">
  76.             <table>
  77.                 <?php do_action( 'wpo_wcpdf_before_order_data', $this->get_type(), $this->order ); ?>
  78.                 <?php if ( isset( $this->settings['display_number'] ) ) : ?>
  79.                     <tr class="invoice-number">
  80.                         <th><?php echo $this->get_number_title(); ?></th>
  81.                         <td><?php $this->invoice_number(); ?></td>
  82.                     </tr>
  83.                 <?php endif; ?>
  84.                 <?php if ( isset( $this->settings['display_date'] ) ) : ?>
  85.                     <tr class="invoice-date">
  86.                         <th><?php echo $this->get_date_title(); ?></th>
  87.                         <td><?php $this->invoice_date(); ?></td>
  88.                     </tr>
  89.                 <?php endif; ?>
  90.                 <tr class="order-number">
  91.                     <th><?php _e( 'Order Number:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
  92.                     <td><?php $this->order_number(); ?></td>
  93.                 </tr>
  94.                 <tr class="order-date">
  95.                     <th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
  96.                     <td><?php $this->order_date(); ?></td>
  97.                 </tr>
  98.                 <?php if ( $payment_method = $this->get_payment_method() ) : ?>
  99.                 <tr class="payment-method">
  100.                     <th><?php _e( 'Payment Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
  101.                     <td><?php echo $payment_method; ?></td>
  102.                 </tr>
  103.                 <?php endif; ?>
  104.                 <?php do_action( 'wpo_wcpdf_after_order_data', $this->get_type(), $this->order ); ?>
  105.             </table>           
  106.         </td>
  107.     </tr>
  108. </table>
  109.  
  110. <?php do_action( 'wpo_wcpdf_before_order_details', $this->get_type(), $this->order ); ?>
  111.  
  112. <table class="order-details">
  113.     <thead>
  114.         <tr>
  115.             <th class="product"><?php _e( 'Product', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
  116.             <th class="quantity"><?php _e( 'Quantity', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
  117.             <th class="price"><?php _e( 'Price', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
  118.         </tr>
  119.     </thead>
  120.     <tbody>
  121.         <?php foreach ( $this->get_order_items() as $item_id => $item ) : ?>
  122.             <tr class="<?php echo apply_filters( 'wpo_wcpdf_item_row_class', 'item-'.$item_id, esc_attr( $this->get_type() ), $this->order, $item_id ); ?>">
  123.                 <td class="product">
  124.                     <?php $description_label = __( 'Description', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?>
  125.                     <span class="item-name"><?php echo $item['name']; ?></span>
  126.                     <?php do_action( 'wpo_wcpdf_before_item_meta', $this->get_type(), $item, $this->order  ); ?>
  127.                     <span class="item-meta"><?php echo $item['meta']; ?></span>
  128.                     <dl class="meta">
  129.                         <?php $description_label = __( 'SKU', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?>
  130.                         <?php if ( ! empty( $item['sku'] ) ) : ?><dt class="sku"><?php _e( 'SKU:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="sku"><?php echo esc_attr( $item['sku'] ); ?></dd><?php endif; ?>
  131.                         <?php if ( ! empty( $item['weight'] ) ) : ?><dt class="weight"><?php _e( 'Weight:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="weight"><?php echo esc_attr( $item['weight'] ); ?><?php echo esc_attr( get_option( 'woocommerce_weight_unit' ) ); ?></dd><?php endif; ?>
  132.                     </dl>
  133.                     <?php do_action( 'wpo_wcpdf_after_item_meta', $this->get_type(), $item, $this->order  ); ?>
  134.                 </td>
  135.                 <td class="quantity"><?php echo $item['quantity']; ?></td>
  136.                 <td class="price"><?php echo $item['order_price']; ?></td>
  137.             </tr>
  138.         <?php endforeach; ?>
  139.     </tbody>
  140.     <tfoot>
  141.         <tr class="no-borders">
  142.             <td class="no-borders">
  143.                 <div class="document-notes">
  144.                     <?php do_action( 'wpo_wcpdf_before_document_notes', $this->get_type(), $this->order ); ?>
  145.                     <?php if ( $this->get_document_notes() ) : ?>
  146.                         <h3><?php _e( 'Notes', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
  147.                         <?php $this->document_notes(); ?>
  148.                     <?php endif; ?>
  149.                     <?php do_action( 'wpo_wcpdf_after_document_notes', $this->get_type(), $this->order ); ?>
  150.                 </div>
  151.                 <div class="customer-notes">
  152.                     <?php do_action( 'wpo_wcpdf_before_customer_notes', $this->get_type(), $this->order ); ?>
  153.                     <?php if ( $this->get_shipping_notes() ) : ?>
  154.                         <h3><?php _e( 'Customer Notes', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
  155.                         <?php $this->shipping_notes(); ?>
  156.                     <?php endif; ?>
  157.                     <?php do_action( 'wpo_wcpdf_after_customer_notes', $this->get_type(), $this->order ); ?>
  158.                 </div>             
  159.             </td>
  160.             <td class="no-borders" colspan="2">
  161.                 <table class="totals">
  162.                     <tfoot>
  163.                         <?php foreach ( $this->get_woocommerce_totals() as $key => $total ) : ?>
  164.                             <tr class="<?php echo esc_attr( $key ); ?>">
  165.                                 <th class="description"><?php echo $total['label']; ?></th>
  166.                                 <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td>
  167.                             </tr>
  168.                         <?php endforeach; ?>
  169.                     </tfoot>
  170.                 </table>
  171.             </td>
  172.         </tr>
  173.     </tfoot>
  174. </table>
  175.  
  176. <div class="bottom-spacer"></div>
  177.  
  178. <?php do_action( 'wpo_wcpdf_after_order_details', $this->get_type(), $this->order ); ?>
  179.  
  180. <?php if ( $this->get_footer() ) : ?>
  181.     <div id="footer">
  182.         <!-- hook available: wpo_wcpdf_before_footer -->
  183.         <?php $this->footer(); ?>
  184.         <!-- hook available: wpo_wcpdf_after_footer -->
  185.     </div><!-- #letter-footer -->
  186. <?php endif; ?>
  187.  
  188. <?php do_action( 'wpo_wcpdf_after_document', $this->get_type(), $this->order ); ?>
  189.  
Advertisement
Add Comment
Please, Sign In to add comment