# Bsp. Etiketten aus Beleg mit Stattpreis, Mengen und IF Abfrage

Etiketten können mit der richtigen Konfiguration auch von Belegen aus gedruckt werden. \
Der Vorteil liegt hier darin, dass Etiketten verschiedener Artikel auf einen Schlag angedruckt werden können, und die Mengen der Belegpositionen als Etikettenmengen vorgeschlagen werden.\
\
Es ist möglich einen Stattpreis anzudrucken, aber nur für den Fall, dass ein Stattpreis definiert ist und dass dieser höher ist als der Verkaufspreis.

Stattpreise für Produkte festlegen: [Stattpreis](/onretail-wiki/handbuch/verwaltungsoberflache/stammdaten/produkte/konfiguration/preislisten/stattpreis.md)\
\
Bedingungen in der Etikettendefinition werden über `if` und `endif` Blöcke angegeben.

![](/files/-Mhrasd9Oe7eCS3t946X)

```
{#- ==================   DEFINITIONEN   ===================== #} 
{%- set PRINTER_NAME = json.dumps(template.printer_name) %}
{%- set LABEL_TYPE = json.dumps("Rechnung") %}
{%- set invoice = model %}
{%- set GROUP_NAME = json.dumps(invoice.name) %}

{%- set LABEL_QUANTITY = 1 %}
{%- set TAX_INFO = model.taxes_id and json.dumps(model.taxes_id[0].name|replace("Mehrwertsteuer ", "MwSt: ")) or '"keine MwSt"' %}
{%- set VARIANT_ATTRIBUTES %}
 {%- for attr in model.attribute_value_ids|sort(attribute="attribute_id.name",reverse=true) %}
   {%- if loop.index > 1 %}, {% endif %}
     {{- attr.attribute_id.name| truncate(2,end="")}}: {{attr.name}}
 {%- endfor %}
{%- endset %}
{%- set VARIANT_ATTRIBUTES = json.dumps(VARIANT_ATTRIBUTES) %}
{%- set LIST_PRICE = model.lst_price or 0 %}
{%- set LABEL_REF_NAME = json.dumps(model.name) %}
{%- set PRODUCT_NAME = json.dumps(model.name) %}
{%- set PRODUCT_EAN = json.dumps(model.product_code) %}
{%- set PRODUCT_PLU = json.dumps(model.id) %}
{%- set GENERAL_PRICELIST_PRICE = model.general_pricelist_price or model.lst_price or 0 %}
{%- set INT_REF =  json.dumps(model.default_code) %}
{%- set HS_CODE =  model.hs_code %}
{%- set MANUFACTURER_CODE =  model.default_code %}

{#- =======================   Angepasstes Etikett   ======================= #}
{%- set FDS -%}
ID;ETT01;3;Benutzerdefiniertes Etikett
         ; ID ; OPT ; TEXT               ; FORM ; FORM SIZE
FormAsgn ; Z  ; 0   ; Benutzerdefiniert  ; 99   ; Benutzerdefiniert
Head ; FORM99 ; 40x24 ; Preis Rechts

   ; Artikeltext
   Font  ; 8.Arial Bold
   Field ; 1.5 ; 2 ; 0 ; TEXT1
   Text ; 2.5 ; 2 ; 0 ; {{ VARIANT_ATTRIBUTES }}

   ; Strichcode
   Font   ; 36.EAN-13B Half Height
   Field ; 9 ; 2 ; 0 ; EANFCD ; FONTBOX{108,70}

   ; Stattpreis (Durchgestrichener Preis, optional)
{%- if LIST_PRICE > GENERAL_PRICELIST_PRICE %}
   Font ; 9.Arial  
   If ; IsStp
      FIELD ; 13 ; 48 ; 0 ; STPW ; SAYRIGHT
      Line ; 16 ; 35 ; 16 ; 49 ; 3
   End
{% endif %}
   
   ; Preis
   Font ; 9.Arial 
   Field ; 16 ; 35 ; 0 ; LDWSYM
   Field ; 16 ; 48 ; 0 ; VKP ; SAYRIGHT
   
   ;HS Code
{%- if HS_CODE %}
   Font ; 9.Arial 
   Text ; 15 ; 2 ; 0 ; {{ HS_CODE }}
{% endif %}

    ; Hersteller Nummer 
{%- if MANUFACTURER_CODE %}
   Font ; 9.Arial
   Text ; 19 ; 2 ; 0 ; {{ MANUFACTURER_CODE }}
{% endif %}
   
{%- endset %}
{%- set FDSDATA = json.dumps(FDS) -%}
  
{#- =======================   LABEL DRUCKER DATEN   ======================= #}
{
  "Quantity": {{ LABEL_QUANTITY }},
  "FormName": {{ LABEL_REF_NAME }},
  "FormDesc": {{ VARIANT_ATTRIBUTES }},
  "GroupName": {{ GROUP_NAME }},
  "LabelType": {{ LABEL_TYPE }},
  "LabelPrinterData": {
    "CmdVer": 1,
    "Cmd": "PrintLabel",
    "PrinterSettings": {
       "PrinterName": {{ PRINTER_NAME }}
    },
    "Layout": {
      "Style": 99,
      "RowCount": 30,
      "ColCount": 1,
      "StartRow": 2,
      "StartCol": 0
    },
    "PrintData": [{
      "Ean": {{ PRODUCT_EAN }},
      "Plu": {{ PRODUCT_PLU }},
      "Text": {{ PRODUCT_NAME }},
      "Text2": {{ VARIANT_ATTRIBUTES }},
      "Price": {{ GENERAL_PRICELIST_PRICE }},
      "CrossedPrice": {{ LIST_PRICE }},
      "ShowPrice": true,
      "VatPrice": true,
      "VatRate": {{ TAX_INFO }},
      "GpiTmg": 200,
      "GpiMeh": "ML",
      "GpiBas": 1000
    }],"FdsData":{{FDSDATA}} 
  }
}

{#- =======================   LABEL DRUCKER DATEN ENDE   ======================= #}    
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpcenter.etron.info/onretail-wiki/handbuch/drucker-and-hardware/etikettendruck-onretail/bsp-etikette-aus-erechnung-mit-stattpreis-und-if-abfrage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
