20 |
|
EmployeesDEPT_PATH: TIBStringField; |
21 |
|
IBLookupComboEditBox1: TIBLookupComboEditBox; |
22 |
|
IBLookupComboEditBox2: TIBLookupComboEditBox; |
23 |
+ |
IBQuery1DEPT_NO: TIBStringField; |
24 |
+ |
IBQuery1EMP_NO: TSmallintField; |
25 |
+ |
IBQuery1FIRST_NAME: TIBStringField; |
26 |
+ |
IBQuery1FULL_NAME: TIBStringField; |
27 |
+ |
IBQuery1HIRE_DATE: TDateTimeField; |
28 |
+ |
IBQuery1JOB_CODE: TIBStringField; |
29 |
+ |
IBQuery1JOB_COUNTRY: TIBStringField; |
30 |
+ |
IBQuery1JOB_GRADE: TSmallintField; |
31 |
+ |
IBQuery1LAST_NAME: TIBStringField; |
32 |
+ |
IBQuery1PHONE_EXT: TIBStringField; |
33 |
+ |
IBQuery1SALARY: TIBBCDField; |
34 |
|
SelectDept: TAction; |
35 |
|
Button4: TButton; |
36 |
|
Button5: TButton; |
80 |
|
Panel2: TPanel; |
81 |
|
EmployeeEditorPanel: TPanel; |
82 |
|
SpeedButton1: TSpeedButton; |
83 |
+ |
JobGradeChangeTimer: TTimer; |
84 |
+ |
JobCodeChangeTimer: TTimer; |
85 |
|
TotalsQueryTOTALSALARIES: TIBBCDField; |
86 |
|
TotalsSource: TDataSource; |
87 |
|
TotalsQuery: TIBQuery; |
99 |
|
IBDatabase1: TIBDatabase; |
100 |
|
IBTransaction1: TIBTransaction; |
101 |
|
procedure EmployeesAfterPost(DataSet: TDataSet); |
102 |
+ |
procedure EmployeesValidatePost(Sender: TObject; var CancelPost: boolean); |
103 |
+ |
procedure JobCodeChangeTimerTimer(Sender: TObject); |
104 |
+ |
procedure JobGradeChangeTimerTimer(Sender: TObject); |
105 |
|
procedure JobGradeDBComboBoxCloseUp(Sender: TObject); |
106 |
|
procedure SelectDeptExecute(Sender: TObject); |
107 |
|
procedure AddEmployeeExecute(Sender: TObject); |
147 |
|
|
148 |
|
uses IB, Unit2; |
149 |
|
|
150 |
+ |
const |
151 |
+ |
sNoName = '<no name>'; |
152 |
+ |
|
153 |
|
function ExtractDBException(msg: string): string; |
154 |
|
var Lines: TStringList; |
155 |
|
begin |
234 |
|
Employees.Refresh |
235 |
|
end; |
236 |
|
|
237 |
+ |
procedure TForm1.EmployeesValidatePost(Sender: TObject; var CancelPost: boolean |
238 |
+ |
); |
239 |
+ |
begin |
240 |
+ |
{Cancel if no name entered} |
241 |
+ |
CancelPost := (EmployeesLAST_NAME.AsString = sNoName) and (EmployeesFIRST_NAME.AsString = sNoName); |
242 |
+ |
end; |
243 |
+ |
|
244 |
+ |
procedure TForm1.JobCodeChangeTimerTimer(Sender: TObject); |
245 |
+ |
begin |
246 |
+ |
Countries.Active := false; |
247 |
+ |
Countries.Active := true; |
248 |
+ |
JobCodeChangeTimer.Interval := 0; |
249 |
+ |
end; |
250 |
+ |
|
251 |
+ |
procedure TForm1.JobGradeChangeTimerTimer(Sender: TObject); |
252 |
+ |
begin |
253 |
+ |
Countries.Active := false; |
254 |
+ |
JobCodes.Active := false; |
255 |
+ |
Countries.Active := true; |
256 |
+ |
JobCodes.Active := true; |
257 |
+ |
JobGradeChangeTimer.Interval := 0; |
258 |
+ |
end; |
259 |
+ |
|
260 |
|
procedure TForm1.JobGradeDBComboBoxCloseUp(Sender: TObject); |
261 |
|
begin |
262 |
|
JobGradeDBComboBox.EditingDone; //See http://bugs.freepascal.org/view.php?id=27186 |
303 |
|
EmployeesJOB_CODE.AsString := 'SRep'; |
304 |
|
EmployeesJOB_GRADE.AsInteger := 4; |
305 |
|
EmployeesSALARY.AsCurrency := 20000; |
306 |
< |
EmployeesFIRST_NAME.AsString := '<no name>'; |
307 |
< |
EmployeesLAST_NAME.AsString := '<no name>'; |
306 |
> |
EmployeesFIRST_NAME.AsString := sNoName; |
307 |
> |
EmployeesLAST_NAME.AsString := sNoName; |
308 |
|
EmployeesHIRE_DATE.AsDateTime := now; |
309 |
|
EmployeesDEPT_NO.AsString := '000'; |
310 |
|
FDirty := true; |
312 |
|
|
313 |
|
procedure TForm1.EmployeesAfterOpen(DataSet: TDataSet); |
314 |
|
begin |
315 |
< |
TotalsQuery.Active := true |
315 |
> |
TotalsQuery.Active := true; |
316 |
> |
IBDynamicGrid1.SetFocus; |
317 |
|
end; |
318 |
|
|
319 |
|
procedure TForm1.EmployeesAfterScroll(DataSet: TDataSet); |
320 |
|
begin |
321 |
< |
Countries.Active := false; |
279 |
< |
JobCodes.Active := false; |
280 |
< |
Countries.Active := true; |
281 |
< |
JobCodes.Active := true; |
321 |
> |
JobGradeChangeTimer.Interval := 200; |
322 |
|
end; |
323 |
|
|
324 |
|
procedure TForm1.EmployeesBeforeClose(DataSet: TDataSet); |
325 |
|
begin |
286 |
– |
with DataSet do |
287 |
– |
if State in [dsInsert,dsEdit] then |
288 |
– |
try |
289 |
– |
Post; |
290 |
– |
except |
291 |
– |
Cancel; |
292 |
– |
raise; |
293 |
– |
end; |
326 |
|
TotalsQuery.Active := false |
327 |
|
end; |
328 |
|
|
354 |
|
|
355 |
|
procedure TForm1.EmployeesJOB_CODEChange(Sender: TField); |
356 |
|
begin |
357 |
< |
Countries.Active := false; |
326 |
< |
Countries.Active := true; |
357 |
> |
JobCodeChangeTimer.Interval := 200; |
358 |
|
end; |
359 |
|
|
360 |
|
procedure TForm1.EmployeesJOB_GRADEChange(Sender: TField); |
361 |
|
begin |
362 |
< |
Countries.Active := false; |
332 |
< |
JobCodes.Active := false; |
333 |
< |
Countries.Active := true; |
334 |
< |
JobCodes.Active := true; |
362 |
> |
JobGradeChangeTimer.Interval := 200; |
363 |
|
end; |
364 |
|
|
365 |
|
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); |
411 |
|
end; |
412 |
|
|
413 |
|
end. |
414 |
< |
|
414 |
> |
|