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