;** ET_Z373X *******************************************************************
;* Etiqueta para Impressao dos Itens de Expedi‡Ćo               8,5cm x 5,5cm  *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 07/01/2020 por Bruno Carvalho
;Ultima Alteracao:   /  /     por                   
;Motivo Alteracao: 

;*******************************************************************************
;Monta Etiqueta                                                                *
;*******************************************************************************
Proc Monta_Etiqueta()

Print File Arquivo "O\n"
Print File Arquivo "N\n"
Print File Arquivo "q680\n"
Print File Arquivo "Q440,24\n"
Print File Arquivo "S2\n"
Print File Arquivo "D8\n"
Print File Arquivo "ZT\n"

Print File Arquivo "A40,20,0,3,1,1,N,\""+"     ARTIGO: "+"\"\n"
Print File Arquivo "A220,20,0,3,1,1,N,\""+Format("W12,AL",ARTIGO)+"\"\n"
Print File Arquivo "A440,20,0,3,1,1,N,\""+"PAIS: "+"\"\n"
Print File Arquivo "A515,20,0,3,1,1,N,\""+PAIS+"\"\n"
        
Print File Arquivo "A40,56,0,3,1,1,N,\""+"  DESCRICAO: "+"\"\n"
Print File Arquivo "A220,56,0,3,1,1,N,\""+Ltrim(Rtrim(ITEM_DES))+"\"\n"

Print File Arquivo "A40,96,0,3,1,1,N,\""+" COMPOSICAO: "+"\"\n"
Print File Arquivo "A220,96,0,3,1,1,N,\""+Ltrim(Rtrim(SubStr(ITEM_DESC,1,31)))+"\"\n"
Print File Arquivo "A220,123,0,3,1,1,N,\""+Ltrim(Rtrim(SubStr(ITEM_DESC,32,31)))+"\"\n"
Print File Arquivo "A220,150,0,3,1,1,N,\""+Ltrim(Rtrim(SubStr(ITEM_DESC,63,30)))+"\"\n"

Print File Arquivo "A40,186,0,3,1,1,N,\""+"    LARGURA: "+"\"\n"
Print File Arquivo "A220,186,0,3,1,1,N,\""+LARGURA+"\"\n"
Print File Arquivo "A450,186,0,4,1,1,N,\""+"QTD: "+"\"\n"
Print File Arquivo "A515,186,0,4,1,1,N,\""+ITEM_QTD+"\"\n"
 

Imprime_Simbologia("ZEBRA","20","222","")  
                                           
Print File Arquivo "A210,315,0,3,1,1,N,\""+" FLOREN€A TECIDOS "+"\"\n"
Print File Arquivo "A210,340,0,3,1,1,N,\""+"  (37) 3246-1288  "+"\"\n\n"
              
Print File Arquivo "P"+StrVal(1)+"\n"        

EndProc

;*******************************************************************************
;* Monta Comandos p/ Impressora Termica                                        *
;*******************************************************************************
Proc Monta_Comandos()
If IsAssigned(DITEA)
   Then Release Vars ITEM_COD, ITEM_QTD, ITEM_DES, ITEM_DESC, ITEM_CON, REG_ITEM
EndIf

GetRecord "\\Sistemas\\Estoque\\Itens" [Codigo do Item] To REG_ITEM
If Not RetVal
   Then Mensagem("O Item "+[Codigo do Item]+" n„o est  cadastro dos itens!")
        Return
EndIf   

GetRecord "\\Sistemas\\Estoque\\Iten_tec" [Codigo do Item] To REG_TECIDO
If RetVal
   Then ARTIGO     = REG_TECIDO["Artigo"]
        COMPOSICAO = REG_TECIDO["Composicao"]
        PECA       = REG_TECIDO["Peca"]
        LARGURA    = REG_TECIDO["Largura"]
        GRAMATURA  = REG_TECIDO["Gramatura"]
        RENDIMENTO = REG_TECIDO["Rendimento"]
        SIMBOLOGIA = REG_TECIDO["Simbologia_Impressao"]
   Else ARTIGO     = ""
        COMPOSICAO = ""
        PECA       = ""
        LARGURA    = ""
        GRAMATURA  = ""
        RENDIMENTO = "" 
        SIMBOLOGIA = ""
EndIf

CONT_SIMBOL=0
DynArray SIMBOL[]
If SIMBOLOGIA<>""
   Then PosI = Search("-",SIMBOLOGIA)
        If PosI>0
           Then While PosI>0
                  CONT_SIMBOL         = CONT_SIMBOL +1
                  SIMBOL[CONT_SIMBOL] = SubStr(SIMBOLOGIA,1,PosI-1)
                  SIMBOLOGIA = SubStr(SIMBOLOGIA,PosI+1,Len(SIMBOLOGIA))
                  PosI = Search("-",SIMBOLOGIA)
                  If PosI=0
                     Then CONT_SIMBOL         = CONT_SIMBOL +1
                          SIMBOL[CONT_SIMBOL] = SIMBOLOGIA
                          QuitLoop
                  EndIf   
                EndWhile
           Else SIMBOL[1]=SIMBOLOGIA
        EndIf
   Else SIMBOL[1]=""
EndIf       

Arquivo="ET_Z373X.ext"
Deleta_Arquivo(Arquivo)

PAIS     = REG_ITEM["Pais"] 
ITEM_COD = [Codigo do Item]
ITEM_QTD = StrVal([Quantidade_Expedida])+" "+REG_ITEM["Unidade Fiscal"] 
ITEM_DES = REG_ITEM["Descricao do Item"]
ITEM_DESC= REG_ITEM["Descricao Complementar"]

Monta_Etiqueta()
ImpriArq(Arquivo)

Sleep 700
Deleta_Arquivo(Arquivo)

EndProc
;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************
Monta_Comandos()
Release Procs Monta_Etiqueta,Monta_Comandos
