param nazev, kod, pocet

***      123456789012345678901234567890
nazev = "krabička     na sirkyyy a cigáraaa"
*nazev = "krabicka     na sirkyyy"
nazev = 'Kancelářský stůl velký černý'
kod = "111156789011"

*DO init_prn


ean_print = "TA200"
crlf = CHR(13)+CHR(10)

DO CASE 
CASE EMPTY(m.pocet)
    pocet = "1"
CASE BETWEEN(m.pocet, 1, 333)
    pocet = ALLTRIM(STR(pocet))
OTHERWISE 
    pocet = "1"
ENDCASE 

kod = allt(m.kod)

nazev = STRTRAN(ALLTRIM(m.nazev), "  ", " ")
nazev = STRTRAN(STRTRAN(m.nazev, "  ", " "), "  ", " ")
IF LEN(m.nazev) < 25
    texticek1 = STRTRAN(ALLTRIM(nazev), '"', '\["]')
    texticek2 = ""

ELSE
    pozice_mezery = RAT(" ", m.nazev, 2)
    IF m.pozice_mezery < 17
        pozice_mezery = RAT(" ", m.nazev, 1)
        IF m.pozice_mezery > 25
            pozice_mezery = 22
        ENDIF 
    ENDIF 
    texticek1 = STRTRAN(LEFT(nazev, pozice_mezery-1), '"', '\["]')
    texticek2 = STRTRAN(SUBST(nazev, pozice_mezery), '"', '\["]')
ENDIF 

WAIT m.nazev + "  " + kod + "  " + pocet wind nowa
SET PRINTER TO NAME (m.ean_print)

??? 'DIRECTION 1' + m.crlf
??? 'CLS' + m.crlf
??? 'CODEPAGE 1250' + m.crlf

IF EMPTY(m.texticek2)
    ??? 'TEXT 44,22,"2", 0, 1, 2, "' + m.texticek1 + '"' + m.crlf
ELSE
    ??? 'TEXT 44,22,"2", 0, 1, 1, "' + m.texticek1 + '"' + m.crlf
    ??? 'TEXT 44,44,"2", 0, 1, 1, "' + m.texticek2 + '"' + m.crlf
ENDIF 

??? 'BARCODE 55,66,"EAN13",99,2,0,3,3, "' + kod + '"' + m.crlf
??? 'TEXT 366,133,"3", 0, 3, 3, "D"' + m.crlf
??? 'PRINT ' + m.pocet + m.crlf

SET PRINTER TO 
wait m.nazev + "  " + kod + "  " + pocet wind time .5


**    **    **    **    **    **    **    **    **    **    **    **    
PROCEDURE init_prn

ean_print = "TA200"
SET PRINTER TO NAME (m.ean_print)
crlf = CHR(13)+CHR(10)

??? 'GAPDETECT' + m.crlf
??? 'SIZE 50 mm,25 mm' + m.crlf
SET PRINT TO


* x = vodorovne, Y svisle
* GAP 3mm
* GAPDETECT
* BOX  x, y, x_end, y_end, thickness
* SIZE 70 mm,35 mm      && width, length    1mm=8dots pro 200dpi tiskarny
* TEXT x,y,"font",rotation,x-multiplication,y-multiplication,[alignment,]"content"
* BARCODE X,Y,"code type",height,human readable,rotation,narrow,wide,[alignment,]"content "
*BARCODE 55,99,"EAN13",66,2,0,3,3, "<<kod>>"
