;** Montitgr *******************************************************************
;** Rotina monta titulo da grade                                               *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 03/10/2008 por Anivel Augusto Rodrigues

;*******************************************************************************
;* Rotina Monta Aray Grade                                                     *
;*******************************************************************************
Proc Monta_Titulo_Grade(Tp,vr)
Private i, ntab, tp, vr, okgrade

ntab=table()

If Not IsAssigned(TIT_TM)
   Then Array TIT_TM[12]
EndIf

For i From 1 to 12
  TIT_TM[i]=""
EndFor

okgrade=True
Switch
  Case Tp="Lookup":
       Moveto [Codigo da Grade]
       If not Busca_Lookup("Codigo da Grade",vr,"")
          Then okgraded=false
       EndIf
  Case Tp="Locate":
       Moveto "\\Sistemas\\Estoque\\Tpgrade"
       Moveto [Codigo da Grade]
       Locate vr
       If Not RetVal
          Then okgrade=false
          Else CopyToArray REG_BUSCA_LOOLUP
       EndIf
EndSwitch
If okgrade
   Then TIT_TM[1] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade1" ])+" "
        TIT_TM[2] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade2" ])+" "
        TIT_TM[3] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade3" ])+" "
        TIT_TM[4] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade4" ])+" "
        TIT_TM[5] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade5" ])+" "
        TIT_TM[6] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade6" ])+" "
        TIT_TM[7] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade7" ])+" "
        TIT_TM[8] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade8" ])+" "
        TIT_TM[9] =Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade9" ])+" "
        TIT_TM[10]=Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade10"])+" "
        TIT_TM[11]=Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade11"])+" "
        TIT_TM[12]=Format("W3,AR",REG_BUSCA_LOOKUP["Titulo Grade12"])+" "
EndIf

Moveto ntab
EndProc

Monta_Titulo_Grade("Locate",[Answer->Codigo da Grade])

