;** Et_0383  *******************************************************************
;* Monta Etiqueta p/ Impressora Bematech/Zebra - EAN13 - LUTE      * Modelo 97 *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 12/01/2017 por Rafael Matos
;Ultima Alteracao: 07/11/2018 por Bruno Carvalho
;Motivo Alteracao: Ajustes padrĈo p/ codigo de barras EAN8, EAN13 ou COD128

;*******************************************************************************
Proc Monta_Etiqueta()

;Print File Arquivo "q1176\n"        ;DOT a 12 por mm    -> Se For ZEBRA, alterar para 8 DOTS
Print File Arquivo "q784\n"          ;<- zebra
Print File Arquivo "Q408,024\n"     ;DOT a  8 por mm
Print File Arquivo "O\n"
Print File Arquivo "N\n"
Print File Arquivo "S2\n"
Print File Arquivo "D8\n"
Print File Arquivo "ZB\n"

Print File Arquivo "A60,180,0,1,1,2,N,\""+DESCRICAO[1]+"\"\n"
Switch
  Case Search("EAN13",TPBARRA[1])>0 : Print File Arquivo "B60,215,0,E30,2,1,62,B,\""+CDBAR[1]+"\"\n" 
  Case Search("EAN8",TPBARRA[1])>0  : Print File Arquivo "B60,215,0,E80,2,1,62,B,\""+CDBAR[1]+"\"\n"
  OtherWise                         : Print File Arquivo "B60,215,0,1,2,1,62,B,\""+CDBAR[1]+"\"\n"
EndSwitch   

Print File Arquivo "P1\n"

EndProc

;*******************************************************************************
;* Monta Comandos p/ Impressora Termica                                        *
;*******************************************************************************
Proc Monta_Comandos()

Arquivo=PrivDir()+"lute.ipl"
Deleta_Arquivo(Arquivo)

If IsAssigned(DITEA)
   Then Release Vars CDBAR, DESCRICAO,TPBARRA
EndIf

Array   TPBARRA[1]
Array    CDBAR[1]
Array DESCRICAO[1]

Coedit "Answer"
Scan
            te = [Quantidade]
      CDBAR[1] = [Codigo de Barras ]
    TPBARRA[1] = Upper([Tipo Codigo_Barras])  
  DESCRICAO[1] = Upper(Substr([Descricao do Item],1,20)) ;Apenas 20 Caracteres
  While True    
    Monta_Etiqueta()
    te = te - 1
    If te <=0 Then  QuitLoop EndIf
  EndWhile
EndScan               
Do_It!
ClearAll

ImpriArq(Arquivo)

Sleep 700
Deleta_Arquivo(Arquivo)
ClearAll
EndProc

;*******************************************************************************
;* Inicio                                                                      *
;*******************************************************************************
Monta_Comandos()
Release Vars DITEA, CDBAR
Release Procs Monta_Etiqueta,Monta_Comandos
