;** RE_M001 ********************************************************************
;** Imprime Etiqueta Numera‡Æo Mostruario 7 X 18 etiquetas                     *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 28/12/2017 por Anivel Augusto Rodrigues
;Ultima Alteracao: 30/05/2018 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes campo Numero 4 caracteres   

;*******************************************************************************
;* Rotina para Impressao do Relatorio                                          *
;*******************************************************************************
Proc IMPETIQUETA()
private s, i, coluna, linha, numero, iniciopagina

s      = ""
coluna = 0 
linha  = 0
iniciopagina=true

View "Answer"
Scan
  numero = [Numero]

  For i From 1 to [Answer->Quantidade]

    if iniciopagina 
       then Print File ARQIMP CI_8LPP+CI_10CPP+CI_IEXP+CI_INEG+"\n\n\n\n\n"
            iniciopagina=false
    endif   

    coluna=coluna+1
    switch
      case coluna=1 : s=CI_8LPP+CI_10CPP+CI_IEXP+CI_INEG+"  "
      case coluna=2 : s=s+"   "
      case coluna=3 : s=s+"    "
      case coluna=4 : s=s+"    "
      case coluna=5 : s=s+"   "
      case coluna=6 : s=s+"    "
      case coluna=7 : s=s+"   "
    endswitch
    s=s+format("W4,AL",numero)

    if coluna=7
       then 
            coluna=0
            linha =linha+1

            switch
              case linha=1  :  Print File ARQIMP s+"\n\n\n\n\n" 
              case linha=2  :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=3  :  Print File ARQIMP s+"\n\n\n\n"
              case linha=4  :  Print File ARQIMP s+"\n\n\n\n"
              case linha=5  :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=6  :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=7  :  Print File ARQIMP s+"\n\n\n\n"
              case linha=8  :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=9  :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=10 :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=11 :  Print File ARQIMP s+"\n\n\n\n"
              case linha=12 :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=13 :  Print File ARQIMP s+"\n\n\n\n"
              case linha=14 :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=15 :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=16 :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=17 :  Print File ARQIMP s+"\n\n\n\n\n"
              case linha=18 :  
                s=s+CI_FEXP+CI_FNEG+"\f"
                Print File ARQIMP s

                s=""
                linha=0
                iniciopagina=true
            endswitch
    endif     

  EndFor

EndScan
if coluna>0
   then Print File ARQIMP s+CI_FEXP+CI_FNEG+"\f"
endif

ClearAll

EndProc ;IMPETIQUETA()

;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************
ARQIMP=PrivDir()+"RE_M001.TXT"
If IsFile(ARQIMP)
   Then Deleta_Arquivo(ARQIMP)
EndIf

AGUARDE("Imprimindo Etiqueta ...")

IMPETIQUETA()

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

Release Procs IMPETIQUETA

LIMPAGUARDE()
