Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 4 Next »

Overview

Default templates are provided for all order notes. If you wish to customize these templates, you can do so by overriding the default templates with your own.

Adding a Custom Template

To add a custom order note template, follow these steps:

  1. In the Admin Panel, navigate to:
    Home › B3_Pdf › Order Note Templates

  2. Add a new order note template to override the default template.

When creating or configuring production sheets in the Admin Panel, the following fields are available:

Field

Description

Template name

Specify one of the following values to override the corresponding default template:

  • order_notes/confirmation_note.html

  • order_notes/delivery_note.html

  • order_notes/invoice.html

Template

Provide a Django HTML template here. The Django templating engine will use this to generate PDF files. An example template is provided below.

Service

Select the Service to which this template applies. Leave empty if the template should be applied to all Services within the organization.

Organization

Select the organization to which this template applies. Leave empty if the template applies only to a Service.

Example Template

Below is an example of an invoice HTML template.

For help configuring templates or to obtain additional default templates, you can reach out to our Customer Support.

{% load i18n static pdf_tags %}
{% get_current_language as LANGUAGE_CODE %}
<!doctype html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{ preview_title }}</title>
    <link rel="stylesheet" href="{% static 'css/order_notes/base.css' %}">
    {% if css_additional %}
        <link rel="stylesheet" href="{% static css_additional %}">
    {% endif %}
    {% include "b3_pdf/extra_header.html" %}
</head>
<body>
<header>
    <table class="header">
        <tr>
            <td class="header__logo">
                <img src="{{ logo_url }}" alt="Default Logo">
            </td>
        </tr>
    </table>
    <div class="header__address">
        {{ service.name }} | {{ sender_address_line }}
    </div>
    <table class="address">
        <tr>
            <td class="address__to">
                <div class="element__label">{% trans 'Billing Address' %}</div>
                <div class="element__value">
                    {{ billing_address.salutation }}
                    {% if billing_address.company_name %}
                        <br/> {{ billing_address.company_name }}
                    {% endif %}
                    {% if billing_address.line1 %}
                        <br/> {{ billing_address.line1 }}
                    {% endif %}
                    {% if billing_address.line2 %}
                        <br/> {{ billing_address.line2 }}
                    {% endif %}
                    <br/> {{ billing_address.city }}{% if billing_address.state %}, {{ billing_address.state }}{% endif %}, {{ billing_address.zip_code }}
                    <br/> {{ billing_address.country.name }}
                </div>
            </td>
            <td class="address__from">
                <div class="element__label">{% trans 'Customer Support' %}</div>
                <div class="element__value">
                    {{ service_address.phone_number }}
                    {% if service.email %}
                        <br> {% trans 'Email:' %} {{ service.email }}
                    {% endif %}
                    <br> {% trans 'Processed by:' %} {{ service_user_name }}
                    <br> {{ note_data.issue_date|date:theme_date_format }}
                </div>
            </td>
        </tr>
    </table>
</header>
<main>
    <h1 class="page-title">
        {{ note_name }}: {{ note_prefix }}{{ note_id }}
    </h1>
    <table class="info">
        <tr>
            <td class="element">
                <div class="element__label">{% trans 'Order #' %}</div>
                <div class="element__value">{{ order_obj.full_number }}</div>
            </td>
            <td class="element">
                <div class="element__label">{% trans 'Order Date' %}</div>
                <div class="element__value">{{ order_date|date:theme_date_format }}</div>
            </td>
            {% if is_customer_number_shown %}
            <td class="element">
                <div class="element__label">{{ customer_number_label }}</div>
                <div class="element__value">{{ customer_number|default:"-" }}</div>
            </td>
            {% endif %}
            {% if is_customer_reference_shown %}
            <td class="element">
                <div class="element__label">{{ customer_reference_label }}</div>
                <div class="element__value">{{ customer_reference|default:"-" }}</div>
            </td>
            {% endif %}
        </tr>
    </table>
    <table class="info info--grey">
        <tr>
            <td class="element">
                <div class="element__label">{% trans 'Order Confirmation #' %}</div>
                <div class="element__value">{{ confirmation_note.order_confirmation_number }}</div>
            </td>
            <td class="element">
                <div class="element__label">{% trans 'Payment method' %}</div>
                {% if payment_custom_fields %}
                  <div class="element__value">{{ payment_custom_fields }}</div>
                {% else %}
                <div class="element__value">{% trans order_obj.payment_method_name %}</div>
                {% endif %}

                {% comment %}
                    To access individual payment metadata items:
                    {% if payment_metadata %}
                      {% for key, value in payment_metadata.items %}
                       {{ key }}: {{ value }}<br>
                      {% endfor %}
                    {% endif %}
                {% endcomment %}
            </td>
            <td class="element">
                <div class="element__label">{% trans 'Delivery date' %}</div>
                <div class="element__value">{{ note_data.shipping_date|date:theme_date_format }}</div>
            </td>
            <td class="element">
                <div class="element__label">{% trans 'Shipping Type' %}</div>
                <div class="element__value">
                    {{ order_obj.shipping_method }}
                </div>
            </td>
        </tr>
    </table>
    {% if backdrop_text %}
        <div class="overlay-wrapper">
            <div class="overlay-text">
                {% trans backdrop_text %}
            </div>
        </div>
    {% endif %}
    <section id="customer-greeting">
        <h4>{% blocktrans %}Dear Sir or Madam, Thank you for your order.{% endblocktrans %}</h4>
        <p>
            {% blocktrans %}
                We hope you were satisfied with the handling of your order so far. If you have any questions or need
                further information, we are of course happy to help.
            {% endblocktrans %}
        </p>
    </section>
    <section id="order-lines">
        <table class="kt-table">
            <thead>
            <tr>
                <th class="line-number">#</th>
                <th class="line-image"></th>
                <th class="line-part">{% trans 'Part' %}</th>
                <th class="line-quantity text-right">{% trans 'Qty.' %}</th>
                <th class="line-price-unit text-right">{% trans 'Unit Price' %}</th>
                <th class="line-price-discount text-right">{% trans 'Discount' %}</th>
                <th class="line-price-total text-right">{% trans 'Item Total' %}</th>
            </tr>
            </thead>
            <tbody>
            {% for line in order_lines %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td class="line-thumbnail">
                        <img
                            src="{{ line.thumbnail }}"
                            alt="{{ line.fullName }}"
                            class="line-image"
                        >
                    </td>
                    <td>
                        <b>{{ line.fullName }}</b>
                        <br> {{ line.offer.technology }}
                        <br> {{ line.offer.material }} | {{ line.prices.printPrice|as_currency:line.prices.currency }}
                        {% if line.offer.postProcessings %}
                            <br>
                            {% for option in line.offer.postProcessings %}
                                <br/>{{ option.name }}
                                {% if option.colorTitle %} | color: {{ option.colorTitle }}{% endif %}
                                {% if option.price %} | {{ option.price|as_currency:line.prices.currency }}{% endif %}
                            {% endfor %}
                            <br>
                        {% endif %}
                        <br>
                        {{ line.dimensions.w|floatformat:2 }} *
                        {{ line.dimensions.h|floatformat:2 }} *
                        {{ line.dimensions.d|floatformat:2 }} ({{ line.measureUnit }})|
                        {{ line.weight|floatformat:line.weightDecimals }} {{ line.weightUnit }}
                        <br>
                    </td>
                    <td class="text-right quantity">{{ line.quantity }} / {{ line.quantity }}</td>
                    <td class="text-right unit-price">
                        {{ line.prices.unitPrice|as_currency:line.prices.currency }}
                    </td>
                    <td class="text-right discount">
                        {% if line.prices.discount %}
                            {{ line.prices.discount|as_currency:line.prices.currency }}
                        {% else %}
                            --/--
                        {% endif %}
                    </td>
                    <td class="text-right line-price">
                        {{ line.prices.linePrice|as_currency:line.prices.currency }}
                    </td>
                </tr>
                {% if line.part_requirements.fields.all %}
                    <tr>
                        <td colspan="2"></td>
                        <td>
                            {% for field in line.part_requirements.fields.all %}
                                {% if field.show_on_pdf %}
                                    <span class="part_requirements_field">
                                        <span class="label">{{ field.property.name }}:</span>
                                        {{ field.get_value_as_str_pretty_printed }}
                                    </span>
                                    <br>
                                {% endif %}
                            {% endfor %}
                        </td>
                        <td colspan="4"></td>
                    </tr>
                {% endif %}
            {% endfor %}
            <tr>
                <td colspan="4"></td>
                <td colspan="3">
                    <table id="order-totals-summary" class="totals-summary">
                        <tbody>
                        <tr>
                            <td class="totals sub-total" width="50%">
                                {% trans 'Subtotal' %}:
                            </td>
                            <td class="totals sub-total" width="50%">
                                {{ subtotal|as_currency:order_obj.currency }}
                            </td>
                        </tr>
                        <tr>
                            <td >
                                {% trans 'Including' %}:
                            </td>
                        </tr>
                        <tr>
                            <td >
                                *   {% trans 'Post-Processings' %}:
                            </td>
                            <td>
                                {{ post_processings_price|as_currency:order_obj.currency }}
                            </td>
                        </tr>
                        <tr>
                            <td >
                                *   {% trans 'Printing' %}:
                            </td>
                            <td>
                                {{ printing_price|as_currency:order_obj.currency }}
                            </td>
                        </tr>
                        {% if fee %}
                            <tr class="extra-fee">
                                <td>{% trans 'Extra Fee' %}:</td>
                                <td>
                                    {{ fee|as_currency:order_obj.currency }}
                                </td>
                            </tr>
                            {% for fee_obj in fees %}
                                <tr>
                                    <td>* {{fee_obj.fee}}</td>
                                    <td>{{fee_obj.amount|as_currency:order_obj.currency}}</td>
                                </tr>
                            {% endfor %}
                        {% endif %}
                        {% if difference_to_minimum > 0 %}
                            <tr class="difference-to-minimum">
                                <td>{% trans 'Difference to minimum price' %}:</td>
                                <td>
                                    {{ difference_to_minimum|as_currency:order_obj.currency }}
                                </td>
                            </tr>
                        {% endif %}
                        {% if voucher_discount > 0 %}
                            <tr class="voucher-discount">
                                <td>{% trans 'Voucher' %}:</td>
                                <td>
                                    {{ voucher_discount|negative|as_currency:order_obj.currency }}
                                </td>
                            </tr>
                        {% endif %}
                        {% if shipping_price > 0 %}
                            <tr class="shipping-price">
                                <td>{% trans 'Shipping' %}:</td>
                                <td>
                                    {{ shipping_price|as_currency:order_obj.currency }}
                                </td>
                            </tr>
                        {% endif %}
                        <tr class="total-without-tax">
                            <td>{% trans 'Net total' %}:</td>
                            <td>
                                {{ total_prices.excl_tax|as_currency:order_obj.currency }}
                            </td>
                        </tr>
                        <tr class="tax">
                            <td>{{ tax_rate|floatformat:2 }}% {% trans 'VAT' %}:</td>
                            <td>
                                {{ tax|as_currency:order_obj.currency }}
                            </td>
                        </tr>
                        <tr class="totals grand-total">
                            <td>{% trans 'Gross Total' %}:</td>
                            <td>{{ total_prices.incl_tax|as_currency:order_obj.currency }}</td>
                        </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            </tbody>
        </table>
    </section>
    {% if note_data.comment %}
        <section id="comment">
            <h3>{% trans 'Comment' %}</h3>
            <p class="comment">{{ note_data.comment|linebreaksbr }}</p>
        </section>
    {% endif %}
    {% if general_sales_conditions %}
        <section id="general-sales-conditions">
            <h3>{% trans 'General Sales Conditions' %}</h3>
            <div>
                {{ general_sales_conditions|linebreaks }}
            </div>
        </section>
    {% endif %}
    {% if general_shipping_conditions %}
        <section id="shipping-conditions">
            <h3>{% trans 'General Shipping Conditions' %}</h3>
            <div>
                {{ general_shipping_conditions|linebreaks }}
            </div>
        </section>
    {% endif %}
</main>
<footer class="footer">
    <p>{{ page_footer }}</p>
</footer>
</body>
</html>

Available Variables

This is an overview of the variables available.

Category

Variable Name

Description

Document Metadata

preview_title

Title of the document for display in the browser tab or print preview.

Styles

css_additional

Path to any additional CSS file to style the PDF.

Header

logo_url

URL of the logo to be displayed in the PDF header.

Service Information

service.name

Name of the service or company issuing the document.

sender_address_line

Address of the service issuing the document.

service_address.phone_number

Service's customer support phone number.

service.email

Service's customer support email address.

service_user_name

Name of the user or agent processing the document.

Billing Address

billing_address.salutation

Salutation or title of the recipient (e.g., Mr., Mrs., Ms.).

billing_address.company_name

Company name of the billing recipient.

billing_address.line1

First line of the billing recipient's address.

billing_address.line2

Second line of the billing recipient's address.

billing_address.city

City of the billing recipient.

billing_address.state

State of the billing recipient.

billing_address.zip_code

ZIP code of the billing recipient.

billing_address.country.name

Country of the billing recipient.

Document Information

note_name

The type of the document (e.g., invoice, order confirmation).

note_prefix

Prefix used for the document number.

note_id

Unique identifier for the document.

Order Details

order_obj.full_number

Full number of the order.

order_date

Date when the order was placed.

is_customer_number_shown

Boolean flag indicating if the customer number should be shown.

customer_number_label

Label for the customer number.

customer_number

Customer number associated with the order.

is_customer_reference_shown

Boolean flag indicating if the customer reference should be shown.

customer_reference_label

Label for the customer reference.

customer_reference

Customer reference number.

confirmation_note.order_confirmation_number

The order confirmation number for the order.

order_obj.payment_method_name

Name of the payment method used for the order.

payment_custom_fields

Custom fields related to payment, if available.

Shipping Details

note_data.shipping_date

Date the order was shipped.

order_obj.shipping_method

Shipping method selected for the order.

Order Lines

order_lines

A list of order lines/items included in the document.

line.thumbnail

Thumbnail image of the order line.

line.fullName

Full name of the product in the order line.

line.offer.technology

Technology used for the line item (e.g., 3D printing method).

line.offer.material

Material used for the product in the order line.

line.prices.printPrice

Print price of the line item.

line.offer.postProcessings

List of post-processing options for the line item.

line.dimensions.w

Width dimension of the line item.

line.dimensions.h

Height dimension of the line item.

line.dimensions.d

Depth dimension of the line item.

line.measureUnit

Unit of measurement for the line item dimensions.

line.weight

Weight of the line item.

line.weightUnit

Unit of measurement for the line item weight.

line.volume

Volume of the line item

line.volumeUnit

Unit of measurement for volume of the line item

line.prices.unitPrice

Unit price of the line item.

line.prices.discount

Discount applied to the line item.

line.prices.linePrice

Total price for the line item.

line.part_requirements.fields.all

Additional requirements for the line item.

Totals

subtotal

Subtotal of the order.

post_processings_price

Total cost for post-processing.

printing_price

Total printing cost.

fee

Extra fee applied to the order.

fees

List of fees associated with the order.

difference_to_minimum

Difference to the minimum price required.

voucher_discount

Discount applied through a voucher.

shipping_price

Shipping price for the order.

total_prices.excl_tax

Net total (before taxes) for the order.

tax_rate

Tax rate applied to the order.

tax

Total tax amount.

total_prices.incl_tax

Gross total (including taxes) for the order.

Footer

page_footer

Text displayed in the footer of the document.

Comments

note_data.comment

Additional comments related to the order.

Conditions

general_sales_conditions

Text containing the general sales conditions.

general_shipping_conditions

Text containing the general shipping conditions.

  • No labels