tüit Logo Direkt zum Hauptinhalt

Benuzerdefinierte Tabellen im Druckformat

Einleitung

Verwenden wir im Druckformat benutzerdefinierte Tabellen...

<div>s verwenden

image-1622798852883.png

Ohne <div>

<!-- Table Heading -->
<table class="table table-bordered table-condensed">
<thead>
<tr>
   <th>{{ _('Item Code') }}</th>
   <th>{{ _('Description') }}</th>
   <th>{{ _('Quantity') }}</th>
   <th>{{ _('Price') }}</th>
   <th>{{ _('Amount') }}</th>
</tr>
</thead>
<tbody>

<!-- Table Content -->
{% set currency = frappe.get_doc("Currency",doc.currency) %}
{%- for row in doc.items -%}
    <tr>
        <td>
            {% set item = frappe.get_doc("Item", row.item_code) %}
            {% if item.variant_of %} 
                {{ item.variant_of }}
            {% else %}
                {{ item.name }}
            {% endif %}     
        </td>
        <td>
            {{ row.description }}<br><br>

    	    <!-- Herkunftsland -->
            {{  _('Country of Origin') }}:
            {% if item.country_of_origin %}
                {{ item.country_of_origin }}
            {% else %}
                {{ _('None') }}
            {% endif %}<br>

            <!-- Kundenreferenzen -->
            {% for refs in item.customer_items %}
                {% if refs.customer_name == doc.customer %}
                {{ _('Your Itemcode')}}: {{ refs.ref_code }}<br>
                {{ _('Your Itemname')}}: {{ refs.ref_name }}
                {% else %}
                    
                {% endif %}
            {% endfor %}<br>
            
            <!-- Palette/Charge -->
            {% if row.batch_no %}
                {% set batch = frappe.get_doc("Batch", row.batch_no) %}
                {{ _('Charge') }}: {{ row.batch_no }}<br>
                                {% if batch.print_supplier_batch == 1 %}
                {{ _('Charge') }} {{ _('Producer') }}: {{ batch.supplier_batch_number }}<br>
                {% endif %}
                {{ _('Manufacturing Date') }}: {% if batch.manufacturing_date %} {{ frappe.utils.get_datetime(batch.manufacturing_date).strftime('%d.%m.%Y') }}{% endif %}<br>
                {{ _('BBE') }}: {% if batch.expiry_date %}{{ frappe.utils.get_datetime(batch.expiry_date).strftime('%d.%m.%Y') }}{% endif %}<br>
            

                <!-- Certificates -->
                {% if batch.technical_data_sheet %}
                    {% set tds = frappe.get_doc("Technical Data Sheet", batch.technical_data_sheet) %}
                    {% if tds.certificates %}
                        {{ _('Certificates') }}:
                    {% endif %}
                    {% for certificate in tds.certificates %}
                        {% if certificate.certified == "Yes" %}
                            {{ certificate.type }}
                            {% if certificate.type == "Organic" %}
                                {% if batch.country_of_origin %}
                                    {% set country = frappe.get_doc("Country", batch.country_of_origin) %}
                                    {% if country.eu_landwirtschaft %}
                                        <br><b>CH-Bio-006 "EU-Landwirtschaft"</b>
                                    {% else %}
                                        <br><b>CH-Bio-006 "Nicht-EU-Landwirtschaft"</b>
                                    {% endif %}
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    {% endfor %}<br>
                {% else %}
                    -
                {% endif %}

            {% endif %}
        <br>
        <br>
        <!-- Lieferdatum -->
        {{ _('Delivery Date') }}: {{ frappe.utils.get_datetime ( row.delivery_date ).strftime('%d.%m.%Y') }}
        </td>

        <td>
            {{ row.qty }} {{ row.uom }}
        </td>
        <td  class="price-column">
            {% if row.uom != row.stock_uom %}
                {% set rate_in_stock_uom = row.rate * row.conversion_factor %}
                {{'%0.2f'| format(rate_in_stock_uom|float)  }} {{ currency.symbol }} / {{ row.stock_uom }}<br>
                {{ row.conversion_factor }} {{ row.stock_uom }} &#8792; 1 {{ row.uom}}
            {% else %}
                {{'%0.2f'| format(row.rate|float)  }} {{ currency.symbol }} / {{ row.uom }}
            {% endif %}
        </td>
        <td  class="price-column">{{'%0.2f'| format(row.amount|float) }} {{ currency.symbol }}</td>
    </tr>
{%- endfor -%}
</tbody>
</table>

image-1622798993193.png

image-1622799047537.png

 

Mit <div>

<!-- Table Heading -->
<table class="table table-bordered table-condensed">
<thead>
<tr>
   <th>{{ _('Item Code') }}</th>
   <th>{{ _('Description') }}</th>
   <th>{{ _('Quantity') }}</th>
   <th>{{ _('Price') }}</th>
   <th>{{ _('Amount') }}</th>
</tr>
</thead>
<tbody>

<!-- Table Content -->
{% set currency = frappe.get_doc("Currency",doc.currency) %}
{%- for row in doc.items -%}
    <tr>
        <td>
            {% set item = frappe.get_doc("Item", row.item_code) %}
            {% if item.variant_of %} 
                {{ item.variant_of }}
            {% else %}
                {{ item.name }}
            {% endif %}     
        </td>
        <td><div>
            {{ row.description }}<br><br>

    	    <!-- Herkunftsland -->
            {{  _('Country of Origin') }}:
            {% if item.country_of_origin %}
                {{ item.country_of_origin }}
            {% else %}
                {{ _('None') }}
            {% endif %}<br>

            <!-- Kundenreferenzen -->
            {% for refs in item.customer_items %}
                {% if refs.customer_name == doc.customer %}
                {{ _('Your Itemcode')}}: {{ refs.ref_code }}<br>
                {{ _('Your Itemname')}}: {{ refs.ref_name }}
                {% else %}
                    
                {% endif %}
            {% endfor %}<br>
            
            <!-- Palette/Charge -->
            {% if row.batch_no %}
                {% set batch = frappe.get_doc("Batch", row.batch_no) %}
                {{ _('Charge') }}: {{ row.batch_no }}<br>
                                {% if batch.print_supplier_batch == 1 %}
                {{ _('Charge') }} {{ _('Producer') }}: {{ batch.supplier_batch_number }}<br>
                {% endif %}
                {{ _('Manufacturing Date') }}: {% if batch.manufacturing_date %} {{ frappe.utils.get_datetime(batch.manufacturing_date).strftime('%d.%m.%Y') }}{% endif %}<br>
                {{ _('BBE') }}: {% if batch.expiry_date %}{{ frappe.utils.get_datetime(batch.expiry_date).strftime('%d.%m.%Y') }}{% endif %}<br>
            

                <!-- Certificates -->
                {% if batch.technical_data_sheet %}
                    {% set tds = frappe.get_doc("Technical Data Sheet", batch.technical_data_sheet) %}
                    {% if tds.certificates %}
                        {{ _('Certificates') }}:
                    {% endif %}
                    {% for certificate in tds.certificates %}
                        {% if certificate.certified == "Yes" %}
                            {{ certificate.type }}
                            {% if certificate.type == "Organic" %}
                                {% if batch.country_of_origin %}
                                    {% set country = frappe.get_doc("Country", batch.country_of_origin) %}
                                    {% if country.eu_landwirtschaft %}
                                        <br><b>CH-Bio-006 "EU-Landwirtschaft"</b>
                                    {% else %}
                                        <br><b>CH-Bio-006 "Nicht-EU-Landwirtschaft"</b>
                                    {% endif %}
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    {% endfor %}<br>
                {% else %}
                    -
                {% endif %}

            {% endif %}
 
        <br>
        <br>
        <!-- Lieferdatum -->
        {{ _('Delivery Date') }}: {{ frappe.utils.get_datetime ( row.delivery_date ).strftime('%d.%m.%Y') }}
        </div>
        </td>

        <td>
            {{ row.qty }} {{ row.uom }}
        </td>
        <td  class="price-column">
            {% if row.uom != row.stock_uom %}
                {% set rate_in_stock_uom = row.rate * row.conversion_factor %}
                {{'%0.2f'| format(rate_in_stock_uom|float)  }} {{ currency.symbol }} / {{ row.stock_uom }}<br>
                {{ row.conversion_factor }} {{ row.stock_uom }} &#8792; 1 {{ row.uom}}
            {% else %}
                {{'%0.2f'| format(row.rate|float)  }} {{ currency.symbol }} / {{ row.uom }}
            {% endif %}
        </td>
        <td  class="price-column">{{'%0.2f'| format(row.amount|float) }} {{ currency.symbol }}</td>
    </tr>
{%- endfor -%}
</tbody>
</table>

image-1622799095576.png