;** ET_0370 ********************************************************************
;** Imprime Etiqueta Personalizada                   **  CHARMY  TECIDOS **    *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 29/12/2015 por Kamila Gomes
;Alterado      em:   /  /     por 
;Motivo Alteracao: 

;*******************************************************************************
;* Rotina para Impressao do Relatorio                                          *
;*******************************************************************************
Proc IMPETIQUETA()
Private Wh

If VSDGQUAN = BlankNum()
   Then VSDGQUAN = 1
EndIf

COLUNA = VSDGQUAN 
LINHA  = 0

Print File ARQIMP "\n\n\n\n"

For Wh From 1 To VSDGQUAN

    Print File ARQIMP CI_12CPP
    Print File ARQIMP "\014" 
    
    Switch
      Case COLUNA >= 2 :
           FAZ = 2
           COLUNA = COLUNA - 2
      Case COLUNA = 1 :
           FAZ = 1
           COLUNA = COLUNA - 1
      OtherWise : QuitLoop
    EndSwitch  
    
    For i From 1 To FAZ
      Print File ARQIMP "\014" 
      Print File ARQIMP "\027E"+"  ART: "+"\027F"+Format("W15,AL",VSDGITEM)
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(4)
         Else Print File ARQIMP "\n\n"
      EndIf   
    EndFor  
    
    For i From 1 To FAZ 
      Print File ARQIMP "\014" 
      Print File ARQIMP "\027E"+" NOME: "+"\027F"+Format("W15,AL",SubStr(Descri_Compl,1,15))
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(4)
         Else Print File ARQIMP "\n"
      EndIf
    EndFor  
    
    For i From 1 To FAZ  
      Print File ARQIMP "\014"  
      Print File ARQIMP Spaces(07)+Format("W15,AL",SubStr(Descri_Compl,16,15))
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(4)
         Else Print File ARQIMP "\n"
      EndIf   
    EndFor  
    
    For i From 1 To FAZ  
      Print File ARQIMP "\014"  
      Print File ARQIMP Spaces(07)+Format("W15,AL",SubStr(Descri_Compl,31,15))
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(4)
         Else Print File ARQIMP "\n\n"
      EndIf   
    EndFor 
    
    For i From 1 To FAZ
      Print File ARQIMP "\014" 
      Print File ARQIMP "\027E"+"CODIGO: "+"\027F"+Format("W7,AL",VSDGCOD)+Spaces(01);+"\n" ;Substr(Format("W9.2,EIC",VSDGPRECO),1,9)+"\n" 
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(11)
         Else Print File ARQIMP "\n\n"
      EndIf   
    EndFor 
          
   
    
    Print File ARQIMP CI_12CPP
    Print File ARQIMP CI_6LPP    
    
    LINHA = LINHA + 1
    
    If Wh <> VSDGQUAN  
       Then If LINHA <> 5
               Then Print File ARQIMP "\n\n\n\n"
               Else Print File ARQIMP "\n\n\n\n\n\n\n\n\n\n\n\n"
                    LINHA = 0
            EndIf
    EndIf
    
EndFor

EndProc ;IMPETIQUETA()
;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************
ARQIMP=PrivDir()+"ET_0370.Txt"
If IsFile(ARQIMP)
   Then Deleta_Arquivo(ARQIMP)
EndIf
AGUARDE("Imprimindo Etiqueta ...")

Descri_Compl=""

GetRecord "\\Sistemas\\Estoque\\Itens" VSDGITEM To ET_ITEM
If RetVal
   Then Descri_Compl= ET_ITEM["Descricao Complementar"]
EndIf

IMPETIQUETA()

;---- Imprime Arquivo Impressao ------------------------------------------------
ImpriArq(ARQIMP)

Release Vars COLUNA, LINHA, Descri_Compl
Release Procs IMPETIQUETA

LIMPAGUARDE()