render_order_vat_info_table

The WooCommerce EU VAT Assistant render order vat info table function.

Description

render_order_vat_info_table( array $vat_info, array $labels, $display_decimals ); 

Parameters (3)

0. $vat_info
The vat info.
1. $labels
The labels.
2. $display_decimals
The display decimals.

Usage

  1. if ( !function_exists( 'render_order_vat_info_table' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-eu-vat-assistant/src/views/admin/order-vat-info-box.php'; 
  3.  
  4. // The vat info. 
  5. $vat_info = array $vat_info; 
  6.  
  7. // The labels. 
  8. $labels = array $labels; 
  9.  
  10. // The display decimals. 
  11. $display_decimals = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = render_order_vat_info_table($vat_info, $labels, $display_decimals); 
  15.  

Defined (1)

The function is defined in the following location(s).

/src/views/admin/order-vat-info-box.php  
  1. function render_order_vat_info_table(array $vat_info, array $labels, $display_decimals) { 
  2. $invoice_currency_column_css = ''; 
  3. if($vat_info['invoice_currency'] == $vat_info['vat_currency']) { 
  4. $invoice_currency_column_css = 'hidden'; 
  5. $exchange_rate = $vat_info['vat_currency_exchange_rate']; 
  6. ?> 
  7. <h4 class="subtitle"><?php echo get_value('title', $vat_info, ''); ?></h4> 
  8. <table> 
  9. <thead> 
  10. <tr> 
  11. <td class="label"><!-- Empty --></td> 
  12. <td class="invoice_currency <?php echo $invoice_currency_column_css ?>"><?php 
  13. echo $vat_info['invoice_currency']; 
  14. ?></td> 
  15. <td class="vat_currency"><?php 
  16. echo $vat_info['vat_currency']; 
  17. ?></td> 
  18. </tr> 
  19. </thead> 
  20. <tbody> 
  21. <!-- Items VAT totals --> 
  22. <tr> 
  23. <td class="label"><?php 
  24. echo $labels['items_total']; 
  25. ?></td> 
  26. <td class="amount invoice_currency <?php echo $invoice_currency_column_css ?>"><?php 
  27. echo number_format($vat_info['items_total'], $display_decimals); 
  28. ?></td> 
  29. <td class="amount vat_currency"><?php 
  30. echo number_format($vat_info['items_total'] * $exchange_rate, $display_decimals); 
  31. ?></td> 
  32. </tr> 
  33. <?php if(!empty($vat_info['items_refund'])): ?> 
  34. <!-- Items VAT refunds --> 
  35. <tr> 
  36. <td class="refund label"><?php 
  37. echo $labels['items_refund']; 
  38. // Make refund negative for display purposes (it will be clearer that 
  39. // it's a refund) 
  40. $vat_info['items_refund'] = $vat_info['items_refund'] * -1; 
  41. ?></td> 
  42. <td class="refund amount invoice_currency <?php echo $invoice_currency_column_css ?>"><?php 
  43. echo number_format($vat_info['items_refund'], $display_decimals); 
  44. ?></td> 
  45. <td class="refund amount vat_currency"><?php 
  46. echo number_format($vat_info['items_refund'] * $exchange_rate, $display_decimals); 
  47. ?></td> 
  48. </tr> 
  49. <?php endif; // Items refund - END ?> 
  50. <!-- Shipping VAT totals --> 
  51. <tr> 
  52. <td class="label"><?php 
  53. echo $labels['shipping_total']; 
  54. ?></td> 
  55. <td class="amount invoice_currency <?php echo $invoice_currency_column_css ?>"><?php 
  56. echo number_format($vat_info['shipping_total'], $display_decimals); 
  57. ?></td> 
  58. <td class="amount vat_currency"><?php 
  59. echo number_format($vat_info['shipping_total'] * $exchange_rate, $display_decimals); 
  60. ?></td> 
  61. </tr> 
  62. <?php if(!empty($vat_info['shipping_refund'])): ?> 
  63. <!-- Shipping VAT refunds --> 
  64. <tr> 
  65. <td class="refund label"><?php 
  66. echo $labels['shipping_refund']; 
  67. // Make refund negative for display purposes (it will be clearer that 
  68. // it's a refund) 
  69. $vat_info['shipping_refund'] = $vat_info['shipping_refund'] * -1; 
  70. ?></td> 
  71. <td class="refund amount invoice_currency <?php echo $invoice_currency_column_css ?>"><?php 
  72. echo number_format($vat_info['shipping_refund'], $display_decimals); 
  73. ?></td> 
  74. <td class="refund amount vat_currency"><?php 
  75. echo number_format($vat_info['shipping_refund'] * $exchange_rate, $display_decimals); 
  76. ?></td> 
  77. </tr> 
  78. <?php endif; // Shipping refund - END ?> 
  79. </tbody> 
  80. <tfoot> 
  81. <!-- Grand totals --> 
  82. <tr> 
  83. <td class="label"><?php 
  84. echo $labels['total']; 
  85. ?></td> 
  86. <td class="amount invoice_currency <?php echo $invoice_currency_column_css ?>"><?php 
  87. echo number_format($vat_info['total'], $display_decimals); 
  88. ?></td> 
  89. <td class="amount vat_currency"><?php 
  90. echo number_format($vat_info['total'] * $exchange_rate, $display_decimals); 
  91. ?></td> 
  92. </tr> 
  93. </tfoot> 
  94. </table> 
  95. <?php