Statistiques
| Révision:

root / LicensesMercure / UFINRA.pas @ 5

Historique | Voir | Annoter | Télécharger (2,47 ko)

1 1 avalancogn
unit UFINRA;
2
3
interface
4
5
uses
6
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
    Dialogs, ComCtrls, StdCtrls, Buttons, PBNumEdit;
8
9
type
10
  TFINRA = class(TForm)
11
    LFirstName: TLabel;
12
    LLastName: TLabel;
13
    LLicenseNumber: TLabel;
14
    LCompany: TLabel;
15
    EFirstName: TEdit;
16
    ELastName: TEdit;
17
    PBLicenseNumber: TPBNumEdit;
18
    ECompany: TEdit;
19
    BBNext: TBitBtn;
20
    MObservations: TMemo;
21
    procedure BBNextClick(Sender: TObject);
22
    procedure ENameChange(Sender: TObject);
23
    procedure FormShow(Sender: TObject);
24
    procedure FormCreate(Sender: TObject);
25
  private
26
    { D?clarations priv?es }
27
    procedure ClearINRA;
28
  public
29
    { D?clarations publiques }
30
  end;
31
32
var
33
  FINRA: TFINRA;
34
35
implementation
36
37
uses
38
  UFMenu;
39
40
{$R *.dfm}
41
42
procedure TFINRA.FormCreate(Sender: TObject);
43
begin
44
  Top := 0;
45
  Left := 0;
46
end;
47
48
procedure TFINRA.FormShow(Sender: TObject);
49
begin
50
  ClearINRA;
51
end;
52
53
procedure TFINRA.ENameChange(Sender: TObject);
54
begin
55
  BBNext.Enabled := (Length(EFirstName.Text) > 0) and (Length(ELastName.Text) > 0);
56
end;
57
58
procedure TFINRA.BBNextClick(Sender: TObject);
59
begin
60
  FMenu.MLog.Lines.Add('Recording license (type 1)...');
61
  with FMenu.TLicense do
62
  begin
63
    Insert;
64
    FieldByName('Validity').AsBoolean := False;
65
    FieldByName('Type').AsInteger := 1;
66
    FieldByName('LicenseNumber').AsInteger := PBLicenseNumber.AsInteger;
67
    FieldByName('FirstName').AsString := EFirstName.Text;
68
    FieldByName('LastName').AsString := ELastName.Text;
69
    FieldByName('Company').AsString := ECompany.Text;
70
    FieldByName('FinalDate').AsDateTime := IncMonth(Date, 2);
71
    Post;
72
  end;
73
  FMenu.MLog.Lines.Add('Logging record...');
74
  with FMenu.TINRA do
75
  begin
76
    Append;
77
    FieldByName('Date').AsDateTime := Now;
78
    FieldByName('Admin').AsString := FMenu.EAdmin.Text;
79
    FieldByName('LicenseNumber').AsInteger := PBLicenseNumber.AsInteger;
80
    FieldByName('FirstName').AsString := EFirstName.Text;
81
    FieldByName('LastName').AsString := ELastName.Text;
82
    FieldByName('Company').AsString := ECompany.Text;
83
    FieldByName('Observations').AsString := MObservations.Text;
84
    Post;
85
  end;
86
  ClearINRA;
87
end;
88
89
procedure TFINRA.ClearINRA;
90
begin
91
  BBNext.Enabled := False;
92
  EFirstName.Text := '';
93
  ELastName.Text := '';
94
  ECompany.Text := '';
95
  PBLicenseNumber.AsInteger := FMenu.TLicense.RecordCount + 1;
96
  MObservations.Clear;
97
  ActiveControl := EFirstName;
98
end;
99
100
end.