;** Et_ZSIR  *******************************************************************
;* Monta Etiqueta p/ Impressora Termica - Zebra - SIRI Dados Cliente           *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 03/08/2009 por Anivel Augusto Rodrigues
;Ultima Alteracao: 31/05/2013 por Bruno Carvalho
;Motivo Alteracao: Altera‡Æo Layout
;Ultima Alteracao: 04/06/2013 por Bruno Carvalho
;Motivo Alteracao: Ajustes Tamanho "SIRI"=5 e "PED"=3
;Ultima Alteracao: 27/08/2015 por Andrey Fillipe
;Motivo Alteracao: Retirado o acento do destinatario

;*******************************************************************************
;* Monta Etiqueta                                                              *
;*******************************************************************************
Proc Monta_Etiqueta()
Moveto "Answer"

Print File Arquivo "O\n"
Print File Arquivo "N\n"
Print File Arquivo "q782\n"     ;10.3 cm
Print File Arquivo "Q864,18\n"  ;14.4 cm - 3mm
Print File Arquivo "S2\n"
Print File Arquivo "D8\n"
Print File Arquivo "ZT\n"

Print File Arquivo "A700,430,1,5,2,2,N,\""+"SIRI"+"\"\n"
Print File Arquivo "A520,030,1,4,1,2,N,\""+"Destinatario"+"\"\n"
Print File Arquivo "A450,030,1,4,1,2,N,\""+SubStr(RAZAO,01,40)+"\"\n"  
Print File Arquivo "A370,030,1,3,1,2,N,\""+SubStr(ENDER,01,40)+"\"\n"
Print File Arquivo "A290,030,1,3,1,2,N,\""+Completa(BAIR,23," ")+CEP+"\"\n"
Print File Arquivo "A210,030,1,3,1,2,N,\""+UF+" / "+CID+"\"\n"
Print File Arquivo "A130,055,1,3,1,2,N,\""+PED+"\"\n"
Print File Arquivo "A090,740,1,3,3,3,N,\""+DOC+"\"\n"

;**** Alterado em 31.05.2013 ***************************************************
;Print File Arquivo "A700,430,1,5,2,2,N,\""+"SIRI"+"\"\n"
;Print File Arquivo "A520,030,1,4,1,1,N,\""+"Destinatario"+"\"\n"
;Print File Arquivo "A450,030,1,3,1,2,N,\""+SubStr(RAZAO,01,40)+"\"\n"
;Print File Arquivo "A370,030,1,3,1,2,N,\""+SubStr(ENDER,01,40)+"\"\n"
;Print File Arquivo "A290,030,1,3,1,2,N,\""+Completa(BAIR,23," ")+CEP+"\"\n"
;Print File Arquivo "A210,030,1,3,1,2,N,\""+UF+" / "+CID+"\"\n"
;Print File Arquivo "A130,055,1,5,2,2,N,\""+PED+"\"\n"
;Print File Arquivo "A090,740,1,3,3,3,N,\""+DOC+"\"\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
EndIf

Arquivo="SIRI.ext"
Deleta_Arquivo(Arquivo)

{Ask} {PedidoC} Check
Moveto [Numero do Pedido] Example "ped"
{Ask} {Answer} Check
Moveto [Numero do Pedido] Example "ped"
Do_IT!
ClearAll

Coedit "Answer"
Scan
  te=[NCopias]

  RAZAO=[Razao Social]
  ENDER=[Endereco    ]
  BAIR =[Bairro      ]
  CEP  =[CEP         ]
  CID  =[CIDADE      ]
  UF   =[UF          ]

;;RAZAO="R2345678901234567890R2345678901234567890"
;;ENDER="E2345678901234567890E2345678901234567890"
;;BAIR ="B2345678901234567890"
;;CEP  ="CEP4567890"
;;CID  ="C2345678901234567890"
;;UF   ="UF"

  PED=[Numero do Pedido]
  If Not IsBlank([Numero do Documento])
     Then DOC=[Tipo do Documento]+"/"+[Numero do Documento]
     Else DOC=""
  EndIf

  Monta_Etiqueta()
EndScan
Do_It!
ClearAll

ImpriArq(Arquivo)

Sleep 700
Deleta_Arquivo(Arquivo)
ClearAll
EndProc

Monta_Comandos()
Release Procs Monta_Etiqueta,Monta_Comandos
