-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPrevisionPresupuestos.pas
165 lines (134 loc) · 4.57 KB
/
PrevisionPresupuestos.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
unit PrevisionPresupuestos;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.StdCtrls, Vcl.ComCtrls,
Vcl.ToolWin, Vcl.Grids, Vcl.DBGrids, rDBGrid, rDBGrid_MS, Vcl.ExtCtrls,DModule1,
RzCmboBx, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, System.DateUtils,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
rImprovedComps;
type
TFPrevisionEjecucion = class(TForm)
ds1: TDataSource;
Panel1: TPanel;
GroupBox2: TGroupBox;
stat1: TStatusBar;
tlb1: TToolBar;
btn1: TToolButton;
btn2: TToolButton;
btn3: TToolButton;
btn5: TToolButton;
ToolButton1: TToolButton;
ToolButton3: TToolButton;
rDBGrid_MS1: TrDBGrid_MS;
GroupBox3: TGroupBox;
rb1: TRadioButton;
rb2: TRadioButton;
rb3: TRadioButton;
rb4: TRadioButton;
rb5: TRadioButton;
rb6: TRadioButton;
rb7: TRadioButton;
rb8: TRadioButton;
rb9: TRadioButton;
rb10: TRadioButton;
rb11: TRadioButton;
rb12: TRadioButton;
GroupBox4: TGroupBox;
LabeledEdit1: TLabeledEdit;
fdtrabajadores: TFDQuery;
rComboBoxEx1: TrComboBoxEx;
procedure ToolButton3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure LabeledEdit1Change(Sender: TObject);
procedure btn3Click(Sender: TObject);
procedure rb1Click(Sender: TObject);
procedure btn5Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
procedure fdprevisionpresupuestosAfterOpen(DataSet: TDataSet) ;
procedure fdprevisionpresupuestosAfterPost(DataSet: TDataSet) ;
procedure fdprevisionpresupuestosAfterDelete(DataSet: TDataSet) ;
procedure fdprevisionpresupuestosFilterRecord(DataSet: TDataSet; var Accept: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FPrevisionEjecucion: TFPrevisionEjecucion;
implementation
uses listalineaspresupuestos;
{$R *.dfm}
procedure TFPrevisionEjecucion.btn1Click(Sender: TObject);
begin
Close;
end;
procedure TFPrevisionEjecucion.btn3Click(Sender: TObject);
var listpresu:Tlistlineaspresupuestos;
begin
listpresu:=Tlistlineaspresupuestos.Create(self);
listpresu.OnClose:=listpresu.FormClose2;
listpresu.ShowModal;
end;
procedure TFPrevisionEjecucion.btn5Click(Sender: TObject);
begin
ds1.DataSet.Delete;
end;
procedure TFPrevisionEjecucion.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
ds1.DataSet.Close;
fdtrabajadores.Close;
Action:=caFree;
end;
procedure TFPrevisionEjecucion.FormCreate(Sender: TObject);
var ano,i:Integer;
begin
for i := YearOf(date)-4 to YearOf(date)+5 do rComboBoxEx1.Items.add(IntToStr(i)) ;
ano:=YearOf(date);
rComboBoxEx1.text:=IntToStr(ano);
ds1.DataSet.AfterOpen:= fdprevisionpresupuestosAfterOpen;
// ds1.DataSet.AfterPost:= fdprevisionpresupuestosAfterPost;
// ds1.DataSet.AfterDelete:=fdprevisionpresupuestosAfterDelete;
// ds1.dataset.onfilterrecord:=fdprevisionpresupuestosFilterRecord;
fdtrabajadores.Active:=True;
ds1.DataSet.Active:=true;
end;
procedure TFPrevisionEjecucion.LabeledEdit1Change(Sender: TObject);
begin
rDBGrid_MS1.DataSource.DataSet.DisableControls;
rDBGrid_MS1.DataSource.DataSet.Filtered:=False;
rDBGrid_MS1.DataSource.DataSet.Filter:='nombre LIKE ''%'+TLabeledEdit(Sender).Text+'%''';
rDBGrid_MS1.DataSource.DataSet.Filtered:=True;
rDBGrid_MS1.DataSource.DataSet.EnableControls;
end;
procedure TFPrevisionEjecucion.rb1Click(Sender: TObject);
begin
ds1.DataSet.Filtered:=False;
ds1.DataSet.Filter:='Month(mesprevision)='+IntToStr((Sender as TRadioButton).Tag)+' and Year(mesprevision)='+rComboBoxEx1.Text;
ds1.DataSet.Filtered:=True;
end;
procedure TFPrevisionEjecucion.ToolButton3Click(Sender: TObject);
begin
DataModule1.rXLSExport1.ExportDBTable(rDBGrid_MS1);
end;
procedure TFPrevisionEjecucion.fdprevisionpresupuestosAfterOpen(DataSet: TDataSet) ;
begin
rDBGrid_MS1.RecalculateSummaryResults(true);
end;
procedure TFPrevisionEjecucion.fdprevisionpresupuestosAfterPost(DataSet: TDataSet) ;
begin
rDBGrid_MS1.RecalculateSummaryResults(true);
end;
procedure TFPrevisionEjecucion.fdprevisionpresupuestosAfterDelete(DataSet: TDataSet) ;
begin
rDBGrid_MS1.RecalculateSummaryResults(true);
end;
procedure TFPrevisionEjecucion.fdprevisionpresupuestosFilterRecord(DataSet: TDataSet;
var Accept: Boolean);
begin
rDBGrid_MS1.RecalculateSummaryResults(true);
end;
end.