;** Et_Z359D *******************************************************************
;* Etiqueta para Impressao dos Itens de Expedi‡Ćo - MODELO 3  - 8,5cm x 5,5cm  *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 13/05/2015 por Bruno Carvalho
;Ultima Alteracao: 20/05/2016 por Bruno Carvalho
;Motivo Alteracao: Ajustes "Iten_Com" -> [Codigo Concentrador]
;Ultima Alteracao: 08/08/2016 por Bruno Carvalho
;Motivo Alteracao: Ajustes CONCENTRADOR

;*******************************************************************************
;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,4,1,1,N,\""+"REFERENCIA: "+"\"\n"
Print File Arquivo "A220,24,0,3,1,1,N,\""+Rtrim(SubStr(ITEM,1,31))+"\"\n"
Print File Arquivo "A220,51,0,3,1,1,N,\""+Rtrim(SubStr(ITEM,32,31))+"\"\n"
        
Print File Arquivo "A40,86,0,4,1,1,N,\""+"   LARGURA: "+"\"\n"
Print File Arquivo "A220,90,0,3,1,1,N,\""+ITEM_CON+"\"\n"

Print File Arquivo "A40,126,0,4,1,1,N,\""+"  METRAGEM: "+"\"\n"
Print File Arquivo "A220,130,0,3,1,1,N,\""+ITEM_QTD+"\"\n"

Print File Arquivo "A40,166,0,4,1,1,N,\""+"       COR:"+"\"\n"
Print File Arquivo "A220,170,0,3,1,1,N,\""+ITEM_COR+"\"\n" 
        
Print File Arquivo "A40,206,0,4,1,1,N,\""+"COMPOSICAO:"+"\"\n"
Print File Arquivo "A220,210,0,3,1,1,N,\""+Ltrim(Rtrim(SubStr(ITEM_DESC,1,31)))+"\"\n"
Print File Arquivo "A220,237,0,3,1,1,N,\""+Ltrim(Rtrim(SubStr(ITEM_DESC,32,31)))+"\"\n"
Print File Arquivo "A220,264,0,3,1,1,N,\""+Ltrim(Rtrim(SubStr(ITEM_DESC,63,30)))+"\"\n"
        
Print File Arquivo "A220,295,0,4,1,1,N,\""+" TECIDOS TOTAL "+"\"\n"
Print File Arquivo "A160,325,0,3,1,1,N,\""+"(37) 9922-0538 (Whatszap)"+"\"\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_COR, 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_Com" [Codigo do Item] To REG_ITEMCOMP     
If RetVal
   Then CONCENTRADOR = REG_ITEMCOMP["Codigo Concentrador"]
   Else CONCENTRADOR = ""
EndIf   

Arquivo="Et_Z359.ext"
Deleta_Arquivo(Arquivo)

ITEM_COD = [Codigo do Item]
ITEM_QTD = StrVal([Quantidade_Expedida])
ITEM_COR = [Descricao da Cor_Tecido]  
ITEM_DES = REG_ITEM["Descricao do Item"]
ITEM_DESC= Format("W41",REG_ITEM["Descricao Complementar"])
ITEM_CON = CONCENTRADOR
ITEM     = Format("W41",ITEM_COD+" "+ITEM_DES)

Monta_Etiqueta()
ImpriArq(Arquivo)

Sleep 700
Deleta_Arquivo(Arquivo)

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