Index: cprs/branches/foia-cprs/CPRS-Chart/fCover.pas
===================================================================
--- cprs/branches/foia-cprs/CPRS-Chart/fCover.pas	(revision 459)
+++ cprs/branches/foia-cprs/CPRS-Chart/fCover.pas	(revision 460)
@@ -101,8 +101,14 @@
     procedure NotifyOrder(OrderAction: Integer; AnOrder: TOrder); override;       {REV}
     procedure UpdateAllergiesList;
+    procedure UpdateVAAButton;
   end;
 
 var
   frmCover: TfrmCover;
+  VAAFlag: TStringList;
+  MHVFlag: TStringList;
+  VAA_DFN: string;
+  PtIsVAA: boolean;
+  PtIsMHV: boolean;  
 
 const
@@ -114,6 +120,6 @@
 {$R *.DFM}
 
-uses ORNet, ORFn, fRptBox, fVitals, fvit, fFrame, uCore, TRPCB, uConst,
-  uReminders, rReminders, fARTAllgy, uOrPtf, fPatientFlagMulti, rODAllergy;
+uses ORNet, ORFn, fRptBox, fVitals, fvit, fFrame, uCore, TRPCB, uConst, uInit,
+  uReminders, rReminders, fARTAllgy, uOrPtf, fPatientFlagMulti, rODAllergy, rMisc;
 
 const
@@ -436,17 +442,9 @@
              if ItemID <> '' then
                begin
-                 SelectVitals(Font.Size);
-                 StatusText('Searching for recent vitals...');
-                 with frmCover do
-                  for i := ComponentCount - 1 downto 0 do
-                    begin
-                      if Components[i] is TORListBox then
-                        begin
-                          case Components[i].Tag of
-                            70: ListVitals((Components[i] as TORListBox).Items);
-                          end;
-                        end;
-                    end;
-                 StatusText('');
+                 frmFrame.VitalsDLLActive := True;
+                 SelectVitals(Piece(DisplayText[ItemIndex],Char(9),1)); //Char(9) = Tab Character
+                 frmFrame.VitalsDLLActive := False;
+                 ClearPtData;
+                 DisplayPage;
                end;
 
@@ -457,5 +455,8 @@
       //don't try to display a detail report
     end;
-    ItemIndex := -1;
+    if uInit.TimedOut then                       // Fix for CQ: 8011
+      Abort
+    else
+      ItemIndex := -1;
   end;
 end;
@@ -612,14 +613,29 @@
   begin
     lb.Clear;
-    i := -1;
-    repeat
-      i := ActiveReminders.IndexOfPiece('1',U,6,i);
-      if(i >= 0) then
+   //i := -1;
+    //AGP Change 26.8 this changes allowed Reminders to display on the coversheet
+    //even if they had an error on evaluation
+    for i := 0 to ActiveReminders.Count-1 do
       begin
-        tmp := ActiveReminders[i];
-        SetPiece(tmp, U, 3, FormatFMDateTimeStr('mmm dd,yy', Piece(tmp, U, 3)));
-        lb.Items.Add(tmp);
+        if Piece(ActiveReminders.Strings[i],U,6)='1' then
+           begin
+             tmp := ActiveReminders[i];
+             SetPiece(tmp, U, 3, FormatFMDateTimeStr('mmm dd,yy', Piece(tmp, U, 3)));
+             lb.Items.Add(tmp);
+           end;
+        if Piece(ActiveReminders.Strings[i],U,6)='3' then
+           begin
+             tmp := ActiveReminders[i];
+             SetPiece(tmp, U, 3, 'Error');
+             lb.Items.Add(tmp);
+           end;
+        if Piece(ActiveReminders.Strings[i],U,6)='4' then
+           begin
+             tmp := ActiveReminders[i];
+             SetPiece(tmp, U, 3, 'CNBD');
+             lb.Items.Add(tmp);
+           end;
       end;
-    until(i < 0);
+      //AGP End Change for 26.8
     if(RemindersEvaluatingInBackground) then
       lb.Items.Insert(0,'0^Evaluating Reminders...')
@@ -745,11 +761,14 @@
 var
   AListBox: TORListBox;
+  x: string;
 begin
   inherited;
   AListBox := (popMenuAllergies.PopupComponent as TORListBox);
-  popEditAllergy.Enabled := AListBox.ItemIEN > 0;
-  popEnteredInError.Enabled := AListBox.ItemIEN > 0;
+  popEditAllergy.Enabled := (AListBox.ItemIEN > 0) and IsARTClinicalUser(x);
+  popEnteredInError.Enabled := (AListBox.ItemIEN > 0) and IsARTClinicalUser(x);
   popNKA.Enabled := (AListBox.Items.Count = 1) and
                     (Piece(AListBox.Items[0], U, 2) = NO_ASSESSMENT);
+                    //and  IsARTClinicalUser(x);           v26.12
+  popNewAllergy.Enabled := True;  //IsARTClinicalUser(x);  v26.12
 end;
 
@@ -867,4 +886,115 @@
 end;
 
+procedure TfrmCover.UpdateVAAButton;
+const
+  MHVLabelOrigTop = 3;
+  PtInsLabelOrigTop = 27;
+//var
+//  PtIsVAA: boolean;
+//  PtIsMHV: boolean;
+
+begin
+//VAA & MHV
+  PtIsVAA := false;
+  PtIsMHV := false;
+
+  VAAFlag := TStringList.Create;
+  MHVFlag := TStringList.Create;
+  VAA_DFN := Patient.DFN;
+  tCallV(VAAFlag, 'ORVAA VAA', [VAA_DFN]);
+  tCallV(MHVFlag, 'ORWMHV MHV', [VAA_DFN]);
+
+  if VAAFlag[0] <> '0' then
+     begin
+     PtIsVAA := true;
+
+     with frmFrame do
+        begin
+        laVAA2.Caption := Piece(VAAFlag[0], '^', 0);
+        laVAA2.Hint := Piece(VAAFlag[0], '^', 2); //CQ7626 was piece '6'
+        end;
+     end
+  else
+     begin
+     with frmFrame do
+        begin
+        laVAA2.Caption := #0;
+        laVAA2.Hint := 'No active insurance'; //CQ7626 added this line
+        end;
+     end;
+
+  //MHV flag
+  if MHVFlag[0] <> '0' then
+     begin
+     PtIsMHV := true;
+
+      with frmFrame do
+        begin
+         laMHV.Caption := Piece(MHVFlag[0], '^', 1);
+         laMHV.Hint := Piece(MHVFlag[0], '^', 2);
+
+         if VAAFlag[0] = '0' then
+           laMHV.Caption := 'MHV';
+        end;
+     end
+  else
+     begin
+     with frmFrame do
+        begin
+        laMHV.Caption := #0;
+        laMHV.Hint := 'No MyHealthyVet data'; //CQ7626 added this line
+        end;
+     end;
+
+  with frmFrame do
+     begin
+     //Modified this 'with' section for CQ7783
+     paVAA.Hide; //Start by hiding it.  Show it only if one of the conditions below is true, else it stays invisible.
+     paVAA.Height := pnlPrimaryCare.Height;
+
+     if ((PtIsVAA and PtIsMHV)) then  //CQ7411 - this line
+        begin
+        laMHV.Top := paVAA.Top;
+        laMHV.Width := paVAA.Width - 1;
+        laMHV.Height := (paVAA.ClientHeight div 2) - 1;
+        laMHV.Visible := true;
+
+        laVAA2.Top := laMHV.Top + laMHV.Height + 1;
+        laVAA2.Width := paVAA.Width - 1;
+        laVAA2.Height := (paVAA.ClientHeight div 2);
+        laVAA2.Visible := true;
+
+        paVAA.Show;
+        end
+     else
+        if ((PtIsMHV and (not PtIsVAA))) then
+           begin
+           laMHV.Top := paVAA.Top;
+           paVAA.Height := pnlPrimaryCare.Height;
+           laMHV.Height := paVAA.ClientHeight - 1;
+           laMHV.Visible := true;
+           laVAA2.Visible  := false;
+           paVAA.Show;
+           end
+     else
+        if ((PtIsVAA and (not PtIsMHV))) then
+           begin
+           laVAA2.Top := paVAA.Top;
+           paVAA.Height := pnlPrimaryCare.Height-2;
+           laVAA2.Height := paVAA.ClientHeight - 1;
+           laVAA2.Visible := true;
+           laMHV.Visible := false;
+
+           paVAA.Show;
+           end;
+  end; //with
+//end VAA & MHV
+end;
+
+initialization
+
+finalization
+  if Assigned(fCover.VAAFlag) then fCover.VAAFlag.Free; //VAA
+
 end.
 
