;** Et_Z009C *******************************************************************
;* Monta Etiqueta p/ Impressora Termica - Zebra - EAN13  CAROL III             *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 19/08/2008 por Anivel Augusto Rodrigues
;Ultima Alteracao: 11/08/2011 por Bruno Carvalho
;Motivo Alteracao: Altera‡Æo no tamanho da fonte da descri‡Æo do item
;Ultima Alteracao: 07/11/2018 por Bruno Carvalho
;Motivo Alteracao: Ajustes padrÆo p/ codigo de barras EAN8, EAN13 ou COD128 

;*******************************************************************************

Proc Monta_Etiqueta()
Moveto "Answer"
Print File Arquivo "O\n"
Print File Arquivo "N\n"
Print File Arquivo "q840\n"
Print File Arquivo "Q0,0\n"
Print File Arquivo "S2\n"
Print File Arquivo "D8\n"
Print File Arquivo "ZT\n"

Print File Arquivo "A105,240,0,3,1,1,N,\""+SubStr(DITEM,01,24)+"\"\n"
Print File Arquivo "A105,266,0,3,1,1,N,\""+SubStr(DITEM,25,06)+"\"\n"
Switch
  Case Search("EAN13",TPBARRA)>0 : Print File Arquivo "B130,290,0,E30,2,30,95,B,\""+CDBAR+"\"\n" 
  Case Search("EAN8",TPBARRA)>0  : Print File Arquivo "B130,290,0,E80,2,30,95,B,\""+CDBAR+"\"\n" 
  OtherWise                      : Print File Arquivo "B130,290,0,1,2,30,95,B,\""+CDBAR+"\"\n" 
EndSwitch 
Print File Arquivo "A115,404,0,2,1,1,N,\""+CITEM+"\"\n"
Print File Arquivo "A118,1341,0,3,1,1,N,\".\"\n"
Print File Arquivo "P"+StrVal(te)+"\n"

EndProc

;*******************************************************************************
;* Monta Comandos p/ Impressora Termica                                        *
;*******************************************************************************
Proc Monta_Comandos()
If IsAssigned(DITEA)
   Then Release Vars DITEA, DITEB, CITEM, NEMPR, TPBARRA
EndIf

Arquivo=PrivDir()+"ET_Z009C.ext"
Deleta_Arquivo(Arquivo)

Coedit "Answer"
Scan
  te=[Quantidade]
  DITEM=[Descricao do Item]
  CDBAR=[Codigo de Barras ]
TPBARRA=Upper([Tipo Codigo_Barras])  
  CITEM=[Codigo do Item   ]
  Monta_Etiqueta()
EndScan
Do_It!
ClearAll

ImpriArq(Arquivo)

Sleep 700
Deleta_Arquivo(Arquivo)
ClearAll
EndProc

Monta_Comandos()
Release Procs Monta_Etiqueta,Monta_Comandos
