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
/
telaadmin.pas
135 lines (109 loc) · 3.03 KB
/
telaadmin.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
unit telaAdmin;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ExtCtrls, telaInseriNotas;
type
{ TfrAdmin }
TfrAdmin = class(TForm)
btStatus: TButton;
btInseriNotas: TButton;
btSairAdmin: TButton;
edSaquesCaixa: TEdit;
edSaldoCaixa: TEdit;
edTransferenciaCaixa: TEdit;
Image1: TImage;
Image2: TImage;
Image3: TImage;
lbSaquesCaixa: TLabel;
lbTransferenciaCaixa: TLabel;
lcSaldoCaixa: TLabel;
procedure btInseriNotasClick(Sender: TObject);
procedure btSairAdminClick(Sender: TObject);
procedure btStatusClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure FormShow(Sender: TObject);
procedure nSaques();
procedure edSaldoCaixaChange(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
frAdmin: TfrAdmin;
resultSaldo :Double;
implementation
{$R *.lfm}
uses conexaoDB, funcoes, telaInicial, LimparForms, telaLogin, FuncoesDeSaque, FuncoesDeTransferencia;
procedure TfrAdmin.edSaldoCaixaChange(Sender: TObject);
begin
end;
procedure TfrAdmin.btStatusClick(Sender: TObject);
begin
case caixaStatus of
2: begin
DB.SQLQuery1.SQL.Text:='UPDATE caixa SET status=1 WHERE idcaixa =1';
DB.SQLTransaction1.Active:=false;
DB.SQLTransaction1.StartTransaction;
DB.SQLQuery1.ExecSQL;
DB.SQLTransaction1.Commit;
//if somaSaldo <300 then
// ShowMessage('Saldo baixo ou inexistente');
//ShowMessage('Caixa Ativo');
btStatus.Font.Size:=30;
btStatus.Caption:='Desativar Caixa';
form1.atualizaStatus();
end;
1: begin
DB.SQLQuery1.SQL.Text:='UPDATE caixa SET status=0 WHERE idcaixa =1';
DB.SQLTransaction1.Active:=false;
DB.SQLTransaction1.StartTransaction;
DB.SQLQuery1.ExecSQL;
DB.SQLTransaction1.Commit;
//ShowMessage('Caixa Desativado');
btStatus.Caption:='Ativar Caixa';
form1.atualizaStatus();
end;
end;
end;
procedure TfrAdmin.FormKeyPress(Sender: TObject; var Key: char);
begin
if (Key = #088) OR (Key = #120) then
btSairAdminClick(self);
if (Key = #065) OR (Key = #097) then
btStatusClick(self);
if (Key = #078) OR (Key = #110) then
btInseriNotasClick(self);
end;
procedure TfrAdmin.FormShow(Sender: TObject);
begin
frAdmin.edSaquesCaixa.Text:=IntToStr(contaSaque);
edTransferenciaCaixa.Text:=IntToStr(contaTransferencia);
edSaldoCaixa.Text:= 'R$ '+FloatToStr(somaSaldo())+',00';
if caixaStatus = 2 then
btStatus.Caption:='Ativar Caixa'
else
begin
btStatus.Font.Size:=30;
btStatus.Caption:='Desativar Caixa';
end;
end;
procedure TfrAdmin.btInseriNotasClick(Sender: TObject);
begin
frInserirNotas.Show;
end;
procedure TfrAdmin.btSairAdminClick(Sender: TObject);
begin
limparTelaLogin();
limparDadosUsuario();
frAdmin.SetVisible(False);
frAdmin.Close;
Form2.Close;
Form1.Show;
end;
procedure TfrAdmin.nSaques();
begin
end;
end.