Revisión | 15 (tree) |
---|---|
Tiempo | 2020-03-04 02:54:21 |
Autor | ![]() |
Recursos alterados
Recursos adicionados
Um novo form temporizado para exibir informações foi criado
Hints do form principal habilitados
A linha informativa de data teve seu tamanho e sua cor alterados
A funcionalidade de sincronização de status foi criada
@@ -12,7 +12,8 @@ | ||
12 | 12 | UConfiguracoes in '..\src\cico\UConfiguracoes.pas', |
13 | 13 | UCiCo in '..\src\lib\UCiCo.pas', |
14 | 14 | UFORMPergunta in '..\src\cico\UFORMPergunta.pas' {FORMPergunta}, |
15 | - UEuJaExisto in '..\src\cico\UEuJaExisto.pas' {FORMEuJaExisto}; | |
15 | + UEuJaExisto in '..\src\cico\UEuJaExisto.pas' {FORMEuJaExisto}, | |
16 | + UFORMInformacao in '..\src\cico\UFORMInformacao.pas' {FORMInformacao}; | |
16 | 17 | |
17 | 18 | {$R *.res} |
18 | 19 |
@@ -5,7 +5,7 @@ | ||
5 | 5 | <FrameworkType>VCL</FrameworkType> |
6 | 6 | <MainSource>CiCo.dpr</MainSource> |
7 | 7 | <Base>True</Base> |
8 | - <Config Condition="'$(Config)'==''">Debug</Config> | |
8 | + <Config Condition="'$(Config)'==''">Release</Config> | |
9 | 9 | <Platform Condition="'$(Platform)'==''">Win32</Platform> |
10 | 10 | <TargetedPlatforms>1</TargetedPlatforms> |
11 | 11 | <AppType>Application</AppType> |
@@ -124,6 +124,9 @@ | ||
124 | 124 | <DCCReference Include="..\src\cico\UEuJaExisto.pas"> |
125 | 125 | <Form>FORMEuJaExisto</Form> |
126 | 126 | </DCCReference> |
127 | + <DCCReference Include="..\src\cico\UFORMInformacao.pas"> | |
128 | + <Form>FORMInformacao</Form> | |
129 | + </DCCReference> | |
127 | 130 | <BuildConfiguration Include="Release"> |
128 | 131 | <Key>Cfg_2</Key> |
129 | 132 | <CfgParent>Base</CfgParent> |
@@ -57,8 +57,8 @@ | ||
57 | 57 | implementation |
58 | 58 | |
59 | 59 | uses |
60 | - UFORMPrincipal, UConfiguracoes, Vcl.Graphics, Vcl.Forms, UCiCo, StrUtils, | |
61 | - UEuJaExisto; | |
60 | + UFORMPrincipal, UConfiguracoes, Vcl.Graphics, Vcl.Forms, System.UITypes, | |
61 | + UCiCo, StrUtils, UEuJaExisto; | |
62 | 62 | |
63 | 63 | {%CLASSGROUP 'Vcl.Controls.TControl'} |
64 | 64 |
@@ -200,7 +200,9 @@ | ||
200 | 200 | begin |
201 | 201 | Data := FormatDateTime('dddd, dd "de" mmmm "de" yyyy hh:nn:ss ',now); |
202 | 202 | Data[1] := UpperCase(Data[1])[1]; |
203 | - FORMPrincipal.LABEInfo.Caption := FLoggedUserName + #13#10 + Data; | |
203 | + | |
204 | + FORMPrincipal.LABEInfo.Caption := FLoggedUserName; | |
205 | + FORMPrincipal.LABEData.Caption := Data; | |
204 | 206 | Reset; |
205 | 207 | end; |
206 | 208 |
@@ -217,47 +219,52 @@ | ||
217 | 219 | CheckInCheckOutInfo: TCheckInChecOutInfo; |
218 | 220 | LastCheckInCheckOut: TCheckInChecOut; |
219 | 221 | begin |
220 | - ZeroMemory(@LastCheckInCheckOut,SizeOf(TCheckInChecOut)); | |
221 | - CheckInCheckOutInfo := CurrentStatus(FORMPrincipal.Handle,Configuracoes.Ambiente = aProducao,ACPF,APassaword,Configuracoes.Matricula); | |
222 | + Screen.Cursor := crHourglass; | |
223 | + try | |
224 | + ZeroMemory(@LastCheckInCheckOut,SizeOf(TCheckInChecOut)); | |
225 | + CheckInCheckOutInfo := CurrentStatus(FORMPrincipal.Handle,Configuracoes.Ambiente = aProducao,ACPF,APassaword,Configuracoes.Matricula); | |
222 | 226 | |
223 | - FLoggedUserName := CheckInCheckOutInfo.UserName; | |
227 | + FLoggedUserName := CheckInCheckOutInfo.UserName; | |
224 | 228 | |
225 | - FORMPrincipal.ValueListEditor1.Strings.Clear; | |
229 | + FORMPrincipal.ValueListEditor1.Strings.Clear; | |
226 | 230 | |
227 | - if Length(CheckInCheckOutInfo.History) > 0 then | |
228 | - begin | |
229 | - for LastCheckInCheckOut in CheckInCheckOutInfo.History do | |
230 | - FORMPrincipal.ValueListEditor1.Strings.AddPair(IfThen(LastCheckInCheckOut.Direction = 'ci','ENTRADA','SAÍDA'),FormatDateTime('hh:nn',LastCheckInCheckOut.Moment)); | |
231 | + if Length(CheckInCheckOutInfo.History) > 0 then | |
232 | + begin | |
233 | + for LastCheckInCheckOut in CheckInCheckOutInfo.History do | |
234 | + FORMPrincipal.ValueListEditor1.Strings.AddPair(IfThen(LastCheckInCheckOut.Direction = 'ci','ENTRADA','SAÍDA'),FormatDateTime('hh:nn',LastCheckInCheckOut.Moment)); | |
231 | 235 | |
232 | - LastCheckInCheckOut := CheckInCheckOutInfo.History[High(CheckInCheckOutInfo.History)]; | |
233 | - end; | |
236 | + LastCheckInCheckOut := CheckInCheckOutInfo.History[High(CheckInCheckOutInfo.History)]; | |
237 | + end; | |
234 | 238 | |
235 | - FORMPrincipal.PANEAdvice.Hide; // Sempre esconde este Panel | |
239 | + FORMPrincipal.PANEAdvice.Hide; // Sempre esconde este Panel | |
236 | 240 | |
237 | - // --------------------------------------------------------------------------- | |
238 | - // Quando se usa os VCL Styles os botões não perdem o foco, fazendo com que | |
239 | - // mesmo os botões desabilitados permaneçam com um estilo focado, o que é | |
240 | - // errado. Para contornar este bug, primeiramente habilitamos os dois botões, | |
241 | - // para que o foco possa sair deles e enviamos o foco para um controle neutro, | |
242 | - // no caso o TValueListEditor. Só depois disso é que os botões são habilitados | |
243 | - // ou desabilitados | |
244 | - FORMPrincipal.BUTNEntrada.Enabled := True; | |
245 | - FORMPrincipal.BUTNSaida.Enabled := True; | |
241 | + // --------------------------------------------------------------------------- | |
242 | + // Quando se usa os VCL Styles os botões não perdem o foco, fazendo com que | |
243 | + // mesmo os botões desabilitados permaneçam com um estilo focado, o que é | |
244 | + // errado. Para contornar este bug, primeiramente habilitamos os dois botões, | |
245 | + // para que o foco possa sair deles e enviamos o foco para um controle neutro, | |
246 | + // no caso o TValueListEditor. Só depois disso é que os botões são habilitados | |
247 | + // ou desabilitados | |
248 | + FORMPrincipal.BUTNEntrada.Enabled := True; | |
249 | + FORMPrincipal.BUTNSaida.Enabled := True; | |
246 | 250 | |
247 | - if FORMPrincipal.Visible then | |
248 | - FORMPrincipal.ValueListEditor1.SetFocus; | |
251 | + if FORMPrincipal.Visible then | |
252 | + FORMPrincipal.ValueListEditor1.SetFocus; | |
249 | 253 | |
250 | - FORMPrincipal.BUTNEntrada.Enabled := (LastCheckInCheckOut.Direction = '') or (LastCheckInCheckOut.Direction = 'co'); | |
251 | - FORMPrincipal.BUTNSaida.Enabled := not FORMPrincipal.BUTNEntrada.Enabled; | |
252 | - // --------------------------------------------------------------------------- | |
254 | + FORMPrincipal.BUTNEntrada.Enabled := (LastCheckInCheckOut.Direction = '') or (LastCheckInCheckOut.Direction = 'co'); | |
255 | + FORMPrincipal.BUTNSaida.Enabled := not FORMPrincipal.BUTNEntrada.Enabled; | |
256 | + // --------------------------------------------------------------------------- | |
253 | 257 | |
254 | - FORMPrincipal.BUTNEntrada.Caption := 'ENTRADA'; | |
255 | - if not FORMPrincipal.BUTNEntrada.Enabled then | |
256 | - FORMPrincipal.BUTNEntrada.Caption := 'ENTRADA' + IfThen(LastCheckInCheckOut.Moment = 0,'',' (' + FormatDateTime('hh:nn',LastCheckInCheckOut.Moment) + ')'); | |
258 | + FORMPrincipal.BUTNEntrada.Caption := 'ENTRADA'; | |
259 | + if not FORMPrincipal.BUTNEntrada.Enabled then | |
260 | + FORMPrincipal.BUTNEntrada.Caption := 'ENTRADA' + IfThen(LastCheckInCheckOut.Moment = 0,'',' (' + FormatDateTime('hh:nn',LastCheckInCheckOut.Moment) + ')'); | |
257 | 261 | |
258 | - FORMPrincipal.BUTNSaida.Caption := 'SAÍDA'; | |
259 | - if not FORMPrincipal.BUTNSaida.Enabled then | |
260 | - FORMPrincipal.BUTNSaida.Caption := 'SAÍDA' + IfThen(LastCheckInCheckOut.Moment = 0,'',' (' + FormatDateTime('hh:nn',LastCheckInCheckOut.Moment) + ')'); | |
262 | + FORMPrincipal.BUTNSaida.Caption := 'SAÍDA'; | |
263 | + if not FORMPrincipal.BUTNSaida.Enabled then | |
264 | + FORMPrincipal.BUTNSaida.Caption := 'SAÍDA' + IfThen(LastCheckInCheckOut.Moment = 0,'',' (' + FormatDateTime('hh:nn',LastCheckInCheckOut.Moment) + ')'); | |
265 | + finally | |
266 | + Screen.Cursor := crDefault; | |
267 | + end; | |
261 | 268 | end; |
262 | 269 | |
263 | 270 | //uses |
@@ -0,0 +1,78 @@ | ||
1 | +unit UFORMInformacao; | |
2 | + | |
3 | +interface | |
4 | + | |
5 | +uses | |
6 | + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, | |
7 | + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, | |
8 | + Vcl.Imaging.pngimage; | |
9 | + | |
10 | +type | |
11 | + TFORMInformacao = class(TForm) | |
12 | + BUTNOk: TButton; | |
13 | + IMAG: TImage; | |
14 | + LABE: TLabel; | |
15 | + TMER: TTimer; | |
16 | + procedure FormClose(Sender: TObject; var Action: TCloseAction); | |
17 | + procedure TMERTimer(Sender: TObject); | |
18 | + procedure FormCreate(Sender: TObject); | |
19 | + procedure FormShow(Sender: TObject); | |
20 | + private | |
21 | + { Private declarations } | |
22 | + FTimeOut: Cardinal; | |
23 | + public | |
24 | + { Public declarations } | |
25 | + class function ShowMe(AOwner: TForm; ATitle: String; AText: String; ATimeOut: Byte): TModalResult; | |
26 | + end; | |
27 | + | |
28 | +implementation | |
29 | + | |
30 | +{$R *.dfm} | |
31 | + | |
32 | +{ TFORMPergunta } | |
33 | + | |
34 | +procedure TFORMInformacao.FormClose(Sender: TObject; var Action: TCloseAction); | |
35 | +begin | |
36 | + Action := caFree; | |
37 | +end; | |
38 | + | |
39 | +procedure TFORMInformacao.FormCreate(Sender: TObject); | |
40 | +begin | |
41 | + FTimeOut := 0; | |
42 | +end; | |
43 | + | |
44 | +procedure TFORMInformacao.FormShow(Sender: TObject); | |
45 | +begin | |
46 | + if FTimeOut > 0 then | |
47 | + begin | |
48 | + BUTNOk.Caption := 'OK (' + (FTimeOut div 1000).ToString + ')'; | |
49 | + FTimeOut := GetTickCount + FTimeOut + 1000; | |
50 | + end; | |
51 | + | |
52 | + TMER.Enabled := FTimeOut > 0; | |
53 | +end; | |
54 | + | |
55 | +class function TFORMInformacao.ShowMe(AOwner: TForm; ATitle, AText: String; ATimeOut: Byte): TModalResult; | |
56 | +begin | |
57 | + with Self.Create(AOwner) do | |
58 | + begin | |
59 | + Caption := ATitle; | |
60 | + LABE.Caption := AText; | |
61 | + FTimeOut := ATimeOut * 1000; | |
62 | + Result := ShowModal; | |
63 | + end; | |
64 | +end; | |
65 | + | |
66 | +procedure TFORMInformacao.TMERTimer(Sender: TObject); | |
67 | +begin | |
68 | + if GetTickCount > FTimeOut then | |
69 | + begin | |
70 | + TMER.Enabled := False; | |
71 | + BUTNOk.Caption := 'OK (!)'; | |
72 | + BUTNOk.Click; | |
73 | + end | |
74 | + else | |
75 | + BUTNOk.Caption := 'OK (' + ((FTimeOut - GetTickCount) div 1000).ToString + ')'; | |
76 | +end; | |
77 | + | |
78 | +end. |
@@ -43,6 +43,8 @@ | ||
43 | 43 | BUTNSaida: TPngBitBtn; |
44 | 44 | SPED: TSpinEdit; |
45 | 45 | Label4: TLabel; |
46 | + PNBBAtualizar: TPngBitBtn; | |
47 | + LABEData: TLabel; | |
46 | 48 | procedure BUTNEntradaClick(Sender: TObject); |
47 | 49 | procedure BUTNSaidaClick(Sender: TObject); |
48 | 50 | procedure FormCreate(Sender: TObject); |
@@ -52,6 +54,7 @@ | ||
52 | 54 | procedure FormClose(Sender: TObject; var Action: TCloseAction); |
53 | 55 | procedure Button1Click(Sender: TObject); |
54 | 56 | procedure DateTimePicker1Change(Sender: TObject); |
57 | + procedure PNBBAtualizarClick(Sender: TObject); | |
55 | 58 | private |
56 | 59 | { Private declarations } |
57 | 60 | FAcaoAutomatica: Boolean; |
@@ -70,7 +73,7 @@ | ||
70 | 73 | implementation |
71 | 74 | |
72 | 75 | uses |
73 | - UConfiguracoes, UCiCo, UFORMPergunta; | |
76 | + UConfiguracoes, UCiCo, UFORMPergunta, UFORMInformacao; | |
74 | 77 | |
75 | 78 | {$R *.dfm} |
76 | 79 |
@@ -102,11 +105,11 @@ | ||
102 | 105 | |
103 | 106 | if CheckIn(Self.Handle,Configuracoes.Ambiente = aProducao,DAMOPrincipal.LimparCPF(KRLECPF.Text),LAEDSenha.Text,Configuracoes.Matricula) then |
104 | 107 | begin |
105 | - Application.MessageBox('Entrada registrada com sucesso','Sucesso!',MB_ICONINFORMATION); | |
108 | + TFORMInformacao.ShowMe(Self,'Sucesso!','Entrada registrada com sucesso',Configuracoes.TempoParaSim); | |
106 | 109 | DAMOPrincipal.CheckStatusAndUpdateGUI(DAMOPrincipal.LimparCPF(KRLECPF.Text),LAEDSenha.Text); |
107 | 110 | end |
108 | 111 | else |
109 | - Application.MessageBox('Não foi possível entrar','Falha!',MB_ICONINFORMATION); | |
112 | + Application.MessageBox('Não foi possível entrar','Falha!',MB_ICONERROR); | |
110 | 113 | end; |
111 | 114 | |
112 | 115 | procedure TFORMPrincipal.BUTNSaidaClick(Sender: TObject); |
@@ -117,11 +120,11 @@ | ||
117 | 120 | |
118 | 121 | if CheckOut(Self.Handle,Configuracoes.Ambiente = aProducao,DAMOPrincipal.LimparCPF(KRLECPF.Text),LAEDSenha.Text,Configuracoes.Matricula) then |
119 | 122 | begin |
120 | - Application.MessageBox('Saída registrada com sucesso','Sucesso!',MB_ICONINFORMATION); | |
123 | + TFORMInformacao.ShowMe(Self,'Sucesso!','Saída registrada com sucesso',Configuracoes.TempoParaSim); | |
121 | 124 | DAMOPrincipal.CheckStatusAndUpdateGUI(DAMOPrincipal.LimparCPF(KRLECPF.Text),LAEDSenha.Text); |
122 | 125 | end |
123 | 126 | else |
124 | - Application.MessageBox('Não foi possível sair','Falha!',MB_ICONINFORMATION); | |
127 | + Application.MessageBox('Não foi possível sair','Falha!',MB_ICONERROR); | |
125 | 128 | end; |
126 | 129 | |
127 | 130 | procedure TFORMPrincipal.Button1Click(Sender: TObject); |
@@ -195,6 +198,7 @@ | ||
195 | 198 | RaiseLastOSError; |
196 | 199 | |
197 | 200 | LABEInfo.Caption := ''; |
201 | + LABEData.Caption := ''; | |
198 | 202 | DAMOPrincipal.ConfigToGUI; |
199 | 203 | DAMOPrincipal.CheckStatusAndUpdateGUI(DAMOPrincipal.LimparCPF(KRLECPF.Text),LAEDSenha.Text); |
200 | 204 | DAMOPrincipal.TMER.Enabled := True; |
@@ -239,6 +243,11 @@ | ||
239 | 243 | TASHCiCo.TabVisible := not TASHConfigs.Visible; |
240 | 244 | end; |
241 | 245 | |
246 | +procedure TFORMPrincipal.PNBBAtualizarClick(Sender: TObject); | |
247 | +begin | |
248 | + DAMOPrincipal.CheckStatusAndUpdateGUI(DAMOPrincipal.LimparCPF(KRLECPF.Text),LAEDSenha.Text); | |
249 | +end; | |
250 | + | |
242 | 251 | // Procedimento de janela da janela invisível. Este procedimento vai manipular |
243 | 252 | // apenas uma mensagem. Todas as outras serão tratadas pelo manipulador padrão |
244 | 253 | // (DefWindowProc) |
@@ -412,7 +412,7 @@ | ||
412 | 412 | |
413 | 413 | procedure ExecuteLogout(AHandle: THandle; AProducao: Boolean); |
414 | 414 | begin |
415 | - InternetSetOption(0, INTERNET_OPTION_END_BROWSER_SESSION, nil, 0); | |
415 | + InternetSetOption(nil, INTERNET_OPTION_END_BROWSER_SESSION, nil, 0); | |
416 | 416 | end; |
417 | 417 | |
418 | 418 | function ConfirmDirection(AHandle: THandle; AProducao: Boolean; AIn: Boolean): Boolean; |