;** Et_Z013  *******************************************************************
;* Monta Etiqueta p/ Impressora Termica - Zebra - Gondola c/ Preco I -3.0x9.9cm*
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 21/06/2011 por Karina Andrade
;Ultima Alteracao: 08/07/2011 por Karina Andrade
;Motivo Alteracao: Ajuste caracter especial

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

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

Print File Arquivo "O\n"
Print File Arquivo "N\n"
Print File Arquivo "q750\n"    ;largura; 20mm=160 dots
Print File Arquivo "Q208,32\n" ; altura / espacamento entre as etiquetas
Print File Arquivo "S2\n"
Print File Arquivo "D8\n"
Print File Arquivo "ZT\n"
                      
Print File Arquivo "A010,00,0,4,2,2,N,\""+DITEM1+"\"\n"
Print File Arquivo "A010,50,0,4,2,2,N,\""+DITEM2+"\"\n"
Print File Arquivo "A010,110,0,2,2,2,N,\""+CITEM+"\"\n"
Print File Arquivo "A430,130,0,4,2,2,N,\""+LPR1+"\"\n"
Print File Arquivo "P"+StrVal(te)+"\n"

ImpriArq(Arquivo)

Sleep 700
Deleta_Arquivo(Arquivo)
Sleep 700

EndProc

;*******************************************************************************
;* Monta Comandos p/ Impressora Termica                                        *
;*******************************************************************************
Proc Monta_Comandos()
If IsAssigned(DITEM)
   Then Release Vars DITEM, CITEM, PRECO
EndIf

View "\\Sistemas\\Vendas\\Tbprite"
Coedit "Answer"
Scan
  te=[Quantidade]
  
  DITEM=[Descricao do Item ]
  s=""
  For wi From 1 To Len(DITEM)
    If Substr(DITEM,wi,1)="\""
      Then If wi=23
            Then s=s+" "
           EndIf  
           s=s+"\\"
    EndIf
    s=s+Substr(DITEM,wi,1)  
  EndFor   
     
  DITEM1=SubStr(s,1,23)
  DITEM2=SubStr(s,24,30)
  CITEM=[Codigo do Item ]
  LPR1=""
  
  Moveto "\\Sistemas\\Vendas\\Tbprite"
  Moveto [Codigo da Tabela]
  Locate VSDGTABELA,CITEM
  If RetVal
     Then PRECO=[Preco Unitario]
          LPR1="R$"+LTrim(Format("W9.2,EIC",PRECO))
  EndIf

  Moveto "Answer"
  Monta_Etiqueta()
EndScan
Do_It!
ClearAll

EndProc

Monta_Comandos()
Release Procs Monta_Etiqueta,Monta_Comandos
