/
AGraficosFluxo.pas
158 lines (136 loc) · 4.49 KB
/
AGraficosFluxo.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
unit AGraficosFluxo;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, formularios,
Graficos, Db, DBTables, StdCtrls, Buttons, Componentes1, ExtCtrls,
PainelGradiente;
type
TFGraficoFluxo = class(TFormulario)
PainelGradiente1: TPainelGradiente;
PanelColor1: TPanelColor;
PanelColor2: TPanelColor;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
aux: TQuery;
Graficos: TGraficosTrio;
GraficosLinhas: TGraficosLinhas;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
public
procedure CarregaTabFluxo( SQLApagar, SQLReceber : String; DiasAno : Integer);
end;
var
FGraficoFluxo: TFGraficoFluxo;
implementation
uses APrincipal;
{$R *.DFM}
{ ****************** Na criação do Formulário ******************************** }
procedure TFGraficoFluxo.FormCreate(Sender: TObject);
begin
{ abre tabelas }
{ chamar a rotina de atualização de menus }
end;
{ ******************* Quando o formulario e fechado ************************** }
procedure TFGraficoFluxo.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := CaFree;
end;
procedure TFGraficoFluxo.CarregaTabFluxo( SQLApagar, SQLReceber : String; DiasAno : Integer);
var
valoresAPagar : array[1..31] of double;
valoresAReceber : array[1..31] of double;
laco : integer;
begin
aux.close;
aux.sql.Clear;
aux.sql.Add(SqlApagar);
aux.open;
aux.First;
while not aux.Eof do
begin
valoresApagar[aux.fieldByName('mes').AsInteger] := aux.fieldByName('valor').AsCurrency;
aux.Next;
end;
aux.close;
aux.sql.Clear;
aux.sql.Add(SqlReceber);
aux.open;
aux.First;
while not aux.Eof do
begin
valoresAReceber[aux.fieldByName('mes').AsInteger] := aux.fieldByName('valor').AsCurrency;
aux.Next;
end;
aux.close;
aux.RequestLive := true;
aux.sql.Clear;
aux.sql.Add('select * from CadDadosFluxo order by i_dia_mes ');
aux.open;
aux.first;
for laco := 1 to DiasAno do
begin
aux.edit;
aux.FieldByName('N_VLR_APG').Value := ValoresAPagar[laco];
aux.FieldByName('N_VLR_REC').Value := ValoresAReceber[laco];
aux.post;
aux.next;
end;
aux.close;
aux.RequestLive := false;
self.ShowModal;
end;
procedure TFGraficoFluxo.BitBtn4Click(Sender: TObject);
begin
close;
end;
procedure TFGraficoFluxo.BitBtn1Click(Sender: TObject);
begin
graficos.info.ComandoSQL := 'select * from CadDadosFluxo where i_dia_mes < 13 order by i_dia_mes';
graficos.info.CampoRotulo := 'i_dia_mes';
graficos.info.CampoValor := 'n_vlr_apg';
graficos.info.TituloGrafico := 'Fluxo Mensal';
graficos.info.RodapeGrafico := 'uuuuu';
graficos.info.TituloFormulario := 'Gráfico do Fluxo Mensal';
graficos.info.TituloY := 'Valores por mes';
graficos.info.TituloX := 'Meses';
graficos.execute;
end;
procedure TFGraficoFluxo.BitBtn2Click(Sender: TObject);
begin
graficos.info.ComandoSQL := 'select * from CadDadosFluxo where i_dia_mes < 13 order by i_dia_mes';
graficos.info.CampoRotulo := 'i_dia_mes';
graficos.info.CampoValor := 'n_vlr_rec';
graficos.info.TituloGrafico := 'Fluxo Mensal';
graficos.info.RodapeGrafico := 'uuuuu';
graficos.info.TituloFormulario := 'Gráfico do Fluxo Mensal';
graficos.info.TituloY := 'Valores por mes';
graficos.info.TituloX := 'Meses';
graficos.execute;
end;
procedure TFGraficoFluxo.BitBtn3Click(Sender: TObject);
begin
GraficosLinhas.info.ComandoSQL[0] := 'select * from CadDadosFluxo where i_dia_mes < 13 order by i_dia_mes';
GraficosLinhas.info.ComandoSQL[1] := 'select * from CadDadosFluxo where i_dia_mes < 13 order by i_dia_mes';
GraficosLinhas.info.CampoRotulo[0] := 'i_dia_mes';
GraficosLinhas.info.CampoRotulo[1] := 'i_dia_mes';
GraficosLinhas.info.CampoValor[0] := 'n_vlr_apg';
GraficosLinhas.info.CampoValor[1] := 'n_vlr_rec';
GraficosLinhas.info.NomeLinha[0] := 'Contas a Pagar';
GraficosLinhas.info.NomeLinha[1] := 'Contas a Receber';
GraficosLinhas.info.TituloGrafico := 'Avalição Contas a Pagar e Receber';
GraficosLinhas.info.RodapeGrafico := 'uuuu';
GraficosLinhas.info.TituloFormulario := 'Gráficos Contas';
GraficosLinhas.info.TituloY := 'Valores por mes';
GraficosLinhas.info.TituloX := 'Meses';
GraficosLinhas.execute;
end;
Initialization
RegisterClasses([TFGraficoFluxo]);
end.