source: cprs/branches/foia-cprs/CPRS-Chart/Orders/fODMedOIFA.pas@ 1404

Last change on this file since 1404 was 460, checked in by Kevin Toppenberg, 16 years ago

Uploading from OR_30_258

File size: 3.8 KB
RevLine 
[459]1unit fODMedOIFA;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
[460]7 StdCtrls, ORCtrls, ExtCtrls, fAutoSz;
[459]8
9type
[460]10 TfrmODMedOIFA = class(TForm)
[459]11 Label1: TLabel;
12 lstFormAlt: TORListBox;
13 Label2: TStaticText;
[460]14 btnPanel: TPanel;
[459]15 cmdYes: TButton;
16 cmdNo: TButton;
17 procedure FormCreate(Sender: TObject);
18 procedure cmdYesClick(Sender: TObject);
19 procedure cmdNoClick(Sender: TObject);
20 procedure lstFormAltClick(Sender: TObject);
[460]21 procedure FormShow(Sender: TObject);
22 procedure FormClose(Sender: TObject; var Action: TCloseAction);
[459]23 private
24 FSelected: string;
25 end;
26
27procedure CheckFormularyOI(var AnIEN: Integer; var AName: string; ForInpatient: Boolean);
28procedure CheckFormularyDose(DispDrug: Integer; var OI: Integer; var OIName: string;
29 ForInpatient: Boolean);
30
31implementation
32
33{$R *.DFM}
34
[460]35uses ORFn, rODMeds, rMisc;
[459]36
37procedure CheckFormularyOI(var AnIEN: Integer; var AName: string; ForInpatient: Boolean);
38
39const
40 TX_NO_FORM_ALT = 'This drug is not in the formulary!' + CRLF +
41 'There are no formulary alternatives entered for this item.' + CRLF +
42 'Please consult with your pharmacy before ordering this item.';
43 TC_NO_FORM_ALT = 'No Formulary Alternatives';
44
45var
46 frmODMedOIFA: TfrmODMedOIFA;
47 FormAltList: TStringList;
48begin
49 FormAltList := TStringList.Create;
50 try
51 LoadFormularyAltOI(FormAltList, AnIEN, ForInpatient);
52 if FormAltList.Count > 0 then
53 begin
54 frmODMedOIFA := TfrmODMedOIFA.Create(Application);
55 try
56 ResizeFormToFont(TForm(frmODMedOIFA));
57 with frmODMedOIFA do
58 begin
59 lstFormAlt.Items.Assign(FormAltList);
60 ShowModal;
61 if Length(FSelected) > 0 then
62 begin
63 AnIEN := StrToIntDef(Piece(FSelected, U, 1), 0);
64 AName := Piece(FSelected, U, 2);
65 end;
66 end; {with frmODMedOIFA}
67 finally
68 frmODMedOIFA.Release;
69 end; {frmODMedOIFA}
70 end
71 else messageDlg(TX_NO_FORM_ALT,mtWarning, [mbOK],0);
72 finally
73 FormAltList.Free;
74 end; {FormAltList}
75end;
76
77procedure CheckFormularyDose(DispDrug: Integer; var OI: Integer; var OIName: string;
78 ForInpatient: Boolean);
79var
80 frmODMedOIFA: TfrmODMedOIFA;
81 FormAltList: TStringList;
82begin
83 FormAltList := TStringList.Create;
84 try
85 LoadFormularyAltDose(FormAltList, DispDrug, OI, ForInpatient);
86 if FormAltList.Count > 0 then
87 begin
88 frmODMedOIFA := TfrmODMedOIFA.Create(Application);
89 try
90 ResizeFormToFont(TForm(frmODMedOIFA));
91 with frmODMedOIFA do
92 begin
93 lstFormAlt.Items.Assign(FormAltList);
94 ShowModal;
95 if Length(FSelected) > 0 then
96 begin
97 OI := StrToIntDef(Piece(FSelected, U, 1), 0);
98 OIName := Piece(FSelected, U, 2);
99 end;
100 end; {with frmODMedOIFA}
101 finally
102 frmODMedOIFA.Release;
103 end; {frmODMedOIFA}
104 end; {if FormAltList}
105 finally
106 FormAltList.Free;
107 end; {FormAltList}
108end;
109
110procedure TfrmODMedOIFA.FormCreate(Sender: TObject);
111begin
112 inherited;
113 FSelected := '';
114end;
115
116procedure TfrmODMedOIFA.lstFormAltClick(Sender: TObject);
117begin
118 inherited;
119 if lstFormAlt.ItemIndex > -1 then cmdYes.Enabled := True;
120end;
121
122procedure TfrmODMedOIFA.cmdYesClick(Sender: TObject);
123begin
124 inherited;
125 with lstFormAlt do if ItemIndex > -1 then FSelected := Items[ItemIndex];
126 Close;
127end;
128
129procedure TfrmODMedOIFA.cmdNoClick(Sender: TObject);
130begin
131 inherited;
132 Close;
133end;
134
[460]135procedure TfrmODMedOIFA.FormShow(Sender: TObject);
136begin
137 inherited;
138 SetFormPosition(Self);
139end;
140
141procedure TfrmODMedOIFA.FormClose(Sender: TObject;
142 var Action: TCloseAction);
143begin
144 inherited;
145 SaveUserBounds(Self);
146end;
147
[459]148end.
Note: See TracBrowser for help on using the repository browser.