Module

fCover

Path

C:\CPRS\CPRS30\fCover.pas

Last Modified

7/15/2014 3:26:36 PM

Initialization Code

initialization
  SpecifyFormIsNotADialog(TfrmCover);

Finalization Code

finalization
  if Assigned(fCover.VAAFlag) then fCover.VAAFlag.Free; //VAA

end.

Open Todo-items for fCover (1)

Text Category Owner Priority Status
What to do about NKA only via right-click menu? Add here? ART/Allergy Rich V. - Open

Units Used in Interface

Name Comments
fAllgyBox -
fBase508Form -
fPage -
rCover -
rOrders -

Units Used in Implementation

Name Comments
fARTAllgy -
fFrame -
fPatientFlagMulti -
fRptBox -
fvit -
fVitals -
rMisc -
rODAllergy -
rReminders -
uConst -
uCore -
uInit -
uOrPtf -
uReminders -

Classes

Name Comments
TfrmCover -

Procedures

Name Owner Declaration Scope Comments
ClearPtData TfrmCover procedure ClearPtData; override; Public Clears all lists displayed on the cover sheet
CoverItemClick TfrmCover procedure CoverItemClick(Sender: TObject); Public/Published Displays details for an item that has been clicked on the cover sheet
CoverItemExit TfrmCover procedure CoverItemExit(Sender: TObject); Public/Published -
DisplayPage TfrmCover procedure DisplayPage; override; Public
Loads the cover sheet lists if the patient has just been selected 
  procedure LoadList(const StsTxt: string; ListCtrl: TObject;
    ARpc: String; ACase, AInvert: Boolean; ADatePiece: integer; ADateFormat, AParam1, AID, ADetail: String; Reminders: boolean = FALSE);
  begin
    StatusText(StsTxt);
    if(ListCtrl is TORListBox) then
    begin
      ListGeneric((ListCtrl as TORListBox).Items, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
      if((ListCtrl as TORListBox).Items.Count = 0) then
        (ListCtrl as TORListBox).Items.Add(NoDataText(Reminders));
    end
    else
    begin
      ListGeneric(ListCtrl as TStrings, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
      if((ListCtrl as TStrings).Count = 0) then
        (ListCtrl as TStrings).Add(NoDataText(Reminders));
    end;
    StatusText('');
  end;
FormClose TfrmCover procedure FormClose(Sender: TObject; var Action: TCloseAction); Public/Published -
FormCreate TfrmCover procedure FormCreate(Sender: TObject); Public/Published -
FormDestroy TfrmCover procedure FormDestroy(Sender: TObject); Public/Published -
FormShow TfrmCover procedure FormShow(Sender: TObject); Public/Published -
GetPatientFlag TfrmCover procedure GetPatientFlag; Private -
LoadList TfrmCover procedure LoadList(const StsTxt: string; ListCtrl: TObject; ARpc: String; ACase, AInvert: Boolean; ADatePiece: integer; ADateFormat, AParam1, AID, ADetail: String; Reminders: boolean = FALSE); Private -
lstFlagClick TfrmCover procedure lstFlagClick(Sender: TObject); Public/Published -
lstFlagKeyDown TfrmCover procedure lstFlagKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); Public/Published -
NotifyOrder TfrmCover procedure NotifyOrder(OrderAction: Integer; AnOrder: TOrder); override; {REV} Public
REV
REV
popEditAllergyClick TfrmCover procedure popEditAllergyClick(Sender: TObject); Public/Published -
popEnteredInErrorClick TfrmCover procedure popEnteredInErrorClick(Sender: TObject); Public/Published -
popMenuAllergiesPopup TfrmCover procedure popMenuAllergiesPopup(Sender: TObject); Public/Published -
popNewAllergyClick TfrmCover procedure popNewAllergyClick(Sender: TObject); Public/Published -
popNKAClick TfrmCover procedure popNKAClick(Sender: TObject); Public/Published -
RemContextPopup TfrmCover procedure RemContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean); Public/Published -
RemindersChange TfrmCover procedure RemindersChange(Sender: TObject); Private -
SetFontSize TfrmCover procedure SetFontSize(NewFontSize: Integer); override; Public -
spt_1CanResize TfrmCover procedure spt_1CanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); Public/Published -
spt_2CanResize TfrmCover procedure spt_2CanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); Public/Published -
spt_3CanResize TfrmCover procedure spt_3CanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); Public/Published -
spt_4CanResize TfrmCover procedure spt_4CanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); Public/Published -
spt_5CanResize TfrmCover procedure spt_5CanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); Public/Published -
sptBottomCanResize TfrmCover procedure sptBottomCanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); Public/Published -
sptTopCanResize TfrmCover procedure sptTopCanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); Public/Published -
timPollTimer TfrmCover procedure timPollTimer(Sender: TObject); Public/Published -
UpdateAllergiesList TfrmCover procedure UpdateAllergiesList; Public -
UpdateVAAButton TfrmCover procedure UpdateVAAButton; Public
Var
  PtIsVAA: boolean;
  PtIsMHV: boolean;
WaitList - procedure WaitList(ListCtrl: TORListBox); Local
Procedure LoadList(const StsTxt: string; ListCtrl: TObject;
    ARpc: String; ACase, AInvert: Boolean; ADatePiece: integer; ADateFormat, AParam1, AID, ADetail: String; Reminders: boolean = FALSE);
  begin
    StatusText(StsTxt);
    if(ListCtrl is TORListBox) then
    begin
      ListGeneric((ListCtrl as TORListBox).Items, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
      if((ListCtrl as TORListBox).Items.Count = 0) then
        (ListCtrl as TORListBox).Items.Add(NoDataText(Reminders));
    end
    else
    begin
      ListGeneric(ListCtrl as TStrings, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
      if((ListCtrl as TStrings).Count = 0) then
        (ListCtrl as TStrings).Add(NoDataText(Reminders));
    end;
    StatusText('');
  end;

Global Variables

Name Type Declaration Comments
frmCover TfrmCover frmCover: TfrmCover; -
MHVFlag TStringList MHVFlag: TStringList; -
PtIsMHV Boolean PtIsMHV: boolean; -
PtIsVAA Boolean PtIsVAA: boolean; -
uARTCoverSheetParams UnicodeString uARTCoverSheetParams: string; -
uIPAddress UnicodeString uIPAddress: string; -
VAA_DFN UnicodeString VAA_DFN: string; -
VAAFlag TStringList VAAFlag: TStringList; -

Constants

Name Declaration Scope Comments
CoverSplitters1 'frmCoverSplitters1' Interfaced -
CoverSplitters2 'frmCoverSplitters2' Interfaced -
RemID '50' Global -
TAG_ALLG 20 Global -
TAG_LABS 60 Global -
TAG_MEDS 40 Global -
TAG_POST 30 Global -
TAG_PROB 10 Global -
TAG_RMND 50 Global -
TAG_VITL 70 Global -
TAG_VSIT 80 Global -
TC_INACTIVE_10DCODE 'Inactive ICD-10-CM code' Global -
TC_INACTIVE_ICDCODE 'Inactive ICD-9-CM code' Global -
TC_INACTIVE_SCTCODE 'Inactive SNOMED CT code' Global -
TX_INACTIVE_10DCODE 'The ICD-10-CM code for this problem is inactive.' + CRLF + CRLF + Global -
TX_INACTIVE_ICDCODE 'The ICD-9-CM code for this problem is inactive.' + CRLF + CRLF + Global -
TX_INACTIVE_SCTCODE 'The SNOMED CT code for this problem is inactive.' + CRLF + CRLF + Global -


Module Source

1     unit fCover;
2     
3     interface
4     
5     uses
6       Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7       fPage, StdCtrls, ORCtrls, ExtCtrls, rOrders, ORClasses, Menus, rCover, fAllgyBox,
8       VA508AccessibilityManager, fBase508Form; {REV}
9     
10    type
11      TfrmCover = class(TfrmPage)
12        pnlBase: TPanel;
13        pnlTop: TPanel;
14        pnlNotTheBottom: TPanel;
15        pnlMiddle: TPanel;
16        pnlBottom: TPanel;
17        sptTop: TSplitter;
18        sptBottom: TSplitter;
19        pnl_Not3: TPanel;
20        pnl_Not8: TPanel;
21        pnl_4: TPanel;
22        pnl_5: TPanel;
23        pnl_6: TPanel;
24        pnl_7: TPanel;
25        pnl_8: TPanel;
26        spt_3: TSplitter;
27        spt_4: TSplitter;
28        spt_5: TSplitter;
29        pnl_1: TPanel;
30        pnl_2: TPanel;
31        pnl_3: TPanel;
32        spt_1: TSplitter;
33        spt_2: TSplitter;
34        lbl_1: TOROffsetLabel;
35        lbl_2: TOROffsetLabel;
36        lbl_4: TOROffsetLabel;
37        lbl_5: TOROffsetLabel;
38        lbl_6: TOROffsetLabel;
39        lbl_7: TOROffsetLabel;
40        lbl_8: TOROffsetLabel;
41        lst_1: TORListBox;
42        lst_2: TORListBox;
43        lst_4: TORListBox;
44        lst_5: TORListBox;
45        lst_6: TORListBox;
46        lst_7: TORListBox;
47        lst_8: TORListBox;
48        timPoll: TTimer;
49        popMenuAllergies: TPopupMenu;
50        popNewAllergy: TMenuItem;
51        popNKA: TMenuItem;
52        popEditAllergy: TMenuItem;
53        popEnteredInError: TMenuItem;
54        pnlFlag: TPanel;
55        lstFlag: TORListBox;
56        lblFlag: TOROffsetLabel;
57        lbl_3: TOROffsetLabel;
58        lst_3: TORListBox;
59        sptFlag: TSplitter;
60        VA508ComponentAccessibility1: TVA508ComponentAccessibility;
61        procedure CoverItemClick(Sender: TObject);
62        procedure timPollTimer(Sender: TObject);
63        procedure FormClose(Sender: TObject; var Action: TCloseAction);
64        procedure RemContextPopup(Sender: TObject; MousePos: TPoint;
65          var Handled: Boolean);
66        procedure FormCreate(Sender: TObject);
67        procedure FormDestroy(Sender: TObject);
68        procedure sptBottomCanResize(Sender: TObject; var NewSize: Integer;
69          var Accept: Boolean);
70        procedure sptTopCanResize(Sender: TObject; var NewSize: Integer;
71          var Accept: Boolean);
72        procedure spt_1CanResize(Sender: TObject; var NewSize: Integer;
73          var Accept: Boolean);
74        procedure spt_2CanResize(Sender: TObject; var NewSize: Integer;
75          var Accept: Boolean);
76        procedure spt_3CanResize(Sender: TObject; var NewSize: Integer;
77          var Accept: Boolean);
78        procedure spt_4CanResize(Sender: TObject; var NewSize: Integer;
79          var Accept: Boolean);
80        procedure spt_5CanResize(Sender: TObject; var NewSize: Integer;
81          var Accept: Boolean);
82        procedure popMenuAllergiesPopup(Sender: TObject);
83        procedure popNewAllergyClick(Sender: TObject);
84        procedure popNKAClick(Sender: TObject);
85        procedure popEditAllergyClick(Sender: TObject);
86        procedure popEnteredInErrorClick(Sender: TObject);
87        procedure CoverItemExit(Sender: TObject);
88        procedure lstFlagClick(Sender: TObject);
89        procedure lstFlagKeyDown(Sender: TObject; var Key: Word;
90          Shift: TShiftState);
91        procedure FormShow(Sender: TObject);
92      private
93        FCoverList: TCoverSheetList;
94        popReminders: TORPopupMenu;
95        FLoadingForDFN: string;  //*DFN*
96        procedure RemindersChange(Sender: TObject);
97        procedure GetPatientFlag;
98        procedure LoadList(const StsTxt: string; ListCtrl: TObject;
99          ARpc: String; ACase, AInvert: Boolean; ADatePiece: integer; ADateFormat, AParam1, AID, ADetail: String; Reminders: boolean = FALSE);
100     public
101       procedure ClearPtData; override;
102       procedure DisplayPage; override;
103       procedure SetFontSize(NewFontSize: Integer); override;
104       procedure NotifyOrder(OrderAction: Integer; AnOrder: TOrder); override;       {REV}
105       procedure UpdateAllergiesList;
106       procedure UpdateVAAButton;
107     end;
108   
109   var
110     frmCover: TfrmCover;
111     VAAFlag: TStringList;
112     MHVFlag: TStringList;
113     VAA_DFN: string;
114     PtIsVAA: boolean;
115     PtIsMHV: boolean;  
116   
117   const
118     CoverSplitters1 = 'frmCoverSplitters1';
119     CoverSplitters2 = 'frmCoverSplitters2';
120   
121   implementation
122   
123   {$R *.DFM}
124   
125   uses ORNet, ORFn, fRptBox, fVitals, fvit, fFrame, uCore, TRPCB, uConst, uInit,
126     uReminders, rReminders, fARTAllgy, uOrPtf, fPatientFlagMulti, rODAllergy, rMisc,
127     VA508AccessibilityRouter;
128   
129   const
130     TAG_PROB = 10;
131     TAG_ALLG = 20;
132     TAG_POST = 30;
133     TAG_MEDS = 40;
134     TAG_RMND = 50;
135     TAG_LABS = 60;
136     TAG_VITL = 70;
137     TAG_VSIT = 80;
138     RemID    = '50';
139   
140     TX_INACTIVE_ICDCODE = 'The ICD-9-CM code for this problem is inactive.' + CRLF + CRLF +
141                        'Please correct this code using the ''Problems'' tab.';
142     TC_INACTIVE_ICDCODE = 'Inactive ICD-9-CM code';
143     TX_INACTIVE_10DCODE = 'The ICD-10-CM code for this problem is inactive.' + CRLF + CRLF +
144                        'Please correct this code using the ''Problems'' tab.';
145     TC_INACTIVE_10DCODE = 'Inactive ICD-10-CM code';
146     TX_INACTIVE_SCTCODE = 'The SNOMED CT code for this problem is inactive.' + CRLF + CRLF +
147                        'Please correct this code using the ''Problems'' tab.';
148     TC_INACTIVE_SCTCODE = 'Inactive SNOMED CT code';
149   
150   var
151     uIPAddress: string;
152     uARTCoverSheetParams: string;
153   
154   procedure TfrmCover.ClearPtData;
155   { clears all lists displayed on the cover sheet }
156   begin
157     timPoll.Enabled := False;
158     if Length(FLoadingForDFN) > 0 then StopCoverSheet(FLoadingForDFN, uIPAddress, frmFrame.Handle);  //*DFN*
159     FLoadingForDFN := '';  //*DFN*
160     inherited ClearPtData;
161     lst_1.Clear;
162     lst_2.Clear;
163     lst_3.Clear;
164     lst_4.Clear;
165     lst_5.Clear;
166     lst_6.Clear;
167     lst_7.Clear;
168     lst_8.Clear;
169     pnl_1.Visible := false;
170     pnl_2.Visible := false;
171     pnl_3.Visible := false;
172     pnl_4.Visible := false;
173     pnl_5.Visible := false;
174     pnl_6.Visible := false;
175     pnl_7.Visible := false;
176     pnl_8.Visible := false;
177   end;
178   
179   procedure TfrmCover.LoadList(const StsTxt: string; ListCtrl: TObject;
180     ARpc: String; ACase, AInvert: Boolean; ADatePiece: integer; ADateFormat, AParam1, AID, ADetail: String; Reminders: boolean = FALSE);
181   begin
182     StatusText(StsTxt);
183     if(ListCtrl is TORListBox) then
184     begin
185       ListGeneric((ListCtrl as TORListBox).Items, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
186       if((ListCtrl as TORListBox).Items.Count = 0) then
187         (ListCtrl as TORListBox).Items.Add(NoDataText(Reminders));
188     end
189     else
190     begin
191       ListGeneric(ListCtrl as TStrings, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
192       if((ListCtrl as TStrings).Count = 0) then
193         (ListCtrl as TStrings).Add(NoDataText(Reminders));
194     end;
195     StatusText('');
196   end;
197   
198   procedure TfrmCover.DisplayPage;
199   { loads the cover sheet lists if the patient has just been selected }
200   var
201     DontDo, ForeGround: string;
202     WaitCount: Integer;
203     RemSL: TStringList;
204     uCoverSheetList: TStringList;
205     i, iRem: Integer;
206     aIFN, aRPC, aCase, aInvert, aDatePiece, aDateFormat, aTextColor, aStatus, aParam1, aID, aQualifier, aTabPos, aName, aPiece, aDetail, x: string;
207     bCase, bInvert: Boolean;
208     iDatePiece: Integer;
209   
210   (*  procedure LoadList(const StsTxt: string; ListCtrl: TObject;
211       ARpc: String; ACase, AInvert: Boolean; ADatePiece: integer; ADateFormat, AParam1, AID, ADetail: String; Reminders: boolean = FALSE);
212     begin
213       StatusText(StsTxt);
214       if(ListCtrl is TORListBox) then
215       begin
216         ListGeneric((ListCtrl as TORListBox).Items, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
217         if((ListCtrl as TORListBox).Items.Count = 0) then
218           (ListCtrl as TORListBox).Items.Add(NoDataText(Reminders));
219       end
220       else
221       begin
222         ListGeneric(ListCtrl as TStrings, ARpc, ACase, AInvert, ADatePiece, ADateFormat, AParam1, ADetail, AID);
223         if((ListCtrl as TStrings).Count = 0) then
224           (ListCtrl as TStrings).Add(NoDataText(Reminders));
225       end;
226       StatusText('');
227     end;*)
228   
229     procedure WaitList(ListCtrl: TORListBox);
230     begin
231       ListCtrl.Clear;
232       Inc(WaitCount);
233       ListCtrl.Items.Add('0^Retrieving in background...');
234       ListCtrl.Repaint;
235     end;
236   
237   begin
238     inherited DisplayPage;
239     iRem := -1;
240     frmFrame.mnuFilePrintSetup.Enabled := True;
241     if InitPage then
242       uIPAddress := DottedIPStr;
243     if InitPatient then
244       begin
245         WaitCount := 0;
246         if InteractiveRemindersActive then
247         begin
248           if(InitialRemindersLoaded) then
249           begin
250             DontDo := RemID+';';
251             NotifyWhenRemindersChange(RemindersChange);
252           end
253           else
254           begin
255             DontDo := '';
256             RemoveNotifyRemindersChange(RemindersChange);
257           end;
258         end;
259         ForeGround := StartCoverSheet(uIPAddress, frmFrame.Handle,
260                       DontDo, InteractiveRemindersActive);
261         uCoverSheetList := TStringList.Create;
262         LoadCoverSheetList(uCoverSheetList);
263         for i := 0 to uCoverSheetList.Count - 1 do
264           begin
265             x := uCoverSheetList[i];
266             aName := Piece(x,'^',2);
267             aRPC := Piece(x,'^',6);
268             aCase := Piece(x,'^',7);
269             aInvert := Piece(x,'^',8);
270             aDatePiece := Piece(x,'^',11);
271             aDateFormat := Piece(x,'^',10);
272             aTextColor := Piece(x,'^',9);
273             aStatus := 'Searching for ' + Piece(x,'^',2) + '...';
274             aParam1 := Piece(x,'^',12);
275             aID := Piece(x,'^',1);         //TAG_PROB, TAG_RMND, ETC.
276             aQualifier := Piece(x,'^',13);
277             aTabPos := Piece(x,'^',14);
278             aPiece := Piece(x,'^',15);
279             aDetail := Piece(x,'^',16);
280             aIFN := Piece(x,'^',17);
281             bCase := FALSE;
282             bInvert := FALSE;
283             iDatePiece := 0;
284             if aCase = '1' then bCase := TRUE;
285             if aInvert = '1' then bInvert := TRUE;
286             if Length(aDatePiece) > 0 then iDatePiece := StrToInt(aDatePiece);
287             if Length(aTextColor) > 0 then aTextColor := 'cl' + aTextColor;
288             // Assign properties to components
289             FCoverList.CVlbl(i).Caption := aName;
290             FCoverList.CVlst(i).Caption := aName;
291             if Length(aTabPos) > 0 then FCoverList.CVlst(i).TabPositions := aTabPos;
292             if Length(aTextColor) > 0 then FCoverList.CVlst(i).Font.Color :=
293                                               Get508CompliantColor(StringToColor(aTextColor));
294             if Length(aPiece) > 0 then FCoverList.CVlst(i).Pieces := aPiece;
295             FCoverList.CVlst(i).Tag := StrToInt(aID);
296             if(aID <> RemID) then
297             begin
298               if((aID = '20') or (Pos(aID + ';', ForeGround) > 0)) then
299                 LoadList(aStatus, FCoverList.CVlst(i), aRpc, bCase, bInvert, iDatePiece, aDateFormat, aParam1, aID, aDetail)
300               else
301                 Waitlist(FCoverList.CVlst(i));
302               if (aID = '20') and ARTPatchInstalled then with FCoverList.CVlst(i) do
303                 begin
304                   uARTCoverSheetParams := x;
305                   PopupMenu := popMenuAllergies;
306                   RightClickSelect := True;
307                   popMenuAllergies.PopupComponent := FCoverList.CVlst(i);
308                 end;
309             end;
310             FCoverList.CVpln(i).Visible := true;
311             if aID = RemID then
312               begin
313                 FCoverList.CVlst(i).OnContextPopup := RemContextPopup;
314                 FCoverList.CVlst(i).RightClickSelect := True;
315                 iRem := FCoverList.CVlst(i).ComponentIndex;
316                 if InteractiveRemindersActive then
317                   begin
318                     if(InitialRemindersLoaded) then
319                       CoverSheetRemindersInBackground := FALSE
320                     else
321                       begin
322                         InitialRemindersLoaded := TRUE;
323                         CoverSheetRemindersInBackground := (Pos(aID + ';', ForeGround) = 0);
324                         if(not CoverSheetRemindersInBackground) then
325                           begin
326                             //InitialRemindersLoaded := TRUE;
327                             RemSL := TStringList.Create;
328                             try
329                               LoadList(aStatus, RemSL, aRpc, bCase, bInvert, iDatePiece, aDateFormat, aParam1, aID, aDetail);
330                               RemindersEvaluated(RemSL);
331                             finally;
332                               RemSL.Free;
333                             end;
334                             NotifyWhenRemindersChange(RemindersChange);
335                           end
336                         else
337                             Waitlist(FCoverList.CVlst(i));
338                       end;
339                   end
340                 else
341                   if Pos(aID + ';', ForeGround) > 0 then
342                       LoadList(aStatus, FCoverList.CVlst(i), aRpc, bCase, bInvert, iDatePiece, aDateFormat, aParam1, aID, aDetail, TRUE)
343                   else
344                       Waitlist(FCoverList.CVlst(i));
345                 if WaitCount > 0 then
346                   begin
347                     FLoadingForDFN := Patient.DFN;
348                     timPoll.Enabled := True;
349                   end
350                 else FLoadingForDFN := '';  //*DFN*
351                 if InteractiveRemindersActive then
352                   begin
353                     RemindersStarted := TRUE;
354                     LoadReminderData(CoverSheetRemindersInBackground);
355                   end;
356               end;
357             if WaitCount > 0 then
358               begin
359                 FLoadingForDFN := Patient.DFN;
360                 timPoll.Enabled := True;
361               end
362             else FLoadingForDFN := '';  //*DFN*
363           end;
364         FocusFirstControl;
365         spt_2.Left := pnl_Not3.Left + pnl_Not3.Width;
366         spt_5.Left := pnl_Not8.Left + pnl_Not8.Width;
367         GetPatientFlag;
368       end;
369     if InitPage then
370       begin
371         popReminders := TORPopupMenu.Create(Self);
372         if InteractiveRemindersActive then
373           begin
374             SetReminderPopupCoverRoutine(popReminders);
375             if iRem > -1 then
376               (frmCover.Components[iRem] as TORListBox).PopupMenu := popReminders;
377           end
378         else
379           begin
380             if iRem > -1 then
381               begin
382                 (frmCover.Components[iRem] as TORListBox).RightClickSelect := FALSE;
383                 (frmCover.Components[iRem] as TORListBox).OnMouseUp := nil;
384               end;
385           end;
386       end;
387   end;
388   
389   procedure TfrmCover.SetFontSize(NewFontSize: Integer);
390   var
391     i: integer;
392   begin
393     inherited;
394     with frmCover do
395             for i := ComponentCount - 1 downto 0 do
396               begin
397                 if Components[i] is TORListBox then
398                   begin
399                     case Components[i].Tag of
400                       30: (Components[i] as TORListBox).Font.Size := NewFontSize;
401                     end;
402                   end;
403               end;
404   end;
405   
406   procedure TfrmCover.CoverItemClick(Sender: TObject);
407   { displays details for an item that has been clicked on the cover sheet }
408   var
409     i: integer;
410     aDetail: string;
411     lb: TORListBox;
412   begin
413     inherited;
414     lb := TORListBox(Sender);
415     if lb.ItemIndex <> -1 then begin
416       aDetail := Uppercase(Piece(lb.Items[lb.ItemIndex],'^',12));
417       case lb.Tag of
418         TAG_PROB:
419                if lb.ItemIEN > 0  then begin
420                  i := lb.ItemIndex;
421                  if Piece(lb.Items[lb.ItemIndex], U, 13) = '#' then
422                  begin
423                    if Piece(lb.Items[lb.ItemIndex], U, 16) = '10D' then
424                      InfoBox(TX_INACTIVE_10DCODE, TC_INACTIVE_10DCODE, MB_ICONWARNING or MB_OK)
425                    else
426                      InfoBox(TX_INACTIVE_ICDCODE, TC_INACTIVE_ICDCODE, MB_ICONWARNING or MB_OK);
427                  end
428                  else if Piece(lb.Items[lb.ItemIndex], U, 13) = '$' then
429                    InfoBox(TX_INACTIVE_SCTCODE, TC_INACTIVE_SCTCODE, MB_ICONWARNING or MB_OK);
430                  lb.ItemIndex := i;
431                  ReportBox(DetailGeneric(lb.ItemIEN, lb.ItemID, aDetail), lb.DisplayText[lb.ItemIndex], True);
432                end;
433         TAG_ALLG:
434       { TODO -oRich V. -cART/Allergy : What to do about NKA only via right-click menu?  Add here? }
435                if lb.ItemIEN > 0 then begin
436                  if ARTPatchInstalled then begin
437                    AllergyBox(DetailGeneric(lb.ItemIEN, lb.ItemID, aDetail), lb.DisplayText[lb.ItemIndex], True, lb.ItemIEN);
438                    //TDP - Fixed allergy form focus problem
439                    if (frmARTAllergy <> nil) and frmARTAllergy.Showing then frmARTAllergy.SetFocus;
440                  end else begin
441                    ReportBox(DetailGeneric(lb.ItemIEN, lb.ItemID, aDetail), lb.DisplayText[lb.ItemIndex], True);
442                  end;
443                end;
444         TAG_POST:
445                if lb.DisplayText[lb.ItemIndex] = 'Allergies' then begin
446                  ReportBox(DetailPosting('A'), lb.DisplayText[lb.ItemIndex], True);
447                end else if lb.ItemID <> '' then begin
448                  NotifyOtherApps(NAE_REPORT, 'TIU^' + lb.ItemID);
449                  ReportBox(DetailPosting(lb.ItemID), lb.DisplayText[lb.ItemIndex], True);
450                end;
451         TAG_MEDS:
452                if (lb.ItemID <> '') and (lb.ItemID <> '0') then begin
453                  ReportBox(DetailMed(lb.ItemID), lb.DisplayText[lb.ItemIndex], True);
454                end;
455         TAG_RMND:
456                if lb.ItemIEN > 0  then begin
457                  ReportBox(DetailReminder(lb.ItemIEN), ClinMaintText + ': ' + lb.DisplayText[lb.ItemIndex], True);
458                end;
459         TAG_LABS:
460                if (lb.ItemID <> '') and (Piece(lb.ItemID,';',1) <> '0') and
461                   (not ContainsAlpha(Piece(lb.ItemID,';',1))) then begin
462                  ReportBox(DetailGeneric(lb.ItemIEN, lb.ItemID, aDetail), lb.DisplayText[lb.ItemIndex], True);
463                end;
464         TAG_VITL:
465                if lb.ItemID <> '' then begin
466                  //agp prevent double clicking on Vitals which can cause CPRS to shut down when exiting vitals
467                  TORListBox(Sender).Enabled := false;
468                  SelectVitals(Piece(lb.DisplayText[lb.ItemIndex],Char(9),1)); //Char(9) = Tab Character
469                  ClearPtData;
470                  //agp set InitialRemindersLoaded to False only if reminders are still evaluating. This prevent
471                  //a problem with reminders not finishing the evaluation if the Vital DLL is launch and it prevent
472                  //an automatic re-evaluation of reminders if reminders are done evaluating.
473                  if RemindersEvaluatingInBackground = true then  InitialRemindersLoaded := False;
474                  DisplayPage;
475                  TORListBox(Sender).Enabled := True;
476                end;
477         TAG_VSIT:
478                if (lb.ItemID <> '') and (lb.ItemID <> '0') then begin
479                  ReportBox(DetailGeneric(lb.ItemIEN, lb.ItemID, aDetail), lb.DisplayText[lb.ItemIndex], True);
480                end
481       else
482         //don't try to display a detail report
483       end;
484     end;
485     lb.SetFocus;
486     if uInit.TimedOut then                       // Fix for CQ: 8011
487       Abort
488     else
489       lb.ItemIndex := -1;
490   end;
491   
492   procedure TfrmCover.FormClose(Sender: TObject; var Action: TCloseAction);
493   begin
494     inherited;
495     timPoll.Enabled := False;
496     if Length(FLoadingForDFN) > 0 then StopCoverSheet(FLoadingForDFN, uIPAddress, frmFrame.Handle);  //*DFN*
497     FLoadingForDFN := '';  //*DFN*
498   end;
499   
500   procedure TfrmCover.timPollTimer(Sender: TObject);
501   const
502     RemUnchanged = '[{^Reminders @ @ @ Unchanged^]}';
503   
504   var
505     Done: Boolean;
506     ReminderSL: TStringList;
507     ProbSL, PostSL, MedsSL, RemSL, LabsSL, VitSL, VisitSL: TStringList;
508     i, iProb, iPost, iMeds, iRem, iLabs, iVit, iVisit: integer;
509   begin
510     inherited;
511     iProb := -1;
512     iPost := -1;
513     iMeds := -1;
514     iRem := -1;
515     iLabs := -1;
516     iVit := -1;
517     iVisit := -1;
518     with frmCover do
519       for i := ComponentCount - 1 downto 0 do
520         begin
521           if Components[i] is TORListBox then
522             begin
523               case Components[i].Tag of
524                 TAG_PROB: iProb := i;
525                 TAG_POST: iPost := i;
526                 TAG_MEDS: iMeds := i;
527                 TAG_RMND: iRem := i;
528                 TAG_LABS: iLabs := i;
529                 TAG_VITL: iVit := i;
530                 TAG_VSIT: iVisit := i;
531               end;
532             end;
533         end;
534     ProbSL := TStringList.Create;
535     PostSL := TStringList.Create;
536     MedsSL := TStringList.Create;
537     RemSL := TStringList.Create;
538     LabsSL := TStringList.Create;
539     VitSL := TStringList.Create;
540     VisitSL := TStringList.Create;
541     if InteractiveRemindersActive then
542     begin
543       ReminderSL := TStringList.Create;
544       try
545         ReminderSL.Add(RemUnchanged);
546         ListAllBackGround(Done, ProbSL, PostSL, MedsSL, ReminderSL, LabsSL, VitSL, VisitSL, uIPAddress, frmFrame.Handle);
547         if (iProb > -1) and (ProbSL.Count > 0) then FastAssign(ProbSL, (Components[iProb] as TORListBox).Items);
548         if (iPost > -1) and (PostSL.Count > 0) then FastAssign(PostSL, (Components[iPost] as TORListBox).Items);
549         if (iMeds > -1) and (MedsSL.Count > 0) then FastAssign(MedsSL, (Components[iMeds] as TORListBox).Items);
550         if (iLabs > -1) and (LabsSL.Count > 0) then FastAssign(LabsSL, (Components[iLabs] as TORListBox).Items);
551         if (iVit > -1) and (VitSL.Count > 0) then FastAssign(VitSL, (Components[iVit] as TORListBox).Items);
552         if (iVisit > -1) and (VisitSL.Count > 0) then FastAssign(VisitSL, (Components[iVisit] as TORListBox).Items);
553         // since this RPC is connected to a timer, clear the results each time to make sure that
554         // the results aren't passed to another RPC in the case that there is an error
555         RPCBrokerV.ClearResults := True;
556         if Done then
557         begin
558           timPoll.Enabled := False;
559           FLoadingForDFN := '';  //*DFN*
560         end;
561         if(not InitialRemindersLoaded) and
562           (ReminderSL.Count <> 1) or (ReminderSL[0] <> RemUnchanged) then
563         begin
564           CoverSheetRemindersInBackground := FALSE;
565   //        InitialRemindersLoaded := TRUE;
566           RemindersEvaluated(ReminderSL);
567           NotifyWhenRemindersChange(RemindersChange);
568         end;
569       finally
570         ReminderSL.Free;
571       end;
572     end
573     else
574     begin
575       ListAllBackGround(Done, ProbSL, PostSL, MedsSL, RemSL, LabsSL, VitSL, VisitSL, uIPAddress, frmFrame.Handle);
576       if (iProb > -1) and (ProbSL.Count > 0) then FastAssign(ProbSL, (Components[iProb] as TORListBox).Items);
577       if (iPost > -1) and (PostSL.Count > 0) then FastAssign(PostSL, (Components[iPost] as TORListBox).Items);
578       if (iMeds > -1) and (MedsSL.Count > 0) then FastAssign(MedsSL, (Components[iMeds] as TORListBox).Items);
579       if (iRem > -1) and (RemSL.Count > 0) then FastAssign(RemSL, (Components[iRem] as TORListBox).Items);
580       if (iLabs > -1) and (LabsSL.Count > 0) then FastAssign(LabsSL, (Components[iLabs] as TORListBox).Items);
581       if (iVit > -1) and (VitSL.Count > 0) then FastAssign(VitSL, (Components[iVit] as TORListBox).Items);
582       if (iVisit > -1) and (VisitSL.Count > 0) then FastAssign(VisitSL, (Components[iVisit] as TORListBox).Items);
583       // since this RPC is connected to a timer, clear the results each time to make sure that
584       // the results aren't passed to another RPC in the case that there is an error
585       RPCBrokerV.ClearResults := True;
586       if Done then
587       begin
588         timPoll.Enabled := False;
589         FLoadingForDFN := '';  //*DFN*
590       end;
591     end;
592     ProbSL.Free;
593     PostSL.Free;
594     MedsSL.Free;
595     RemSL.Free;
596     LabsSL.Free;
597     VitSL.Free;
598     VisitSL.Free;
599   end;
600   
601   procedure TfrmCover.NotifyOrder(OrderAction: Integer; AnOrder: TOrder);    {REV}
602   var
603     i: integer;
604   begin
605     case OrderAction of
606     ORDER_SIGN:
607       begin
608         with frmCover do
609             for i := ComponentCount - 1 downto 0 do
610               begin
611                 if Components[i] is TORListBox then
612                   begin
613                     case Components[i].Tag of
614                       20: UpdateAllergiesList;
615                       30: ListPostings((Components[i] as TORListBox).Items);
616                     end;
617                   end;
618               end;
619       end;
620     end;
621   end;
622   
623   procedure TfrmCover.RemindersChange(Sender: TObject);
624   var
625     i: integer;
626     tmp: string;
627     lb: TORListBox;
628   
629   begin
630     lb := nil;
631     with frmCover do
632       for i := ComponentCount - 1 downto 0 do
633       begin
634         if (Components[i] is TORListBox) and (Components[i].Tag = TAG_RMND) then
635         begin
636           lb := (Components[i] as TORListBox);
637           break;
638         end;
639       end;
640     if assigned(lb) then
641     begin
642       lb.Clear;
643      //i := -1;
644       //AGP Change 26.8 this changes allowed Reminders to display on the coversheet
645       //even if they had an error on evaluation
646       for i := 0 to ActiveReminders.Count-1 do
647         begin
648           if Piece(ActiveReminders.Strings[i],U,6)='1' then
649              begin
650                tmp := ActiveReminders[i];
651                SetPiece(tmp, U, 3, FormatFMDateTimeStr('mmm dd,yy', Piece(tmp, U, 3)));
652                lb.Items.Add(tmp);
653              end;
654           if Piece(ActiveReminders.Strings[i],U,6)='3' then
655              begin
656                tmp := ActiveReminders[i];
657                SetPiece(tmp, U, 3, 'Error');
658                lb.Items.Add(tmp);
659              end;
660           if Piece(ActiveReminders.Strings[i],U,6)='4' then
661              begin
662                tmp := ActiveReminders[i];
663                SetPiece(tmp, U, 3, 'CNBD');
664                lb.Items.Add(tmp);
665              end;
666         end;
667         //AGP End Change for 26.8
668       if(RemindersEvaluatingInBackground) then
669         lb.Items.Insert(0,'0^Evaluating Reminders...')
670       //AGP added code below to change the reminder panel picture if the clock has not stop by this point. CQ
671       else if(lb.Items.Count = 0) and (RemindersStarted) then
672         begin
673           lb.Items.Add(NoDataText(TRUE));
674           if frmFrame.anmtRemSearch.Visible = true then
675             begin
676               frmFrame.anmtRemSearch.Visible := FALSE;
677               frmFrame.imgReminder.Visible := TRUE;
678               frmFrame.imgReminder.Picture.Bitmap.LoadFromResourceName(hInstance, 'BMP_REMINDERS_APPLICABLE');
679               frmFrame.anmtRemSearch.Active := FALSE;
680             end;
681         end
682       else if (lb.Items.Count > 0) and (RemindersStarted) and (frmFrame.anmtRemSearch.Visible = true) then
683          begin
684               frmFrame.anmtRemSearch.Visible := FALSE;
685               frmFrame.imgReminder.Visible := TRUE;
686               frmFrame.imgReminder.Picture.Bitmap.LoadFromResourceName(hInstance, 'BMP_REMINDERS_DUE');
687               frmFrame.anmtRemSearch.Active := FALSE;
688          end;
689     end;
690   end;
691   
692   Procedure TfrmCover.RemContextPopup(Sender: TObject;
693     MousePos: TPoint; var Handled: Boolean);
694   var
695     idx: integer;
696     i, iRem: integer;
697   begin
698     inherited;
699     Handled := TRUE;
700     iRem := -1;
701     with frmCover do
702       for i := ComponentCount - 1 downto 0 do
703         begin
704           if Components[i] is TORListBox then
705             begin
706               case Components[i].Tag of
707                 TAG_RMND: iRem := i;
708               end;
709             end;
710         end;
711     if iRem > -1 then
712       if ((frmCover.Components[iRem] as TORListBox).ItemIndex >= 0) then
713         begin
714           idx := StrToIntDef(Piece((frmCover.Components[iRem] as TORListBox).Items[(frmCover.Components[iRem] as TORListBox).ItemIndex],U,1),0);
715           if(idx <> 0) then
716           begin
717             popReminders.Data := RemCode + (frmCover.Components[iRem] as TORListBox).Items[(frmCover.Components[iRem] as TORListBox).ItemIndex];
718             Handled := FALSE;
719           end;
720         end;
721   end;
722   
723   procedure TfrmCover.FormCreate(Sender: TObject);
724   begin
725     inherited;
726     PageID := CT_COVER;
727     FCoverList := TCoverSheetList.Create;
728     FCoverList.Add(pnl_1, lbl_1, lst_1);
729     FCoverList.Add(pnl_2, lbl_2, lst_2);
730     FCoverList.Add(pnl_3, lbl_3, lst_3);
731     FCoverList.Add(pnl_4, lbl_4, lst_4);
732     FCoverList.Add(pnl_5, lbl_5, lst_5);
733     FCoverList.Add(pnl_6, lbl_6, lst_6);
734     FCoverList.Add(pnl_7, lbl_7, lst_7);
735     FCoverList.Add(pnl_8, lbl_8, lst_8);
736   end;
737   
738   procedure TfrmCover.FormDestroy(Sender: TObject);
739   begin
740     inherited;
741     FCoverList.Free;
742   end;
743   
744   procedure TfrmCover.FormShow(Sender: TObject);
745   begin
746     inherited;
747     //If a Dx was added to the PL, Update the Problem List on the Coversheet
748     if Changes.RefreshCoverPL then
749     begin
750       ListActiveProblems(lst_1.Items);
751       Changes.RefreshCoverPL := False;
752     end;
753   end;
754   
755   procedure TfrmCover.sptBottomCanResize(Sender: TObject;
756     var NewSize: Integer; var Accept: Boolean);
757   begin
758     inherited;
759       if NewSize < 50 then
760         Newsize := 50;
761   end;
762   
763   procedure TfrmCover.sptTopCanResize(Sender: TObject; var NewSize: Integer;
764     var Accept: Boolean);
765   begin
766     inherited;
767       if NewSize < 50 then
768         Newsize := 50;
769   end;
770   
771   procedure TfrmCover.spt_1CanResize(Sender: TObject; var NewSize: Integer;
772     var Accept: Boolean);
773   begin
774     inherited;
775     if NewSize < 50 then
776         Newsize := 50;
777   end;
778   
779   procedure TfrmCover.spt_2CanResize(Sender: TObject; var NewSize: Integer;
780     var Accept: Boolean);
781   begin
782     inherited;
783     if NewSize < 50 then
784         Newsize := 50;
785   end;
786   
787   procedure TfrmCover.spt_3CanResize(Sender: TObject; var NewSize: Integer;
788     var Accept: Boolean);
789   begin
790     inherited;
791     if NewSize < 50 then
792         Newsize := 50;
793   end;
794   
795   procedure TfrmCover.spt_4CanResize(Sender: TObject; var NewSize: Integer;
796     var Accept: Boolean);
797   begin
798     inherited;
799     if NewSize < 50 then
800         Newsize := 50;
801   end;
802   
803   procedure TfrmCover.spt_5CanResize(Sender: TObject; var NewSize: Integer;
804     var Accept: Boolean);
805   begin
806     inherited;
807     if NewSize < 50 then
808         Newsize := 50;
809   end;
810   
811   procedure TfrmCover.popMenuAllergiesPopup(Sender: TObject);
812   const
813     NO_ASSESSMENT = 'No Allergy Assessment';
814   var
815     AListBox: TORListBox;
816     x: string;
817   begin
818     inherited;
819     AListBox := (popMenuAllergies.PopupComponent as TORListBox);
820     popEditAllergy.Enabled := (AListBox.ItemIEN > 0) and IsARTClinicalUser(x);
821     popEnteredInError.Enabled := (AListBox.ItemIEN > 0) and IsARTClinicalUser(x);
822     popNKA.Enabled := (AListBox.Items.Count = 1) and
823                       (Piece(AListBox.Items[0], U, 2) = NO_ASSESSMENT);
824                       //and  IsARTClinicalUser(x);           v26.12
825     popNewAllergy.Enabled := True;  //IsARTClinicalUser(x);  v26.12
826   end;
827   
828   procedure TfrmCover.popNewAllergyClick(Sender: TObject);
829   const
830     NEW_ALLERGY = True;
831     ENTERED_IN_ERROR = True;
832   begin
833     inherited;
834     EnterEditAllergy(0, NEW_ALLERGY, not ENTERED_IN_ERROR);
835   end;
836   
837   procedure TfrmCover.popNKAClick(Sender: TObject);
838   var
839     Changed: boolean;
840   begin
841     inherited;
842     Changed := EnterNKAForPatient;
843     if Changed then UpdateAllergiesList;
844   end;
845   
846   procedure TfrmCover.popEditAllergyClick(Sender: TObject);
847   const
848     NEW_ALLERGY = True;
849     ENTERED_IN_ERROR = True;
850   begin
851     inherited;
852     EnterEditAllergy((popMenuAllergies.PopupComponent as TORListBox).ItemIEN, not NEW_ALLERGY, not ENTERED_IN_ERROR);
853   end;
854   
855   procedure TfrmCover.popEnteredInErrorClick(Sender: TObject);
856   begin
857     inherited;
858     MarkEnteredInError((popMenuAllergies.PopupComponent as TORListBox).ItemIEN);
859   end;
860   
861   procedure TfrmCover.UpdateAllergiesList;
862   var
863     bCase, bInvert: boolean;
864     iDatePiece: integer ;
865     x, aRPC, aDateFormat, aParam1, aID, aDetail, aStatus, aName, aCase, aInvert, aDatePiece, aTextColor, aQualifier, aTabPos, aPiece, aIFN: string;
866   begin
867     x := uARTCoverSheetParams;
868     if x = '' then exit;
869     aName := Piece(x,'^',2);
870     aRPC := Piece(x,'^',6);
871     aCase := Piece(x,'^',7);
872     aInvert := Piece(x,'^',8);
873     aDatePiece := Piece(x,'^',11);
874     aDateFormat := Piece(x,'^',10);
875     aTextColor := Piece(x,'^',9);
876     aStatus := 'Searching for ' + Piece(x,'^',2) + '...';
877     aParam1 := Piece(x,'^',12);
878     aID := Piece(x,'^',1);         //TAG_PROB, TAG_RMND, ETC.
879     aQualifier := Piece(x,'^',13);
880     aTabPos := Piece(x,'^',14);
881     aPiece := Piece(x,'^',15);
882     aDetail := Piece(x,'^',16);
883     aIFN := Piece(x,'^',17);
884     bCase := FALSE;
885     bInvert := FALSE;
886     iDatePiece := 0;
887     if aCase = '1' then bCase := TRUE;
888     if aInvert = '1' then bInvert := TRUE;
889     if Length(aDatePiece) > 0 then iDatePiece := StrToInt(aDatePiece);
890     if Length(aTextColor) > 0 then aTextColor := 'cl' + aTextColor;
891     // Assign properties to components
892     if Length(aTabPos) > 0 then (popMenuAllergies.PopupComponent as TORListBox).TabPositions := aTabPos;
893     if Length(aTextColor) > 0 then (popMenuAllergies.PopupComponent as TORListBox).Font.Color :=
894                                                         Get508CompliantColor(StringToColor(aTextColor));
895     if Length(aPiece) > 0 then (popMenuAllergies.PopupComponent as TORListBox).Pieces := aPiece;
896     (popMenuAllergies.PopupComponent as TORListBox).Tag := StrToInt(aID);
897     LoadList(aStatus, (popMenuAllergies.PopupComponent as TORListBox), aRpc, bCase, bInvert, iDatePiece, aDateFormat, aParam1, aID, aDetail);
898     with frmFrame do
899       begin
900         lblPtCWAD.Caption := GetCWADInfo(Patient.DFN);
901         if Length(lblPtCWAD.Caption) > 0
902           then lblPtPostings.Caption := 'Postings'
903           else lblPtPostings.Caption := 'No Postings';
904         pnlPostings.Caption := lblPtPostings.Caption + ' ' + lblPtCWAD.Caption;
905       end;
906   end;
907   
908   procedure TfrmCover.CoverItemExit(Sender: TObject);
909   begin
910     with Sender as TORListBox do
911       Selected[ItemIndex] := False;
912     inherited;
913   end;
914   
915   procedure TfrmCover.GetPatientFlag;
916   begin
917     pnlFlag.Visible := HasFlag;
918     sptFlag.Visible := HasFlag;
919     FastAssign(FlagList, lstFlag.Items);
920   end;
921   
922   procedure TfrmCover.lstFlagClick(Sender: TObject);
923   begin
924     if lstFlag.ItemIndex >= 0 then
925       ShowFlags(lstFlag.ItemID);
926     lstFlag.ItemIndex := -1;
927   end;
928   
929   procedure TfrmCover.lstFlagKeyDown(Sender: TObject; var Key: Word;
930     Shift: TShiftState);
931   begin
932     inherited;
933     if Key = VK_RETURN then
934       lstFlagClick(Self);
935   end;
936   
937   procedure TfrmCover.UpdateVAAButton;
938   const
939     MHVLabelOrigTop = 3;
940     PtInsLabelOrigTop = 27;
941   //var
942   //  PtIsVAA: boolean;
943   //  PtIsMHV: boolean;
944   begin
945   //VAA & MHV
946     PtIsVAA := false;
947     PtIsMHV := false;
948   
949     VAAFlag := TStringList.Create;
950     MHVFlag := TStringList.Create;
951     VAA_DFN := Patient.DFN;
952     tCallV(VAAFlag, 'ORVAA VAA', [VAA_DFN]);
953     tCallV(MHVFlag, 'ORWMHV MHV', [VAA_DFN]);
954     if VAAFlag[0] <> '0' then
955        begin
956        PtIsVAA := true;
957   
958        with frmFrame do
959           begin
960           laVAA2.Caption := Piece(VAAFlag[0], '^', 1);
961           laVAA2.Hint := Piece(VAAFlag[0], '^', 2); //CQ7626 was piece '6'
962           end;
963        end
964     else
965        begin
966        with frmFrame do
967           begin
968           laVAA2.Caption := #0;
969           laVAA2.Hint := 'No active insurance'; //CQ7626 added this line
970           end;
971        end;
972   
973     //MHV flag
974     if MHVFlag[0] <> '0' then
975        begin
976        PtIsMHV := true;
977   
978         with frmFrame do
979           begin
980            laMHV.Caption := Piece(MHVFlag[0], '^', 1);
981            laMHV.Hint := Piece(MHVFlag[0], '^', 2);
982   
983            if VAAFlag[0] = '0' then
984              laMHV.Caption := 'MHV';
985           end;
986        end
987     else
988        begin
989        with frmFrame do
990           begin
991           laMHV.Caption := #0;
992           laMHV.Hint := 'No MyHealthyVet data'; //CQ7626 added this line
993           end;
994        end;
995   
996     with frmFrame do
997        begin
998        //Modified this 'with' section for CQ7783
999        paVAA.Hide; //Start by hiding it.  Show it only if one of the conditions below is true, else it stays invisible.
1000       paVAA.Height := pnlPrimaryCare.Height;
1001  
1002       if ((PtIsVAA and PtIsMHV)) then  //CQ7411 - this line
1003          begin
1004          laMHV.Top := paVAA.Top;
1005          laMHV.Width := paVAA.Width - 1;
1006          laMHV.Height := (paVAA.ClientHeight div 2) - 1;
1007          laMHV.Visible := true;
1008  
1009          laVAA2.Top := laMHV.Top + laMHV.Height + 1;
1010          laVAA2.Width := paVAA.Width - 1;
1011          laVAA2.Height := (paVAA.ClientHeight div 2);
1012          laVAA2.Visible := true;
1013  
1014          paVAA.Show;
1015          end
1016       else
1017          if ((PtIsMHV and (not PtIsVAA))) then
1018             begin
1019             laMHV.Top := paVAA.Top;
1020             paVAA.Height := pnlPrimaryCare.Height;
1021             laMHV.Height := paVAA.ClientHeight - 1;
1022             laMHV.Visible := true;
1023             laVAA2.Visible  := false;
1024             paVAA.Show;
1025             end
1026       else
1027          if ((PtIsVAA and (not PtIsMHV))) then
1028             begin
1029             laVAA2.Top := paVAA.Top;
1030             paVAA.Height := pnlPrimaryCare.Height-2;
1031             laVAA2.Height := paVAA.ClientHeight - 1;
1032             laVAA2.Width := paVAA.Width - 1;
1033             laVAA2.Visible := true;
1034             laMHV.Visible := false;
1035  
1036             paVAA.Show;
1037             end;
1038    end; //with
1039  //end VAA & MHV
1040  end;
1041  
1042  initialization
1043    SpecifyFormIsNotADialog(TfrmCover);
1044  
1045  finalization
1046    if Assigned(fCover.VAAFlag) then fCover.VAAFlag.Free; //VAA
1047  
1048  end.

Module Calls (2 levels)


fCover
 ├fPage
 │ ├uConst
 │ ├rOrders
 │ ├fBase508Form
 │ ├fFrame
 │ └uInit
 ├rOrders...
 ├rCover
 │ ├uConst
 │ ├fFrame...
 │ ├uCore
 │ ├rMeds
 │ └uReminders
 ├fAllgyBox
 │ ├fRptBox
 │ ├fARTAllgy
 │ ├rCover...
 │ └rODAllergy
 ├fRptBox...
 ├fVitals
 │ ├fBase508Form...
 │ ├uVitals
 │ ├uCore...
 │ ├rCore
 │ ├fvit
 │ ├fFrame...
 │ ├fEncnt
 │ ├fRptBox...
 │ └rReports
 ├fFrame...
 ├uCore...
 ├uConst
 ├uInit...
 ├uReminders...
 ├rReminders
 │ ├fMHTest
 │ ├uCore...
 │ ├uReminders...
 │ └rCore...
 ├fARTAllgy...
 ├fPatientFlagMulti
 │ ├rMisc
 │ ├fBase508Form...
 │ ├uCore...
 │ ├uOrPtf
 │ ├uConst
 │ ├fRptBox...
 │ └rCover...
 └rODAllergy...

Module Called-By (2 levels)


                     fCover
                   fFrame┤ 
              CPRSChart┤ │ 
                  fPage┤ │ 
                uOrders┤ │ 
                fODBase┤ │ 
                UBACore┤ │ 
                fOrders┤ │ 
                   uPCE┤ │ 
      fBALocalDiagnoses┤ │ 
             fEncVitals┤ │ 
                fVitals┤ │ 
              fCover...┤ │ 
                 rCover┤ │ 
              fPtSelMsg┤ │ 
                 fPtSel┤ │ 
            fOrdersSign┤ │ 
         fPrintLocation┤ │ 
                  fMeds┤ │ 
                fRptBox┤ │ 
                 fNotes┤ │ 
               fReports┤ │ 
                 fEncnt┤ │ 
                 fProbs┤ │ 
          fReportsPrint┤ │ 
                fGraphs┤ │ 
              fConsults┤ │ 
                fDCSumm┤ │ 
        fReminderDialog┤ │ 
                  fLabs┤ │ 
              fLabPrint┤ │ 
                fReview┤ │ 
            fIconLegend┤ │ 
           fOrdersPrint┤ │ 
               fSurgery┤ │ 
uVA508CPRSCompatibility┤ │ 
           fOrdersRenew┤ │ 
             fODConsult┤ │ 
                fODProc┤ │ 
                 fODRad┤ │ 
                 fODLab┤ │ 
                fODMeds┤ │ 
               fODMedIV┤ │ 
              fODVitals┤ │ 
                fODAuto┤ │ 
                 fOMSet┤ │ 
         fOrdersRelease┤ │ 
              fODMedNVA┤ │ 
         fOrdersOnChart┤ │ 
             fOCSession┤ │ 
              fODActive┤ │ 
               fPCEEdit┘ │ 
                fARTAllgy┘ 
             uOrders...┤   
              fCover...┤   
              fAllgyBox┘