You are here

commerce-invoice.html.twig in Commerce Invoice 8.2

Template for the invoice.

Available variables:

  • invoice_entity: The invoice entity.
  • billing_information: The billing information.
  • totals: An array of invoice totals values with the following keys:
    • subtotal: The invoice subtotal price.
    • adjustments: An array of adjustment totals:
      • type: The adjustment type.
      • label: The adjustment label.
      • total: The adjustment total price.
      • weight: The adjustment weight, taken from the adjustment type.
    • total: The invoice total price.

File

templates/commerce-invoice.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template for the invoice.
  5. *
  6. * Available variables:
  7. * - invoice_entity: The invoice entity.
  8. * - billing_information: The billing information.
  9. * - totals: An array of invoice totals values with the following keys:
  10. * - subtotal: The invoice subtotal price.
  11. * - adjustments: An array of adjustment totals:
  12. * - type: The adjustment type.
  13. * - label: The adjustment label.
  14. * - total: The adjustment total price.
  15. * - weight: The adjustment weight, taken from the adjustment type.
  16. * - total: The invoice total price.
  17. *
  18. * @ingroup themeable
  19. */
  20. #}
  21. {% set due_date = invoice_entity.getDueDateTime %}
  22. {% if (logo_url) %}
  23. <img src="{{ logo_url }}"/>
  24. {% endif %}
  25. <div class="invoice-header">
  26. <table class="table-container fullwidth">
  27. <tr>
  28. <td>
  29. {% if (invoice.billing_information) %}
  30. <div class="billing-information">
  31. <h3>{{ 'Billed to'|t }}</h3>
  32. {{ invoice.billing_information }}
  33. </div>
  34. {% endif %}
  35. </td>
  36. <td>
  37. <table class="invoice-table">
  38. <tbody>
  39. <tr>
  40. <td>{{ 'Invoice'|t }}</td>
  41. <td>{{ invoice_entity.getInvoiceNumber }}</td>
  42. </tr>
  43. <tr>
  44. <td>{{ 'Date'|t }}</td>
  45. <td>{{ invoice_entity.getInvoiceDateTime|format_date('html_date') }}</td>
  46. </tr>
  47. {% if (due_date) %}
  48. <tr>
  49. <td>{{ 'Due date'|t }}</td>
  50. <td>{{ due_date|format_date('html_date') }}</td>
  51. </tr>
  52. {% endif %}
  53. </tbody>
  54. </table>
  55. </td>
  56. </tr>
  57. </table>
  58. </div>
  59. <div class="invoice-items-container">
  60. <table class="invoice-items">
  61. <thead>
  62. <tr>
  63. <th>{{ 'Description'|t }}</th>
  64. <th>{{ 'Unit price'|t }}</th>
  65. <th>{{ 'Quantity'|t }}</th>
  66. <th>{{ 'Total'|t }}</th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. {% block invoice_items %}
  71. {% for invoice_item in invoice_entity.getItems %}
  72. <tr>
  73. <td>{{ invoice_item.label }} {{ invoice_item.getDescription }}</td>
  74. <td>{{ invoice_item.getUnitPrice|commerce_price_format }}</td>
  75. <td>
  76. {{ invoice_item.getQuantity|number_format }}
  77. </td>
  78. <td>
  79. {{ invoice_item.getTotalPrice|commerce_price_format }}
  80. </td>
  81. </tr>
  82. {% endfor %}
  83. {% endblock %}
  84. </tbody>
  85. </table>
  86. </div>
  87. <div class="invoice-totals-container">
  88. <table class="table-container fullwidth">
  89. <tr>
  90. <td>
  91. <table class="invoice-table">
  92. <tbody>
  93. <tr>
  94. <td>
  95. {{ 'Subtotal'|t }}
  96. </td>
  97. <td>
  98. {{ totals.subtotal|commerce_price_format }}
  99. </td>
  100. </tr>
  101. {% for adjustment in totals.adjustments %}
  102. <tr>
  103. <td>
  104. {{ adjustment.label }}
  105. </td>
  106. <td>
  107. {{ adjustment.total|commerce_price_format }}
  108. </td>
  109. </tr>
  110. {% endfor %}
  111. <tr class="invoice-total">
  112. <td>
  113. {{ 'Invoice Total'|t }}
  114. </td>
  115. <td>
  116. {{ invoice_entity.getTotalPrice|commerce_price_format }}
  117. </td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. </td>
  122. </tr>
  123. </table>
  124. </div>
  125. {% if (payment_terms) %}
  126. <div class="invoice-payment-terms">
  127. {{ payment_terms }}
  128. </div>
  129. {% endif %}
  130. {% if (footer_text) %}
  131. <div class="invoice-footer">
  132. {{ footer_text }}
  133. </div>
  134. {% endif %}