12. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/31/2017 10:45:41 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.

12.1 Files compared

# Location File Last Modified
1 CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\APP-VITALS fGMV_UserMain.pas Tue Dec 13 18:26:08 2016 UTC
2 CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\APP-VITALS fGMV_UserMain.pas Fri Mar 31 14:59:49 2017 UTC

12.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 5 3716
Changed 4 10
Inserted 0 0
Removed 0 0

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

12.4 Active regular expressions

No regular expressions were active.

12.5 Comparison detail

  1   unit fGMV_ UserMain;
  2  
  3   interface
  4  
  5   uses
  6     Windows,  Messages,  SysUtils,  Variants,  Classes,  Graphics,  Controls,  Forms,
  7     Dialogs,  StdCtrls,  Buttons,  ExtCtrls,  ComCtrls,  CommCtrl,
  8     Menus,
  9     ActnList
  10     , uGMV_C onst, StdA ctns, ImgL ist, Shell API
  11     , VERGEN CECONTEXTO RLib_TLB
  12     , OleCtr ls
  13     , mGMV_G ridGraph
  14     , mGMV_M DateTime,  uROR_Conte xtor, AppE vnts
  15     , fGMV_P atientSele ctor, Syst em.Actions
  16     ;
  17  
  18   type
  19     TfrmGMV_ UserMain =  class(TFo rm)
  20       sb: TS tatusBar;
  21       acMain List: TAct ionList;
  22       acInpu tVitals: T Action;
  23       acPati entInfo: T Action;
  24       acPtSe lect: TAct ion;
  25       acEdit Vitals: TA ction;
  26       acPtAl lergies: T Action;
  27       acRunR eport: TAc tion;
  28       mnMain : TMainMen u;
  29       mnFile : TMenuIte m;
  30       PtSele ct1: TMenu Item;
  31       EnterV itals1: TM enuItem;
  32       mnFile PrinterSet up: TMenuI tem;
  33       mnFile EnteredInE rror: TMen uItem;
  34       mnFile EditUserTe mplates: T MenuItem;
  35       mnFile UserOption s: TMenuIt em;
  36       N1: TM enuItem;
  37       mnFile Exit: TMen uItem;
  38       mnRepo rts: TMenu Item;
  39       mnRepo rtsVitalSi gns: TMenu Item;
  40       mnRepo rtsBPPlott ingChart:  TMenuItem;
  41       mnRepo rtsWeightC hart: TMen uItem;
  42       mnRepo rtsPOxResp irationCha rt: TMenuI tem;
  43       mnRepo rtsPainCha rt: TMenuI tem;
  44       N4: TM enuItem;
  45       mnRepo rtsCumaula tiveVitals Report: TM enuItem;
  46       mnRepo rtsLatestV italsbyLoc ation: TMe nuItem;
  47       mnRepo rtsLatestV italsDispl ayPatient:  TMenuItem ;
  48       mnRepo rtsVitalsE nteredInEr ror: TMenu Item;
  49       View1:  TMenuItem ;
  50       Demogr aphics1: T MenuItem;
  51       Allerg ies1: TMen uItem;
  52       mnHelp : TMenuIte m;
  53       mnHelp Index: TMe nuItem;
  54       mnHelp Web: TMenu Item;
  55       N3: TM enuItem;
  56       mnHelp About: TMe nuItem;
  57       FileEx it1: TFile Exit;
  58       splPtS elect: TSp litter;
  59       CCRCon textor: TC CRContexto r;
  60       aclMai n: TAction List;
  61       acFile Exit: TAct ion;
  62       acFile BreakLink:  TAction;
  63       acFile RejoinApp:  TAction;
  64       acFile RejoinGlob al: TActio n;
  65       acPati entEdit: T Action;
  66       N5: TM enuItem;
  67       UseApp licationDa ta1: TMenu Item;
  68       UseGlo balData1:  TMenuItem;
  69       Breakt heClinical Link1: TMe nuItem;
  70       Applic ationEvent s: TApplic ationEvent s;
  71       CCOW1:  TMenuItem ;
  72       acShow Status: TA ction;
  73       ShowSt atus1: TMe nuItem;
  74       pnlPtS elect: TPa nel;
  75       pnlGra ph: TPanel ;
  76       fraGMV _GridGraph 1: TfraGMV _GridGraph ;
  77       acPati entSelect:  TAction;
  78       Panel2 : TPanel;
  79       pnlGro upActions:  TPanel;
  80       SpeedB utton1: TS peedButton ;
  81       acGrou pInput: TA ction;
  82       pnlTop : TPanel;
  83       pnlSpe edButtonDo wn: TPanel ;
  84       pnlCCO WControls:  TPanel;
  85       pnlPtI nfo: TPane l;
  86       lblPat ientName:  TLabel;
  87       lblPat ientInfo:  TLabel;
  88       ccrCon textorIndi cator: TCC RContextor Indicator;
  89       Panel1 : TPanel;
  90       sbtnAl lergies: T SpeedButto n;
  91       sbEnte rVitals: T SpeedButto n;
  92       sbtnPt Lookup: TS peedButton ;
  93       pnlPat ientDetail s: TPanel;
  94       lblHos pital: TLa bel;
  95       Label6 : TLabel;
  96       Label1 1: TLabel;
  97       lblDat eFromTitle : TLabel;
  98       acDevI nfo: TActi on;
  99       Bevel1 : TBevel;
  100       PrintG raph1: TMe nuItem;
  101       N2: TM enuItem;
  102       ShowHi deGraphOpt ions1: TMe nuItem;
  103       Select GraphColor 1: TMenuIt em;
  104       pnlCCO WIndicator : TPanel;
  105       Patien tInquiry1:  TMenuItem ;
  106       DataGr idReport1:  TMenuItem ;
  107       ShowLo g1: TMenuI tem;
  108       N6: TM enuItem;
  109       N7: TM enuItem;
  110       ShowGr aphReport1 : TMenuIte m;
  111       N8: TM enuItem;
  112       N9: TM enuItem;
  113       proced ure FileEx it1Hint(va r HintStr:  String; v ar CanShow : Boolean) ;
  114       proced ure acPati entInfoExe cute(Sende r: TObject );
  115       proced ure pnlPtI nfoClick(S ender: TOb ject);
  116       proced ure pnlPtI nfoMouseDo wn(Sender:  TObject;  Button: TM ouseButton ;
  117         Shif t: TShiftS tate; X, Y : Integer) ;
  118       proced ure pnlPtI nfoMouseUp (Sender: T Object; Bu tton: TMou seButton;
  119         Shif t: TShiftS tate; X, Y : Integer) ;
  120       proced ure acPtSe lectExecut e(Sender:  TObject);
  121       proced ure acPtAl lergiesExe cute(Sende r: TObject );
  122       proced ure acRunR eportExecu te(Sender:  TObject);
  123       proced ure mnFile PrinterSet upClick(Se nder: TObj ect);
  124       proced ure mnFile EnteredInE rrorClick( Sender: TO bject);
  125       proced ure mnFile EditUserTe mplatesCli ck(Sender:  TObject);
  126       proced ure mnFile UserOption sClick(Sen der: TObje ct);
  127       proced ure mnHelp AboutClick (Sender: T Object);
  128       proced ure mnHelp IndexClick (Sender: T Object);
  129       proced ure mnHelp WebClick(S ender: TOb ject);
  130       proced ure sbDraw Panel(Stat usBar: TSt atusBar; P anel: TSta tusPanel;
  131         cons t Rect: TR ect);
  132       proced ure acInpu tVitalsExe cute(Sende r: TObject );
  133       proced ure FormDe stroy(Send er: TObjec t);
  134       proced ure CCRCon textorComm itted(Send er: TObjec t);
  135       proced ure CCRCon textorPati entChanged (Sender: T Object);
  136       proced ure CCRCon textorPend ing(Sender : TObject;
  137         cons t aContext ItemCollec tion: IDis patch);
  138       proced ure FormRe size(Sende r: TObject );
  139       proced ure FormCr eate(Sende r: TObject );
  140       proced ure Applic ationEvent sMinimize( Sender: TO bject);
  141       proced ure Applic ationEvent sRestore(S ender: TOb ject);
  142       proced ure acFile BreakLinkE xecute(Sen der: TObje ct);
  143       proced ure acFile RejoinAppE xecute(Sen der: TObje ct);
  144       proced ure acFile RejoinGlob alExecute( Sender: TO bject);
  145       proced ure acShow StatusExec ute(Sender : TObject) ;
  146       proced ure fraGMV _GridGraph 1acEnterVi talsExecut e(Sender:  TObject);
  147       proced ure pnlPtS electResiz e(Sender:  TObject);
  148       proced ure acPati entSelectE xecute(Sen der: TObje ct);
  149       proced ure FormCl ose(Sender : TObject;  var Actio n: TCloseA ction);
  150       proced ure acGrou pInputExec ute(Sender : TObject) ;
  151       proced ure acDevI nfoExecute (Sender: T Object);
  152       proced ure FormKe yDown(Send er: TObjec t; var Key : Word;
  153         Shif t: TShiftS tate);
  154       proced ure fraGMV _GridGraph 1SpeedButt on1Click(S ender: TOb ject);
  155       proced ure CCRCon textorSusp ended(Send er: TObjec t);
  156       proced ure CCRCon textorResu med(Sender : TObject) ;
  157       proced ure mnFile ExitClick( Sender: TO bject);
  158        // functio n Applicat ionEventsH elp(Comman d: Word; D ata: Integ er; //  DN S      BELLC 7/30 /2013
  159    //     va r CallHelp : Boolean) : Boolean;
  160       proced ure pnlPtI nfoEnter(S ender: TOb ject);
  161       proced ure pnlPtI nfoExit(Se nder: TObj ect);
  162       proced ure ShowLo g1Click(Se nder: TObj ect);
  163       proced ure Patien tInquiry1C lick(Sende r: TObject );
  164       proced ure DataGr idReport1C lick(Sende r: TObject );
  165       proced ure FormAc tivate(Sen der: TObje ct);
  166       proced ure ShowHi deGraphOpt ions1Click (Sender: T Object);
  167       proced ure ShowGr aphReport1 Click(Send er: TObjec t);
  168       functi on Applica tionEvents Help(Comma nd: Word;  Data: Nati veInt;
  169         var  CallHelp:  Boolean):  Boolean;
  170     private
  171       { Priv ate declar ations }
  172       bIgnor eListChang es: Boolea n;
  173       { The  fEditCount  variable  (see also  the EditCo unt proper ty) stores  number of
  174         open  modal for ms that pr event the  patient co ntext from  changing.   A counte r
  175         inst ead of a b oolean var iable is r equired to  handle ne sted modal  forms.
  176         See  the StartP atientEdit  and EndPa tientEdit  procedures  for more  details. }
  177       fEditC ount:  Int eger;
  178  
  179       { The  fPendingDF N variable  holds an  IEN (DFN)  of the pat ient who m ust be
  180         sele cted as th e current  one after  the modal  forms, whi ch block t he patient
  181         cont ext change , are clos ed.  See t he StartPa tientEdit,  EndPatien tEdit,
  182         and  ccrContext orPatientC hanged pro cedures fo r more det ails. }
  183       fPendi ngDFN: Str ing;
  184  
  185       Switch PatientSel ector:Bool ean;
  186       fIgnor eCount:Int eger;
  187  
  188       FMDate TimeRange:  TMDateTim eRange;
  189       FCurre ntPtIEN:St ring;
  190       FCurre ntTemplate : string;
  191       FCurre ntHospital ID: string ;
  192       FCurre ntHospital Name: stri ng;
  193  
  194       fPatie ntSelector Form: Tfrm GMV_Patien tSelector;   // vhais handria 05 0706
  195  
  196       functi on getpati entList: T ListView;   // vhaish andria 050 706
  197  
  198       proced ure SetCur rentPtIEN( aDFN: stri ng);
  199       proced ure SetCur rentTempla te(const V alue: stri ng);
  200       functi on GetCurr entTemplat e: string;
  201       proced ure NewPtL ookup(Send er: TObjec t);
  202       proced ure SetRep ortsActive (bState: B oolean);
  203  
  204       proced ure DrawDe lay(sDelay :String;iD elay:Integ er);
  205       proced ure DrawDe layClear;
  206   //    proc edure SetS tatusBar(s Text:Strin g);
  207       functi on SearchP attern:Str ing;
  208       functi on SearchD elay:Strin g;
  209   //    func tion Searc hStatus:St ring;
  210       functi on SearchM SDelay:Int eger;
  211       proced ure Discon nect;
  212  
  213       proced ure StartP atientEdit ; virtual;
  214       proced ure EndPat ientEdit;  virtual;
  215  
  216       proced ure Displa yHint(Send er: TObjec t);
  217       proced ure setCCO WActionsSt atus(bEnab led:Boolea n);
  218       proced ure FindPa tientInSel ector;
  219  
  220       proced ure WMGetM inMaxInfo(  var Messa ge :TWMGet MinMaxInfo  ); messag e WM_GETMI NMAXINFO;
  221     protecte d
  222       proper ty EditCou nt: Intege r read fEd itCount;
  223     public
  224       proced ure CloseO therForms( Force: Boo lean = Fal se);
  225       { Publ ic declara tions }
  226       functi on Restore Connection :Boolean;
  227       proced ure Restor eSettings;
  228       proced ure setAct ionStatus( aValue:Boo lean);
  229       proced ure SetSta tusBar(sTe xt:String) ;
  230     publishe d
  231       proper ty Current Template:  string       read Get CurrentTem plate writ e SetCurre ntTemplate ;
  232       proper ty Current PtIEN: str ing          read FCu rrentPtIEN  write Set CurrentPtI EN;
  233       proper ty Current HospitalID : string          rea d FCurrent HospitalID  write FCu rrentHospi talID;
  234       proper ty Current HospitalNa me: string          r ead FCurre ntHospital Name write  FCurrentH ospitalNam e;
  235  
  236       proper ty Patient List:TList View read  getPatient List; // v haishandri a 050706
  237  
  238     protecte d
  239       proced ure CMPati entFound(v ar Message : TMessage ); message  CM_PATIEN TFOUND; // AAN 06/11/ 02
  240       proced ure CMPTSe arching(va r Message:  TMessage) ; message  CM_PTSEARC HING; //AA N 07/18/02
  241       proced ure CMPTSe archDone(v ar Message : TMessage ); message  CM_PTSEAR CHDONE; // AAN 07/18/ 02
  242       proced ure CMPTSe archStart( var Messag e: TMessag e); messag e CM_PTSEA RCHSTART;  //AAN 07/1 8/02
  243       proced ure CMPati entListNot Found(var  Message: T Message);  message CM _PTLISTNOT FOUND; //A AN 07/18/0 2
  244       proced ure CMPTSe archKBMode (var Messa ge: TMessa ge); messa ge CM_PTSE ARCHKBMODE ; //AAN 07 /18/02
  245       proced ure CMPTSe archDelay( var Messag e: TMessag e); messag e CM_PTSEA RCHDELAY;  //AAN 07/1 8/02
  246  
  247       proced ure CMPTLI STCHANGED( var Messag e: TMessag e); messag e CM_PTLIS TCHANGED;  //AAN 07/1 8/02
  248       proced ure CMPTPe riodChange d(var Mess age: TMess age); mess age CM_PER IODCHANGED ; //AAN 07 /18/02
  249     end;
  250  
  251   var
  252     frmGMV_U serMain: T frmGMV_Use rMain;
  253  
  254   implementa tion
  255  
  256   uses uGMV_ Common, uG MV_User
  257     , uGMV_U tils, fGMV _PtInfo
  258     , fGMV_R eportOptio ns
  259     , fGMV_E nteredInEr ror
  260     , fGMV_E ditUserTem plates, uG MV_Templat e, fGMV_Us erSettings
  261     , uGMV_G lobalVars,  fGMV_Abou tDlg, uGMV _SaveResto re, fGMV_I nputLite
  262     , fROR_P Call
  263     , uROR_R PCBroker
  264     , fGMV_P tSelect, u GMV_FileEn try, uGMV_ Engine, uG MV_Patient
  265     , uGMV_V ersionInfo , Grids
  266     , fGMV_H ospitalSel ector2, fG MV_RPCLog,  uGMV_Log
  267     ;
  268  
  269   {$R *.dfm}
  270  
  271   function C ontextor:  TCCRContex tor;
  272   begin
  273     Result : = frmGMV_U serMain.cc rContextor ;
  274   end;
  275  
  276   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////CCOW
  277   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////CCOW
  278   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////CCOW
  279   procedure  TfrmGMV_Us erMain.set CCOWAction sStatus(bE nabled:Boo lean);
  280   begin
  281   // 2008-05 -20 commen ted out to  separate  CCOW and m ovement wi thin list
  282   //  acGrou pInput.Ena bled := (f rmGMV_Pati entSelecto r.SelectCo unt > 1);
  283   //  acInpu tVitals.En abled := b Enabled;
  284  
  285     CCOW1.En abled :=
  286       bEnabl ed and
  287       ccrCon textor.Ena bled and
  288       (ccrCo ntextor.St ate<>CsPar ticipating );             // vha ishandria  060217
  289  
  290     acFileRe joinApp.En abled := C COW1.Enabl ed and (Cu rrentPtIEN <>''); //  bEnabled a nd ccrCont extor.Enab led;
  291     acFileRe joinGlobal .Enabled : = CCOW1.En abled; //  bEnabled a nd ccrCont extor.Enab led;
  292     acFileBr eakLink.En abled := c crContexto r.Enabled  and (ccrCo ntextor.St ate=CsPart icipating) ;
  293   end;
  294  
  295   procedure  TfrmGMV_Us erMain.Res toreSettin gs;
  296  
  297     procedur e RestoreG ridGraph;
  298     begin
  299       try
  300         fraG MV_GridGra ph1.FrameS tyle := fs Vitals;
  301         fraG MV_GridGra ph1.Restor eUserPrefe rences;
  302       except
  303         on E : Exceptio n do
  304            f raGMV_Grid Graph1.cbx Graph.Item Index := 0 ;
  305       end;
  306     end;
  307  
  308     procedur e RestoreD ateRange;
  309     var
  310       i: Int eger;
  311     begin
  312       if not  Assigned( FMDateTime Range) the n
  313         FMDa teTimeRang e := TMDat eTimeRange .Create;
  314       fraGMV _GridGraph 1.SetUpFra me;
  315       fraGMV _GridGraph 1.MDateTim eRange :=  FMDateTime Range;
  316  
  317       i := S trToIntDef (GMVUser.S etting[usG ridDateRan ge], 9);// AAN 12/11/ 02
  318       if i >  12 then i  := 12;
  319  
  320       if fra GMV_GridGr aph1.Frame Style = fs Vitals the n
  321         begi n
  322           fr aGMV_GridG raph1.lbDa teRange.It emIndex :=  i;
  323           fr aGMV_GridG raph1.cbxD ateRangeCl ick(fraGMV _GridGraph 1.lbDateRa nge);
  324         end;
  325     end;
  326  
  327     procedur e RestoreP atientSele ctorWindow ;
  328     var
  329       aForm:  TfrmGMV_P atientSele ctor;
  330       s: Str ing;
  331       i: Int eger;
  332  
  333     begin
  334       aForm  := nil;
  335       try
  336         aFor m := getPa tientSelec torForm;
  337         aFor m.bIgnore  := True;
  338         aFor m.bIgnoreP tChange :=  True;
  339  
  340         try
  341           s  := getUser Settings(' UNIT_INDEX ');
  342           if  (s <> '')  and (s<>' -1') then
  343              begin
  344                aForm.pc Main.Activ ePageIndex  := 0;
  345                i := str ToInt(s);
  346                aForm.lb Units.Item Index := i ;
  347                aForm.pc MainChange (nil);
  348                aForm.lb UnitsDblCl ick(nil);
  349                aForm.lv UnitPatien ts.Enabled  := True;
  350              end;
  351         exce pt
  352         end;
  353  
  354         try
  355           s  := getUser Settings(' WARD_INDEX ');
  356           if  (s <> '')  and (s<>' -1') then
  357              begin
  358                aForm.pc Main.Activ ePageIndex  := 1;
  359                i := str ToInt(s);
  360                aForm.lb Wards.Item Index := i ;
  361                aForm.pc MainChange (nil);
  362                aForm.lb UnitsDblCl ick(nil);
  363                aForm.lv WardPatien ts.Enabled  := True;
  364              end;
  365         exce pt
  366         end;
  367  
  368         try
  369           s  := getUser Settings(' TEAM_INDEX ');
  370           if  (s <> '')  and (s<>' -1') then
  371              begin
  372                aForm.pc Main.Activ ePageIndex  := 2;
  373                i := str ToInt(s);
  374                aForm.lb Teams.Item Index := i ;
  375                aForm.pc MainChange (nil);
  376                aForm.lb UnitsDblCl ick(nil);
  377                aForm.lv TeamPatien ts.Enabled  := True;
  378              end;
  379         exce pt
  380         end;
  381  
  382         try
  383           s  := getUser Settings(' CLINIC_IND EX');
  384           if  (s <> '')  and (s<>' -1') then
  385              begin
  386                aForm.pc Main.Activ ePageIndex  := 3;
  387                aForm.cm bPeriod.It emIndex :=  0; // vha ishandria  2008-06-17
  388                i := str ToInt(s);
  389                aForm.lb Clinics.It emIndex :=  i;
  390                aForm.pc MainChange (nil);
  391                aForm.lb UnitsDblCl ick(nil);
  392                aForm.lv ClinicPati ents.Enabl ed := True ;
  393              end;
  394         exce pt
  395         end;
  396  
  397         s :=  getUserSe ttings('SE LECTOR_TAB ');
  398         try
  399           if  s = '' th en i := 0
  400           el se
  401              i := strTo Int(s);
  402           aF orm.pcMain .ActivePag eIndex :=  i;
  403           aF orm.pcMain Change(nil );
  404         exce pt
  405         end;
  406  
  407         if a Form.Paren t <> pnlPt Select the n
  408           be gin
  409              aForm.Pare nt := pnlP tSelect;
  410              aForm.OnPa tChange :=  NewPtLook up;
  411              aForm.Bord erStyle :=  bsNone;
  412              aForm.pnlS tatus.Visi ble := Fal se;
  413              aForm.Alig n := alCli ent;
  414              aForm.Show ;
  415  
  416              pnlGroupAc tions.Visi ble := Tru e;
  417           en d;
  418       except
  419       end;
  420       if Ass igned(aFor m) then
  421         begi n
  422           aF orm.bIgnor e := False ;
  423           aF orm.bIgnor ePtChange  := True;
  424           fP atientSele ctorForm : = aForm;
  425         end;
  426     end;
  427  
  428   var
  429     bTime,
  430     aTime: T DateTime;
  431  
  432   begin
  433     // vhais handria 20 08-03-10    profiling  changes - ---------- ---------- ---- begin
  434     aTime :=  EventStar t('VITALS  RestoreSet tings --   Begin');
  435     FCurrent Template : = GMVUser. Setting[us DefaultTem plate];
  436  
  437     RestoreP atientSele ctorWindow ;
  438     bTime :=  EventAdd( 'Restore P atient Sel ector Wind ow','',aTi me);
  439     RestoreW indowSetti ngs(TForm( Self));
  440     bTime :=  EventAdd( 'Restore L ayoutSetti ngs','',bT ime);
  441     RestoreG ridGraph;
  442     bTime :=  EventAdd( 'Restore G ridGraph', '',bTime);
  443     RestoreD ateRange;
  444     EventAdd ('Restore  Date Range ','',bTime );
  445  
  446     EventSto p('VITALS  RestoreSet tings - en d');
  447     // vhais handria 20 08-03-10    profiling  changes - ---------- ---------- ------ end
  448   end;
  449  
  450   function T frmGMV_Use rMain.Rest oreConnect ion:Boolea n;
  451   var
  452     s,
  453     stn:Stri ng;
  454     aTime,eT ime: TDate Time;
  455  
  456   const
  457     RPC_CREA TECONTEXT  = 'GMV V/M  GUI';
  458  
  459   begin
  460   //vhaishan dria 2008- 03-11 ==== ========== ========== ========== ========== =========
  461     if Assig ned(RPCBro ker) then  Disconnect ;
  462     Result : = False;
  463  
  464     if CmdLi neSwitch([ '/NOCCOW'] ) then
  465       begin
  466         ccrC ontextor.E nabled :=  False;
  467         RPCB roker := S electBroke r(RPC_CREA TECONTEXT,  nil);
  468       end
  469     else
  470       begin
  471         ccrC ontextor.E nabled :=  True;
  472         if C mdLineSwit ch(['CCOW= PATIENTONL Y','/PATIE NTONLY'])  then
  473           RP CBroker :=  SelectBro ker(RPC_CR EATECONTEX T, nil)
  474         else
  475           RP CBroker :=  SelectBro ker(RPC_CR EATECONTEX T, ccrCont extor.Cont extor);
  476       end;
  477  
  478     if RPCBr oker = nil  then
  479         Exit ;
  480  
  481     GMVUser  := TGMV_Us er.Create;
  482  
  483     if GMVUs er.SignOn( RPC_CREATE CONTEXT, T rue) then
  484       begin
  485         GMVT ypes := TG MV_VitalTy pe.Create;         //  TGMV_Vita lType.Crea te(RPCBrok er);
  486         GMVQ uals := TG MV_VitalQu al.Create;         //  TGMV_Vita lQual.Crea te(RPCBrok er);
  487  
  488         aTim e := Now;
  489         Init VitalsIENS ; // vhais handria 06 0515
  490         aTim e := Event Stop('Init VitalsIENs  -- Done', '',aTime);
  491         GMVC ats := TGM V_VitalCat .Create;           //  TGMV_Vita lCat.Creat e(RPCBroke r);
  492         aTim e := Event Stop('Crea te Vitals  Categories  -- Done', '',aTime);
  493         GMVN ursingUnit s := TGMV_ NursingUni t.Create;  // TGMV_Nu rsingUnit. Create(RPC Broker);
  494         eTim e := Event Add('Creat e Nursing  Units -- D one','',aT ime);
  495         GMVW ardLocatio ns := TGMV _WardLocat ion.Create ; // TGMV_ WardLocati on.Create( RPCBroker) ;
  496         eTim e := Event Add('Creat e Ward Loc ations --  Done','',e Time);
  497         GMVT eams := TG MV_Teams.C reate;             //  TGMV_Team s.Create(R PCBroker);
  498         eTim e := Event Add('Creat e Nursing  Teams -- D one','',eT ime);
  499         GMVC linics :=  TGMV_Clini cs.Create;         //  TGMV_Clin ics.Create (RPCBroker );
  500         eTim e := Event Add('Creat e Clinics  -- Done',' ',eTime);
  501         GMVD efaultTemp lates := T GMV_Defaul tTemplates .Create;//  TGMV_Defa ultTemplat es.Create( RPCBroker) ;
  502         Even tAdd('Crea te Templat es -- Done ','',eTime );
  503  
  504         Rest oreSetting s; // vhai shandria 2 008-03-10
  505  
  506         Resu lt := True ;
  507       end
  508     else
  509       begin
  510         Free AndNil(GMV User);
  511         Free AndNil(RPC Broker);
  512         Resu lt := Fals e;
  513       end;
  514  
  515     if Assig ned(RPCBro ker) then
  516       begin
  517         Resu lt := True ;
  518         { Th e contexto r needs a  reference  to the RPC  Broker to  perform t he
  519           DF N <-> ICN  conversion s. }
  520         aTim e := Now;
  521         ccrC ontextor.R PCBroker : = RPCBroke r;
  522         Even tStop('Ass ign Broker  to Contex tor','',aT ime);
  523  
  524         with  ccrContex tor do
  525           be gin
  526              { Here you  should ge t a real s tation num ber from V istA }
  527              stn := get StationInf o;
  528  
  529              s := Piece (stn,'^',2 );
  530              stn := Pie ce(stn,'^' ,1);
  531              if s = '0'  then s :=  '_test';
  532   //           if s = ' 1' then s  := '_prod' ;
  533              if s = '1'  then s :=  '';
  534              { If the s tation num ber is not  available  by any re ason then  the
  535                particip ation in t he context  will be s uspended a nd the con textor
  536                will be  disabled.  }
  537              if stn <>  '' then
  538                begin
  539                  { Appe nd the sta tion numbe r to the b ase name s tored in
  540                    the  property ( 'patient.i d.mrn.dfn_ '). }
  541                  DFNIte mName := P iece(DFNIt emName, '_ ') + '_' +  stn + s;
  542                  { Proc ess the kn own subjec ts of the  current co ntext and
  543                    extr act availa ble patien t identifi ers (conve rt the DFN
  544                    to/f rom the IC N if neces sary). }
  545                  aTime  := Now;
  546                  Proces sKnownSubj ects{(true )};// vhai shandria 2 008-05-15
  547                  EventS top('Proce ss Context  Subjects' ,'',aTime) ;
  548                  { Sele ct the pat ient accor ding to th e current  patient co ntext }
  549                  aTime  := EventSt art('Set P atient by  Context Da ta -- Begi n','DFN: ' +PatientDF N);
  550                  Curren tPtIEN :=  PatientDFN ;
  551                  EventS top('Set P atient by  Context Da ta -- End' ,'',aTime) ;
  552                  if Cur rentPtIEN< >'' then
  553                    Find PatientInS elector;
  554                end
  555              else
  556                Enabled  := False;
  557           en d;
  558  
  559         if C mdLineSwit ch(['/nocc ow','/NOCC OW']) then
  560           be gin
  561              ccrContext or.Enabled  := False;
  562              acFileBrea kLink.Enab led := Fal se;
  563              acFileRejo inApp.Enab led := Fal se;
  564              acFileRejo inGlobal.E nabled :=  False;
  565              acShowStat us.Enabled  := False;
  566              CCOW1.Enab led := Fal se;
  567           en d
  568         else
  569           CC OW1.Enable d := False ;
  570       end;
  571   end;
  572  
  573   procedure  TfrmGMV_Us erMain.Dis connect;
  574   begin 
  575     if Assig ned(RPCBro ker) then
  576       begin
  577   //      Hi de;    vha ishandria  2008-03-11
  578         { Di sconnect a nd destroy  the RPC B roker }
  579         RPCB roker.Conn ected := F alse;
  580         Free AndNil(RPC Broker);
  581       end;
  582   end;
  583  
  584   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  585  
  586   procedure  TfrmGMV_Us erMain.Set CurrentPtI EN(aDFN: s tring);
  587   var
  588     Value:St ring;
  589     sL: TStr ingList;
  590     aPatient : TPatient ;
  591     aTime: T DateTime;  //vhaishan dria 06061 0
  592   begin
  593     if (aDFN  = fCurren tPtIEN) an d (fCurren tPtIEN <>' ') then Ex it;
  594     Value :=  aDFN;
  595     FCurrent PtIEN := V alue;
  596  
  597     fraGMV_G ridGraph1. PatientDFN  := FCurre ntPtIEN;
  598     fraGMV_G ridGraph1. PatientLoc ationName  := '';
  599     fraGMV_G ridGraph1. PatientLoc ation := ' ';
  600     if assig ned(frmGMV _PatientSe lector) th en
  601       try
  602         fraG MV_GridGra ph1.Patien tLocationN ame := frm GMV_Patien tSelector. SelectedPa tientLocat ionName;
  603         fraG MV_GridGra ph1.Patien tLocation  := frmGMV_ PatientSel ector.Sele ctedPatien tLocationI D;
  604       except
  605       end;
  606  
  607     try
  608       mnRepo rtsLatestV italsDispl ayPatient. Enabled :=  False;
  609       mnRepo rtsVitalsE nteredInEr ror.Enable d := False ;
  610       if FCu rrentPtIEN  <> '' the n
  611         begi n
  612           sL  := getPat ientHeader (Value);
  613           if  Piece(SL[ 0], '^', 1 ) <> '-1'  then
  614              begin
  615                lblPatie ntName.Cap tion := Fo rmatPatien tName(SL[1 ]);
  616                lblPatie ntInfo.Cap tion := Fo rmatPatien tInfo(SL[1 ] + SL[2]) ;
  617                acPtSele ct.Enabled  := True;
  618                acPtAlle rgies.Enab led := Tru e;
  619                acPatien tInfo.Enab led := Tru e;
  620                acInputV itals.Enab led := Tru e;
  621  
  622                mnReport sLatestVit alsDisplay Patient.En abled := T rue;
  623                mnReport sVitalsEnt eredInErro r.Enabled  := True;
  624  
  625                // The l ocation in formation  should be  provided b y Patient  object.
  626                // Other wise when  a patient  would be c hanged by  CCOW there  will
  627                // be no  way to fi gure out t he locatio n(Name and  ID)
  628                aPatient  := Select PatientByD FN(FCurren tPtIEN,Tru e);
  629                lblHospi tal.Captio n := aPati ent.Locati onName;
  630                aPatient .Free;
  631  
  632                lblDateF romTitle.C aption :=  fraGMV_Gri dGraph1.lb lDateFromT itle.Capti on;
  633                pnlPatie ntDetails. Visible :=  True;
  634              end
  635           el se
  636              begin
  637                lblPatie ntName.Cap tion := Pi ece(SL[0], '^',2);
  638                lblPatie ntInfo.Cap tion := '0 00-00-0000 ';
  639                acPtSele ct.Enabled  := False;
  640                acPtAlle rgies.Enab led := Fal se;
  641                acPatien tInfo.Enab led := Fal se;
  642                acInputV itals.Enab led := Fal se;
  643                pnlPatie ntDetails. Visible :=  False;
  644              end;
  645            S L.Free;
  646         end
  647       else i f Assigned (PatientLi st) and (P atientList .SelCount  > 1) then
  648         begi n
  649           lb lPatientNa me.Caption  := 'Multi ple Patien ts Selecte d';
  650           lb lPatientIn fo.Caption  := '';
  651           ac PtSelect.E nabled :=  False;
  652           ac PtAllergie s.Enabled  := False;  //AAN 05/2 8/2003
  653           ac PatientInf o.Enabled  := False;  // vhaisha ndria 2008 -02-13
  654           fr aGMV_GridG raph1.acVi talsReport .Enabled : = False; / / vhaishan dria 2008- 02-13
  655         end
  656       else
  657         begi n
  658           lb lPatientNa me.Caption  :='No Pat ient Selec ted';
  659           lb lPatientIn fo.Caption  := '000-0 0-0000';
  660           ac PtSelect.E nabled :=  True;
  661           ac PtAllergie s.Enabled  := False;
  662           ac PatientInf o.Enabled  := False;
  663           pn lPatientDe tails.Visi ble := Fal se;
  664         end;
  665  
  666     except
  667       on E:  Exception  do
  668         begi n
  669           lb lPatientNa me.Caption  := FCurre ntPtIEN;
  670           lb lPatientIn fo.Caption  := 'Error ...';
  671           pn lPatientDe tails.Visi ble := Fal se;
  672         end;
  673     end;
  674  
  675     fraGMV_G ridGraph1. SetGraphTi tle(lblPat ientName.C aption,lbl PatientInf o.Caption) ;
  676     if fraGM V_GridGrap h1.Patient DFN <> ''  then
  677       begin
  678         fraG MV_GridGra ph1.Visibl e := True;
  679  
  680         aTim e := Event Start('Upd ateFrame b y StCurren tPtIEN','N o Reload') ; // vhais handria 06 0610
  681         fraG MV_GridGra ph1.Update Frame(fals e); // vha ishandria  060610
  682         {aTi me := }Eve ntStop('Up dateFrame  by StCurre ntPtIEN',' No Reload' ,aTime); / / vhaishan dria 06061 0
  683  
  684         fraG MV_GridGra ph1.scbHGr aphChange( nil);
  685         fraG MV_GridGra ph1.acPati entInfo.En abled := T rue;
  686         fraG MV_GridGra ph1.acVita lsReport.E nabled :=  True;
  687         fraG MV_GridGra ph1.acShow GraphRepor t.Enabled  := True;
  688  
  689         fraG MV_GridGra ph1.Patien tLocationN ame := lbl Hospital.C aption;
  690  
  691         Capt ion := 'Vi tals for ' +
  692           lb lPatientNa me.Caption  + ' ' + l blPatientI nfo.Captio n;
  693       end
  694     else
  695       begin
  696         fraG MV_GridGra ph1.acPati entInfo.En abled := F alse;
  697         fraG MV_GridGra ph1.acVita lsReport.E nabled :=  False;
  698         fraG MV_GridGra ph1.acShow GraphRepor t.Enabled  := False;
  699         Capt ion := 'Vi tals: No P atient Sel ected';
  700       end;
  701   end;
  702  
  703   procedure  TfrmGMV_Us erMain.CMP atientFoun d(var Mess age: TMess age);
  704   begin
  705     SwitchPa tientSelec tor := Fal se;
  706  
  707     SetRepor tsActive(T rue);
  708     if CCRCo ntextor.Se tPatientCo ntext(frmG MV_Patient Selector.S electedPat ientID) th en
  709       //    CurrentPtI EN := Tfrm GMV_Patien tSelector( nil).Selec tedPatient ID; // DN S      BELLC
  710        CurrentPtI EN :=    frmGMV_Pat ientSelect or.Selecte dPatientID ; // DN S      BELLC
  711     SwitchPa tientSelec tor := Tru e;
  712   end;
  713  
  714   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  715   //  ROR Co ntextor
  716   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  717  
  718   procedure  TfrmGMV_Us erMain.For mDestroy(S ender: TOb ject);
  719   begin
  720   //  SaveWi ndowSettin gs(Self);  // vhaisha ndria 2008 -03-10
  721     if Assig ned(FMDate TimeRange)  then Free AndNil(FMD ateTimeRan ge);
  722     try
  723       with f raGMV_Grid Graph1 do
  724         begi n
  725           wh ile chrtVi tals.Serie sCount > 0  do
  726               chrtVital s.Series[0 ].Free;
  727           Fr eeAndNil(c hrtVitals) ;
  728         end;
  729     except
  730     end;
  731     inherite d;
  732   end;
  733  
  734   procedure  TfrmGMV_Us erMain.End PatientEdi t;
  735   begin
  736     { Decrea se the for m nesting  level }
  737     if fEdit Count > 0  then
  738       Dec(fE ditCount);
  739     { If thi s is the o utmost nes ting level  then proc ess the po stponed
  740       patien t change r equest. }
  741     if (fEdi tCount = 0 ) and (fPe ndingDFN < > '') then
  742       begin
  743         Curr entPtIEN : = fPending DFN; //       SelectP atient(fPe ndingDFN);
  744         fPen dingDFN :=  '';
  745       end;
  746   end;
  747  
  748   procedure  TfrmGMV_Us erMain.Sta rtPatientE dit;
  749   begin
  750     if fEdit Count = 0  then
  751         fPen dingDFN :=  '';
  752     { Increm emt the fo rm nesting  level }
  753     Inc(fEdi tCount);
  754   end;
  755  
  756   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  757  
  758   procedure  TfrmGMV_Us erMain.CCR ContextorC ommitted(S ender: TOb ject);
  759   begin
  760     if Assig ned(RPCBro ker) then
  761       { Perf orm the ch ecks requi red by the  single si gn-on/sign -off. }
  762       if RPC Broker.Was UserDefine d and RPCB roker.IsUs erCleared  then
  763         begi n
  764           {  Force clos ure of all  modal dia logs and m essage box es }
  765           Cl oseOtherFo rms(True);
  766           {  Terminate  the applic ation }
  767           Ap plication. Terminate;
  768         end;
  769   end;
  770  
  771   procedure  TfrmGMV_Us erMain.Clo seOtherFor ms(Force:  Boolean);
  772   var
  773     i: Integ er;
  774   begin
  775     { Close  the forms  only if th ere are mo dal dialog s and/or m essage box es that
  776       block  the patien t context  change or  if the "fo rced" acti on is requ ested. }
  777     if (Edit Count > 0)  or Force  then
  778       begin
  779         for  i:=1 to Sc reen.Custo mFormCount  do
  780           be gin
  781              { Close al l modal di alogs and  message bo xes that a re display ed
  782                over the  this wind ow (main a pplication  window).  }
  783              if Screen. CustomForm s[i-1] = S elf then
  784                Break;
  785              if fsModal  in Screen .CustomFor ms[i-1].Fo rmState th en
  786                Screen.C ustomForms [i-1].Clos e;
  787           en d;
  788       end;
  789   end;
  790  
  791   procedure  TfrmGMV_Us erMain.CCR ContextorP atientChan ged(Sender : TObject) ;
  792   begin
  793     { If thi s applicat ion condit ionally ac cepted the  patient c ontext cha nge
  794       reques t and is f orced to c hange it n ow then cl ose modal  dialogs an d
  795       messag e boxes th at block t he patient  context c hange. }
  796     if Conte xtor.Force dChange th en
  797       CloseO therForms;
  798     { If the re were mo dal dialog s and mess age boxes  that block ed the pat ient
  799       contex t change t hen postpo ne the cha nge until  the outerm ost EndPat ientEdit
  800       is exe cuted. Oth erwise, se lect the n ew patient  immediate ly. }
  801     if EditC ount > 0 t hen
  802       fPendi ngDFN := C ontextor.P atientDFN
  803     else
  804       begin
  805         Curr entPtIEN : = Contexto r.PatientD FN;
  806         // v haishandri a 060614
  807         // C leanup the  patient s elector if  the reque st to swit ch came fr om CCOW
  808         try
  809           if  assigned( frmGMV_Pat ientSelect or) then
  810              FindPatien tInSelecto r; // vhai shandria 0 60614
  811         exce pt
  812         end;
  813       end;
  814   end;
  815  
  816   procedure  TfrmGMV_Us erMain.CCR ContextorP ending(Sen der: TObje ct;
  817     const aC ontextItem Collection : IDispatc h);
  818   var
  819     newDFN,  newICN: St ring;
  820     ctx: ICo ntextItemC ollection;
  821   begin
  822     ctx := I ContextIte mCollectio n(aContext ItemCollec tion);
  823     with ccr Contextor  do
  824       begin
  825         { Ge t the awai lable pati ent identi fier(s) }
  826         Pati entDFNFrom Context(ct x, newDFN) ;
  827         Pati entICNFrom Context(ct x, newICN) ;
  828         { Ch eck if the  context c hange is a ctually re quired }
  829         if ( newDFN <>  PatientDFN ) or (newI CN <> Pati entICN) th en
  830           {  If there a re modal d ialogs and /or messag e boxex th at block t he
  831              patient co ntext chan ge then ac cept the r equest con ditionally
  832              and inform  the user  about the  potential  data loss.  }
  833           if  EditCount  > 0 then
  834              SetSurveyR esponse('Y ou might l ose unsave d patient  data.');
  835       end;
  836   end;
  837  
  838   procedure  TfrmGMV_Us erMain.Dis playHint(S ender: TOb ject);
  839   begin
  840     SB.Panel s[0].Text  := Applica tion.Hint;
  841   end;
  842  
  843   procedure  TfrmGMV_Us erMain.For mCreate(Se nder: TObj ect);
  844   begin
  845     SwitchPa tientSelec tor := Tru e; // vhai shandria 0 60614
  846  
  847     { Try to  start the  underlayi ng context or and con nect to th e vault. I f the
  848       Sentil lion conte xtor is no t installe d on the u sers works tation or  the vault
  849       is not  available  then the  TCCRContex tor will s witch to i dle mode a nd all
  850       reques ts will be  ignored.  }
  851     ccrConte xtor.Run;
  852  
  853     with ccr ContextorI ndicator d o
  854       begin
  855   {$IFDEF RO RCCOW}
  856         widt h  := SB.P anels[1].W idth - 4;
  857         heig ht := SB.H eight - 6;
  858         // t he context or indicat or invokes  OnResumed  method of  contextor .
  859         // t he OnResum ed method  has no inf ormation o n what con text (Glob al or
  860         // a pplication ) was used  to switch  the patie nt.
  861         // T o avoid co nfusion we  are hidin g the Indi cator menu
  862         ccrC ontextorIn dicator.Po pupMenu :=  nil; // v haishandri a 060614
  863   {$ENDIF}
  864       end;
  865  
  866     fIgnoreC ount := 0;
  867     Applicat ion.OnHint  := Displa yHint;
  868  
  869   {$IFDEF SH OWLOG} //  vhaishandr ia 060613
  870     N6.Visib le := True ;
  871     ShowLog1 .Visible : = True;
  872   {$ELSE}
  873     N6.Visib le := Fals e;
  874     ShowLog1 .Visible : = False;
  875   {$ENDIF}
  876  
  877     fraGMV_G ridGraph1. SetUpFrame ; // vhais handria 20 08-03-10
  878   {$IFDEF PA TCH_5_0_23 }
  879     mnReport sVitalSign s.Visible  := False;
  880     mnReport sBPPlottin gChart.Vis ible := Fa lse;
  881     mnReport sWeightCha rt.Visible  := False;
  882     mnReport sPOxRespir ationChart .Visible : = False;
  883     mnReport sPainChart .Visible : = False;
  884     N4.Visib le := Fals e;
  885   {$ENDIF}
  886   end;
  887  
  888   // DN S      BELLC
  889   function T frmGMV_Use rMain.Appl icationEve ntsHelp(Co mmand: Wor d; Data: N ativeInt;
  890     var Call Help: Bool ean): Bool ean;
  891   var
  892     s: Strin g;
  893     iHelp: I nteger;
  894   begin
  895     Applicat ionEvents. CancelDisp atch;
  896     s := Ext ractFileDi r(Applicat ion.ExeNam e) + '\Hel p\'+
  897       Change FileExt(Ex tractFileN ame(Applic ation.ExeN ame),'.hlp ');
  898     if Assig ned(Active Control) t hen
  899       begin
  900         iHel p := Activ eControl.H elpContext ;
  901         if i Help = 0 t hen iHelp  := 1;
  902  
  903         Appl ication.He lpSystem.S howContext Help(iHelp ,s);
  904         Call Help := Fa lse;
  905       end;
  906     Result : = True;
  907  
  908   end;
  909  
  910   procedure  TfrmGMV_Us erMain.App licationEv entsMinimi ze(Sender:  TObject);
  911   begin
  912     { When a pplication  is minimi zed, it su spends the  contextor . It does  not make
  913       sense  to change  the contex t when the  applicati on is not  visible an yway. }
  914   //  ccrCon textor.Sus pend;
  915   end;
  916  
  917   procedure  TfrmGMV_Us erMain.App licationEv entsRestor e(Sender:  TObject);
  918   begin
  919   Exit; //
  920     { When t he applica tion is re stored, th e particip ation in c ontext is
  921       resume d and sync hronizatio n with the  current c ontext is  performed.  }
  922     Screen.C ursor := c rHourGlass ;
  923     ccrConte xtor.Resum e(crmUseGl obalData);
  924     Screen.C ursor := c rDefault;
  925   end;
  926  
  927   procedure  TfrmGMV_Us erMain.acF ileBreakLi nkExecute( Sender: TO bject);
  928   begin
  929     Screen.C ursor := c rHourGlass ;
  930     ccrConte xtor.Suspe nd;
  931     Screen.C ursor := c rDefault;
  932     setCCOWA ctionsStat us(true);
  933   end;
  934  
  935   procedure  TfrmGMV_Us erMain.acF ileRejoinA ppExecute( Sender: TO bject);
  936   begin
  937     Screen.C ursor := c rHourGlass ;
  938     ccrConte xtor.Resum e(crmUseAp pData);
  939     Screen.C ursor := c rDefault;
  940   end;
  941  
  942   procedure  TfrmGMV_Us erMain.acF ileRejoinG lobalExecu te(Sender:  TObject);
  943   begin
  944     Screen.C ursor := c rHourGlass ;
  945     ccrConte xtor.Resum e(crmUseGl obalData);
  946     FindPati entInSelec tor; //vha ishandria  060614
  947     Screen.C ursor := c rDefault;
  948   end;
  949  
  950   procedure  TfrmGMV_Us erMain.CCR ContextorS uspended(S ender: TOb ject);
  951   begin
  952     CCOW1.En abled := n ot (ccrCOn textor.Sta te = csPar ticipating );
  953     acFileBr eakLink.En abled := c crCOntexto r.State =  csParticip ating;
  954   end;
  955  
  956   procedure  TfrmGMV_Us erMain.CCR ContextorR esumed(Sen der: TObje ct);
  957   begin
  958     CCOW1.En abled := n ot (ccrCOn textor.Sta te = csPar ticipating );
  959     acFileBr eakLink.En abled := c crContexto r.State =  csParticip ating;
  960   end;
  961  
  962   procedure  TfrmGMV_Us erMain.acS howStatusE xecute(Sen der: TObje ct);
  963   begin
  964     ccrConte xtor.Displ ayStatus;
  965   end;
  966  
  967   procedure  TfrmGMV_Us erMain.fra GMV_GridGr aph1acEnte rVitalsExe cute(
  968     Sender:  TObject);
  969   begin
  970     fraGMV_G ridGraph1. acEnterVit alsExecute (Sender);
  971   end;
  972  
  973   procedure  TfrmGMV_Us erMain.For mResize(Se nder: TObj ect);
  974   var
  975     i, wd, i i: Integer ;
  976     sbpr: TR ect;
  977   const
  978     iCCOW =  1;
  979   begin
  980     Inc(fIgn oreCount);
  981     if fIgno reCount <  2 then
  982       begin
  983         wd : = SB.Width ;
  984         for  i:=SB.Pane ls.Count-1  downto 1  do
  985           wd  := wd - S B.Panels[i ].Width;
  986         SB.P anels[0].W idth := wd ;
  987  
  988         { Pl ace the CC OW context or indicat or on the  status bar  }
  989         SB.P erform(SB_ GETRECT, i CCOW, LPAR AM(@sbpr)) ;
  990         with  ccrContex torIndicat or do
  991           be gin
  992   {$IFDEF TO PCCOWINDIC ATOR}
  993              Parent :=  pnlCCOWInd icator;
  994              Left   :=  pnlCCOWInd icator.Lef t +
  995                (pnlCCOW Indicator. Width - Wi dth)  div  2;
  996              Top    :=  pnlCCOWInd icator.Top   +
  997                (pnlCCOW Indicator. Height  -  Height) di v 2;
  998   {$ELSE}
  999              pnlCCOWInd icator.Vis ible := Fa lse;
  1000              Parent :=  SB;
  1001              Left   :=  sbpr.Left  + (sbpr.Ri ght  - sbp r.Left - W idth)  div  2;
  1002              Top    :=  sbpr.Top   + (sbpr.Bo ttom - sbp r.Top  - H eight) div  2;
  1003   {$ENDIF}
  1004           en d;
  1005       end;
  1006  
  1007     with fra GMV_GridGr aph1 do
  1008       begin
  1009         ii : = grdVital s.ColWidth s[1]+grdVi tals.GridL ineWidth;
  1010         wd : = self.Wid th - pnlPt Select.Wid th - splPt Select.Wid th
  1011           -  pnlGLeft.W idth - pnl GRight.Wid th
  1012           -  grdVitals. ColWidths[ 0];
  1013         wd : = wd mod i i;
  1014         if ( wd > 1) an d (wd < ii ) then
  1015   //         Self.Width  := Self.W idth +grdV itals.ColW idths[1]+1  - wd;
  1016           pn lRight.Wid th := wd -  4;
  1017           pn lRight.Vis ible := Tr ue;
  1018       end;
  1019  
  1020     dec(fIgn oreCount);
  1021   end;
  1022  
  1023   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1024   // CM impl ementaion
  1025   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1026  
  1027   procedure  TfrmGMV_Us erMain.Fin dPatientIn Selector;  // vhaisha ndria 0606 13
  1028   var
  1029     sDFN,sNa me,sSSN,
  1030     sDOB: St ring;
  1031     SL : TSt ringList;
  1032     li: TLis tItem;
  1033   begin
  1034     if Curre ntPtIEN =  '' then Ex it;
  1035  
  1036     bIgnoreL istChanges  := True;
  1037     with frm GMV_Patien tSelector  do
  1038       begin
  1039         if p cMain.Acti vePageInde x = 4 then
  1040           be gin
  1041              ClearListV iew(lvAllP atients);
  1042              cmbAll.Tex t := '';
  1043           en d
  1044         else
  1045           be gin
  1046              if fCurren tPtIEN <>  '' then    // vhaisha ndria 2008 -03-11
  1047                begin
  1048                  pcMain .ActivePag eIndex :=  4;// switc h to "All"  tab if th ere is a P t
  1049                end;
  1050              frmGMV_Pat ientSelect or.pcMainC hange(nil) ;
  1051           en d;
  1052       end;
  1053  
  1054     frmGMV_P atientSele ctor.Clear ListView(f rmGMV_Pati entSelecto r.lvAllPat ients);
  1055     SL := ge tPatientHe ader(fCurr entPtIEN);
  1056     if sl.Co unt > 0 th en
  1057       begin
  1058         sDFN  := sl[0];
  1059         sNam e := piece (sl[1],' ' ,1);
  1060         sSSN  := Format SSN(piece( sl[1],'  ' ,2));
  1061         sDOB  := piece( sl[2],' ', 2);
  1062         li : = frmGMV_P atientSele ctor.lvAll Patients.I tems.Add;
  1063         li.C aption :=  sName;
  1064         li.S ubItems.Ad d(sSSN);
  1065         li.S ubItems.Ad d(sDOB);
  1066         li.D ata := TGM V_FileEntr y.CreateFr omRPC('2;' +sDFN+'^'+ sName);
  1067       end;
  1068     SL.Free;
  1069  
  1070     bIgnoreL istChanges  := False;
  1071     frmGMV_P atientSele ctor.lvAll Patients.I temIndex : = 0;
  1072     frmGMV_P atientSele ctor.Selec tedPatient ID := sDFN ;
  1073     setActio nStatus(fC urrentPtIE N <> '')
  1074   end;
  1075  
  1076   procedure  TfrmGMV_Us erMain.set ActionStat us(aValue: Boolean);
  1077   begin
  1078     acInputV itals.Enab led := aVa lue;
  1079     acPtAlle rgies.Enab led := aVa lue;
  1080     acPatien tInfo.Enab led := aVa lue;
  1081     fraGMV_G ridGraph1. acPatientI nfo.Enable d := aValu e; // true  vhaisahnd ria 2008-0 3-12
  1082     fraGMV_G ridGraph1. acVitalsRe port.Enabl ed := aVal ue;
  1083     fraGMV_G ridGraph1. acShowGrap hReport.En abled := a Value;
  1084     fraGMV_G ridGraph1. Visible :=  aValue;
  1085   end;
  1086  
  1087   function T frmGMV_Use rMain.Sear chPattern: String;
  1088   begin
  1089     if pos('  ',frmGMV_ PatientSel ector.Targ et)=1 then   result : ='the last  patient p rocessed'
  1090     else                                                   result : =frmGMV_Pa tientSelec tor.Target ;
  1091   end;
  1092   {
  1093   function T frmGMV_Use rMain.Sear chStatus:S tring;
  1094   begin
  1095     Result : = frmGMV_P atientSele ctor.sStat us;
  1096   end;
  1097   }
  1098   function T frmGMV_Use rMain.Sear chDelay:St ring;
  1099   begin
  1100     Result : =frmGMV_Pa tientSelec tor.sSecon dsToStart;
  1101     if Resul t = '0.0'  then
  1102       Result  := '';
  1103   end;
  1104  
  1105   function T frmGMV_Use rMain.Sear chMSDelay: Integer;
  1106   begin
  1107     Result : =frmGMV_Pa tientSelec tor.iMSeco ndsToStart ;
  1108   end;
  1109  
  1110   procedure  TfrmGMV_Us erMain.Set StatusBar( sText:Stri ng);
  1111   begin
  1112     sb.Panel s[0].Text  := sText;
  1113   end;
  1114  
  1115   procedure  TfrmGMV_Us erMain.CMP atientList NotFound(v ar Message : TMessage );
  1116   begin
  1117     SetStatu sBar('  Pa ttern <'+S earchPatte rn +'> not  found')
  1118   end;
  1119  
  1120   procedure  TfrmGMV_Us erMain.CMP TSearching (var Messa ge: TMessa ge);
  1121   begin
  1122     SetStatu sBar('  Lo oking for  <'+SearchP attern +'> ');
  1123     DrawDela yClear;
  1124   end;
  1125  
  1126   procedure  TfrmGMV_Us erMain.CMP TSearchDon e(var Mess age: TMess age);
  1127   begin
  1128     SetStatu sBar('');
  1129     DrawDela yClear;
  1130   end;
  1131  
  1132   procedure  TfrmGMV_Us erMain.CMP TSearchSta rt(var Mes sage: TMes sage);
  1133   begin
  1134     DrawDela yClear;
  1135   end;
  1136  
  1137   procedure  TfrmGMV_Us erMain.CMP TSearchDel ay(var Mes sage: TMes sage);
  1138   begin
  1139   //  SetSta tusBar(sea rchStatus) ; commente d vhaishan dria 20080 609
  1140     drawDela y(SearchDe lay, searc hMSDelay);
  1141     Applicat ion.Proces sMessages;
  1142   end;
  1143  
  1144   procedure  TfrmGMV_Us erMain.CMP TSearchKBM ode(var Me ssage: TMe ssage);
  1145   begin
  1146       if sea rchPattern  <> '' the n
  1147         CMPT SearchDela y(Message)
  1148       else
  1149         SetS tatusBar('   Type tar get to sea rch and pr ess <Enter >')
  1150   end;
  1151  
  1152   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1153  
  1154   procedure  TfrmGMV_Us erMain.New PtLookup(S ender: TOb ject);
  1155   {This proc edure proc essing TNo tifyEvents  from fraP tLookup}
  1156   begin
  1157     if Sende r is TfrmG MV_Patient Selector t hen
  1158       begin
  1159         if C CRContexto r.SetPatie ntContext( TfrmGMV_Pa tientSelec tor(Sender ).Selected PatientID)  then
  1160         Curr entPtIEN : = TfrmGMV_ PatientSel ector(Send er).Select edPatientI D;
  1161     end;
  1162   end;
  1163  
  1164   function T frmGMV_Use rMain.GetC urrentTemp late: stri ng;
  1165   begin
  1166     Result : = Piece(FC urrentTemp late, '|',  2);
  1167   end;
  1168  
  1169   procedure  TfrmGMV_Us erMain.Set CurrentTem plate(cons t Value: s tring);
  1170   begin
  1171     FCurrent Template : = Value;
  1172   end;
  1173  
  1174   procedure  TfrmGMV_Us erMain.Fil eExit1Hint (var HintS tr: String ;
  1175     var CanS how: Boole an);
  1176   begin
  1177     Close;
  1178   end;
  1179  
  1180   procedure  TfrmGMV_Us erMain.acP atientInfo Execute(Se nder: TObj ect);
  1181   begin
  1182     if Curre ntPtIEN =  '' then
  1183       Exit;  // vhaisha ndria 2008 -02-12
  1184     ShowPati entInfo(FC urrentPtIE N, '');
  1185   end;
  1186  
  1187   procedure  TfrmGMV_Us erMain.pnl PtInfoClic k(Sender:  TObject);
  1188   begin
  1189     pnlPtInf o.BevelOut er := bvNo ne;
  1190     Applicat ion. Proce ssMessages ;
  1191     if acPat ientInfo.E nabled the n
  1192       acPati entInfo.Ex ecute
  1193     else
  1194       Messag eDlg('Sele ct Patient  first.',  mtInformat ion,[mbOk] , 0);//CCO W 29/04/03  AAN
  1195   end;
  1196  
  1197   procedure  TfrmGMV_Us erMain.pnl PtInfoMous eDown(Send er: TObjec t;
  1198     Button:  TMouseButt on; Shift:  TShiftSta te; X, Y:  Integer);
  1199   begin
  1200     if acPat ientInfo.E nabled the n
  1201       pnlPtI nfo.BevelO uter := bv Lowered;
  1202   end;
  1203  
  1204   procedure  TfrmGMV_Us erMain.pnl PtInfoMous eUp(Sender : TObject;
  1205     Button:  TMouseButt on; Shift:  TShiftSta te; X, Y:  Integer);
  1206   begin
  1207     if acPat ientInfo.E nabled the n
  1208       pnlPtI nfo.BevelO uter := bv None;
  1209   end;
  1210  
  1211   procedure  TfrmGMV_Us erMain.acP tSelectExe cute(Sende r: TObject );
  1212   begin
  1213     pnlPtSel ect.Visibl e := not p nlPtSelect .Visible;
  1214     if not p nlPtSelect .Visible t hen
  1215       begin
  1216         splP tSelect.Al ign := alR ight;
  1217         splP tSelect.Vi sible := F alse;
  1218       end;
  1219     fraGMV_G ridGraph1. pnlPtInfo. Visible :=  not pnlPt Select.Vis ible;
  1220     sbtnPtLo okup.Down  := pnlPtSe lect.Visib le;
  1221     if pnlPt Select.Vis ible then
  1222       begin
  1223         splP tSelect.Vi sible := T rue;
  1224         splP tSelect.Al ign := alL eft;
  1225       end;
  1226     PtSelect 1.Checked  := pnlPtSe lect.Visib le;
  1227   end;
  1228  
  1229   procedure  TfrmGMV_Us erMain.acP tAllergies Execute(Se nder: TObj ect);
  1230   begin
  1231     if Curre ntPtIEN =  '' then
  1232       Exit;  // vhaisha ndria 2008 -02-12
  1233     sbtnAlle rgies.Down  := True;
  1234     ShowPati entAllergi es(Current PtIEN, 'Al lergies fo r: '+lblPa tientName. Caption +
  1235       '  ' +  lblPatien tInfo.Capt ion);
  1236     sbtnAlle rgies.Down  := False;
  1237   end;
  1238  
  1239   procedure  TfrmGMV_Us erMain.acR unReportEx ecute(Send er: TObjec t);
  1240   var
  1241     i: Integ er;
  1242   begin
  1243     i := -1;
  1244   (* vhaisha ndria 2008 -02-21 === ========== ======= re moving vit als report s ========
  1245     if Sende r = mnRepo rtsVitalSi gns then i  := 0
  1246     else if  Sender = m nReportsBP PlottingCh art  then  i := 1
  1247     else if  Sender = m nReportsWe ightChart   then i :=  2
  1248     else if  Sender = m nReportsPO xRespirati onChart  t hen i := 3
  1249     else if  Sender = m nReportsPa inChart  t hen i := 4
  1250     else
  1251   *)
  1252   {$IFDEF PA TCH_5_0_23 }
  1253     if Sende r = mnRepo rtsCumaula tiveVitals Report  th en i := 0  //5
  1254     else if  Sender = m nReportsLa testVitals byLocation   then i : = 1 //6
  1255     else if  Sender = m nReportsLa testVitals DisplayPat ient  then  i := 2 // 7
  1256     else if  Sender = m nReportsVi talsEntere dInError   then i :=  3 //8;
  1257     ;
  1258   {$ELSE}
  1259     if Sende r = mnRepo rtsVitalSi gns then i  := 0
  1260     else if  Sender = m nReportsBP PlottingCh art  then  i := 1
  1261     else if  Sender = m nReportsWe ightChart   then i :=  2
  1262     else if  Sender = m nReportsPO xRespirati onChart  t hen i := 3
  1263     else if  Sender = m nReportsPa inChart  t hen i := 4
  1264     else
  1265     if Sende r = mnRepo rtsCumaula tiveVitals Report  th en i := 5
  1266     else if  Sender = m nReportsLa testVitals byLocation   then i : = 6
  1267     else if  Sender = m nReportsLa testVitals DisplayPat ient  then  i := 7
  1268     else if  Sender = m nReportsVi talsEntere dInError   then i :=  8
  1269     ;
  1270   {$ENDIF}
  1271  
  1272     if i >=  0 then
  1273       PrintR eport2(i,  CurrentPtI EN,lblPati entName.Ca ption+' '+ lblPatient Info.Capti on);
  1274   end;
  1275  
  1276   procedure  TfrmGMV_Us erMain.mnF ilePrinter SetupClick (Sender: T Object);
  1277   begin
  1278     with TPr interSetup Dialog.Cre ate(Applic ation) do
  1279       try
  1280         Exec ute;
  1281       finall y
  1282         free ;
  1283       end;
  1284   end;
  1285  
  1286   procedure  TfrmGMV_Us erMain.mnF ileEntered InErrorCli ck(Sender:  TObject);
  1287   begin
  1288     if Curre ntPtIEN =  '' then
  1289       Messag eDlg('No p atient sel ected, ple ase select  a patient  to contin ue', mtInf ormation,  [mbOK], 0)
  1290     else
  1291       begin
  1292         Ente rVitalsInE rror(Curre ntPtIEN);
  1293         fraG MV_GridGra ph1.Patien tDFN := Cu rrentPtIEN ;
  1294       end;
  1295   end;
  1296  
  1297   procedure  TfrmGMV_Us erMain.mnF ileEditUse rTemplates Click(Send er: TObjec t);
  1298   begin
  1299     EditUser Templates;
  1300   end;
  1301  
  1302   procedure  TfrmGMV_Us erMain.mnF ileUserOpt ionsClick( Sender: TO bject);
  1303   begin
  1304     UpdateUs erSettings ;
  1305   //  fraGMV _GridGraph 1.BGColor  := GMVNorm alBkgd;
  1306     fraGMV_G ridGraph1. BGTodayCol or := GMVN ormalToday Bkgd;
  1307     try
  1308       frmGMV _PatientSe lector.Set TimerInter val(GMVSea rchDelay);
  1309     except
  1310     end;
  1311     if pnlPt Select.Vis ible then
  1312       fraGMV _GridGraph 1.grdVital s.Refresh;
  1313   end;
  1314  
  1315   procedure  TfrmGMV_Us erMain.mnH elpAboutCl ick(Sender : TObject) ;
  1316   begin
  1317     GMVAbout Dlg.Execut e;
  1318   end;
  1319  
  1320   procedure  TfrmGMV_Us erMain.mnH elpIndexCl ick(Sender : TObject) ;
  1321   begin
  1322   //showMess age('Help  Index');
  1323   //Exit;
  1324     Applicat ion.HelpCo mmand(HELP _INDEX, 0) ;
  1325   end;
  1326  
  1327   procedure  TfrmGMV_Us erMain.mnH elpWebClic k(Sender:  TObject);
  1328   var
  1329     s: Strin g;
  1330   begin
  1331   //  ShellE xecute(0,  nil, PChar (GMV_WEBSI TE), nil,  nil, SW_NO RMAL)
  1332     s := get WebLinkAdd ress;
  1333     if s <>  '' then
  1334       ShellE xecute(0,  nil, PChar (S), nil,  nil, SW_NO RMAL)
  1335   end;
  1336  
  1337   procedure  TfrmGMV_Us erMain.Dra wDelay(sDe lay:String ;iDelay:In teger);
  1338   var
  1339     i: Integ er;
  1340     aRect:TR ect;
  1341   begin
  1342     with sb. Canvas do
  1343       begin
  1344         aRec t.Top := 3 ;
  1345         aRec t.Bottom : = sb.Heigh t-2;
  1346         aRec t.Left :=   sb.Panels [0].width  + sb.Panel s[1].width  + 3;
  1347         aRec t.Right :=  sb.Panels [0].width  + sb.Panel s[1].Width  + sb.Pane ls[2].widt h - 10;
  1348         Draw DelayClear ;
  1349  
  1350         Text Rect(aRect ,sb.Panels [0].Width+ sb.Panels[ 1].Width+4 +2,{2}6,sD elay);
  1351  
  1352         aRec t.Top := a Rect.Top +  2;
  1353         aRec t.Bottom : = aRect.Bo ttom -2;
  1354         aRec t.Left :=  aRect.Left  + 2 + 25;
  1355         aRec t.Right :=  aRect.Rig ht - 2;
  1356         i :=  round((aR ect.Right- aRect.Left -25)/10*(i Delay/500) );
  1357         aRec t.Right :=  aRect.Lef t + i;
  1358         Brus h.Color :=  clBlue;
  1359         Fill Rect(aRect );
  1360       end;
  1361   end;
  1362  
  1363   procedure  TfrmGMV_Us erMain.Dra wDelayClea r;
  1364   var
  1365     aRect:TR ect;
  1366   begin
  1367     with sb. Canvas do
  1368       begin
  1369         aRec t.Top := 3 ;
  1370         aRec t.Bottom : = sb.Heigh t-2;
  1371         aRec t.Left :=   sb.Panels [0].width  + 3 + sb.P anels[1].w idth;
  1372         aRec t.Right :=  sb.Panels [0].width  + sb.Panel s[1].Width  + sb.Pane ls[2].Widt h- 10;
  1373         Brus h.Color :=  clBtnFace ;
  1374         Fill Rect(aRect );
  1375       end;
  1376   end;
  1377  
  1378   procedure  TfrmGMV_Us erMain.sbD rawPanel(S tatusBar:  TStatusBar ;
  1379     Panel: T StatusPane l; const R ect: TRect );
  1380   begin
  1381     if Panel  = sb.Pane ls[2] then   DrawDela yClear;
  1382   end;
  1383  
  1384   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1385  
  1386   procedure  TfrmGMV_Us erMain.Set ReportsAct ive(bState : Boolean) ;
  1387   begin
  1388     mnReport sLatestVit alsDisplay Patient.En abled := b State;
  1389     mnReport sVitalsEnt eredInErro r.Enabled  := bState;
  1390     mnFileEn teredInErr or.Enabled  := bState ;
  1391  
  1392     acPatien tInfo.Enab led := bSt ate;
  1393     fraGMV_G ridGraph1. acGraphBut tons.Enabl ed := bSta te;
  1394   end;
  1395  
  1396   procedure  TfrmGMV_Us erMain.pnl PtSelectRe size(Sende r: TObject );
  1397   begin
  1398     pnlPtInf o.Width :=  pnlPtSele ct.Width;
  1399   end;
  1400  
  1401   procedure  TfrmGMV_Us erMain.acP atientSele ctExecute( Sender: TO bject);
  1402   var
  1403     aDFN,aNa me:String;
  1404   begin
  1405     if Selec tPatientDF N(aDFN,aNa me) then
  1406       ShowMe ssage('Sel ected Pati ent: <'+an ame+'/'+aD FN+'>');
  1407   end;
  1408  
  1409   procedure  TfrmGMV_Us erMain.CMP TLISTCHANG ED(var Mes sage: TMes sage);
  1410   var
  1411     bValue:  Boolean;
  1412   begin
  1413     if bIgno reListChan ges then E xit;
  1414     acGroupI nput.Enabl ed := (frm GMV_Patien tSelector. SelectCoun t > 1);//  vhaishandr ia 2008-05 -20
  1415     // moved  from setC COWActionS tatus
  1416   {
  1417     setCCOWA ctionsStat us(
  1418       (frmGM V_PatientS elector.Se lectCount  <= 1) and
  1419       (fraGM V_GridGrap h1.Patient DFN <> '')
  1420       );
  1421   }
  1422     // vhais handria 06 0608  ---- ---------- ---------- ---------- ---------- ---- Start
  1423     bValue : =
  1424       (frmGM V_PatientS elector.Fo cusedPatie ntID = frm GMV_Patien tSelector. SelectedPa tientID)
  1425       and (f rmGMV_Pati entSelecto r.Selected PatientID  <> '') //  2008-03-06  vhaishand ria
  1426       and (f rmGMV_Pati entSelecto r.Selected PatientID  = FCurrent PtIEN) //  2008-03-06  vhaishand ria
  1427       ;
  1428  
  1429     setActio nStatus(bV alue);
  1430     // vhais handria 06 0608  ---- ---------- ---------- ---------- ---------- ----- Stop
  1431   {
  1432     eventAdd (
  1433       'Patie nt Change  Notificati on (MSG)',
  1434       '----- ---------- ---------- --'+#13#10 +
  1435       'Curre nt Parient  DFN:..... . '+ FCurr entPtIEN +  #13#10 +
  1436       'Grid- Fraph Pari ent DFN:.. . '+ fraGM V_GridGrap h1.Patient DFN);
  1437   }
  1438   end;
  1439  
  1440   procedure  TfrmGMV_Us erMain.For mClose(Sen der: TObje ct;
  1441     var Acti on: TClose Action);
  1442   var
  1443     s: Strin g;
  1444   begin
  1445     Applicat ionEvents. OnHelp :=  nil;// vha ishandria  2007-11-08
  1446     try
  1447       s := I ntToStr(fr mGMV_Patie ntSelector .pcMain.Ta bIndex);
  1448       setUse rSettings( 'SELECTOR_ TAB',s);
  1449  
  1450   //    s :=  IntToStr( frmGMV_Pat ientSelect or.Patient Group.Item Index);
  1451   //    setU serSetting s('SELECTO R_GROUP_IN DEX',s);
  1452  
  1453       s := I ntToStr(fr mGMV_Patie ntSelector .lbUnits.I temIndex);
  1454       setUse rSettings( 'UNIT_INDE X',s);
  1455       s := I ntToStr(fr mGMV_Patie ntSelector .lbWards.I temIndex);
  1456       setUse rSettings( 'WARD_INDE X',s);
  1457       s := I ntToStr(fr mGMV_Patie ntSelector .lbTeams.I temIndex);
  1458       setUse rSettings( 'TEAM_INDE X',s);
  1459       s := I ntToStr(fr mGMV_Patie ntSelector .lbClinics .ItemIndex );
  1460       setUse rSettings( 'CLINIC_IN DEX',s);
  1461  
  1462     except
  1463     end;
  1464  
  1465     fraGMV_G ridGraph1. SaveStatus ;
  1466   end;
  1467  
  1468   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1469   procedure  TfrmGMV_Us erMain.acI nputVitals Execute(Se nder: TObj ect);
  1470   var
  1471     sHospita lInfo,
  1472     sLocatio nName,sLoc ationID
  1473   //  ,sName ,sInfo
  1474     : string ;
  1475   //  lvInde x: integer ;
  1476  
  1477   begin
  1478   {$IFDEF RO RCCOW}
  1479     if (Pati entList.Se lCount > 1 ) and (ccr Contextor. State = Cs Participat ing) then
  1480       begin  // Leave C COW contex t begore u sint this  mode;
  1481         Show Message('Y ou must le ave the CC OW patient  context t o work '+
  1482                      'w ith multip le patient s.'+#13+
  1483                      'T o do this  choose Fil e| Break t he Clinica l Link');
  1484         Exit ;
  1485       end;
  1486   {$ENDIF}
  1487  
  1488     if (Curr entPtIEN =  '') and ( PatientLis t.SelCount  > 1) then
  1489       begin
  1490         Curr entPtIEN : = TGMV_Fil eEntry(frm GMV_Patien tSelector. PatientLis t.Selected .Data).IEN ;
  1491         frmG MV_Patient Selector.S etCurrentL ocation;
  1492  
  1493         sHos pitalInfo  := getHosp italLocati onByID(Cur rentPtIEN) ;
  1494  
  1495         if ( sHospitalI nfo = '')  or (sHospi talInfo =  '0') or (p os('-1',sH ospitalInf o) = 1) th en
  1496           be gin
  1497              if not Sel ectLocatio n2(Current PtIEN,sLoc ationID,sL ocationNam e) then
  1498                begin
  1499                  ShowMe ssage('Sor ry, you mu st enter a  location. ..');
  1500                  Exit;
  1501                end;
  1502           en d
  1503         else
  1504           be gin
  1505              sLocationI D := sHosp italInfo;
  1506              sLocationN ame := get FileField( '44','.01' ,sLocation ID);
  1507           en d;
  1508       end
  1509     else
  1510  
  1511     if (Curr entPtIEN < > '') and  (PatientLi st.SelCoun t <= 1) th en
  1512       begin
  1513         sLoc ationID :=   frmGMV_P atientSele ctor.Selec tedPatient LocationID ;
  1514         sLoc ationName  := frmGMV_ PatientSel ector.Sele ctedPatien tLocationN ame;
  1515  
  1516         if s LocationID  = '' then
  1517           be gin
  1518              sHospitalI nfo := get HospitalLo cationByID (CurrentPt IEN);
  1519  
  1520              if (sHospi talInfo =  '') or (sH ospitalInf o = '0') o r (pos('-1 ',sHospita lInfo) = 1 ) then
  1521                begin
  1522                  if not  SelectLoc ation2(Cur rentPtIEN, sLocationI D,sLocatio nName) the n
  1523                    begi n
  1524                      Sh owMessage( 'Sorry, yo u must ent er a locat ion...');
  1525                      Ex it;
  1526                    end;
  1527                end
  1528              else
  1529                begin
  1530                  sLocat ionID := s HospitalIn fo;
  1531                  sLocat ionName :=  getFileFi eld('44',' .01',sLoca tionID);
  1532                end;
  1533           en d
  1534         else
  1535           sH ospitalInf o := sLoca tionID;
  1536  
  1537       end;
  1538       if (Cu rrentPtIEN  <> '') an d (Patient List.SelCo unt <= 1)  then
  1539         begi n
  1540   {$IFDEF RO RCCOW}
  1541           St artPatient Edit;
  1542   {$ENDIF}
  1543           In putVitals( CurrentPtI EN,sLocati onID, FCur rentTempla te,nil,sLo cationName );
  1544  
  1545           fr aGMV_GridG raph1.Pati entDFN :=  CurrentPtI EN;
  1546   {$IFDEF RO RCCOW}
  1547           En dPatientEd it;
  1548   {$ENDIF}
  1549         end
  1550   end;
  1551  
  1552  
  1553   procedure  TfrmGMV_Us erMain.acG roupInputE xecute(Sen der: TObje ct);
  1554   var
  1555     sLocatio nName,sLoc ationID,
  1556     sName,sI nfo: strin g;
  1557     lvIndex:  integer;
  1558     LI: TLis tItem;
  1559     LV: TLis tView;
  1560  
  1561     function  NewPatien tListView: TListView;
  1562     var
  1563       LView: TListView;
  1564       LC:TLi stColumn;
  1565     begin
  1566       LView  := TListVi ew.Create( Self);
  1567       LView. Visible :=  false;
  1568       LView. Parent :=  self;
  1569  
  1570       LC :=  LView.Colu mns.Add;
  1571       LC.Cap tion := 'N ame';
  1572       LC :=  LView.Colu mns.Add;
  1573       LC.Cap tion := 'I D';
  1574       LC :=  LView.Colu mns.Add;
  1575       LC.Cap tion := 'D escription ';
  1576       LC :=  LView.Colu mns.Add;
  1577       LC.Cap tion := 'D escription 2';
  1578  
  1579       Result  := LView;
  1580     end;
  1581  
  1582     function  ConfirmSe lection(an Index:Inte ger):Boole an;
  1583     begin
  1584       with P atientList  do
  1585         begi n
  1586           if  SelCount  >= 1 then
  1587              Result :=  Items[anIn dex].Selec ted and
  1588                PatientC heckSelect ByDFN(TGMV _FileEntry (Items[lvI ndex].Data ).IEN,sNam e,sInfo)
  1589           el se
  1590              result :=
  1591                PatientC heckSelect ByDFN(TGMV _FileEntry (Items[lvI ndex].Data ).IEN,sNam e,sInfo);
  1592         end;
  1593     end;
  1594  
  1595   begin
  1596   {$IFDEF RO RCCOW}
  1597     if (Pati entList.Se lCount > 1 ) and (ccr Contextor. State = Cs Participat ing) then
  1598       begin  // Leave C COW contex t begore u sing list  input mode ;
  1599         if M essageDlg(
  1600           'Y ou must le ave the CC OW patient  context t o work '+
  1601           'w ith multip le patient s.'+#13+
  1602           'D o you want  to break  the Clinic al Link no w?',
  1603           mt Confirmati on, [mbYes , mbNo], 0 ) = mrYes  then
  1604           be gin
  1605              if not acF ileBreakLi nk.Execute  then
  1606                begin
  1607                  ShowMe ssage('Err or breakin g the Clin ical Link' );
  1608                  Exit;
  1609                end
  1610              else
  1611                setCCOWA ctionsStat us(true);
  1612           en d
  1613         else
  1614           Ex it;
  1615       end;
  1616   {$ENDIF}
  1617  
  1618   // 060927  vhaishandr ia - no ne ed to chan ge the Con text -
  1619   //                         we ar e not part icipating  in the con text at th is point
  1620   //  sID :=  TGMV_File Entry(frmG MV_Patient Selector.P atientList .Selected. Data).IEN;
  1621   //  if CCR Contextor. SetPatient Context(sI D) then
  1622   //    Curr entPtIEN : = sID;
  1623  
  1624   //  frmGMV _PatientSe lector.Set CurrentLoc ation; vha ishandria  2008-02-27
  1625   // 2007-10 -04 vhaish andria --- ---------- ---------- ---------- ---------- ---- begin
  1626   (* 2007-10 -04 ------ ---------- ---------- ---------- ---------- ---------- ----------
  1627     sHospita lInfo := g etHospital LocationBy ID(Current PtIEN);
  1628  
  1629     if (sHos pitalInfo  = '') or ( sHospitalI nfo = '0')  or (pos(' -1',sHospi talInfo) =  1) then
  1630       begin
  1631         if n ot SelectL ocation2(C urrentPtIE N,sLocatio nID,sLocat ionName) t hen
  1632           be gin
  1633              ShowMessag e('Sorry,  you must e nter a loc ation...') ;
  1634              setCCOWAct ionsStatus (PatientLi st.SelCoun t<=1);
  1635              Exit;
  1636           en d;
  1637       end
  1638     else
  1639       begin
  1640         sLoc ationID :=  sHospital Info;
  1641         sLoc ationName  := getFile Field('44' ,'.01',sLo cationID);
  1642       end;
  1643   ---------- ---------- ---------- ---------- ---------- ---------- ------ 200 7-10-04 *)
  1644     frmGMV_P atientSele ctor.setPa tientLocat ionIDByFir stSelected Patient; / / vhaishan dria 2008- 02-28
  1645  
  1646     if frmGM V_PatientS elector.Pa tientLocat ionID = ''  then
  1647       begin
  1648         if n ot SelectL ocation2(C urrentPtIE N,sLocatio nID,sLocat ionName) t hen
  1649           be gin
  1650              ShowMessag e('Sorry,  you must e nter a loc ation...') ;
  1651   //           setCCOWA ctionsStat us(Patient List.SelCo unt<=1);    // commen ted  2008- 05-20
  1652              Exit;
  1653           en d;
  1654       end
  1655     else
  1656       begin
  1657         sLoc ationID :=  frmGMV_Pa tientSelec tor.Patien tLocationI D;
  1658         sLoc ationName  := getFile Field('44' ,'.01', sL ocationID) ;
  1659       end;
  1660   // 2007-10 -04 vhaish andria --- ---------- ---------- ---------- ---------- ------ end
  1661  
  1662     LV := Ne wPatientLi stView;
  1663     for lvIn dex := 0 t o PatientL ist.Items. Count - 1  do
  1664       if Con firmSelect ion(lvInde x) then
  1665         begi n
  1666           LI  := LV.Ite ms.Add;
  1667           LI .SubItems. Add(sName) ;
  1668           LI .SubItems. Add(TGMV_F ileEntry(P atientList .Items[lvI ndex].Data ).IEN);
  1669           LI .SubItems. Add(sInfo) ;
  1670         end;
  1671     if (LV.I tems.Count <1) then
  1672         Mess ageDLG('No t enough i nformation  to start  input'+#13 +
  1673           'S elect one  or more pa tients to  proceed',M TinFORMATI ON ,[MBok] ,0)
  1674     else
  1675       InputV itals('',  sLocationI D, FCurren tTemplate, LV,sLocati onName);
  1676  
  1677   // 060927  vhaishandr ia - no ne ed to chan ge the Con text -
  1678   //                         we ar e not part icipating  in the con text at th is point
  1679   //  sID :=  TGMV_File Entry(frmG MV_Patient Selector.P atientList .Selected. Data).IEN;
  1680   //  if CCR Contextor. SetPatient Context(sI D) then
  1681   //    Curr entPtIEN : = sID;
  1682  
  1683   //  setCCO WActionsSt atus(Patie ntList.Sel Count<=1);  commented  2008-05-2 0
  1684  
  1685     LV.Free;
  1686  
  1687     frmGMV_P atientSele ctor.Patie ntList.Cle arSelectio n;
  1688   end;
  1689  
  1690  
  1691   procedure  TfrmGMV_Us erMain.CMP TPeriodCha nged(var M essage: TM essage); / /AAN 07/18 /02
  1692   begin
  1693     lblDateF romTitle.C aption :=  fraGMV_Gri dGraph1.lb lDateFromT itle.Capti on;
  1694   end;
  1695  
  1696   function T frmGMV_Use rMain.getp atientList : TListVie w;  // vha ishandria  050706
  1697   begin
  1698     Result : = nil;
  1699     if not A ssigned(fP atientSele ctorForm)  then Exit;
  1700     Result : = fPatient SelectorFo rm.Patient List;
  1701   end;
  1702  
  1703   procedure  TfrmGMV_Us erMain.acD evInfoExec ute(Sender : TObject) ;
  1704   var
  1705     s: Strin g;
  1706   begin
  1707     try
  1708       with T VersionInf o.Create(s elf) do
  1709       try
  1710         s :=  '  '+Prod uctName +  ' v.'+File Version+'   '+getKey( 'Developer Info');
  1711         SetS tatusBar(s );
  1712         Appl ication.Pr ocessMessa ges;
  1713         slee p(3000);
  1714         SetS tatusBar(' ');
  1715       finall y
  1716         free ;
  1717       end;
  1718     except
  1719     end;
  1720   end;
  1721  
  1722   procedure  TfrmGMV_Us erMain.For mKeyDown(S ender: TOb ject; var  Key: Word;
  1723     Shift: T ShiftState );
  1724   begin
  1725     case Key  of
  1726       word(V K_F1):
  1727         if s sCtrl in S hift then
  1728           ac DevInfoExe cute(nil)
  1729         else
  1730           Ap plication. HelpComman d(HELP_IND EX, 0);
  1731       word(V K_RETURN):  if (Activ eControl=  pnlPtInfo)
  1732         and  (pnlPtInfo .BevelOute r = bvRais ed) then
  1733           fr aGMV_GridG raph1.acPa tientInfo. Execute; / / vhaishan dria 06030 9
  1734     end;
  1735   end;
  1736  
  1737   procedure  TfrmGMV_Us erMain.fra GMV_GridGr aph1SpeedB utton1Clic k(Sender:  TObject);
  1738   begin
  1739     fraGMV_G ridGraph1. sbGraphCol orClick(Se nder);
  1740   end;
  1741  
  1742   procedure  TfrmGMV_Us erMain.mnF ileExitCli ck(Sender:  TObject);
  1743   begin
  1744     Close;
  1745   end;
  1746      DN S      BELLC
  1747   function T frmGMV_Use rMain.Appl icationEve ntsHelp(Co mmand: Wor d;
  1748     Data: In teger; var  CallHelp:  Boolean):  Boolean;
  1749   var
  1750     s: Strin g;
  1751     iHelp: I nteger;
  1752   begin
  1753     Applicat ionEvents. CancelDisp atch;
  1754     s := Ext ractFileDi r(Applicat ion.ExeNam e) + '\Hel p\'+
  1755       Change FileExt(Ex tractFileN ame(Applic ation.ExeN ame),'.hlp ');
  1756     if Assig ned(Active Control) t hen
  1757       begin
  1758         iHel p := Activ eControl.H elpContext ;
  1759         if i Help = 0 t hen iHelp  := 1;
  1760  
  1761         Appl ication.He lpSystem.S howContext Help(iHelp ,s);
  1762         Call Help := Fa lse;
  1763       end;
  1764     Result : = True;
  1765   end;  }
  1766  
  1767   procedure  TfrmGMV_Us erMain.pnl PtInfoEnte r(Sender:  TObject);
  1768   begin
  1769     pnlPtInf o.BevelOut er := bvRa ised;
  1770   end;
  1771  
  1772   procedure  TfrmGMV_Us erMain.pnl PtInfoExit (Sender: T Object);
  1773   begin
  1774     pnlPtInf o.BevelOut er := bvNo ne;
  1775   end;
  1776  
  1777   procedure  TfrmGMV_Us erMain.Sho wLog1Click (Sender: T Object);
  1778   begin
  1779     ShowRPCL og;
  1780   end;
  1781  
  1782   (*
  1783   procedure  getLocatio nDescripti on(aDFN:St ring;var a LocationNa me:String;  var aLoca tionID:Str ing);
  1784   var
  1785     aPt:TPat ient;
  1786   begin
  1787      aPt :=  TPatient.C reatePatie ntByDFN(aD FN);
  1788      aLocati onName :=  aPT.Locati onName;
  1789      aLocati onID := aP t.Location ID;
  1790      aPT.Fre e;
  1791   end;
  1792   *)
  1793   procedure  TfrmGMV_Us erMain.Pat ientInquir y1Click(Se nder: TObj ect);
  1794   begin
  1795     fraGMV_G ridGraph1. acPatientI nfoExecute (Sender);
  1796   end;
  1797  
  1798   procedure  TfrmGMV_Us erMain.Dat aGridRepor t1Click(Se nder: TObj ect);
  1799   begin
  1800     if Curre ntPtIEN =  '' then
  1801       Exit;  // vhaisha ndria 2008 -02-12
  1802     fraGMV_G ridGraph1. acVitalsRe portExecut e(Sender);
  1803   end;
  1804  
  1805   procedure  TfrmGMV_Us erMain.WMG etMinMaxIn fo( var Me ssage :TWM GetMinMaxI nfo );
  1806   var
  1807     wd,ii: I nteger;
  1808   const
  1809     delta =  2;//border s;
  1810   begin
  1811     exit;
  1812     if not a ssigned(fr aGMV_GridG raph1) the n Exit;
  1813     with fra GMV_GridGr aph1 do
  1814       begin
  1815         ii : = grdVital s.ColWidth s[1];
  1816         wd : = Screen.W idth
  1817           -  pnlPtSelec t.Width -  splPtSelec t.Width -  grdVitals. ColWidths[ 0];
  1818         wd : = wd mod ( ii+1);
  1819         if ( wd > 1) an d (wd < ii ) then
  1820           wd  := Screen .Width - w d;
  1821       end;
  1822     with Mes sage.MinMa xInfo^ do
  1823     begin
  1824       ptMaxS ize.X := w d;                               {Width whe n maximize d}
  1825       ptMaxS ize.Y := S creen.Work AreaHeight ;          {Height wh en maximiz ed}
  1826       ptMaxP osition.X  := (Screen .Width - w d) div 2;  {Left posi tion when  maximized}
  1827  
  1828   //    ptMa xPosition. Y := (Scre en.Height  - Screen.W orkAreaHei ght) div 2 ; {Top pos ition when  maximized }
  1829   //    ptMi nTrackSize .X := 100;             {Minimum  width}
  1830   //    ptMi nTrackSize .Y := 100;             {Minimum  height}
  1831   //    ptMa xTrackSize .X := 300;             {Maximum  width}
  1832   //    ptMa xTrackSize .Y := 300;             {Maximum  height}
  1833     end;
  1834     Message. Result :=  0;                  { Tell windo ws you hav e changed  minmaxinfo }
  1835     inherite d;
  1836   end;
  1837  
  1838  
  1839   procedure  TfrmGMV_Us erMain.For mActivate( Sender: TO bject);
  1840   begin
  1841     try
  1842       if Ass igned(frmG MV_Patient Selector)  then
  1843         frmG MV_Patient Selector.p cMainChang e(nil);
  1844       setAct ionStatus( CurrentPtI EN <> '');
  1845     except
  1846     end;
  1847   end;
  1848  
  1849   procedure  TfrmGMV_Us erMain.Sho wHideGraph Options1Cl ick(Sender : TObject) ;
  1850   begin
  1851     fraGMV_G ridGraph1. acGraphOpt ionsExecut e(Sender);
  1852     ShowHide GraphOptio ns1.Checke d := fraGM V_GridGrap h1.pnlGrap hOptions.V isible;
  1853   end;
  1854  
  1855   procedure  TfrmGMV_Us erMain.Sho wGraphRepo rt1Click(S ender: TOb ject);
  1856   begin
  1857     fraGMV_G ridGraph1. acShowGrap hReportExe cute(Sende r);
  1858  
  1859   end;
  1860  
  1861   end.
  1862  
  1863