*   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   
*   nazev se podle delky tiskne na 1 nebo 2 radky
*   "init_prn" v nazvu vola inicializaci tiskarny
*
*   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   
PARAMETERS nazev, kod, pocet

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

ean_print = "TA200"
SET PRINTER TO NAME (m.ean_print)

IF "init_prn" $ LOWER(m.nazev)
    ??? 'GAPDETECT' + m.crlf
    ??? 'SIZE 50 mm,25 mm' + m.crlf

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

    kod = ALLTRIM(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 WINDOW NOWAIT 

    ??? '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
    WAIT m.nazev + "  " + kod + "  " + pocet WINDOW TIMEOUT .5
ENDIF 

SET PRINTER 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>>"
