Ignore:
Timestamp:
Jul 7, 2010, 4:51:54 PM (14 years ago)
Author:
Kevin Toppenberg
Message:

Upgrading to version 27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/uReminders.pas

    r456 r830  
    66  Windows, Messages, Classes, Controls, StdCtrls, SysUtils, ComCtrls, Menus,
    77  Graphics, Forms, ORClasses, ORCtrls, ORDtTm, ORFn, ORNet, Dialogs, uPCE, uVitals,
    8   ExtCtrls, fDrawers, fDeviceSelect;
     8  ExtCtrls, fDrawers, fDeviceSelect, TypInfo;
    99
    1010type
     
    2121    FWHReviewIEN: string;  // AGP CHANGE 23.13 Allow for multiple processing of WH Review of Result Reminders
    2222    FRemWipe: integer;
     23    FMHTestArray: TORStringList;
    2324  protected
    2425    function GetIEN: string; virtual;
     
    4142    function Processing: boolean;
    4243    procedure AddText(Lst: TStrings);
     44    procedure ClearMHTest(RIEN: String);
    4345    property PrintName: string read GetPrintName;
    4446    property IEN: string read GetIEN;
     
    5052    property WHReviewIEN: string read FWHReviewIEN write FWHReviewIEN;  //AGP CHANGE 23.13
    5153    property RemWipe: integer read FRemWipe write FRemWipe;
     54    property MHTestArray: TORStringList read FMHTestArray write FMHTestArray;
    5255  end;
    5356
     
    7376  end;
    7477
    75   TRDChildReq = (crNone, crOne, crAtLeastOne, crNoneOrOne);
     78  TRDChildReq = (crNone, crOne, crAtLeastOne, crNoneOrOne, crAll);
    7679  TRDElemType = (etCheckBox, etTaxonomy, etDisplayOnly);
    7780
     
    112115    function TrueIndent: integer;
    113116    procedure cbClicked(Sender: TObject);
     117    procedure cbEntered(Sender: TObject);
    114118    procedure FieldPanelEntered(Sender: TObject);
    115119    procedure FieldPanelExited(Sender: TObject);
     
    137141    function FindingType: string;
    138142    function Historical: boolean;
    139     function ResultDlgID: integer;
     143    function ResultDlgID: string;
    140144    function IncludeMHTestInPN: boolean;
    141145    function HideChildren: boolean;
     
    339343procedure ClearReminderData;
    340344function GetReminder(ARemData: string): TReminder;
    341 procedure WordWrap(const AText: string; Output: TStrings; LineLength: integer;
    342                                                    AutoIndent: integer = 4);
     345procedure WordWrap(AText: string; Output: TStrings; LineLength: integer;
     346                                                   AutoIndent: integer = 4; MHTest: boolean = false);
    343347function InteractiveRemindersActive: boolean;
    344348function GetReminderData(Rem: TReminderDialog; Lst: TStrings; Finishing: boolean = FALSE;
     
    352356//const
    353357//  InteractiveRemindersActive = FALSE;
    354 type
    355   TWHCheckBox = class(TORCheckBox)
    356   private
    357   FPrintNow: TORCheckBox;
    358   FViewLetter: TORCheckBox;
    359   FCheck1: TORCheckBox;
    360   FCheck2: TORCheckBox;
    361   FCheck3: TORCheckBox;
    362   FEdit: TEdit;
    363   FButton: TButton;
    364   FOnDestroy: TNotifyEvent;
    365   Flbl, Flbl2: TLabel;
    366   FPrintVis: String;
    367   //FPrintDevice: String;
    368   FPntNow: String;
    369   FPntBatch: String;
    370   FButtonText: String;
    371   FCheckNum: String;
    372   protected 
    373   public
    374   property lbl: TLabel read Flbl write Flbl;
    375   property lbl2: TLabel read Flbl2 write Flbl2;
    376   property PntNow: String read FPntNow write FPntNow;
    377   property PntBatch: String read FPntBatch write FPntBatch;
    378   property CheckNum: String read FCheckNum write FCheckNum;
    379   property ButtonText: String read FButtonText write FButtonText;
    380   property PrintNow: TORCheckBox read FPrintNow write FPrintNow;
    381   property Check1: TORCheckBox read FCheck1 write FCheck1;
    382   property Check2: TORCheckBox read FCheck2 write FCheck2;
    383   property Check3: TORCheckBox read FCheck3 write FCheck3;
    384   property ViewLetter: TORCheckBox read FViewLetter write FViewLetter;
    385   property Button: TButton read FButton write FButton;
    386   property Edit: TEdit read FEdit write FEdit;
    387   property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
    388   property PrintVis: String read FPrintVis write FPrintVis;
    389   end;
    390358
    391359var
     
    435403
    436404uses rCore, uCore, rReminders, fRptBox, uConst, fReminderDialog, fNotes, rMisc,
    437      fMHTest, rPCE, rTemplates, dShared, uTemplateFields, fIconLegend, fReminderTree, uInit;
     405     fMHTest, rPCE, rTemplates, dShared, uTemplateFields, fIconLegend, fReminderTree, uInit,
     406     VAUtils, VA508AccessibilityRouter, VA508AccessibilityManager, uDlgComponents,
     407  fBase508Form;
    438408
    439409type
     
    441411  TRemFolders = set of TRemFolder;
    442412  TValidRemFolders = succ(low(TRemFolder)) .. high(TRemFolder);
     413  TExposedComponent = class(TControl);
     414
     415  TWHCheckBox = class(TCPRSDialogCheckBox)
     416  private
     417    FPrintNow: TCPRSDialogCheckBox;
     418    FViewLetter: TCPRSDialogCheckBox;
     419    FCheck1: TWHCheckBox;
     420    FCheck2: TWHCheckBox;
     421    FCheck3: TWHCheckBox;
     422    FEdit: TEdit;
     423    FButton: TButton;
     424    FOnDestroy: TNotifyEvent;
     425    Flbl, Flbl2: TControl;
     426    FPrintVis: String;
     427    //FPrintDevice: String;
     428    FPntNow: String;
     429    FPntBatch: String;
     430    FButtonText: String;
     431    FCheckNum: String;
     432  protected 
     433  public
     434    property lbl: TControl read Flbl write Flbl;
     435    property lbl2: TControl read Flbl2 write Flbl2;
     436    property PntNow: String read FPntNow write FPntNow;
     437    property PntBatch: String read FPntBatch write FPntBatch;
     438    property CheckNum: String read FCheckNum write FCheckNum;
     439    property ButtonText: String read FButtonText write FButtonText;
     440    property PrintNow: TCPRSDialogCheckBox read FPrintNow write FPrintNow;
     441    property Check1: TWHCheckBox read FCheck1 write FCheck1;
     442    property Check2: TWHCheckBox read FCheck2 write FCheck2;
     443    property Check3: TWHCheckBox read FCheck3 write FCheck3;
     444    property ViewLetter: TCPRSDialogCheckBox read FViewLetter write FViewLetter;
     445    property Button: TButton read FButton write FButton;
     446    property Edit: TEdit read FEdit write FEdit;
     447    property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
     448    property PrintVis: String read FPrintVis write FPrintVis;
     449  end;
    443450
    444451var
     
    459466  HistRootCount: longint = 0;
    460467  uRemFolders: TRemFolders = [rfUnknown];
    461 
     468 
    462469const
    463470  DueText = 'Due';
     
    605612                 ptReaction, ptContraindicated, ptLevelUnderstanding];
    606613
    607   Gap = 2;
     614  Gap = 3;
    608615  LblGap = 4;
    609616  IndentGap = 18;
     
    631638  MonthReqCode = 'M';
    632639
    633 type
    634   TVitalComboBox = class;
    635 
    636   TVitalEdit = class(TEdit)
    637   private
    638     FLinkedCombo: TVitalComboBox;
    639   end;
    640 
    641   TVitalComboBox = class(TComboBox)
    642   private
    643     FLinkedEdit: TVitalEdit;
    644   public
    645     procedure SelectByID(Value: string);
    646   end;
    647 
    648640function InitText(const InStr: string): string;
    649641var
     
    690682end;
    691683
    692 
    693 procedure TVitalComboBox.SelectByID(Value: string);
    694 var
    695   i: integer;
    696 
    697 begin
    698   for i := 0 to Items.Count-1 do
    699     if(Value = Items[i]) then
    700     begin
    701       ItemIndex := i;
    702       break;
    703     end;
    704 end;
    705 
    706684type
    707685  TMultiClassObj = record
    708686    case integer of
    709       0: (edt:  TEdit);
    710       1: (cb:   TORCheckBox);
    711       2: (cbo:  TORComboBox);
    712       3: (dt:   TORDateCombo);
     687      0: (edt:  TCPRSDialogFieldEdit);
     688      1: (cb:   TCPRSDialogCheckBox);
     689      2: (cbo:  TCPRSDialogComboBox);
     690      3: (dt:   TCPRSDialogDateCombo);
    713691      4: (ctrl: TORExposedControl);
    714692      5: (vedt: TVitalEdit);
    715693      6: (vcbo: TVitalComboBox);
    716       7: (btn:  TButton);
     694      7: (btn:  TCPRSDialogButton);
    717695      8: (pNow: TORCheckBox);
    718696      9: (pBat: TORCheckBox);
     
    757735    TmpSL := TStringList.Create;
    758736    try
    759       TmpSL.Assign(RemindersInProcess);
     737      FastAssign(RemindersInProcess, TmpSL);
    760738      TmpSL.Sort;
    761739      for i := 0 to TmpSL.Count-1 do
     
    808786  OtherReminders.Notifier.BeginUpdate;
    809787  TmpActive := TStringList.Create;
    810   TmpActive.Assign(ActiveReminders);
     788  FastAssign(ActiveReminders, TmpActive);
    811789  TmpOther := TStringList.Create;
    812   TmpOther.Assign(OtherReminders);
     790  FastAssign(OtherReminders, TmpOther);
    813791end;
    814792
     
    1003981      begin
    1004982        EvaluateReminders(RemList);
    1005         RemList.Assign(RPCBrokerV.Results);
     983        FastAssign(RPCBrokerV.Results, RemList);
    1006984        for i := 0 to RemList.Count-1 do
    1007985          ReminderEvaluated(RemList[i], (i = (RemList.Count-1)));
     
    10501028          end;
    10511029        end;
    1052         // ActiveReminders.Assign(TempList);
     1030        // FastAssign(TempList,ActiveReminders);
    10531031        for i := 0 to TempList.Count-1 do
    10541032        begin
     
    20942072  ScootOver: integer = 0;
    20952073 
    2096 procedure WordWrap(const AText: string; Output: TStrings; LineLength: integer;
    2097                                                    AutoIndent: integer = 4);
    2098 var
    2099   i, l, max, FCount: integer;
    2100   First: boolean;
    2101   OrgText, Text, Prefix: string;
    2102 
    2103 begin
     2074procedure WordWrap(AText: string; Output: TStrings; LineLength: integer;
     2075                                                   AutoIndent: integer = 4; MHTest: boolean = false);
     2076var
     2077  i, j, l, max, FCount, MHLoop: integer;
     2078  First, MHRes: boolean;
     2079  OrgText, Text, Prefix, tmpText: string;
     2080
     2081begin
     2082  StripScreenReaderCodes(AText);
    21042083  inc(LineLength, ScootOver);
    21052084  dec(AutoIndent, ScootOver);
    21062085  FCount := Output.Count;
    21072086  First := TRUE;
    2108   OrgText := InitText(AText);
     2087  MHLoop := 1;
     2088  MHRes := False;
     2089  tmpText := '';
     2090  if Pos('~', AText)>0 then MHLoop := 2;
     2091  for j := 1 to MHLoop do
     2092  begin
     2093  if (j = 1) and (MHLoop = 2) then
     2094    begin
     2095      tmpText := Piece(AText, '~', 1);
     2096      MHRes := True;
     2097    end
     2098  else if (j = 2) then
     2099    begin
     2100      tmpText := Piece(AText, '~', 2);
     2101      First := False;
     2102      MHRes := False;
     2103    end
     2104  else if (j = 1) and (MHLoop = 1) then
     2105    begin
     2106      tmpText := AText;
     2107      First := False;
     2108      MHRes := False;
     2109    end;
     2110  if tmpText <> '' then OrgText := tmpText
     2111  else OrgText := InitText(AText);
    21092112  Prefix := StringOfChar(' ',74-LineLength);
    21102113  repeat
     
    21562159      end;
    21572160    end;
    2158     if(First) and (FCount <> Output.Count) then
     2161    if ((First) and (FCount <> Output.Count)) and (MHRes = False) then
    21592162    begin
    21602163      dec(LineLength, AutoIndent);
     
    21632166    end;
    21642167  until(OrgText = '');
     2168  end;
    21652169end;
    21662170
     
    25542558  if(Result.Count = 0) then
    25552559  begin
    2556     Result.Assign(GetDialogInfo(GetIEN, (Self is TReminder)));
     2560    FastAssign(GetDialogInfo(GetIEN, (Self is TReminder)), Result);
    25572561    Result.Add(DlgCalled); // Used to prevent repeated calling of RPC if dialog is empty
    25582562  end;
     
    25832587  if(AParent.ControlCount = 0) then
    25842588  begin
    2585     with TLabel.Create(AOwner) do
     2589    with TVA508StaticText.Create(AOwner) do
    25862590    begin
    25872591      Parent := AParent;
     
    25982602  i, idx: integer;
    25992603  Elem: TRemDlgElement;
     2604  temp: string;
    26002605
    26012606begin
     
    26102615    end;
    26112616    if (Self is TReminder) and (PrintName <> '') and (idx <> Lst.Count) then
    2612       Lst.Insert(idx, '  ' + PrintName + ':')
     2617    begin
     2618      temp := PrintName;
     2619      StripScreenReaderCodes(temp);
     2620      Lst.Insert(idx, '  ' + temp + ':')
     2621    end;
    26132622  end;
    26142623end;
     
    26312640    end;
    26322641  end;
     2642end;
     2643
     2644procedure TReminderDialog.ClearMHTest(RIEN: String);
     2645var
     2646i,j: integer;
     2647TestName: string;
     2648begin
     2649  if (self.MHTestArray <> nil) and (self.MHTestArray.Count > 0) then
     2650    begin
     2651      i := self.MHTestArray.IndexOfPiece(RIEN, U, 2, -1);
     2652      while i > -1 do
     2653        begin
     2654          TestName := Piece(self.MHTestArray.Strings[i], U, 1);
     2655          self.MHTestArray.Delete(i);
     2656          j := self.MHTestArray.IndexOfPiece(TestName, U, 1, -1);
     2657          if j = -1 then RemoveMHTest(TestName);
     2658          i := self.MHTestArray.IndexOfPiece(RIEN, U, 2, -1);
     2659        end;
     2660    end;
    26332661end;
    26342662
     
    29092937  else if Tmp = '2' then Result := crAtLeastOne
    29102938  else if Tmp = '3' then Result := crNoneOrOne
     2939  else if Tmp = '4' then result := crAll
    29112940  else Result := crNone;
    29122941end;
     
    29793008      TempSL[i] := Tmp;
    29803009    end;
    2981     FReminder.GetDlgSL.AddStrings(TempSL);
     3010    FastAddStrings(TempSL, FReminder.GetDlgSL);
    29823011  end;
    29833012  UpdateData;
     
    31603189                         U + 'P' + U + Tmp + U + BOOLCHAR[NewLine] + U + '0';
    31613190                FData := RData;
    3162                 if(Piece(FRec3, U, r3GAF) = '1') then
     3191                if ((Piece(FRec3, U, r3GAF) = '1')) and (MHDLLFound = false) then
    31633192                begin
    31643193                  FOverrideType := ptGAF;
     
    33523381  end;
    33533382  RemindersInProcess.Notifier.Notify;
    3354   TFieldPanel(TORCheckBox(Sender).Associate).SetFocus;
     3383  if assigned(TORCheckBox(Sender).Associate) and (not ScreenReaderSystemActive) then
     3384    TDlgFieldPanel(TORCheckBox(Sender).Associate).SetFocus;
    33553385end;
    33563386
     
    33953425    Result := FALSE;
    33963426end;
    3397    
     3427
     3428type
     3429  TAccessCheckBox = class(TORCheckBox);
     3430
     3431procedure TRemDlgElement.cbEntered(Sender: TObject);
     3432begin
     3433// changing focus because of a mouse click sets ClicksDisabled to false during the
     3434// call to SetFocus - this is how we allow the cbClicked code to execute on a mouse
     3435// click, which will set the focus after the mouse click.  All other cases and the
     3436// ClicksDisabled will be FALSE and the focus is reset here.  If we don't make this
     3437// check, you can't click on the check box..
     3438  if (Last508KeyCode = VK_UP) or (Last508KeyCode = VK_LEFT) then
     3439  begin
     3440    UnfocusableControlEnter(nil, Sender);
     3441    exit;
     3442  end;
     3443  if not TAccessCheckBox(Sender).ClicksDisabled then
     3444  begin
     3445    if ScreenReaderSystemActive then
     3446      (Sender as TCPRSDialogParentCheckBox).FocusOnBox := true
     3447    else
     3448      TDlgFieldPanel(TORCheckBox(Sender).Associate).SetFocus;
     3449  end;
     3450end;
     3451
    33983452procedure TRemDlgElement.ParentCBEnter(Sender: TObject);
    33993453begin
    3400   (Sender as TORCheckbox).FocusOnBox := true;
     3454  (Sender as TORCheckBox).FocusOnBox := true;
    34013455end;
    34023456
    34033457procedure TRemDlgElement.ParentCBExit(Sender: TObject);
    34043458begin
    3405   (Sender as TORCheckbox).FocusOnBox := false;
    3406 end;
    3407 
     3459  (Sender as TORCheckBox).FocusOnBox := false;
     3460end;
     3461
     3462type
     3463  TORExposedWinControl = class(TWinControl);
    34083464
    34093465function TRemDlgElement.BuildControls(var Y: integer; ParentWidth: integer;
     
    34113467var
    34123468  lbl: TLabel;
    3413   pnl: TPanel;
     3469  lblText: string;
     3470  sLbl: TCPRSDialogStaticLabel;
     3471  lblCtrl: TControl;
     3472  pnl: TDlgFieldPanel;
    34143473  AutoFocusControl: TWinControl;
    3415   cb: TORCheckBox;
     3474  cb: TCPRSDialogParentCheckBox;
    34163475  gb: TGroupBox;
    34173476  ERes, prnt: TWinControl;
     
    34303489  vt: TVitalType;
    34313490  DefaultDate: TFMDateTime;
    3432 
    3433   function GetPanel(const EID, AText: string; const PnlWidth: integer): TPanel;
     3491  Req: boolean;
     3492
     3493  function GetPanel(const EID, AText: string; const PnlWidth: integer;
     3494                    OwningCheckBox: TCPRSDialogParentCheckBox): TDlgFieldPanel;
    34343495  var
    34353496    idx, p: integer;
     
    34603521    // values to the values that were restored to the Entry from the Element if
    34613522    // they exist, otherwise the default values will remain.
    3462     Result := Entry.GetPanel(PnlWidth, BaseParent);
     3523    Result := Entry.GetPanel(PnlWidth, BaseParent, OwningCheckBox);
    34633524  end;
    34643525
     
    34883549      cb.Top := pnl.Top;
    34893550    SameLineCtrl.Clear;
     3551  end;
     3552
     3553  procedure ProcessLabel(Required, AEnabled: boolean;
     3554                         AParent: TWinControl; Control: TControl);  begin
     3555    if(Trim(Prompt.Caption) = '') and (not Required) then
     3556      lblCtrl := nil
     3557    else
     3558    begin
     3559      lbl := TLabel.Create(AOwner);
     3560      lbl.Parent := AParent;
     3561      if ScreenReaderSystemActive then
     3562      begin
     3563        sLbl := TCPRSDialogStaticLabel.Create(AOwner);
     3564        sLbl.Parent := AParent;
     3565        sLbl.Height := lbl.Height;
     3566// get groop box hearder, if any
     3567//                (sLbl as ICPRSDialogComponent).BeforeText := ScreenReaderSystem_GetPendingText;
     3568        lbl.Free;
     3569        lblCtrl := sLbl;
     3570      end
     3571      else
     3572        lblCtrl := lbl;
     3573      lblText := Prompt.Caption;
     3574      if Required then
     3575      begin
     3576        if assigned(Control) and Supports(Control, ICPRSDialogComponent) then
     3577        begin
     3578          (Control as ICPRSDialogComponent).RequiredField := TRUE;
     3579          if ScreenReaderSystemActive and (AOwner = frmRemDlg) then
     3580            frmRemDlg.amgrMain.AccessText[sLbl] := lblText;
     3581        end;
     3582        lblText := lblText + ' *';
     3583      end;
     3584      SetStrProp(lblCtrl, CaptionProperty, lblText);
     3585      if ScreenReaderSystemActive then
     3586      begin
     3587        ScreenReaderSystem_CurrentLabel(sLbl);
     3588        ScreenReaderSystem_AddText(lblText);
     3589      end;
     3590      lblCtrl.Enabled := AEnabled;
     3591      UpdateColorsFor508Compliance(lblCtrl);
     3592    end;
     3593  end;
     3594
     3595  procedure ScreenReaderSupport(Control: TWinControl);
     3596  begin
     3597    if ScreenReaderSystemActive then
     3598    begin
     3599      if Supports(Control, ICPRSDialogComponent) then
     3600        ScreenReaderSystem_CurrentComponent(Control as ICPRSDialogComponent)
     3601      else
     3602        ScreenReaderSystem_Stop;
     3603    end;
    34903604  end;
    34913605
     
    35523666          MaxX := 0;
    35533667          lbl := nil;
     3668          sLbl := nil;
     3669          lblCtrl := nil;
    35543670          DoLbl := Prompt.Required;
    35553671          case pt of
    35563672            ptComment, ptQuantity:
    35573673              begin
    3558                 Ctrl.edt := TEdit.Create(AOwner);
     3674                Ctrl.edt := TCPRSDialogFieldEdit.Create(AOwner);
    35593675                Ctrl.ctrl.Parent := AParent;
    35603676                Ctrl.edt.Text := Prompt.Value;
     
    35823698                  MinX := TextWidthByFont(Ctrl.edt.Font.Handle, IntToStr(ud.Max)) + 24;
    35833699                  ud.Position := StrToIntDef(Prompt.Value, ud.Min);
     3700                  UpdateColorsFor508Compliance(ud);
    35843701                end;
    35853702                Ctrl.edt.OnKeyPress := Prompt.EditKeyPress;
    35863703                Ctrl.edt.OnChange := Prompt.PromptChange;
     3704                UpdateColorsFor508Compliance(Ctrl.edt);
    35873705                DoLbl := TRUE;
    35883706              end;
     
    35923710            ptLevelSeverity, ptSkinResults, ptSkinReading:
    35933711              begin
    3594                 Ctrl.cbo := TORComboBox.Create(AOwner);
     3712                Ctrl.cbo := TCPRSDialogComboBox.Create(AOwner);
    35953713                Ctrl.ctrl.Parent := AParent;
    35963714                Ctrl.cbo.OnKeyDown := Prompt.ComboBoxKeyDown;
     
    36663784                DoLbl := TRUE;
    36673785                Ctrl.cbo.ListItemsOnly := (pt <> ptVisitLocation);
     3786                UpdateColorsFor508Compliance(Ctrl.cbo);
    36683787              end;
    36693788
    36703789              ptWHPapResult:
    36713790              begin
    3672               if FData<>nil then
     3791                if FData<>nil then
    36733792                begin
    3674                 if (TRemData(FData[i]).DisplayWHResults)=true then
    3675                 begin
    3676                 NextLine(Y);
    3677                 Ctrl.btn := TButton.Create(AOwner);
    3678                 Ctrl.ctrl.Parent := AParent;
    3679                 Ctrl.btn.Left := NewLInePromptGap+15;
    3680                 Ctrl.btn.Top := Y+7;
    3681                 Ctrl.btn.OnClick := Prompt.DoWHReport;
    3682                 Ctrl.btn.Caption := 'Review complete report';
    3683                 Ctrl.btn.Width := TextWidthByFont(Ctrl.btn.Font.Handle, Ctrl.btn.Caption) + 13;
    3684                 Ctrl.btn.Height := TextHeightByFont(Ctrl.btn.Font.Handle, Ctrl.btn.Caption) + 13;
    3685                 Ctrl.btn.Height := TextHeightByFont(Ctrl.btn.Handle, Ctrl.btn.Caption) + 8;
    3686                 Y := ctrl.btn.Top + Ctrl.btn.Height;
     3793                  if (TRemData(FData[i]).DisplayWHResults)=true then
     3794                  begin
     3795                    NextLine(Y);
     3796                    Ctrl.btn := TCPRSDialogButton.Create(AOwner);
     3797                    Ctrl.ctrl.Parent := AParent;
     3798                    Ctrl.btn.Left := NewLInePromptGap+15;
     3799                    Ctrl.btn.Top := Y+7;
     3800                    Ctrl.btn.OnClick := Prompt.DoWHReport;
     3801                    Ctrl.btn.Caption := 'Review complete report';
     3802                    Ctrl.btn.Width := TextWidthByFont(Ctrl.btn.Font.Handle, Ctrl.btn.Caption) + 13;
     3803                    Ctrl.btn.Height := TextHeightByFont(Ctrl.btn.Font.Handle, Ctrl.btn.Caption) + 13;
     3804                    Ctrl.btn.Height := TextHeightByFont(Ctrl.btn.Handle, Ctrl.btn.Caption) + 8;
     3805                    ScreenReaderSupport(Ctrl.btn);
     3806                    UpdateColorsFor508Compliance(Ctrl.btn);
     3807                    Y := ctrl.btn.Top + Ctrl.btn.Height;
     3808                    NextLine(Y);
     3809                    Ctrl.WHChk := TWHCheckBox.Create(AOwner);
     3810                    Ctrl.ctrl.Parent := AParent;
     3811                    ProcessLabel(Prompt.Required, TRUE, Ctrl.WHChk.Parent, Ctrl.WHChk);
     3812                    if lblCtrl is TWinControl then
     3813                      TWinControl(lblCtrl).TabOrder := Ctrl.WHChk.TabOrder;
     3814                    Ctrl.WHChk.Flbl := lblCtrl;
     3815                    Ctrl.WHChk.Flbl.Top := Y + 5;
     3816                    Ctrl.WHChk.Flbl.Left := NewLinePromptGap+15;
     3817                    WrapLeft := Ctrl.WHChk.Flbl.Left;
     3818//                    Ctrl.WHChk.Flbl.Width := TextWidthByFont(
     3819//                      TExposedComponent(Ctrl.WHChk.Flbl).Font.Handle,
     3820//                      TExposedComponent(Ctrl.WHChk.Flbl).Caption)+25;
     3821//                    Ctrl.WHChk.Flbl.Height := TextHeightByFont(
     3822//                      TExposedComponent(Ctrl.WHChk.Flbl).Font.Handle,
     3823//                      TExposedComponent(Ctrl.WHChk.Flbl).Caption);
     3824                    //LineWidth := WrapLeft + Ctrl.WHChk.Flbl.Width+10;
     3825                    Y := Ctrl.WHChk.Flbl.Top + Ctrl.WHChk.Flbl.Height;
     3826                    NextLine(Y);
     3827                    Ctrl.WHChk.RadioStyle:=true;
     3828                    Ctrl.WHChk.GroupIndex:=1;
     3829                    Ctrl.WHChk.Check2 := TWHCheckBox.Create(AOwner);
     3830                    Ctrl.WHChk.Check2.Parent := Ctrl.WHChk.Parent;
     3831                    Ctrl.WHChk.Check2.RadioStyle:=true;
     3832                    Ctrl.WHChk.Check2.GroupIndex:=1;
     3833                    Ctrl.WHChk.Check3 := TWHCheckBox.Create(AOwner);
     3834                    Ctrl.WHChk.Check3.Parent := Ctrl.WHChk.Parent;
     3835                    Ctrl.WHChk.Check3.RadioStyle:=true;
     3836                    Ctrl.WHChk.Check3.GroupIndex:=1;
     3837                    Ctrl.WHChk.Caption := 'NEM (No Evidence of Malignancy)';
     3838                    Ctrl.WHChk.ShowHint := true;
     3839                    Ctrl.WHChk.Hint := 'No Evidence of Malignancy';
     3840                    Ctrl.WHChk.Width := TextWidthByFont(Ctrl.WHChk.Font.Handle, Ctrl.WHChk.Caption)+20;
     3841                    Ctrl.WHChk.Height := TextHeightByFont(Ctrl.WHChk.Font.Handle, Ctrl.WHChk.Caption)+4;
     3842                    Ctrl.WHChk.Top := Y + 5;
     3843                    Ctrl.WHChk.Left := WrapLeft;
     3844                    Ctrl.WHChk.OnClick := Prompt.PromptChange;
     3845                    Ctrl.WHChk.Checked := (WHResultChk = 'N');
     3846                    LineWidth := WrapLeft + Ctrl.WHChk.Width+5;
     3847                    Ctrl.WHChk.Check2.Caption := 'Abnormal';
     3848                    Ctrl.WHChk.Check2.Width := TextWidthByFont(Ctrl.WHChk.Check2.Font.Handle, Ctrl.WHChk.Check2.Caption) + 20;
     3849                    Ctrl.WHChk.Check2.Height := TextHeightByFont(Ctrl.WHChk.check2.Font.Handle, Ctrl.WHChk.check2.Caption)+4;
     3850                    if (LineWidth + Ctrl.WHChk.Check2.Width) > PWidth - 10 then
     3851                    begin
     3852                      LineWidth := WrapLeft;
     3853                      Y := Ctrl.WHChk.Top + Ctrl.WHChk.Height;
     3854                      Nextline(Y);
     3855                    end;
     3856                    Ctrl.WHChk.Check2.Top := Y + 5;
     3857                    Ctrl.WHChk.Check2.Left := LineWidth;
     3858                    Ctrl.WHChk.Check2.OnClick := Prompt.PromptChange;
     3859                    Ctrl.WHChk.Check2.Checked := (WHResultChk = 'A');
     3860                    LineWidth := LineWidth + Ctrl.WHChk.Check2.Width+5;
     3861                    Ctrl.WHChk.Check3.Caption := 'Unsatisfactory for Diagnosis';
     3862                    Ctrl.WHChk.Check3.Width := TextWidthByFont(Ctrl.WHChk.Check3.Font.Handle, Ctrl.WHChk.Check3.Caption)+20;
     3863                    Ctrl.WHChk.Check3.Height := TextHeightByFont(Ctrl.WHChk.check3.Font.Handle, Ctrl.WHChk.check3.Caption)+4;
     3864                    if (LineWidth + Ctrl.WHChk.Check3.Width) > PWidth - 10 then
     3865                    begin
     3866                      LineWidth := WrapLeft;
     3867                      Y := Ctrl.WHChk.Check2.Top + Ctrl.WHChk.Check2.Height;
     3868                      Nextline(Y);
     3869                    end;
     3870                    Ctrl.WHChk.Check3.Top := Y + 5;
     3871                    Ctrl.WHChk.Check3.OnClick := Prompt.PromptChange;
     3872                    Ctrl.WHChk.Check3.Checked := (WHResultChk = 'U');
     3873                    Ctrl.WHChk.Check3.Left := LineWidth;
     3874                    UpdateColorsFor508Compliance(Ctrl.WHChk);
     3875                    UpdateColorsFor508Compliance(Ctrl.WHChk.Flbl);
     3876                    UpdateColorsFor508Compliance(Ctrl.WHChk.Check2);
     3877                    UpdateColorsFor508Compliance(Ctrl.WHChk.Check3);
     3878                    ScreenReaderSupport(Ctrl.WHChk);
     3879                    ScreenReaderSupport(Ctrl.WHChk.Check2);
     3880                    ScreenReaderSupport(Ctrl.WHChk.Check3);
     3881                    Y := Ctrl.WHChk.Check3.Top + Ctrl.WHChk.Check3.Height;
     3882                    Nextline(Y);
     3883                  end
     3884                  else
     3885                    DoLbl := FALSE;
     3886                end
     3887                else
     3888                  DoLbl :=FALSE;
     3889              end;
     3890
     3891              ptWHNotPurp:
     3892              begin
    36873893                NextLine(Y);
    36883894                Ctrl.WHChk := TWHCheckBox.Create(AOwner);
    36893895                Ctrl.ctrl.Parent := AParent;
    3690                 Ctrl.WHChk.Flbl := TLabel.Create(AOwner);
    3691                 Ctrl.WHChk.Flbl.Parent := Ctrl.WHChk.Parent;
    3692                 Ctrl.WHChk.Flbl.Caption := Prompt.Caption;
    3693                 Ctrl.WHChk.Flbl.Top := Y + 5;
    3694                 Ctrl.WHChk.Flbl.Left := NewLInePromptGap+15;
    3695                 WrapLeft := Ctrl.WHChk.Flbl.Left;
    3696                 Ctrl.WHChk.Flbl.Width := TextWidthByFont(Ctrl.WHChk.Flbl.Font.Handle, Ctrl.WHChk.Flbl.Caption)+25;
    3697                 Ctrl.WHChk.Flbl.Height := TextHeightByFont(Ctrl.WHChk.Flbl.Font.Handle, Ctrl.WHChk.Flbl.Caption);
    3698                 //LineWidth := WrapLeft + Ctrl.WHChk.Flbl.Width+10;
    3699                 if Prompt.Required then
    3700                   Ctrl.WHChk.Flbl.Caption := '* '+Ctrl.WHChk.Flbl.Caption;
    3701                 Y := Ctrl.WHChk.Flbl.Top + Ctrl.WHChk.Flbl.Height;
    3702                 NextLine(Y);
    3703                 Ctrl.WHChk.RadioStyle:=true;
    3704                 Ctrl.WHChk.GroupIndex:=1;
    3705                 Ctrl.WHChk.Check2 := TWHCheckBox.Create(AOwner);
    3706                 Ctrl.WHChk.Check2.Parent := Ctrl.WHChk.Parent;
    3707                 Ctrl.WHChk.Check2.RadioStyle:=true;
    3708                 Ctrl.WHChk.Check2.GroupIndex:=1;
    3709                 Ctrl.WHChk.Check3 := TWHCheckBox.Create(AOwner);
    3710                 Ctrl.WHChk.Check3.Parent := Ctrl.WHChk.Parent;
    3711                 Ctrl.WHChk.Check3.RadioStyle:=true;
    3712                 Ctrl.WHChk.Check3.GroupIndex:=1;
    3713                 Ctrl.WHChk.Caption := 'NEM (No Evidence of Malignancy)';
    3714                 Ctrl.WHChk.ShowHint := true;
    3715                 Ctrl.WHChk.Hint := 'No Evidence of Malignancy';
    3716                 Ctrl.WHChk.Width := TextWidthByFont(Ctrl.WHChk.Font.Handle, Ctrl.WHChk.Caption)+20;
    3717                 Ctrl.WHChk.Height := TextHeightByFont(Ctrl.WHChk.Font.Handle, Ctrl.WHChk.Caption)+4;
    3718                 Ctrl.WHChk.Top := Y + 5;
    3719                 Ctrl.WHChk.Left := WrapLeft;
    3720                 Ctrl.WHChk.OnClick := Prompt.PromptChange;
    3721                 Ctrl.WHChk.Checked := (WHResultChk = 'N');
    3722                 LineWidth := WrapLeft + Ctrl.WHChk.Width+5;
    3723                 Ctrl.WHChk.Check2.Caption := 'Abnormal';
    3724                 Ctrl.WHChk.Check2.Width := TextWidthByFont(Ctrl.WHChk.Check2.Font.Handle, Ctrl.WHChk.Check2.Caption) + 20;
    3725                 Ctrl.WHChk.Check2.Height := TextHeightByFont(Ctrl.WHChk.check2.Font.Handle, Ctrl.WHChk.check2.Caption)+4;
    3726                 if (LineWidth + Ctrl.WHChk.Check2.Width) > PWidth - 10 then
    3727                         begin
    3728                         LineWidth := WrapLeft;
    3729                         Y := Ctrl.WHChk.Top + Ctrl.WHChk.Height;
    3730                         Nextline(Y);
    3731                         end;
    3732                 Ctrl.WHChk.Check2.Top := Y + 5;
    3733                 Ctrl.WHChk.Check2.Left := LineWidth;
    3734                 Ctrl.WHChk.Check2.OnClick := Prompt.PromptChange;
    3735                 Ctrl.WHChk.Check2.Checked := (WHResultChk = 'A');
    3736                 LineWidth := LineWidth + Ctrl.WHChk.Check2.Width+5;
    3737                 Ctrl.WHChk.Check3.Caption := 'Unsatisfactory for Diagnosis';
    3738                 Ctrl.WHChk.Check3.Width := TextWidthByFont(Ctrl.WHChk.Check3.Font.Handle, Ctrl.WHChk.Check3.Caption)+20;
    3739                 Ctrl.WHChk.Check3.Height := TextHeightByFont(Ctrl.WHChk.check3.Font.Handle, Ctrl.WHChk.check3.Caption)+4;
    3740                 if (LineWidth + Ctrl.WHChk.Check3.Width) > PWidth - 10 then
    3741                         begin
    3742                         LineWidth := WrapLeft;
    3743                         Y := Ctrl.WHChk.Check2.Top + Ctrl.WHChk.Check2.Height;
    3744                         Nextline(Y);
    3745                         end;
    3746                 Ctrl.WHChk.Check3.Top := Y + 5;
    3747                 Ctrl.WHChk.Check3.OnClick := Prompt.PromptChange;
    3748                 Ctrl.WHChk.Check3.Checked := (WHResultChk = 'U');
    3749                 Ctrl.WHChk.Check3.Left := LineWidth;
    3750                 Y := Ctrl.WHChk.Check3.Top + Ctrl.WHChk.Check3.Height;
    3751                 Nextline(Y);
    3752                 end
    3753                 else DoLbl := FALSE;
    3754                 end
    3755                 else DoLbl :=FALSE;
    3756               end;
    3757 
    3758               ptWHNotPurp:
    3759               begin
    3760               NextLine(Y);
    3761                 Ctrl.WHChk := TWHCheckBox.Create(AOwner);
    3762                 Ctrl.ctrl.Parent := AParent;
    3763                 Ctrl.WHChk.Flbl := TLabel.Create(AOwner);
    3764                 Ctrl.WHChk.Flbl.Parent := Ctrl.WHChk.Parent;
    3765                 Ctrl.WHChk.Flbl.Caption := Prompt.Caption;
     3896                ProcessLabel(Prompt.Required, TRUE, Ctrl.WHChk.Parent, Ctrl.WHChk);
     3897                Ctrl.WHChk.Flbl := lblCtrl;
     3898                if lblCtrl is TWinControl then
     3899                  TWinControl(lblCtrl).TabOrder := Ctrl.WHChk.TabOrder;
    37663900                Ctrl.WHChk.Flbl.Top := Y + 7;
    37673901                Ctrl.WHChk.Flbl.Left := NewLInePromptGap+30;
    37683902                WrapLeft := Ctrl.WHChk.Flbl.Left;
    3769                 Ctrl.WHChk.Flbl.Width := TextWidthByFont(Ctrl.WHChk.Flbl.Font.Handle, Ctrl.WHChk.Flbl.Caption)+25;
    3770                 Ctrl.WHChk.Flbl.Height := TextHeightByFont(Ctrl.WHChk.Flbl.Font.Handle, Ctrl.WHChk.Flbl.Caption)+4;
     3903//                Ctrl.WHChk.Flbl.Width := TextWidthByFont(
     3904//                  TExposedComponent(Ctrl.WHChk.Flbl).Font.Handle,
     3905//                  TExposedComponent(Ctrl.WHChk.Flbl).Caption)+25;
     3906//                Ctrl.WHChk.Flbl.Height := TextHeightByFont(
     3907//                  TExposedComponent(Ctrl.WHChk.Flbl).Font.Handle,
     3908//                  TExposedComponent(Ctrl.WHChk.Flbl).Caption)+4;
    37713909                LineWidth := WrapLeft + Ctrl.WHChk.Flbl.Width+10;
    3772                 if Prompt.Required then
    3773                   Ctrl.WHChk.Flbl.Caption := '* '+Ctrl.WHChk.Flbl.Caption;
    37743910                Ctrl.WHChk.Check2 := TWHCheckBox.Create(AOwner);
    37753911                Ctrl.WHChk.Check2.Parent := Ctrl.WHChk.Parent;
     
    37823918                Ctrl.WHChk.Height := TextHeightByFont(Ctrl.WHChk.Font.Handle, Ctrl.WHChk.Caption)+4;
    37833919                if (LineWidth + Ctrl.WHChk.Width) > PWidth - 10 then
    3784                         begin
    3785                         LineWidth := WrapLeft;
    3786                         Y := Ctrl.WHChk.Flbl.Top + Ctrl.WHChk.Flbl.Height;
    3787                         Nextline(Y);
    3788                         end;
     3920                begin
     3921                  LineWidth := WrapLeft;
     3922                  Y := Ctrl.WHChk.Flbl.Top + Ctrl.WHChk.Flbl.Height;
     3923                  Nextline(Y);
     3924                end;
    37893925                Ctrl.WHChk.Top := Y + 7;
    37903926                Ctrl.WHChk.Left := LineWidth;
     
    37963932                Ctrl.WHChk.Check2.Height := TextHeightByFont(Ctrl.WHChk.check2.Font.Handle, Ctrl.WHChk.check2.Caption)+4;
    37973933                if (LineWidth + Ctrl.WHChk.Check2.Width) > PWidth - 10 then
    3798                         begin
    3799                         LineWidth := WrapLeft;
    3800                         Y := Ctrl.WHChk.Top + Ctrl.WHChk.Height;
    3801                         Nextline(Y);
    3802                         end;
     3934                begin
     3935                  LineWidth := WrapLeft;
     3936                  Y := Ctrl.WHChk.Top + Ctrl.WHChk.Height;
     3937                  Nextline(Y);
     3938                end;
    38033939                Ctrl.WHChk.Check2.Top := Y + 7;
    38043940                Ctrl.WHChk.Check2.Left := LineWidth;
     
    38103946                Ctrl.WHChk.Check3.Height := TextHeightByFont(Ctrl.WHChk.check3.Font.Handle, Ctrl.WHChk.check3.Caption)+4;
    38113947                if (LineWidth + Ctrl.WHChk.Check3.Width) > PWidth - 10 then
    3812                         begin
    3813                         LineWidth := WrapLeft;
    3814                         Y := Ctrl.WHChk.Check2.Top + Ctrl.WHChk.Check2.Height;
    3815                         Nextline(Y);
    3816                         end;
     3948                begin
     3949                  LineWidth := WrapLeft;
     3950                  Y := Ctrl.WHChk.Check2.Top + Ctrl.WHChk.Check2.Height;
     3951                  Nextline(Y);
     3952                end;
    38173953                Ctrl.WHChk.Check3.Top := Y + 7;
    38183954                Ctrl.WHChk.Check3.OnClick := Prompt.PromptChange;
     
    38213957                Y := Ctrl.WHChk.Check3.Top + Ctrl.WHChk.Check3.Height;
    38223958                Nextline(Y);
    3823                 Ctrl.WHChk.Fbutton := TButton.Create(AOwner);
     3959                Ctrl.WHChk.Fbutton := TCPRSDialogButton.Create(AOwner);
    38243960                Ctrl.WHChk.FButton.Parent := Ctrl.WHChk.Parent;
    38253961                Ctrl.WHChk.FButton.Enabled:=(Pos('L',WHResultNot)>0);
     
    38303966                Ctrl.WHChk.FButton.Width := TextWidthByFont(Ctrl.WHChk.FButton.Font.Handle, Ctrl.WHChk.FButton.Caption) + 13;
    38313967                Ctrl.WHChk.FButton.Height := TextHeightByFont(Ctrl.WHChk.FButton.Font.Handle, Ctrl.WHChk.FButton.Caption) + 13;
     3968                UpdateColorsFor508Compliance(Ctrl.WHChk);
     3969                UpdateColorsFor508Compliance(Ctrl.WHChk.Flbl);
     3970                UpdateColorsFor508Compliance(Ctrl.WHChk.Check2);
     3971                UpdateColorsFor508Compliance(Ctrl.WHChk.Check3);
     3972                UpdateColorsFor508Compliance(Ctrl.WHChk.FButton);
     3973                ScreenReaderSupport(Ctrl.WHChk);
     3974                ScreenReaderSupport(Ctrl.WHChk.Check2);
     3975                ScreenReaderSupport(Ctrl.WHChk.Check3);
     3976                ScreenReaderSupport(Ctrl.WHChk.FButton);
    38323977                LineWidth := Ctrl.WHChk.FButton.Left + Ctrl.WHChk.FButton.Width;
    38333978                if piece(Prompt.FRec4,u,12)='1' then
     3979                begin
     3980                  Ctrl.WHChk.FPrintNow :=TCPRSDialogCheckBox.Create(AOwner);
     3981                  Ctrl.WHChk.FPrintNow.Parent := Ctrl.WHChk.Parent;
     3982                  Ctrl.WHChk.FPrintNow.ShowHint := true;
     3983                  Ctrl.WHChk.FPrintNow.Hint := 'Letter will print after "Finish" button is clicked';
     3984                  Ctrl.WHChk.FPrintNow.Caption:='Print Now';
     3985                  Ctrl.WHChk.FPrintNow.Width := TextWidthByFont(Ctrl.WHChk.FPrintNow.Font.Handle, Ctrl.WHChk.FPrintNow.Caption)+20;
     3986                  Ctrl.WHChk.FPrintNow.Height := TextHeightByFont(Ctrl.WHChk.FPrintNow.Font.Handle, Ctrl.WHChk.FPrintNow.Caption)+4;
     3987                  if (LineWidth + Ctrl.WHChk.FPrintNow.Width) > PWidth - 10 then
    38343988                  begin
    3835                      Ctrl.WHChk.FPrintNow :=TORCheckBox.Create(AOwner);
    3836                      Ctrl.WHChk.FPrintNow.Parent := Ctrl.WHChk.Parent;
    3837                      Ctrl.WHChk.FPrintNow.ShowHint := true;
    3838                      Ctrl.WHChk.FPrintNow.Hint := 'Letter will print after "Finish" button is clicked';
    3839                      Ctrl.WHChk.FPrintNow.Caption:='Print Now';
    3840                      Ctrl.WHChk.FPrintNow.Width := TextWidthByFont(Ctrl.WHChk.FPrintNow.Font.Handle, Ctrl.WHChk.FPrintNow.Caption)+20;
    3841                      Ctrl.WHChk.FPrintNow.Height := TextHeightByFont(Ctrl.WHChk.FPrintNow.Font.Handle, Ctrl.WHChk.FPrintNow.Caption)+4;
    3842                      if (LineWidth + Ctrl.WHChk.FPrintNow.Width) > PWidth - 10 then
    3843                         begin
    3844                           LineWidth := WrapLeft;
    3845                           Y := Ctrl.WHChk.FButton.Top + Ctrl.WHChk.FButton.Height;
    3846                           Nextline(Y);
    3847                         end;
    3848                      Ctrl.WHChk.FPrintNow.Left := LineWidth + 15;
    3849                      Ctrl.WHChk.FPrintNow.Top := Y + 7;
    3850                      Ctrl.WHChk.FPrintNow.Enabled := (Pos('L',WHResultNot)>0);
    3851                      Ctrl.WHChk.FPrintNow.Checked :=(WHPrintDevice<>'');
    3852                      Ctrl.WHChk.FPrintNow.OnClick := Prompt.PromptChange;
    3853                      MinX :=PWidth;
    3854                      if (Ctrl.WHChk.FButton.Top + Ctrl.WHChk.FButton.Height) > (Ctrl.WHChk.FPrintNow.Top + Ctrl.WHChk.FPrintNow.Height) then
    3855                         Y := Ctrl.WHChk.FButton.Top + Ctrl.WHChk.FButton.Height + 7
    3856                      else
    3857                         Y := Ctrl.WHChk.FPrintNow.Top + Ctrl.WHChk.FPrintNow.Height + 7;
    3858                   end
     3989                    LineWidth := WrapLeft;
     3990                    Y := Ctrl.WHChk.FButton.Top + Ctrl.WHChk.FButton.Height;
     3991                    Nextline(Y);
     3992                  end;
     3993                  Ctrl.WHChk.FPrintNow.Left := LineWidth + 15;
     3994                  Ctrl.WHChk.FPrintNow.Top := Y + 7;
     3995                  Ctrl.WHChk.FPrintNow.Enabled := (Pos('L',WHResultNot)>0);
     3996                  Ctrl.WHChk.FPrintNow.Checked :=(WHPrintDevice<>'');
     3997                  Ctrl.WHChk.FPrintNow.OnClick := Prompt.PromptChange;
     3998                  UpdateColorsFor508Compliance(Ctrl.WHChk.FPrintNow);
     3999                  MinX :=PWidth;
     4000                  if (Ctrl.WHChk.FButton.Top + Ctrl.WHChk.FButton.Height) > (Ctrl.WHChk.FPrintNow.Top + Ctrl.WHChk.FPrintNow.Height) then
     4001                    Y := Ctrl.WHChk.FButton.Top + Ctrl.WHChk.FButton.Height + 7
     4002                  else
     4003                    Y := Ctrl.WHChk.FPrintNow.Top + Ctrl.WHChk.FPrintNow.Height + 7;
     4004                ScreenReaderSupport(Ctrl.WHChk.FPrintNow);
     4005                end
    38594006                else
    38604007                  Y := Ctrl.WHChk.FButton.Top + Ctrl.WHChk.FButton.Height + 7;
    38614008                NextLine(Y);
    3862                 end;
     4009              end;
    38634010
    38644011            ptVisitDate:
    38654012              begin
    3866                 Ctrl.dt := TORDateCombo.Create(AOwner);
     4013                Ctrl.dt := TCPRSDialogDateCombo.Create(AOwner);
    38674014                Ctrl.ctrl.Parent := AParent;
    38684015                Ctrl.dt.LongMonths := TRUE;
     
    38774024                end;
    38784025                Ctrl.dt.OnChange := Prompt.PromptChange;
     4026                UpdateColorsFor508Compliance(Ctrl.dt);
    38794027                DoLbl := TRUE;
    38804028                MinX := Ctrl.dt.Width;
     
    38844032            ptPrimaryDiag, ptAdd2PL, ptContraindicated:
    38854033              begin
    3886                 Ctrl.cb := TORCheckBox.Create(AOwner);
     4034                Ctrl.cb := TCPRSDialogCheckBox.Create(AOwner);
    38874035                Ctrl.ctrl.Parent := AParent;
    38884036                Ctrl.cb.Checked := (Prompt.Value = '1');
     
    38954043                Ctrl.cb.Width := 17;
    38964044                Ctrl.cb.OnClick := Prompt.PromptChange;
     4045                UpdateColorsFor508Compliance(Ctrl.cb);
    38974046                MinX := Ctrl.cb.Width;
    38984047              end;
     
    39024051              if(pt = ptSubComment) then
    39034052              begin
    3904                 Ctrl.cb := TORCheckBox.Create(AOwner);
     4053                Ctrl.cb := TCPRSDialogCheckBox.Create(AOwner);
    39054054                Ctrl.ctrl.Parent := AParent;
    39064055                Ctrl.cb.Checked := (Prompt.Value = '1');
     
    39094058                Ctrl.cb.OnClick := SubCommentChange;
    39104059                Ctrl.cb.Tag := Integer(Prompt);
     4060                UpdateColorsFor508Compliance(Ctrl.cb);
    39114061                MinX := Ctrl.cb.Width;
    39124062              end
     
    39174067                if(vt = vtPain) then
    39184068                begin
    3919                   Ctrl.cbo := TORComboBox.Create(AOwner);
     4069                  Ctrl.cbo := TCPRSDialogComboBox.Create(AOwner);
    39204070                  Ctrl.ctrl.Parent := AParent;
    39214071                  Ctrl.cbo.Style := orcsDropDown;
     
    39344084                    ElementChecked := nil;
    39354085                  end;
     4086                  UpdateColorsFor508Compliance(Ctrl.cbo);
    39364087                end
    39374088                else
     
    39404091                  Ctrl.ctrl.Parent := AParent;
    39414092                  MinX := TextWidthByFont(Ctrl.vedt.Font.Handle, '12345.67');
    3942                   Ctrl.edt.OnKeyPress := Prompt.EditKeyPress;
    3943                   Ctrl.edt.OnChange := Prompt.PromptChange;
    3944                   Ctrl.edt.OnExit := Prompt.VitalVerify;
     4093                  Ctrl.vedt.OnKeyPress := Prompt.EditKeyPress;
     4094                  Ctrl.vedt.OnChange := Prompt.PromptChange;
     4095                  Ctrl.vedt.OnExit := Prompt.VitalVerify;
     4096                  UpdateColorsFor508Compliance(Ctrl.vedt);
    39454097                  if(vt in [vtTemp, vtHeight, vtWeight]) then
    39464098                  begin
    39474099                    HasVCombo := TRUE;
    3948                     Ctrl.vedt.FLinkedCombo := TVitalComboBox.Create(AOwner);
    3949                     Ctrl.vedt.FLinkedCombo.Parent := AParent;
    3950                     Ctrl.vedt.FLinkedCombo.OnChange := Prompt.PromptChange;
    3951                     Ctrl.vedt.FLinkedCombo.Tag := VitalControlTag(vt, TRUE);
    3952                     Ctrl.vedt.FLinkedCombo.OnExit := Prompt.VitalVerify;
    3953                     Ctrl.vedt.FLinkedCombo.FLinkedEdit := Ctrl.vedt;
     4100                    Ctrl.vedt.LinkedCombo := TVitalComboBox.Create(AOwner);
     4101                    Ctrl.vedt.LinkedCombo.Parent := AParent;
     4102                    Ctrl.vedt.LinkedCombo.OnChange := Prompt.PromptChange;
     4103                    Ctrl.vedt.LinkedCombo.Tag := VitalControlTag(vt, TRUE);
     4104                    Ctrl.vedt.LinkedCombo.OnExit := Prompt.VitalVerify;
     4105                    Ctrl.vedt.LinkedCombo.LinkedEdit := Ctrl.vedt;
    39544106                    case vt of
    39554107                      vtTemp:
    39564108                        begin
    3957                           Ctrl.vedt.FLinkedCombo.Items.Add('F');
    3958                           Ctrl.vedt.FLinkedCombo.Items.Add('C');
     4109                          Ctrl.vedt.LinkedCombo.Items.Add('F');
     4110                          Ctrl.vedt.LinkedCombo.Items.Add('C');
    39594111                        end;
    39604112
    39614113                      vtHeight:
    39624114                        begin
    3963                           Ctrl.vedt.FLinkedCombo.Items.Add('IN');
    3964                           Ctrl.vedt.FLinkedCombo.Items.Add('CM');
     4115                          Ctrl.vedt.LinkedCombo.Items.Add('IN');
     4116                          Ctrl.vedt.LinkedCombo.Items.Add('CM');
    39654117                        end;
    39664118
    39674119                      vtWeight:
    39684120                        begin
    3969                           Ctrl.vedt.FLinkedCombo.Items.Add('LB');
    3970                           Ctrl.vedt.FLinkedCombo.Items.Add('KG');
     4121                          Ctrl.vedt.LinkedCombo.Items.Add('LB');
     4122                          Ctrl.vedt.LinkedCombo.Items.Add('KG');
    39714123                        end;
    39724124
    39734125                    end;
    3974                     Ctrl.vedt.FLinkedCombo.SelectByID(Prompt.VitalUnitValue);
    3975                     if(Ctrl.vedt.FLinkedCombo.ItemIndex < 0) then
    3976                       Ctrl.vedt.FLinkedCombo.ItemIndex := 0;
    3977                     Ctrl.vedt.FLinkedCombo.Width := TextWidthByFont(Ctrl.vedt.Font.Handle,
    3978                                                                     Ctrl.vedt.FLinkedCombo.Items[1]) + 30;
    3979                     Ctrl.vedt.FLinkedCombo.SelLength := 0;
    3980                     inc(MinX, Ctrl.vedt.FLinkedCombo.Width);
     4126                    Ctrl.vedt.LinkedCombo.SelectByID(Prompt.VitalUnitValue);
     4127                    if(Ctrl.vedt.LinkedCombo.ItemIndex < 0) then
     4128                      Ctrl.vedt.LinkedCombo.ItemIndex := 0;
     4129                    Ctrl.vedt.LinkedCombo.Width := TextWidthByFont(Ctrl.vedt.Font.Handle,
     4130                                                                    Ctrl.vedt.LinkedCombo.Items[1]) + 30;
     4131                    Ctrl.vedt.LinkedCombo.SelLength := 0;
     4132                    UpdateColorsFor508Compliance(Ctrl.vedt.LinkedCombo);
     4133                    inc(MinX, Ctrl.vedt.LinkedCombo.Width);
    39814134                  end;
    39824135                  if(ElementChecked = Self) then
    39834136                  begin
    3984                     AutoFocusControl := Ctrl.edt;
     4137                    AutoFocusControl := Ctrl.vedt;
    39854138                    ElementChecked := nil;
    39864139                  end;
     
    39934146              if pt = ptDataList then
    39944147              begin
    3995                 Ctrl.cbo := TORComboBox.Create(AOwner);
     4148                Ctrl.cbo := TCPRSDialogComboBox.Create(AOwner);
    39964149                Ctrl.ctrl.Parent := AParent;
    39974150                Ctrl.cbo.Style := orcsDropDown;
     
    40174170                  end  {loop through FChoices/FChoicesActiveDates}
    40184171                else
    4019                   ActChoicesSL.Assign(Prompt.FData.FChoices);
    4020                 Ctrl.cbo.Items.Assign(ActChoicesSL);
     4172                  FastAssign(Prompt.FData.FChoices, ActChoicesSL);
     4173                FastAssign(ActChoicesSL, Ctrl.cbo.Items);
    40214174                Ctrl.cbo.CheckBoxes := TRUE;
    40224175                Ctrl.cbo.SelectByID(Prompt.Value);
     
    40264179                Ctrl.cbo.OnChange := Prompt.PromptChange;
    40274180                Ctrl.cbo.ListItemsOnly := TRUE;
     4181                UpdateColorsFor508Compliance(Ctrl.cbo);
    40284182                if(ElementChecked = Self) then
    40294183                begin
     
    40484202              end
    40494203              else
    4050               if(pt = ptMHTest) then
     4204              if(pt = ptMHTest) or ((pt = ptGaf) and (MHDLLFound = true)) then
    40514205              begin
    4052                 Ctrl.btn := TButton.Create(AOwner);
     4206                Ctrl.btn := TCPRSDialogButton.Create(AOwner);
    40534207                Ctrl.ctrl.Parent := AParent;
    40544208                Ctrl.btn.OnClick := Prompt.DoMHTest;
    40554209                Ctrl.btn.Caption := Prompt.ForcedCaption;
    40564210                if Piece(Prompt.FData.FRec3,U,13)='1' then
    4057                       Ctrl.btn.Caption := Ctrl.btn.Caption + ' *';
     4211                begin
     4212                  Ctrl.btn.Caption := Ctrl.btn.Caption + ' *';
     4213                  (Ctrl.btn as ICPRSDialogComponent).RequiredField := TRUE;
     4214                end;
    40584215                MinX := TextWidthByFont(Ctrl.btn.Font.Handle, Ctrl.btn.Caption) + 13;
    40594216                Ctrl.btn.Height := TextHeightByFont(Ctrl.btn.Font.Handle, Ctrl.btn.Caption) + 8;
    40604217                DoLbl := TRUE;
    40614218              end
    4062               else
    4063               if(pt = ptGAF) then
     4219             else
     4220              if ((pt = ptGAF)) and (MHDLLFound = false) then
    40644221              begin
    4065                 Ctrl.edt := TEdit.Create(AOwner);
     4222                Ctrl.edt := TCPRSDialogFieldEdit.Create(AOwner);
    40664223                Ctrl.ctrl.Parent := AParent;
    40674224                Ctrl.edt.Text := Prompt.Value;
     
    40774234                if(User.WebAccess and (GAFURL <> '')) then
    40784235                begin
    4079                   HelpBtn := TButton.Create(AOwner);
     4236                  HelpBtn := TCPRSDialogButton.Create(AOwner);
    40804237                  HelpBtn.Parent := AParent;
    40814238                  HelpBtn.Caption := 'Reference Info';
     
    40954252          //if(DoLbl) then
    40964253          begin
    4097             if(Prompt.Caption = '') and (not Prompt.Required) then
    4098               DoLbl := FALSE
     4254            Req := Prompt.Required;
     4255            if (not Req) and (pt = ptGaf) and (MHDLLFound = false) then
     4256              Req := (Piece(Prompt.FData.FRec3,U,13) = '1');
     4257            ProcessLabel(Req, Prompt.FParent.Enabled, AParent, Ctrl.Ctrl);
     4258            if assigned(lblCtrl) then
     4259            begin
     4260              inc(MinX, lblCtrl.Width + LblGap);
     4261              inc(MaxX, lblCtrl.Width + LblGap);
     4262            end
    40994263            else
    4100             begin
    4101               lbl := TLabel.Create(AOwner);
    4102               lbl.Parent := AParent;
    4103               lbl.Caption := Prompt.Caption;
    4104              if Prompt.Required then
    4105                 lbl.Caption :=  lbl.Caption+' *';
    4106               if pt = ptGaf then
    4107                 begin
    4108                   if Piece(Prompt.FData.FRec3,U,13)='1' then
    4109                       lbl.Caption := lbl.Caption + ' *';
    4110                 end;
    4111               lbl.Enabled := Prompt.FParent.Enabled;
    4112               inc(MinX, lbl.Width + LblGap);
    4113               inc(MaxX, lbl.Width + LblGap);
    4114             end;
     4264              DoLbl := FALSE;
    41154265          end;
    41164266
     
    41434293          //if((DoLbl) or (assigned(Ctrl.Ctrl))) then
    41444294          begin
    4145           if DoLbl then
    4146           begin
    4147             lbl.Left := X;
    4148             lbl.Top := Y;
    4149             inc(X, lbl.Width + LblGap);
    4150             dec(MinX, lbl.Width + LblGap);
    4151             dec(MaxX, lbl.Width + LblGap);
    4152             SameLineCtrl.Add(lbl);
    4153           end;
    4154           if(assigned(Ctrl.Ctrl)) then
    4155           begin
    4156             Ctrl.Ctrl.Enabled := Prompt.FParent.Enabled;
    4157             if not Ctrl.Ctrl.Enabled then
    4158               Ctrl.Ctrl.Font.Color := DisabledFontColor;
    4159             Ctrl.Ctrl.Left := X;
    4160             Ctrl.Ctrl.Top := Y;
    4161             SameLineCtrl.Add(Ctrl.Ctrl);
    4162             if(assigned(ud)) then
     4295            if DoLbl then
    41634296            begin
    4164               SameLineCtrl.Add(ud);
    4165               if(assigned(HelpBtn)) then
     4297              lblCtrl.Left := X;
     4298              lblCtrl.Top := Y;
     4299              inc(X, lblCtrl.Width + LblGap);
     4300              dec(MinX, lblCtrl.Width + LblGap);
     4301              dec(MaxX, lblCtrl.Width + LblGap);
     4302              SameLineCtrl.Add(lblCtrl);
     4303            end;
     4304            if(assigned(Ctrl.Ctrl)) then
     4305            begin
     4306              if ScreenReaderSystemActive then
    41664307              begin
    4167                 SameLineCtrl.Add(HelpBtn);
    4168                 Ctrl.Ctrl.Width := MinX - HelpBtn.Width - ud.Width;
    4169                 HelpBtn.Left := X + Ctrl.Ctrl.Width + ud.Width + Gap;
    4170                 HelpBtn.Top := Y;
    4171                 HelpBtn.Enabled := Prompt.FParent.Enabled;
     4308                if Supports(Ctrl.Ctrl, ICPRSDialogComponent) then
     4309                  ScreenReaderSystem_CurrentComponent(Ctrl.Ctrl as ICPRSDialogComponent)
     4310                else
     4311                  ScreenReaderSystem_Stop;
     4312              end;
     4313              Ctrl.Ctrl.Enabled := Prompt.FParent.Enabled;
     4314              if not Ctrl.Ctrl.Enabled then
     4315                Ctrl.Ctrl.Font.Color := DisabledFontColor;
     4316              Ctrl.Ctrl.Left := X;
     4317              Ctrl.Ctrl.Top := Y;
     4318              SameLineCtrl.Add(Ctrl.Ctrl);
     4319              if(assigned(ud)) then
     4320              begin
     4321                SameLineCtrl.Add(ud);
     4322                if(assigned(HelpBtn)) then
     4323                begin
     4324                  SameLineCtrl.Add(HelpBtn);
     4325                  Ctrl.Ctrl.Width := MinX - HelpBtn.Width - ud.Width;
     4326                  HelpBtn.Left := X + Ctrl.Ctrl.Width + ud.Width + Gap;
     4327                  HelpBtn.Top := Y;
     4328                  HelpBtn.Enabled := Prompt.FParent.Enabled;
     4329                end
     4330                else
     4331                  Ctrl.Ctrl.Width := MinX - ud.Width;
     4332                ud.Left := X + Ctrl.Ctrl.Width;
     4333                ud.Top := Y;
     4334                LastX := X + MinX + PromptGap;
     4335                ud.Enabled := Prompt.FParent.Enabled;
    41724336              end
    41734337              else
    4174                 Ctrl.Ctrl.Width := MinX - ud.Width;
    4175               ud.Left := X + Ctrl.Ctrl.Width;
    4176               ud.Top := Y;
    4177               LastX := X + MinX + PromptGap;
    4178               ud.Enabled := Prompt.FParent.Enabled;
    4179             end
    4180             else
    4181             if(HasVCombo) then
    4182             begin
    4183               SameLineCtrl.Add(Ctrl.vedt.FLinkedCombo);
    4184               Ctrl.Ctrl.Width := MinX - Ctrl.vedt.FLinkedCombo.Width;
    4185               Ctrl.vedt.FLinkedCombo.Left := X + Ctrl.Ctrl.Width;
    4186               Ctrl.vedt.FLinkedCombo.Top := Y;
    4187               LastX := X + MinX + PromptGap;
    4188               Ctrl.vedt.FLinkedCombo.Enabled := Prompt.FParent.Enabled;
    4189             end
    4190             else
    4191             begin
    4192               Ctrl.Ctrl.Width := MaxX;
    4193               LastX := X + MaxX + PromptGap;
     4338              if(HasVCombo) then
     4339              begin
     4340                SameLineCtrl.Add(Ctrl.vedt.LinkedCombo);
     4341                Ctrl.Ctrl.Width := MinX - Ctrl.vedt.LinkedCombo.Width;
     4342                Ctrl.vedt.LinkedCombo.Left := X + Ctrl.Ctrl.Width;
     4343                Ctrl.vedt.LinkedCombo.Top := Y;
     4344                LastX := X + MinX + PromptGap;
     4345                Ctrl.vedt.LinkedCombo.Enabled := Prompt.FParent.Enabled;
     4346              end
     4347              else
     4348              begin
     4349                Ctrl.Ctrl.Width := MaxX;
     4350                LastX := X + MaxX + PromptGap;
     4351              end;
    41944352            end;
    41954353          end;
    4196         end;
    41974354        end;
    41984355        if(assigned(ud)) then
     
    42064363    end;
    42074364  end;
     4365
     4366  procedure UpdatePrompts(EnablePanel: boolean; ClearCB: boolean);
     4367  begin
     4368    if EnablePanel then
     4369    begin
     4370      if not ScreenReaderSystemActive then
     4371      begin
     4372        pnl.TabStop := TRUE;     {tab through the panels instead of the checkboxes}
     4373        pnl.OnEnter := FieldPanelEntered;
     4374        pnl.OnExit := FieldPanelExited;
     4375      end;
     4376      if ClearCB then
     4377        cb := nil;
     4378    end;
     4379
     4380    if (FChecked and assigned(FPrompts) and (FPrompts.Count > 0)) then
     4381    begin
     4382      AddPrompts(FALSE, BaseParent, ParentWidth, Y);
     4383    end
     4384    else
     4385      inc(Y, pnl.Height);
     4386  end;
    42084387 
    42094388begin
    42104389  Result := nil;
     4390  cb := nil;
     4391  pnl := nil;
    42114392  AutoFocusControl := nil;
    42124393  X := TrueIndent;
     
    42214402    begin
    42224403      inc(Y,Gap);
    4223       pnl := GetPanel(EntryID, CRLFText(FText), ParentWidth - X - (Gap * 2));
     4404      pnl := GetPanel(EntryID, CRLFText(FText), ParentWidth - X - (Gap * 2), nil);
    42244405      pnl.Left := X;
    42254406      pnl.Top := Y;
    4226       if (FChecked and assigned(FPrompts) and (FPrompts.Count > 0)) then
    4227       begin
    4228         cb := nil;
    4229         AddPrompts(FALSE, BaseParent, ParentWidth, Y);
    4230       end
    4231       else
    4232         inc(Y,pnl.Height);
     4407      UpdatePrompts(ScreenReaderSystemActive, TRUE);
    42334408    end;
    42344409  end
     
    42364411  begin
    42374412    inc(Y,Gap);
    4238     cb := TORCheckBox.Create(AOwner);
     4413    cb := TCPRSDialogParentCheckBox.Create(AOwner);
    42394414    cb.Parent := BaseParent;
    42404415    cb.Left := X;
     
    42454420    cb.Checked := FChecked;
    42464421    cb.Width := ParentWidth - X - Gap;
    4247     cb.Caption := CRLFText(FText);
     4422    if not ScreenReaderSystemActive then
     4423      cb.Caption := CRLFText(FText);
    42484424    cb.AutoAdjustSize;
    42494425    cbSingleLine := cb.SingleLine;
    4250     cb.AutoSize := FALSE;
     4426//    cb.AutoSize := FALSE;
    42514427    cb.WordWrap := FALSE;
    4252     cb.Caption := '';
    4253     cb.Width := 13;
    4254     cb.Height := 17;
    4255     cb.TabStop := False;  {take checkboxes out of the tab order}
    4256     pnl := GetPanel(EntryID, CRLFText(FText), ParentWidth - X - (Gap * 2) - IndentGap);
     4428    cb.Caption := ' ';
     4429//    cb.Width := 13;
     4430//    cb.Height := 17;
     4431    if not ScreenReaderSystemActive then
     4432      cb.TabStop := False;  {take checkboxes out of the tab order}
     4433    pnl := GetPanel(EntryID, CRLFText(FText), ParentWidth - X - (Gap * 2) - IndentGap, cb);
    42574434    pnl.Left := X + IndentGap;
    42584435    pnl.Top := Y;
    42594436    cb.Associate := pnl;
    42604437    pnl.Tag := Integer(cb);   {So the panel can check the checkbox}
    4261     pnl.TabStop := TRUE;     {tab through the panels instead of the checkboxes}
    4262 
    42634438    cb.OnClick := cbClicked;
    4264     pnl.OnEnter := FieldPanelEntered;
    4265     pnl.OnExit := FieldPanelExited;
    4266     TFieldPanel(pnl).OnKeyPress := FieldPanelKeyPress;
     4439    cb.OnEnter := cbEntered;
     4440    if ScreenReaderSystemActive then
     4441      cb.OnExit := ParentCBExit;
     4442
     4443    UpdateColorsFor508Compliance(cb);
     4444    pnl.OnKeyPress := FieldPanelKeyPress;
    42674445    pnl.OnClick := FieldPanelOnClick;
    42684446    for i := 0 to pnl.ControlCount - 1 do
    4269       if (pnl.Controls[i] is TLabel) and
     4447      if ((pnl.Controls[i] is TLabel) or (pnl.Controls[i] is TVA508StaticText)) and
    42704448         not (fsUnderline in TLabel(pnl.Controls[i]).Font.Style) then //If this isn't a hyperlink change then event handler
    42714449         TLabel(pnl.Controls[i]).OnClick := FieldPanelLabelOnClick;
     
    42754453      cb.RadioStyle := TRUE;
    42764454
    4277     if (FChecked and assigned(FPrompts) and (FPrompts.Count > 0)) then
    4278       AddPrompts(FALSE, BaseParent, ParentWidth, Y)
    4279     else
    4280       inc(Y, pnl.Height);
     4455    UpdatePrompts(TRUE, FALSE);
    42814456  end;
    42824457
     
    42934468      PrntWidth := gb.Width - (Gap * 2);
    42944469      gb.Caption := BoxCaption;
     4470//      if ScreenReaderSystemActive then
     4471//      begin
     4472//        ScreenReaderSystem_AddText(gb.Caption + ',');
     4473//      end;
    42954474      gb.Enabled := EnableChildren;
    42964475      if(not EnableChildren) then
    42974476        gb.Font.Color := DisabledFontColor;
     4477      UpdateColorsFor508Compliance(gb);
    42984478      prnt := gb;
    42994479      if(gb.Caption = '') then
     
    43404520      Result := AutoFocusControl
    43414521  end;
     4522  if ScreenReaderSystemActive then
     4523    ScreenReaderSystem_Stop;   
    43424524end;
    43434525
     
    44554637      end;
    44564638      if FReminder.FNoResolve then
    4457         Lst.Add(txt)
     4639      begin
     4640        StripScreenReaderCodes(txt);
     4641        Lst.Add(txt);
     4642      end
    44584643      else
    44594644        WordWrap(txt, Lst, ilvl);
     
    44744659          Prompt := TRemPrompt(FParent.FPrompts[i]);
    44754660          if(Prompt.FIsShared) and (Prompt.FSharedChildren.IndexOf(Self) >= 0) then
    4476             WordWrap(Prompt.NoteText, Lst, ilvl);
     4661            begin
     4662              //AGP Change MH dll
     4663              if (Prompt.PromptType = ptMHTest) then WordWrap(Prompt.NoteText, Lst, ilvl, 4, True)
     4664              else WordWrap(Prompt.NoteText, Lst, ilvl);
     4665            end;
    44774666        end;
    44784667      end;
     
    44814670    begin
    44824671      for i := 0 to FChildren.Count-1 do
     4672      begin
    44834673        TRemDlgElement(FChildren[i]).AddText(Lst);
     4674      end;
    44844675    end;
    44854676  finally
     
    46734864          end;
    46744865      //(AGP Change 24.9 add check to see if MH tests are required)
    4675      if ((Pt = ptMHTest) or (Pt = ptGAF)) and (Piece(Prompt.FData.FRec3,U,13) = '1') and
     4866     if ((Pt = ptMHTest) or (Pt = ptGAF)) and (StrtoInt(Piece(Prompt.FData.FRec3,U,13)) > 0) and
    46764867                (not Prompt.Forced) then
    46774868        begin
     4869          if (Piece(Prompt.FData.FRec3,U,13) = '2') and (Prompt.FMHTestComplete = 0) then break;
    46784870          if (Pt = ptMHTest) and (Prompt.FMHTestComplete = 2) then
    46794871            begin
     
    46884880                  end;
    46894881            end;
    4690           if (Pt = ptMHTest) and (Prompt.FMHTestComplete = 0) or (Prompt.FValue = '') then
     4882          if (Pt = ptMHTest) and (Prompt.FMHTestComplete = 0) or ((Prompt.FValue = '') and (Pos('New MH dll',Prompt.FValue) = 0)) then
    46914883                  begin
    46924884                    if Prompt.FValue = '' then
     
    46974889                   WordWrap(' ',List,65,6);
    46984890                  end;
     4891          if (Pt = ptMHTest) and (Prompt.FMHTestComplete = 0) and (Pos('New MH dll',Prompt.FValue) > 0) then
     4892            begin
     4893              WordWrap('MH test ' + Piece(Prompt.FData.FRec3, U, 8) + ' is not complete', List, 65, 6);
     4894              WordWrap(' ',List,65,6);
     4895            end;
    46994896          if (Pt = ptGAF) and ((Prompt.FValue = '0') or (Prompt.FValue = '')) then
    47004897            begin
     
    47084905  begin
    47094906    cReq := ChildrenRequired;
    4710     if(cReq in [crOne, crAtLeastOne]) then
     4907    if(cReq in [crOne, crAtLeastOne, crAll]) then
    47114908    begin
    47124909      cnt := 0;
     
    47244921        msg := 'One or more selections required'
    47254922      else
     4923      if (cReq = crAll) and (cnt < FChildren.Count) then
     4924        msg := 'All selections are required'
     4925      else
    47264926        msg := '';
    47274927      if(msg <> '') then
     
    47794979end;
    47804980
    4781 function TRemDlgElement.ResultDlgID: integer;
    4782 begin
    4783   Result := StrToIntDef(Piece(FRec1, U, 10), 0);
     4981function TRemDlgElement.ResultDlgID: string;
     4982begin
     4983  Result := Piece(FRec1, U, 10);
    47844984end;
    47854985
     
    48695069      begin
    48705070        TmpSL.CommaText := copy(FFieldValues[i],p+1,MaxInt);
    4871         FldData.AddStrings(TmpSL);
     5071        FastAddStrings(TmpSL, FldData);
    48725072        TmpSL.Clear;
    48735073      end;
     
    48845084procedure TRemDlgElement.FieldPanelEntered(Sender: TObject);
    48855085begin
    4886   with TFieldPanel(Sender) do
     5086  with TDlgFieldPanel(Sender) do
    48875087  begin
    48885088    Focus := TRUE;
    48895089    Invalidate;
    4890     if Parent is TFieldPanel then
    4891     begin
    4892       TFieldPanel(Parent).Focus := FALSE;
    4893       TFieldPanel(Parent).Invalidate;
     5090    if Parent is TDlgFieldPanel then
     5091    begin
     5092      TDlgFieldPanel(Parent).Focus := FALSE;
     5093      TDlgFieldPanel(Parent).Invalidate;
    48945094    end;
    48955095  end;
     
    48985098procedure TRemDlgElement.FieldPanelExited(Sender: TObject);
    48995099begin
    4900   with TFieldPanel(Sender) do
     5100  with TDlgFieldPanel(Sender) do
    49015101  begin
    49025102    Focus := FALSE;
    49035103    Invalidate;
    4904     if Parent is TFieldPanel then
    4905     begin
    4906       TFieldPanel(Parent).Focus := TRUE;
    4907       TFieldPanel(Parent).Invalidate;
     5104    if Parent is TDlgFieldPanel then
     5105    begin
     5106      TDlgFieldPanel(Parent).Focus := TRUE;
     5107      TDlgFieldPanel(Parent).Invalidate;
    49085108    end;
    49095109  end;
     
    49245124begin
    49255125//  if TFieldPanel(Sender).Focus then
    4926     TORCheckBox(TFieldPanel(Sender).Tag).Checked := not FChecked;
     5126    TORCheckBox(TDlgFieldPanel(Sender).Tag).Checked := not FChecked;
    49275127end;
    49285128
     
    55495749          end
    55505750          else
    5551           if pt = ptGAF then
     5751          if (pt = ptGAF) and (MHDLLFound = false) then
    55525752            TmpValue := (Sender as TEdit).Text;
    55535753      end;
     
    56605860var
    56615861  pt: TRemPromptType;
    5662   fmt, tmp, WHValue: string;
     5862  dateStr, fmt, tmp, WHValue: string;
    56635863  cnt, i, j, k: integer;
    56645864  ActDt, InActDt: Double;
     
    56905890            if(tmp <> '') and (tmp <> '0') and (length(Tmp) = 7) then
    56915891            begin
     5892              dateStr := '';
    56925893              if FMonthReq and (copy(tmp,4,2) = '00') then
    56935894                Result := ''
     
    56955896              begin
    56965897                if(copy(tmp,4,4) = '0000') then
    5697                   fmt := 'YYYY'
     5898                  begin
     5899                    fmt := 'YYYY';
     5900                    dateStr := ' – Exact date is unknown';
     5901                  end
    56985902                else
    56995903                if(copy(tmp,6,2) = '00') then
    5700                   fmt := 'MMMM, YYYY'
     5904                  begin
     5905                    fmt := 'MMMM, YYYY';
     5906                    dateStr := ' – Exact date is unknown';
     5907                  end
    57015908                else
    57025909                  fmt := 'MMMM D, YYYY';
    5703                 Result := FormatFMDateTimeStr(fmt, tmp);
     5910                if dateStr = '' then Result := FormatFMDateTimeStr(fmt, tmp)
     5911                else Result := FormatFMDateTimeStr(fmt, tmp) + ' ' + dateStr;
    57045912              end;
    57055913            end;
     
    59016109          Result := FMiscText
    59026110        else
    5903         if pt = ptGAF then
     6111        if (pt = ptGAF) and (MHDLLFound = false) then
    59046112        begin
    59056113          if(StrToIntDef(Piece(tmp, U, 1),0) <> 0) then
    59066114          begin
    59076115            Result := tmp;
     6116          end
     6117        end
     6118        else
     6119        if pt = ptMHTest then
     6120          Result := FMiscText;
     6121
    59086122            (*
    59096123            GafDate := Trunc(FParent.FReminder.PCEDataObj.VisitDateTime);
     
    59126126                            CRCode + 'Determined By: ' + FParent.FReminder.PCEDataObj.Providers.PCEProviderName;
    59136127            *)
    5914           end;
     6128          //end;
    59156129        end;
    59166130      end;
    5917 
    59186131    end;
    59196132    if(Result <> '') and (Caption <> '') then
    59206133      Result := Trim(Caption + ' ' + Trim(Result));
    5921   end;
     6134  //end;
    59226135end;
    59236136
     
    61066319    OK := (assigned(FParent) and assigned(FParent.FData) and
    61076320          (Piece(FRec4, U, 4) = RemPromptCodes[ptPrimaryDiag]));
     6321    if (OK = false) and (Value = 'New MH dll') then OK := true;
    61086322    if OK then
    61096323      OK := (not FParent.Historical);
     
    62536467            begin
    62546468              Text := VitalValue;
    6255               if(assigned(FLinkedCombo)) then
     6469              if(assigned(LinkedCombo)) then
    62566470              begin
    62576471                Tmp := VitalUnitValue;
    62586472                if(Tmp <> '') then
    6259                   FLinkedCombo.Text := VitalUnitValue
     6473                  LinkedCombo.Text := VitalUnitValue
    62606474                else
    6261                   FLinkedCombo.ItemIndex := 0;
     6475                  LinkedCombo.ItemIndex := 0;
    62626476              end;
    62636477            end;
     
    63896603  begin
    63906604    vEdt := TVitalEdit(Sender);
    6391     vCbo := vEdt.FLinkedCombo;
     6605    vCbo := vEdt.LinkedCombo;
    63926606  end
    63936607  else
     
    63956609  begin
    63966610    vCbo := TVitalComboBox(Sender);
    6397     vEdt := vCbo.FLinkedEdit;
     6611    vEdt := vCbo.LinkedEdit;
    63986612  end
    63996613  else
     
    64736687procedure TRemPrompt.DoMHTest(Sender: TObject);
    64746688var
    6475   TmpSL: TStringList;
     6689  TmpSL, tmpScores, tmpResults: TStringList;
    64766690  i, TestComp: integer;
    6477   Before, After: string;
     6691  Before, After, Score: string;
     6692  MHRequired: boolean;
    64786693
    64796694begin
    64806695  TestComp := 0;
     6696  try
     6697  if (sender is TCPRSDialogButton) then
     6698     (Sender as TCPRSDialogButton).Enabled := false;
     6699  if FParent.FReminder.MHTestArray = nil then FParent.FReminder.MHTestArray := TORStringList.Create;
    64816700  if(MHTestAuthorized(FData.Narrative)) then
    64826701  begin
     
    64876706      else
    64886707        TmpSL := nil;
     6708      if Piece(self.FData.FRec3,U,13) = '1' then MHRequired := True
     6709      else MHRequired := false;
    64896710      Before := GetValue;
    6490       After := PerformMHTest(Before, FData.Narrative, TmpSL);
     6711      After := PerformMHTest(Before, FData.Narrative, TmpSL, MHRequired);
    64916712      if uinit.TimedOut then After := '';
     6713      if Piece(After, U, 1) = 'New MH dll' then
     6714        begin
     6715          if Piece(After,U,2)='COMPLETE' then
     6716          begin
     6717            FParent.FReminder.MHTestArray.Add(FData.Narrative + U + FParent.FReminder.IEN);
     6718            self.FMHTestComplete := 1;
     6719            Score := Piece(After,U,3);
     6720            if FParent.ResultDlgID <> '' then
     6721              begin
     6722                tmpScores := TStringList.Create;
     6723                tmpResults := TStringList.Create;
     6724                PiecestoList(copy(score,2,Length(score)),'*',tmpScores);
     6725                PiecestoList(FParent.ResultDlgID,'~',tmpResults);
     6726                GetMHResultText(FMiscText, tmpResults, tmpScores);
     6727                if tmpScores <> nil then tmpScores.Free;
     6728                if tmpResults <> nil then tmpResults.Free;
     6729              end;
     6730            if (FMiscText <> '') then FMiscText := FMiscText + '~<br>';
     6731            if tmpSL <> nil then
     6732              begin
     6733                for i := 0 to TmpSL.Count-1 do
     6734                  begin
     6735                    if(i > 0) then FMiscText := FMiscText + CRCode;
     6736                    FMiscText := FMiscText + TmpSL[i];
     6737                  end;
     6738              end;
     6739          //end;
     6740            //ExpandTIUObjects(FMiscText);
     6741          end
     6742          else if Piece(After,U,2)='INCOMPLETE' then
     6743            begin
     6744               FParent.FReminder.MHTestArray.Add(FData.Narrative + U + FParent.FReminder.IEN);
     6745               self.FMHTestComplete := 2;
     6746               FMiscText := '';
     6747               After := 'X';
     6748            end
     6749          else if Piece(After,U,2)='CANCELLED' then
     6750            begin
     6751               self.FMHTestComplete := 0;
     6752               FMiscText := '';
     6753               After := '';
     6754            end;
     6755          SetValue(After);
     6756          exit;
     6757        end;
    64926758      if pos(U,After)>0 then
    64936759        begin
     
    64986764      if(Before <> After) and (not uInit.TimedOut) then
    64996765      begin
    6500         if(After = '') or (FParent.ResultDlgID = 0) then
     6766        if(After = '') or (FParent.ResultDlgID = '') then
    65016767          FMiscText := ''
    65026768        else
     
    65316797                InfoBox('Not Authorized to score the ' + FData.Narrative + ' test.',
    65326798                   'Insufficient Authorization', MB_OK + MB_ICONERROR);
     6799  finally
     6800     (Sender as TCPRSDialogButton).Enabled := true;
     6801  end;
    65336802end;
    65346803
Note: See TracChangeset for help on using the changeset viewer.