;** EXP_GW **********************************************************************
;*  PROGRAMA DE EXPORTACAO DE TABELAS PARA ARQUIVOS TXT                        *
;********************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 17/08/2006 por Nikolas M. Mateus
;Ultima Alteracao: 13/08/2007 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes Deleta_Arquivo
;Ultima Alteracao: 01/10/2016 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes showdialog.                  

;*******************************************************************************
;* Rotina para Localizar Registro                                              *
;*******************************************************************************
proc processa()
AGUARDE("Aguarde, processando")
clearAll

Deleta_Arquivo("\\Sistemas\\Cadastro\\Destinat.txt")
Deleta_Arquivo("\\Sistemas\\Ctacor\\Plcontas.txt")
Deleta_Arquivo("\\Sistemas\\Estoque\\Itens.txt")
Deleta_Arquivo("\\Sistemas\\Ctapag\\Titulos.txt")
Deleta_Arquivo("\\Sistemas\\Ctarec\\Duplic.txt")
Deleta_Arquivo("\\Sistemas\\Vendas\\Notac.txt")
Deleta_Arquivo("\\Sistemas\\Vendas\\Notai.txt")

{Tools} {More} {Directory} {\\SISTEMAS\\CADASTRO\\}
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
{Destinat} {Destinat}

{Tools} {More} {Directory} {\\SISTEMAS\\Ctacor\\}
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
{Plcontas} {Plcontas}

{Tools} {More} {Directory} {\\SISTEMAS\\ctapag\\}
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
{Titulos} {Titulos}

{Tools} {More} {Directory} {\\SISTEMAS\\CTArec\\}
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
{Duplic} {Duplic}

{Tools} {More} {Directory} {\\SISTEMAS\\estoque\\} 
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
{Itens} {Itens}

{Tools} {More} {Directory} {\\SISTEMAS\\vendas\\}
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
{Notac} {Notac}

{Tools} {ExportImport} {Export} {ASCII} {Delimited}
{Notai} {Notai}

{Tools} {More} {Directory} {\\SISTEMAS\\Exporta\\} 

clearall
endproc

;*******************************************************************************
;* Rotina                                                                      *
;*******************************************************************************
Proc SD_Dialog(Disparo,Campo,Evento,Elemento)
Temp=True
If Disparo="OPEN"  Then AoCriarShowDialog() EndIf
If Disparo="EVENT" And Evento["Type"]="KEY" Then
   Switch
     Case Evento["KeyCode"] = -59: Dialog_F1()
     Case Evento["KeyCode"] =  27:
          Temp=False
          Switch
            Case Campo="YES": Campo="NO"
            Case Campo="NO" : Campo="YES"
          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:
          Checa_Tag()
          Temp=False
          RefreshDialog
   EndSwitch
EndIf
TECLA=""
MSG_CAMPO=""
Monta_Prompt(MSG_CAMPO,TECLA)
Return Temp
EndProc

;*******************************************************************************
;* ROTINA PRINCIPAL                                                            *
;*******************************************************************************
AutoLib="\\Sistemas\\Cadastro\\Bib_Show,\\Sistemas\\Cadastro\\Bibliot"
LimpAguarde()

While True
 ShowDialog "Gera Tabelas TXT - GW" Proc "SD_Dialog"
   Trigger "OPEN","ARRIVE"
    Key "TAB","ReverseTab","ENTER","ESC",
      -104, -105, -106, -107, -108, -109, -110, -111, -112, -113, -139, -140    
     @ 05,12 Height 05 Width 72

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

  EndDialog
  If Not RetVal Then QuitLoop EndIf

  Processa()

  LimpAguarde()
  MENSAGEM("Fim da Opera‡„o !")

EndWhile
ClearAll
Release Vars All
Release Procs All
