1 |
tony |
23 |
unit Unit5; |
2 |
|
|
|
3 |
|
|
{$mode objfpc}{$H+} |
4 |
|
|
|
5 |
|
|
interface |
6 |
|
|
|
7 |
|
|
uses |
8 |
|
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, |
9 |
|
|
StdCtrls, db, IBQuery, IBLookupComboEditBox; |
10 |
|
|
|
11 |
|
|
type |
12 |
|
|
|
13 |
|
|
{ TEditJobCode } |
14 |
|
|
|
15 |
|
|
TEditJobCode = class(TForm) |
16 |
|
|
Bevel1: TBevel; |
17 |
|
|
Button1: TButton; |
18 |
|
|
Button2: TButton; |
19 |
|
|
IBLookupComboEditBox1: TIBLookupComboEditBox; |
20 |
|
|
JobCodes: TIBQuery; |
21 |
|
|
JobCodeSource: TDataSource; |
22 |
|
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
23 |
|
|
procedure FormShow(Sender: TObject); |
24 |
|
|
procedure JobCodesAfterOpen(DataSet: TDataSet); |
25 |
|
|
procedure JobCodesBeforeOpen(DataSet: TDataSet); |
26 |
|
|
private |
27 |
|
|
{ private declarations } |
28 |
|
|
FGrade: integer; |
29 |
|
|
FCountry: string; |
30 |
|
|
FJobCode: string; |
31 |
|
|
public |
32 |
|
|
{ public declarations } |
33 |
|
|
function ShowModal(Grade: integer; Country: string; var JobCode:string): TModalResult; |
34 |
|
|
end; |
35 |
|
|
|
36 |
|
|
var |
37 |
|
|
EditJobCode: TEditJobCode; |
38 |
|
|
|
39 |
|
|
implementation |
40 |
|
|
|
41 |
|
|
{$R *.lfm} |
42 |
|
|
|
43 |
|
|
{ TEditJobCode } |
44 |
|
|
|
45 |
|
|
procedure TEditJobCode.FormShow(Sender: TObject); |
46 |
|
|
begin |
47 |
|
|
JobCodes.Active := true; |
48 |
|
|
end; |
49 |
|
|
|
50 |
|
|
procedure TEditJobCode.JobCodesAfterOpen(DataSet: TDataSet); |
51 |
|
|
begin |
52 |
|
|
IBLookupComboEditBox1.KeyValue := FJobCode; |
53 |
|
|
end; |
54 |
|
|
|
55 |
|
|
procedure TEditJobCode.JobCodesBeforeOpen(DataSet: TDataSet); |
56 |
|
|
begin |
57 |
|
|
JobCodes.ParamByName('JOB_GRADE').AsInteger := FGrade; |
58 |
|
|
JobCodes.ParamByName('JOB_COUNTRY').AsString := FCountry; |
59 |
|
|
end; |
60 |
|
|
|
61 |
|
|
function TEditJobCode.ShowModal(Grade: integer; Country: string; var JobCode: string |
62 |
|
|
): TModalResult; |
63 |
|
|
begin |
64 |
|
|
FGrade := Grade; |
65 |
|
|
FCountry := Country; |
66 |
|
|
FJobCode := JobCode; |
67 |
|
|
Result := inherited ShowModal; |
68 |
|
|
if Result = mrOK then |
69 |
|
|
JobCode := FJobCode; |
70 |
|
|
end; |
71 |
|
|
|
72 |
|
|
procedure TEditJobCode.FormClose(Sender: TObject; var CloseAction: TCloseAction); |
73 |
|
|
begin |
74 |
|
|
if ModalResult = mrOK then |
75 |
|
|
FJobCode := IBLookupComboEditBox1.KeyValue; |
76 |
|
|
JobCodes.Active := false |
77 |
|
|
end; |
78 |
|
|
|
79 |
|
|
end. |
80 |
|
|
|