de:cobi.wms:etikettenvorlagen
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| de:cobi.wms:etikettenvorlagen [2025/10/24 10:53] – thuth | de:cobi.wms:etikettenvorlagen [2025/10/24 11:08] (current) – [JavaScript-Integration] thuth | ||
|---|---|---|---|
| Line 200: | Line 200: | ||
| ==== Datums-Umformatierung ==== | ==== Datums-Umformatierung ==== | ||
| + | |||
| + | Der spezielle Platzhalter zur Datumsumformatierung kann verwendet werden, um ein Datum in einem bestimmten Format einzulesen und anschließend in einem anderen Format auszugeben. Die Verwendung sieht wie folgt aus: | ||
| < | < | ||
| @dateReformat(DATUM|VON_FORMAT|ZU_FORMAT)@ | @dateReformat(DATUM|VON_FORMAT|ZU_FORMAT)@ | ||
| </ | </ | ||
| + | |||
| + | **HINWEIS: | ||
| + | |||
| + | Dieser Platzhalter verwendet das senkrechte Strichsymbol '' | ||
| + | |||
| + | Die Funktionsweise ist wie folgt: | ||
| + | Der Text, der im Parameter '' | ||
| + | |||
| + | Die Parameter '' | ||
| + | |||
| + | Im folgenden Beispiel wird das Ablaufdatum einer Charge in einem benutzerdefinierten Format ausgegeben — unter Ausnutzung der Tatsache, dass der Platzhalter '' | ||
| Beispiel: | Beispiel: | ||
| Line 213: | Line 226: | ||
| ===== JavaScript-Integration ===== | ===== JavaScript-Integration ===== | ||
| - | Aktivierung: | + | Das HTML-Dokument, |
| < | < | ||
| Line 219: | Line 232: | ||
| </ | </ | ||
| - | Druckersteuerung erfolgt dann über JS: | + | **HINWEIS:** Wenn JavaScript aktiviert ist, wird der Druck des gerenderten HTML-Dokuments nicht mehr automatisch ausgelöst. Stattdessen muss der Druck manuell aus dem JavaScript-Code gestartet werden, indem an geeigneter Stelle |
| - | '' | + | |
| + | Während der Ausführung des JavaScript-Codes steht das spezielle Objekt '' | ||
| + | |||
| + | < | ||
| + | cobiwms.get(name) | ||
| + | </ | ||
| + | |||
| + | Der Parameter '' | ||
| + | Beispiel: Ein Aufruf von '' | ||
| + | |||
| + | (Man könnte zwar auch Platzhalter wie '' | ||
| + | |||
| + | < | ||
| + | cobiwms.prompt(title, | ||
| + | </ | ||
| + | |||
| + | Durch den Aufruf dieser Funktion zeigt die App ein Popup mit einem Eingabefeld für den Benutzer an. | ||
| + | Der Parameter '' | ||
| + | Der Parameter '' | ||
| + | Diese Funktion wird nach Bestätigung der Eingabe aufgerufen und erhält dabei einen Parameter, | ||
| + | der den vom Benutzer eingegebenen Wert als String enthält. | ||
| Zugriff auf Platzhalterwerte: | Zugriff auf Platzhalterwerte: | ||
| < | < | ||
| - | cobiwms.get("itemName") | + | window.handleCurrency = function (currency) { |
| + | ... | ||
| + | } | ||
| + | |||
| + | cobiwms.prompt("Enter currency", | ||
| </ | </ | ||
| Line 237: | Line 275: | ||
| <code html> | <code html> | ||
| - | <!-- Beispiel | + | <!DOCTYPE html> |
| + | < | ||
| + | < | ||
| + | <meta charset=" | ||
| + | < | ||
| + | @page { | ||
| + | /* You can use width/ | ||
| + | /* For example, the following two are equivalent: */ | ||
| + | /* size: 148mm 105mm; */ | ||
| + | /* size: A6 landscape; */ | ||
| + | size: A6 landscape; | ||
| + | |||
| + | /* Don't change, use the container padding below. */ | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | } | ||
| + | |||
| + | body { | ||
| + | /* We could use 100vw/100vh to cover the whole size declared with @page, but this doesn' | ||
| + | work with ZPL printing, so repeat the page dimensions explicitly. | ||
| + | use standardized sizes like A6 here. The height should be minimally reduced to make | ||
| + | sure the HTML renderer doesn' | ||
| + | width: 148mm; | ||
| + | height: 104mm; | ||
| + | |||
| + | /* Don't change, use the container below. */ | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | |||
| + | /* Useful to diagnose dimension issues. */ | ||
| + | outline: 0.5mm solid black; | ||
| + | outline-offset: | ||
| + | } | ||
| + | |||
| + | .container { | ||
| + | /* Don't change. */ | ||
| + | box-sizing: border-box; | ||
| + | position: relative; | ||
| + | width: 100%; | ||
| + | height: 100%; | ||
| + | |||
| + | font-family: | ||
| + | font-size: 18pt; | ||
| + | |||
| + | /* Global padding from the edges. */ | ||
| + | padding: 3mm; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <div class=" | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | @itemName@ | ||
| + | </ | ||
| + | <div style=" | ||
| + | @barcode(CODE_128, | ||
| + | </ | ||
| + | <div style=" | ||
| + | (90)@itemCode@(10)@batchNumber@ | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </html> | ||
| </ | </ | ||
| + | |||
| ==== Datei 2 ==== | ==== Datei 2 ==== | ||
| Line 245: | Line 364: | ||
| <code html> | <code html> | ||
| - | <!-- Beispiel | + | <!DOCTYPE html> |
| + | < | ||
| + | < | ||
| + | <meta charset=" | ||
| + | < | ||
| + | @page { | ||
| + | /* You can use width/ | ||
| + | /* For example, the following two are equivalent: */ | ||
| + | /* size: 148mm 105mm; */ | ||
| + | /* size: A6 landscape; */ | ||
| + | size: A6 landscape; | ||
| + | |||
| + | /* Don't change, use the container padding below. */ | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | } | ||
| + | |||
| + | body { | ||
| + | /* We could use 100vw/100vh to cover the whole size declared with @page, but this doesn' | ||
| + | work with ZPL printing, so repeat the page dimensions explicitly. | ||
| + | use standardized sizes like A6 here. The height should be minimally reduced to make | ||
| + | sure the HTML renderer doesn' | ||
| + | width: 148mm; | ||
| + | height: 104mm; | ||
| + | |||
| + | /* Don't change, use the container below. */ | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | |||
| + | /* Useful to diagnose dimension issues. */ | ||
| + | outline: 0.5mm solid black; | ||
| + | outline-offset: | ||
| + | } | ||
| + | |||
| + | .container { | ||
| + | /* Don't change. */ | ||
| + | box-sizing: border-box; | ||
| + | position: relative; | ||
| + | width: 100%; | ||
| + | height: 100%; | ||
| + | |||
| + | font-family: | ||
| + | font-size: 18pt; | ||
| + | |||
| + | /* Global padding from the edges. */ | ||
| + | padding: 3mm; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | <!-- Input definitions: | ||
| + | @input(text[Insert value])@ | ||
| + | @input(selection[Select value]; | ||
| + | @input(codeFormat[Barcode type]; | ||
| + | --> | ||
| + | |||
| + | < | ||
| + | // @useJavaScript@ | ||
| + | window.onload = function() { | ||
| + | var insert = document.getElementById(' | ||
| + | insert.textContent = "Hello World!" | ||
| + | cobiwms.print() | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <div class=" | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | @itemName@ | ||
| + | </ | ||
| + | <div style=" | ||
| + | @barcode(@input(codeFormat)@, | ||
| + | </ | ||
| + | <div style=" | ||
| + | (90)@itemCode@(10)@batchNumber@ | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </html> | ||
| </ | </ | ||
| - | |||
| - | |||
de/cobi.wms/etikettenvorlagen.1761296001.txt.gz · Last modified: by thuth