;** TIBPT **********************************************************************
;*  CARGA TRIBUTARIA CONFORME IBPT                                             *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 04/06/2013 por Bruno Carvalho 
;Ultima Alteracao: 10/02/2013 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes PAGINAR            
;Ultima Alteracao: 21/10/2017 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes layout             

;*******************************************************************************
;* Rotina para Localizar Registro                                              *
;*******************************************************************************
Proc CHAVE()

While True
  Moveto [UF]
  End 
  If OPCAO_FORM="F"
     Then Down
     Else PgDn
  EndIf

  SetaCorRegistro("Editar")

  Opcao_Ver=False
    
  Switch
    Case Field()="" : MSGCAMPO=""  
    OtherWise       : MSGCAMPO=Field()
  EndSwitch

  TECLA=""
  AguardaTeclasPadraoIt2()

  Switch
     Case RetVal="F3":
          If OPCAO_FORM="F"
             Then OPCAO_FORM="2"
             Else OPCAO_FORM="F"
          EndIf
          Del
          CHAVE=5
          Return
    Case RetVal=-94 : MsgTeclasPadrao()
    Case RetVal=-33 : SemFuncoes()
    Case RetVal="F7" Or RetVal="DOWN" Or RetVal="UP" Or RetVal="PGUP" Or RetVal="HOME":
         While True
             If OPCAO_FORM="F"
                 Then PAGINA("TIBPT","MR")
                 Else PAGINA("TIBPT","MT")
             EndIf
            If EDITAR="S"
               Then UnLockRecord
               Else If EXCLUIR="S"
                       Then UnLockRecord
                       Else QuitLoop
                    EndIf
            EndIf
            SetaPosForm()
         EndWhile
         Loop
    Case Retval="ESC": 
         CHAVE=9
         QuitLoop
    Case Retval="PGDN": 
         CHAVE=9
         QuitLoop
    ;Case Retval="ENTER": FastMsg("Edi‡Æo nÆo permitida!")  
    ;     QuitLoop
    EndSwitch

EndWhile

EndProc ; (CHAVE)

;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************
AutoLib="\\Sistemas\\Cadastro\\Bibliot,\\Sistemas\\Cadastro\\Bib_Show"

CoEdit "TIBPT"

PickForm "F"
OPCAO_FORM="F"
While True
      CHAVE()
      If CHAVE=9
         Then QuitLoop
      EndIf
      If CHAVE=5
         Then If OPCAO_FORM="F"
                 Then PickForm "F"
                 Else PickForm "1"
              EndIf
      EndIf
EndWhile
Do_It!
ClearAll

Release Vars All
Release Procs All
