home *** CD-ROM | disk | FTP | other *** search
- /*
- PROGRAMA : Freedom Call
- UNIT : FreeExtern.c
- AUTOR : Cristian Robert Gallas (SuRRouND)
- DATA : 01/02/1998 a 21.05.1999
- S.O. : Workbench & AmigaDos
- LINGUAGEM : SAS C 6.58 + MUI Library
- PLATAFORMA : Amiga ECS & AGA
- DEPENDE : Mui 3.7+, 2 mb+
- */
-
- #include <surround.h>
- #include "freedom.h"
- #include "freegui.h"
- #include "freemain.h"
- #include "freeextern.h"
-
- #include <fcntl.h>
- #include <exec/memory.h>
- #include <proto/muimaster.h>
- #include <clib/alib_protos.h>
- #include <clib/dos_protos.h>
- #include <clib/exec_protos.h>
- #include <libraries/mui.h>
- #include <libraries/asl.h>
-
- CarregaPilhaCategorias(char categoria[256])
- {
- /* CARREGA OS LIMITES PARA UMA VARIAVEL GLOBAL */
- char *categorydir, a, teste[256], lecateg[256];
- int x = 0, pos = 0;
- FILE *entrada;
-
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- sprintf(lecateg, "%s/%s", categorydir, categoria);
-
- if(!(entrada = fopen(lecateg, "r")))
- return 0;
-
- x = 0; pos = 0;
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if(a == '\n') {
- teste[--x] = '\0';
- strcpy(pilha[pos++], teste);
- teste[0] = '\0'; x = 0; }
- }
- pilhafim = --pos;
- fclose(entrada);
- }
-
- int CarregaBarraStatus(void)
- {
- /* CARREGA A DATA DE HOJE NA BARRA DA JANELA GRAFICA */
- char teste[256], dia[20];
- strcpy(dia, DataHora(0));
-
- sprintf(teste, "\033r%s, of %s %s (%s)", Corta(dia, '.', 0), DescricaoMesFREE(atoi(Corta(dia, '.', 1)), 1), Corta(dia, '.', 2), DiaSemanaFREE(dia, 1));
- set(App->Janela2StatusBar, MUIA_Text_Contents, teste);
- return NULL;
- }
-
- int CarregaLista(struct Hook *objeto, char arq[256])
- {
- /* ESTA ROTINA CARREGA APARTIR DE UM ARQUIVO UMA LISTA FLOAT TEXT */
- APTR *text;
- long filesize = 0;
- BPTR entrada;
-
- set(objeto, MUIA_Floattext_Text, NULL);
- if(!(entrada = Open(arq, MODE_OLDFILE)))
- return 0;
- filesize = atof(ExaminaArquivo(arq, 0));
- text = AllocVec(filesize+1, MEMF_ANY|MEMF_CLEAR);
- text[filesize] = '\0';
-
- Read(entrada, text, filesize);
- Close(entrada);
-
- set(objeto, MUIA_Floattext_Text, text);
- FreeVec(text);
- return NULL;
- }
-
- int TestaPedidoRegistro(void)
- {
- /* VERIFICA SE AS INFORMACOES DO PEDIDO DE REGISTRO SAO VALIDAS
- RETORNA:
- 0 - INFORMACOES EM BRANCO
- 1 - INFORMACOES INVALIDAS
- -1 - OK */
- char *regemail, *regname, *regcountry, *regcity, *regnumber;
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterCity, MUIA_String_Contents, ®city);
-
- if(!strcmp(regnumber, ""))
- return 0;
- if(strlen(regemail) < 4 || strlen(regname) < 4 || strlen(regcountry) < 2 || strlen(regcity) < 2)
- return 1;
- return -1;
- }
-
- int CarregaListaLimites(char categoria[256])
- {
- /* ROTINA QUE ADICIONA UM LIMITE NOVO A LISTA */
- static struct buffer {
- char lista[256];
- };
- static struct buffer listaarray[50];
-
- char teste[256], a, *categorydir, var1[50], var2[50], var3[50],
- var4[50], var5[50], lecateg[256];
- int x = 0;
- long pos = 0;
- FILE *entrada;
-
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- sprintf(lecateg, "%s/%s", categorydir, categoria);
-
- if(!(entrada = fopen(lecateg, "r")))
- return 0;
-
- DoMethod(App->LimitesLista, MUIM_List_Clear);
- x = 0; pos = 0;
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if(a == '\n')
- {
- teste[--x] = '\0';
- if(strcmp(Corta(teste, ':', 0), "**>money"))
- {
- pos++;
- if(pos < 51)
- {
- strcpy(var1, SegundoHora(Corta(teste, ' ', 0)));
- strcpy(var2, SegundoHora(Corta(teste, ' ', 1)));
- strcpy(var3, Corta(teste, ' ', 2));
- strcpy(var4, Corta(teste, ' ', 3));
- strcpy(var5, Corta(teste, ' ', 4));
- sprintf(teste, "%s %s %s %s %s", var1, var2, var3, var4, var5);
- strcpy(listaarray[pos].lista, teste);
- DoMethod(App->LimitesLista, MUIM_List_InsertSingle, &listaarray[pos].lista[0], MUIV_List_Insert_Bottom);
- }
- }
- teste[0] = '\0'; x = 0;
- }
- }
- fclose(entrada);
- sprintf(teste, LeRegistroDB(lecateg, "money"));
-
- strcpy(var1, Corta(teste, '@', 1));
- if(!strcmp(var1, "CUTERRO"))
- set(App->NomeMoeda, MUIA_String_Contents, "");
- else
- set(App->NomeMoeda, MUIA_String_Contents, var1);
-
- set(App->ComboMoeda, MUIA_Cycle_Active, atof(Corta(teste, '@', 0)));
-
- set(App->NomeCategoria, MUIA_String_Contents, categoria);
- return -1;
- }
-
- int CarregaListaCategorias(void)
- {
- char *categorydir;
-
- DoMethod(App->CategoriesList, MUIM_List_Clear);
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- DiretorioArquivo(categorydir, "T:Freedom.CategoryDir", 0);
-
- /* CARREGA DO ARQUIVO PARA A LISTA */
- CarregaLista(App->CategoriesList, "T:Freedom.CategoryDir");
- remove("T:Freedom.CategoryDir");
- return -1;
- }
-
- int MsgRegistro(void)
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg60));
- return NULL;
- }
-
- LimpaJanelaDesseMes(void)
- {
- /* LIMPA OS CAMPOS DA JANELA DE CONSULTA DESSE E DE OUTRO MES */
- set(App->LabelMesUso, MUIA_Text_Contents, TMsg(App->Msg16));
- set(App->LabelMesNumero, MUIA_Text_Contents, TMsg(App->Msg1));
- set(App->NrQuedaLinhaMes, MUIA_Text_Contents, TMsg(App->Msg4));
- set(App->NrLogoutGoodMes, MUIA_Text_Contents, TMsg(App->Msg5));
- set(App->NrDownResetMes, MUIA_Text_Contents, TMsg(App->Msg6));
- set(App->LabelMesUsadas, MUIA_Text_Contents, TMsg(App->Msg7));
- set(App->LabelMesMedia, MUIA_Text_Contents, TMsg(App->Msg9));
- set(App->LabelMesData, MUIA_Text_Contents, TMsg(App->Msg11));
- set(App->LabelMesMaior, MUIA_Text_Contents, TMsg(App->Msg10));
- set(App->LabelMesLow, MUIA_Text_Contents, TMsg(App->Msg12));
- set(App->LabelMesMenor, MUIA_Text_Contents, TMsg(App->Msg13));
- set(App->LabelMesExedentes, MUIA_Text_Contents, TMsg(App->Msg2));
- set(App->LabelUltimaLigacao, MUIA_Text_Contents, TMsg(App->Msg14));
- set(App->LabelPrimeiraLigacao, MUIA_Text_Contents, TMsg(App->Msg15));
- set(App->LabelCost, MUIA_Text_Contents, TMsg(App->Msg75));
- set(App->LabelCostAverage, MUIA_Text_Contents, TMsg(App->Msg76));
- return NULL;
- }
-
- int ConverteParaFreedom(char file[256])
- {
- /* ESTE COMANDO CONVERTE UM ARQUIVO PARA JOGAR NA BASE DO
- FREEDOM CALL, O FORMATO DEVE SER IGUAL AO FREEDOM.INPUT,
- FREEDOM.IN */
- char a, teste[256], data1[256], *database, saida[256];
- int x = 0;
- FILE *entrada;
-
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!(entrada = fopen(file, "r")))
- return 0;
-
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if(a == '\n')
- {
- teste[--x] = '\0';
- strcpy(data1, Corta(teste, ',', 1));
- strcpy(data1, AposCaracter(data1, '.', 1));
- sprintf(saida, "%s/Freedom.%s", database, data1);
- sprintf(teste, "%s\n", teste);
- GravaLinha(saida, teste, "a");
- teste[0] = '\0'; x = 0;
- }
- }
- fclose(entrada);
- }
-
- APTR Geracao( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA ROTINA FAZ A IMPORTACAO DOS DADOS DO MIAMI PARA DENTRO
- DO FREEDOM CALL, A IMPORTACAO EH TOTAL, CASO EXISTA INFORMACOES
- NA BASE DO FREEDOM SERAO TODAS REFEITAS APARTIR DO MIAMI */
- char *path, a, teste[256], pego[256], diferenca[256], gauge[30],
- telefone[20], dataon[20], dataoff[20], statusini[4],
- horaon[20], horaoff[20], linhaini[256], tempoon[40],
- pegolinha[256], recfone[20], tmp[256], *database,
- diaa[256], connect[256], lastfone[20], *anodis, *timedis;
- long int x, y, pegon, linhan = 0, erro = 0, dx = 0;
- float totalarq, gaugep;
- long warning = 0;
- FILE *entrada, *freedomout;
-
- get(App->RequestMiamiLog, MUIA_String_Contents, &path);
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
- set(App->GaugeGeracao, MUIA_Gauge_Current, 0);
-
- /* LE INFORMACOES DO CONFIG TIMEDIS, ANODIS */
- get(App->ExcededYear, MUIA_String_Contents, &anodis);
- get(App->ExcededTime, MUIA_String_Contents, &timedis);
-
- /* ROTINA QUE VERIFICA SE JA EXISTE UMA BASE DE DADOS */
- DiretorioArquivoFREE(database, "T:Freedom.DataDir", 1);
- if(LinhasArquivo("T:Freedom.DataDir") > 0)
- {
- /* DATABASE ALREADY EXIST, CLEAR, CANCEL, OK */
- x = MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg20), TMsg(App->Msg21));
- if(x == 0) {
- remove("T:Freedom.DataDir");
- return NULL; }
- if(x == 1)
- {
- DeletaArquivos("T:Freedom.DataDir");
- sprintf(teste, "%s/Freedom.Out", database);
- remove(teste);
- }
- }
- remove("T:Freedom.DataDir");
-
- set(App->EspereGerando, MUIA_Window_Open, TRUE);
- /* TESTA SE O ARQUIVO EXISTE */
- if(!(entrada = fopen(path, "r")))
- {
- fclose(entrada);
- set(App->EspereGerando,MUIA_Window_Open,FALSE);
- /* MIAMI LOG FILE NOT FOUND */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg22));
- return NULL;
- }
- else
- {
- totalarq = LinhasArquivo(path);
- sprintf(teste, "%s/Freedom.Out", database);
- freedomout = fopen(teste, "a");
-
- /* ABRE O ARQUIVO E GERA A IMPORTACAO DOS DADOS DO MIAMI */
- x = 0; y = 0; linhaini[0] = '\0'; pegon = 0; gaugep = 0;
- linhan = 0;
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if (a == '\n' || a == '\0')
- {
- teste[--x] = '\0';
- linhan++;
-
- /* PEGA O STATUS
- Onl -> Online, Hora Login
- Act -> Active Logout, Normal Logout
- Pas -> Passive Logout, Caiu a Linha
- Rec -> Reconnect */
- statusini[0] = teste[0];
- statusini[1] = teste[1];
- statusini[2] = teste[2];
- statusini[3] = '\0';
-
- if(x > 20 && !strcmp(statusini, "Onl") || !strcmp(statusini, "Pas") || !strcmp(statusini, "Act"))
- {
- gaugep++;
- sprintf(gauge, "%f", ((100 / totalarq) * gaugep));
- set(App->GaugeGeracao, MUIA_Gauge_Current, atoi(gauge));
- set(App->GaugeGeracao, MUIA_Gauge_InfoText, "%ld %%");
-
- strcpy(teste, AposCaracter(teste, ':', 2));
-
- /* ROTINA QUE TESTA SE EH LOG DO MIAMIDX */
- strcpy(tmp, Corta(teste, ' ', 0));
- if(PosicaoCaracter(tmp, ':', 1) > 10)
- dx = 1; else dx = 0;
-
- if(dx == 1)
- {
- strcpy(dataon, Corta(tmp, ':', 0));
- strcpy(horaon, HoraSegundo(AposCaracter(tmp, ':', 1)));
- strcpy(connect, Corta(teste, ' ', 2));
-
- } else {
-
- strcpy(dataon, Corta(teste, ' ', 0));
- strcpy(horaon, HoraSegundo(Corta(teste, ' ', 1)));
- strcpy(connect, Corta(teste, ' ', 3));
- }
-
- if(!strcmp(connect, "CUTERRO"))
- strcpy(connect, "Miami");
-
- if(!strcmp(statusini, "Onl"))
- {
- if(dx == 1)
- strcpy(telefone, Corta(teste, ' ', 1));
- else
- strcpy(telefone, Corta(teste, ' ', 2));
-
- strcpy(telefone, RetiraPontas(telefone, 1));
- strcpy(telefone, Corta(DeletaCaracter(telefone, ','), ':', 0));
- }
-
- strcpy(recfone, telefone);
- if(!strcmp(telefone, "UTERR"))
- strcpy(telefone, lastfone);
-
- sprintf(linhaini, "%s,%s,%s,%s", telefone, dataon, horaon, connect);
-
- strcpy(lastfone, telefone);
- if (pegon == 1)
- {
- if ((!strcmp(pego, "Onl")) && (strcmp(statusini, "Onl")))
- {
- /* FREEDOM.IN */
- strcpy(telefone, Corta(pegolinha, ',', 0));
- strcpy(dataon, Corta(pegolinha, ',', 1));
- strcpy(horaon, Corta(pegolinha, ',', 2));
- strcpy(connect, Corta(pegolinha, ',', 3));
-
- /* TESTA DATA INVALIDA < CONFIG (Disconsidera) */
- if(atof(DiaJuliano(dataon)) < atof(DiaJuliano(anodis)))
- continue;
-
- /* ROTINA QUE TESTA SE EH LOG DO MIAMIDX */
- if(dx == 1)
- {
- strcpy(dataoff, Corta(tmp, ':', 0));
- strcpy(horaoff, HoraSegundo(AposCaracter(tmp, ':', 1)));
-
- } else {
-
- strcpy(dataoff, Corta(teste, ' ', 0));
- strcpy(horaoff, HoraSegundo(Corta(teste, ' ', 1)));
- }
-
- strcpy(tempoon, IntervaloHora(Corta(pegolinha, ',', 2), horaoff));
- /* TESTA SE TROCOU DE DIA A CONECCAO */
- strcpy(diferenca, Corta(DiferencaDias(Corta(pegolinha, ',', 1), dataoff), ':', 1));
-
- if(atoi(diferenca) > 0)
- sprintf(tempoon, "%ld", atoi(diferenca) - atoi(tempoon));
-
- /* TESTA ANO INVALIDO */
- if(atof(tempoon) > atof(HoraSegundo(timedis)))
- continue;
-
- strcpy(diaa, Corta(pegolinha, ',', 1));
- strcpy(teste, AposCaracter(diaa, '.', 1));
- sprintf(diaa, "%s/Freedom.%s", database, teste);
-
- sprintf(teste, "%s,%s,%s,%s,%s,%s,%s,%s\n", telefone, dataon, horaon, dataoff, horaoff, statusini, tempoon, connect);
- GravaLinha(diaa, teste, "a");
- } else {
- fprintf(freedomout, "%s\n", linhaini);
- pegon = 0;
- }
- }
- strcpy(pego, statusini);
- strcpy(pegolinha, linhaini);
-
- linhaini[0] = '\0'; teste[0] = '\0'; x = 0;
- if (pegon == 0)
- pegon = 1;
- else
- pegon = 0;
- }
- else
- {
- if(strcmp(statusini, "Rec"))
- erro++;
- linhaini[0] = '\0'; teste[0] = '\0'; x = 0;
- }
- }
- }
- fclose(entrada);
- fclose(freedomout);
- }
- /* ADICIONA AS ROTINAS DE INPUT NA BASE DO FREEDOM */
- sprintf(teste, "%s/Freedom.Input", database);
- if(ExisteArquivo(teste))
- ConverteParaFreedom(teste);
- set(App->EspereGerando,MUIA_Window_Open,FALSE);
-
- /* MIAMI LOG FILE CORRUPT (ONLY ACTIVE, PASSIVE...) */
- if(erro > 0)
- {
- sprintf(teste, "%s%d", TMsg(App->Msg23), erro);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), teste);
- } else {
- /* ROTINA QUE MOSTRA O DISPLAY DA GERACAO */
- get(App->LabelVisualGeneration, MUIA_Selected, &warning);
- if(warning == 1)
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg19));
- }
- return NULL;
- }
-
- APTR PreparaEsseMes( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE PREPARA O ARQUIVO DE ESTATISTICAS COM SOMENTE
- INFORMACOES DO MES CORRENTE */
- char *horainicio, *horafim, *dia, ano[5], teste[256], teste2[256],
- data1[256], data2[256], *database, freein[256],
- freeout[256];
- int x = 0;
- long retorno = 0;
-
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
- /* CARREGA INFORMACOES DO PROVIDER SETS */
- get(App->PrefsFreeHInicio, MUIA_String_Contents, &horainicio);
- get(App->PrefsFreeHFim, MUIA_String_Contents, &horafim);
- get(App->PrefsDiaInicial, MUIA_String_Contents, &dia);
- get(App->ProviderRetornaMes, MUIA_Selected, &retorno);
-
- LimpaJanelaDesseMes();
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, TRUE);
- set(App->GaugeQuery, MUIA_Gauge_Current, 5);
- set(App->GaugeQuery, MUIA_Gauge_InfoText, TMsg(App->Msg26));
-
- strcpy(teste, DataHora(1));
- strcpy(ano, Corta(teste, '.', 1));
-
- /* CARREGA VARIAVEIS DE PARA LEITURA DOS ARQUIVOS */
- sprintf(freein, "%s/Freedom.%s", database, teste);
- sprintf(freeout, "%s/Freedom.Out", database);
-
- /* TESTA SE CONFIGURACAO DE FREE HOURS E DAY INITIAL SAO VALIDAS */
- if( ((!(strcmp(horainicio, "")) && !(strcmp(horafim, ""))) ||
- (!(strcmp(horainicio, "00:00:00")) && !(strcmp(horafim, "00:00:00")))) && (atoi(dia) <= 1) )
- {
- FiltraCampoParaArquivoFREE(teste, freein, "t:freedom.intmp", ',', 1, '.');
- FiltraCampoParaArquivoFREE(teste, freeout, "t:freedom.outtmp", ',', 1, '.');
- }
- else
- {
- /* ACERTA DAY INIT NOVO */
- strcpy(teste, DataHora(1));
- sprintf(data1, "%s.%s", dia, teste);
- x = atoi(dia);
- x--;
- if(x < 1)
- x = 31;
- sprintf(data2, "%d.%s", x, teste);
- strcpy(data2, SomaDiminuiMes(data2, 1));
-
- /* ROTINA QUE RETORNA UM MES NA CONSULTA CASO A OPCAO ESTEJA ON */
- if(retorno == 1)
- {
- strcpy(data1, SomaDiminuiMes(data1, -1));
- strcpy(data2, SomaDiminuiMes(data2, -1));
-
- sprintf(teste2, "%s/Freedom.%s", database, AposCaracter(data1, '.', 1));
- CopiaArquivo(teste2, "t:Freedom.In");
- sprintf(teste2, "%s/Freedom.%s", database, AposCaracter(data2, '.', 1));
- InsereArquivo(teste2, "t:Freedom.In");
- }
- else
- CopiaArquivo(freein, "t:Freedom.In");
-
- SelecionaIntervaloCampo("T:Freedom.In", "T:Freedom.InTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- remove("t:Freedom.In");
- SelecionaIntervaloCampo(freeout, "T:Freedom.OutTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- }
- set(App->GaugeQuery, MUIA_Gauge_Current, 25);
- /* CRIA ARQUIVO COM A DESCRICAO DA CONSULTA */
- sprintf(teste, "%s %s", DescricaoMesFREE(atoi(Corta(teste, '.', 0)), 1), ano);
- GravaRegistroDB("t:Freedom.Date", teste, "date", "w");
- SemanaCount("t:Freedom.InTmp");
- set(App->GaugeQuery, MUIA_Gauge_Current, 50);
- return NULL;
- }
-
- APTR CarregaEsseMes( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE CARREFA AS INFORMACOES DO ARQUIVO PREPARADO PARA
- A TELA INFORMACOES DO MES CORRENTE */
- char teste[256], teste2[256], horason[30], mediafinal[30], *unit,
- media[30], exc[256], maior[256], menor[256], data[30], *limit,
- firstcall[30], lastcall[30], ultima[60], d1[256], d2[256],
- days[256], cost[30], *moedac, *precision, senha1[256],
- senha2[256], teste3[256], a, status[30], dia[20], sem[256],
- login[20], online[20], fone[30], htmlfile[256],
- *regemail, *regnumber, *regname, *regorg, *regcountry,
- senhatmp[256], *regnumber2, *htmldirectory, *browser;
- int totcal = 0, totout = 0, queda = 0, logoutgood = 0, excc = 0,
- diferenca = 0, registro = 0, htm = 1, x = 0, gerahtml = 0,
- salvahtml = 0, checkglobal = 0, global = 0;
- long moeda = 0;
- FILE *html, *entrada;
-
- LimpaJanelaDesseMes();
-
- totcal = LinhasArquivo("t:Freedom.inTmp");
- if(totcal <= 0)
- {
- remove("t:freedom.intmp");
- remove("t:freedom.outtmp");
- remove("t:freedom.date");
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, FALSE);
- set(App->JanelaDesseMes, MUIA_Window_Open, FALSE);
- /* NO CONNECTIONS REGISTERED ABOUT THIS DATE */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg24));
- return NULL;
- }
-
- /* LE INFORMACOES SOBRE O HTML */
- get(App->HtmlName, MUIA_String_Contents, &htmldirectory);
- get(App->Browser, MUIA_String_Contents, &browser);
- get(App->HtmlCheck, MUIA_Selected, &gerahtml);
- get(App->CheckReports, MUIA_Selected, &salvahtml);
- get(App->CheckGlobalHtml, MUIA_Selected, &checkglobal);
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- /* PEGA INFORMACOES DA MOEDA CORRENTE */
- get(App->ComboMoeda, MUIA_Cycle_Active, &moeda);
- get(App->NomeMoeda, MUIA_String_Contents, &moedac);
-
- /* PEGA A PRECISAO DOS DISPLAYS DE VALORES */
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
- /* PEGA UNIDADE DE DESCONTO */
- get(App->ConfUnit, MUIA_String_Contents, &unit);
-
- set(App->GaugeQuery, MUIA_Gauge_Current, 55);
- /* LOADING QUERY INFORMATION... */
- set(App->GaugeQuery, MUIA_Gauge_InfoText, TMsg(App->Msg25));
-
- get(App->InputLimitTime, MUIA_String_Contents, &limit);
- totout = LinhasArquivo("t:Freedom.outTmp");
- queda = ContaVezesCampo("t:Freedom.inTmp", "Pas", ',', 5);
- logoutgood = ContaVezesCampo("t:Freedom.inTmp", "Act", ',', 5);
- strcpy(data, DataHora(1));
- set(App->GaugeQuery, MUIA_Gauge_Current, 65);
-
- strcpy(media, MediaCampo("t:Freedom.inTmp", ',', 6));
- strcpy(cost, MediaCampo("t:Freedom.inTmp", ',', 8));
- strcpy(mediafinal, SegundoHora(Corta(media, ':', 1)));
- strcpy(horason, SegundoHora(Corta(media, ':', 0)));
-
- sprintf(days, "%f", (atof(HoraSegundo(horason)) / 86400));
- strcpy(ultima, PrimeiroUltimoCampo("t:freedom.inTmp", ',', 1, ':'));
- /* ROTINA QUE ACERTA O CABECALHO DA GERACAO, O PERIODO */
- strcpy(teste, LeRegistroDB("t:Freedom.Date", "date"));
- strcpy(d1, Corta(ultima, ':', 0));
- strcpy(d2, Corta(ultima, ':', 1));
- sprintf(teste2, "\033c\0338%s [%s] %s", d1, teste, d2);
-
- /* TESTA SE DEVE SER GERADO O HTML PARA GLOBAL STATISTICS */
- if(checkglobal == FALSE && gerahtml == TRUE)
- {
- if(!strcmp(teste, "Global Statistics")) {
- set(App->BotaoHtml, MUIA_Disabled, TRUE);
- global = 1;
- } else {
- set(App->BotaoHtml, MUIA_Disabled, FALSE);
- global = 0; }
- }
-
- set(App->LabelMesUso, MUIA_Text_Contents, teste2);
- set(App->GaugeQuery, MUIA_Gauge_Current, 85);
-
-
- /* INICIALIZA GERACAO DO HTML */
- sprintf(htmlfile, "%s%s-%s.html", FiltraDir(htmldirectory, 1), d1, d2);
- if(gerahtml == TRUE && global == 0)
- {
- if(!(html = fopen("T:Freedom.HTML", "w")))
- htm = 1;
- else
- htm = 0;
- }
- if(htm == 0)
- {
- fprintf(html, "<HTML>\n<HEAD><TITLE>Freedom Statistics %s [%s] %s</TITLE></HEAD>\n<BODY BGCOLOR=#F8FCDC>\n",d1, teste, d2);
- fprintf(html, "<H2>\n<CENTER><B>%s [%s] %s</B></CENTER>\n</H2>\n<BR><CENTER>\n<TABLE BORDER BGCOLOR=#FFFFFF>\n", d1, teste, d2);
- }
-
- diferenca = DiferencaMes(d1, d2);
- if(diferenca > 0)
- sprintf(exc, "%d:00:00", (atoi(limit) * diferenca));
- else
- sprintf(exc, "%s:00:00", limit);
-
- strcpy(teste, HoraSegundo(exc));
- strcpy(teste2, HoraSegundo(horason));
-
- excc = (atoi(teste2) - atoi(teste));
- if(excc <= 0)
- {
- excc = excc * (-1);
- sprintf(exc, "%d", excc);
- strcpy(exc, SegundoHora(exc));
- /* TIME REMAINING */
- sprintf(teste, "%s \0338%s\033n", TMsg(App->Msg2), exc);
- set(App->LabelMesExedentes, MUIA_Text_Contents, teste);
- } else {
- sprintf(exc, "%d", excc);
- strcpy(exc, SegundoHora(exc));
- /* TIME EXCEDED */
- sprintf(teste, "%s \0338%s\033n", TMsg(App->Msg3), exc);
- set(App->LabelMesExedentes, MUIA_Text_Contents, teste);
- }
- /* GRAVA O TIME REMAINING OU TIME EXCEDED EM HTML */
- if(htm == 0)
- fprintf(html, "<TR BGCOLOR=#00FFFF>\n<TD><B>%s</B></TD></TR>\n<TR><TD>%s</TD></TR>\n</TABLE>\n", TMsg(App->Msg2), exc);
-
- strcpy(maior, MaiorMenorCampo("t:Freedom.inTmp", ',', 6, 1));
- strcpy(menor, MaiorMenorCampo("t:Freedom.inTmp", ',', 6, 0));
- set(App->GaugeQuery, MUIA_Gauge_Current, 95);
-
- /* GRAVA CABECALHO DO COST ONLINE, AVERAGE, TOTAL */
- if(htm == 0)
- fprintf(html, "<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF><TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD></TR>\n", TMsg(App->Msg75), TMsg(App->Msg76), TMsg(App->Msg1));
-
- /* COST ONLINE */
- strcpy(teste2, Corta(cost, ':', 0));
- sprintf(teste2, "%f", (atof(teste2) - atof(unit)));
- if(moeda == 0)
- {
- sprintf(teste, "%s \033b%s%s\033n", TMsg(App->Msg75), moedac, CasasAposCaracter(teste2, '.', atoi(precision)));
- if(htm == 0)
- fprintf(html, "<TR><TD>%s%s</TD>\n", moedac, CasasAposCaracter(teste2, '.', atoi(precision)));
- } else {
- sprintf(teste, "%s \033b%s%s\033n", TMsg(App->Msg75), CasasAposCaracter(teste2, '.', atoi(precision)), moedac);
- if(htm == 0)
- fprintf(html, "<TR><TD>%s%s</TD>\n", CasasAposCaracter(teste2, '.', atoi(precision)), moedac);
- }
- if(registro < 2)
- sprintf(teste, "%s \033bREALREG\033n", TMsg(App->Msg75));
- set(App->LabelCost, MUIA_Text_Contents, teste);
-
- /* AVERAGE COST */
- if(moeda == 0)
- {
- sprintf(teste, "%s \033b%s%s\033n", TMsg(App->Msg76), moedac, CasasAposCaracter(Corta(cost, ':', 1), '.', atoi(precision)));
- if(htm == 0)
- fprintf(html, "<TD>%s%s</TD>\n", moedac, CasasAposCaracter(Corta(cost, ':', 1), '.', atoi(precision)));
- } else {
- sprintf(teste, "%s \033b%s%s\033n", TMsg(App->Msg76), CasasAposCaracter(Corta(cost, ':', 1), '.', atoi(precision)), moedac);
- if(htm == 0)
- fprintf(html, "<TD>%s%s</TD>\n", CasasAposCaracter(Corta(cost, ':', 1), '.', atoi(precision)), moedac);
- }
- if(registro < 2)
- sprintf(teste, "%s \033bREALREG\033n", TMsg(App->Msg76));
- set(App->LabelCostAverage, MUIA_Text_Contents, teste);
-
- /* TOTAL CALLS */
- sprintf(teste, "%s \033b%d\033n", TMsg(App->Msg1), totcal);
- if(htm == 0)
- fprintf(html, "<TD>%d</TD></TR>\n</TABLE>\n", totcal);
-
- /* GRAVA CABECALHO DAS IRREGULAR, REGULAR E SHUTDOWN */
- if(htm == 0)
- fprintf(html, "<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF><TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n</TR>\n", TMsg(App->Msg4), TMsg(App->Msg5), TMsg(App->Msg6));
-
- set(App->LabelMesNumero, MUIA_Text_Contents, teste);
- /* IRREGULAR LOGOUTS */
- sprintf(teste, "%s \033b%d\033n", TMsg(App->Msg4), queda);
- set(App->NrQuedaLinhaMes, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TR>\n<TD>%d</TD>\n", queda);
-
- /* REGULAR LOGOUTS */
- sprintf(teste, "%s \033b%d\033n", TMsg(App->Msg5), logoutgood);
- set(App->NrLogoutGoodMes, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%d</TD>\n", logoutgood);
-
- /* SHUTDOWN ONLINE */
- sprintf(teste, "%s \033b%d\033n", TMsg(App->Msg6), totout);
- set(App->NrDownResetMes, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%d</TD></TR>\n</TABLE>\n", totout);
-
- /* GRAVA CABECALHO TOTAL ONLINE, DAYS, AVERAGE ONLINE */
- if(htm == 0)
- fprintf(html, "<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#5F9F9F><TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n</TR>\n", TMsg(App->Msg7), TMsg(App->Msg95), TMsg(App->Msg9));
-
- /* TOTAL ONLINE & DAYS */
- sprintf(teste, "%s \0338%s\033n (%s %s)", TMsg(App->Msg7), horason, CasasAposCaracter(days, '.', 1), TMsg(App->Msg8));
- set(App->LabelMesUsadas, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n<TD>%s</TD>\n", horason, CasasAposCaracter(days, '.', 1));
-
- /* AVERAGE ONLINE */
- sprintf(teste, "%s \033b%s\033n", TMsg(App->Msg9), mediafinal);
- set(App->LabelMesMedia, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n</TR>\n</TABLE>\n", mediafinal);
-
- /* GRAVA CABECALHO LONGEST DATE, PHONE, CALL */
- if(htm == 0)
- fprintf(html, "<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF><TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n</TR>\n", TMsg(App->Msg11), TMsg(App->Msg10), TMsg(App->Msg96));
-
- /* LONGEST DATE */
- sprintf(teste, "%s \033b%s\033n", TMsg(App->Msg11), Corta(maior, ',', 1));
- set(App->LabelMesData, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n", Corta(maior, ',', 1));
-
- /* LONGEST CALL */
- strcpy(teste2, Corta(maior, ',', 0));
- sprintf(teste, "%s \0338%s\033n (%s)", TMsg(App->Msg10), SegundoHora(Corta(maior, ',', 6)), teste2);
- set(App->LabelMesMaior, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n<TD>%s</TD>\n</TR>\n</TABLE>\n", SegundoHora(Corta(maior, ',', 6)), teste2);
-
- /* GRAVA CABECALHO SHORTEST DATE, PHONE, CALL */
- if(htm == 0)
- fprintf(html, "<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF><TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n</TR>\n", TMsg(App->Msg12), TMsg(App->Msg13), TMsg(App->Msg96));
-
- /* SHORTEST DATE */
- sprintf(teste, "%s \033b%s\033n", TMsg(App->Msg12), Corta(menor, ',', 1));
- set(App->LabelMesLow, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n", Corta(menor, ',', 1));
-
- /* SHORTEST CALL */
- strcpy(teste2, Corta(menor, ',', 0));
- sprintf(teste, "%s \033b%s\033n (%s)", TMsg(App->Msg13), SegundoHora(Corta(menor, ',', 6)), teste2);
- set(App->LabelMesMenor, MUIA_Text_Contents, teste);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n<TD>%s</TD>\n</TR>\n</TABLE>\n", SegundoHora(Corta(menor, ',', 6)), teste2);
-
- strcpy(teste2, PrimeiroUltimoCampo("t:Freedom.InTmp", ',', 6, '@'));
- strcpy(teste, SegundoHora(Corta(teste2, '@', 1)));
-
- /* GRAVA CABECALHO FIRST CALL, LAST CALL */
- if(htm == 0)
- fprintf(html, "<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n</TR>\n", TMsg(App->Msg14), TMsg(App->Msg15));
-
- /* LAST CALL */
- sprintf(lastcall, "%s \033b%s\033n", TMsg(App->Msg14), teste);
- set(App->LabelUltimaLigacao, MUIA_Text_Contents, lastcall);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n", teste);
- strcpy(teste, SegundoHora(Corta(teste2, '@', 0)));
-
- /* FIRST CALL */
- sprintf(firstcall, "%s \033b%s\033n", TMsg(App->Msg15), teste);
- set(App->LabelPrimeiraLigacao, MUIA_Text_Contents, firstcall);
- if(htm == 0)
- fprintf(html, "<TD>%s</TD>\n</TR>\n</TABLE>\n<BR><HR>\n", teste);
- set(App->GaugeQuery, MUIA_Gauge_Current, 100);
-
- /* GERA HTML BASEADO NOS DADOS SEMANAIS */
- if(htm == 0)
- {
- fprintf(html, "<H2><B>%s</B></H2>\n<BR>\n<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF>\n<TD></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%</B></TD>\n<TD><B>%s</B></TD>\n</TR>\n", TMsg(App->Msg98), TMsg(App->Msg97), TMsg(App->Msg92), TMsg(App->Msg93));
-
- /* GRAVA SEGUNDA */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "2"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 3), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD><B>%s</B></TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD><DIV ALIGN=RIGHT>%s</DIV></TD>\n", TMsg(App->MsgSegunda), Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 2)), CasasAposCaracter(Corta(teste, '@', 1), '.', 1), teste3);
-
- /* GRAVA TERCA */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "3"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 3), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD><B>%s</B></TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD><DIV ALIGN=RIGHT>%s</DIV></TD>\n", TMsg(App->MsgTerca), Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 2)), CasasAposCaracter(Corta(teste, '@', 1), '.', 1), teste3);
-
-
- /* GRAVA QUARTA */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "4"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 3), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD><B>%s</B></TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD><DIV ALIGN=RIGHT>%s</DIV></TD>\n", TMsg(App->MsgQuarta), Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 2)), CasasAposCaracter(Corta(teste, '@', 1), '.', 1), teste3);
-
- /* GRAVA QUINTA */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "5"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 3), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD><B>%s</B></TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD>%s</TD><TD><DIV ALIGN=RIGHT>%s</DIV></TD>\n", TMsg(App->MsgQuinta), Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 2)), CasasAposCaracter(Corta(teste, '@', 1), '.', 1), teste3);
-
- /* GRAVA SEXTA */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "6"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 3), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD><B>%s</B></TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD><DIV ALIGN=RIGHT>%s</DIV></TD>\n", TMsg(App->MsgSexta), Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 2)), CasasAposCaracter(Corta(teste, '@', 1), '.', 1), teste3);
-
- /* GRAVA SABADO */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "0"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 3), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD><B>%s</B></TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD><DIV ALIGN=RIGHT>%s</DIV></TD>\n", TMsg(App->MsgSabado), Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 2)), CasasAposCaracter(Corta(teste, '@', 1), '.', 1), teste3);
-
- /* GRAVA DOMINGO */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "1"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 3), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD><B>%s</B></TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD>%s</TD>\n<TD><DIV ALIGN=RIGHT>%s</DIV></TD>\n", TMsg(App->MsgDomingo), Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 2)), CasasAposCaracter(Corta(teste, '@', 1), '.', 1), teste3);
-
- /* GRAVA TOTAL */
- strcpy(teste, LeRegistroDB("T:Freedom.Week", "7"));
- strcpy(teste2, CasasAposCaracter(Corta(teste, '@', 2), '.', atoi(precision)));
- if(moeda == 0) { sprintf(teste3, "%s%s", moedac, teste2); } else { sprintf(teste3, "%s%s", teste2, moedac); }
- if(registro < 2)
- strcpy(teste3, "REALREG");
- fprintf(html, "<TR>\n<TD></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>100</B></TD>\n<TD><B><DIV ALIGN=RIGHT>%s</DIV></B></TD>\n</TR>\n</TABLE>\n", Corta(teste, '@', 0), SegundoHora(Corta(teste, '@', 1)), teste3);
- }
- /* GERA HTML BASEADO NOS CPS */
- if(htm == 0)
- {
- fprintf(html, "<BR><HR>\n<B><H2>%s</B></H2><BR>\n<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF>\n<TD></TD>\n<TD><B>%s</B></TD>\n</TR>\n", TMsg(App->Msg99), TMsg(App->Msg97));
-
- /* 300 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "300"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>300</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 2400 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "2400"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>2400</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 9600 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "9600"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>9600</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 14400 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "14400"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>14400</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 16800 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "16800"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>16800</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 19200 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "19200"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>19200</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 21600 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "21600"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>21600</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 24000 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "24000"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>24000</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 26400 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "26400"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>26400</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 28800 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "28800"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>28800</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 30666 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "30666"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>30666</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 31200 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "31200"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>31200</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 31250 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "31250"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>31250</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 32000 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "32000"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>32000</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 33333 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "33333"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>33333</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 34666 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "34666"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>34666</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 33600 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "33600"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>33600</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 38400 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "38400"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>38400</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 45333 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "45333"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>45333</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 46666 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "46666"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>46666</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 48000 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "48000"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>48000</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 49333 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "49333"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>49333</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 50666 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "50666"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>50666</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 52000 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "52000"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>52000</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 53333 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "53333"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>53333</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 54666 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "54666"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>54666</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 57600 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "57600"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>57600</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 64000 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "64000"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>64000</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 76800 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "76800"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>76800</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 115200 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "115200"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>115200</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- /* 230400 CPS */
- x = atoi(LeRegistroDB("T:Freedom.Rates", "230400"));
- if(x > 0)
- fprintf(html, "<TR>\n<TD><B>230400</B></TD>\n<TD><DIV ALIGN=RIGHT>%d</DIV></TD>\n</TR>\n", x);
-
- fprintf(html, "</TABLE>\n");
- }
-
- /* GERA HTML DAS LIGACOES ANALITICAMENTE */
- if(htm == 0)
- {
- if(entrada = fopen("T:Freedom.InTmp", "r"))
- {
- fprintf(html, "<BR><HR>\n<B><H2>%s</B></H2><BR>\n<TABLE BORDER BGCOLOR=#FFFFFF>\n<TR BGCOLOR=#00FFFF>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD>\n<TD><B>%s</B></TD></TR>\n", TMsg(App->Msg104), TMsg(App->Msg100), TMsg(App->Msg101), TMsg(App->Msg92), TMsg(App->Msg102), TMsg(App->Msg93), TMsg(App->Msg103));
- x = 0;
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if(a == '\n')
- {
- teste[--x] = '\0';
-
- if(!(strcmp(Corta(teste, ',', 5), "Act"))) {
- /* REGULAR */
- strcpy(status, TMsg(App->Msg54));
- } else {
- /* IRREGULAR */
- strcpy(status, TMsg(App->Msg55)); }
-
- strcpy(dia, Corta(teste, ',', 1));
- strcpy(sem, DiaSemanaFREE(dia, 1));
- strcpy(login, Corta(teste, ',', 2));
- strcpy(online, Corta(teste, ',', 6));
- strcpy(fone, Corta(teste, ',', 0));
-
- /* LE O VALOR DA LIGACAO */
- strcpy(cost, Corta(teste, ',', 8));
- strcpy(teste2, CasasAposCaracter(cost, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, teste2);
- else
- sprintf(cost, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(cost, "REALREG");
-
- strcpy(login, SegundoHora(login));
- strcpy(online, SegundoHora(online));
-
- /* GRAVA CONECCOES NO HTML */
- fprintf(html, "<TR>\n<TD><B>%s</B></TD><TD>%s</TD><TD><B>%s</B></TD><TD>%s</TD><TD><B>%s</B></TD><TD>%s (%s)</TD>\n</TR>\n", dia, login, online, fone, cost, status, sem);
- teste[0] = '\0'; x = 0;
- }
- }
- fclose(entrada);
- }
- }
-
- /* FINALIZA O HTML */
- if(htm == 0)
- {
- fprintf(html, "</TABLE>\n</BODY>\n</HTML>\n");
- fclose(html);
-
- /* VERIFICA OPCAO DE SALVAR HTML NA BASE DE DADOS */
- if(salvahtml == TRUE)
- CopiaArquivo("T:Freedom.HTML", htmlfile);
- }
- remove("t:freedom.outtmp");
-
- /* FECHA A JANELA DE DISPLAY DE GERACAO */
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, FALSE);
- /* ABRE A JANELA COM AS ESTATISTICAS */
- set(App->JanelaDesseMes, MUIA_Window_Open, TRUE);
- return NULL;
- }
-
- APTR SalvaConfiguracao( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE SALVA A CONFIGURACAO DO FREEDOM CALL */
- char *path, *limit, *regname, *regcity, *unit,
- *regcountry, *regorganiz, *regemail, *regnumber, *regnumberreal,
- *freeinicio, *freefim, *diainicio, *database, *precision,
- *phoneignore, *categorydir, *categorydefault, *pricedefault,
- *providerbill, *extrahour, *excededtime, *excededyear,
- *htmlname, *browser;
- long warning = 0, startup = 0, phonecheck = 0, menu = 0,
- returnmonth = 0, htmlcheck = 0, checkreports = 0,
- checkglobalhtml = 0;
-
- FILE *saida;
- if(!(saida = fopen("Freedom:Freedom.Config", "w")))
- {
- fclose(saida);
- /* PROBLEMA NO ACESSO AO FREEDOM:FREEDOM.CONFIG */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg31));
- return NULL;
- }
-
- get(App->RequestMiamiLog, MUIA_String_Contents, &path);
- get(App->InputLimitTime, MUIA_String_Contents, &limit);
- get(App->LabelVisualGeneration, MUIA_Selected, &warning);
- get(App->LabelGenerationStartup, MUIA_Selected, &startup);
- get(App->ProviderRetornaMes, MUIA_Selected, &returnmonth);
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®organiz);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®numberreal);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterCity, MUIA_String_Contents, ®city);
- get(App->PrefsFreeHInicio, MUIA_String_Contents, &freeinicio);
- get(App->PrefsFreeHFim, MUIA_String_Contents, &freefim);
- get(App->PrefsDiaInicial, MUIA_String_Contents, &diainicio);
- get(App->DataBaseName, MUIA_String_Contents, &database);
- get(App->GrupoFoneInput, MUIA_String_Contents, &phoneignore);
- get(App->GrupoFoneInputCheck, MUIA_Selected, &phonecheck);
- get(App->PrefsComboMenu, MUIA_Cycle_Active, &menu);
- get(App->TextDefault, MUIA_Text_Contents, &categorydefault);
- get(App->CategValorDefault, MUIA_String_Contents, &pricedefault);
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
- get(App->HoraExtra, MUIA_String_Contents, &extrahour);
- get(App->ContaProvedor, MUIA_String_Contents, &providerbill);
- get(App->ConfUnit, MUIA_String_Contents, &unit);
- get(App->ExcededTime, MUIA_String_Contents, &excededtime);
- get(App->ExcededYear, MUIA_String_Contents, &excededyear);
- get(App->HtmlCheck, MUIA_Selected, &htmlcheck);
- get(App->HtmlName, MUIA_String_Contents, &htmlname);
- get(App->Browser, MUIA_String_Contents, &browser);
- get(App->CheckReports, MUIA_Selected, &checkreports);
- get(App->CheckGlobalHtml, MUIA_Selected, &checkglobalhtml);
-
- fprintf(saida, "**>path:%s\n", path);
- fprintf(saida, "**>limit:%s\n", limit);
- fprintf(saida, "**>warning:%d\n", warning);
- fprintf(saida, "**>startup:%d\n", startup);
- fprintf(saida, "**>regname:%s\n", regname);
- fprintf(saida, "**>regorganiz:%s\n", regorganiz);
- fprintf(saida, "**>regemail:%s\n", regemail);
- fprintf(saida, "**>regnumber:%s\n", regnumber);
- fprintf(saida, "**>regcountry:%s\n", regcountry);
- fprintf(saida, "**>regcity:%s\n", regcity);
- fprintf(saida, "**>freeinit:%s\n", freeinicio);
- fprintf(saida, "**>freeend:%s\n", freefim);
- fprintf(saida, "**>dayinit:%s\n", diainicio);
- fprintf(saida, "**>databasename:%s\n", database);
- fprintf(saida, "**>phoneignore:%s\n", phoneignore);
- fprintf(saida, "**>phonecheck:%d\n", phonecheck);
- fprintf(saida, "**>menu:%d\n", menu);
- fprintf(saida, "**>categorydefault:%s\n", categorydefault);
- fprintf(saida, "**>pricedefault:%s\n", pricedefault);
- fprintf(saida, "**>categorydir:%s\n", categorydir);
- fprintf(saida, "**>returnmonth:%d\n", returnmonth);
- fprintf(saida, "**>precision:%s\n", precision);
- fprintf(saida, "**>regnumberreal:%s\n", regnumberreal);
- fprintf(saida, "**>extrahour:%s\n", extrahour);
- fprintf(saida, "**>providerbill:%s\n", providerbill);
- fprintf(saida, "**>unitdiscount:%s\n", unit);
- fprintf(saida, "**>excededtime:%s\n", excededtime);
- fprintf(saida, "**>excededyear:%s\n", excededyear);
- fprintf(saida, "**>htmlcheck:%d\n", htmlcheck);
- fprintf(saida, "**>htmlname:%s\n", htmlname);
- fprintf(saida, "**>browser:%s\n", browser);
- fprintf(saida, "**>checkreports:%d\n", checkreports);
- fprintf(saida, "**>checkglobalhtml:%d\n", checkglobalhtml);
-
- fclose(saida);
- return NULL;
- }
-
- APTR CarregaConfiguracao( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA DE CARREGAMENTO DA CONFIGURACAO, AS INFORMACOES SAO LIDAS
- DO FREEDOM.CONFIG E LARGADA NOS FORMS DE CONFIGURACAO DE ONDE SERAO
- LIDAS PELO PROGRAMA */
- char teste[256], *database, a, regnumberreal[500], unit[10],
- path[256], limit[10], warning[2], startup[2], regname[256],
- regorganiz[256], regemail[256], regnumber[500], regcountry[256],
- regcity[256], freeinit[15], freeend[15], dayinit[15],
- databasename[256], phoneignore[256], phonecheck[2], menu[2],
- categorydefault[256], pricedefault[10], categorydir[256],
- returnmonth[2], precision[10], extrahour[10], providerbill[10],
- excededtime[30], excededyear[30], htmlcheck[2], htmlname[256],
- browser[256], checkreports[2], checkglobalhtml[2];
-
- int x = 0, y = 0;
- FILE *entrada;
-
- /* ZERA VARIAVEIS */
- path[0] = '\0';
- limit[0] = '\0';
- warning[0] = '\0';
- startup[0] = '\0';
- regname[0] = '\0';
- regorganiz[0] = '\0';
- regemail[0] = '\0';
- regnumber[0] = '\0';
- regcountry[0] = '\0';
- regcity[0] = '\0';
- freeinit[0] = '\0';
- freeend[0] = '\0';
- dayinit[0] = '\0';
- databasename[0] = '\0';
- phoneignore[0] = '\0';
- phonecheck[0] = '\0';
- menu[0] = '\0';
- categorydefault[0] = '\0';
- pricedefault[0] = '\0';
- categorydir[0] = '\0';
- returnmonth[0] = '\0';
- precision[0] = '\0';
- regnumberreal[0] = '\0';
- extrahour[0] = '\0';
- providerbill[0] = '\0';
- unit[0] = '\0';
- excededtime[0] = '\0';
- excededyear[0] = '\0';
- htmlcheck[0] = '\0';
- htmlname[0] = '\0';
- browser[0] = '\0';
- checkreports[0] = '\0';
- checkglobalhtml[0] = '\0';
-
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!(ExisteDiretorio("Freedom:")))
- {
- /* FREEDOM NEEDS ASSIGN */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg28));
- DoMethod(App->App, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
- }
- /* ROTINA PARA CARREGAR A CONFIGURACAO */
- if(!(entrada = fopen("Freedom:Freedom.Config", "r")))
- return NULL;
-
- x = 0; y = 0;
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if(a == '\n')
- {
- teste[--x] = '\0'; y++;
- switch(y)
- {
- case 1: strcpy(path, AposCaracter(teste, ':', 1)); break;
- case 2: strcpy(limit, AposCaracter(teste, ':', 1)); break;
- case 3: strcpy(warning, AposCaracter(teste, ':', 1)); break;
- case 4: strcpy(startup, AposCaracter(teste, ':', 1)); break;
- case 5: strcpy(regname, AposCaracter(teste, ':', 1)); break;
- case 6: strcpy(regorganiz, AposCaracter(teste, ':', 1)); break;
- case 7: strcpy(regemail, AposCaracter(teste, ':', 1)); break;
- case 8: strcpy(regnumber, AposCaracter(teste, ':', 1)); break;
- case 9: strcpy(regcountry, AposCaracter(teste, ':', 1)); break;
- case 10: strcpy(regcity, AposCaracter(teste, ':', 1)); break;
- case 11: strcpy(freeinit, AposCaracter(teste, ':', 1)); break;
- case 12: strcpy(freeend, AposCaracter(teste, ':', 1)); break;
- case 13: strcpy(dayinit, AposCaracter(teste, ':', 1)); break;
- case 14: strcpy(databasename, AposCaracter(teste, ':', 1)); break;
- case 15: strcpy(phoneignore, AposCaracter(teste, ':', 1)); break;
- case 16: strcpy(phonecheck, AposCaracter(teste, ':', 1)); break;
- case 17: strcpy(menu, AposCaracter(teste, ':', 1)); break;
- case 18: strcpy(categorydefault, AposCaracter(teste, ':', 1)); break;
- case 19: strcpy(pricedefault, AposCaracter(teste, ':', 1)); break;
- case 20: strcpy(categorydir, AposCaracter(teste, ':', 1)); break;
- case 21: strcpy(returnmonth, AposCaracter(teste, ':', 1)); break;
- case 22: strcpy(precision, AposCaracter(teste, ':', 1)); break;
- case 23: strcpy(regnumberreal, AposCaracter(teste, ':', 1)); break;
- case 24: strcpy(extrahour, AposCaracter(teste, ':', 1)); break;
- case 25: strcpy(providerbill, AposCaracter(teste, ':', 1)); break;
- case 26: strcpy(unit, AposCaracter(teste, ':', 1)); break;
- case 27: strcpy(excededtime, AposCaracter(teste, ':', 1)); break;
- case 28: strcpy(excededyear, AposCaracter(teste, ':', 1)); break;
- case 29: strcpy(htmlcheck, AposCaracter(teste, ':', 1)); break;
- case 30: strcpy(htmlname, AposCaracter(teste, ':', 1)); break;
- case 31: strcpy(browser, AposCaracter(teste, ':', 1)); break;
- case 32: strcpy(checkreports, AposCaracter(teste, ':', 1)); break;
- case 33: strcpy(checkglobalhtml, AposCaracter(teste, ':', 1)); break;
- }
- teste[0] = '\0'; x = 0;
- }
- }
- fclose(entrada);
-
- set(App->RequestMiamiLog, MUIA_String_Contents, path);
- set(App->InputLimitTime, MUIA_String_Contents, limit);
-
- /* CARREGA CAMPOS NUMERICOS DE CHECK BOX */
- if(atoi(warning) == 1)
- set(App->LabelVisualGeneration, MUIA_Selected, TRUE);
- else
- set(App->LabelVisualGeneration, MUIA_Selected, FALSE);
- if(atoi(startup) == 1)
- set(App->LabelGenerationStartup, MUIA_Selected, TRUE);
- else
- set(App->LabelGenerationStartup, MUIA_Selected, FALSE);
- if(atoi(phonecheck) == 1)
- set(App->GrupoFoneInputCheck, MUIA_Selected, TRUE);
- else
- set(App->GrupoFoneInputCheck, MUIA_Selected, FALSE);
- if(atoi(returnmonth) == 1)
- set(App->ProviderRetornaMes, MUIA_Selected, TRUE);
- else
- set(App->ProviderRetornaMes, MUIA_Selected, FALSE);
- if(atoi(htmlcheck) == 1)
- set(App->HtmlCheck, MUIA_Selected, TRUE);
- else
- set(App->HtmlCheck, MUIA_Selected, FALSE);
- if(atoi(checkreports) == 1)
- set(App->CheckReports, MUIA_Selected, TRUE);
- else
- set(App->CheckReports, MUIA_Selected, FALSE);
-
- if(atoi(checkglobalhtml) == 1)
- set(App->CheckGlobalHtml, MUIA_Selected, TRUE);
- else
- set(App->CheckGlobalHtml, MUIA_Selected, FALSE);
-
- set(App->HtmlName, MUIA_String_Contents, htmlname);
- set(App->Browser, MUIA_String_Contents, browser);
- set(App->ExcededTime, MUIA_String_Contents, excededtime);
- set(App->ExcededYear, MUIA_String_Contents, excededyear);
- set(App->HoraExtra, MUIA_String_Contents, extrahour);
- set(App->ContaProvedor, MUIA_String_Contents, providerbill);
- set(App->PrefsComboMenu, MUIA_Cycle_Active, atof(menu));
- set(App->RegisterName, MUIA_String_Contents, regname);
- set(App->RegisterOrganization, MUIA_String_Contents, regorganiz);
- set(App->RegisterEmail, MUIA_String_Contents, regemail);
- set(App->RegisterKey, MUIA_String_Contents, regnumber);
- set(App->RegisterKeyReal, MUIA_String_Contents, regnumberreal);
- set(App->RegisterCountry, MUIA_String_Contents, regcountry);
- set(App->RegisterCity, MUIA_String_Contents, regcity);
- set(App->GrupoFoneInput, MUIA_String_Contents, phoneignore);
- set(App->CategValorDefault, MUIA_String_Contents, pricedefault);
- set(App->TextDefault, MUIA_Text_Contents, categorydefault);
- set(App->PrefsFreeHInicio, MUIA_String_Contents, freeinit);
- set(App->PrefsFreeHFim, MUIA_String_Contents, freeend);
- set(App->PrefsDiaInicial, MUIA_String_Contents, dayinit);
- set(App->DataBaseName, MUIA_String_Contents, databasename);
- set(App->CategDiretorio, MUIA_String_Contents, categorydir);
- set(App->ConfPrecision, MUIA_String_Contents, precision);
- set(App->ConfUnit, MUIA_String_Contents, unit);
-
- /* CARREGA A CATEGORIA DEFAULT */
- CarregaListaLimites(categorydefault);
- CarregaPilhaCategorias(categorydefault);
-
- /* ACERTA VALORES DEFAULTS CASO SEJAM INVALIDOS */
- if(!(strcmp(precision, "")))
- set(App->ConfPrecision, MUIA_String_Contents, "2");
- if(!(strcmp(categorydir, "")))
- set(App->CategDiretorio, MUIA_String_Contents, "Freedom:Categories");
- if(!(strcmp(freeinit, "")))
- set(App->PrefsFreeHInicio, MUIA_String_Contents, "00:00:00");
- if(!(strcmp(freeend, "")))
- set(App->PrefsFreeHFim, MUIA_String_Contents, "00:00:00");
- if(!(strcmp(dayinit, "")))
- set(App->PrefsDiaInicial, MUIA_String_Contents, "1");
- if(!(strcmp(databasename, "")))
- set(App->DataBaseName, MUIA_String_Contents, "Freedom:FDataBase");
-
- /* VERIFICA A JANELA PRINCIPAL CERTA A ABRIR (STAND, GRAPHIC) */
- if(!strcmp(menu, "0")) {
- set(App->JanelaPrincipal, MUIA_Window_Open, FALSE);
- set(App->JanelaPrincipal2, MUIA_Window_Open, TRUE);
- } else {
- set(App->JanelaPrincipal2, MUIA_Window_Open, FALSE);
- set(App->JanelaPrincipal, MUIA_Window_Open, TRUE); }
-
- /* CARREGA A LISTA PRINCIPAL DAS CATEGORIAS */
- CarregaListaCategorias();
- return NULL;
- }
-
- APTR TestaRegistro( struct Hook *a0, APTR a2, APTR a1 )
- {
- char senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry;
- int registro = 0;
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- /* TESTA SE O PROGRAMA EH REGISTRADO OU NAO */
- if(registro == 0)
- {
- MsgRegistro();
- return NULL;
- }
- set(App->JanelaSelecionaMes, MUIA_Window_Open, TRUE);
- return NULL;
- }
-
- APTR PreparaOutroMes( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE PREPARA O ARQUIVO DE ESTATISTICAS COM OUTRO MES,
- DIA OU ATE MESMO UM DETERMINADO ANO */
- char teste[256], mesdes[5], diades[5], *dia, *mes, *ano, *select,
- mesdes2[20], *diax, *horainicio, *horafim, data1[256],
- data2[256], *database, freein[256], freeout[256], xx[10],
- arquivo1[256], arquivo2[256];
- int x = 0;
- long combo = 0, retorno = 0;
-
- LimpaJanelaDesseMes();
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
-
- /* PEGA O NUMERO DA POSICAO DO COMBO DE DIA, MES, ANO */
- get(App->ComboSelect, MUIA_Cycle_Active, &combo);
-
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, TRUE);
- set(App->GaugeQuery, MUIA_Gauge_Current, 5);
- set(App->GaugeQuery, MUIA_Gauge_InfoText, TMsg(App->Msg26));
-
- get(App->TextDia, MUIA_String_Contents, &dia);
- get(App->ComboMes, MUIA_Text_Contents, &mes);
- get(App->TextAno, MUIA_String_Contents, &ano);
- get(App->ComboSelect, MUIA_Text_Contents, &select);
- get(App->PrefsFreeHInicio, MUIA_String_Contents, &horainicio);
- get(App->PrefsFreeHFim, MUIA_String_Contents, &horafim);
- get(App->PrefsDiaInicial, MUIA_String_Contents, &diax);
- get(App->ProviderRetornaMes, MUIA_Selected, &retorno);
-
- sprintf(mesdes, Corta(mes, ' ', 0));
- sprintf(mesdes2, Corta(mes, ' ', 1));
-
- /* CARREGA VARIAVEIS DE PARA LEITURA DOS ARQUIVOS */
- sprintf(freeout, "%s/Freedom.Out", database);
-
- set(App->GaugeQuery, MUIA_Gauge_Current, 15);
- /* ACERTA ESTATISTICA POR DIA */
- if(combo == 1)
- {
- if(strlen(dia) < 2)
- sprintf(diades, "0%s", dia);
- else
- strcpy(diades, dia);
- sprintf(teste, "%s.%s.%s", diades, mesdes, ano);
- sprintf(freein, "%s/Freedom.%s.%s", database, mesdes, ano);
-
- if( ((!(strcmp(horainicio, "")) && !(strcmp(horafim, ""))) ||
- (!(strcmp(horainicio, "00:00:00")) && !(strcmp(horafim, "00:00:00")))) && (atoi(diax) <= 1) )
- {
- FiltraCampoParaArquivoFREE(teste, freein, "t:freedom.intmp", ',', 1, '.');
- FiltraCampoParaArquivoFREE(teste, freeout, "t:freedom.outtmp", ',', 1, '.');
- }
- else
- {
- SelecionaIntervaloCampo(freein, "T:Freedom.InTmp", "Ram:Freedom.Temp", teste, teste, horainicio, horafim);
- SelecionaIntervaloCampo(freeout, "T:Freedom.OutTmp", "Ram:Freedom.Temp", teste, teste, horainicio, horafim);
- }
- sprintf(teste, "%s, %s %s", diades, mesdes2, ano);
- GravaRegistroDB("t:Freedom.Date", teste, "date", "w");
- SemanaCount("t:Freedom.InTmp");
- return NULL;
- }
- set(App->GaugeQuery, MUIA_Gauge_Current, 35);
-
- /* ACERTA ESTATISTICA POR MES */
- if(combo == 0)
- {
- sprintf(teste, "%s.%s", mesdes, ano);
- sprintf(freein, "%s/Freedom.%s.%s", database, mesdes, ano);
-
- if( ((!(strcmp(horainicio, "")) && !(strcmp(horafim, ""))) ||
- (!(strcmp(horainicio, "00:00:00")) && !(strcmp(horafim, "00:00:00")))) && (atoi(diax) <= 1) )
- {
- FiltraCampoParaArquivoFREE(teste, freein, "t:freedom.intmp", ',', 1, '.');
- FiltraCampoParaArquivoFREE(teste, freeout, "t:freedom.outtmp", ',', 1, '.');
- }
- else
- {
- sprintf(data1, "%s.%s", diax, teste);
- x = atoi(diax);
- x--;
- if(x < 1)
- x = 31;
- sprintf(data2, "%d.%s", x, teste);
-
- if(atoi(diax) > 1)
- {
- strcpy(data2, ArrumaDataHora(SomaDiminuiMes(data2, 1), '.'));
- /* RETORNA UM MES CASO SEJA NECESSARIO */
- if(retorno == 1)
- {
- strcpy(data1, SomaDiminuiMes(data1, -1));
- strcpy(data2, SomaDiminuiMes(data2, -1));
- }
- /* PREPARA O ARQUIVO DE LEITURA */
- sprintf(arquivo1, "%s/Freedom.%s", database, AposCaracter(data1, '.', 1));
- sprintf(arquivo2, "%s/Freedom.%s", database, AposCaracter(data2, '.', 1));
- CopiaArquivo(arquivo1, "T:Freedom.InTmp");
- InsereArquivo(arquivo2, "T:Freedom.InTmp");
- strcpy(freein, "T:Freedom.InTmp");
- }
- SelecionaIntervaloCampo(freein, "T:Freedom.InTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- SelecionaIntervaloCampo(freeout, "T:Freedom.OutTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- }
- sprintf(teste, "%s %s", mesdes2, ano);
- GravaRegistroDB("t:Freedom.Date", teste, "date", "w");
- SemanaCount("t:Freedom.InTmp");
- return NULL;
- }
- set(App->GaugeQuery, MUIA_Gauge_Current, 35);
-
- /* ACERTA ESTATISTICA POR ANO */
- if(combo == 2)
- {
- /* PREPARA ARQUIVO ANUAL PARA CONSULTA */
- for(x = 1; x < 13; x++)
- {
- if(x < 10)
- sprintf(xx, "0%d", x);
- else
- sprintf(xx, "%d", x);
- sprintf(teste, "%s/Freedom.%s.%s", database, xx, ano);
- InsereArquivo(teste, "t:Freedom.Year");
- }
- sprintf(teste, "%s", ano);
-
- if( ((!(strcmp(horainicio, "")) && !(strcmp(horafim, ""))) ||
- (!(strcmp(horainicio, "00:00:00")) && !(strcmp(horafim, "00:00:00")))) && (atoi(diax) <= 1) )
- {
- CopiaArquivo("T:Freedom.Year", "t:Freedom.InTmp");
- FiltraCampoParaArquivoFREE(teste, freeout, "t:freedom.outtmp", ',', 1, '.');
- }
- else
- {
- sprintf(data1, "01.01.%s", teste);
- sprintf(data2, "31.12.%s", teste);
- SelecionaIntervaloCampo("t:Freedom.Year", "T:Freedom.InTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- SelecionaIntervaloCampo(freeout, "T:Freedom.OutTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- }
- set(App->GaugeQuery, MUIA_Gauge_Current, 35);
- remove("t:Freedom.Year");
- sprintf(teste, "%s", ano);
- GravaRegistroDB("t:Freedom.Date", teste, "date", "w");
- SemanaCount("t:Freedom.InTmp");
- set(App->GaugeQuery, MUIA_Gauge_Current, 50);
- return NULL;
- }
- return NULL;
- }
-
- APTR DiminuiDia( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE DIMINUI DIA NO EDIT DA SELECAO DE MES */
- char teste[100], *dia;
- get(App->TextDia, MUIA_String_Contents, &dia);
- if(atoi(dia) == 1)
- strcpy(dia, "31");
- else
- {
- sprintf(teste, "%d", (atoi(dia) - 1));
- strcpy(dia, teste);
- }
- MUI_Redraw(App->TextDia, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR AumentaDia( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE AUMENTA DIA NO EDIT DA SELECAO DE MES */
- char teste[100], *dia;
- get(App->TextDia, MUIA_String_Contents, &dia);
- if(atoi(dia) == 31)
- strcpy(dia, "1");
- else
- {
- sprintf(teste, "%d", (atoi(dia) + 1));
- strcpy(dia, teste);
- }
- MUI_Redraw(App->TextDia, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR DiminuiAno( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE DIMINUI ANO NO EDIT DA SELECAO DE MES */
- char teste[100], *ano;
- get(App->TextAno, MUIA_String_Contents, &ano);
- if(atoi(ano) == 1)
- strcpy(ano, "1");
- else
- {
- sprintf(teste, "%d", (atoi(ano) - 1));
- strcpy(ano, teste);
- }
- MUI_Redraw(App->TextAno, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR AumentaAno( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE AUMENTA ANO NO EDIT DA SELECAO DE MES */
- char teste[100], *ano;
- get(App->TextAno, MUIA_String_Contents, &ano);
- sprintf(teste, "%d", (atoi(ano) + 1));
- strcpy(ano, teste);
- MUI_Redraw(App->TextAno, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR DataAtual( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* CARREGA DATA ATUAL PARA A JANELA DE SELECAO DE MES */
- char *database, *dia, *ano, teste[256], teste2[256];
- int tmp;
- get(App->TextDia, MUIA_String_Contents, &dia);
- get(App->TextAno, MUIA_String_Contents, &ano);
- get(App->DataBaseName, MUIA_String_Contents, &database);
- strcpy(teste, DataHora(0));
-
- tmp = atoi(Corta(teste, '.', 0));
- sprintf(dia, "%d", tmp);
- tmp = atoi(Corta(teste, '.', 2));
- sprintf(ano, "%d", tmp);
- tmp = atoi(Corta(teste, '.', 1));
-
- /* ATUALIZA A SELECAO DE DIA, MES, ANO */
- tmp--;
- set(App->ComboMes, MUIA_Cycle_Active, tmp);
- set(App->ComboMes2, MUIA_Cycle_Active, tmp);
-
- set(App->TextDia, MUIA_String_Contents, dia);
- MUI_Redraw(App->TextDia, MADF_DRAWOBJECT);
-
- set(App->TextAno, MUIA_String_Contents, ano);
- MUI_Redraw(App->TextAno, MADF_DRAWOBJECT);
-
- set(App->TextAno2, MUIA_String_Contents, ano);
- MUI_Redraw(App->TextAno2, MADF_DRAWOBJECT);
-
- set(App->InputPeriodo1, MUIA_String_Contents, teste);
- set(App->InputPeriodo2, MUIA_String_Contents, teste);
- set(App->LabelInputDateLogin, MUIA_String_Contents, Corta(teste, ':', 0));
- /* CARREGA ULTIMO TELEFONE NO INPUT MANUAL */
- sprintf(teste2, "%s/Freedom.%s", database, DataHora(1));
- strcpy(teste, UltimaLinha(teste2));
- if(!strcmp(teste, "ERRO"))
- strcpy(teste, "");
- set(App->LabelInputPhone, MUIA_String_Contents, Corta(teste, ',', 0));
-
- /* CARREGA INFORMACOES DA SELECAO DE ESTATISTICA ANUAL */
- set(App->CAnualText, MUIA_String_Contents, Corta(DataHora(3), '.', 0));
- set(App->CAnualMes1, MUIA_Cycle_Active, 0);
- set(App->CAnualMes2, MUIA_Cycle_Active, 11);
-
- /* CARREGA A DATA DE HOJE NA BARRA DA JANELA GRAFICA */
- CarregaBarraStatus();
-
- return NULL;
- }
-
- APTR AcertaAbout( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ATUALIZA INFORMACOES JANELA ABOUT, SOBRE O TIPO DE REGISTRO */
- char reg[256], org[256], teste[256], senha1[256], senha2[256],
- senhatmp[256], *regnumber2,
- *regname, *regorg, *regcountry, *regemail, *regnumber;
- int registro = 0;
-
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
-
- if(!strcmp(TrimSur(regorg, 0), ""))
- sprintf(org, "(%s)", regcountry);
- else
- sprintf(org, "(%s - %s)", regcountry, regorg);
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- if(registro == 0)
- strcpy(reg, "\033bUNREGISTERED\033n\nRegister is a free e-mail!");
- if(registro == 1)
- sprintf(reg, "\033bNOPAY REGISTERED\033n\n%s\n%s", regname, org);
- if(registro == 2)
- sprintf(reg, "\033bREAL REGISTERED\033n\n%s\n%s", regname, org);
- sprintf(teste, "\033c\0338\033b\nFreedom Call\nVersion 1.12 [28.05.1999]\033n\nBy Cristian Robert Gallas\n\nAmiga Open Source (SuRRouND 99)\n\nEmail for bug reports: surround@iname.com\n [members.tripod.com/surround_br] \n\nThis version is:\n%s\n", reg);
- set(App->TextAbout, MUIA_Text_Contents, teste);
- return NULL;
- }
-
- APTR GerarImportacaoRegistro( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA DE IMPORTACAO DO ARQUIVO DE REGISTRO */
- char reg1[500], reg2[500], *path;
- get(App->DirImportaRegistro, MUIA_String_Contents, &path);
-
- if(!(ExisteArquivo(path)))
- {
- /* FILE FOR IMPORTING NOT FOUND */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg35));
- return NULL;
- }
- strcpy(reg1, LeRegistroDB(path, "KeyRegister"));
- strcpy(reg2, LeRegistroDB(path, "KeyRegisterReal"));
- if(!(strcmp(reg1, "")))
- {
- /* THIS FILE DON`T HAVE REGISTRATION */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg36));
- return NULL;
- }
- set(App->RegisterKey, MUIA_String_Contents, reg1);
- set(App->RegisterKeyReal, MUIA_String_Contents, reg2);
-
- return NULL;
- }
-
- APTR AplicacaoHide( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* MINIMIZA A APLICACAO, COLOCA ELA EM ICONIFIED */
- set(App->App, MUIA_Application_Iconified, TRUE);
- return NULL;
- }
-
- APTR HelpMain( struct Hook *a0, APTR a2, APTR a1 )
- {
- if(!(ExisteArquivo("Freedom:Docs/Freedom.Guide")))
- {
- /* FREEDOM:FREEDOM.GUIDE NOT FOUND, PLEASE COPY */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg37));
- return NULL;
- }
- DoMethod(App->App, MUIM_Application_ShowHelp, 0, "Freedom:Docs/Freedom.Guide", "Main", 1);
- return NULL;
- }
-
- APTR HelpUsage( struct Hook *a0, APTR a2, APTR a1 )
- {
- if(!(ExisteArquivo("Freedom:Docs/Freedom.Guide")))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg37));
- return NULL;
- }
- DoMethod(App->App, MUIM_Application_ShowHelp, 0, "Freedom:Docs/Freedom.Guide", "Usage", 1);
- return NULL;
- }
-
- APTR HelpHistory( struct Hook *a0, APTR a2, APTR a1 )
- {
- if(!(ExisteArquivo("Freedom:Docs/Freedom.Guide")))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg37));
- return NULL;
- }
- DoMethod(App->App, MUIM_Application_ShowHelp, 0, "Freedom:Docs/Freedom.Guide", "History", 1);
- return NULL;
- }
-
- APTR AboutMUI( struct Hook *a0, APTR a2, APTR a1 )
- {
- DoMethod(App->App, MUIM_Application_AboutMUI, App->JanelaPrincipal);
- return NULL;
- }
-
- APTR LimpaSaida( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* LIMPA ARQUIVOS TEMPORARIOS APOS A FINALIZACAO DO PROGRAMA */
- remove("t:freedom.intmp");
- remove("t:freedom.outtmp");
- remove("t:freedom.date");
- remove("t:freedom.week");
- remove("t:freedom.rates");
- remove("t:freedom.html");
- return NULL;
- }
-
- APTR CarregaSemana( struct Hook *a0, APTR a2, APTR a1 )
- {
- char dom[50], seg[50], ter[50], qua[50], qui[50], sex[50],
- sab[50], tot[50], teste[256], teste2[256], *moedac,
- *precision, senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry;
- int registro = 0;
- long moeda = 0;
-
- /* LIMPA OS REGISTROS */
- set(App->ValorDomingo, MUIA_Text_Contents, "0");
- set(App->ValorSegunda, MUIA_Text_Contents, "0");
- set(App->ValorTerca, MUIA_Text_Contents, "0");
- set(App->ValorQuarta, MUIA_Text_Contents, "0");
- set(App->ValorQuinta, MUIA_Text_Contents, "0");
- set(App->ValorSexta, MUIA_Text_Contents, "0");
- set(App->ValorSabado, MUIA_Text_Contents, "0");
- set(App->PercentualDomingo, MUIA_Text_Contents, "0");
- set(App->PercentualSegunda, MUIA_Text_Contents, "0");
- set(App->PercentualTerca, MUIA_Text_Contents, "0");
- set(App->PercentualQuarta, MUIA_Text_Contents, "0");
- set(App->PercentualQuinta, MUIA_Text_Contents, "0");
- set(App->PercentualSexta, MUIA_Text_Contents, "0");
- set(App->PercentualSabado, MUIA_Text_Contents, "0");
- set(App->ValorTotal, MUIA_Text_Contents, "0");
- set(App->PercentualTotal, MUIA_Text_Contents, "0");
- set(App->WeekLabelTop, MUIA_Text_Contents, "");
- set(App->TimeTotal, MUIA_Text_Contents, "0");
- set(App->TimeDomingo, MUIA_Text_Contents, "0");
- set(App->TimeSegunda, MUIA_Text_Contents, "0");
- set(App->TimeTerca, MUIA_Text_Contents, "0");
- set(App->TimeQuarta, MUIA_Text_Contents, "0");
- set(App->TimeQuinta, MUIA_Text_Contents, "0");
- set(App->TimeSexta, MUIA_Text_Contents, "0");
- set(App->TimeSabado, MUIA_Text_Contents, "0");
- set(App->CustoTotal, MUIA_Text_Contents, "0");
- set(App->CustoDomingo, MUIA_Text_Contents, "0");
- set(App->CustoSegunda, MUIA_Text_Contents, "0");
- set(App->CustoTerca, MUIA_Text_Contents, "0");
- set(App->CustoQuarta, MUIA_Text_Contents, "0");
- set(App->CustoQuinta, MUIA_Text_Contents, "0");
- set(App->CustoSexta, MUIA_Text_Contents, "0");
- set(App->CustoSabado, MUIA_Text_Contents, "0");
-
- /* PEGA INFORMACOES DA MOEDA CORRENTE */
- get(App->ComboMoeda, MUIA_Cycle_Active, &moeda);
- get(App->NomeMoeda, MUIA_String_Contents, &moedac);
-
- /* PEGA A PRECISAO DOS DISPLAYS DE VALORES */
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- /* DOMINGO */
- strcpy(dom, LeRegistroDB("t:Freedom.Week", "1"));
- set(App->ValorDomingo, MUIA_Text_Contents, Corta(dom, '@', 0));
- set(App->PercentualDomingo, MUIA_Text_Contents, CasasAposCaracter(Corta(dom, '@', 1), '.', 1));
- set(App->TimeDomingo, MUIA_Text_Contents, SegundoHora(Corta(dom, '@', 2)));
- strcpy(teste2, CasasAposCaracter(Corta(dom, '@', 3), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoDomingo, MUIA_Text_Contents, teste);
-
- /* SEGUNDA */
- strcpy(seg, LeRegistroDB("t:Freedom.Week", "2"));
- set(App->ValorSegunda, MUIA_Text_Contents, Corta(seg, '@', 0));
- set(App->PercentualSegunda, MUIA_Text_Contents, CasasAposCaracter(Corta(seg, '@', 1), '.', 1));
- set(App->TimeSegunda, MUIA_Text_Contents, SegundoHora(Corta(seg, '@', 2)));
- strcpy(teste2, CasasAposCaracter(Corta(seg, '@', 3), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoSegunda, MUIA_Text_Contents, teste);
-
- /* TERCA */
- strcpy(ter, LeRegistroDB("t:Freedom.Week", "3"));
- set(App->ValorTerca, MUIA_Text_Contents, Corta(ter, '@', 0));
- set(App->PercentualTerca, MUIA_Text_Contents, CasasAposCaracter(Corta(ter, '@', 1), '.', 1));
- set(App->TimeTerca, MUIA_Text_Contents, SegundoHora(Corta(ter, '@', 2)));
- strcpy(teste2, CasasAposCaracter(Corta(ter, '@', 3), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoTerca, MUIA_Text_Contents, teste);
-
- /* QUARTA */
- strcpy(qua, LeRegistroDB("t:Freedom.Week", "4"));
- set(App->ValorQuarta, MUIA_Text_Contents, Corta(qua, '@', 0));
- set(App->PercentualQuarta, MUIA_Text_Contents, CasasAposCaracter(Corta(qua, '@', 1), '.', 1));
- set(App->TimeQuarta, MUIA_Text_Contents, SegundoHora(Corta(qua, '@', 2)));
- strcpy(teste2, CasasAposCaracter(Corta(qua, '@', 3), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoQuarta, MUIA_Text_Contents, teste);
-
- /* QUINTA */
- strcpy(qui, LeRegistroDB("t:Freedom.Week", "5"));
- set(App->ValorQuinta, MUIA_Text_Contents, Corta(qui, '@', 0));
- set(App->PercentualQuinta, MUIA_Text_Contents, CasasAposCaracter(Corta(qui, '@', 1), '.', 1));
- set(App->TimeQuinta, MUIA_Text_Contents, SegundoHora(Corta(qui, '@', 2)));
- strcpy(teste2, CasasAposCaracter(Corta(qui, '@', 3), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoQuinta, MUIA_Text_Contents, teste);
-
- /* SEXTA */
- strcpy(sex, LeRegistroDB("t:Freedom.Week", "6"));
- set(App->ValorSexta, MUIA_Text_Contents, Corta(sex, '@', 0));
- set(App->PercentualSexta, MUIA_Text_Contents, CasasAposCaracter(Corta(sex, '@', 1), '.', 1));
- set(App->TimeSexta, MUIA_Text_Contents, SegundoHora(Corta(sex, '@', 2)));
- strcpy(teste2, CasasAposCaracter(Corta(sex, '@', 3), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoSexta, MUIA_Text_Contents, teste);
-
- /* SABADO */
- strcpy(sab, LeRegistroDB("t:Freedom.Week", "0"));
- set(App->ValorSabado, MUIA_Text_Contents, Corta(sab, '@', 0));
- set(App->PercentualSabado, MUIA_Text_Contents, CasasAposCaracter(Corta(sab, '@', 1), '.', 1));
- set(App->TimeSabado, MUIA_Text_Contents, SegundoHora(Corta(sab, '@', 2)));
- strcpy(teste2, CasasAposCaracter(Corta(sab, '@', 3), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoSabado, MUIA_Text_Contents, teste);
-
- /* TOTAL */
- strcpy(tot, LeRegistroDB("t:Freedom.Week", "7"));
- set(App->ValorTotal, MUIA_Text_Contents, Corta(tot, '@', 0));
- set(App->TimeTotal, MUIA_Text_Contents, SegundoHora(Corta(tot, '@', 1)));
- set(App->PercentualTotal, MUIA_Text_Contents, "100");
- strcpy(teste2, CasasAposCaracter(Corta(tot, '@', 2), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(teste, "%s%s", moedac, teste2);
- else
- sprintf(teste, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(teste, "REALREG");
- set(App->CustoTotal, MUIA_Text_Contents, teste);
-
- strcpy(teste, LeRegistroDB("t:Freedom.Date", "date"));
- sprintf(teste2, "%s", teste);
- set(App->WeekLabelTop, MUIA_Text_Contents, teste2);
- return NULL;
- }
-
- APTR CarregaUltimasCinco( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA ROTINA CARREGA OS DADOS NA JANELA DAS ULTIMAS
- CINCO LIGACOES */
- char l1[256], l2[256], l3[256], l4[256], l5[256], horaon[30], dataon[30],
- *database, teste[256], data1[256], status1[30], *precision,
- status2[30], categoria[256], *categorydir, *categoryname, campo[256],
- data[256], login[256], tempo[256], *moedac, cost[30], diferenca[256],
- senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry,
- tempoon[30], telefone[30], connect[256];
- int x = 0, registro = 0;
- long moeda = 0;
-
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- set(App->JanelaCincoLigacoes, MUIA_Window_Open, FALSE);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- /* Rotina que limpa os campos antes da atribuicao */
- set(App->FirstData, MUIA_Text_Contents, "0");
- set(App->FirstLoginTime, MUIA_Text_Contents, "0");
- set(App->FirstTimeOnline, MUIA_Text_Contents, "0");
- set(App->FirstPhone, MUIA_Text_Contents, "0");
- set(App->FirstStatus, MUIA_Text_Contents, "");
- set(App->SecondData, MUIA_Text_Contents, "0");
- set(App->SecondLoginTime, MUIA_Text_Contents, "0");
- set(App->SecondTimeOnline, MUIA_Text_Contents, "0");
- set(App->SecondPhone, MUIA_Text_Contents, "0");
- set(App->SecondStatus, MUIA_Text_Contents, "");
- set(App->ThirdData, MUIA_Text_Contents, "0");
- set(App->ThirdLoginTime, MUIA_Text_Contents, "0");
- set(App->ThirdTimeOnline, MUIA_Text_Contents, "0");
- set(App->ThirdPhone, MUIA_Text_Contents, "0");
- set(App->ThirdStatus, MUIA_Text_Contents, "");
- set(App->FourthData, MUIA_Text_Contents, "0");
- set(App->FourthLoginTime, MUIA_Text_Contents, "0");
- set(App->FourthTimeOnline, MUIA_Text_Contents, "0");
- set(App->FourthPhone, MUIA_Text_Contents, "0");
- set(App->FourthStatus, MUIA_Text_Contents, "");
- set(App->LastData, MUIA_Text_Contents, "0");
- set(App->LastLoginTime, MUIA_Text_Contents, "0");
- set(App->LastTimeOnline, MUIA_Text_Contents, "0");
- set(App->LastPhone, MUIA_Text_Contents, "0");
- set(App->LastStatus, MUIA_Text_Contents, "");
- set(App->FirstCost, MUIA_Text_Contents, "0");
- set(App->SecondCost, MUIA_Text_Contents, "0");
- set(App->ThirdCost, MUIA_Text_Contents, "0");
- set(App->FourthCost, MUIA_Text_Contents, "0");
- set(App->LastCost, MUIA_Text_Contents, "0");
- set(App->UpdateCall, MUIA_Text_Contents, "");
-
- strcpy(status1, TMsg(App->Msg54));
- strcpy(status2, TMsg(App->Msg55));
-
- strcpy(data1, DataHora(0));
- /* PREPARA O ARQUIVO A SER LIDO */
- for(x = 0; x < 25; x++)
- {
- sprintf(teste, "%s/Freedom.%s", database, AposCaracter(data1, '.', 1));
- if(ExisteArquivo(teste))
- break;
- strcpy(data1, ArrumaDataHora(SomaDiminuiMes(data1, -1), '.'));
- }
- if(x == 25)
- {
- set(App->JanelaCincoLigacoes, MUIA_Window_Open, FALSE);
- /* FREEDOM LAST CALLS NOT FOUND */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg39));
- return NULL;
- }
- sprintf(teste, "%s/Freedom.%s", database, AposCaracter(data1, '.', 1));
- FinalArquivo(teste, "t:Freedom.Five", 5);
-
- /* SO LIBERA CONSULTA SE EXISTE 5 ULTIMAS LIGACOES */
- if(LinhasArquivo("T:Freedom.Five") < 5)
- {
- remove("t:Freedom.Five");
- set(App->JanelaCincoLigacoes, MUIA_Window_Open, FALSE);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg56));
- return NULL;
- }
- /* PEGA INFORMACOES DA MOEDA CORRENTE */
- get(App->ComboMoeda, MUIA_Cycle_Active, &moeda);
- get(App->NomeMoeda, MUIA_String_Contents, &moedac);
-
- /* PEGA A PRECISAO DOS DISPLAYS DE VALORES */
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
-
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- get(App->TextDefault, MUIA_Text_Contents, &categoryname);
- sprintf(categoria, "%s/%s", categorydir, categoryname);
-
- strcpy(l1, LinhaNumero("t:Freedom.Five", 1));
- strcpy(l2, LinhaNumero("t:Freedom.Five", 2));
- strcpy(l3, LinhaNumero("t:Freedom.Five", 3));
- strcpy(l4, LinhaNumero("t:Freedom.Five", 4));
- strcpy(l5, LinhaNumero("t:Freedom.Five", 5));
-
- /* PRIMEIRA LIGACAO */
- strcpy(data, Corta(l1, ',', 1));
- strcpy(login, Corta(l1, ',', 2));
- strcpy(tempo, Corta(l1, ',', 6));
- set(App->FirstData, MUIA_Text_Contents, data);
- set(App->FirstLoginTime, MUIA_Text_Contents, SegundoHora(login));
- set(App->FirstTimeOnline, MUIA_Text_Contents, SegundoHora(tempo));
- strcpy(teste, CalculaPrecoFREE(categoria, atoi(login), atoi(Corta(l1, ',', 4)), atoi(DiaSemanaFREE(data, 2))));
- strcpy(teste, CasasAposCaracter(teste, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, teste);
- else
- sprintf(cost, "%s%s", teste, moedac);
- set(App->FirstCost, MUIA_Text_Contents, cost);
-
- set(App->FirstPhone, MUIA_Text_Contents, Corta(l1, ',', 0));
- if(!(strcmp(Corta(l1, ',', 5), "Act")))
- set(App->FirstStatus, MUIA_Text_Contents, status1);
- else
- set(App->FirstStatus, MUIA_Text_Contents, status2);
-
- /* SEGUNDA LIGACAO */
- strcpy(data, Corta(l2, ',', 1));
- strcpy(login, Corta(l2, ',', 2));
- strcpy(tempo, Corta(l2, ',', 6));
- set(App->SecondData, MUIA_Text_Contents, data);
- set(App->SecondLoginTime, MUIA_Text_Contents, SegundoHora(login));
- set(App->SecondTimeOnline, MUIA_Text_Contents, SegundoHora(tempo));
- strcpy(teste, CalculaPrecoFREE(categoria, atoi(login), atoi(Corta(l2, ',', 4)), atoi(DiaSemanaFREE(data, 2))));
- strcpy(teste, CasasAposCaracter(teste, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, teste);
- else
- sprintf(cost, "%s%s", teste, moedac);
- set(App->SecondCost, MUIA_Text_Contents, cost);
- set(App->SecondPhone, MUIA_Text_Contents, Corta(l2, ',', 0));
- if(!(strcmp(Corta(l2, ',', 5), "Act")))
- set(App->SecondStatus, MUIA_Text_Contents, status1);
- else
- set(App->SecondStatus, MUIA_Text_Contents, status2);
-
- /* TERCEIRA LIGACAO */
- strcpy(data, Corta(l3, ',', 1));
- strcpy(login, Corta(l3, ',', 2));
- strcpy(tempo, Corta(l3, ',', 6));
- set(App->ThirdData, MUIA_Text_Contents, data);
- set(App->ThirdLoginTime, MUIA_Text_Contents, SegundoHora(login));
- set(App->ThirdTimeOnline, MUIA_Text_Contents, SegundoHora(tempo));
- strcpy(teste, CalculaPrecoFREE(categoria, atoi(login), atoi(Corta(l3, ',', 4)), atoi(DiaSemanaFREE(data, 2))));
- strcpy(teste, CasasAposCaracter(teste, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, teste);
- else
- sprintf(cost, "%s%s", teste, moedac);
- set(App->ThirdCost, MUIA_Text_Contents, cost);
- set(App->ThirdPhone, MUIA_Text_Contents, Corta(l3, ',', 0));
- if(!(strcmp(Corta(l3, ',', 5), "Act")))
- set(App->ThirdStatus, MUIA_Text_Contents, status1);
- else
- set(App->ThirdStatus, MUIA_Text_Contents, status2);
-
- /* QUARTA LIGACAO */
- strcpy(data, Corta(l4, ',', 1));
- strcpy(login, Corta(l4, ',', 2));
- strcpy(tempo, Corta(l4, ',', 6));
- set(App->FourthData, MUIA_Text_Contents, data);
- set(App->FourthLoginTime, MUIA_Text_Contents, SegundoHora(login));
- set(App->FourthTimeOnline, MUIA_Text_Contents, SegundoHora(tempo));
- strcpy(teste, CalculaPrecoFREE(categoria, atoi(login), atoi(Corta(l4, ',', 4)), atoi(DiaSemanaFREE(data, 2))));
- strcpy(teste, CasasAposCaracter(teste, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, teste);
- else
- sprintf(cost, "%s%s", teste, moedac);
- set(App->FourthCost, MUIA_Text_Contents, cost);
- set(App->FourthPhone, MUIA_Text_Contents, Corta(l4, ',', 0));
- if(!(strcmp(Corta(l4, ',', 5), "Act")))
- set(App->FourthStatus, MUIA_Text_Contents, status1);
- else
- set(App->FourthStatus, MUIA_Text_Contents, status2);
-
- /* ULTIMA LIGACAO */
- strcpy(data, Corta(l5, ',', 1));
- strcpy(login, Corta(l5, ',', 2));
- strcpy(tempo, Corta(l5, ',', 6));
- set(App->LastData, MUIA_Text_Contents, data);
- set(App->LastLoginTime, MUIA_Text_Contents, SegundoHora(login));
- set(App->LastTimeOnline, MUIA_Text_Contents, SegundoHora(tempo));
- strcpy(teste, CalculaPrecoFREE(categoria, atoi(login), atoi(Corta(l5, ',', 4)), atoi(DiaSemanaFREE(data, 2))));
- strcpy(teste, CasasAposCaracter(teste, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, teste);
- else
- sprintf(cost, "%s%s", teste, moedac);
- set(App->LastCost, MUIA_Text_Contents, cost);
- set(App->LastPhone, MUIA_Text_Contents, Corta(l5, ',', 0));
- if(!(strcmp(Corta(l5, ',', 5), "Act")))
- set(App->LastStatus, MUIA_Text_Contents, status1);
- else
- set(App->LastStatus, MUIA_Text_Contents, status2);
-
- remove("t:Freedom.Five");
-
- /* ROTINA QUE CARREGA O STATUS DA LIGACAO ATUAL */
- if(!Conectado()) {
- /* NOT CONNECTED... */
- set(App->UpdateCall, MUIA_Text_Contents, TMsg(App->Msg89));
- return NULL; }
-
- if(!ExisteArquivo("S:Freedom.Miami.Temp")) {
- /* FREEEVENTMIAMI LOG NOT FOUND */
- set(App->UpdateCall, MUIA_Text_Contents, TMsg(App->Msg90));
- return NULL; }
-
- strcpy(campo, LeRegistroDB("s:Freedom.Miami.Temp", "1"));
- strcpy(horaon, Corta(campo, ',', 2));
- strcpy(dataon, Corta(campo, ',', 1));
- strcpy(telefone, Corta(campo, ',', 0));
- strcpy(connect, Corta(campo, ',', 3));
- if(!strcmp(connect, "CUTERRO"))
- strcpy(connect, "");
-
- /* CONNECT */
- sprintf(teste, "%s [\033b%s %s\033n]", TMsg(App->Msg91), dataon, SegundoHora(horaon));
- strcpy(tempoon, IntervaloHora(horaon, HoraSegundo(DataHora(5))));
-
- /* VERIFICA SE PASSOU DA MEIA NOITE A LIGACAO ATUAL */
- strcpy(diferenca, Corta(DiferencaDias(dataon, DataHora(0)), ':', 1));
- if(atoi(diferenca) > 0)
- sprintf(tempoon, "%ld", atoi(diferenca) - atoi(tempoon));
-
- /* CALCULA O CUSTO DA LIGACAO */
- strcpy(l1, CalculaPrecoFREE(categoria, atoi(horaon), atoi(HoraSegundo(DataHora(5))), atoi(DiaSemanaFREE(DataHora(0), 2))));
- strcpy(l1, CasasAposCaracter(l1, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, l1);
- else
- sprintf(cost, "%s%s", l1, moedac);
- if(registro < 2)
- strcpy(cost, "REALREG");
-
- /* ONLINE, COST */
- sprintf(teste, "%s, %s [\033b%s\033n], %s [\033b%s\033n]\n \0338[%s] %s\033n", teste, TMsg(App->Msg92), SegundoHora(tempoon), TMsg(App->Msg93), cost, telefone, connect);
- set(App->UpdateCall, MUIA_Text_Contents, teste);
- MUI_Redraw(App->UpdateCall, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR TestaRegistro2( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE TESTA SE O PROGRAMA ESTA REGISTRADO OU NAO,
- PARA CARREGAMENTO DA JANELA "MANUAL CALL INPUTATION" */
- char teste[500], nopay[20], senha[500],
- *regemail, *regnumber, *regname, *regcountry;
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
-
- sprintf(teste, "%s%s%s", regname, regemail, regcountry);
- strcpy(teste, CriptografiaSimples(teste, 0));
-
- strcpy(nopay, Corta(AsciiString(regnumber, 69), 'Ã¥', 1));
- strcpy(senha, AsciiString(regnumber, 69));
- strcpy(senha, Corta(senha, 'Ã¥', 0));
-
- if(strcmp(teste, senha) || !strcmp(regnumber, ""))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg60));
- return NULL;
- }
- set(App->JanelaDeInputManual, MUIA_Window_Open, TRUE);
- return NULL;
- }
-
- APTR SalvaNovoInput( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA FUNCAO PREPARA, CALCULA E TESTA TODOS OS DADOS PARA
- ENVIAR PARA A JANELA DE CONFIRMACAO E GRAVACAO DO INPUT
- MANUAL. */
- char *phone, *datelogin, *hourlogin, *timeonline, *select,
- hor1[3], hor2[3], min1[3], min2[3], seg1[3], seg2[3],
- dia[3], mes[3], ano[5], teste[256];
-
- /* TESTA SE O CAMPO DE TELEFONE ESTA EM BRANCO */
- get(App->LabelInputPhone, MUIA_String_Contents, &phone);
- if(!(strcmp(phone, "")))
- {
- /* PHONE NUMBER IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg40));
- return NULL;
- }
-
- get(App->LabelInputDateLogin, MUIA_String_Contents, &datelogin);
- get(App->LabelInputHourLogin, MUIA_String_Contents, &hourlogin);
- get(App->LabelInputTimeOnline, MUIA_String_Contents, &timeonline);
-
- /* SEPARA EM VARIAVEIS HORA, MINUTO, SEGUNDO, DIA, MES, ANO */
- strcpy(hor1, Copia2(hourlogin, 1, 2));
- strcpy(hor2, Copia2(timeonline, 1, 2));
- strcpy(min1, Copia2(hourlogin, 4, 2));
- strcpy(min2, Copia2(timeonline, 4, 2));
- strcpy(seg1, Copia2(hourlogin, 7, 2));
- strcpy(seg2, Copia2(timeonline, 7, 2));
- strcpy(dia, Copia2(datelogin, 1, 2));
- strcpy(mes, Copia2(datelogin, 4, 2));
- strcpy(ano, Copia2(datelogin, 7, 4));
-
- /* INICIA OS TESTES DE VALIDADE DE HORA E DATA */
- if((strlen(hourlogin) != 8) ||
- (strlen(timeonline) != 8))
- {
- /* FORMAT TIME IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg41));
- return NULL;
- }
- if((atoi(hor1) < 0 || atoi(hor1) > 23) ||
- (atoi(hor2) < 0))
- {
- /* HOUR IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg42));
- return NULL;
- }
- if((atoi(min1) < 0 || atoi(min1) > 60) ||
- (atoi(min2) < 0 || atoi(min2) > 60))
- {
- /* MINUTES IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg43));
- return NULL;
- }
- if((atoi(seg1) < 0 || atoi(seg1) > 60) ||
- (atoi(seg2) < 0 || atoi(seg2) > 60))
- {
- /* SECONDS IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg44));
- return NULL;
- }
-
- if(!TestaData(datelogin))
- {
- /* DATE IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg45));
- return NULL;
- }
- if(!(strcmp(timeonline, "00:00:00")))
- {
- /* TIME ONLINE IS NULL */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg46));
- return NULL;
- }
-
- set(App->JanelaDeInputManual, MUIA_Window_Open, FALSE);
- set(App->JanelaInputSalvaValores, MUIA_Window_Open, TRUE);
- strcpy(teste, Online(datelogin, hourlogin, timeonline));
-
- set(App->Input2Phone, MUIA_Text_Contents, phone);
- set(App->Input2DateLogin, MUIA_Text_Contents, JulianoDia(Corta(teste, '@', 0)));
- set(App->Input2DateLogout, MUIA_Text_Contents, JulianoDia(Corta(teste, '@', 1)));
- set(App->Input2TimeLogin, MUIA_Text_Contents, SegundoHora(Corta(teste, '@', 2)));
- set(App->Input2TimeLogout, MUIA_Text_Contents, SegundoHora(Corta(teste, '@', 3)));
- set(App->Input2TimeOnline, MUIA_Text_Contents, SegundoHora(Corta(teste, '@', 4)));
-
- get(App->ComboStatusInput, MUIA_Text_Contents, &select);
- set(App->Input2Status, MUIA_Text_Contents, select);
- return NULL;
- }
-
- APTR SalvaInputManual( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA FUNCAO SALVA OS DADOS DA JANELA DE INPUT MANUAL */
- char *phone, *datelogin, *datelogout, *timelogin, *timeonline,
- *select, *timelogout, status[10], h1[256], h2[256],
- h3[256], teste[256], *database, teste2[256];
- long combo;
-
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
- get(App->Input2Phone, MUIA_Text_Contents, &phone);
- get(App->Input2DateLogin, MUIA_Text_Contents, &datelogin);
- get(App->Input2DateLogout, MUIA_Text_Contents, &datelogout);
- get(App->Input2TimeLogin, MUIA_Text_Contents, &timelogin);
- get(App->Input2TimeOnline, MUIA_Text_Contents, &timeonline);
- get(App->Input2TimeLogout, MUIA_Text_Contents, &timelogout);
- get(App->ComboStatusInput, MUIA_Text_Contents, &select);
-
- /* PEGA O NUMERO DA POSICAO DO COMBO DE DIA, MES, ANO */
- get(App->ComboStatusInput, MUIA_Cycle_Active, &combo);
-
- if(combo == 0)
- strcpy(status, "Act");
- else
- strcpy(status, "Pas");
-
- strcpy(h1, HoraSegundo(timelogin));
- strcpy(h2, HoraSegundo(timelogout));
- strcpy(h3, HoraSegundo(timeonline));
-
- sprintf(teste, "%s,%s,%s,%s,%s,%s,%s,Input\n", phone, datelogin, h1, datelogout, h2, status, h3);
- sprintf(teste2, "%s/Freedom.%s", database, AposCaracter(datelogin, '.', 1));
- GravaLinha(teste2, teste, "a");
- sprintf(teste2, "%s/Freedom.Input", database);
- GravaLinha(teste2, teste, "a");
-
- /* NEW CALL ADDED IN FREEDOM DATABASE */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg47));
- return NULL;
- }
-
- APTR PreparaOutroMesTodas( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA FUNCAO PREPARA O ARQUIVO DE LEITURA PARA AS INFORMACOES
- DA JANELA ALL CALLS. PARA CONSULTAS DE ESSE E OUTRO MES. */
- char teste2[256], saida[256], a, teste[256], status[30], gauge[30],
- dia[20], login[20], online[20], fone[30], cost[30], *moedac,
- *precision, senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry, sem[256];
- float totalarq = 0, gaugep = 0, registro = 0;
- long moeda = 0;
- int x = 0;
- FILE *entrada, *saidaarq;
-
- set(App->GaugeTodasLigacoes, MUIA_Gauge_InfoText, TMsg(App->Msg25));
- DoMethod(App->ListTodasLigacoes, MUIM_List_Clear);
- totalarq = LinhasArquivo("T:Freedom.InTmp");
-
- if((!(entrada = fopen("T:Freedom.InTmp", "r"))) ||
- (!(saidaarq= fopen("T:Freedom.InAll", "w"))))
- {
- /* FREEDOM TEMPORARY FILE NOT FOUND */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg48));
- return NULL;
- }
- /* PEGA INFORMACOES DA MOEDA CORRENTE */
- get(App->ComboMoeda, MUIA_Cycle_Active, &moeda);
- get(App->NomeMoeda, MUIA_String_Contents, &moedac);
-
- /* PEGA A PRECISAO DOS DISPLAYS DE VALORES */
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- x = 0; gaugep = 0;
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if(a == '\n')
- {
- teste[--x] = '\0';
-
- if(!(strcmp(Corta(teste, ',', 5), "Act"))) {
- /* REGULAR */
- strcpy(status, TMsg(App->Msg54));
- } else {
- /* IRREGULAR */
- strcpy(status, TMsg(App->Msg55)); }
-
- strcpy(dia, Corta(teste, ',', 1));
- strcpy(sem, DiaSemanaFREE(dia, 1));
- strcpy(login, Corta(teste, ',', 2));
- strcpy(online, Corta(teste, ',', 6));
- strcpy(fone, EspacoString(Corta(teste, ',', 0), 12, 1));
-
- /* LE O VALOR DA LIGACAO */
- strcpy(cost, Corta(teste, ',', 8));
- strcpy(teste2, CasasAposCaracter(cost, '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, teste2);
- else
- sprintf(cost, "%s%s", teste2, moedac);
- if(registro < 2)
- strcpy(cost, "REALREG");
-
- strcpy(login, SegundoHora(login));
- strcpy(online, SegundoHora(online));
-
- /* ACERTA OS TAMANHOS DOS CAMPOS */
- strcpy(dia, EspacoString(dia, 12, 1));
- strcpy(login, EspacoString(login, 10, 1));
- strcpy(online, EspacoString(online, 10, 1));
- strcpy(cost, EspacoString(cost, 12, 1));
-
- /* GERA O ARQUIVO DE SAIDA */
- sprintf(saida, "\033b%s\033n%s\033b%s\033n%s\033b%s\033n\0338 %s (%s)\033n\n", dia, login, online, fone, cost, status, sem);
- fprintf(saidaarq, "%s", saida);
-
- teste[0] = '\0'; x = 0;
- gaugep++;
- sprintf(gauge, "%f", ((100 / totalarq) * gaugep));
- set(App->GaugeTodasLigacoes, MUIA_Gauge_Current, atoi(gauge));
- }
- }
- fclose(entrada);
- fclose(saidaarq);
-
- /* CARREGA DO ARQUIVO PARA A LISTA */
- CarregaLista(App->ListTodasLigacoes, "T:Freedom.InAll");
- remove("T:Freedom.InAll");
- /* LOADED */
- set(App->GaugeTodasLigacoes, MUIA_Gauge_InfoText, TMsg(App->Msg78));
-
- return NULL;
- }
-
- APTR TestaConfiguracao( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA FUNCAO TESTA A VALIDADE DOS CAMPOS NA JANELA DE
- CONFIGURACAO. EVENTO DOS BOTOES DE SAVE, USE, E CLOSE REQUEST */
- char teste[256],
- *mes, *hora1, *hora2, *database, *categorydir, *precision;
- int x = 0;
- long menu = 0;
-
- get(App->PrefsDiaInicial, MUIA_String_Contents, &mes);
- get(App->PrefsFreeHInicio, MUIA_String_Contents, &hora1);
- get(App->PrefsFreeHFim, MUIA_String_Contents, &hora2);
- get(App->DataBaseName, MUIA_String_Contents, &database);
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- get(App->PrefsComboMenu, MUIA_Cycle_Active, &menu);
-
- /* VERIFICA A JANELA PRINCIPAL CERTA A ABRIR (STAND, GRAPHIC) */
- if(menu == 0) {
- set(App->JanelaPrincipal, MUIA_Window_Open, FALSE);
- set(App->JanelaPrincipal2, MUIA_Window_Open, TRUE);
- } else {
- set(App->JanelaPrincipal2, MUIA_Window_Open, FALSE);
- set(App->JanelaPrincipal, MUIA_Window_Open, TRUE);
- }
-
- /* TESTA SE O LOGO EXISTE */
- if(!ExisteArquivo("Freedom:Images/Freelogo.iff"))
- {
- /* FREEDOM:IMAGES/FREELOGO.IFF NOT FOUND */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg58));
- }
- /* TESTA SE EXISTE TODOS OS BOTOES DO MENU PRINCIPAL */
- if(!ExisteArquivo("Freedom:Images/About.iff") ||
- !ExisteArquivo("Freedom:Images/Global.iff") ||
- !ExisteArquivo("Freedom:Images/LastC.iff") ||
- !ExisteArquivo("Freedom:Images/Other.iff") ||
- !ExisteArquivo("Freedom:Images/Prefs.iff") ||
- !ExisteArquivo("Freedom:Images/Costs.iff") ||
- !ExisteArquivo("Freedom:Images/Anual.iff") ||
- !ExisteArquivo("Freedom:Images/This.iff"))
- {
- /* FREEDOM IMAGE BUTTONS NOT FOUND */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg59));
- }
-
- /* TESTA DIRETORIO DA BASE DE DADOS */
- set(App->DataBaseName, MUIA_String_Contents, FiltraDir(database, 0));
- if(!strcmp(UltimoCaracter(database), ":"))
- {
- set(App->DataBaseName, MUIA_String_Contents, "Freedom:FDataBase");
- /* FREEDOM DATABASE DIR IS WRONG, NOT POSSIBLE DEVICE */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg50));
- }
- /* VERIFICA SE O DIRETORIO DA BASE EXISTE */
- if(!ExisteDiretorio(database))
- {
- /* FREEDOM DATABASE NOT FOUND, CREATED? */
- sprintf(teste, "\033c%s\n\0338[%s]", TMsg(App->Msg30), database);
- /* CREATE DIRECTORY, CANCEL */
- x = MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg33), teste);
- if(x == 1)
- {
- mkdir(database);
- /* FREEDOM DATABASE CREATED */
- sprintf(teste, "\033c%s \0338[%s]", TMsg(App->Msg27), database);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), teste);
- }
- }
-
- /* FAZ CONSISTENCIA DO TAMANHO DO CAMPO HORA */
- if(!TestaHora(hora1) ||
- !TestaHora(hora2))
- {
- /* FORMAT TIME IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg41));
- set(App->PrefsFreeHInicio, MUIA_String_Contents, "00:00:00");
- set(App->PrefsFreeHFim, MUIA_String_Contents, "00:00:00");
- return NULL;
- }
- if(atoi(mes) < 1 || atoi(mes) > 31)
- {
- /* INITIAL DAY IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg49));
- set(App->PrefsDiaInicial, MUIA_String_Contents, "1");
- }
-
- /* TESTA DIRETORIO DAS CATEGORIAS */
- set(App->CategDiretorio, MUIA_String_Contents, FiltraDir(categorydir, 0));
- if(!strcmp(UltimoCaracter(categorydir), ":"))
- {
- set(App->CategDiretorio, MUIA_String_Contents, "Freedom:Categories");
- /* FREEDOM CATEGORIES DIR IS WRONG, NOT POSSIBLE DEVICE */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg71));
- }
- /* VERIFICA SE O DIRETORIO DAS CATEGORIAS EXISTE */
- if(!ExisteDiretorio(categorydir))
- {
- /* FREEDOM CATEGORIE NOT FOUND, CREATE? */
- sprintf(teste, "\033c%s\n\0338[%s]", TMsg(App->Msg66), categorydir);
- /* CREATE DIRECTORY, CANCEL */
- x = MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg33), teste);
- if(x == 1)
- {
- mkdir(categorydir);
- /* FREEDOM CATEGORIE DIRECTORY CREATED */
- sprintf(teste, "\033c%s \0338[%s]", TMsg(App->Msg67), categorydir);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), teste);
- }
- }
- /* TESTA A VALIDADE DOS CAMPOS DE REGISTRO, SE INVALIDOS LIMPA A CHAVE
- PARA DIFICULTAR O CRACKER DO PROGRAMA */
- if(TestaPedidoRegistro() == 1)
- {
- set(App->RegisterKey, MUIA_String_Contents, "");
- /* REGISTER INFORMATION INVALID! */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg38));
- }
-
- /* TESTA O CAMPO DE PRECISAO DE VALORES */
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
- if(atoi(precision) < 0)
- set(App->ConfPrecision, MUIA_String_Contents, "0");
- if(atoi(precision) > 10)
- set(App->ConfPrecision, MUIA_String_Contents, "10");
-
- return NULL;
- }
-
- APTR CarregaPeriodo( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA FUNCAO GERA OS ARQUIVOS PARA A SELECAO POR PERIODO */
- char *data1, *data2, *horainicio, *horafim, teste[256],
- *database, freeout[256], data12[256];
- int x = 0;
- FILE *saida;
-
- LimpaJanelaDesseMes();
-
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- set(App->JanelaDesseMes,MUIA_Window_Open,FALSE);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, TRUE);
- set(App->GaugeQuery, MUIA_Gauge_Current, 5);
- set(App->GaugeQuery, MUIA_Gauge_InfoText, TMsg(App->Msg26));
-
- get(App->InputPeriodo1, MUIA_String_Contents, &data1);
- get(App->InputPeriodo2, MUIA_String_Contents, &data2);
- get(App->PrefsFreeHInicio, MUIA_String_Contents, &horainicio);
- get(App->PrefsFreeHFim, MUIA_String_Contents, &horafim);
-
- /* FAZ CONSISTENCIA DO FORMATO DA DATA */
- if(!TestaData(data1) ||
- !TestaData(data2))
- {
- /* DATE IS INVALID! VERIFIED FIELDS [DD.MM.YYYY] */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg51));
- return NULL;
- }
-
- /* CASO OS CAMPOS DE HORA INICIAL E FINAL ESTEJAM EM BRANCO
- ATRIBUI 00:00:00 A ELES */
- if(!(strcmp(horainicio, "")))
- strcpy(horainicio, "00:00:00");
- if(!(strcmp(horafim, "")))
- strcpy(horafim, "00:00:00");
-
- /* CRIA LISTA DE ARQUIVOS A CONSULTAR */
- if(!(saida = fopen("T:Freedom.DataDir", "w")))
- {
- set(App->JanelaDesseMes,MUIA_Window_Open,FALSE);
- /* PROBLEM ON CREATION T:FREEDOM.DATADIR */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg53));
- return NULL;
- }
- fprintf(saida, "%s/Freedom.%s\n", database, AposCaracter(data1, '.', 1));
- set(App->GaugeQuery, MUIA_Gauge_Current, 15);
-
- sprintf(freeout, "%s/Freedom.Out", database);
- strcpy(data12, data1); x = 0;
- while(x == 0)
- {
- strcpy(teste, ArrumaDataHora(SomaDiminuiMes(data12, 1), '.'));
- if(atoi(DiaJuliano(teste)) <= atoi(DiaJuliano(data2)))
- {
- fprintf(saida, "%s/Freedom.%s\n", database, AposCaracter(teste, '.', 1));
- strcpy(data12, teste);
- } else
- x = 1;
- }
- fclose(saida);
-
- /* PREPARA O ARQUIVO PARA A CONSULTA GLOBAL */
- UnirArquivos("T:Freedom.InTmpP", "T:Freedom.DataDir");
- remove("T:Freedom.DataDir");
- set(App->GaugeQuery, MUIA_Gauge_Current, 25);
-
- SelecionaIntervaloCampo("T:Freedom.InTmpP", "T:Freedom.InTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- SelecionaIntervaloCampo(freeout, "T:Freedom.OutTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- remove("T:Freedom.InTmpP");
- set(App->GaugeQuery, MUIA_Gauge_Current, 35);
-
- SemanaCount("t:Freedom.InTmp");
- sprintf(teste, "%s - %s", data1, data2);
- GravaRegistroDB("t:Freedom.Date", teste, "date", "w");
- set(App->GaugeQuery, MUIA_Gauge_Current, 50);
- return NULL;
- }
-
- APTR CriaBaseDados( struct Hook *a0, APTR a2, APTR a1 )
- {
- char *database, teste[256];
- get(App->DataBaseName, MUIA_String_Contents, &database);
-
- mkdir(database);
-
- sprintf(teste, "\033c%s \0338[%s]", TMsg(App->Msg27), database);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), teste);
- return NULL;
- }
-
- APTR PreparaGlobal( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ESTA ROTINA PREPARA OS ARQUIVOS PARA A CONSULTA GLOBAL */
- char *database, freeout[256];
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- set(App->JanelaDesseMes,MUIA_Window_Open,FALSE);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
-
- LimpaJanelaDesseMes();
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, TRUE);
- set(App->GaugeQuery, MUIA_Gauge_Current, 5);
- set(App->GaugeQuery, MUIA_Gauge_InfoText, TMsg(App->Msg26));
-
- /* PREPARA O ARQUIVO PARA A CONSULTA GLOBAL */
- DiretorioArquivoFREE(database, "T:Freedom.DataDir", 1);
- UnirArquivosFREE("T:Freedom.InTmp", "T:Freedom.DataDir");
- VerificaFoneArquivo("T:Freedom.InTmp", "T:Freedom.Temp");
- remove("T:Freedom.DataDir");
- /* GLOBAL STATISTICS */
- GravaRegistroDB("t:Freedom.Date", TMsg(App->Msg52), "date", "w");
- set(App->GaugeQuery, MUIA_Gauge_Current, 25);
- sprintf(freeout, "%s/Freedom.Out", database);
- CopiaArquivo(freeout, "t:Freedom.OutTmp");
- SemanaCount("t:Freedom.InTmp");
- set(App->GaugeQuery, MUIA_Gauge_Current, 50);
- return NULL;
- }
-
- APTR AnualDiminuiAno( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE DIMINUI ANO NA CONSULTA ANUAL */
- char teste[100], *ano;
- get(App->CAnualText, MUIA_String_Contents, &ano);
- if(atoi(ano) == 1)
- strcpy(ano, "1");
- else
- {
- sprintf(teste, "%d", (atoi(ano) - 1));
- strcpy(ano, teste);
- }
- MUI_Redraw(App->CAnualText, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR AnualAumentaAno( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE AUMENTA ANO NA CONSULTA ANUAL */
- char teste[100], *ano;
- get(App->CAnualText, MUIA_String_Contents, &ano);
- sprintf(teste, "%d", (atoi(ano) + 1));
- strcpy(ano, teste);
- MUI_Redraw(App->CAnualText, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR TestaRegistroAnual( struct Hook *a0, APTR a2, APTR a1 )
- {
- char senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry;
- int registro = 0;
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
-
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
-
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
-
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- if(registro == 0)
- {
- /* VERSION NOT REGISTER, PLEASE REGISTER */
- MsgRegistro();
- return NULL;
- }
- set(App->JanelaConsultaAnual, MUIA_Window_Open, TRUE);
- return NULL;
- }
-
- APTR ConsultaAnual( struct Hook *a0, APTR a2, APTR a1 )
- {
- char *database, teste[256], *ano, xx[10], a, tmp[256], *regnumber2,
- mes[256], ligacoes[256], online[256], regular[20], senhatmp[256],
- irregular[20], media[256], gauge[30], mesnumero[3], cost[30],
- costtmp[30], *moedac, *precision, senha1[256], senha2[256],
- *regemail, *regnumber, *regname, *regorg, *regcountry;
- int x = 0, xmes1 = 0, xmes2 = 0, totalarq = 0, registro = 0;
- float gaugep = 0;
- long mes1 = 0, mes2 = 0, moeda = 0;
- FILE *entrada, *arq;
-
- get(App->CAnualMes1, MUIA_Cycle_Active, &mes1);
- get(App->CAnualMes2, MUIA_Cycle_Active, &mes2);
- xmes1 = mes1 + 1;
- xmes2 = mes2 + 1;
- if(xmes1 > xmes2)
- {
- /* PERIOD SELECTED INVALID! LOOK FIELDS */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg61));
- set(App->JanelaConsultaAnual, MUIA_Window_Open, TRUE);
- return NULL;
- }
- set(App->JanelaConsultaAnualLista, MUIA_Window_Open, TRUE);
- DoMethod(App->ListConsultaAnual, MUIM_List_Clear);
-
- set(App->CAnualGauge, MUIA_Gauge_Current, 0);
- set(App->CAnualGauge, MUIA_Gauge_InfoText, TMsg(App->Msg26));
- get(App->DataBaseName, MUIA_String_Contents, &database);
- get(App->CAnualText, MUIA_String_Contents, &ano);
- /* ROTINA QUE PREPARA O ARQUIVO PARA CRIACAO DOS MESES */
- for(x = 1; x < 13; x++)
- {
- if(x < 10)
- sprintf(xx, "0%d", x);
- else
- sprintf(xx, "%d", x);
- sprintf(teste, "%s/Freedom.%s.%s", database, xx, ano);
- if(x >= xmes1 && x <= xmes2)
- InsereArquivoFREE(teste, "t:Freedom.YearTemp");
- set(App->CAnualGauge, MUIA_Gauge_Current, (x * 7));
- }
- ConsultaAnualFREE("t:Freedom.YearTemp", "t:Freedom.YearC");
- totalarq = LinhasArquivo("t:Freedom.YearC");
- remove("t:Freedom.YearTemp");
- set(App->CAnualGauge, MUIA_Gauge_Current, 100);
-
- if(totalarq <= 0)
- {
- /* NAO EXISTE INFORMACOES PARA ESSA CONSULTA */
- set(App->JanelaConsultaAnualLista, MUIA_Window_Open, FALSE);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg24));
- return NULL;
- }
-
- /* CARREGA FREEDOM.YEARC PARA A LISTA */
- if((!(entrada = fopen("T:Freedom.YearC", "r"))) ||
- (!(arq = fopen("T:Freedom.ListTmp", "w"))))
- {
- /* ERROR ON OPEN A INTERNAL TEMPORARY FILE */
- set(App->JanelaConsultaAnualLista, MUIA_Window_Open, FALSE);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg62));
- return NULL;
- }
- /* PEGA INFORMACOES DA MOEDA CORRENTE */
- get(App->ComboMoeda, MUIA_Cycle_Active, &moeda);
- get(App->NomeMoeda, MUIA_String_Contents, &moedac);
-
- /* PEGA A PRECISAO DOS DISPLAYS DE VALORES */
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- set(App->CAnualGauge, MUIA_Gauge_Current, 0);
- x = 0; gaugep = 0;
- while(a = getc(entrada), ! feof(entrada))
- {
- teste[x++] = a;
- if(a == '\n')
- {
- teste[--x] = '\0';
- strcpy(mes, Corta(teste, ',', 0));
- if(atoi(mes) < 10)
- sprintf(tmp, "0%s.%s", mes, ano);
- else
- sprintf(tmp, "%s.%s", mes, ano);
- strcpy(mesnumero, EspacoString(tmp, 9, 1));
-
- strcpy(mes, DescricaoMesFREE(atoi(mes), 1));
- strcpy(mes, EspacoString(mes, 9, 1));
- strcpy(ligacoes, EspacoString(Corta(teste, ',', 1), 5, 1));
- strcpy(online, EspacoString(SegundoHora(Corta(teste, ',', 2)), 10, 1));
- strcpy(irregular, EspacoString(Corta(teste, ',', 3), 5, 1));
- strcpy(regular, EspacoString(Corta(teste, ',', 4), 5, 1));
- strcpy(media, EspacoString(SegundoHora(Corta(teste, ',', 5)), 10, 1));
- strcpy(costtmp, CasasAposCaracter(Corta(teste, ',', 6), '.', atoi(precision)));
- if(moeda == 0)
- sprintf(cost, "%s%s", moedac, costtmp);
- else
- sprintf(cost, "%s%s", costtmp, moedac);
- if(registro < 2)
- strcpy(cost, "REALREG");
- strcpy(cost, EspacoString(cost, 12, 1));
-
- fprintf(arq, "\033b%s\033n%s\033b%s\033n%s%s%s\033b%s\033n\0338 %s\n", mesnumero, ligacoes, online, media, regular, irregular, cost, mes);
-
- /* ROTINA QUE ACERTA GAUGE */
- gaugep++;
- sprintf(gauge, "%f", ((100 / totalarq) * gaugep));
- set(App->CAnualGauge, MUIA_Gauge_Current, atoi(gauge));
- set(App->CAnualGauge, MUIA_Gauge_InfoText, "%ld %%");
- teste[0] = '\0'; x = 0;
- }
- }
- fclose(entrada);
- fclose(arq);
- set(App->CAnualGauge, MUIA_Gauge_Current, 100);
- remove("t:Freedom.YearC");
-
- /* CARREGA DO ARQUIVO PARA A LISTA */
- CarregaLista(App->ListConsultaAnual, "T:Freedom.ListTmp");
- remove("T:Freedom.ListTmp");
-
- /* LOADED */
- set(App->CAnualGauge, MUIA_Gauge_InfoText, TMsg(App->Msg78));
-
- return NULL;
- }
-
- APTR RemoveLimite( struct Hook *a0, APTR a2, APTR a1 )
- {
- long pos = 0;
- get(App->LimitesLista, MUIA_List_Active, &pos);
- DoMethod(App->LimitesLista, MUIM_List_Remove, pos);
- return NULL;
- }
-
- APTR LimpaLimites( struct Hook *a0, APTR a2, APTR a1 )
- {
- int x;
- /* ACCEPT OR CANCEL */
- /* YOU LIKE CLEAR ALL LIMITS IN THIS LIST */
- x = MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg64), TMsg(App->Msg65));
- if(x == 1)
- DoMethod(App->LimitesLista, MUIM_List_Clear);
- return NULL;
- }
-
- APTR AdicionaLimite( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE ADICIONA UM LIMITE NOVO A LISTA */
- static struct buffer {
- char lista[256];
- };
- static struct buffer listaarray[50];
-
- char *horaini, *horafim, *custo, *combotext;
- long pos = 0, menu = 0;
-
- /* TESTA SE NAO EXPIROU O MAXIMO DE LIMITES 100 */
- get(App->LimitesLista, MUIA_List_Entries, &pos);
- if(pos >= 50)
- {
- /* LIST OF IGNORE PHONES FINISH! MAXIMUN 100 LIMITS */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg63));
- return NULL;
- }
-
- get(App->LimitesHInicio, MUIA_String_Contents, &horaini);
- get(App->LimitesHFinal, MUIA_String_Contents, &horafim);
- get(App->LimiteCusto, MUIA_String_Contents, &custo);
- strcpy(custo, SubstituiCaracter(custo, ',', '.'));
- get(App->ComboCost, MUIA_Cycle_Active, &menu);
- get(App->ComboCost, MUIA_Text_Contents, &combotext);
-
- /* FAZ CONSISTENCIA DO TAMANHO DO CAMPO HORA */
- if(!TestaHora(horaini) ||
- !TestaHora(horafim))
- {
- /* FORMAT TIME IS INVALID */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg41));
- return NULL;
- }
-
- sprintf(listaarray[pos].lista, "%s %s %s %d %s", horaini, horafim, custo, menu, combotext);
- if(menu < 6)
- DoMethod(App->LimitesLista, MUIM_List_InsertSingle, &listaarray[pos].lista[0], MUIV_List_Insert_Bottom);
- else
- DoMethod(App->LimitesLista, MUIM_List_InsertSingle, &listaarray[pos].lista[0], -1, MUIV_List_Insert_Bottom);
-
- return NULL;
- }
-
- APTR DoubleClickLimites( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE CARREGA DO LIST E JOGA NOS TEXTS */
- char *linha;
- DoMethod(App->LimitesLista, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &linha);
- set(App->LimitesHInicio, MUIA_String_Contents, Corta(linha, ' ', 0));
- set(App->LimitesHFinal, MUIA_String_Contents, Corta(linha, ' ', 1));
- set(App->LimiteCusto, MUIA_String_Contents, Corta(linha, ' ', 2));
- set(App->ComboCost, MUIA_Cycle_Active, atoi(Corta(linha, ' ', 3)));
- return NULL;
- }
-
- APTR SalvaCategoria( struct Hook *a0, APTR a2, APTR a1 )
- {
- char *categorydir, teste[256], *categoryname, *lista, *money;
- int x = 0;
- long pos = 0, moneycombo = 0;
- FILE *saida;
-
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- get(App->NomeCategoria, MUIA_String_Contents, &categoryname);
- get(App->NomeMoeda, MUIA_String_Contents, &money);
-
- /* VERIFICA SE O DIRETORIO DAS CATEGORIAS EXISTE */
- if(!ExisteDiretorio(categorydir))
- {
- /* FREEDOM CATEGORIE NOT FOUND, CREATE? */
- sprintf(teste, "\033c%s\n\0338[%s]", TMsg(App->Msg66), categorydir);
- /* CREATE DIRECTORY, CANCEL */
- x = MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg33), teste);
- if(x == 1)
- {
- mkdir(categorydir);
- }
- else
- return NULL;
- }
- if(!strcmp(categoryname, ""))
- {
- /* NAME OF CATEGORY IS INVALID! */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg68));
- return NULL;
- }
- get(App->LimitesLista, MUIA_List_Entries, &pos);
- if(pos == 0)
- {
- /* LISTA ESTA VAZIA */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg72));
- return NULL;
- }
-
- sprintf(teste, "%s/%s", categorydir, categoryname);
- if(!(saida = fopen(teste, "w")))
- {
- /* PROBLEM ON SAVE CATEGORY */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg69));
- return NULL;
- }
- for(x = 0; x < pos; x++)
- {
- DoMethod(App->LimitesLista, MUIM_List_GetEntry, x, &lista);
- sprintf(teste, "%s %s %s %s %s", HoraSegundo(Corta(lista, ' ', 0)), HoraSegundo(Corta(lista, ' ', 1)), Corta(lista, ' ', 2), Corta(lista, ' ', 3), Corta(lista, ' ', 4));
- fprintf(saida, "%s\n", teste);
- }
- get(App->ComboMoeda, MUIA_Cycle_Active, &moneycombo);
- fprintf(saida, "**>money:%d@%s\n", moneycombo, money);
- fclose(saida);
- /* CATEGORY SAVED */
- sprintf(teste, "%s \0338[%s]", TMsg(App->Msg70), categoryname);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), teste);
- CarregaListaCategorias();
- return NULL;
- }
-
- APTR SelecionaCategoriaDefault( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE PEGA DA LISTA DE CATEGORIAS SE COLOCA NO CAMPO DEFAULT */
- char *texto;
- DoMethod(App->CategoriesList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &texto);
- set(App->TextDefault, MUIA_Text_Contents, texto);
- CarregaListaLimites(texto);
- CarregaPilhaCategorias(texto);
- return NULL;
- }
-
- APTR DoubleClickCategoria( struct Hook *a0, APTR a2, APTR a1 )
- {
- char *texto, teste[256];
-
- DoMethod(App->CategoriesList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &texto);
- strcpy(teste, texto);
- CarregaListaLimites(teste);
- return NULL;
- }
-
- APTR DeletaCategoria( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE REMOVE UMA DETERMINADA CATEGORIA DO DISCO */
- char *categorydir, *texto, teste[256], deleta[256], *defaulttext;
- int x = 0;
-
- get(App->TextDefault, MUIA_Text_Contents, &defaulttext);
- get(App->CategDiretorio, MUIA_String_Contents, &categorydir);
- DoMethod(App->CategoriesList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &texto);
- if(!strcmp(texto, ""))
- return NULL;
- sprintf(deleta, "%s/%s", categorydir, texto);
- /* CONFIRM DELETING */
- sprintf(teste, "%s \0338[%s]?", TMsg(App->Msg73), texto);
- /* _DELETE|_CANCEL */
- x = MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg74), teste);
- if(x == 1)
- {
- remove(deleta);
- CarregaListaCategorias();
- }
- /* VERIFICA SE O DELETADO NAO EH O DEFAULT */
- sprintf(deleta, "%s/%s", categorydir, defaulttext);
- if(!(ExisteArquivo(deleta)))
- set(App->TextDefault, MUIA_Text_Contents, "");
- /* CARREGA APOS A DELECAO OS LIMITES DO DEFAULT */
- CarregaListaLimites(defaulttext);
- return NULL;
- }
-
- APTR GeraPedidoRegistro( struct Hook *a0, APTR a2, APTR a1 )
- {
- char *regemail, *regname, *regcountry, *regcity, *regnumber,
- *nick, *comment, *regorg;
-
- if(TestaPedidoRegistro() == 1)
- {
- set(App->RegisterKey, MUIA_String_Contents, "");
- /* REGISTER INFORMATION INVALID! */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg38));
- return NULL;
- }
-
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterCity, MUIA_String_Contents, ®city);
- get(App->PedidoNick, MUIA_String_Contents, &nick);
- get(App->PedidoFreedomCall, MUIA_String_Contents, &comment);
-
- if(!strcmp(nick, "") || !strcmp(comment, ""))
- {
- /* PLEASE, COMPLETE FIELDS */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg77));
- return NULL;
- }
-
- GravaRegistroDB("Ram:Freedom.RegisterForm", "Send this register form for [surround@iname.com]", "EmailAddress", "w");
- GravaRegistroDB("Ram:Freedom.RegisterForm", regname, "YourName", "a");
- GravaRegistroDB("Ram:Freedom.RegisterForm", regorg, "Organization", "a");
- GravaRegistroDB("Ram:Freedom.RegisterForm", regemail, "YourEmail", "a");
- GravaRegistroDB("Ram:Freedom.RegisterForm", regcountry, "YourCountry", "a");
- GravaRegistroDB("Ram:Freedom.RegisterForm", regcity, "City", "a");
- GravaRegistroDB("Ram:Freedom.RegisterForm", nick, "Nickname", "a");
- GravaRegistroDB("Ram:Freedom.RegisterForm", comment, "Comment", "a");
- GravaRegistroDB("Ram:Freedom.RegisterForm", "Don`t change this automatic e-mail, just send it!!!", "Warning", "a");
-
- set(App->JanelaPedidoRegistro, MUIA_Window_Open, FALSE);
-
- /* FILE WAS GENERATED RAM:FREEDOM.REGISTERFORM */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg34));
-
- return NULL;
- }
-
- APTR TestaRegistroCusto( struct Hook *a0, APTR a2, APTR a1 )
- {
- char senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry;
- int registro = 0;
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
-
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
-
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
-
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- if(registro == 0)
- {
- /* VERSION NOT REGISTER, PLEASE REGISTER */
- MsgRegistro();
- return NULL;
- }
- set(App->JanelaSelecionaMesCustos, MUIA_Window_Open, TRUE);
- return NULL;
- }
-
- APTR AumentaAno2( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE AUMENTA ANO NO EDIT DA SELECAO DE MES */
- char teste[100], *ano;
- get(App->TextAno2, MUIA_String_Contents, &ano);
- sprintf(teste, "%d", (atoi(ano) + 1));
- strcpy(ano, teste);
- MUI_Redraw(App->TextAno2, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR DiminuiAno2( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* ROTINA QUE DIMINUI ANO NO EDIT DA SELECAO DE MES */
- char teste[100], *ano;
- get(App->TextAno2, MUIA_String_Contents, &ano);
- if(atoi(ano) == 1)
- strcpy(ano, "1");
- else
- {
- sprintf(teste, "%d", (atoi(ano) - 1));
- strcpy(ano, teste);
- }
- MUI_Redraw(App->TextAno2, MADF_DRAWOBJECT);
- return NULL;
- }
-
- APTR CarregaEsseCheckCost( struct Hook *a0, APTR a2, APTR a1 )
- {
- char senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry,
- teste[256], horason[30], cost[30], *moedac, *precision,
- media[30], teste2[256], d1[256], d2[256], ultima[60],
- *extrahour, *providerbill, *limit, *unit;
- int totcal = 0, registro = 0;
- long moeda = 0;
- float horastotais = 0, limitehoras = 0, precoextra = 0;
-
- totcal = LinhasArquivo("t:Freedom.inTmp");
- if(totcal <= 0)
- {
- remove("t:freedom.intmp");
- remove("t:freedom.outtmp");
- remove("t:freedom.date");
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, FALSE);
- set(App->JanelaDesseMes, MUIA_Window_Open, FALSE);
- /* NO CONNECTIONS REGISTERED ABOUT THIS DATE */
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg24));
- return NULL;
- }
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- /* TRAVA A EXECUCAO CASO SEJA USUARIO SEM REGISTRO */
- if(registro == 0)
- {
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, FALSE);
- /* VERSION NOT REGISTER, PLEASE REGISTER */
- MsgRegistro();
- return NULL;
- }
-
- /* EXTRA HOUR & PROVIDER BILL */
- get(App->HoraExtra, MUIA_String_Contents, &extrahour);
- get(App->ContaProvedor, MUIA_String_Contents, &providerbill);
- get(App->InputLimitTime, MUIA_String_Contents, &limit);
- limitehoras = atof(limit) * 3600;
-
- /* PEGA INFORMACOES DA MOEDA CORRENTE */
- get(App->ComboMoeda, MUIA_Cycle_Active, &moeda);
- get(App->NomeMoeda, MUIA_String_Contents, &moedac);
-
- /* PEGA A PRECISAO DOS DISPLAYS DE VALORES */
- get(App->ConfPrecision, MUIA_String_Contents, &precision);
- /* PEGA UNIDADE DE DESCONTO */
- get(App->ConfUnit, MUIA_String_Contents, &unit);
-
- strcpy(media, MediaCampo("t:Freedom.inTmp", ',', 6));
- strcpy(cost, MediaCampo("t:Freedom.inTmp", ',', 8));
- strcpy(horason, SegundoHora(Corta(media, ':', 0)));
- horastotais = atof(Corta(media, ':', 0));
-
- /* LOADING QUERY INFORMATION... */
- set(App->GaugeQuery, MUIA_Gauge_Current, 55);
- set(App->GaugeQuery, MUIA_Gauge_InfoText, TMsg(App->Msg25));
-
- /* ROTINA QUE ACERTA O CABECALHO DA GERACAO, O PERIODO */
- strcpy(ultima, PrimeiroUltimoCampo("t:freedom.inTmp", ',', 1, ':'));
- strcpy(teste, LeRegistroDB("t:Freedom.Date", "date"));
- strcpy(d1, Corta(ultima, ':', 0));
- strcpy(d2, Corta(ultima, ':', 1));
- sprintf(teste2, "\033c\0338%s [%s] %s", d1, teste, d2);
- set(App->LabelCheckCosts, MUIA_Text_Contents, teste2);
-
- /* TOTAL ONLINE & DAYS */
- sprintf(teste, "%s \0338%s\033n", TMsg(App->Msg7), horason);
- set(App->CheckTotalHoras, MUIA_Text_Contents, teste);
-
- /* EXTRA HOUR */
- if(registro < 2)
- {
- sprintf(teste, "%s \033bREALREG\033n", TMsg(App->Msg87));
- set(App->CheckHorasExtras, MUIA_Text_Contents, teste);
- } else {
- if(horastotais <= limitehoras)
- {
- if(moeda == 0)
- sprintf(teste, "%s %s0", TMsg(App->Msg87), moedac);
- else
- sprintf(teste, "%s 0%s", TMsg(App->Msg87), moedac);
- set(App->CheckHorasExtras, MUIA_Text_Contents, teste);
- precoextra = 0;
- } else {
- sprintf(d1, "%f", (((horastotais - limitehoras) / 3600) * atof(extrahour)));
- precoextra = atof(d1);
- if(moeda == 0)
- sprintf(teste, "%s %s%s", TMsg(App->Msg87), moedac, CasasAposCaracter(d1, '.', atoi(precision)));
- else
- sprintf(teste, "%s %s%s", TMsg(App->Msg87), CasasAposCaracter(d1, '.', atoi(precision)), moedac);
- set(App->CheckHorasExtras, MUIA_Text_Contents, teste);
- }
- }
-
- /* PHONE BILL */
- strcpy(teste2, Corta(cost, ':', 0));
- sprintf(teste2, "%f", (atof(teste2) - atof(unit)));
- if(moeda == 0)
- sprintf(teste, "%s %s%s", TMsg(App->Msg86), moedac, CasasAposCaracter(teste2, '.', atoi(precision)));
- else
- sprintf(teste, "%s %s%s", TMsg(App->Msg86), CasasAposCaracter(teste2, '.', atoi(precision)), moedac);
- if(registro < 2)
- sprintf(teste, "%s \033bREALREG\033n", TMsg(App->Msg86));
- set(App->CheckContaTelefonica, MUIA_Text_Contents, teste);
-
- /* PROVIDER BILL */
- if(registro < 2)
- {
- sprintf(teste, "%s \033bREALREG\033n", TMsg(App->Msg85));
- set(App->CheckContaProvedor, MUIA_Text_Contents, teste);
- } else {
- sprintf(d1, "%f", (atof(providerbill) + precoextra));
- if(moeda == 0)
- sprintf(teste, "%s %s%s", TMsg(App->Msg85), moedac, CasasAposCaracter(d1, '.', atoi(precision)));
- else
- sprintf(teste, "%s %s%s", TMsg(App->Msg85), CasasAposCaracter(d1, '.', atoi(precision)), moedac);
- set(App->CheckContaProvedor, MUIA_Text_Contents, teste);
- }
-
- set(App->GaugeQuery, MUIA_Gauge_Current, 100);
-
- /* TOTAL COSTS */
- if(registro < 2)
- {
- sprintf(teste, "%s \033bREALREG\033n", TMsg(App->Msg88));
- set(App->CheckCustoTotal, MUIA_Text_Contents, teste);
- } else {
- /* teste2 POSSUI O VALOR DA CONTA TELEFONICA */
- sprintf(d2, "%f", atof(teste2) + atof(d1));
- if(moeda == 0)
- sprintf(teste, "%s \033b%s%s\033n", TMsg(App->Msg88), moedac, CasasAposCaracter(d2, '.', atoi(precision)));
- else
- sprintf(teste, "%s \033b%s%s\033n", TMsg(App->Msg88), CasasAposCaracter(d2, '.', atoi(precision)), moedac);
- set(App->CheckCustoTotal, MUIA_Text_Contents, teste);
- }
-
- /* FINAL DA GERACAO */
- remove("t:freedom.outtmp");
- /* FECHA A JANELA DE DISPLAY DE GERACAO */
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, FALSE);
- /* ABRE A JANELA COM AS ESTATISTICAS */
- set(App->JanelaChecaCustos, MUIA_Window_Open, TRUE);
-
- return NULL;
- }
-
- APTR PreparaChequeCustos( struct Hook *a0, APTR a2, APTR a1 )
- {
- char teste[256], mesdes[5], *mes, *ano,
- mesdes2[20], *diax, *horainicio, *horafim, data1[256],
- data2[256], *database, freein[256], freeout[256],
- arquivo1[256], arquivo2[256];
- int x = 0;
-
- /* FECHA A JANELA DE SELECAO */
- set(App->JanelaSelecionaMesCustos, MUIA_Window_Open, FALSE);
-
- /* TESTA SE O DIRETORIO DA BASE DE DADOS EXISTE */
- get(App->DataBaseName, MUIA_String_Contents, &database);
- if(!ExisteDiretorio(database))
- {
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg17));
- return NULL;
- }
- /* PEGA O NUMERO DA POSICAO DO COMBO DE DIA, MES, ANO */
- set(App->JanelaGeracaoQuery, MUIA_Window_Open, TRUE);
- set(App->GaugeQuery, MUIA_Gauge_Current, 5);
- set(App->GaugeQuery, MUIA_Gauge_InfoText, TMsg(App->Msg26));
-
- get(App->TextAno2, MUIA_String_Contents, &ano);
- get(App->ComboMes2, MUIA_Text_Contents, &mes);
- get(App->PrefsFreeHInicio, MUIA_String_Contents, &horainicio);
- get(App->PrefsFreeHFim, MUIA_String_Contents, &horafim);
- get(App->PrefsDiaInicial, MUIA_String_Contents, &diax);
-
- sprintf(mesdes, Corta(mes, ' ', 0));
- sprintf(mesdes2, Corta(mes, ' ', 1));
-
- /* CARREGA VARIAVEIS DE PARA LEITURA DOS ARQUIVOS */
- sprintf(freeout, "%s/Freedom.Out", database);
- set(App->GaugeQuery, MUIA_Gauge_Current, 15);
- sprintf(teste, "%s.%s", mesdes, ano);
- sprintf(freein, "%s/Freedom.%s.%s", database, mesdes, ano);
-
- if( ((!(strcmp(horainicio, "")) && !(strcmp(horafim, ""))) ||
- (!(strcmp(horainicio, "00:00:00")) && !(strcmp(horafim, "00:00:00")))) && (atoi(diax) <= 1) )
- {
- FiltraCampoParaArquivoFREE(teste, freein, "t:freedom.intmp", ',', 1, '.');
- FiltraCampoParaArquivoFREE(teste, freeout, "t:freedom.outtmp", ',', 1, '.');
- }
- else
- {
- sprintf(data1, "%s.%s", diax, teste);
- x = atoi(diax);
- x--;
- if(x < 1)
- x = 31;
- sprintf(data2, "%d.%s", x, teste);
-
- if(atoi(diax) > 1)
- {
- strcpy(data2, ArrumaDataHora(SomaDiminuiMes(data2, 1), '.'));
- /* PREPARA O ARQUIVO DE LEITURA */
- sprintf(arquivo1, "%s/Freedom.%s", database, AposCaracter(data1, '.', 1));
- sprintf(arquivo2, "%s/Freedom.%s", database, AposCaracter(data2, '.', 1));
- CopiaArquivo(arquivo1, "T:Freedom.InTmp");
- InsereArquivo(arquivo2, "T:Freedom.InTmp");
- strcpy(freein, "T:Freedom.InTmp");
- }
- SelecionaIntervaloCampo(freein, "T:Freedom.InTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- SelecionaIntervaloCampo(freeout, "T:Freedom.OutTmp", "Ram:Freedom.Temp", data1, data2, horainicio, horafim);
- }
- sprintf(teste, "%s %s", mesdes2, ano);
- GravaRegistroDB("t:Freedom.Date", teste, "date", "w");
- SemanaCount("t:Freedom.InTmp");
- return NULL;
- }
-
- APTR CarregaRates( struct Hook *a0, APTR a2, APTR a1 )
- {
- char teste[256], teste2[256],
- senha1[256], senha2[256], senhatmp[256], *regnumber2,
- *regemail, *regnumber, *regname, *regorg, *regcountry;
- int registro = 0;
-
- /* LIMPA OS VALORES */
- set(App->Edt300, MUIA_Text_Contents, "0");
- set(App->Edt2400, MUIA_Text_Contents, "0");
- set(App->Edt9600, MUIA_Text_Contents, "0");
- set(App->Edt14400, MUIA_Text_Contents, "0");
- set(App->Edt16800, MUIA_Text_Contents, "0");
- set(App->Edt19200, MUIA_Text_Contents, "0");
- set(App->Edt21600, MUIA_Text_Contents, "0");
- set(App->Edt24000, MUIA_Text_Contents, "0");
- set(App->Edt26400, MUIA_Text_Contents, "0");
- set(App->Edt28800, MUIA_Text_Contents, "0");
- set(App->Edt30666, MUIA_Text_Contents, "0");
- set(App->Edt32000, MUIA_Text_Contents, "0");
- set(App->Edt31200, MUIA_Text_Contents, "0");
- set(App->Edt31250, MUIA_Text_Contents, "0");
- set(App->Edt33600, MUIA_Text_Contents, "0");
- set(App->Edt38400, MUIA_Text_Contents, "0");
- set(App->Edt45333, MUIA_Text_Contents, "0");
- set(App->Edt46666, MUIA_Text_Contents, "0");
- set(App->Edt48000, MUIA_Text_Contents, "0");
- set(App->Edt49333, MUIA_Text_Contents, "0");
- set(App->Edt50666, MUIA_Text_Contents, "0");
- set(App->Edt52000, MUIA_Text_Contents, "0");
- set(App->Edt57600, MUIA_Text_Contents, "0");
- set(App->Edt64000, MUIA_Text_Contents, "0");
-
- /* TESTA SE O ARQUIVO RATES EXISTE */
- if(!(ExisteArquivo("t:freedom.rates")))
- {
- /* FILE FOR IMPORTING NOT FOUND */
- set(App->JanelaRates, MUIA_Window_Open, FALSE);
- MUI_Request(App->App, 0, 0, 0, TMsg(App->Msg18), TMsg(App->Msg94));
- return NULL;
- }
-
- /* ROTINA QUE TESTA O TIPO DE REGISTRO */
- get(App->RegisterName, MUIA_String_Contents, ®name);
- get(App->RegisterOrganization, MUIA_String_Contents, ®org);
- get(App->RegisterEmail, MUIA_String_Contents, ®email);
- get(App->RegisterCountry, MUIA_String_Contents, ®country);
- get(App->RegisterKeyReal, MUIA_String_Contents, ®number2);
- get(App->RegisterKey, MUIA_String_Contents, ®number);
-
- strcpy(senha1, AsciiString(regnumber, 69));
- strcpy(senha2, AsciiString(regnumber2, 96));
- sprintf(senhatmp, "%s%s%s", regname, regemail, regcountry);
- strcpy(senhatmp, CriptografiaSimples(senhatmp, 0));
- if(!strcmp(senha1, senhatmp))
- registro = 1;
- if(!strcmp(senha1, senhatmp) && !strcmp(senha2, senhatmp))
- registro = 2;
- if(!strcmp(regnumber, ""))
- registro = 0;
-
- /* CARREGA OS RATES DO ARQUIVO PARA A TELA */
- if(registro == 2)
- set(App->Edt300, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "300"));
- else
- set(App->Edt300, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt2400, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "2400"));
- else
- set(App->Edt2400, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt9600, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "9600"));
- else
- set(App->Edt9600, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt14400, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "14400"));
- else
- set(App->Edt14400, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt16800, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "16800"));
- else
- set(App->Edt16800, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt19200, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "19200"));
- else
- set(App->Edt19200, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt21600, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "21600"));
- else
- set(App->Edt21600, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt24000, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "24000"));
- else
- set(App->Edt24000, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt26400, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "26400"));
- else
- set(App->Edt26400, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt28800, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "28800"));
- else
- set(App->Edt28800, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt31200, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "31200"));
- else
- set(App->Edt31200, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt31250, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "31250"));
- else
- set(App->Edt31250, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt33600, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "33600"));
- else
- set(App->Edt33600, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt38400, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "38400"));
- else
- set(App->Edt38400, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt57600, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "57600"));
- else
- set(App->Edt57600, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt64000, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "64000"));
- else
- set(App->Edt64000, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt30666, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "30666"));
- else
- set(App->Edt30666, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt32000, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "32000"));
- else
- set(App->Edt32000, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt50666, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "50666"));
- else
- set(App->Edt50666, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt32000, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "32000"));
- else
- set(App->Edt32000, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt45333, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "45333"));
- else
- set(App->Edt45333, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt46666, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "46666"));
- else
- set(App->Edt46666, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt48000, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "48000"));
- else
- set(App->Edt48000, MUIA_Text_Contents, "REALREG");
-
- if(registro == 2)
- set(App->Edt49333, MUIA_Text_Contents, LeRegistroDB("t:freedom.rates", "49333"));
- else
- set(App->Edt49333, MUIA_Text_Contents, "REALREG");
-
- /* COLOCA O TITULO */
- strcpy(teste, LeRegistroDB("t:Freedom.Date", "date"));
- sprintf(teste2, "%s", teste);
- set(App->RatesLabel, MUIA_Text_Contents, teste2);
- return NULL;
- }
-
- APTR AumentaMes( struct Hook *a0, APTR a2, APTR a1 )
- {
- long x = 0;
- get(App->ComboMes, MUIA_Cycle_Active, &x);
- if(x >= 11)
- x = 0;
- else
- x++;
- set(App->ComboMes, MUIA_Cycle_Active, x);
- return NULL;
- }
-
- APTR DiminuiMes( struct Hook *a0, APTR a2, APTR a1 )
- {
- long x = 0;
- get(App->ComboMes, MUIA_Cycle_Active, &x);
- if(x <= 0)
- x = 11;
- else
- x--;
- set(App->ComboMes, MUIA_Cycle_Active, x);
- return NULL;
- }
-
- APTR AbreHtml( struct Hook *a0, APTR a2, APTR a1 )
- {
- /* FUNCAO QUE ABRE O BROWSER COM O REPORT */
- char *browser, teste[256];
-
- get(App->Browser, MUIA_String_Contents, &browser);
- if(ExisteArquivo("T:Freedom.HTML"))
- {
- sprintf(teste, "C:Run >NIL: %s file://T:Freedom.HTML", browser);
- system(teste);
- }
- return NULL;
- }
-