;** ET_0352 ********************************************************************
;** Imprime Etiqueta Personalizada                   ** DECORART TECIDOS **    *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 23/07/2014 por Andrey Fillipe
;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"
      EndIf   
    EndFor  
    
    For i From 1 To FAZ 
      Print File ARQIMP "\014" 
      Print File ARQIMP "\027E"+" COMP: "+"\027F"+Format("W15,AL",SubStr(VSDGNOMITEM,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(VSDGNOMITEM,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 "\027E"+"  COD: "+"\027F"+Format("W15,AL",VSDGCOD)
      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 "\027E"+" NOME: "+"\027F"+Format("W15,AL",SubStr(VSDGNOME,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(VSDGNOME,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 "\027E"+"  REN: "  +"\027F"+Format("W5,AL",Substr(VSDGREND,1,5))+" KG"
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(11)
         Else Print File ARQIMP "\n"
      EndIf   
    EndFor 
        
    For i From 1 To FAZ                  
      Print File ARQIMP "\014"                    
      Print File ARQIMP "\027E"+"  PCA: "+"\027F"+Format("W5,AL",Substr(VSDGPEC,1,5))+" MT"
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(11)
         Else Print File ARQIMP "\n"
      EndIf   
    EndFor 
        
    For i From 1 To FAZ
      Print File ARQIMP "\014"
      Print File ARQIMP "\027E"+"  LAR: "+"\027F"+Format("W15,AL",Substr(VSDGLARG,1,4))
      If i = 1 And FAZ = 2
         Then Print File ARQIMP Spaces(4)
         Else Print File ARQIMP "\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"
               Else Print File ARQIMP "\n\n\n\n\n\n\n\n\n\n\n"
                    LINHA = 0
            EndIf
    EndIf
    
EndFor

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

IMPETIQUETA()

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

Release Vars COLUNA, LINHA
Release Procs IMPETIQUETA

LIMPAGUARDE()