2. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 11/9/2017 7:41:45 AM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

2.1 Files compared

# Location File Last Modified
1 OR_3_455_source.zip\OR_3_455_source\Encounter fEncounterFrame.pas Thu Nov 9 13:04:36 2017 UTC
2 OR_3_455_source.zip\OR_3_455_source\Encounter fEncounterFrame.pas Thu Nov 9 13:28:09 2017 UTC

2.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1534
Changed 1 2
Inserted 0 0
Removed 0 0

2.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

2.4 Active regular expressions

No regular expressions were active.

2.5 Comparison detail

  1   unit fEnco unterFrame ;
  2  
  3   interface
  4  
  5   uses
  6     Windows,  Messages,  SysUtils,  Classes,  Graphics,  Controls,  Forms, Dia logs,
  7     Tabs, Co mCtrls, Ex tCtrls, Me nus, StdCt rls, Butto ns, fPCEBa se,
  8     fVisitTy pe, fDiagn oses, fPro cedure, fI mmunizatio n, fSkinTe st, fPatie ntEd,
  9     fHealthF actor, fEx am, uPCE,  rPCE, rTIU , ORCtrls,  ORFn
  10   { $ IFDEF  GROUPNOTES }
  11   { $ ELSE}
  12   //  , fEnc Vitals, rv itals
  13   { $ ENDIF}
  14     , fBase5 08Form,
  15     VA508Acc essibility Manager, u GN_Const;
  16  
  17   const
  18     //tab na mes
  19     CT_Visit Nm = '&Vis it Type';
  20     CT_DiagN m  = '&Dia gnoses';
  21     CT_ProcN m  = '&Pro cedures';
  22     CT_ImmNm    = '&Imm unizations ';
  23     CT_SkinN m  = '&Ski n Tests';
  24     CT_PedNm    = 'Pati ent &Ed';
  25     CT_HlthN m  = '&Hea lth Factor s';
  26     CT_XamNm    = 'E&xa ms';
  27     CT_VitNm    = 'Vit& als';
  28     CT_GAFNm    = '&GAF ';
  29  
  30     NUM_TABS        = 3 ;
  31     TAG_VTYP E      = 1 0;
  32     TAG_DIAG        = 2 0;
  33     TAG_PROC        = 3 0;
  34     TAG_IMMU NIZ    = 4 0;
  35     TAG_SKIN        = 5 0;
  36     TAG_PED         = 6 0;
  37     TAG_HF          = 7 0;
  38     TAG_XAM         = 8 0;
  39     TAG_TRT         = 9 0;
  40  
  41     TX_NOSEC TION = '-1 ^No sectio ns found';
  42     TX_PROV_ REQ = 'A p rimary enc ounter pro vider must  be select ed ' + CRL F +
  43                    'bef ore encoun ter data c an be save d.' + CRLF  + CRLF +
  44                    'Sel ect the Pr imary Enco unter Prov ider on th e VISIT TY PE tab.' +  CRLF +
  45                    'Oth erwise, pr ess <Cance l> to quit  without s aving data .';
  46  
  47     TC_PROV_ REQ = 'Mis sing Prima ry Provide r for Enco unter';
  48  
  49   type
  50     TfrmEnco unterFrame  = class(T frmBase508 Form)
  51       Status Bar1: TSta tusBar;
  52       pnlPag e: TPanel;
  53       Bevel1 : TBevel;
  54       TabCon trol: TTab Control;
  55       mmLog:  TMemo;
  56       ckbDeb ugInfo: TC heckBox;
  57       splDeb ug: TSplit ter;
  58  
  59       proced ure tabPag eChange(Se nder: TObj ect; NewTa b: Integer ;
  60         var  AllowChang e: Boolean );
  61       proced ure FormRe size(Sende r: TObject );
  62       proced ure Sectio nClick(Sen der: TObje ct);
  63       proced ure FormDe stroy(Send er: TObjec t);
  64       proced ure FormCr eate(Sende r: TObject );
  65       proced ure FormCl oseQuery(S ender: TOb ject; var  CanClose:  Boolean);
  66       proced ure TabCon trolChange (Sender: T Object);
  67       proced ure TabCon trolChangi ng(Sender:  TObject;
  68         var  AllowChang e: Boolean );
  69       proced ure FormKe yDown(Send er: TObjec t; var Key : Word;
  70         Shif t: TShiftS tate);
  71       proced ure FormCl ose(Sender : TObject;  var Actio n: TCloseA ction);
  72       proced ure FormCa nResize(Se nder: TObj ect; var N ewWidth,
  73         NewH eight: Int eger; var  Resize: Bo olean);
  74       proced ure FormSh ow(Sender:  TObject);
  75       proced ure TabCon trolEnter( Sender: TO bject);
  76       proced ure ckbDeb ugInfoClic k(Sender:  TObject);
  77  
  78     private
  79   { $ IFDEF  DEBUG}
  80       fDebug PCE: TPCED ata;
  81   { $ ENDIF}
  82       FAutoS ave: boole an;
  83   //    FSav eNeeded: b oolean;
  84       FChang eSource: I nteger;
  85       FCance l:  Boolea n; //Indic ates the c ancel butt on has bee n pressed;
  86       FAbort : boolean;  // indica tes that n either OK  or Cancel  has been p ressed
  87       FormLi st: TStrin gList;  // Holds the  types of a ny forms t hat will b e used
  88                                 // in the fra me.  They  must be av ailable at  compile t ime
  89       FLastP age: TfrmP CEBase;
  90       FGiveM ultiTabMes sage: bool ean;
  91       proced ure SynchP CEData;
  92       proced ure Switch ToPage(New Form: Tfrm PCEBase);    //was tf rmPage
  93  
  94       functi on FormLis tContains( item: stri ng): Boole an;
  95       proced ure SendDa ta;
  96       proced ure Update Encounter( PCE: TPCED ata);
  97       proced ure SetFor mFonts;
  98  
  99       proced ure doCrea teForms(aL ocation: I nteger);
  100       functi on pageByN ame(aName: String): T frmPCEBase ;
  101  
  102     public
  103       proced ure Select Tab(NewTab Name: stri ng);
  104       proper ty ChangeS ource:     Integer re ad FChange Source;
  105       proper ty Forms:             tstringlis t read For mList;
  106       proper ty Cancel:            Boolean re ad FCancel  write FCa ncel;
  107       proper ty Abort:           B oolean rea d FAbort w rite FAbor t;
  108  
  109       proced ure _UM_GN _ENCUPDATE (var Messa ge: TMessa ge); messa ge UM_GN_E NCUPDATE;
  110  
  111     end;
  112  
  113   var
  114     frmEncou nterFrame:  TfrmEncou nterFrame;
  115     uSCCond:                TSCCon ditions;
  116     uVisitTy pe:            TPCEPr oc;        // contain s info for  visit typ e page
  117     uEncPCED ata: TPCED ata;
  118     uProvide rs: TPCEPr oviderList ;
  119  
  120   // Returns  true if P CE data st ill needs  to be save d - vitals /gaf are a lways save d
  121   function U pdatePCE(P CEData: TP CEData; Sa veOnExit:  boolean =  TRUE): boo lean;
  122  
  123   implementa tion
  124  
  125   uses
  126     uCore,
  127     fGAF, uC onst,
  128     rCore, f PCEProvide r, rMisc,  VA508Acces sibilityRo uter, VAUt ils
  129     , fEncVi tals,rGN_C ore, oGN_P TData, uGN _Utils, uG N_RPCLog;
  130  
  131   {$R *.DFM}
  132  
  133   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  134   //Name: fu nction Tfr mEncounter Frame.Form ListContai ns(item: s tring): Bo olean;
  135   //Created:  12/06/98
  136   //By: Robe rt Bott
  137   //Location : ISL
  138   //Descript ion: Retur ns a boole an value i ndicating  if a given  string ex ists in
  139   // the for mlist.
  140   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  141   function T frmEncount erFrame.Fo rmListCont ains(item:  string):  Boolean;
  142   begin
  143     result : = false;
  144     if (Form List.Index Of(item) < > -1 ) the n
  145       result  := true;
  146   end;
  147  
  148   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  149   //Name: Tf rmEncounte rFrame.Swi tchToPage( NewForm: t frmPCEBase );
  150   //Created:  Jan 1999
  151   //By: Robe rt Bott
  152   //Location : ISL
  153   //Descript ion: Bring s the sele cted page  to the fro nt for dis play.
  154   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  155   procedure  TfrmEncoun terFrame.S witchToPag e(NewForm:  tfrmPCEBa se);// was  TfrmPage) ;
  156   { unmerge/ merge menu s, bring p age to top  of z-orde r, call fo rm-specifi c OnDispla y code }
  157   begin
  158     if (NewF orm = nil)  or (FLast Page = New Form) then  Exit;
  159     if Assig ned(FLastP age) then
  160       FLastP age.Hide;
  161     FLastPag e := NewFo rm;
  162   //  KeyPre view := (N ewForm = f rmEncVital s);
  163     NewForm. DisplayPag e;  // thi s calls Br ingToFront  for the f orm
  164   { $ IFDEF  GROUPNOTES }
  165     NewForm. Show;
  166   { $ ENDIF}
  167   end;
  168  
  169   procedure  TfrmEncoun terFrame.t abPageChan ge(Sender:  TObject;  NewTab: In teger; var  AllowChan ge: Boolea n);
  170   { switches  to form l inked to N ewTab }
  171   begin
  172     SwitchTo Page(pageB yName(TabC ontrol.Tab s[NewTab]) );
  173   end;
  174  
  175   { Resize a nd Font-Ch ange proce dures ---- ---------- ---------- ---------- ---------- ---------- --- }
  176   procedure  TfrmEncoun terFrame.F ormResize( Sender: TO bject);
  177   begin
  178     self.rep aint;
  179   end;
  180  
  181   function U pdatePCE(P CEData: TP CEData; Sa veOnExit:  Boolean =  TRUE): Boo lean;
  182   var
  183     AUser: s tring;
  184  
  185   begin
  186     frmEncou nterFrame  := TfrmEnc ounterFram e.Create(A pplication );
  187     try
  188       frmEnc ounterFram e.FAutoSav e := SaveO nExit;
  189  
  190       uEncPC EData := P CEData;
  191       if (uE ncPCEData. Empty and  ((uEncPCED ata.Locati on = 0) or
  192         (uEn cPCEData.V isitDateTi me = 0)) a nd (not En counter.Ne edVisit))  then
  193         uEnc PCEData.Us eEncounter  := TRUE;
  194       frmEnc ounterFram e.Caption  := 'Encoun ter Form f or ' +
  195         Exte rnalName(u EncPCEData .Location,  44) + '   (' +
  196         Form atFMDateTi me('mmm dd ,yyyy@hh:n n', uEncPC EData.Visi tDateTime)  + ')';
  197  
  198       uProvi ders.Assig n(uEncPCED ata.Provid ers);
  199       SetDef aultProvid er(uProvid ers, uEncP CEData);
  200       AUser  := IntToSt r(uProvide rs.Pending IEN(False) );
  201       if (AU ser <> '0' ) and (uPr oviders.In dexOfProvi der(AUser)  < 0) and
  202         Auto Checkout(u EncPCEData .Location)  then
  203         uPro viders.Add Provider(A User, uPro viders.Pen dingName(F alse), Fal se);
  204  
  205       { $ IF DEF GROUPN OTES }
  206       frmEnc ounterFram e.doCreate Forms(PCED ata.Locati on);
  207       { $ EL SE }
  208       // frm EncounterF rame.Creat eChildForm s(frmEncou nterFrame,  PCEData.L ocation);
  209       { $ EN DIF }
  210       SetFor mPosition( frmEncount erFrame);
  211       Resize AnchoredFo rmToFont(f rmEncounte rFrame);
  212       // Set FormPositi on(frmEnco unterFrame );
  213  
  214       with f rmEncounte rFrame do
  215       begin
  216         SetR PCEncLocat ion(PCEDat a.Location );
  217         Sync hPCEData;
  218         TabC ontrol.Tab index := 0 ;
  219         TabC ontrolChan ge(TabCont rol);
  220  
  221         Show Modal;
  222         Resu lt := (not  FCancel);
  223       end;
  224     finally
  225       frmEnc ounterFram e.Free;  / / v22.11 ( JD and SM)
  226       // frm EncounterF rame.Relea se;
  227       // frm EncounterF rame := ni l; // acce ss violati on source?   removed  7/28/03 RV
  228     end;
  229   end;
  230  
  231   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  232   //Name: Tf rmEncounte rFrame.Sec tionClick( Sender: TO bject);
  233   //Created:  Jan 1999
  234   //By: Robe rt Bott
  235   //Location : ISL
  236   //Descript ion: Call  the proced ure apropr iate for t he selecte d tab
  237     //////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// / }
  238   procedure  TfrmEncoun terFrame.S ectionClic k(Sender:  TObject);
  239   begin
  240     with Sen der as TLi stBox do
  241       case T ag of
  242         TAG_ VTYPE:
  243           if  FormListC ontains(CT _VisitNm)  then
  244           be gin
  245              with frmVi sitType do
  246                lstVType SectionCli ck(Sender) ;
  247           en d;
  248       end;
  249   end;
  250  
  251   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  252   //Name: pr ocedure Tf rmEncounte rFrame.Syn chPCEData;
  253   //Created:  Jan 1999
  254   //By: Robe rt Bott
  255   //Location : ISL
  256   //Descript ion: Synch ronize any  existing  PCE data w ith what i s displaye d in the f orm.
  257   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  258   procedure  TfrmEncoun terFrame.S ynchPCEDat a;
  259  
  260     procedur e InitList (AListBox:  TORListBo x);
  261     var
  262       DoClic k: Boolean ;
  263  
  264     begin
  265       with A ListBox do
  266       begin
  267         DoCl ick := TRU E;
  268         case  Tag of
  269           TA G_VTYPE:
  270              begin
  271                if FormL istContain s(CT_Visit Nm) then
  272                  ListVi sitTypeSec tions(Item s);
  273                DoClick  := AutoSel ectVisit(P CERPCEncLo cation);
  274              end;
  275         end;
  276         if I tems.Count  > 0 then
  277         begi n
  278           if  DoClick t hen
  279           be gin
  280              ItemIndex  := 0;
  281              SectionCli ck(AListBo x);
  282           en d;
  283         end
  284         else
  285           It ems.Add(TX _NOSECTION );
  286       end;
  287     end;
  288  
  289   begin
  290     if FormL istContain s(CT_Visit Nm) then
  291     with frm VisitType  do
  292       begin
  293         Init List(frmVi sitType.ls tVTypeSect ion);                       // s et up Visi t Type pag e
  294         List SCDisabili ties(memSC Display.Li nes);
  295         uSCC ond := Eli gbleCondit ions;
  296         frmV isitType.f raVisitRel ated.InitA llow(uSCCo nd);
  297       end;
  298     with uEn cPCEData d o                                  // load  any existi ng data fr om PCEData
  299     begin
  300       if For mListConta ins(CT_Vis itNm) then
  301         frmV isitType.f raVisitRel ated.InitR elated(uEn cPCEData);
  302       if For mListConta ins(CT_Dia gNm) then
  303         frmD iagnoses.I nitTab(Cop yDiagnoses , ListDiag nosisSecti ons);
  304       if For mListConta ins(CT_Pro cNm) then
  305         frmP rocedures. InitTab(Co pyProcedur es, ListPr ocedureSec tions);
  306       if For mListConta ins(CT_Imm Nm) then
  307         frmI mmunizatio ns.InitTab (CopyImmun izations,L istImmuniz Sections);
  308       if For mListConta ins(CT_Ski nNm) then
  309         frmS kinTests.I nitTab(Cop ySkinTests , ListSkin Sections);
  310       if For mListConta ins(CT_Ped Nm) then
  311         frmP atientEd.I nitTab(Cop yPatientEd s, ListPat ientSectio ns);
  312       if For mListConta ins(CT_Hlt hNm) then
  313         frmH ealthFacto rs.InitTab (CopyHealt hFactors,  ListHealth Sections);
  314       if For mListConta ins(CT_Xam Nm) then
  315         frmE xams.InitT ab(CopyExa ms, ListEx amsSection s);
  316       uVisit Type.Assig n(VisitTyp e);
  317       if For mListConta ins(CT_Vis itNm) then
  318       with f rmVisitTyp e do
  319       begin
  320         Matc hVType;
  321       end;
  322     end;
  323   end;
  324  
  325  
  326   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  327   //Name: pr ocedure Tf rmEncounte rFrame.For mDestroy(S ender: TOb ject);
  328   //Created:  Jan 1999
  329   //By: Robe rt Bott
  330   //Location : ISL
  331   //Descript ion: Free  up objects  in memory  when dest roying for m.
  332   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  333   procedure  TfrmEncoun terFrame.F ormDestroy (Sender: T Object);
  334   var
  335     i: integ er;
  336  
  337   begin
  338     inherite d;
  339     for i :=  Component Count-1 do wnto 0 do
  340       if(Com ponents[i]  is TForm)  then
  341         TFor m(Componen ts[i]).Fre e;
  342  
  343     formlist .clear;
  344     KillObj( @uProvider s);
  345     uVisitTy pe.Free;
  346     Formlist .free;
  347   { $ IFDEF  DEBUG}
  348     fDebugPC E.Free;
  349   { $ ENDIF}
  350   end;
  351  
  352  
  353   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  354   //Name: pr ocedure Tf rmEncounte rFrame.For mCreate(Se nder: TObj ect);
  355   //Created:  Jan 1999
  356   //By: Robe rt Bott
  357   //Location : ISL
  358   //Descript ion: Creat e instance s of the o bjects nee ded.
  359   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  360   procedure  TfrmEncoun terFrame.F ormCreate( Sender: TO bject);
  361   begin
  362     uProvide rs := TPCE ProviderLi st.Create;
  363     uVisitTy pe := TPCE Proc.creat e;
  364     FormList  := TStrin gList.crea te;
  365     fCancel  := False;
  366     FAbort : = TRUE;
  367     SetFormF onts;
  368     FGiveMul tiTabMessa ge := Scre enReaderSy stemActive ;
  369   { $ IFDEF  DEBUG}
  370     fDebugPC E := TPCED ata.Create ;
  371   { $ ENDIF}
  372     ckbDebug Info.Visib le := HasS ecurityKey (GN_GUI_SE CURITY_KEY )
  373   {$IFDEF DE BUG} or TR UE {$ENDIF }
  374         ;
  375   end;
  376  
  377   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  378   //Name: pr ocedure Tf rmEncounte rFrame.Sen dData;
  379   //Created:  Jan 1999
  380   //By: Robe rt Bott
  381   //Location : ISL
  382   //Descript ion: Send  Data back  to the M s ide sor st oring.
  383   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  384   procedure  TfrmEncoun terFrame.S endData;
  385   //send PCE  data to t he RPC
  386   var
  387   { $ IFDEF  GROUPNOTES }
  388   { $ ELSE}
  389   //  StoreM essage: st ring;
  390   { $ ENDIF}
  391     ptDFN: S tring;
  392     i: Integ er;
  393     GAFScore : integer;
  394     GAFDate:  TFMDateTi me;
  395     GAFStaff : Int64;
  396     PatientD ata: TPati entData;
  397  
  398   begin
  399     inherite d;
  400     // do va lidation f or vitals  & anything  else here
  401   { $ IFDEF  GROUPNOTES }
  402   { $ ELSE}
  403   (*
  404     //proces s vitals
  405     if FormL istContain s(CT_VitNm ) then
  406     begin
  407       with f rmEncVital s do
  408       if Has Data then
  409       begin
  410         if A ssignVital s then
  411         begi n
  412           St oreMessage  := ValAnd StoreVital s(frmEncVi tals.Vital New);
  413           if  (Storemes sage <> 'T rue') then
  414           be gin
  415              ShowMsg(st oremessage );
  416   //         exit;
  417           en d;
  418         end;
  419       end;
  420     end;
  421   *)
  422   { $ ENDIF}
  423  
  424     if(FormL istContain s(CT_GAFNm )) then
  425     begin
  426       frmGAF .GetGAFSco re(GAFScor e, GAFDate , GAFStaff );
  427       if(GAF Score > 0)  then
  428         Save GAFScore(G AFScore, G AFDate, GA FStaff);
  429     end;
  430  
  431     //PCE
  432     UpdateEn counter(uE ncPCEData) ;
  433  
  434     if Group Edit then
  435       begin
  436         for  i := 0 to  GNPtList.C ount - 1 d o
  437         begi n
  438           Pa tientData  := TPatien tData(GNPt List[i]);
  439           uE ncPCEData. CopyPCEDat a(PatientD ata.PCEDat a);
  440           Pt DFN := Pat ientData.P atient.DFN ;
  441   {$IFDEF DE BUG}
  442           ad dLogLine(P CEDataToSt ring(Patie ntData.PCE Data),'Enc ounter dat a for '+pt DFN);
  443   {$ENDIF}
  444           Pa tientData. PCEData.Sa ve(ptDFN);
  445         end;
  446       end
  447       else
  448         uEnc PCEData.Sa ve;
  449     Close;
  450   end;
  451  
  452   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  453   //Name: pr ocedure Tf rmEncounte rFrame.For mCloseQuer y(Sender:  TObject;
  454   //Created:  Jan 1999
  455   //By: Robe rt Bott
  456   //Location : ISL
  457   //Descript ion: Check  to see if  the Cance l button w as pressed , if not,  call
  458   // procedu re to send  the data  to the ser ver.
  459   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  460   procedure  TfrmEncoun terFrame.F ormCloseQu ery(Sender : TObject;
  461     var CanC lose: Bool ean);
  462  
  463   const
  464     TXT_SAVE CHANGES =  'Save Chan ges?';
  465  
  466   var
  467     TmpPCEDa ta: TPCEDa ta;
  468     ask, Cha ngeOK: boo lean;
  469  
  470   begin
  471     CanClose  := True;
  472     if(FAbor t) then
  473       FCance l := (Info Box(TXT_SA VECHANGES,  TXT_SAVEC HANGES, MB _YESNO) =  ID_NO);
  474     if FCanc el then Ex it;  //*KC M*
  475  
  476     if(uProv iders.Prim aryIdx >=  0) then
  477       ask :=  TRUE
  478     else
  479     begin
  480       TmpPCE Data := TP CEData.Cre ate;
  481       try
  482         uEnc PCEData.Co pyPCEData( TmpPCEData );
  483         Upda teEncounte r(TmpPCEDa ta);
  484         ask  := TmpPCED ata.NeedPr oviderInfo ;
  485       finall y
  486         TmpP CEData.Fre e;
  487       end;
  488     end;
  489     if ask a nd (NoPrim aryPCEProv ider(uProv iders, uEn cPCEData))  then
  490     begin
  491       InfoBo x(TX_PROV_ REQ, TC_PR OV_REQ, MB _OK or MB_ ICONWARNIN G);
  492       CanClo se := Fals e;
  493       Exit;
  494     end;
  495  
  496     uVisitTy pe.Provide r := uProv iders.Prim aryIEN;  { RV - v20.1 }
  497  
  498   { $ IFDEF  GROUPNOTES }
  499   { $ ELSE}
  500   //  if For mListConta ins(CT_Vit Nm) then
  501   //    CanC lose := fr mEncVitals .OK2SaveVi tals;
  502   { $ ENDIF}
  503     if CanCl ose and Fo rmListCont ains(CT_Pr ocNm) then
  504       begin
  505         CanC lose := fr mProcedure s.OK2SaveP rocedures;
  506         if n ot CanClos e then
  507           be gin
  508              tabPageCha nge(Self,  FormList.I ndexOf(CT_ ProcNm), C hangeOK);
  509   { $ IFDEF  GROUPNOTES }
  510              SwitchToPa ge(pageByN ame(CT_Pro cNm));
  511   { $ ELSE}
  512   //           SwitchTo Page(PageI DToForm(CT _PROCEDURE S));
  513   { $ ENDIF}
  514              TabControl .TabIndex  := FormLis t.IndexOf( CT_ProcNm) ;
  515           en d;
  516       end;
  517  
  518     if CanCl ose then S endData;   //*KCM*
  519  
  520   end;
  521  
  522   procedure  TfrmEncoun terFrame.T abControlC hange(Send er: TObjec t);
  523   begin
  524   //must swi tch based  on caption , as all t abs may no t be prese nt.
  525     if (send er as tTab Control).t abindex =  -1 then ex it;
  526  
  527     if TabCo ntrol.CanF ocus and A ssigned(FL astPage) a nd not Tab Control.Fo cused then
  528       TabCon trol.SetFo cus;  //CQ : 14845
  529  
  530      SwitchT oPage(page ByName(Tab Control.Ta bs[TabCont rol.TabInd ex]));
  531   end;
  532  
  533   procedure  TfrmEncoun terFrame.T abControlC hanging(Se nder: TObj ect;
  534     var Allo wChange: B oolean);
  535   begin
  536     if(assig ned(FLastP age)) then
  537       FLastP age.AllowT abChange(A llowChange );
  538   end;
  539  
  540   procedure  TfrmEncoun terFrame.U pdateEncou nter(PCE:  TPCEData);
  541   begin
  542     with PCE  do
  543     begin
  544       if For mListConta ins(CT_Vis itNm) then
  545       begin
  546         Visi tType := u VisitType;
  547         frmV isitType.f raVisitRel ated.GetRe lated(uEnc PCEData);
  548         Prov iders.Merg e(uProvide rs);
  549       end;
  550         // DN S      BELLC
  551       if For mListConta ins(CT_Dia gNm) then
  552         SetD iagnoses(f rmDiagnose s.lstCapti onList.Ite msStrings) ;
  553       if For mListConta ins(CT_Pro cNm) then
  554        SetPr ocedures(f rmProcedur es.lstCapt ionList.It emsStrings );
  555       if For mListConta ins(CT_Imm Nm) then
  556          Set Immunizati ons(frmImm unizations .lstCaptio nList.Item sStrings);
  557       if For mListConta ins(CT_Ski nNm) then
  558          Set SkinTests( frmSkinTes ts.lstCapt ionList.It emsStrings );
  559       if For mListConta ins(CT_Ped Nm) then
  560         SetP atientEds( frmPatient Ed.lstCapt ionList.It emsStrings );
  561       if For mListConta ins(CT_Hlt hNm) then
  562         SetH ealthFacto rs(frmHeal thFactors. lstCaption List.Items Strings);
  563       if For mListConta ins(CT_Xam Nm) then
  564         SetE xams(frmEx ams.lstCap tionList.I temsString s);
  565  
  566       if Gro upEdit the n
  567         Copy PCEData(Ba sePCE);
  568     end;
  569   end;
  570  
  571   procedure  TfrmEncoun terFrame.S electTab(N ewTabName:  string);
  572   var
  573     AllowCha nge: boole an;
  574   begin
  575     AllowCha nge := Tru e;
  576     tabContr ol.TabInde x := FormL ist.IndexO f(NewTabNa me);
  577     tabPageC hange(Self , tabContr ol.TabInde x, AllowCh ange);
  578   end;
  579  
  580   procedure  TfrmEncoun terFrame.T abControlE nter(Sende r: TObject );
  581   begin
  582     if FGive MultiTabMe ssage then  // CQ#154 83
  583     begin
  584       FGiveM ultiTabMes sage := FA LSE;
  585       GetScr eenReader. Speak('Mul ti tab for m');
  586     end;
  587   end;
  588  
  589   procedure  TfrmEncoun terFrame.F ormKeyDown (Sender: T Object; va r Key: Wor d;
  590     Shift: T ShiftState );
  591   var
  592     CanChang e: boolean ;
  593   begin
  594     inherite d;
  595     if (Key  = VK_ESCAP E) then
  596     begin
  597       Key :=  0;
  598       FLastP age.btnCan cel.Click;
  599     end
  600     else if  Key = VK_T AB then
  601     begin
  602       if ssC trl in Shi ft then
  603       begin
  604         CanC hange := T rue;
  605         if A ssigned(Ta bControl.O nChanging)  then
  606           Ta bControl.O nChanging( TabControl , CanChang e);
  607         if C anChange t hen
  608         begi n
  609           if  ssShift i n Shift th en
  610           be gin
  611              if TabCont rol.TabInd ex < 1 the n
  612                TabContr ol.TabInde x := TabCo ntrol.Tabs .Count -1
  613              else
  614                TabContr ol.TabInde x := TabCo ntrol.TabI ndex - 1;
  615           en d
  616           el se
  617              TabControl .TabIndex  := (TabCon trol.TabIn dex + 1) m od TabCont rol.Tabs.C ount;
  618           if  Assigned( TabControl .OnChange)  then
  619              TabControl .OnChange( TabControl );
  620         end;
  621         Key  := 0;
  622       end;
  623     end;
  624   end;
  625  
  626   procedure  TfrmEncoun terFrame.S etFormFont s;
  627   var
  628     i: Integ er;
  629     NewFontS ize: integ er;
  630   begin
  631     NewFontS ize := Mai nFontsize;
  632     for i  : = 0 to For mList.Coun t - 1 do
  633       if ass igned(Form List.Objec ts[i]) and  (FormList .Objects[i ] is TfrmP CEBase) th en
  634         Tfrm PCEBase(Fo rmList.Obj ects[i]).F ont.Size : = NewFontS ize;
  635   end;
  636  
  637   procedure  TfrmEncoun terFrame.F ormClose(S ender: TOb ject;
  638     var Acti on: TClose Action);
  639   begin
  640     SaveUser Bounds(Sel f);
  641   end;
  642  
  643   procedure  TfrmEncoun terFrame.F ormCanResi ze(Sender:  TObject;
  644     var NewW idth, NewH eight: Int eger; var  Resize: Bo olean);
  645   begin
  646     // CQ474 0
  647     if NewWi dth < 200  then
  648     begin
  649       NewWid th := 200;
  650       Resize  := False;
  651     end;
  652   end;
  653  
  654   procedure  TfrmEncoun terFrame.F ormShow(Se nder: TObj ect);
  655   begin
  656     inherite d;
  657     if TabCo ntrol.CanF ocus and A ssigned(FL astPage) a nd not Tab Control.Fo cused then
  658       TabCon trol.SetFo cus;
  659   end;
  660  
  661   procedure  TfrmEncoun terFrame._ UM_GN_ENCU PDATE(var  Message: T Message);
  662   { $ IFDEF  DEBUG}
  663   var
  664     i: integ er;
  665     sl: TSTr ingList;
  666     s, ss: S tring;
  667   begin;
  668     UpdateEn counter(fD ebugPCE);
  669     mmLog.Cl ear;
  670     mmLog.Li nes.Add(Fo rmatDateTi me('-- mm/ dd/yyyy hh :nn:ss --' , Now));
  671     mmLog.Li nes.Add('- ---------- ---------- ----');
  672     mmLog.Li nes.Text : = mmLog.Li nes.Text +  CRLF +
  673       PCEDat aToString( fDebugPCE) ;
  674     i := 1;
  675     while i  <= mmLog.L ines.Count  - 1 do
  676       if Tri m(mmLog.Li nes[i]) =  '' then
  677         mmLo g.Lines.De lete(i)
  678       else
  679         inc( i);
  680     mmLog.Li nes.Add('- ---------- ---------- ----');
  681     sl := fD ebugPCE.ge tPCEDataLi st;
  682     for s in  sl do
  683       begin
  684         ss : = StringRe place(s,#0 ,'#0',[rfR eplaceAll] );
  685         mmLo g.Lines.Ad d(ss);
  686       end;
  687     sl.Free;
  688   { $ ELSE}
  689   //begin
  690   { $ ENDIF}
  691   end;
  692  
  693   procedure  TfrmEncoun terFrame.c kbDebugInf oClick(Sen der: TObje ct);
  694   begin
  695     inherite d;
  696   //  ckbDeb ugInfo.Che cked := no t ckbDebug Info.Check ed;
  697     mmLog.Vi sible := c kbDebugInf o.Checked;
  698     splDebug .Visible : = ckbDebug Info.Check ed;
  699     splDebug .Top := mm Log.Height ;
  700   end;
  701  
  702  
  703   procedure  TfrmEncoun terFrame.d oCreateFor ms(aLocati on: Intege r);
  704   var
  705     j: Integ er;
  706     s: strin g;
  707   begin
  708     FormList .Clear;
  709  
  710     frmVisit Type  := T frmVisitTy pe.CreateL inked(pnlP age);
  711     frmDiagn oses  := T frmDiagnos es.CreateL inked(pnlP age);
  712     frmProce dures := T frmProcedu res.Create Linked(pnl Page);
  713     if not G roupEdit t hen
  714       frmEnc Vitals :=  TfrmEncVit als.Create Linked(pnl Page);
  715     frmImmun izations : = TfrmImmu nizations. CreateLink ed(pnlPage );
  716     if not G roupEdit t hen
  717       frmSki nTests :=  TfrmSkinTe sts.Create Linked(pnl Page);
  718     frmPatie ntEd := Tf rmPatientE d.CreateLi nked(pnlPa ge);
  719     frmHealt hFactors : = TfrmHEal thFactors. CreateLink ed(pnlPage );
  720     if not G roupEdit t hen
  721       frmExa ms := Tfrm Exams.Crea teLinked(p nlPage);
  722     if not G roupEdit t hen
  723  
  724   {$IFDEF DE BUG} // te sting appe arance of  the GAF fo rm regardl ess of Loc ation
  725   {$ELSE}
  726       if MHC linic(aLoc ation) the n
  727   {$ENDIF}
  728         frmG AF := Tfrm GAF.Create Linked(pnl Page);
  729  
  730     FormList .AddObject (CT_VisitN m,frmVisit Type);
  731     FormList .AddObject (CT_DiagNm ,frmDiagno ses);
  732     FormList .AddObject (CT_ProcNm ,frmProced ures);
  733     if not G roupEdit t hen
  734       FormLi st.AddObje ct(CT_VitN m,frmEncVi tals);
  735  
  736     FormList .AddObject (CT_ImmNm, frmImmuniz ations);
  737     if not G roupEdit t hen
  738       FormLi st.AddObje ct(CT_Skin Nm,frmSkin Tests);
  739     FormList .AddObject (CT_PedNm, frmPatient Ed);
  740     FormList .AddObject (CT_HlthNm ,frmHealth Factors);
  741     if not G roupEdit t hen
  742       FormLi st.AddObje ct(CT_XamN m,frmExams );
  743     if not G roupEdit t hen
  744   {$IFDEF DE BUG} // te sting appe arance of  the GAF fo rm regardl ess of Loc ation
  745   {$ELSE}
  746       if MHC linic(aLoc ation) the n
  747   {$ENDIF}
  748         Form List.AddOb ject(CT_GA FNm,frmGAF );
  749  
  750     frmVisit Type.Visib le := True ;
  751     for j  : = 1 to For mList.Coun t - 1 do
  752       TForm( FormList.O bjects[j]) .Visible : = False;
  753  
  754     for s in  FormList  do
  755       tabCon trol.Tabs. Add(s);
  756   end;
  757  
  758   function T frmEncount erFrame.pa geByName(a Name:Strin g): TfrmPC EBase;
  759   var
  760     i: integ er;
  761   begin
  762     Result : = nil;
  763     i := For mList.Inde xOf(aName) ;
  764     if i >=0  then
  765       Result  := TfrmPC EBase(Form List.Objec ts[i]);
  766   end;
  767  
  768   end.