| 1 | unit fPtCWAD;
 | 
|---|
| 2 | 
 | 
|---|
| 3 | interface
 | 
|---|
| 4 | 
 | 
|---|
| 5 | uses
 | 
|---|
| 6 |   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 | 
|---|
| 7 |   fAutoSz, ORCtrls, StdCtrls, ORFn, ExtCtrls;
 | 
|---|
| 8 | 
 | 
|---|
| 9 | type
 | 
|---|
| 10 |   TfrmPtCWAD = class(TfrmAutoSz)
 | 
|---|
| 11 |     lstAllergies: TORListBox;
 | 
|---|
| 12 |     lstNotes: TORListBox;
 | 
|---|
| 13 |     lblNotes: TOROffsetLabel;
 | 
|---|
| 14 |     pnlBottom: TPanel;
 | 
|---|
| 15 |     btnClose: TButton;
 | 
|---|
| 16 |     lblAllergies: TOROffsetLabel;
 | 
|---|
| 17 |     procedure FormCreate(Sender: TObject);
 | 
|---|
| 18 |     procedure lstAllergiesClick(Sender: TObject);
 | 
|---|
| 19 |     procedure lstNotesClick(Sender: TObject);
 | 
|---|
| 20 |     procedure FormKeyUp(Sender: TObject; var Key: Word;
 | 
|---|
| 21 |       Shift: TShiftState);
 | 
|---|
| 22 |     procedure btnCloseClick(Sender: TObject);
 | 
|---|
| 23 |   private
 | 
|---|
| 24 |     { Private declarations }
 | 
|---|
| 25 |   public
 | 
|---|
| 26 |     { Public declarations }
 | 
|---|
| 27 |   end;
 | 
|---|
| 28 | 
 | 
|---|
| 29 | procedure ShowCWAD;
 | 
|---|
| 30 | 
 | 
|---|
| 31 | implementation
 | 
|---|
| 32 | 
 | 
|---|
| 33 | {$R *.DFM}
 | 
|---|
| 34 | 
 | 
|---|
| 35 | uses rCover, fRptBox, uCore, uConst, fAllgyBox, rODAllergy;
 | 
|---|
| 36 | 
 | 
|---|
| 37 | const
 | 
|---|
| 38 |   TX_LST_ALLG = 'Searching for allergies...';
 | 
|---|
| 39 |   TX_LST_POST = 'Searching for postings...';
 | 
|---|
| 40 | 
 | 
|---|
| 41 | procedure ShowCWAD;
 | 
|---|
| 42 | { displays CWAD notices (future - allow updates of allergy info from here? }
 | 
|---|
| 43 | var
 | 
|---|
| 44 |   frmPtCWAD: TfrmPtCWAD;
 | 
|---|
| 45 | begin
 | 
|---|
| 46 |   frmPtCWAD := TfrmPtCWAD.Create(Application);
 | 
|---|
| 47 |   try
 | 
|---|
| 48 |     ResizeFormToFont(TForm(frmPtCWAD));
 | 
|---|
| 49 |     frmPtCWAD.ShowModal;
 | 
|---|
| 50 |   finally
 | 
|---|
| 51 |     frmPtCWAD.Release;
 | 
|---|
| 52 |   end;
 | 
|---|
| 53 | end;
 | 
|---|
| 54 | 
 | 
|---|
| 55 | 
 | 
|---|
| 56 | procedure TfrmPtCWAD.FormCreate(Sender: TObject);
 | 
|---|
| 57 | var
 | 
|---|
| 58 |   i: Integer;
 | 
|---|
| 59 | begin
 | 
|---|
| 60 |   inherited;
 | 
|---|
| 61 |   StatusText(TX_LST_ALLG);
 | 
|---|
| 62 |   ListAllergies(lstAllergies.Items);
 | 
|---|
| 63 |   StatusText(TX_LST_POST);
 | 
|---|
| 64 |   ListPostings(lstNotes.Items);
 | 
|---|
| 65 |   with lstNotes do for i := Items.Count - 1 downto 0 do
 | 
|---|
| 66 |     if Items[i]='^Allergies^' then Items.Delete(i);
 | 
|---|
| 67 |   StatusText('');
 | 
|---|
| 68 | end;
 | 
|---|
| 69 | 
 | 
|---|
| 70 | procedure TfrmPtCWAD.lstAllergiesClick(Sender: TObject);
 | 
|---|
| 71 | begin
 | 
|---|
| 72 |   inherited;
 | 
|---|
| 73 |   with lstAllergies do
 | 
|---|
| 74 |     if ItemIEN > 0 then
 | 
|---|
| 75 |     begin
 | 
|---|
| 76 | { TODO -oRich V. -cART/Allergy : Allergy Box to update CWAD allergies list? }
 | 
|---|
| 77 | (*      if ARTPatchInstalled then
 | 
|---|
| 78 |         AllergyBox(DetailAllergy(ItemIEN), DisplayText[ItemIndex], True, ItemIEN)
 | 
|---|
| 79 |       else*)
 | 
|---|
| 80 |         ReportBox(DetailAllergy(ItemIEN), DisplayText[ItemIndex], True);
 | 
|---|
| 81 |     end;
 | 
|---|
| 82 | end;
 | 
|---|
| 83 | 
 | 
|---|
| 84 | procedure TfrmPtCWAD.lstNotesClick(Sender: TObject);
 | 
|---|
| 85 | begin
 | 
|---|
| 86 |   inherited;
 | 
|---|
| 87 |   with lstNotes do
 | 
|---|
| 88 |     if ItemID <> '' then
 | 
|---|
| 89 |       begin
 | 
|---|
| 90 |         NotifyOtherApps(NAE_REPORT, 'TIU^' + lstNotes.ItemID);
 | 
|---|
| 91 |         ReportBox(DetailPosting(ItemID), DisplayText[ItemIndex], True);
 | 
|---|
| 92 |       end;
 | 
|---|
| 93 | end;
 | 
|---|
| 94 | 
 | 
|---|
| 95 | procedure TfrmPtCWAD.FormKeyUp(Sender: TObject; var Key: Word;
 | 
|---|
| 96 |   Shift: TShiftState);
 | 
|---|
| 97 | begin
 | 
|---|
| 98 |   inherited;
 | 
|---|
| 99 |   if Key = VK_ESCAPE then
 | 
|---|
| 100 |   begin
 | 
|---|
| 101 |     Key := 0;
 | 
|---|
| 102 |     Close;
 | 
|---|
| 103 |   end;
 | 
|---|
| 104 | end;
 | 
|---|
| 105 | 
 | 
|---|
| 106 | procedure TfrmPtCWAD.btnCloseClick(Sender: TObject);
 | 
|---|
| 107 | begin
 | 
|---|
| 108 |   inherited;
 | 
|---|
| 109 |   Close;
 | 
|---|
| 110 | end;
 | 
|---|
| 111 | 
 | 
|---|
| 112 | end.
 | 
|---|