;** Lista ********************************************************************
;*  LIsta de Op‡oes de Invent rio                                             *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 23/04/2001 por Karen Lauar Nery
;Ultima Alteracao: 14/08/2007 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes Deleta_Arquivo
;Ultima Alteracao: 19/09/2012 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes Substitui‡Æo Editor novo arquivo por FileWrite
;Ultima Alteracao: 04/02/2013 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes LimpaRodape()                  

;*******************************************************************************
;* ROTINA PARA Ler/Gravacao Opcao                                              *
;******************************************************************************
Proc ConfOpcoes(Opcao)
Private Opcao

Switch
  Case Opcao="Ler":
       DynArray Array_OpInvent[]
       Array_OpInvent[01]="01 - Inventario Simples"
       Array_OpInvent[02]="02 - Inventario/Familia"
       Array_OpInvent[03]="03 - Inventario/Marca/Grupo"
       Array_OpInvent[04]="04 - Inventario/Grupo"
       Array_OpInvent[05]="05 - Inventario/Marca"
       Array_OpInvent[06]="06 - Inventario/ICMS"

       If IsFile("OE_1000.sc")
           Then Play "OE_1000"
           Else VSDGOPINVENT         =1
                VSDGOPRELCODALF   =""
                VSDGNOMOPRELCODALF=""
       EndIf
  Case Opcao="Gravar":
       FileWrite        "OE_1000.sc" From ";****** Variaveis de Configura‡„o Opcao de Inventario Vise Informatica"+"\n"
       FileWrite Append "OE_1000.sc" From "VSDGOPINVENT="+VSDGOPINVENT+"\n"
       FileWrite Append "OE_1000.sc" From "VSDGOPRELCODALF="+Chr(34)+VSDGOPRELCODALF+Chr(34)+"\n"
EndSwitch
EndProc ;


;*******************************************************************************
;* Rotina                                                                      *
;*******************************************************************************
Proc SD_Dialog7(Disparo,Campo,Evento,Elemento)
Temp=True
MSG_CAMPO=""
TECLA=""
If Disparo="OPEN"  Then AoCriarShowDialog() EndIf
If Disparo="EVENT" And Evento["Type"]="KEY" Then
   Switch
     Case Evento["KeyCode"] = 9: Temp=False
     Case Evento["KeyCode"] = -59: Dialog_F1()

     Case Evento["KeyCode"] =  27:
          Temp=False
          Switch
            Case Campo="TG_OPINVENT"       :INICIO_DIALOGO=True
                                            CancelDialog
            Case Campo="TG_OPRELCODALF"    : Campo="TG_OPINVENT"
            Case Campo="YES" Or Campo="NO" : Campo="TG_OPINVENT"
          EndSwitch
     Case (Evento["KeyCode"] <= -104 And Evento["KeyCode"] >= -113) Or 
           Evento["KeyCode"]  = -139 Or  Evento["KeyCode"]  = -140:
           SYS_TECLA_ACIONADA=Evento["KeyCode"]
           Seta_Tecla_Acionada()
           CancelDialog
     Case Evento["KeyCode"] = 13:
          Temp=False
          If Checa_TAG()
             Then Switch
                    Case Campo="TG_OPINVENT"       : Campo="TG_OPRELCODALF"
                    Case Campo="TG_OPRELCODALF"    : Campo="YES"
                    Case Campo="NO"                : AcceptDialog
                                                     Show_Cab=True
                                                     INICIO_DIALOGO=False

                  EndSwitch
          EndIf
          RefreshDialog
   EndSwitch
EndIf
Switch
  Case Campo="TG_OPINVENT":
     MSG_CAMPO="Selecione o op‡„o desejada !"
     TECLA    ="=Selecionar  "

EndSwitch
Monta_Prompt(MSG_CAMPO,TECLA)
Return Temp
EndProc


;*******************************************************************************
;* Rotina Impressao                                                            *
;*******************************************************************************
Proc Imprimir()
LimpaRodape(0)
Do_It!
ClearAll

While True

  OP_SHOW="I"
  ShowDialog "Imprimir" Proc "SD_Dialog7"
  Trigger "OPEN","ARRIVE"
  Key "F1","ENTER","ESC","TAB",
      -104, -105, -106, -107, -108, -109, -110, -111, -112, -113, -139, -140  
   @ 01,01 Height 14 Width 55

    PickDynArray @1,01 Height 6 width 51
     Columns 1
      Array_OpInvent
       Tag "TG_OPINVENT"
        To VSDGOPINVENT
    Label @ 00,00 "Op‡”es de Inventario"  For "TG_OPINVENT"

    Label  @ 07,00 "Op‡„o de Ordem" For "TG_OPRELCODALF"
    Accept @ 08,01 Width 04 "A1"  Picture "1,2" Tag "TG_OPRELCODALF" To VSDGOPRELCODALF
    Accept @ 08,06 Width 31 "A25"  Picture "!*!" Tag "TG_NOMOPRELCODALF" To VSDGNOMOPRELCODALF

    Pushbutton @ 10,10 width 11 "~O~k"      OK     Default Value "Ok" Tag "YES" To BottonValue
    Pushbutton @ 10,24 width 11 "~C~ancela" CANCEL                    Tag "NO"  To BottonValue

  EndDialog
  If Not RetVal Then QuitLoop EndIf

 Dispositivo()
 If OK="" Then Loop EndIf

 ConfOpcoes("Gravar")

 QuitLoop
EndWhile
ClearAll

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

ConfOpcoes("Ler")

  Imprimir()

