This repository has been archived by the owner on Aug 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtelainicial.pas
205 lines (183 loc) · 4.11 KB
/
telainicial.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
unit telaInicial;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
btDeposito: TButton;
lbError: TLabel;
lbInsiraCartao: TLabel;
lbNota50: TLabel;
lbNota100: TLabel;
lbNota20: TLabel;
lbNota10: TLabel;
lbNota5: TLabel;
lbNota2: TLabel;
lbNotasDisponiveis: TLabel;
SaqueSem: TButton;
status: TPanel;
procedure btDepositoClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure atualizaStatus();
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormShow(Sender: TObject);
procedure stSaque();
procedure SaqueSemClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses conexaoDB,telaLogin, funcoes, telaDeposito;
{ TForm1 }
function notasTelaInicial():integer;
begin
if getNotas100() > 1 then
begin
Application.ProcessMessages;
Form1.lbNota100.Caption:='R$ 100';
end
else
begin
Application.ProcessMessages;
Form1.lbNota100.Caption:='';
end;
if getNotas50() > 1 then
begin
Application.ProcessMessages;
Form1.lbNota50.Caption:='R$ 50';
end
else
begin
Application.ProcessMessages;
Form1.lbNota50.Caption:='';
end;
if getNotas20() > 1 then
begin
Application.ProcessMessages;
Form1.lbNota20.Caption:='R$ 20';
end
else
begin
Application.ProcessMessages;
Form1.lbNota20.Caption:='';
end;
if getNotas10() > 1 then
begin
Application.ProcessMessages;
Form1.lbNota10.Caption:='R$ 10';
end
else
begin
Application.ProcessMessages;
Form1.lbNota10.Caption:='';
end;
if getNotas5() > 1 then
begin
Application.ProcessMessages;
Form1.lbNota5.Caption:='R$ 5';
end
else
begin
Application.ProcessMessages;
Form1.lbNota5.Caption:='';
end;
if getNotas2() > 1 then
begin
Application.ProcessMessages;
Form1.lbNota2.Caption:='R$ 2';
end
else
begin
Application.ProcessMessages;
Form1.lbNota2.Caption:='';
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//atualizaStatus(Sender: TObject);
end;
procedure TForm1.btDepositoClick(Sender: TObject);
begin
if caixaStatus() = 1 then
begin
frDeposito.Show;
Form1.Close;
end
else
begin
lbError.Caption:='Caixa Inativo. Por Favor Utilize outro Caixa.';
Application.ProcessMessages;
Sleep(3000);
lbError.Caption:='';
end;
end;
procedure TForm1.atualizaStatus();
begin
case caixaStatus() of
1:status.Visible:= false;
2:begin
status.Color := clRed;
status.Caption:='Caixa Em Manutencao';
end;
end;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
);
begin
end;
procedure TForm1.FormShow(Sender: TObject);
begin
stSaque();
notasTelaInicial();
// atualizaStatus()
//caixaStatus();
case caixaStatus() of
1:begin
status.Visible:= false;
lbNotasDisponiveis.Show;
lbNota2.Show;
lbNota5.Show;
lbNota10.Show;
lbNota20.Show;
lbNota50.Show;
lbNota100.Show;
btDeposito.Show;
end;
2:begin
lbNotasDisponiveis.Hide;
lbNota2.Hide;
lbNota5.Hide;
lbNota10.Hide;
lbNota20.Hide;
lbNota50.Hide;
lbNota100.Hide;
btDeposito.Hide;
Application.ProcessMessages;
status.Visible:=True;
status.Color := clRed;
status.Caption:='Caixa Em Manutencao';
end;
end;
end;
procedure TForm1.SaqueSemClick(Sender: TObject);
begin
Form2.Show;
Form1.Close;
end;
procedure TForm1.stSaque();
begin
if statusSaque=1 then
Form1.lbNotasDisponiveis.Caption:=' Opção de saque Indisponivel'
else
Form1.atualizaStatus();
end;
end.