;*******************************************************************************
;* Desenvolvido: 19/03/2020 por Bruno Carvalho                                 *
;*******************************************************************************
Autolib="\\Sistemas\\Cadastro\\Bibliot,\\Sistemas\\Cadastro\\Bib_Show"

DATAM_DATA   = DateVal("30.04.2020")
DATAM_VERSAO = "2020.D"
 
DATAM_EXECUTA = "SYS_DATAM"
Play "\\Sistemas\\Cadastro\\EXEC_DAT"

If Not DATAM_EXECUTA 
   Then Exit
   Else DATAM_ROTINA  = "Estoque"
        DATAM_EXECUTA = "SYS_DATAM_MENSAGEM"
        Play "\\Sistemas\\Cadastro\\EXEC_DAT"
        If Not DATAM_EXECUTA
           Then Exit
        EndIf
EndIf 
 
;*******************************************************************************
;Rotina Corre‡Æo de Tabelas                                                    *
;*******************************************************************************
Proc Correcao_Tabelas_Estoque()
Private TABELA, regtpitem

If IsTable("TpItem")  
   Then 
        If IsTable("TMPTPIT")
           Then View "TpItem"
                CoEdit "TMPTPIT"
                Scan
                  copytoarray regtpitem
                
                  ITEM_TIPO = [Tipo do Item] 
                  ITEM_SPED = [SPED_Tipo   ]  
                  
                  Moveto "TpItem"
                  Moveto [Tipo do Item] 
                  Locate ITEM_TIPO
                  If RetVal
                     Then [SPED_Tipo] = ITEM_SPED
                     else end down
                          copyfromarray regtpitem    
                  EndIf   
                  UnLockRecord

                  Moveto "TMPTPIT"
                EndScan
                Do_It!
                ClearImage
                
                Delete "TMPTPIT"
        EndIf
EndIf

EndProc ;Correcao_Tabelas_Cobranca()

;*******************************************************************************
;Rotina Principal                                                              *
;*******************************************************************************
Aguarde("Atualizando Sistema")
Password("t01avivcl")
Password("FechaSys")

View "SysTable"
SYS_CODIGO_CLIENTE = [Codigo do Cliente]
ClearAll

;-------------------------------------------------------------------------------

DATAM_ROTINA   = "ESTOQUE"
DATAM_FECHAMES = ""
DATAM_EXECUTA  = "DATAM_SETDIR"
Play "\\Sistemas\\Cadastro\\EXEC_DAT" 

{Tools} {More} {Directory} {\\Sistemas\\Cadastro\\}

DATAM_EXECUTA  = "DATAM_SYSTABLE"
Play "\\Sistemas\\Cadastro\\EXEC_DAT" 

UnPassword("t01avivcl")
UnPassword("FechaSys")
LimpAguarde()
FastMsg("Fim da atualiza‡Æo !")

DATAM_EXECUTA  = "DATAM_RELEASE"
Play "\\Sistemas\\Cadastro\\EXEC_DAT"

Release Vars DATAM_EXECUTA
