source: cprs/trunk/CPRS-Chart/Orders/fODMedOIFA.pas@ 733

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

Initial Upload of Official WV CPRS 1.0.26.76

File size: 3.8 KB
RevLine 
[456]1unit fODMedOIFA;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 StdCtrls, ORCtrls, ExtCtrls, fAutoSz;
8
9type
10 TfrmODMedOIFA = class(TForm)
11 Label1: TLabel;
12 lstFormAlt: TORListBox;
13 Label2: TStaticText;
14 btnPanel: TPanel;
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);
21 procedure FormShow(Sender: TObject);
22 procedure FormClose(Sender: TObject; var Action: TCloseAction);
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
35uses ORFn, rODMeds, rMisc;
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
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
148end.
Note: See TracBrowser for help on using the repository browser.