-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclientes.pas
278 lines (236 loc) · 8.31 KB
/
clientes.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
unit clientes;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.ComCtrls,
VclTee.TeeGDIPlus, VCLTee.TeEngine, VCLTee.TeeProcs, VCLTee.Chart,
VCLTee.DBChart, framePresupuestos, frameFacturas, frameObras, frameContactos,
FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
FireDAC.Stan.Async, FireDAC.DApt, System.Rtti, System.Bindings.Outputs,
Vcl.Bind.Editors, Data.Bind.EngExt, Vcl.Bind.DBEngExt, Data.Bind.Components,
Data.Bind.DBScope, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
Data.Bind.Controls, Vcl.Buttons, Vcl.Bind.Navigator, Vcl.ToolWin, Vcl.Grids,
Vcl.DBGrids;
type
TFClientes = class(TForm)
GroupBox1: TGroupBox;
GridPanel1: TGridPanel;
Panel1: TPanel;
GridPanel2: TGridPanel;
GroupBox4: TGroupBox;
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
GroupBox2: TGroupBox;
LabeledEdit4: TLabeledEdit;
LabeledEdit5: TLabeledEdit;
GroupBox5: TGroupBox;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
ComboBox2: TComboBox;
Frame11: TFrame1;
Frame21: TFrame2;
Frame31: TFrame3;
Frame41: TFrame4;
GroupBox3: TGroupBox;
LabeledEdit6: TLabeledEdit;
LabeledEdit7: TLabeledEdit;
LabeledEdit8: TLabeledEdit;
fdclientes: TFDQuery;
fdpresupuestos: TFDQuery;
fdfacturas: TFDQuery;
fdobras: TFDQuery;
fdContactos: TFDQuery;
BindSourceDB1: TBindSourceDB;
BindingsList1: TBindingsList;
LinkControlToField1: TLinkControlToField;
LinkControlToField2: TLinkControlToField;
LinkControlToField3: TLinkControlToField;
LinkControlToField4: TLinkControlToField;
LinkControlToField5: TLinkControlToField;
LinkControlToField6: TLinkControlToField;
LinkControlToField7: TLinkControlToField;
LinkControlToField8: TLinkControlToField;
fdAdministradores: TFDQuery;
LinkPropertyToFieldItemIndex: TLinkPropertyToField;
BindSourceDB2: TBindSourceDB;
BindSourceDB3: TBindSourceDB;
LinkListControlToField1: TLinkListControlToField;
BindSourceDB4: TBindSourceDB;
LinkListControlToField3: TLinkListControlToField;
BindSourceDB5: TBindSourceDB;
LinkListControlToField4: TLinkListControlToField;
BindSourceDB6: TBindSourceDB;
LinkFillControlToField1: TLinkFillControlToField;
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
DBGrid1: TDBGrid;
dsfdpresupuestos: TDataSource;
fdlineaspresupuesto: TFDQuery;
dsfdlineaspresupuesto: TDataSource;
DBGrid2: TDBGrid;
Label3: TLabel;
LinkListControlToField2: TLinkListControlToField;
FDlineasObras: TFDQuery;
dsobras: TDataSource;
dbgrd1: TDBGrid;
dslineasobras: TDataSource;
dblineasobras: TDBGrid;
fdlineasfacturas: TFDQuery;
procedure GridPanel2Resize(Sender: TObject);
procedure Frame11ListView1AdvancedCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
procedure Frame11Button2Click(Sender: TObject);
procedure Frame11Button1Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure Frame11Button3Click(Sender: TObject);
procedure Frame11ListView1DblClick(Sender: TObject);
procedure Frame31ListViewObrasDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
procedure Frame31ListViewObrasDragDrop(Sender, Source: TObject; X,
Y: Integer);
procedure Frame31Button2Click(Sender: TObject);
procedure Frame31ListViewObrasDblClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Frame11btnobraClick(Sender: TObject);
procedure Frame21ListViewFacturasDblClick(Sender: TObject);
procedure Frame21Button2Click(Sender: TObject);
procedure Frame31Button3Click(Sender: TObject);
procedure Frame31Button1Click(Sender: TObject);
procedure Frame31btncrearfacturaClick(Sender: TObject);
procedure Frame21Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
lstobras:TStringList;
end;
var
FClientes: TFClientes;
implementation
{$R *.dfm}
uses DModule1, presupuestos, FPrincipal, listaclientes, SelectLineasPresupuestos;
procedure TFClientes.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FDlineasObras.Close;
fdlineaspresupuesto.Close;
fdpresupuestos.Close;
fdobras.Close;
fdclientes.Close;
Action:=caFree;
end;
procedure TFClientes.Frame11btnobraClick(Sender: TObject);
begin
DataModule1.ConvertirEnObraExecute(fdpresupuestos);
end;
procedure TFClientes.Frame11Button1Click(Sender: TObject);
begin
DataModule1.insertarpresupuestoExecute(fdclientes);
end;
procedure TFClientes.Frame11Button2Click(Sender: TObject);
begin
DataModule1.editarpresupuestoExecute(fdpresupuestos);
end;
procedure TFClientes.Frame11Button3Click(Sender: TObject);
begin
if Application.MessageBox('¿Esta seguro de borrar el presupuesto?','Borrar Presupuesto',MB_YESNO)=IDYES then
begin
if not (fdpresupuestos.State in [dsInsert,dsEdit]) then fdpresupuestos.Delete;
end;
end;
procedure TFClientes.Frame11ListView1AdvancedCustomDrawItem(
Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
Stage: TCustomDrawStage; var DefaultDraw: Boolean);
var i:integer;
begin
for i:=0 to (Sender as TListView).Groups.count -1 do
begin
(Sender as TListView).Groups.Items[i].state:=[lgsNormal,lgsCollapsed,lgsCollapsible];
(Sender as TListView).Groups.Items[i].FooterAlign:=taRightJustify ;
end;
if item.Index mod 2 <> 0 then
begin
(Sender as TListview).Canvas.Brush.Color:=cl3DLight ;
end
else
(Sender as TListview).Canvas.Brush.Color:=clWindow;
if (cdsSelected in State) then
begin
(Sender as TListview).Canvas.font.Style:=[fsbold];
end;
end;
procedure TFClientes.Frame11ListView1DblClick(Sender: TObject);
begin
DataModule1.editarpresupuestoExecute(fdpresupuestos);
end;
procedure TFClientes.Frame21Button1Click(Sender: TObject);
begin
DataModule1.insertarFacturaExecute(fdfacturas);
end;
procedure TFClientes.Frame21Button2Click(Sender: TObject);
begin
DataModule1.editarFacturaExecute(fdfacturas);
end;
procedure TFClientes.Frame21ListViewFacturasDblClick(Sender: TObject);
begin
DataModule1.editarFacturaexecute(fdFacturas);
end;
procedure TFClientes.Frame31btncrearfacturaClick(Sender: TObject);
begin
DataModule1.ConvertirEnFacturaExecute(fdobras);
end;
procedure TFClientes.Frame31Button1Click(Sender: TObject);
begin
DataModule1.insertarobraExecute(fdobras);
end;
procedure TFClientes.Frame31Button2Click(Sender: TObject);
begin
DataModule1.editarObraExecute(fdobras);
end;
procedure TFClientes.Frame31Button3Click(Sender: TObject);
begin
if Application.MessageBox('¿Esta seguro de borrar la obra?','Borrar Obra',MB_YESNO)=IDYES then
begin
if not (fdobras.State in [dsInsert,dsEdit]) then fdobras.Delete;
end;
end;
procedure TFClientes.Frame31ListViewObrasDblClick(Sender: TObject);
begin
DataModule1.editarobraExecute(fdobras);
end;
procedure TFClientes.Frame31ListViewObrasDragDrop(Sender, Source: TObject; X,
Y: Integer);
var SellineasPresu:TFLineasPresupuestoObra;
begin
if fdpresupuestos.FieldByName('Aprovado').asboolean then
begin
SellineasPresu:=TFLineasPresupuestoObra.Create(Self);
SellineasPresu.ShowModal;
SellineasPresu.Close;
end
else showmessage('El presupuesto no esta aprobado, no se puede crear la obra.');
end;
procedure TFClientes.Frame31ListViewObrasDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept:=false;
if (source is TListView) then
if (source as TListView).Name='ListViewPresupuestos' then
begin
Accept:=True;
end;
end;
procedure TFClientes.GridPanel2Resize(Sender: TObject);
begin
ComboBox1.Width:=GroupBox5.Width-100;
ComboBox2.Width:=GroupBox5.Width-100;
end;
procedure TFClientes.ToolButton1Click(Sender: TObject);
begin
DataModule1.editarclienteExecute(fdclientes);
end;
end.