1. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 8/3/2017 10:10:40 AM Central Daylight 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.

1.1 Files compared

# Location File Last Modified
1 V31A.zip\V31A\434\OR_30_434V114_SRC\Encounter fEncounterFrame.pas Tue Jun 13 18:16:54 2017 UTC
2 V31A.zip\V31A\434\OR_30_434V114_SRC\Encounter fEncounterFrame.pas Thu Aug 3 13:23:40 2017 UTC

1.2 Comparison summary

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

1.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

1.4 Active regular expressions

No regular expressions were active.

1.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, fEn cVitals, r vitals, fB ase508Form ,
  10     VA508Acc essibility Manager;
  11  
  12   const
  13     //tab na mes
  14     CT_Visit Nm = 'Visi t Type';
  15     CT_DiagN m  = 'Diag noses';
  16     CT_ProcN m  = 'Proc edures';
  17     CT_ImmNm    = 'Immu nizations' ;
  18     CT_SkinN m  = 'Skin  Tests';
  19     CT_PedNm    = 'Pati ent Ed';
  20     CT_HlthN m  = 'Heal th Factors ';
  21     CT_XamNm    = 'Exam s';
  22     CT_VitNm    = 'Vita ls';
  23     CT_GAFNm    = 'GAF' ;
  24  
  25     //number s assigned  to tabs t o make cha nges easie r
  26     //they m ust be seq uential
  27     CT_NOPAG E        =  -1;
  28     CT_UNKNO WN       =  0;
  29     CT_VISIT TYPE     =  1; CT_FIR ST = 1;
  30     CT_DIAGN OSES     =  2;
  31     CT_PROCE DURES    =  3;
  32     CT_IMMUN IZATIONS =  4;
  33     CT_SKINT ESTS     =  5;
  34     CT_PATIE NTED     =  6;
  35     CT_HEALT HFACTORS =  7;
  36     CT_EXAMS          =  8;
  37     CT_VITAL S        =  9;
  38     CT_GAF            =  10; CT_LA ST = 10;
  39  
  40     NUM_TABS        = 3 ;
  41     TAG_VTYP E      = 1 0;
  42     TAG_DIAG        = 2 0;
  43     TAG_PROC        = 3 0;
  44     TAG_IMMU NIZ    = 4 0;
  45     TAG_SKIN        = 5 0;
  46     TAG_PED         = 6 0;
  47     TAG_HF          = 7 0;
  48     TAG_XAM         = 8 0;
  49     TAG_TRT         = 9 0;
  50  
  51     TX_NOSEC TION = '-1 ^No sectio ns found';
  52     TX_PROV_ REQ = 'A p rimary enc ounter pro vider must  be select ed before  encounter  data can'  + CRLF +
  53                    'be  saved.  Se lect the P rimary Enc ounter Pro vider on t he VISIT T YPE tab.'  + CRLF +
  54                    'Oth erwise, pr ess <Cance l> to quit  without s aving data .';
  55  
  56     TC_PROV_ REQ = 'Mis sing Prima ry Provide r for Enco unter';
  57  
  58   type
  59     TfrmEnco unterFrame  = class(T frmBase508 Form)
  60       Status Bar1: TSta tusBar;
  61       pnlPag e: TPanel;
  62       Bevel1 : TBevel;
  63       TabCon trol: TTab Control;
  64  
  65       proced ure tabPag eChange(Se nder: TObj ect; NewTa b: Integer ;
  66         var  AllowChang e: Boolean );
  67       proced ure FormRe size(Sende r: TObject );
  68       proced ure Sectio nClick(Sen der: TObje ct);
  69       proced ure FormDe stroy(Send er: TObjec t);
  70       proced ure FormCr eate(Sende r: TObject );
  71       proced ure FormCl oseQuery(S ender: TOb ject; var  CanClose:  Boolean);
  72       proced ure TabCon trolChange (Sender: T Object);
  73       proced ure TabCon trolChangi ng(Sender:  TObject;
  74         var  AllowChang e: Boolean );
  75       proced ure FormKe yDown(Send er: TObjec t; var Key : Word;
  76         Shif t: TShiftS tate);
  77       proced ure FormCl ose(Sender : TObject;  var Actio n: TCloseA ction);
  78       proced ure FormCa nResize(Se nder: TObj ect; var N ewWidth,
  79         NewH eight: Int eger; var  Resize: Bo olean);
  80       proced ure FormSh ow(Sender:  TObject);
  81       proced ure TabCon trolEnter( Sender: TO bject);
  82  
  83     private
  84       FAutoS ave: boole an;
  85       FSaveN eeded: boo lean;
  86       FChang eSource: I nteger;
  87       FCance l:  Boolea n; //Indic ates the c ancel butt on has bee n pressed;
  88       FAbort : boolean;  // indica tes that n either OK  or Cancel  has been p ressed
  89       FormLi st: TStrin gList;  // Holds the  types of a ny forms t hat will b e used
  90                                 // in the fra me.  They  must be av ailable at  compile t ime
  91       FLastP age: TfrmP CEBase;
  92       FGiveM ultiTabMes sage: bool ean;
  93       proced ure Create ChildForms (Sender: T Object; Lo cation: in teger);
  94       proced ure SynchP CEData;
  95       proced ure Switch ToPage(New Form: Tfrm PCEBase);    //was tf rmPage
  96       functi on PageIDT oForm(Page ID: Intege r): TfrmPC EBase;
  97       functi on PageIDT oTab(PageI D: Integer ): string;
  98       proced ure LoadFo rmList(Loc ation: int eger);
  99       proced ure Create Forms;
  100       proced ure AddTab s;
  101       functi on FormLis tContains( item: stri ng): Boole an;
  102       proced ure SendDa ta;
  103       proced ure Update Encounter( PCE: TPCED ata);
  104       proced ure SetFor mFonts;
  105  
  106     public
  107       proced ure Select Tab(NewTab Name: stri ng);
  108       proper ty ChangeS ource:     Integer re ad FChange Source;
  109       proper ty Forms:             tstringlis t read For mList;
  110       proper ty Cancel:            Boolean re ad FCancel  write FCa ncel;
  111       proper ty Abort:           B oolean rea d FAbort w rite FAbor t;
  112     end;
  113  
  114   var
  115     frmEncou nterFrame:  TfrmEncou nterFrame;
  116     uSCCond:                TSCCon ditions;
  117     uVisitTy pe:            TPCEPr oc;        // contain s info for  visit typ e page
  118     uEncPCED ata: TPCED ata;
  119     uProvide rs: TPCEPr oviderList ;
  120  
  121   // Returns  true if P CE data st ill needs  to be save d - vitals /gaf are a lways save d
  122   function U pdatePCE(P CEData: TP CEData; Sa veOnExit:  boolean =  TRUE): boo lean;
  123  
  124   implementa tion
  125  
  126   uses
  127     uCore,
  128     fGAF, uC onst,
  129     rCore, f PCEProvide r, rMisc,  VA508Acces sibilityRo uter, VAUt ils;
  130  
  131   {$R *.DFM}
  132  
  133   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  134   //Name: fu nction Tfr mEncounter Frame.Page IDToTab(Pa geID: Inte ger): Stri ng;
  135   //Created:  Jan 1999
  136   //By: Robe rt Bott
  137   //Location : ISL
  138   //Descript ion: retur ns the tab  index tha t correspo nds to a g iven PageI D .
  139   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  140   function T frmEncount erFrame.Pa geIDToTab( PageID: In teger): St ring;
  141   begin
  142     result : = '';
  143     case Pag eID of
  144       CT_NOP AGE:         Result : = '';
  145       CT_UNK NOWN:        Result : = '';
  146       CT_VIS ITTYPE:      Result : = CT_Visit Nm;
  147       CT_DIA GNOSES:      Result : = CT_DiagN m;
  148       CT_PRO CEDURES:     Result : = CT_ProcN m;
  149       CT_IMM UNIZATIONS : Result : = CT_ImmNm ;
  150       CT_SKI NTESTS:      Result : = CT_SkinN m;
  151       CT_PAT IENTED:      Result : = CT_PedNm ;
  152       CT_HEA LTHFACTORS : Result : = CT_HlthN m;
  153       CT_EXA MS:          Result : = CT_XamNm ;
  154       CT_VIT ALS:         Result : = CT_VitNm ;
  155       CT_GAF :            Result : = CT_GAFNm ;
  156  
  157     end;
  158   end;
  159  
  160  
  161   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  162   //Name: fu nction Tfr mEncounter Frame.Page IDToForm(P ageID: Int eger): Tfr mPCEBase;
  163   //Created:  Jan 1999
  164   //By: Robe rt Bott
  165   //Location : ISL
  166   //Descript ion: retur n the form  name base d on the P ageID}
  167   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  168   function T frmEncount erFrame.Pa geIDToForm (PageID: I nteger): T frmPCEBase ;
  169   begin
  170     case Pag eID of
  171       CT_VIS ITTYPE:      Result : = frmVisit Type;
  172       CT_DIA GNOSES:      Result : = frmDiagn oses;
  173       CT_PRO CEDURES:     Result : = frmProce dures;
  174       CT_IMM UNIZATIONS : Result : = frmImmun izations;
  175       CT_SKI NTESTS:      Result : = frmSkinT ests;
  176       CT_PAT IENTED:      Result : = frmPatie ntEd;
  177       CT_HEA LTHFACTORS : Result : = frmHealt hFactors;
  178       CT_EXA MS:          Result : = frmExams ;
  179       CT_VIT ALS:         Result : = frmEncVi tals;
  180       CT_GAF :            Result : = frmGAF;
  181     else  // not a vali d form
  182       result  := frmPCE Base;
  183     end;
  184   end;
  185  
  186  
  187   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  188   //Name: pr ocedure Tf rmEncounte rFrame.Cre atChildFor ms(Sender:  TObject);
  189   //Created:  Jan 1999
  190   //By: Robe rt Bott
  191   //Location : ISL
  192   //Descript ion: Finds  out what  pages to d isplay, ha s the page s and tabs  created.
  193   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  194   procedure  TfrmEncoun terFrame.C reateChild Forms(Send er: TObjec t; Locatio n: integer );
  195   begin
  196     //load F ormList wi th a list  of all for ms to disp lay.
  197     inherite d;
  198     LoadForm List(Locat ion);
  199     AddTabs;
  200     CreateFo rms;
  201   end;
  202  
  203  
  204  
  205   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  206   //Name: Tf rmEncounte rFrame.Loa dFormList;
  207   //Created:  Jan 1999
  208   //By: Robe rt Bott
  209   //Location : ISL
  210   //Descript ion: Loads  Formlist  with the f orms to cr eate, will  be replac ed by RPC  call.
  211   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  212   procedure  TfrmEncoun terFrame.L oadFormLis t(Location : integer) ;
  213   begin
  214     //change  this to a n RPC in R PCE.pas
  215     FormList .clear;
  216     FormList .add(CT_Vi sitNm);
  217     FormList .add(CT_Di agNm);
  218     FormList .add(CT_Pr ocNm);
  219     formList .add(CT_Vi tNm);
  220     formList .add(CT_Im mNm);
  221     formList .add(CT_Sk inNm);
  222     formList .add(CT_Pe dNm);
  223     formList .add(CT_Hl thNm);
  224     formList .add(CT_Xa mNm);
  225     if MHCli nic(Locati on) then
  226       formLi st.add(CT_ GAFNm);
  227     end;
  228  
  229  
  230   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  231   //Name: fu nction Tfr mEncounter Frame.Form ListContai ns(item: s tring): Bo olean;
  232   //Created:  12/06/98
  233   //By: Robe rt Bott
  234   //Location : ISL
  235   //Descript ion: Retur ns a boole an value i ndicating  if a given  string ex ists in
  236   // the for mlist.
  237   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  238   function T frmEncount erFrame.Fo rmListCont ains(item:  string):  Boolean;
  239   begin
  240     result : = false;
  241     if (Form List.Index Of(item) < > -1 ) the n
  242       result  := true;
  243   end;
  244  
  245   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  246   //Name: pr ocedure Tf rmEncounte rFrame.Cre ateForms;
  247   //Created:  Jan 1999
  248   //By: Robe rt Bott
  249   //Location : ISL
  250   //Descript ion:  Crea tes all of  the forms  in the li st.
  251   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  252   procedure  TfrmEncoun terFrame.C reateForms ;
  253   var
  254     i: integ er;
  255   begin
  256     //could  this be pl aced in a  loop using  PagedIdTo Tab & Page IDToFOrm &  ?
  257  
  258     if FormL istContain s(CT_Visit Nm) then
  259       frmVis itType  :=  TfrmVisit Type.Creat eLinked(pn lPage);
  260     if FormL istContain s(CT_DiagN m) then
  261       frmDia gnoses  :=  TfrmDiagn oses.Creat eLinked(pn lPage);
  262     if FormL istContain s(CT_ProcN m) then
  263       frmPro cedures :=  TfrmProce dures.Crea teLinked(p nlPage);
  264     if FormL istContain s(CT_VitNm ) then
  265       frmEnc Vitals :=  TfrmEncVit als.Create Linked(pnl Page);
  266     if FormL istContain s(CT_ImmNm ) then
  267       frmImm unizations  := TfrmIm munization s.CreateLi nked(pnlPa ge);
  268     if FormL istContain s(CT_SkinN m) then
  269       frmSki nTests :=  TfrmSkinTe sts.Create Linked(pnl Page);
  270     if FormL istContain s(CT_PedNm ) then
  271       frmPat ientEd :=  TfrmPatien tEd.Create Linked(pnl Page);
  272     if FormL istContain s(CT_HlthN m) then
  273       frmHea lthFactors  := TfrmHE althFactor s.CreateLi nked(pnlPa ge);
  274     if FormL istContain s(CT_XamNm ) then
  275       frmExa ms := Tfrm Exams.Crea teLinked(p nlPage);
  276     if FormL istContain s(CT_GAFNm ) then
  277       frmGAF  := TfrmGA F.CreateLi nked(pnlPa ge);
  278     //must s witch base d on capti on, as all  tabs may  not be pre sent.
  279     for i :=  CT_FIRST  to CT_LAST  do
  280     begin
  281       if For mlist.Inde xOf(PageId ToTab(i))  <> -1 then
  282         Page IDToForm(i ).Visible  := (Formli st.IndexOf (PageIdToT ab(i)) = 0 );
  283     end;
  284   end;
  285  
  286  
  287   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  288   //Name: Tf rmEncounte rFrame.Swi tchToPage( NewForm: t frmPCEBase );
  289   //Created:  Jan 1999
  290   //By: Robe rt Bott
  291   //Location : ISL
  292   //Descript ion: Bring s the sele cted page  to the fro nt for dis play.
  293   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  294   procedure  TfrmEncoun terFrame.S witchToPag e(NewForm:  tfrmPCEBa se);// was  TfrmPage) ;
  295   { unmerge/ merge menu s, bring p age to top  of z-orde r, call fo rm-specifi c OnDispla y code }
  296   begin
  297     if (NewF orm = nil)  or (FLast Page = New Form) then  Exit;
  298     if Assig ned(FLastP age) then
  299       FLastP age.Hide;
  300     FLastPag e := NewFo rm;
  301   //  KeyPre view := (N ewForm = f rmEncVital s);
  302     NewForm. DisplayPag e;  // thi s calls Br ingToFront  for the f orm
  303   end;
  304  
  305  
  306  
  307   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  308   //Name: pr ocedure Tf rmEncounte rFrame.tab PageChange (Sender: T Object; Ne wTab: Inte ger; var A llowChange : Boolean) ;
  309   //Created:  Jan 1999
  310   //By: Robe rt Bott
  311   //Location : ISL
  312   //Descript ion: Finds  the page,  and calls  SwithToPa ge to disp lay it.
  313   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  314   procedure  TfrmEncoun terFrame.t abPageChan ge(Sender:  TObject;  NewTab: In teger; var  AllowChan ge: Boolea n);
  315   { switches  to form l inked to N ewTab }
  316   var
  317     i: integ er;
  318   begin
  319   //must swi tch based  on caption , as all t abs may no t be prese nt.
  320   for i := C T_FIRST to  CT_LAST d o
  321     begin
  322     With For mlist do
  323       if New Tab = Inde xOf(PageId ToTab(i))  then
  324       begin
  325         Page IDToForm(i ).show;
  326         Swit chToPage(P ageIDToFor m(i));
  327       end;
  328     end;
  329   end;
  330  
  331   { Resize a nd Font-Ch ange proce dures ---- ---------- ---------- ---------- ---------- ---------- --- }
  332  
  333   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  334   //Name: pr ocedure Tf rmEncounte rFrame.For mResize(Se nder: TObj ect);
  335   //Created:  Jan 1999
  336   //By: Robe rt Bott
  337   //Location : ISL
  338   //Descript ion: Resiz es all win dows when  parent cha nges.
  339   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  340   procedure  TfrmEncoun terFrame.F ormResize( Sender: TO bject);
  341   var
  342     i: integ er;
  343   begin
  344    for i :=  CT_FIRST t o CT_LAST  do
  345      if (For mList.Inde xOf(PageId ToTab(i))  <> -1) the n
  346        MoveW indow(Page IdToForm(i ).Handle,  0, 0, pnlP age.Client Width, pnl page.Clien tHeight, t rue);
  347     self.rep aint;
  348   end;
  349  
  350   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  351   //Name: pr ocedure Tf rmEncounte rFrame.Add Tabs;
  352   //Created:  Jan 1999
  353   //By: Robe rt Bott
  354   //Location : ISL
  355   //Descript ion: adds  a tab for  each page  that will  be display ed
  356   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  357   procedure  TfrmEncoun terFrame.A ddTabs;
  358  
  359   var
  360     i: integ er;
  361   begin
  362     TabContr ol.Tabs.Cl ear;
  363     for I :=  0 to (For mlist.coun t - 1) do
  364       TabCon trol.Tabs. Add(Formli st.Strings [i]);
  365   end;
  366  
  367  
  368   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  369   //Name: pr ocedure Up datePCE(PC EData: TPC EData);
  370   //Created:  Jan 1999
  371   //By: Robe rt Bott
  372   //Location : ISL
  373   //Descript ion: The m ain call t o open the  encounter  frame and  capture e ncounter
  374   // informa tion.
  375   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  376   function U pdatePCE(P CEData: TP CEData; Sa veOnExit:  boolean =  TRUE): boo lean;
  377   var
  378   //  FontHe ight,
  379   //  FontWi dth: Integ er;
  380     AUser: s tring;
  381  
  382   begin
  383     frmEncou nterFrame  := TfrmEnc ounterFram e.Create(A pplication );
  384     try
  385       frmEnc ounterFram e.FAutoSav e := SaveO nExit;
  386  
  387       uEncPC EData := P CEData;
  388       if(uEn cPCEData.E mpty and ( (uEncPCEDa ta.Locatio n = 0) or  (uEncPCEDa ta.VisitDa teTime = 0 )) and
  389         (not  Encounter .NeedVisit )) then
  390         uEnc PCEData.Us eEncounter  := TRUE;
  391       frmEnc ounterFram e.Caption  := 'Encoun ter Form f or ' + Ext ernalName( uEncPCEDat a.Location , 44) +
  392                                        '  ('  + FormatFM DateTime(' mmm dd,yyy y@hh:nn',  uEncPCEDat a.VisitDat eTime) + ' )';
  393  
  394       uProvi ders.Assig n(uEncPCED ata.Provid ers);
  395       SetDef aultProvid er(uProvid ers, uEncP CEData);
  396       AUser  := IntToSt r(uProvide rs.Pending IEN(FALSE) );
  397       if(AUs er <> '0')  and (uPro viders.Ind exOfProvid er(AUser)  < 0) and
  398          Aut oCheckout( uEncPCEDat a.Location ) then
  399         uPro viders.Add Provider(A User, uPro viders.Pen dingName(F ALSE), FAL SE);
  400  
  401       frmEnc ounterFram e.CreateCh ildForms(f rmEncounte rFrame, PC EData.Loca tion);
  402       SetFor mPosition( frmEncount erFrame);
  403       Resize AnchoredFo rmToFont(f rmEncounte rFrame);
  404       //SetF ormPositio n(frmEncou nterFrame) ;
  405  
  406       with f rmEncounte rFrame do
  407       begin
  408         SetR PCEncLocat ion(PCEDat a.Location );
  409         Sync hPCEData;
  410         TabC ontrol.Tab index := 0 ;
  411         TabC ontrolChan ge(TabCont rol);
  412  
  413         Show Modal;
  414         Resu lt := FSav eNeeded;
  415       end;
  416     finally
  417       // frm EncounterF rame.Free;    v22.11  (JD and SM )
  418       frmEnc ounterFram e.Release;
  419       //frmE ncounterFr ame := nil ;  access  violation  source?  r emoved 7/2 8/03 RV
  420     end;
  421   end;
  422  
  423   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  424   //Name: Tf rmEncounte rFrame.Sec tionClick( Sender: TO bject);
  425   //Created:  Jan 1999
  426   //By: Robe rt Bott
  427   //Location : ISL
  428   //Descript ion: Call  the proced ure apropr iate for t he selecte d tab
  429   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  430   procedure  TfrmEncoun terFrame.S ectionClic k(Sender:  TObject);
  431   begin
  432     with Sen der as TLi stBox do c ase Tag of
  433     TAG_VTYP E:   if Fo rmListCont ains(CT_Vi sitNm) the n
  434                   begin
  435                     wit h frmVisit Type do
  436                       l stVTypeSec tionClick( Sender);
  437                   end;
  438     end;
  439   end;
  440  
  441   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  442   //Name: pr ocedure Tf rmEncounte rFrame.Syn chPCEData;
  443   //Created:  Jan 1999
  444   //By: Robe rt Bott
  445   //Location : ISL
  446   //Descript ion: Synch ronize any  existing  PCE data w ith what i s displaye d in the f orm.
  447   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  448   procedure  TfrmEncoun terFrame.S ynchPCEDat a;
  449  
  450     procedur e InitList (AListBox:  TORListBo x);
  451     var
  452       DoClic k: boolean ;
  453  
  454     begin
  455       with A ListBox do
  456       begin
  457         DoCl ick := TRU E;
  458         case  Tag of
  459           TA G_VTYPE:    begin
  460                            if Form ListContai ns(CT_Visi tNm) then
  461                               List VisitTypeS ections(It ems);
  462                            DoClick  := AutoSe lectVisit( PCERPCEncL ocation);
  463                          end;
  464         end;
  465         if I tems.Count  > 0 then
  466         begi n
  467           if  DoClick t hen
  468           be gin
  469              ItemIndex  := 0;
  470              SectionCli ck(AListBo x);
  471           en d;
  472         end
  473         else  Items.Add (TX_NOSECT ION);
  474       end;
  475     end;
  476  
  477   begin
  478     if FormL istContain s(CT_Visit Nm) then
  479     with frm VisitType  do
  480       begin
  481         Init List(frmVi sitType.ls tVTypeSect ion);                       // s et up Visi t Type pag e
  482         List SCDisabili ties(memSC Display.Li nes);
  483         uSCC ond := Eli gbleCondit ions;
  484         frmV isitType.f raVisitRel ated.InitA llow(uSCCo nd);
  485       end;
  486     with uEn cPCEData d o                                  // load  any existi ng data fr om PCEData
  487     begin
  488       if For mListConta ins(CT_Vis itNm) then
  489         frmV isitType.f raVisitRel ated.InitR elated(uEn cPCEData);
  490       if For mListConta ins(CT_Dia gNm) then
  491         frmD iagnoses.I nitTab(Cop yDiagnoses , ListDiag nosisSecti ons);
  492       if For mListConta ins(CT_Pro cNm) then
  493         frmP rocedures. InitTab(Co pyProcedur es, ListPr ocedureSec tions);
  494       if For mListConta ins(CT_Imm Nm) then
  495         frmI mmunizatio ns.InitTab (CopyImmun izations,L istImmuniz Sections);
  496       if For mListConta ins(CT_Ski nNm) then
  497         frmS kinTests.I nitTab(Cop ySkinTests , ListSkin Sections);
  498       if For mListConta ins(CT_Ped Nm) then
  499         frmP atientEd.I nitTab(Cop yPatientEd s, ListPat ientSectio ns);
  500       if For mListConta ins(CT_Hlt hNm) then
  501         frmH ealthFacto rs.InitTab (CopyHealt hFactors,  ListHealth Sections);
  502       if For mListConta ins(CT_Xam Nm) then
  503         frmE xams.InitT ab(CopyExa ms, ListEx amsSection s);
  504       uVisit Type.Assig n(VisitTyp e);
  505       if For mListConta ins(CT_Vis itNm) then
  506       with f rmVisitTyp e do
  507       begin
  508         Matc hVType;
  509       end;
  510     end;
  511   end;
  512  
  513  
  514   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  515   //Name: pr ocedure Tf rmEncounte rFrame.For mDestroy(S ender: TOb ject);
  516   //Created:  Jan 1999
  517   //By: Robe rt Bott
  518   //Location : ISL
  519   //Descript ion: Free  up objects  in memory  when dest roying for m.
  520   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  521   procedure  TfrmEncoun terFrame.F ormDestroy (Sender: T Object);
  522   var
  523     i: integ er;
  524  
  525   begin
  526     inherite d;
  527     for i :=  Component Count-1 do wnto 0 do
  528       if(Com ponents[i]  is TForm)  then
  529         TFor m(Componen ts[i]).Fre e;
  530  
  531     formlist .clear;
  532     KillObj( @uProvider s);
  533     uVisitTy pe.Free;
  534     Formlist .free;
  535   end;
  536  
  537  
  538   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  539   //Name: pr ocedure Tf rmEncounte rFrame.For mCreate(Se nder: TObj ect);
  540   //Created:  Jan 1999
  541   //By: Robe rt Bott
  542   //Location : ISL
  543   //Descript ion: Creat e instance s of the o bjects nee ded.
  544   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  545   procedure  TfrmEncoun terFrame.F ormCreate( Sender: TO bject);
  546   begin
  547     uProvide rs := TPCE ProviderLi st.Create;
  548     uVisitTy pe := TPCE Proc.creat e;
  549     //uVital Old  := TS tringList. create;
  550     //uVital New  := TS tringList. create;
  551     FormList  := TStrin gList.crea te;
  552     fCancel  := False;
  553     FAbort : = TRUE;
  554     SetFormF onts;
  555     FGiveMul tiTabMessa ge := Scre enReaderSy stemActive ;
  556   end;
  557  
  558  
  559   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  560   //Name: pr ocedure Tf rmEncounte rFrame.Sen dData;
  561   //Created:  Jan 1999
  562   //By: Robe rt Bott
  563   //Location : ISL
  564   //Descript ion: Send  Data back  to the M s ide sor st oring.
  565   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  566   procedure  TfrmEncoun terFrame.S endData;
  567   //send PCE  data to t he RPC
  568   var
  569     StoreMes sage: stri ng;
  570     GAFScore : integer;
  571     GAFDate:  TFMDateTi me;
  572     GAFStaff : Int64;
  573  
  574   begin
  575     inherite d;
  576     // do va lidation f or vitals  & anything  else here
  577  
  578     //proces s vitals
  579     if FormL istContain s(CT_VitNm ) then
  580     begin
  581       with f rmEncVital s do
  582       if Has Data then
  583       begin
  584         if A ssignVital s then
  585         begi n
  586           St oreMessage  := ValAnd StoreVital s(frmEncVi tals.Vital New);
  587           if  (Storemes sage <> 'T rue') then
  588           be gin
  589              ShowMsg(st oremessage );
  590   //         exit;
  591           en d;
  592         end;
  593       end;
  594     end;
  595  
  596     if(FormL istContain s(CT_GAFNm )) then
  597     begin
  598       frmGAF .GetGAFSco re(GAFScor e, GAFDate , GAFStaff );
  599       if(GAF Score > 0)  then
  600         Save GAFScore(G AFScore, G AFDate, GA FStaff);
  601     end;
  602  
  603     //PCE
  604  
  605     UpdateEn counter(uE ncPCEData) ;
  606     with uEn cPCEData d o
  607     begin
  608       if FAu toSave the n
  609         Save
  610       else
  611         FSav eNeeded :=  TRUE;
  612     end;
  613     Close;
  614   end;
  615  
  616   {///////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  617   //Name: pr ocedure Tf rmEncounte rFrame.For mCloseQuer y(Sender:  TObject;
  618   //Created:  Jan 1999
  619   //By: Robe rt Bott
  620   //Location : ISL
  621   //Descript ion: Check  to see if  the Cance l button w as pressed , if not,  call
  622   // procedu re to send  the data  to the ser ver.
  623   ////////// ////////// ////////// ////////// ////////// ////////// ////////// /////////}
  624   procedure  TfrmEncoun terFrame.F ormCloseQu ery(Sender : TObject;
  625     var CanC lose: Bool ean);
  626  
  627   const
  628     TXT_SAVE CHANGES =  'Save Chan ges?';
  629  
  630   var
  631     TmpPCEDa ta: TPCEDa ta;
  632     ask, Cha ngeOK: boo lean;
  633  
  634   begin
  635     CanClose  := True;
  636     if(FAbor t) then
  637       FCance l := (Info Box(TXT_SA VECHANGES,  TXT_SAVEC HANGES, MB _YESNO) =  ID_NO);
  638     if FCanc el then Ex it;  //*KC M*
  639  
  640     if(uProv iders.Prim aryIdx >=  0) then
  641       ask :=  TRUE
  642     else
  643     begin
  644       TmpPCE Data := TP CEData.Cre ate;
  645       try
  646         uEnc PCEData.Co pyPCEData( TmpPCEData );
  647         Upda teEncounte r(TmpPCEDa ta);
  648         ask  := TmpPCED ata.NeedPr oviderInfo ;
  649       finall y
  650         TmpP CEData.Fre e;
  651       end;
  652     end;
  653     if ask a nd (NoPrim aryPCEProv ider(uProv iders, uEn cPCEData))  then
  654     begin
  655       InfoBo x(TX_PROV_ REQ, TC_PR OV_REQ, MB _OK or MB_ ICONWARNIN G);
  656       CanClo se := Fals e;
  657       Exit;
  658     end;
  659  
  660     uVisitTy pe.Provide r := uProv iders.Prim aryIEN;  { RV - v20.1 }
  661  
  662     if FormL istContain s(CT_VitNm ) then
  663       CanClo se := frmE ncVitals.O K2SaveVita ls;
  664  
  665     if CanCl ose and Fo rmListCont ains(CT_Pr ocNm) then   
  666       begin
  667         CanC lose := fr mProcedure s.OK2SaveP rocedures;
  668         if n ot CanClos e then
  669           be gin
  670              tabPageCha nge(Self,  FormList.I ndexOf(CT_ ProcNm), C hangeOK);
  671              SwitchToPa ge(PageIDT oForm(CT_P ROCEDURES) );
  672              TabControl .TabIndex  := FormLis t.IndexOf( CT_ProcNm) ;
  673           en d;
  674       end;
  675  
  676     if CanCl ose then S endData;   //*KCM*
  677  
  678   end;
  679  
  680   procedure  TfrmEncoun terFrame.T abControlC hange(Send er: TObjec t);
  681   var
  682     i: integ er;
  683   begin
  684   //must swi tch based  on caption , as all t abs may no t be prese nt.
  685     if (send er as tTab Control).t abindex =  -1 then ex it;
  686  
  687     if TabCo ntrol.CanF ocus and A ssigned(FL astPage) a nd not Tab Control.Fo cused then
  688       TabCon trol.SetFo cus;  //CQ : 14845
  689  
  690     for i :=  CT_FIRST  to CT_LAST  do
  691     begin
  692       with F ormlist do
  693         with  sender as  tTabContr ol do
  694           if  Tabindex  = IndexOf( PageIdToTa b(i)) then
  695         begi n
  696           Pa geIDToForm (i).show;
  697           Sw itchToPage (PageIDToF orm(i));
  698           Ex it;
  699         end;
  700     end;
  701   end;
  702  
  703   procedure  TfrmEncoun terFrame.T abControlC hanging(Se nder: TObj ect;
  704     var Allo wChange: B oolean);
  705   begin
  706     if(assig ned(FLastP age)) then
  707       FLastP age.AllowT abChange(A llowChange );
  708   end;
  709  
  710   procedure  TfrmEncoun terFrame.U pdateEncou nter(PCE:  TPCEData);
  711   begin
  712     with PCE  do
  713     begin
  714       if For mListConta ins(CT_Vis itNm) then
  715       begin
  716         Visi tType := u VisitType;
  717         frmV isitType.f raVisitRel ated.GetRe lated(uEnc PCEData);
  718         Prov iders.Merg e(uProvide rs);
  719       end;
  720         // DN S      BELLC
  721       if For mListConta ins(CT_Dia gNm) then
  722         SetD iagnoses(f rmDiagnose s.lstRenam eMe.ItemsS trings);
  723       if For mListConta ins(CT_Pro cNm) then
  724        SetPr ocedures(f rmProcedur es.lstRena meMe.Items Strings);
  725       if For mListConta ins(CT_Imm Nm) then
  726          Set Immunizati ons(frmImm unizations .lstRename Me.ItemsSt rings);
  727       if For mListConta ins(CT_Ski nNm) then
  728          Set SkinTests( frmSkinTes ts.lstRena meMe.Items Strings);
  729       if For mListConta ins(CT_Ped Nm) then
  730         SetP atientEds( frmPatient Ed.lstRena meMe.Items Strings);
  731       if For mListConta ins(CT_Hlt hNm) then
  732         SetH ealthFacto rs(frmHeal thFactors. lstRenameM e.ItemsStr ings);
  733       if For mListConta ins(CT_Xam Nm) then
  734         SetE xams(frmEx ams.lstRen ameMe.Item sStrings);
  735     end;
  736   end;
  737  
  738   procedure  TfrmEncoun terFrame.S electTab(N ewTabName:  string);
  739   var
  740     AllowCha nge: boole an;
  741   begin
  742     AllowCha nge := Tru e;
  743     tabContr ol.TabInde x := FormL ist.IndexO f(NewTabNa me);
  744     tabPageC hange(Self , tabContr ol.TabInde x, AllowCh ange);
  745   end;
  746  
  747   procedure  TfrmEncoun terFrame.T abControlE nter(Sende r: TObject );
  748   begin
  749     if FGive MultiTabMe ssage then  // CQ#154 83
  750     begin
  751       FGiveM ultiTabMes sage := FA LSE;
  752       GetScr eenReader. Speak('Mul ti tab for m');
  753     end;
  754   end;
  755  
  756   procedure  TfrmEncoun terFrame.F ormKeyDown (Sender: T Object; va r Key: Wor d;
  757     Shift: T ShiftState );
  758   var
  759     CanChang e: boolean ;
  760   begin
  761     inherite d;
  762     if (Key  = VK_ESCAP E) then
  763     begin
  764       Key :=  0;
  765       FLastP age.btnCan cel.Click;
  766     end
  767     else if  Key = VK_T AB then
  768     begin
  769       if ssC trl in Shi ft then
  770       begin
  771         CanC hange := T rue;
  772         if A ssigned(Ta bControl.O nChanging)  then
  773           Ta bControl.O nChanging( TabControl , CanChang e);
  774         if C anChange t hen
  775         begi n
  776           if  ssShift i n Shift th en
  777           be gin
  778              if TabCont rol.TabInd ex < 1 the n
  779                TabContr ol.TabInde x := TabCo ntrol.Tabs .Count -1
  780              else
  781                TabContr ol.TabInde x := TabCo ntrol.TabI ndex - 1;
  782           en d
  783           el se
  784              TabControl .TabIndex  := (TabCon trol.TabIn dex + 1) m od TabCont rol.Tabs.C ount;
  785           if  Assigned( TabControl .OnChange)  then
  786              TabControl .OnChange( TabControl );
  787         end;
  788         Key  := 0;
  789       end;
  790     end;
  791   end;
  792  
  793   procedure  TfrmEncoun terFrame.S etFormFont s;
  794   var
  795     NewFontS ize: integ er;
  796   begin
  797     NewFontS ize := Mai nFontsize;
  798     if FormL istContain s(CT_Visit Nm) then
  799       frmVis itType.Fon t.Size :=  NewFontSiz e;
  800     if FormL istContain s(CT_DiagN m) then
  801       frmDia gnoses.Fon t.Size :=  NewFontSiz e;
  802     if FormL istContain s(CT_ProcN m) then
  803       frmPro cedures.Fo nt.Size :=  NewFontSi ze;
  804     if FormL istContain s(CT_ImmNm ) then
  805       frmImm unizations .Font.Size  := NewFon tSize;
  806     if FormL istContain s(CT_SkinN m) then
  807       frmSki nTests.Fon t.Size :=  NewFontSiz e;
  808     if FormL istContain s(CT_PedNm ) then
  809       frmPat ientEd.Fon t.Size :=  NewFontSiz e;
  810     if FormL istContain s(CT_HlthN m) then
  811       frmHea lthFactors .Font.Size  := NewFon tSize;
  812     if FormL istContain s(CT_XamNm ) then
  813       frmExa ms.Font.Si ze := NewF ontSize;
  814     if FormL istContain s(CT_VitNm ) then
  815       frmEnc Vitals.Fon t.Size :=  NewFontSiz e;
  816     if FormL istContain s(CT_GAFNm ) then
  817       frmGAF .SetFontSi ze(NewFont Size);
  818   end;
  819  
  820   procedure  TfrmEncoun terFrame.F ormClose(S ender: TOb ject;
  821     var Acti on: TClose Action);
  822   begin
  823     SaveUser Bounds(Sel f);
  824   end;
  825  
  826   procedure  TfrmEncoun terFrame.F ormCanResi ze(Sender:  TObject;  var NewWid th,
  827     NewHeigh t: Integer ; var Resi ze: Boolea n);
  828   begin
  829     //CQ4740
  830     if NewWi dth < 200  then
  831        begin
  832        NewWi dth := 200 ;
  833        Resiz e := false ;
  834        end;
  835   end;
  836  
  837   procedure  TfrmEncoun terFrame.F ormShow(Se nder: TObj ect);
  838   begin
  839     inherite d;
  840     if TabCo ntrol.CanF ocus then
  841       TabCon trol.SetFo cus;
  842   end;
  843  
  844   end.