;** ET_0370B  ******************************************************************
;** Impressao de Etiqueta - Jato de Tinta                       ** CHARMY **   *
;** Etiqueta Pimaco Com 5 Colunas e 12 Linhas de Etiqueta (3,8 x 2,1)          *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido em : 30/12/2015 por Kamila Gomes  
;Ultima Alteracao: 14/01/2016 por Kamila Gomes    
;Motivo Alteracao: Ajustes tamanho cąd item     

;*******************************************************************************
;* Rotina de Impressao das Etiquetas                                           *
;*******************************************************************************
Proc MONTA_ETIQUETA()

If QUEBRA_PAGINA > 60                  
   Then QUEBRA_PAGINA = 5
        Print File ARQIMP "\f"      
        Print File ARQIMP CI_15CPP
        Print File ARQIMP "\n\n\n"
EndIf             

Print File ARQIMP Spaces(02)

For I From 1 to K
  Print File ARQIMP Format("W12,AL",COD_ITEM[I])+spaces(11)
  If I=1 Or I=3  
     Then Print File ARQIMP Spaces(08)
     Else Print File ARQIMP Spaces(07)
  EndIf   
EndFor

Print File ARQIMP "\n"
Print File ARQIMP Spaces(02)
        
For I From 1 to K
  Print File ARQIMP Format("W23,AL",SubStr(DESC_ITEM1[I],1,23))
  If I=1 Or I=3                                       
     Then Print File ARQIMP Spaces(08)
     Else Print File ARQIMP Spaces(07)
  EndIf 
EndFor

Print File ARQIMP "\n"
Print File ARQIMP Spaces(02)

For I From 1 to K
  Print File ARQIMP "\027E"+Format("W23,AL",SubStr(DESC_ITEM1[I],24,23))+"\027F"  
  If I=1 Or I=3                                       
     Then Print File ARQIMP Spaces(08)
     Else Print File ARQIMP Spaces(07)
  EndIf 
EndFor
                                                      
Print File ARQIMP "\n\n\n"              

EndProc
;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************
ClearAll

ArqImp=PrivDir()+"ET_0370B.Txt"
If IsFile(ArqImp)
   Then Deleta_Arquivo(ARQIMP)
EndIf

AGUARDE("Imprimindo Etiqueta ...")

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

DynArray ITEM[]
Array DESC_ITEM1[5]
Array COD_ITEM[5]

CONT_ITEM     = 0
K             = 0
CODIGO_ITEM   = "***"
CONTADOR      = 0                            
QUEBRA_PAGINA = 0

While VSDGQUAN > CONTADOR
         
      CONT_ITEM = CONT_ITEM + 1
      ITEM[CONT_ITEM] = VSDGITEM
      
      CONTADOR=CONTADOR + 1  
      QUEBRA_PAGINA = QUEBRA_PAGINA + 1
      
      K=K+1 
                      ;07                                          ;03
      COD_ITEM[K]   = "\027E"+Format("W10,AL",VSDGITEM)+"\027F"                                                         
      DESC_ITEM1[K] = "\027E"+Format("W30,AL",VSDGNOMITEM)+"\027F"  
      
      If K=5                    
         Then MONTA_ETIQUETA()
              K=0
      EndIf
EndWhile

If K>0
   Then MONTA_ETIQUETA()
EndIf

Print File ARQIMP "\n"

LIMPAGUARDE()


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



