| 1 | unit fLkUpLocation;
 | 
|---|
| 2 | 
 | 
|---|
| 3 | interface
 | 
|---|
| 4 | 
 | 
|---|
| 5 | uses
 | 
|---|
| 6 |   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 | 
|---|
| 7 |   fAutoSz, StdCtrls, ORCtrls, ORFn;
 | 
|---|
| 8 | 
 | 
|---|
| 9 | type
 | 
|---|
| 10 |   TfrmLkUpLocation = class(TfrmAutoSz)
 | 
|---|
| 11 |     lblInfo: TLabel;
 | 
|---|
| 12 |     cboLocation: TORComboBox;
 | 
|---|
| 13 |     lblLocation: TLabel;
 | 
|---|
| 14 |     cmdOK: TButton;
 | 
|---|
| 15 |     cmdCancel: TButton;
 | 
|---|
| 16 |     procedure cmdCancelClick(Sender: TObject);
 | 
|---|
| 17 |     procedure FormCreate(Sender: TObject);
 | 
|---|
| 18 |     procedure cmdOKClick(Sender: TObject);
 | 
|---|
| 19 |     procedure cboLocationNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
| 20 |       Direction, InsertAt: Integer);
 | 
|---|
| 21 |   private
 | 
|---|
| 22 |     OKPressed: Boolean;
 | 
|---|
| 23 |   end;
 | 
|---|
| 24 | 
 | 
|---|
| 25 | var
 | 
|---|
| 26 |   LocType:   integer;
 | 
|---|
| 27 | 
 | 
|---|
| 28 | 
 | 
|---|
| 29 | procedure LookupLocation(var IEN: Integer; var AName: string; const AType: integer; const HelpInfo: string);
 | 
|---|
| 30 | 
 | 
|---|
| 31 | implementation
 | 
|---|
| 32 | 
 | 
|---|
| 33 | {$R *.DFM}
 | 
|---|
| 34 | 
 | 
|---|
| 35 | uses rCore, uConst;
 | 
|---|
| 36 | 
 | 
|---|
| 37 | procedure LookupLocation(var IEN: Integer; var AName: string; const AType: integer; const HelpInfo: string);
 | 
|---|
| 38 | var
 | 
|---|
| 39 |   frmLkUpLocation: TfrmLkUpLocation;
 | 
|---|
| 40 | begin
 | 
|---|
| 41 |   LocType := AType;
 | 
|---|
| 42 |   frmLkUpLocation := TfrmLkUpLocation.Create(Application);
 | 
|---|
| 43 |   try
 | 
|---|
| 44 |     ResizeFormToFont(TForm(frmLkUpLocation));
 | 
|---|
| 45 |     frmLkUpLocation.lblInfo.Caption := HelpInfo;
 | 
|---|
| 46 |     frmLkUpLocation.ShowModal;
 | 
|---|
| 47 |     IEN := 0;
 | 
|---|
| 48 |     AName := '';
 | 
|---|
| 49 |     if frmLkUpLocation.OKPressed then
 | 
|---|
| 50 |     begin
 | 
|---|
| 51 |       IEN := frmLkUpLocation.cboLocation.ItemIEN;
 | 
|---|
| 52 |       AName := frmLkUpLocation.cboLocation.Text;
 | 
|---|
| 53 |     end;
 | 
|---|
| 54 |   finally
 | 
|---|
| 55 |     frmLkUpLocation.Release;
 | 
|---|
| 56 |   end;
 | 
|---|
| 57 | end;
 | 
|---|
| 58 | 
 | 
|---|
| 59 | procedure TfrmLkUpLocation.FormCreate(Sender: TObject);
 | 
|---|
| 60 | begin
 | 
|---|
| 61 |   inherited;
 | 
|---|
| 62 |   OKPressed := False;
 | 
|---|
| 63 |   cboLocation.InitLongList('');
 | 
|---|
| 64 | end;
 | 
|---|
| 65 | 
 | 
|---|
| 66 | procedure TfrmLkUpLocation.cboLocationNeedData(Sender: TObject; const StartFrom: string;
 | 
|---|
| 67 |   Direction, InsertAt: Integer);
 | 
|---|
| 68 | begin
 | 
|---|
| 69 |   inherited;
 | 
|---|
| 70 |     case LocType of
 | 
|---|
| 71 |       LOC_ALL:   cboLocation.ForDataUse(SubSetOfLocations(StartFrom, Direction));
 | 
|---|
| 72 |       LOC_OUTP:  cboLocation.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
| 73 |       LOC_INP:   cboLocation.ForDataUse(SubSetOfInpatientLocations(StartFrom, Direction));
 | 
|---|
| 74 |     end;
 | 
|---|
| 75 | 
 | 
|---|
| 76 | end;
 | 
|---|
| 77 | 
 | 
|---|
| 78 | procedure TfrmLkUpLocation.cmdOKClick(Sender: TObject);
 | 
|---|
| 79 | begin
 | 
|---|
| 80 |   inherited;
 | 
|---|
| 81 |   OKPressed := True;
 | 
|---|
| 82 |   Close;
 | 
|---|
| 83 | end;
 | 
|---|
| 84 | 
 | 
|---|
| 85 | procedure TfrmLkUpLocation.cmdCancelClick(Sender: TObject);
 | 
|---|
| 86 | begin
 | 
|---|
| 87 |   inherited;
 | 
|---|
| 88 |   Close;
 | 
|---|
| 89 | end;
 | 
|---|
| 90 | 
 | 
|---|
| 91 | end.
 | 
|---|