Module

fODMedOIFA

Path

C:\CPRS\CPRS30\Orders\fODMedOIFA.pas

Last Modified

7/15/2014 3:26:42 PM

Units Used in Interface

Name Comments
fAutoSz -
fBase508Form -

Units Used in Implementation

Name Comments
rMisc -
rODMeds -

Classes

Name Comments
TfrmODMedOIFA -

Procedures

Name Owner Declaration Scope Comments
CheckFormularyDose - procedure CheckFormularyDose(DispDrug: Integer; var OI: Integer; var OIName: string; ForInpatient: Boolean); Interfaced -
CheckFormularyOI - procedure CheckFormularyOI(var AnIEN: Integer; var AName: string; ForInpatient: Boolean); Interfaced -
cmdNoClick TfrmODMedOIFA procedure cmdNoClick(Sender: TObject); Public/Published -
cmdYesClick TfrmODMedOIFA procedure cmdYesClick(Sender: TObject); Public/Published -
FormClose TfrmODMedOIFA procedure FormClose(Sender: TObject; var Action: TCloseAction); Public/Published -
FormCreate TfrmODMedOIFA procedure FormCreate(Sender: TObject); Public/Published -
FormShow TfrmODMedOIFA procedure FormShow(Sender: TObject); Public/Published -
lstFormAltClick TfrmODMedOIFA procedure lstFormAltClick(Sender: TObject); Public/Published -


Module Source

1     unit fODMedOIFA;
2     
3     interface
4     
5     uses
6       Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7       StdCtrls, ORCtrls, ExtCtrls, fAutoSz, fBase508Form, VA508AccessibilityManager;
8     
9     type
10      TfrmODMedOIFA = class(TfrmBase508Form)
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    
27    procedure CheckFormularyOI(var AnIEN: Integer; var AName: string; ForInpatient: Boolean);
28    procedure CheckFormularyDose(DispDrug: Integer; var OI: Integer; var OIName: string;
29      ForInpatient: Boolean);
30    
31    implementation
32    
33    {$R *.DFM}
34    
35    uses ORFn, rODMeds, rMisc;
36    
37    procedure CheckFormularyOI(var AnIEN: Integer; var AName: string; ForInpatient: Boolean);
38    
39    const
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    
45    var
46      frmODMedOIFA: TfrmODMedOIFA;
47      FormAltList: TStringList;
48    begin
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              FastAssign(FormAltList, lstFormAlt.Items);
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}
75    end;
76    
77    procedure CheckFormularyDose(DispDrug: Integer; var OI: Integer; var OIName: string;
78      ForInpatient: Boolean);
79    var
80      frmODMedOIFA: TfrmODMedOIFA;
81      FormAltList: TStringList;
82    begin
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              FastAssign(FormAltList, lstFormAlt.Items);
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}
108   end;
109   
110   procedure TfrmODMedOIFA.FormCreate(Sender: TObject);
111   begin
112     inherited;
113     FSelected := '';
114   end;
115   
116   procedure TfrmODMedOIFA.lstFormAltClick(Sender: TObject);
117   begin
118     inherited;
119     if lstFormAlt.ItemIndex > -1 then cmdYes.Enabled := True;
120   end;
121   
122   procedure TfrmODMedOIFA.cmdYesClick(Sender: TObject);
123   begin
124     inherited;
125     with lstFormAlt do if ItemIndex > -1 then FSelected := Items[ItemIndex];
126     Close;
127   end;
128   
129   procedure TfrmODMedOIFA.cmdNoClick(Sender: TObject);
130   begin
131     inherited;
132     Close;
133   end;
134   
135   procedure TfrmODMedOIFA.FormShow(Sender: TObject);
136   begin
137     inherited;
138     SetFormPosition(Self);
139   end;
140   
141   procedure TfrmODMedOIFA.FormClose(Sender: TObject;
142     var Action: TCloseAction);
143   begin
144     inherited;
145     SaveUserBounds(Self);  
146   end;
147   
148   end.

Module Calls (2 levels)


fODMedOIFA
 ├fBase508Form
 │ ├uConst
 │ └uHelpManager
 ├rODMeds
 │ ├uCore
 │ └uConst
 └rMisc
   └fOrders

Module Called-By (2 levels)


    fODMedOIFA
     fODMeds┤ 
   uOrders┘ │ 
   fODMedNVA┘ 
uOrders...┘