34. EPMO Open Source Coordination Office Redaction File Detail Report

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

34.1 Files compared

# Location File Last Modified
1 CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSDATAENTRY fGMV_InputLite.pas Tue Dec 13 18:25:46 2016 UTC
2 CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSDATAENTRY fGMV_InputLite.pas Fri Mar 31 15:01:31 2017 UTC

34.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 5448
Changed 3 6
Inserted 0 0
Removed 0 0

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

34.4 Active regular expressions

No regular expressions were active.

34.5 Comparison detail

  1   unit fGMV_ InputLite;
  2  
  3   {
  4     ======== ========== ========== ========== ========== ========== ========== ========== ==
  5     *
  6     *        Applicatio n:  Vitals
  7     *        Revision:      $Revis ion: 1 $   $Modtime:  4/17/09 2: 31p $
  8     *        Developer:      PII                                             
  9     *        Site:          Hines  OIFO
  10     *
  11     *        Descriptio n:  Main f orm for en tering a n ew series  of vitals  for pt.
  12     *
  13     *        Notes:
  14     *
  15     ======== ========== ========== ========== ========== ========== ========== ========== ==
  16     *        $Archive:  /Vitals/5. 0 (Version  5.0)/5.0. 23 (Patch  23)/VITALS _5_0_23_8/ Source/VIT ALSDATAENT RY/fGMV_In putLite.pa s $
  17     *
  18     * $Histo ry: fGMV_I nputLite.p as $
  19     *
  20     * ****** ********** *  Version  1  ****** ********** *
  21     * User:  Vhaishandr ia Date: 8 /12/09     Time: 8:29 a
  22     * Create d in $/Vit als/5.0 (V ersion 5.0 )/5.0.23 ( Patch 23)/ VITALS_5_0 _23_8/Sour ce/VITALSD ATAENTRY
  23     *
  24     * ****** ********** *  Version  1  ****** ********** *
  25     * User:  Vhaishandr ia Date: 3 /09/09     Time: 3:38 p
  26     * Create d in $/Vit als/5.0 (V ersion 5.0 )/5.0.23 ( Patch 23)/ VITALS_5_0 _23_6/Sour ce/VITALSD ATAENTRY
  27     *
  28     * ****** ********** *  Version  2  ****** ********** *
  29     * User:  Vhaishandr ia Date: 1 /20/09     Time: 3:42 p
  30     * Update d in $/Vit als/5.0 (V ersion 5.0 )/5.0.23 ( Patch 23)/ VITALS_5_0 _23_4/Sour ce/VITALSD ATAENTRY
  31     *
  32     * ****** ********** *  Version  1  ****** ********** *
  33     * User:  Vhaishandr ia Date: 1 /13/09     Time: 1:26 p
  34     * Create d in $/Vit als/5.0 (V ersion 5.0 )/5.0.23 ( Patch 23)/ VITALS_5_0 _23_4/Sour ce/VITALSD ATAENTRY
  35     *
  36     * ****** ********** *  Version  7  ****** ********** *
  37     * User:  Vhaishandr ia Date: 6 /17/08     Time: 4:04 p
  38     * Update d in $/Vit als/5.0 (V ersion 5.0 )/VitalsGU I2007/Vita ls/VITALSD ATAENTRY
  39     *
  40     * ****** ********** *  Version  5  ****** ********** *
  41     * User:  Vhaishandr ia Date: 3 /03/08     Time: 4:07 p
  42     * Update d in $/Vit als GUI 20 07/Vitals/ VITALSDATA ENTRY
  43     *
  44     * ****** ********** *  Version  4  ****** ********** *
  45     * User:  Vhaishandr ia Date: 2 /20/08     Time: 1:42 p
  46     * Update d in $/Vit als GUI 20 07/Vitals/ VITALSDATA ENTRY
  47     * Build  5.0.23.0
  48     *
  49     * ****** ********** *  Version  3  ****** ********** *
  50     * User:  Vhaishandr ia Date: 1 /07/08     Time: 6:51 p
  51     * Update d in $/Vit als GUI 20 07/Vitals/ VITALSDATA ENTRY
  52     *
  53     * ****** ********** *  Version  2  ****** ********** *
  54     * User:  Vhaishandr ia Date: 7 /17/07     Time: 2:30 p
  55     * Update d in $/Vit als GUI 20 07/Vitals- 5-0-18/VIT ALSDATAENT RY
  56     *
  57     * ****** ********** *  Version  1  ****** ********** *
  58     * User:  Vhaishandr ia Date: 5 /14/07     Time: 10:2 9a
  59     * Create d in $/Vit als GUI 20 07/Vitals- 5-0-18/VIT ALSDATAENT RY
  60     *
  61     * ****** ********** *  Version  1  ****** ********** *
  62     * User:  Vhaishandr ia Date: 5 /16/06     Time: 5:43 p
  63     * Create d in $/Vit als/VITALS -5-0-18/Vi talsDataEn try
  64     * GUI v.  5.0.18 up dates the  default vi tal type I ENs with t he local
  65     * values .
  66     *
  67     * ****** ********** *  Version  1  ****** ********** *
  68     * User:  Vhaishandr ia Date: 5 /16/06     Time: 5:33 p
  69     * Create d in $/Vit als/Vitals -5-0-18/VI TALS-5-0-1 8/VitalsDa taEntry
  70     *
  71     * ****** ********** *  Version  4  ****** ********** *
  72     * User:  Vhaishandr ia Date: 7 /22/05     Time: 3:51 p
  73     * Update d in $/Vit als/Vitals  GUI  v 5. 0.2.1 -5.0 .3.1 - Pat ch GMVR-5- 7 (CASMed,  CCOW) - D elphi 6/Vi talsDataEn try
  74     *
  75     * ****** ********** *  Version  3  ****** ********** *
  76     * User:  Vhaishandr ia Date: 7 /06/05     Time: 12:1 1p
  77     * Update d in $/Vit als/Vitals  GUI  v 5. 0.2.1 -5.0 .3.1 - Pat ch GMVR-5- 7 (CASMed,  CCOW) - D elphi 6/Vi talsDataEn try
  78     *
  79     * ****** ********** *  Version  2  ****** ********** *
  80     * User:  Vhaishandr ia Date: 7 /05/05     Time: 9:38 a
  81     * Update d in $/Vit als/Vitals  GUI  v 5. 0.2.1 -5.0 .3.1 - Pat ch GMVR-5- 7 (CASMed,  No CCOW)  - Delphi 6 /VitalsDat aEntry
  82     *
  83     * ****** ********** *  Version  1  ****** ********** *
  84     * User:  Vhaishandr ia Date: 5 /24/05     Time: 3:35 p
  85     * Create d in $/Vit als/Vitals  GUI  v 5. 0.2.1 -5.0 .3.1 - Pat ch GMVR-5- 7 (CASMed,  No CCOW)  - Delphi 6 /VitalsDat aEntry
  86     *
  87     * ****** ********** *  Version  2  ****** ********** *
  88     * User:  Vhaishandr ia Date: 4 /23/04     Time: 1:21 p
  89     * Update d in $/Vit als/Vitals  GUI Versi on 5.0.3 ( CCOW, CPRS , Delphi 7 )/VITALSDA TAENTRY
  90     *
  91     * ****** ********** *  Version  1  ****** ********** *
  92     * User:  Vhaishandr ia Date: 4 /16/04     Time: 4:20 p
  93     * Create d in $/Vit als/Vitals  GUI Versi on 5.0.3 ( CCOW, CPRS , Delphi 7 )/VITALSDA TAENTRY
  94     *
  95     * ****** ********** *  Version  2  ****** ********** *
  96     * User:  Vhaishandr ia Date: 2 /06/04     Time: 4:47 p
  97     * Update d in $/Vit alsLite/Vi talsLiteDL L
  98     *
  99     * ****** ********** *  Version  1  ****** ********** *
  100     * User:  Vhaishandr ia Date: 1 /30/04     Time: 4:30 p
  101     * Create d in $/Vit alsLite/Vi talsLiteDL L
  102     *
  103     * ****** ********** *  Version  1  ****** ********** *
  104     * User:  Vhaishandr ia Date: 1 /15/04     Time: 3:06 p
  105     * Create d in $/Vit alsLite/Vi talsLiteDL L
  106     * Vitals  Lite DLL
  107     *
  108     ======== ========== ========== ========== ========== ========== ========== ========== ==
  109   }
  110   interface
  111  
  112   uses
  113     Windows,
  114     ShellAPI ,
  115     Messages ,
  116     SysUtils ,
  117     System.D ateUtils,  {for incMi nute}
  118     Classes,
  119     Graphics ,
  120     Controls ,
  121     Forms,
  122     Dialogs,
  123     StdCtrls ,
  124     ExtCtrls ,
  125     ComCtrls ,
  126     Menus,
  127     StdActns ,
  128     ActnList ,
  129     ImgList,
  130     ToolWin,
  131     Buttons,
  132     Grids,
  133     uGMV_Tem plate,
  134     uGMV_Con st,
  135     AppEvnts ,
  136     Math
  137   {$IFDEF US EVSMONITOR }
  138       ,
  139     uGMV_Mon itor,
  140     uVHA_ATE 740X,
  141     System.A ctions,
  142     System.I mageList
  143   {$ENDIF}
  144       ;
  145  
  146   type
  147     TfrmGMV_ InputLite  = class(TF orm)
  148       pnlBot tom: TPane l;
  149       pnlInp ut: TPanel ;
  150       pnlPar ams: TPane l;
  151       pnlTem plates: TP anel;
  152       gbxTem plates: TG roupBox;
  153       imgTem plates: TI mageList;
  154       Panel2 : TPanel;
  155       Panel4 : TPanel;
  156       Panel5 : TPanel;
  157       Panel6 : TPanel;
  158       tv: TT reeView;
  159       pnlTem plInfo: TP anel;
  160       lblTem plInfo: TL abel;
  161       splPar ams: TSpli tter;
  162       splLas tVitals: T Splitter;
  163       pnlBut tons: TPan el;
  164       btnSav e: TButton ;
  165       btnCan cel: TButt on;
  166       alInpu tVitals: T ActionList ;
  167       acMetr icStyleCha nge: TActi on;
  168       acSave Preference s: TAction ;
  169       acLoad Preference s: TAction ;
  170       acPati entSelecte d: TAction ;
  171       splPat ients: TSp litter;
  172       pnlToo ls: TPanel ;
  173       pnlPat ient: TPan el;
  174       pnlSet tings: TPa nel;
  175       lblHos pital: TLa bel;
  176       lblDat eTime: TLa bel;
  177       acTemp lateClicke d: TAction ;
  178       acSetO nPass: TAc tion;
  179       acSave Input: TAc tion;
  180       ImageL ist1: TIma geList;
  181       acChec kBoxesChan ge: TActio n;
  182       PopupM enu2: TPop upMenu;
  183       Patien OnPass1: T MenuItem;
  184       acDate TimeSelect or: TActio n;
  185       acHosp italSelect or: TActio n;
  186       acTemp lateSelect : TAction;
  187       lblHos pitalCap:  TLabel;
  188       Label2 : TLabel;
  189       tlbInp ut: TToolB ar;
  190       sbtnHo spitals: T SpeedButto n;
  191       acPara msShowHide : TAction;
  192       acVita lsShowHide : TAction;
  193       acAdju stToolbars : TAction;
  194       acTemp lateSelect or: TActio n;
  195       ToolBu tton2: TTo olButton;
  196       sbtnTe mplates: T SpeedButto n;
  197       pnlInp utTemplate : TPanel;
  198       pnlInp utTemplate Header: TP anel;
  199       hc: TH eaderContr ol;
  200       pnlScr ollBox: TP anel;
  201       sbxMai n: TScroll Box;
  202       pnlLat estVitalsB g: TPanel;
  203       pnlLat estVitalsH eader: TPa nel;
  204       pnlOpt ions: TPan el;
  205       bvU: T Bevel;
  206       ckbOnP ass: TChec kBox;
  207       pnlCPR SMetricSty le: TPanel ;
  208       chkCPR SSTyle: TC heckBox;
  209       Bevel1 : TBevel;
  210       Panel1 3: TPanel;
  211       strgLV : TStringG rid;
  212       Window Close1: TW indowClose ;
  213       bvUnav ailable: T Bevel;
  214       lblUna vailable:  TLabel;
  215       ckbUna vailable:  TCheckBox;
  216       chkbCl oseOnSave:  TCheckBox ;
  217       chkOne Unavailabl eBox: TChe ckBox;
  218       acUnav ailableBox Status: TA ction;
  219       gbDate Time: TGro upBox;
  220       dtpDat e: TDateTi mePicker;
  221       dtpTim e: TDateTi mePicker;
  222       sbtnTo olShowPara ms: TSpeed Button;
  223       pnlPar amTools: T Panel;
  224       SpeedB utton4: TS peedButton ;
  225       SpeedB utton3: TS peedButton ;
  226       SpeedB utton2: TS peedButton ;
  227       Panel1 0: TPanel;
  228       sbtnTe mplateTree : TSpeedBu tton;
  229       Panel3 : TPanel;
  230       sbtnSh owLatestVi tals: TSpe edButton;
  231       gbxPat ients: TGr oupBox;
  232       Panel1 : TPanel;
  233       Panel8 : TPanel;
  234       Panel9 : TPanel;
  235       lvSelP atients: T ListView;
  236       alDevi ce: TActio nList;
  237       acGetC ASMEDDescr iption: TA ction;
  238       btnSav eAndExit:  TButton;
  239       pnlMon itor: TPan el;
  240       sbMoni tor: TSpee dButton;
  241       acMoni torGetData : TAction;
  242       SpeedB utton1: TS peedButton ;
  243       SpeedB utton5: TS peedButton ;
  244       cbR: T CheckBox;
  245       cbU: T CheckBox;
  246       Bevel2 : TBevel;
  247       Bevel3 : TBevel;
  248       Panel7 : TPanel;
  249       cbConv ersionWarn ing: TChec kBox;
  250       Bevel4 : TBevel;
  251       acPati entInfo: T Action;
  252       MainMe nu1: TMain Menu;
  253       acPati entInfo1:  TMenuItem;
  254       edPati entName: T Edit;
  255       edPati entInfo: T Edit;
  256       Hospit al1: TMenu Item;
  257       ExpVie w1: TMenuI tem;
  258       Latest V1: TMenuI tem;
  259       DateTi me1: TMenu Item;
  260       Status Bar: TStat usBar;
  261       acShow StatusBar:  TAction;
  262       ShowHi deStatusBa r1: TMenuI tem;
  263       File1:  TMenuItem ;
  264       View1:  TMenuItem ;
  265       N1: TM enuItem;
  266       acEnab leU: TActi on;
  267       acEnab leR: TActi on;
  268       acExit : TAction;
  269       N2: TM enuItem;
  270       Exit1:  TMenuItem ;
  271       N3: TM enuItem;
  272       Save1:  TMenuItem ;
  273       ReadMo nitor1: TM enuItem;
  274       N4: TM enuItem;
  275       acLate stVitals:  TAction;
  276       Latest Vitals1: T MenuItem;
  277       Enable U1: TMenuI tem;
  278       Enable R1: TMenuI tem;
  279       acUnit sDDL: TAct ion;
  280       Unitsa sDropDownL ist1: TMen uItem;
  281       proced ure btnCan celClick(S ender: TOb ject);
  282       proced ure FormCl ose(Sender : TObject;  var Actio n: TCloseA ction);
  283       proced ure dtpTim eChange(Se nder: TObj ect);
  284       proced ure FormRe size(Sende r: TObject );
  285       proced ure tvChan ging(Sende r: TObject ; Node: TT reeNode; v ar AllowCh ange: Bool ean);
  286       proced ure FormAc tivate(Sen der: TObje ct);
  287       proced ure acMetr icStyleCha ngeExecute (Sender: T Object);
  288       proced ure ckbOnP assEnter(S ender: TOb ject);
  289       proced ure ckbOnP assExit(Se nder: TObj ect);
  290       proced ure acSave Preference sExecute(S ender: TOb ject);
  291       proced ure acLoad Preference sExecute(S ender: TOb ject);
  292       proced ure tvExpa nded(Sende r: TObject ; Node: TT reeNode);
  293       proced ure tvColl apsed(Send er: TObjec t; Node: T TreeNode);
  294       proced ure pnlPar amsResize( Sender: TO bject);
  295       proced ure acSetO nPassExecu te(Sender:  TObject);
  296       proced ure acSave InputExecu te(Sender:  TObject);
  297       proced ure ckbOnP assClick(S ender: TOb ject);
  298       proced ure SpeedB utton2Clic k(Sender:  TObject);
  299       proced ure acDate TimeSelect orExecute( Sender: TO bject);
  300       proced ure acHosp italSelect orExecute( Sender: TO bject);
  301       proced ure pnlLat estVitalsB gResize(Se nder: TObj ect);
  302       proced ure strgLV DrawCell(S ender: TOb ject; ACol , ARow: In teger; Rec t: TRect;  State: TGr idDrawStat e);
  303       proced ure FormCr eate(Sende r: TObject );
  304       proced ure ckbUna vailableEn ter(Sender : TObject) ;
  305       proced ure ckbUna vailableEx it(Sender:  TObject);
  306       proced ure ckbUna vailableCl ick(Sender : TObject) ;
  307       proced ure acUnav ailableBox StatusExec ute(Sender : TObject) ;
  308       proced ure acPara msShowHide Execute(Se nder: TObj ect);
  309       proced ure acAdju stToolbars Execute(Se nder: TObj ect);
  310       proced ure acVita lsShowHide Execute(Se nder: TObj ect);
  311       proced ure lvSelP atientsCli ck(Sender:  TObject);
  312       proced ure lvSelP atientsCha nging(Send er: TObjec t; Item: T ListItem;  Change: TI temChange;  var Allow Change: Bo olean);
  313       proced ure lvSelP atientsCha nge(Sender : TObject;  Item: TLi stItem; Ch ange: TIte mChange);
  314       proced ure FormDe stroy(Send er: TObjec t);
  315       proced ure acGetC ASMEDDataE xecute(Sen der: TObje ct);
  316       proced ure acGetC ASMEDDescr iptionExec ute(Sender : TObject) ;
  317       proced ure FormKe yDown(Send er: TObjec t; var Key : Word; Sh ift: TShif tState);
  318       proced ure acMoni torGetData Execute(Se nder: TObj ect);
  319       proced ure cbRCli ck(Sender:  TObject);
  320       proced ure hcMous eMove(Send er: TObjec t; Shift:  TShiftStat e; X, Y: I nteger);
  321       proced ure cbConv ersionWarn ingClick(S ender: TOb ject);
  322       proced ure pnlPat ientEnter( Sender: TO bject);
  323       proced ure pnlPat ientExit(S ender: TOb ject);
  324       proced ure pnlPat ientClick( Sender: TO bject);
  325       proced ure acPati entInfoExe cute(Sende r: TObject );
  326       proced ure edPati entNameKey Down(Sende r: TObject ; var Key:  Word; Shi ft: TShift State);
  327       proced ure acShow StatusBarE xecute(Sen der: TObje ct);
  328       proced ure pnlPat ientMouseD own(Sender : TObject;  Button: T MouseButto n; Shift:  TShiftStat e; X, Y: I nteger);
  329       proced ure pnlPat ientMouseU p(Sender:  TObject; B utton: TMo useButton;  Shift: TS hiftState;  X, Y: Int eger);
  330       proced ure acLate stVitalsEx ecute(Send er: TObjec t);
  331       proced ure acEnab leUExecute (Sender: T Object);
  332       proced ure acEnab leRExecute (Sender: T Object);
  333       proced ure acUnit sDDLExecut e(Sender:  TObject);
  334     private
  335       FTmplt Root: TTre eNode;
  336       FTmplt DomainRoot : TTreeNod e;
  337       FTmplt Institutio nRoot: TTr eeNode;
  338       FTmplt HopsitalLo cationRoot : TTreeNod e;
  339       FTmplt NewPersonR oot: TTree Node;
  340       FNewTe mplate: st ring;
  341       FNewTe mplateDesc ription: S tring;
  342       FDefau ltTemplate , // AAN 0 8/27/2002
  343       FInput Template:  TGMV_Templ ate;
  344       FTempl ateData: s tring;
  345       FDFN:  string;
  346       Curren tTime: TDa teTime; //  AAN 07/11 /2002
  347  
  348       fStatu s: String;
  349  
  350       fFileV ersion: St ring; // v haishandri a 050415
  351       fFileC omments: S tring; //  vhaishandr ia 050415
  352  
  353       // VS  monitor su pport;
  354   {$IFDEF US EVSMONITOR }
  355       fMonit or: TGMV_M onitor;
  356       sCasme dPort: Str ing;
  357       bCasme dUsed: Boo lean;
  358       Casmed : TATE740X ;
  359   {$ENDIF}
  360       bShowV itals, bSh owParams:  Boolean;
  361       bDataU pdated: Bo olean;
  362       bSlave : Boolean;
  363       _FCurr entPtIEN:  string;
  364       _FHosp italIEN: S tring;
  365       proced ure _SetCu rrentPtIEN (const Val ue: string );
  366       proced ure LoadTr eeView;
  367       proced ure Insert Template(T emplate: T GMV_Templa te; GoToTe mplate: Bo olean = Fa lse);
  368       proced ure SetVit alsList(In putTemplat e: String) ;
  369       proced ure ClearV italsList;
  370       proced ure CleanU pVitalsLis t;
  371       proced ure Update LatestVita ls(aPatien t: String;  bSilent:  Boolean);
  372       proced ure FocusI nputField;
  373       functi on InputSt ring: Stri ng;
  374       proced ure SaveDa ta(DT: TDa teTime);
  375       proced ure CMHosp italUpdate (var Messa ge: TMessa ge); messa ge CM_UPDA TELOOKUP;
  376       proced ure CMVita lChanged(v ar Message : TMessage ); message  CM_VITALC HANGED;
  377       proced ure Update Patient(aP atient: St ring);
  378       proced ure Patien tSelected;
  379       proced ure setSta tus(aStatu s: String) ;
  380  
  381       proced ure setPat ientInfoVi ew(aName,  anInfo: St ring);
  382       proced ure update PatientInf oView;
  383       functi on getPati entName: S tring;
  384  
  385     public
  386       proper ty Status:  String re ad fStatus  write set Status;
  387       proper ty _Curren tPtIEN: St ring read  _FCurrentP tIEN write  _SetCurre ntPtIEN;
  388  
  389       proced ure InputL ite(Patien tDFN: Stri ng; Patien tLocationI EN: string ; InputTem plate: str ing; aDate Time: TDat eTime);
  390     protecte d
  391       proced ure CMSave Input(var  Message: T Message);  message CM _SAVEINPUT ; // AAN 2 003/06/06
  392   {$IFDEF US EVSMONITOR }
  393       proced ure Monito rProcess;
  394       proced ure Casmed StatusIndi cator(aSta tus: Strin g);
  395       proced ure Casmed Process;
  396   {$ENDIF}
  397     end;
  398  
  399   function V italsInput DLG(aPatie nt, aLocat ion, aTemp late, aSig nature: Sh ortString;  aDateTime : TDateTim e; aName,  anInfo: St ring): Int eger;
  400  
  401   // functio n FormatLV (aSL:TStri ngList;aDe lim:String ):TStringL ist;
  402   // procedu re VitalsL iteInput(a Patient, a Location,  aTemplate, aSignature :ShortStri ng;
  403   // functio n GetLates tVitals(aB roker:TRPC Broker;aPa tient,aDel im:String; bSilent:Bo olean):TSt ringList;
  404  
  405   procedure  InputVital s(PatientD FN: string ; PatientL ocationIEN : string;  InputTempl ate: strin g; LV: TLi stView; aL ocationNam e: String) ;
  406  
  407   function V italsInput Form(aPati ent, aLoca tion, aTem plate, aSi gnature: S tring; aDa teTime: TD ateTime):  TfrmGMV_In putLite;
  408  
  409   function G etLatestVi tals(aPati ent, aDeli m: String;  bSilent:  Boolean):  TStringLis t;
  410  
  411   var
  412     frmGMV_I nputLite:  TfrmGMV_In putLite;
  413     // Input One21: Tfr aGMV_Input One2;
  414  
  415   implementa tion
  416  
  417   uses
  418     mGMV_Inp utOne2
  419   {$IFNDEF D LL}
  420       ,
  421     fGMV_Spl ash,
  422     fGMV_Abo utDlg
  423   {$ENDIF}
  424       ,
  425     uGMV_Com mon,
  426     uGMV_Glo balVars,
  427     uGMV_Use r,
  428     uGMV_Fil eEntry,
  429     uGMV_Uti ls,
  430     uGMV_Sav eRestore,
  431     fGMV_Hos pitalSelec tor2,
  432     uGMV_Vit alTypes,
  433     uGMV_Set up,
  434     RS232,
  435     uGMV_Eng ine,
  436     uGMV_Ver sionInfo / / vhaishan dria 05041 5
  437       ,
  438     fGMV_PtI nfo,
  439     fGMV_Dat eTimeDLG,
  440     uGMV_Log ;
  441  
  442   const
  443     indMulti pleInput:  Integer =  19;
  444     indSingl eCurrent:  Integer =  17;
  445     indMulti pleCurrent : Integer  = 18;
  446     indOnPas s: Integer  = 5;
  447     indUnava il: Intege r = 5;
  448     indSingl eInput: In teger = 3;
  449     indBlank Input: Int eger = 13;
  450  
  451     _WindowN ame = 'Vit alsLite';
  452  
  453     stsDLL =  'DLL';
  454     stsDIALO G = 'DIALO G';
  455     stsCPRS  = 'CPRS';
  456     stsDefau lt = 'DEFA ULT';
  457  
  458   {$R *.DFM}
  459  
  460  
  461   procedure  InputVital s(PatientD FN: string ; PatientL ocationIEN : string;  InputTempl ate: strin g; LV: TLi stView; aL ocationNam e: String) ;
  462   var
  463     InputVit alsForm: T frmGMV_Inp utLite;
  464     LI: TLis tItem;
  465     lc: TLis tColumn;
  466     i: Integ er;
  467  
  468     CurrentS erverDateT ime: TDate Time;
  469  
  470     sHospita lLocationI D, sHospit alLocation Name,
  471  
  472       sWindo wSettings,  sDateTime , sTemplat e: String;
  473  
  474     // Have  some probl ems with:      Restor eWindowSet tings(TFor m(InputVit alsForm));
  475     procedur e RestoreW in;
  476     var
  477       RetLis t: TString s;
  478     begin
  479       RetLis t := TStri ngList.Cre ate;
  480       try
  481         with  InputVita lsForm do
  482           be gin
  483              sWindowSet tings := I nputVitals Form.Class Name;
  484              sWindowSet tings := g etUserSett ings(sWind owSettings );
  485              if sWindow Settings < > '' then
  486                begin
  487                  Left : = StrToInt Def(Piece( sWindowSet tings, ';' , 3), Left );
  488                  Top :=  StrToIntD ef(Piece(s WindowSett ings, ';',  4), Top);
  489                  Width  := StrToIn tDef(Piece (sWindowSe ttings, '; ', 5), Wid th);
  490                  Height  := StrToI ntDef(Piec e(sWindowS ettings, ' ;', 6), He ight);
  491                end
  492              else
  493                begin
  494                  Left : = (Screen. Width - Wi dth) div 2 ;
  495                  Top :=  (Screen.H eight - He ight) div  2;
  496                  if Top  < 0 Then
  497                    Top  := 0;
  498                  if Lef t < 0 Then
  499                    Left  := 0;
  500                end;
  501           en d;
  502       except
  503       end;
  504       RetLis t.Free;
  505     end;
  506  
  507   begin
  508     sHospita lLocationI D := Patie ntLocation IEN;
  509     sHospita lLocationN ame := aLo cationName ;
  510  
  511     if sHosp italLocati onID = ''  then
  512       begin
  513         if n ot SelectL ocation2(P atientDFN,  sHospital LocationID , sHospita lLocationN ame) then
  514           be gin
  515              MessageDLG ('Not enou gh informa tion to st art input'  + #13 + ' Select hos pital loca tion to pr oceed', mt Informatio n, [mbOK],  0);
  516              exit;
  517           en d;
  518       end;
  519  
  520     try
  521       sDateT ime := get CurrentDat eTime;
  522       Curren tServerDat eTime := F MDateTimeT oWindowsDa teTime(Str ToFloat(sD ateTime));  // 10/08/ 2002 AAN
  523     except
  524       on E:  Exception  do
  525         begi n
  526           Me ssageDLG(' Input Vita ls: Unable  to set cl ient to th e servers  time.' + # 13#10 + E. Message, m tWarning,  [mbOK], 0) ;
  527           ex it;
  528         end;
  529     end;
  530  
  531     InputVit alsForm :=  TfrmGMV_I nputLite.C reate(Appl ication);
  532  
  533     with Inp utVitalsFo rm do
  534       try
  535         if ( PatientDFN  = '') and  ((LV = ni l) or (LV. Items.Coun t < 1)) th en
  536           Me ssageDLG(' Not enough  informati on to star t input' +  #13 + 'Se lect one o r more pat ients to p roceed', m tInformati on, [mbOK] , 0)
  537         else
  538           be gin
  539              if Patient DFN = '' t hen
  540                FDFN :=  LV.Items[0 ].SubItems [1]
  541              else
  542                FDFN :=  PatientDFN ;
  543  
  544              dtpDate.Da te := Curr entServerD ateTime;
  545              dtpDate.Ma xDate := d tpDate.Dat e;
  546              dtpTime.Da teTime :=  CurrentSer verDateTim e;
  547              CurrentTim e := dtpTi me.DateTim e;
  548  
  549              _FHospital IEN := sHo spitalLoca tionID;
  550              lblHospita l.Caption  := sHospit alLocation Name;
  551  
  552              acLoadPref erencesExe cute(nil);
  553              RestoreWin ;
  554              LoadTreeVi ew;
  555              if tv <> n il then
  556                begin
  557                  // AAN  08/27/200 2 Default  template h andling--- ---------- ----- begi n
  558                  sTempl ate := Pie ce(FNewTem plate, '|' , 2);
  559                  if sTe mplate = ' ' then
  560                    try
  561                      sT emplate :=  FDefaultT emplate.Te mplateName ;
  562                    exce pt
  563                    end;
  564                  for i  := 0 to tv .Items.Cou nt - 1 do
  565                    begi n
  566                      if  sTemplate  = tv.Item s[i].Text  then
  567                         begin
  568                           tv.Selec ted := tv. Items[i];
  569                           break;
  570                         end;
  571                    end;
  572                end;
  573  
  574              if LV <> n il then
  575                begin
  576                  lvSelP atients.Sm allImages  := imgTemp lates;
  577                  if lvS elPatients .Columns.C ount < 3 t hen
  578                    begi n
  579                      lc  := lvSelP atients.Co lumns.Add;
  580                      lc .Width :=  150;
  581                      lc  := lvSelP atients.Co lumns.Add;
  582                      lc .Width :=  0;
  583                      lc  := lvSelP atients.Co lumns.Add;
  584                      lc .Width :=  0;
  585                      lc  := lvSelP atients.Co lumns.Add;
  586                      lc .Width :=  0;
  587                    end;
  588                  for i  := 0 to LV .Items.Cou nt - 1 do
  589                    begi n
  590                      LI  := lvSelP atients.It ems.Add;
  591                      LI .Caption : = LV.Items [i].SubIte ms[0];
  592                      LI .SubItems. Add(LV.Ite ms[i].SubI tems[0]);
  593                      LI .SubItems. Add(LV.Ite ms[i].SubI tems[1]);
  594                      LI .SubItems. Add(LV.Ite ms[i].SubI tems[2]);
  595                      LI .SubItems. Add('');
  596                      LI .Checked : = False;
  597                    end;
  598                  if lvS elPatients .Items.Cou nt > 0 the n
  599                    begi n
  600                      lv SelPatient s.ItemFocu sed := lvS elPatients .Items[0];
  601                      lv SelPatient sClick(nil );
  602                      bt nSaveAndEx it.Visible  := False;
  603                    end;
  604                  if lvS elPatients .Items.Cou nt < 2 the n
  605                    begi n
  606                      gb xPatients. Visible :=  False;
  607                      sp lPatients. Visible :=  False;
  608                    end;
  609                end
  610              else
  611                begin
  612                  gbxPat ients.Visi ble := Fal se;
  613                  splPat ients.Visi ble := Fal se;
  614                  update PatientInf oView; //  vhaishandr ia 060309
  615                  Update LatestVita ls(FDFN, F alse);
  616                end;
  617  
  618              ShowModal;
  619              bDataUpdat ed := Fals e;
  620  
  621              acSavePref erencesExe cute(nil);
  622              SaveWindow Settings(T Form(Input VitalsForm ));
  623           en d;
  624       finall y
  625         Free ;
  626       end;
  627   end;
  628  
  629   function V italsInput DLG(aPatie nt, aLocat ion, aTemp late, aSig nature: Sh ortString;  aDateTime : TDateTim e; aName,  anInfo: St ring): Int eger;
  630  
  631   var
  632     aTime: T DateTime;
  633  
  634     procedur e SaveWind owSettings (Form: TFo rm);
  635     var
  636       s: Str ing;
  637       State:  TWindowSt ate;
  638     begin
  639       State  := Form.Wi ndowState;
  640       Form.W indowState  := wsNorm al;
  641       Form.V isible :=  False;
  642       s := I ntToStr(Sc reen.Width ) + ';' +  IntToStr(S creen.Heig ht) + ';'  + IntToStr (Form.Left ) + ';' +  IntToStr(F orm.Top) +  ';' + Int ToStr(Form .Width) +  ';' + IntT oStr(Form. Height) +  ';' + IntT oStr(Integ er(State)) ;
  643  
  644       s := s etUserSett ings(_Wind owName, s) ;
  645       if Pie ce(s, '^',  1) = '-1'  then
  646         Mess ageDLG('Un able to se t paramete r ' + _Win dowName +  '.' + #13  + 'Error M essage: '  + Piece(s,  '^', 2),  mtError, [ mbOK], 0);
  647     end;
  648  
  649   begin
  650     try
  651       aTime  := Now;
  652       SetUpG lobals;
  653       EventS top('Setup  Globals',  '', aTime );
  654  
  655       aTime  := Now;
  656       GMVUse r.SetupSig nOnParams;
  657       GMVUse r.SetupUse r;
  658       EventS top('Setup  User', '' , aTime);
  659  
  660       aTime  := Now;
  661       Applic ation.Crea teForm(Tfr mGMV_Input Lite, frmG MV_InputLi te);
  662       // frm GMV_InputL ite := Tfr mGMV_Input Lite.Creat e(nil);
  663       EventS top('Creat e Vitals L ite form',  '', aTime );
  664  
  665       aTime  := EventSt art('Input Lite -- Be gin');
  666       frmGMV _InputLite .InputLite (aPatient,  aLocation , aTemplat e, aDateTi me);
  667       EventS top('Input Lite -- En d', '', aT ime);
  668  
  669       if frm GMV_InputL ite._FHosp italIEN <>  '' then
  670         begi n
  671           tr y
  672              frmGMV_Inp utLite.set PatientInf oView(aNam e, anInfo) ; // vhais handria 06 0309
  673  
  674              PositionFo rm(frmGMV_ InputLite) ;
  675              { Result : = } frmGMV _InputLite .ShowModal ;
  676  
  677              aTime := E ventStart( 'Save form  -- Begin' );
  678              { These ne xt two are  commented  because t he form is  already f reed via c aFree in O nClose }
  679              // frmGMV_ InputLite. acSavePref erencesExe cute(nil);
  680              // SaveWin dowSetting s(TForm(fr mGMV_Input Lite));
  681              EventStop( 'Save form  -- End',  '', aTime) ;
  682           ex cept
  683              on E: Exce ption do
  684                ShowMess age('Error  saving us er prefere nces:'#13# 13 + E.Mes sage);
  685           en d;
  686         end
  687       else
  688         Show Message('T o enter Vi tals selec t the pati ent locati on first') ;
  689       // fin ally { add ed an exce ption to s how there  is an erro r }
  690       // frm GMV_InputL ite.Free
  691       CleanU pGlobals;
  692       Result  := -1;
  693     except
  694       on E:  Exception  do
  695         Show Message('E rror while  calling V italsInput DLG: ' + E .Message);
  696     end;
  697   end;
  698  
  699   function F ormatLV(aS L: TString List; aDel im: String ): TString List;
  700   var
  701     AbNormal : Boolean;
  702     sBMI, sV ital, sDat e, sTime,  sKey, sVal ue, sQual,  sMetric,  sEnteredBy , s, ss: s tring;
  703     i: Integ er;
  704     SL: TStr ingList;
  705   {$IFDEF PA TCH_5_0_23 }
  706     sSource:  String;
  707   {$ENDIF}
  708   const
  709     // 1   5     10   1 5   20   2 5   30   3 5   40   4 5   50   5 5   60
  710     // |   |     |    |     |    |     |    |     |    |     |    |     |
  711     KeyWords  = 'Temp.  Pulse Resp . Pulse Ox  B/P Ht. W t. CVP Cir c/Girth Pa in Body Ma ss Index';
  712     // 1      7     13     19        28  32   36  40  44          5 5   60
  713     // AAN 0 6/10/02--- ---------- ---------- ---------- ---------- ---------- ------ Beg in
  714     procedur e CorrectL ist(var tS L: TString List);
  715     var
  716       s: str ing;
  717       i, j:  Integer;
  718     begin
  719       for i  := 0 to tS L.Count -  1 do
  720         begi n
  721           s  := tSL.Str ings[i];
  722           j  := pos('(, ', s);
  723           wh ile j <> 0  do
  724              begin
  725                s := cop y(s, 1, j)  + copy(s,  j + 2, Le ngth(s) -  j - 1);
  726                j := pos ('(,', s);
  727              end;
  728           tS L.Strings[ i] := s;
  729         end;
  730     end;
  731   // AAN 06/ 10/02----- ---------- ---------- ---------- ---------- ---------- ------ End
  732  
  733   begin
  734     SL := TS tringList. Create;
  735     SL.Assig n(aSL);
  736  
  737     CorrectL ist(SL);
  738     sBMI :=  '';
  739     for i :=  0 to SL.C ount - 1 d o
  740       begin
  741         s :=  SL.String s[i];
  742         if p os('Body M ass Index: ', s) <> 0  then
  743           be gin
  744              sVital :=  'Body Mass  Index';
  745              sEnteredBy  := '';
  746              ss := copy (s, 17, Le ngth(s));
  747              ss := Trim Left(ss);
  748              sBMI := ss ;
  749           en d
  750         else  if pos('P ulse Ox:',  s) <> 0 t hen
  751           be gin
  752              sVital :=  'Pulse Ox: ';
  753              ss := copy (s, 10, Le ngth(s));
  754              ss := Trim Left(ss);
  755           en d
  756         else
  757           be gin
  758              sVital :=  Piece(s, '  ', 1);
  759              ss := copy (s, pos('  ', s), Len gth(s));
  760              ss := Trim Left(ss);
  761           en d;
  762  
  763         s :=  Piece(sVi tal, ':',  1);
  764         if s  = '' then  // two re cords for  the same d ate/time
  765           be gin
  766              ss := Trim Left(SL.St rings[i]);
  767              sValue :=  ss;
  768              sDate := ' ';
  769              sTime := ' ';
  770           en d
  771         else
  772           be gin
  773              sKey := s;
  774              s := copy( ss, 1, pos (' ', ss)) ;
  775              if pos('(' , s) = 1 t hen
  776                s := Pie ce(Piece(s , '(', 2),  ')', 1);  // to dele te ()
  777              sDate := P iece(s, '@ ', 1);
  778              sTime := P iece(s, '@ ', 2);
  779  
  780              ss := copy (ss, pos('  ', ss), L ength(ss)) ;
  781              ss := Trim Left(ss);
  782              sValue :=  ss;
  783           en d;
  784         sQua l := '';
  785         sMet ric := '';
  786   {$IFDEF PA TCH_5_0_23 }
  787         sSou rce := Pie ce(sValue,  '_', 3);
  788   {$ENDIF}
  789         case  pos(sKey,  KeyWords)  of
  790           //  1   5     10   15    20   25    30   35    40   45    50   55    60
  791           //  |   |     |    |     |    |     |    |     |    |     |    |     |
  792           //  KeyWords  = 'Temp. P ulse Resp.  Pulse Ox  B/P Ht. Wt . CVP Circ /Girth Pai n Body Mas s Index';
  793           //  1     7      13    1 9       28   32  36   40  44          55    60
  794           0:
  795              begin
  796                sDate :=  '';
  797                sTime :=  '';
  798                sVital : = ' ';
  799                sValue : = '';
  800                sMetric  := '';
  801                sEntered By := '';
  802   {$IFDEF PA TCH_5_0_23 }
  803                sSource  := '';
  804   {$ENDIF}
  805                sQual :=  SL.String s[i];
  806              end;
  807           1:  // Temp
  808              begin
  809                AbNormal  := pos('* ', sValue)  > 0;
  810  
  811                sEntered By := Piec e(sValue,  '_', 2);
  812                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  813                sMetric  := Piece(s Value, '(' , 2, 2);
  814                sMetric  := Piece(s Metric, ') ', 1);
  815                sQual :=  sValue;
  816                sValue : = Piece(sV alue, '(',  1);
  817  
  818                if AbNor mal and (p os('*', sV alue) = 0)  then
  819                  sValue  := sValue  + '*';
  820  
  821                sQual :=  Piece(Pie ce(sQual,  ')', 2), ' (', 2);
  822                sVital : = 'Tempera ture';
  823              end;
  824           7:  // Pulse
  825              begin
  826                AbNormal  := pos('* ', sValue)  > 0;
  827                sEntered By := Piec e(sValue,  '_', 2);
  828                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  829                sValue : = Piece(sV alue, ' ',  1);
  830  
  831                if AbNor mal and (p os('*', sV alue) = 0)  then
  832                  sValue  := sValue  + '*';
  833  
  834                sQual :=  Piece(Pie ce(ss, '(' , 2), ')',  1);
  835                sMetric  := '';
  836                sVital : = 'Pulse';
  837              end;
  838           13 : // Resp;
  839              begin
  840                AbNormal  := pos('* ', sValue)  > 0;
  841                sEntered By := Piec e(sValue,  '_', 2);
  842                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  843                sValue : = Piece(sV alue, ' ',  1);
  844  
  845                if AbNor mal and (p os('*', sV alue) = 0)  then
  846                  sValue  := sValue  + '*';
  847  
  848                sQual :=  Piece(Pie ce(ss, '(' , 2), ')',  1);
  849                sMetric  := '';
  850                sVital : = 'Respira tion';
  851              end;
  852           19 : // Pulse  Ox;
  853              begin
  854                // ABNor mal := pos ('*',sValu e) > 0;
  855                sEntered By := Piec e(sValue,  '_', 2);
  856                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  857                sValue : = Piece(sV alue, '_',  1);
  858                sQual :=  Trim(Piec e(sValue,  ' ', 2, 10 ));
  859                if (pos( 'P', sValu e) <> 1) a nd (pos('U ', sValue)  <> 1) and  (pos('R',  sValue) < > 1) then
  860                  sValue  := Piece( sValue, '% ', 1) + '% ';
  861                sMetric  := '';
  862                sVital : = 'Pulse O ximetry';
  863                if pos(' *', sQual)  = 1 then
  864                  begin
  865                    sVal ue := sVal ue + '*';
  866                    sQua l := Trim( Piece(sQua l, '*', 2) );
  867                  end;
  868              end;
  869           28 : // B/P
  870              begin
  871                AbNormal  := pos('* ', sValue)  > 0;
  872                sEntered By := Piec e(sValue,  '_', 2);
  873                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  874                sValue : = Piece(sV alue, ' ',  1);
  875  
  876                if AbNor mal and (p os('*', sV alue) = 0)  then
  877                  sValue  := sValue  + '*';
  878  
  879                sQual :=  Piece(Pie ce(ss, '(' , 2), ')',  1);
  880                sMetric  := '';
  881                sVital : = 'Blood P ressure';
  882              end;
  883           32 : // Heigh t
  884              begin
  885                AbNormal  := pos('* ', sValue)  > 0;
  886                sEntered By := Piec e(sValue,  '_', 2);
  887                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  888                sMetric  := Piece(s Value, '(' , 2, 2);
  889                sMetric  := Piece(s Metric, ') ', 1);
  890                sQual :=  sValue;
  891                sValue : = Piece(sV alue, '(',  1);
  892  
  893                if AbNor mal and (p os('*', sV alue) = 0)  then
  894                  sValue  := sValue  + '*';
  895  
  896                sQual :=  Piece(Pie ce(sQual,  ')', 2), ' (', 2);
  897                sVital : = 'Height' ;
  898              end;
  899           36 : // Weigh t
  900              begin
  901                AbNormal  := pos('* ', sValue)  > 0;
  902                sEntered By := Piec e(sValue,  '_', 2);
  903                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  904                sMetric  := Piece(s Value, '(' , 2, 2);
  905                sMetric  := Piece(s Metric, ') ', 1);
  906                sQual :=  sValue;
  907                sValue : = Piece(sV alue, '(',  1);
  908  
  909                if AbNor mal and (p os('*', sV alue) = 0)  then
  910                  sValue  := sValue  + '*';
  911  
  912                sQual :=  Piece(Pie ce(sQual,  ')', 2), ' (', 2);
  913                sVital : = 'Weight' ;
  914              end;
  915           40 : // CVP
  916              begin
  917                AbNormal  := pos('* ', sValue)  > 0;
  918                sEntered By := Piec e(sValue,  '_', 2);
  919                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  920                sMetric  := Piece(s Value, '(' , 2, 2);
  921                sMetric  := Piece(s Metric, ') ', 1);
  922                sQual :=  sValue;
  923                sValue : = Piece(sV alue, '(',  1);
  924  
  925                if AbNor mal and (p os('*', sV alue) = 0)  then
  926                  sValue  := sValue  + '*';
  927  
  928                sQual :=  Piece(Pie ce(sQual,  ')', 2), ' (', 2);
  929                sVital : = 'CVP';
  930              end;
  931           44 :
  932              begin
  933                AbNormal  := pos('* ', sValue)  > 0;
  934                sEntered By := Piec e(sValue,  '_', 2);
  935                sValue : = Piece(sV alue, '_',  1); // AA N 05/28/20 03
  936                sMetric  := Piece(s Value, '(' , 2, 2);
  937                sMetric  := Piece(s Metric, ') ', 1);
  938                sQual :=  sValue;
  939                sValue : = Piece(sV alue, '(',  1);
  940  
  941                if AbNor mal and (p os('*', sV alue) = 0)  then
  942                  sValue  := sValue  + '*';
  943  
  944                sQual :=  Piece(Pie ce(sQual,  ')', 2), ' (', 2);
  945                sVital : = 'Circumf erence/Gir th';
  946              end;
  947           55 : // Pain
  948              begin
  949                AbNormal  := pos('* ', sValue)  > 0;
  950                sEntered By := Piec e(sValue,  '_', 2);
  951                sValue : = Piece(sV alue, '_',  1);
  952  
  953                if AbNor mal and (p os('*', sV alue) = 0)  then
  954                  sValue  := sValue  + '*';
  955  
  956                sVital : = 'Pain';
  957              end;
  958           60 : // Body  Mass Index ;
  959              begin
  960                sQual :=  '';
  961                sMetric  := '';
  962                sDate :=  '';
  963                sTime :=  '';
  964                sValue : = sBMI;
  965              end;
  966         end;
  967  
  968         if ( (Trim(sVit al) = '')  and (pos(' There', Tr im(sQual))  = 1)) the n
  969           be gin
  970              SL.Strings [i] := aDe lim + 'The re are' +  aDelim + ' no results ' + aDelim  + 'to rep ort' + aDe lim + aDel im;
  971           en d
  972         else
  973           be gin
  974              SL.Strings [i] := sDa te + ' ' +  sTime + a Delim + sV ital + aDe lim + sVal ue + aDeli m + sMetri c + aDelim  + sQual +  aDelim +  sEnteredBy
  975   {$IFDEF PA TCH_5_0_23 }
  976                + aDelim  + sSource
  977   {$ENDIF}
  978                ;
  979  
  980           en d;
  981       end;
  982     SL.Inser t(0, 'Date  & Time' +  aDelim +  'Vital' +  aDelim + ' USS Value'  + aDelim  + 'Metric  Value' + a Delim + 'Q ualifiers'  + aDelim  + 'Entered  by'
  983   {$IFDEF PA TCH_5_0_23 }
  984       + aDel im + 'Data  Source'
  985   {$ENDIF}
  986       );
  987  
  988     Result : = SL;
  989  
  990   end;
  991  
  992   function V italsInput Form(aPati ent, aLoca tion, aTem plate, aSi gnature: S tring; aDa teTime: TD ateTime):  TfrmGMV_In putLite;
  993   begin
  994     try
  995       Applic ation.Crea teForm(Tfr mGMV_Input Lite, frmG MV_InputLi te);
  996       frmGMV _InputLite .Status :=  stsDLL;
  997  
  998       frmGMV _InputLite .InputLite (aPatient,  aLocation , aTemplat e, aDateTi me);
  999       frmGMV _InputLite .pnlTools. Visible :=  False;
  1000  
  1001       frmGMV _InputLite .chkbClose OnSave.Vis ible := Fa lse;
  1002       frmGMV _InputLite .pnlButton s.Width :=  frmGMV_In putLite.bt nSave.Widt h + frmGMV _InputLite .btnSave.L eft + 6;
  1003       frmGMV _InputLite .BorderSty le := bsNo ne;
  1004  
  1005       Result  := frmGMV _InputLite ;
  1006     except
  1007       Result  := nil;
  1008     end;
  1009   end;
  1010  
  1011   function G etLatestVi tals(aPati ent, aDeli m: String;  bSilent:  Boolean):  TStringLis t;
  1012   var
  1013     aSL: TSt ringList;
  1014   begin
  1015     aSL := g etLatestVi talsByDFN( aPatient,  bSilent);
  1016     Result : = FormatLV (aSL, '^') ;
  1017     aSL.Free ;
  1018   end;
  1019  
  1020   /// ////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// /
  1021  
  1022   procedure  TfrmGMV_In putLite.In putLite(Pa tientDFN:  string; Pa tientLocat ionIEN: st ring; Inpu tTemplate:  string; a DateTime:  TDateTime) ;
  1023   var
  1024     i: Integ er;
  1025     sDateTim e, sCaptio n, sTempla te: String ;
  1026     sWindowS ettings: S tring;
  1027     aSL: TSt rings;
  1028     aTime: T DateTime;
  1029  
  1030     // Have  some probl ems with:      Restor eWindowSet tings(TFor m(InputVit alsForm));
  1031     procedur e RestoreW in;
  1032     begin
  1033       try
  1034         sWin dowSetting s := Class Name;
  1035         sWin dowSetting s := getUs erSettings (_WindowNa me);
  1036         if s WindowSett ings <> ''  then
  1037           be gin
  1038              Left := St rToIntDef( Piece(sWin dowSetting s, ';', 3) , Left);
  1039              Top := Str ToIntDef(P iece(sWind owSettings , ';', 4),  Top);
  1040              Width := S trToIntDef (Piece(sWi ndowSettin gs, ';', 5 ), Width);
  1041              Height :=  StrToIntDe f(Piece(sW indowSetti ngs, ';',  6), Height );
  1042           en d;
  1043       except
  1044       end;
  1045     end;
  1046  
  1047     procedur e setWindo wCaption;
  1048     begin
  1049       sCapti on := ' Vi tals Lite  Enter';
  1050       if fFi leComments  <> '' the n
  1051         sCap tion := sC aption + '  (' + fFil eComments  + ') ';
  1052       sCapti on := sCap tion + '   User: ' +  GMVUser.Na me;
  1053       if GMV User.Title  <> '' the n
  1054         sCap tion := sC aption + '   (' + GMV User.Title  + ')';
  1055       sCapti on := sCap tion + '   Division:  ' + GMVUse r.Division ;
  1056  
  1057       Captio n := sCapt ion;
  1058     end;
  1059  
  1060   begin
  1061     aSL := T StringList .Create;
  1062     try
  1063       gbxPat ients.Visi ble := Fal se;
  1064       setWin dowCaption ;
  1065       chkbCl oseOnSave. Visible :=  True;
  1066       btnSav eAndExit.V isible :=  False;
  1067       bSlave  := True;
  1068       FDFN : = PatientD FN;
  1069  
  1070       // sel ect a loca tion first
  1071       if (Pa tientLocat ionIEN = ' ') or (Pat ientLocati onIEN = '0 ') then
  1072         acHo spitalSele ctorExecut e(nil)
  1073       else
  1074         begi n
  1075           sC aption :=  getFileFie ld('44', ' 2', Patien tLocationI EN);
  1076           if  (pos('WAR D', upperc ase(sCapti on)) <> 0)  or (pos(' CLINIC', u ppercase(s Caption))  <> 0) then
  1077              begin
  1078                _FHospit alIEN := P atientLoca tionIEN;
  1079                sCaption  := getFil eField('44 ', '.01',  _FHospital IEN); // v haishandri a 050210
  1080                lblHospi tal.Captio n := sCapt ion;
  1081              end
  1082           el se
  1083              _FHospital IEN := Pat ientLocati onIEN;
  1084         end;
  1085       sCapti on := getF ileField(' 44', '.01' , _FHospit alIEN); //  vhaishand ria 050210
  1086       lblHos pital.Capt ion := sCa ption;
  1087  
  1088       try
  1089         sDat eTime := g etCurrentD ateTime;
  1090         dtpD ate.Date : = FMDateTi meToWindow sDateTime( StrToFloat (sDateTime )); // 10/ 08/2002 AA N
  1091         dtpD ate.MaxDat e := dtpDa te.Date;
  1092         dtpT ime.DateTi me := FMDa teTimeToWi ndowsDateT ime(StrToF loat(sDate Time));
  1093   {$IFDEF DL L}
  1094         chkb CloseOnSav e.Visible  := False;  // vhaisha ndria 0502 09
  1095         btnS aveAndExit .Visible : = True;
  1096  
  1097         // C urrentTime  := Now;
  1098         if a DateTime < > 0 then
  1099           be gin
  1100              CurrentTim e := aDate Time; // v haishandra  20081008  fixing dis cepency be tween PC a nd VistA
  1101              //dtpDate. MaxDate :=  0; // Got ta reset M axDate her e since th e datetime  came from  the DLL C lient
  1102              //dtpDate. Date := 0;
  1103              dtpDate.Ma xDate := C urrentTime ;
  1104              dtpDate.Da te := Trun c(CurrentT ime);
  1105              dtpTime.Da teTime :=  CurrentTim e;
  1106           en d
  1107         else
  1108           Cu rrentTime  := dtpDate .Date;
  1109         dtpT imeChange( nil);
  1110   {$ELSE}
  1111         Curr entTime :=  dtpTime.D ateTime;
  1112   {$ENDIF}
  1113       except
  1114         on E : EConvert Error do
  1115           Me ssageDLG(' Input Lite : Unable t o set clie nt to the  servers ti me.' + #13 #10 + E.Me ssage, mtW arning, [m bOK], 0);
  1116  
  1117         on E : Exceptio n do
  1118           be gin
  1119              ShowMessag e('Excepti on reads:  ' + E.Mess age);
  1120              raise
  1121           en d;
  1122       end;
  1123  
  1124       aTime  := Now;
  1125       acLoad Preference sExecute(n il);
  1126       EventS top('LoadP references ', '', aTi me);
  1127       aTime  := Now;
  1128       Restor eWin;
  1129       EventS top('Resto reWin', '' , aTime);
  1130  
  1131       aTime  := Now;
  1132       LoadTr eeView;
  1133       if tv  <> nil the n
  1134         begi n
  1135           sT emplate :=  Piece(FNe wTemplate,  '|', 2);
  1136           if  sTemplate  = '' then
  1137              try
  1138                sTemplat e := FDefa ultTemplat e.Template Name;
  1139              except
  1140              end;
  1141           fo r i := 0 t o tv.Items .Count - 1  do
  1142              begin
  1143                if sTemp late = tv. Items[i].T ext then
  1144                  begin
  1145                    tv.S elected :=  tv.Items[ i];
  1146                    brea k;
  1147                  end;
  1148              end;
  1149         end;
  1150       EventS top('Resto re templat e tree', ' ', aTime);
  1151  
  1152       aTime  := Now;
  1153       Update Patient(FD FN);
  1154       EventS top('Updat e patient' , '', aTim e);
  1155     finally
  1156       aSL.Fr ee;
  1157     end;
  1158   end;
  1159  
  1160   /// ////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// /
  1161  
  1162   procedure  TfrmGMV_In putLite.Up datePatien t(aPatient : String);
  1163   begin
  1164   {$IFNDEF D LL}
  1165     updatePa tientInfoV iew;
  1166   {$ENDIF}
  1167     UpdateLa testVitals (aPatient,  False);
  1168   end;
  1169  
  1170   procedure  TfrmGMV_In putLite._S etCurrentP tIEN(const  Value: st ring);
  1171   begin
  1172     _FCurren tPtIEN :=  Value;
  1173     FDFN :=  Value;
  1174   {$IFNDEF D LL}
  1175     lblHospi tal.Captio n := getHo spitalLoca tionByID(_ CurrentPtI EN);
  1176   {$ENDIF}
  1177     UpdatePa tient(_Cur rentPtIEN) ;
  1178   end;
  1179  
  1180   procedure  TfrmGMV_In putLite.Fo cusInputFi eld;
  1181   var
  1182     i: Integ er;
  1183   begin
  1184     for i :=  0 to sbxM ain.Contro lCount - 1  do
  1185       if sbx Main.Contr ols[i] is  TfraGMV_In putOne2 th en
  1186         begi n
  1187           Ac tiveContro l := TfraG MV_InputOn e2(sbxMain .Controls[ i]).cbxInp ut;
  1188           br eak;
  1189         end;
  1190   end;
  1191  
  1192   procedure  TfrmGMV_In putLite.bt nCancelCli ck(Sender:  TObject);
  1193   begin
  1194     if (Inpu tString <>  '') then
  1195       begin
  1196         if ( MessageDLG ('Some of  the input  fields con tain data. ' + #13 +  #13
  1197           //  +'Do you  really wan t to close  the input  window?',
  1198           +  'Click "Ye s" to exit  without s aving the  data' + #1 3 + #10 +  'Click "No " to retur n to the i nput templ ate', mtCo nfirmation , [mbYes,  mbNo], 0)  <> mrYes)  then
  1199           ex it
  1200         else
  1201           bD ataUpdated  := False;
  1202       end;
  1203  
  1204     if bSlav e then
  1205       begin
  1206         acSa vePreferen cesExecute (nil);
  1207         Save WindowSett ings(Self) ;
  1208       end;
  1209  
  1210     Close;
  1211   end;
  1212  
  1213   procedure  TfrmGMV_In putLite.Fo rmClose(Se nder: TObj ect; var A ction: TCl oseAction) ;
  1214   var
  1215     i: Integ er;
  1216   begin
  1217     for i :=  sbxMain.C omponentCo unt - 1 do wnto 0 do
  1218       if sbx Main.Compo nents[i] i s TfraGMV_ InputOne2  then
  1219         Tfra GMV_InputO ne2(sbxMai n.Componen ts[i]).Fre e;
  1220  
  1221     if bSlav e then
  1222       begin
  1223         // c ommented b y vhaishan dria on 05 0209
  1224         // a cSaveInput Execute(ni l);
  1225         if I nputString  = '' then
  1226           Ac tion := ca Free // DL L
  1227         else
  1228           Ac tion := ca None;
  1229       end;
  1230   end;
  1231  
  1232   procedure  TfrmGMV_In putLite.Cl earVitalsL ist;
  1233   var
  1234     i: Integ er;
  1235     p: TPane l;
  1236   begin
  1237     i := 0;
  1238     while sb xMain.Comp onentCount  > 0 do
  1239       begin
  1240         if s bxMain.Com ponents[i]  is TfraGM V_InputOne 2 then
  1241           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).F ree
  1242         else  if sbxMai n.Componen ts[i] is T Panel then
  1243           be gin
  1244              p := TPane l(sbxMain. Components [i]);
  1245              p.Free;
  1246           en d
  1247         else
  1248           in c(i);
  1249         if i  > sbxMain .Component Count then
  1250           br eak;
  1251       end;
  1252   end;
  1253  
  1254   procedure  TfrmGMV_In putLite.Se tVitalsLis t(InputTem plate: Str ing);
  1255   var
  1256       InputOne2:  TfraGMV_I nputOne2;  //  DN S      BELLC
  1257     i: Integ er;
  1258   begin
  1259     Screen.C ursor := c rHourGlass ;
  1260     sbxMain. Visible :=  False;
  1261  
  1262     try
  1263       ClearV italsList;
  1264       acSave Input.Enab led := Fal se;
  1265     except
  1266     end;
  1267  
  1268     FInputTe mplate :=  GetTemplat eObject(Pi ece(InputT emplate, ' |', 1), Pi ece(InputT emplate, ' |', 2));
  1269  
  1270     if FInpu tTemplate  <> nil the n
  1271       begin
  1272         FTem plateData  := Piece(F InputTempl ate.XPARVa lue, '|',  2);
  1273         i :=  1;
  1274         whil e Piece(FT emplateDat a, ';', i)  <> '' do
  1275           be gin
  1276              try
  1277                InputOne 2 := TfraG MV_InputOn e2.Create( sbxMain);  // works i n unit
  1278                InputOne 2.DFN := F DFN; // vh aishandria  2009 02 2 7
  1279                acSaveIn put.Enable d := True;
  1280  
  1281                with Inp utOne2 do
  1282                  begin
  1283                    Conv ersionWarn ing := Fal se;
  1284                    cbCo nversionWa rning.Chec ked := Fal se;
  1285                    Pare nt := sbxM ain;
  1286                    Name  := 'tmplt ' + IntToS tr(i);
  1287                    if ( i mod 2) =  0 then
  1288                      pn lMain.Colo r := $00B1 B1B1
  1289                    else
  1290                      pn lMain.Colo r := clBtn Face;
  1291                    Temp lateVital  := TGMV_Te mplateVita l.CreateFr omXPAR(Pie ce(FTempla teData, '; ', i));
  1292                    Defa ultTemplat eVital :=  TemplateVi tal;
  1293                    lblN um.Caption  := IntToS tr(i) + '.  ';
  1294                    if i  < 10 then
  1295                      be gin
  1296                         lblNum.Cap tion := '& ' + lblNum .Caption;
  1297                         lblNum.Foc usControl  := cbxInpu t;
  1298                      en d;
  1299                    Top  := i * Hei ght;
  1300                    TabO rder := To p;
  1301                    Alig n := alTop ;
  1302                    try
  1303                      ck bMetricCli ck(nil); / / AAN 08/1 6/2002
  1304                    exce pt
  1305                    end;
  1306                  end;
  1307              except
  1308                on E: Ex ception do
  1309                  Messag eDialog('E rror', 'Er ror creati ng input t emplate '  + #13 + E. Message, m tError, mb YesNoCance l, 0, 0);
  1310              end;
  1311              inc(i);
  1312           en d;
  1313         try
  1314           ac MetricStyl eChangeExe cute(nil);
  1315         exce pt
  1316         end;
  1317       end;
  1318     sbxMain. Visible :=  True;
  1319     bDataUpd ated := Fa lse;
  1320     FocusInp utField;
  1321     Screen.C ursor := c rDefault;
  1322   end;
  1323  
  1324   procedure  TfrmGMV_In putLite.dt pTimeChang e(Sender:  TObject);
  1325   begin
  1326     if trunc (dtpDate.D ate) + fra c(dtpTime. Time) > Cu rrentTime  then
  1327       dtpTim e.Time :=  CurrentTim e;
  1328     lblDateT ime.Captio n := ' ' +  FormatDat eTime(GMV_ DateFormat , dtpDate. Date) + '   ' + Forma tDateTime( GMV_TimeFo rmat, dtpT ime.Time);
  1329   end;
  1330  
  1331   procedure  TfrmGMV_In putLite.Fo rmResize(S ender: TOb ject);
  1332   begin
  1333     hc.Secti ons[3].Wid th := 118;
  1334     hc.Secti ons[4].Wid th := 116;
  1335     hc.Secti ons[5].Wid th := 78;
  1336  
  1337     hc.Secti ons[6].Wid th := hc.W idth - hc. Sections[0 ].Width -  hc.Section s[1].Width  - hc.Sect ions[2].Wi dth - hc.S ections[3] .Width - h c.Sections [4].Width  - hc.Secti ons[5].Wid th;
  1338     strgLV.C olWidths[0 ] := hc.Se ctions[0]. Width + hc .Sections[ 1].Width +  hc.Sectio ns[2].Widt h + 2;
  1339     strgLV.C olWidths[1 ] := hc.Se ctions[3]. Width - 2;
  1340     strgLV.C olWidths[2 ] := hc.Se ctions[4]. Width;
  1341     strgLV.C olWidths[3 ] := hc.Se ctions[5]. Width;
  1342     strgLV.C olWidths[4 ] := hc.Se ctions[6]. Width - 10 0;
  1343     strgLV.C olWidths[5 ] := 100;
  1344     if Heigh t > Screen .Height th en
  1345       Height  := Screen .Height;
  1346  
  1347     acAdjust Toolbars.E xecute;
  1348   end;
  1349  
  1350   procedure  TfrmGMV_In putLite.Lo adTreeView ;
  1351   var
  1352     tmpList:  TStringLi st;
  1353     i: Integ er;
  1354   begin
  1355     tv.Enabl ed := Fals e;
  1356     tv.Items .BeginUpda te;
  1357     tv.ShowR oot := Tru e;
  1358     with tv. Items do
  1359       begin
  1360         Clea r;
  1361         FTmp ltRoot :=  nil;
  1362         FTmp ltDomainRo ot := AddC hild(FTmpl tRoot, GMV ENTITYNAME S[teDomain ]);
  1363         FTmp ltInstitut ionRoot :=  AddChild( FTmpltRoot , GMVENTIT YNAMES[teI nstitution ]);
  1364         FTmp ltHopsital LocationRo ot := AddC hild(FTmpl tRoot, GMV ENTITYNAME S[teHospit alLocation ]);
  1365         if G MVAllowUse rTemplates  then
  1366           FT mpltNewPer sonRoot :=  AddChild( FTmpltRoot , GMVENTIT YNAMES[teN ewPerson]) ;
  1367       end;
  1368  
  1369     try
  1370       tmpLis t := getTe mplateList ByID('');
  1371       for i  := 1 to tm pList.Coun t - 1 do
  1372         Inse rtTemplate (TGMV_Temp late.Creat eFromXPAR( tmpList[i] ));
  1373     finally
  1374       FreeAn dNil(tmpLi st);
  1375     end;
  1376  
  1377     tv.Ctl3D  := False;
  1378     tv.Alpha Sort;
  1379     tv.Enabl ed := True ;
  1380     tv.TopIt em := tv.I tems.GetFi rstNode;
  1381     tv.Items .EndUpdate ;
  1382     Refresh;
  1383   end;
  1384  
  1385   procedure  TfrmGMV_In putLite.In sertTempla te(Templat e: TGMV_Te mplate; Go ToTemplate : Boolean  = False);
  1386   var
  1387     TypeRoot : TTreeNod e;
  1388     oRoot: T TreeNode;
  1389     NewNode:  TTreeNode ;
  1390  
  1391     function  OwnerRoot : TTreeNod e;
  1392     begin
  1393       Result  := nil;
  1394       try
  1395         oRoo t := TypeR oot.getFir stChild;
  1396       except
  1397         oRoo t := nil;
  1398       end;
  1399       while  oRoot <> n il do
  1400         begi n
  1401           if  TGMV_Temp lateOwner( oRoot.Data ).Entity =  Template. Entity the n
  1402              begin
  1403                Result : = oRoot;
  1404                exit;
  1405              end
  1406           el se
  1407              oRoot := T ypeRoot.Ge tNextChild (oRoot);
  1408         end;
  1409  
  1410       if oRo ot = nil t hen
  1411         begi n
  1412           if  Template. EntityType  = teNewPe rson then
  1413              begin
  1414                if GMVAl lowUserTem plates the n
  1415                  Result  := tv.Ite ms.AddChil dObject(Ty peRoot, Ti tleCase(Te mplate.Own er.OwnerNa me), Templ ate.Owner) ;
  1416              end
  1417           el se
  1418              Result :=  tv.Items.A ddChildObj ect(TypeRo ot, Templa te.Owner.O wnerName,  Template.O wner);
  1419         end;
  1420     end;
  1421  
  1422   begin
  1423     case Tem plate.Enti tyType of
  1424       teUnkn own:
  1425         Type Root := ni l;
  1426       teDoma in:
  1427         Type Root := FT mpltDomain Root;
  1428       teInst itution:
  1429         Type Root := FT mpltInstit utionRoot;
  1430       teHosp italLocati on:
  1431         Type Root := FT mpltHopsit alLocation Root;
  1432       teNewP erson:
  1433         Type Root := FT mpltNewPer sonRoot;
  1434     end;
  1435  
  1436     NewNode  := tv.Item s.AddChild Object(Own erRoot, Te mplate.Tem plateName,  Template) ;
  1437  
  1438     if (GMVD efaultTemp lates <> n il) and GM VDefaultTe mplates.Is Default(Te mplate.Ent ity, Templ ate.Templa teName) th en
  1439       begin
  1440         NewN ode.ImageI ndex := GM VIMAGES[ii DefaultTem plate];
  1441         NewN ode.Select edIndex :=  GMVIMAGES [iiDefault Template];
  1442         // D efault Tem plate Data ;
  1443         if T emplate.En tityType =  teDomain  then
  1444           FD efaultTemp late := Te mplate;
  1445       end
  1446     else
  1447       begin
  1448         NewN ode.ImageI ndex := GM VIMAGES[ii Template];
  1449         NewN ode.Select edIndex :=  GMVIMAGES [iiTemplat e];
  1450       end;
  1451  
  1452     if GoToT emplate th en
  1453       begin
  1454         NewN ode.Select ed := True ;
  1455         tv.S etFocus;
  1456       end;
  1457   end;
  1458  
  1459   procedure  TfrmGMV_In putLite.tv Changing(S ender: TOb ject; Node : TTreeNod e; var All owChange:  Boolean);
  1460   begin
  1461     if Node  = nil then
  1462       exit;
  1463     try
  1464       if Nod e.Level >  1 then
  1465         begi n
  1466           FN ewTemplate  := TGMV_T emplate(No de.Data).E ntity + '| ' + TGMV_T emplate(No de.Data).T emplateNam e;
  1467           FN ewTemplate Descriptio n := Piece (TGMV_Temp late(Node. Data).XPAR Value, '|' , 1);
  1468  
  1469           Se tVitalsLis t(FNewTemp late + '^'  + FNewTem plateDescr iption);
  1470           pn lInputTemp lateHeader .Caption : = '  Vital s input te mplate: <'  + TGMV_Te mplate(Nod e.Data).Te mplateName  + '>';
  1471           lb lTemplInfo .Caption : = Piece(TG MV_Templat e(Node.Dat a).XPARVal ue, '|', 1 );
  1472         end
  1473       else
  1474         lblT emplInfo.C aption :=  '';
  1475       tv.hin t := lblTe mplInfo.Ca ption;
  1476     except
  1477     end;
  1478   end;
  1479  
  1480   procedure  TfrmGMV_In putLite.Cl eanUpVital sList;
  1481   var
  1482     i: Integ er;
  1483   begin
  1484     for i :=  0 to sbxM ain.Compon entCount -  1 do
  1485       if sbx Main.Compo nents[i] i s TfraGMV_ InputOne2  then
  1486         try
  1487           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxInput.It emIndex :=  -1;
  1488           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxInput.Te xt := '';
  1489           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxUnavaila ble.Checke d := False ;
  1490           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxRefused. Checked :=  False;
  1491           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).T emplateVit al := Tfra GMV_InputO ne2(sbxMai n.Componen ts[i]).Def aultTempla teVital;
  1492           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).S etMetricSt yle(chkCPR SSTyle.Che cked);
  1493           //  AAN 2003/ 09/17
  1494           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c kbMetricCl ick(nil);
  1495           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).C learPO2Flo wRateAndPe rcentage;
  1496         exce pt
  1497         end;
  1498     ckbOnPas s.Checked  := False;  // vhaisha ndria 0504 29
  1499     ckbUnava ilable.Che cked := Fa lse; // vh aishandria  050429
  1500     bDataUpd ated := Fa lse;
  1501   end;
  1502  
  1503   procedure  TfrmGMV_In putLite.Fo rmActivate (Sender: T Object);
  1504   begin
  1505     dtpTimeC hange(Send er);
  1506     acUnavai lableBoxSt atusExecut e(Sender);  // ?
  1507     cbRClick (nil);
  1508   end;
  1509  
  1510   procedure  TfrmGMV_In putLite.ac MetricStyl eChangeExe cute(Sende r: TObject );
  1511   var
  1512     i: Integ er;
  1513   begin
  1514     for i :=  0 to sbxM ain.Compon entCount -  1 do
  1515       if sbx Main.Compo nents[i] i s TfraGMV_ InputOne2  then
  1516         Tfra GMV_InputO ne2(sbxMai n.Componen ts[i]).Set MetricStyl e(chkCPRSS Tyle.Check ed);
  1517  
  1518     acMetric StyleChang e.Checked  := acMetri cStyleChan ge.Enabled ;
  1519     acUnitsD DL.Checked  := chkCPR SSTyle.Che cked;
  1520   end;
  1521  
  1522   procedure  TfrmGMV_In putLite.CM HospitalUp date(var M essage: TM essage);
  1523   begin
  1524   end;
  1525  
  1526   procedure  TfrmGMV_In putLite.ck bOnPassEnt er(Sender:  TObject);
  1527   begin
  1528     bvU.Visi ble := Tru e;
  1529   end;
  1530  
  1531   procedure  TfrmGMV_In putLite.ck bOnPassExi t(Sender:  TObject);
  1532   begin
  1533     bvU.Visi ble := Fal se;
  1534   end;
  1535  
  1536   procedure  TfrmGMV_In putLite.ac SavePrefer encesExecu te(Sender:  TObject);
  1537  
  1538     procedur e saveBool ean(aSetti ng: TGMV_U serSetting ; aValue:  Boolean; a True, aFal se: String );
  1539     begin
  1540       if aVa lue then
  1541         GMVU ser.Settin g[aSetting ] := aTrue
  1542       else
  1543         GMVU ser.Settin g[aSetting ] := aFals e;
  1544     end;
  1545  
  1546   begin
  1547     if FNewT emplate <>  '' then / / vhaishan dria 05020 9
  1548       GMVUse r.Setting[ usDefaultT emplate] : = FNewTemp late;
  1549  
  1550     if chkOn eUnavailab leBox.Chec ked then
  1551       GMVUse r.Setting[ usOneUnava ilableBox]  := 'OneUn availableB ox'
  1552     else
  1553       GMVUse r.Setting[ usOneUnava ilableBox]  := 'ManyU navailable Boxes';
  1554     (*
  1555       if chk bCloseOnSa ve.Checked  then
  1556       GMVUse r.Setting[ usCloseInp utWindowAf terSave] : ='CloseInp utWindowAf terSave'
  1557       else
  1558       GMVUse r.Setting[ usCloseInp utWindowAf terSave] : ='DoNotClo seInputWin dow';
  1559  
  1560       saveBo olean(usCl oseInputWi ndowAfterS ave,chkbCl oseOnSave. Checked,
  1561       'Close InputWindo wAfterSave ','DoNotCl oseInputWi ndow');
  1562     *)
  1563     // if ch kCPRSStyle .Checked t hen GMVUse r.Setting[ usMetricSt yle] :='CP RSMetricSt yle'
  1564     // else                    GMV User.Setti ng[usMetri cStyle] := 'VitalsMet ricStyle';
  1565     saveBool ean(usMetr icStyle, c hkCPRSSTyl e.Checked,  'CPRSMetr icStyle',  'VitalsMet ricStyle') ;
  1566  
  1567     GMVUser. Setting[us ParamTreeW idth] := I ntToStr(pn lParams.Wi dth);
  1568  
  1569     // if bS howParams  then   GMV User.Setti ng[usTempl ateTree] : = 'ShowTem plates'
  1570     // else                    GMV User.Setti ng[usTempl ateTree] : = 'NoTempl ates';
  1571     saveBool ean(usTemp lateTree,  bShowParam s, 'ShowTe mplates',  'NoTemplat es');
  1572  
  1573     GMVUser. Setting[us LastVitals ListHeight ] := IntTo Str(pnlLat estVitalsB g.Height);
  1574  
  1575     if bShow Vitals the n
  1576       GMVUse r.Setting[ usLastVita ls] := 'Sh owLastVita ls'
  1577     else
  1578       GMVUse r.Setting[ usLastVita ls] := 'No LatestVita ls';
  1579  
  1580     if cbR.C hecked the n
  1581       setUse rSettings( 'RefuseSta tus', 'ON' )
  1582     else
  1583       setUse rSettings( 'RefuseSta tus', 'OFF ');
  1584  
  1585     if cbU.C hecked the n
  1586       setUse rSettings( 'Unavailab leStatus',  'ON')
  1587     else
  1588       setUse rSettings( 'Unavailab leStatus',  'OFF');
  1589  
  1590     (* comme nted 2008- 04-23 vhai shandria
  1591       if cbU .Checked t hen setUse rSettings( 'Conversio nWarningSt atus','ON' )
  1592       else s etUserSett ings('Conv ersionWarn ingStatus' ,'OFF');
  1593     *)
  1594   end;
  1595  
  1596   procedure  TfrmGMV_In putLite.ac LoadPrefer encesExecu te(Sender:  TObject);
  1597   var
  1598     s: Strin g;
  1599     i: Integ er;
  1600   begin
  1601     try
  1602       FNewTe mplate :=  GMVUser.Se tting[usDe faultTempl ate];
  1603     except
  1604       FNewTe mplate :=  '';
  1605     end;
  1606  
  1607     bShowVit als := not (GMVUser.S etting[usL astVitals]  = 'ShowLa stVitals') ;
  1608     acVitals ShowHideEx ecute(nil) ;
  1609  
  1610     s := GMV User.Setti ng[usLastV italsListH eight];
  1611     if s <>  '' then
  1612       try
  1613         pnlL atestVital sBg.Height  := StrToI nt(s);
  1614       except
  1615         pnlL atestVital sBg.Height  := pnlInp ut.Height  div 4;
  1616       end
  1617     else
  1618       pnlLat estVitalsB g.Height : = pnlInput .Height di v 4;
  1619  
  1620     bShowPar ams := not (GMVUser.S etting[usT emplateTre e] = 'Show Templates' );
  1621     acParams ShowHideEx ecute(nil) ;
  1622  
  1623     s := GMV User.Setti ng[usParam TreeWidth] ;
  1624     if s <>  '' then
  1625       try
  1626         i :=  StrToInt( s);
  1627         pnlP arams.Widt h := i;
  1628       except
  1629         pnlP arams.Widt h := 150;
  1630       end
  1631     else
  1632       pnlPar ams.Width  := 150;
  1633  
  1634     chkCPRSS Tyle.Check ed := GMVU ser.Settin g[usMetric Style] = ' CPRSMetric Style';
  1635     acMetric StyleChang eExecute(S ender);
  1636  
  1637     // chkOn eUnavailab leBox.Chec ked :=
  1638     // GMVUs er.Setting [usOneUnav ailableBox ] ='OneUna vailableBo x';
  1639     chkOneUn availableB ox.Checked  := False;  // AAN 05 /21/2003
  1640  
  1641     acUnavai lableBoxSt atusExecut e(Sender);
  1642     { vhaish andria 200 50209
  1643       chkbCl oseOnSave. Checked :=
  1644       GMVUse r.Setting[ usCloseInp utWindowAf terSave] = 'CloseInpu tWindowAft erSave';
  1645     }
  1646     s := get UserSettin gs('Refuse Status');
  1647     cbR.Chec ked := s < > 'OFF';
  1648     s := get UserSettin gs('Unavai lableStatu s');
  1649     cbU.Chec ked := s < > 'OFF';
  1650     { vhaish andria 200 8-04-23 co mmented
  1651       s := g etUserSett ings('Conv ersionWarn ingStatus' );
  1652       cbConv ersionWarn ing.Checke d := s = ' ON';
  1653     }
  1654   end;
  1655  
  1656   procedure  TfrmGMV_In putLite.Up dateLatest Vitals(aPa tient: Str ing; bSile nt: Boolea n);
  1657   var
  1658     aSL: TSt ringList;
  1659     TheSL: T StringList ;
  1660     i, j: In teger;
  1661     s: Strin g;
  1662   begin
  1663     aSL := g etLatestVi talsByDFN( aPatient,  bSilent);
  1664  
  1665     TheSL :=  FormatLV( aSL, '^');
  1666     strgLV.R owCount :=  TheSL.Cou nt + 1;
  1667     strgLV.C ells[0, 0]  := 'Date  & Time';
  1668     strgLV.C ells[1, 0]  := 'Vital ';
  1669     strgLV.C ells[2, 0]  := 'USS V alue';
  1670     strgLV.C ells[3, 0]  := 'Metri c Value';
  1671     strgLV.C ells[4, 0]  := 'Quali fiers';
  1672     strgLV.C ells[5, 0]  := 'Enter ed by';
  1673   {$IFDEF PA TCH_5_0_23 }
  1674     strgLV.C ells[6, 0]  := 'Data  Source';
  1675   {$ENDIF}
  1676   {$IFDEF AA NTEST}
  1677     ShowMess age(aSL.Te xt + #13#1 0 + TheSL. Text); //  vhaishandr ia 050429
  1678   {$ENDIF}
  1679     for i :=  1 to TheS L.Count -  1 do // fi rst row co ntains hea ders
  1680       begin
  1681         s :=  TheSL.Str ings[i];
  1682         for  j := 0 to  strgLV.Col Count - 1  do
  1683           st rgLV.Cells [j, i] :=  Piece(s, ' ^', j + 1) ;
  1684       end;
  1685     TheSL.Fr ee;
  1686  
  1687     aSL.Free ;
  1688   end;
  1689  
  1690   procedure  TfrmGMV_In putLite.tv Expanded(S ender: TOb ject; Node : TTreeNod e);
  1691   begin
  1692     if Node. Level < 2  then
  1693       Node.I mageIndex  := 1;
  1694   end;
  1695  
  1696   procedure  TfrmGMV_In putLite.tv Collapsed( Sender: TO bject; Nod e: TTreeNo de);
  1697   begin
  1698     if Node. Level < 2  then
  1699       Node.I mageIndex  := 0;
  1700   end;
  1701  
  1702   procedure  TfrmGMV_In putLite.pn lParamsRes ize(Sender : TObject) ;
  1703   begin
  1704     pnlPatie nt.Width : = pnlParam s.Width +  5;
  1705     acAdjust Toolbars.E xecute;
  1706   end;
  1707  
  1708   procedure  TfrmGMV_In putLite.ac SetOnPassE xecute(Sen der: TObje ct);
  1709   var
  1710     i: Integ er;
  1711   begin
  1712     if (Send er = ckbUn available)  and ckbUn available. Checked an d ckbOnPas s.Checked  then
  1713       ckbOnP ass.Checke d := False
  1714     else if  ckbOnPass. Checked an d ckbUnava ilable.Che cked then
  1715       ckbUna vailable.C hecked :=  False;
  1716  
  1717     for i :=  0 to sbxM ain.Compon entCount -  1 do
  1718       begin
  1719         if s bxMain.Com ponents[i]  is TfraGM V_InputOne 2 then
  1720           be gin
  1721              if (ckbOnP ass.Checke d) or (ckb Unavailabl e.Checked)  // AAN 12 /09/2002
  1722              then
  1723                begin
  1724                  TfraGM V_InputOne 2(sbxMain. Components [i]).Disab lePanel;
  1725                  TfraGM V_InputOne 2(sbxMain. Components [i]).cbxRe fused.Enab led := Fal se;
  1726                  TfraGM V_InputOne 2(sbxMain. Components [i]).cbxUn available. Enabled :=  False;
  1727                end
  1728              else
  1729                begin
  1730                  if Tfr aGMV_Input One2(sbxMa in.Compone nts[i]).cb xRefused.C hecked or  TfraGMV_In putOne2(sb xMain.Comp onents[i]) .cbxUnavai lable.Chec ked then
  1731                    Tfra GMV_InputO ne2(sbxMai n.Componen ts[i]).Dis ablePanel
  1732                  else
  1733                    Tfra GMV_InputO ne2(sbxMai n.Componen ts[i]).Ena blePanel;
  1734                  TfraGM V_InputOne 2(sbxMain. Components [i]).cbxRe fused.Enab led := Tru e;
  1735                  TfraGM V_InputOne 2(sbxMain. Components [i]).cbxUn available. Enabled :=  True;
  1736                end;
  1737           en d
  1738       end;
  1739  
  1740     if acSet OnPass.Ena bled then
  1741       acSetO nPass.Chec ked := Tru e
  1742     else
  1743       acSetO nPass.Chec ked := Fal se;
  1744   end;
  1745  
  1746   procedure  TfrmGMV_In putLite.Sa veData(DT:  TDateTime );
  1747   var
  1748     sPO2: St ring;
  1749     i: Integ er;
  1750     s1, s2,  X: String;
  1751   begin
  1752     sPO2 :=  getVitalTy peIEN('PUL SE OXIMETR Y'); // vh aishandria  050715
  1753  
  1754     for i :=  0 to sbxM ain.Contro lCount - 1  do
  1755       begin
  1756         if s bxMain.Con trols[i] i s TfraGMV_ InputOne2  then
  1757           wi th TfraGMV _InputOne2 (sbxMain.C ontrols[i] ) do
  1758              begin
  1759                X := '';
  1760                if ckbOn Pass.Check ed then
  1761                  begin
  1762                    X :=  FloatToSt r(DT) + '^ ' + FDFN +  '^' + Vit alIEN + '; Pass;' + ' ^' + _FHos pitalIEN +  '^' + GMV User.DUZ +  '*';
  1763                  end
  1764                else if  ckbUnavail able.Check ed then
  1765                  begin
  1766                    X :=  FloatToSt r(DT) + '^ ' + FDFN +  '^' + Vit alIEN + '; Unavailabl e;' + '^'  + _FHospit alIEN + '^ ' + GMVUse r.DUZ + '* ';
  1767                  end
  1768                else if  VitalsRate  <> '' the n
  1769                  begin
  1770                    s1 : = VitalsRa te;
  1771                    (* v haishandri a 20071220  ==== No s pecial tre atment for  sPO2 ==== ========== ======
  1772                      //  AAN 2003/ 06/30 -- d o not show  qualifier s for Puls eOx if the re is no r ate
  1773                      if  (piece(s1 ,';',1) =  sPO2) // P ulseOx ID  {'21'}
  1774                      an d (piece(s 1,';',3)=' ')  // no  value for  the Flow r ate for Pu lseOx
  1775                      //  uncomment  the next  line if yo u'd like t o ignore " no Flow Ra te" for th e Room Air
  1776                      an d (pos('RO OM AIR',up percase(lb lQualifier s.Caption) )=0) // Me thod is no t <Room Ai r>
  1777                      th en
  1778                      s2  := ''
  1779                      el se
  1780                      == ========== ========== ========== ========== ========== ========== ========== ===== *)
  1781                    s2 : = VitalsQu alifiers;
  1782  
  1783                    X :=  FloatToSt r(DT) + '^ ' + FDFN +  '^' + s1  + '^' + _F HospitalIE N + '^' +  GMVUser.DU Z + '*' +  s2;
  1784                  end;
  1785  
  1786                if X <>  '' then
  1787                  begin
  1788                    // C allRemoteP roc(RPCBro ker, 'GMV  ADD VM', [ x], nil,[r pcSilent,r pcNoresChk ]);
  1789                    // i f RPCBroke r.Results. Count > 1  then
  1790                    // M essageDlg( RPCBroker. Results.Te xt, mtErro r, [mbok],  0);
  1791                    X :=  addVM(X);
  1792                    if X  <> '' the n
  1793                      Me ssageDLG(X , mtError,  [mbOK], 0 );
  1794                  end;
  1795              end;
  1796       end;
  1797   {$IFDEF US EVSMONITOR }
  1798     // CASME D support/ ////////// ////////// ////////// ////////// ///////
  1799     // vhais habdria 20 080929 che ck added t o speed up  cases whe n the devi ce is not  used
  1800     if bCasm edUsed the n
  1801       try
  1802         if n ot Assigne d(Casmed)  then
  1803           Ca smed := TA TE740X.Cre ate(sCasme dPort);
  1804         Casm ed.NewPati ent;
  1805         bCas medUsed :=  False;
  1806       finall y
  1807         Free AndNil(Cas med);
  1808       end;
  1809   {$ENDIF}   /// ////// ////////// ////////// ////////// ////////// ////////// ////////// /
  1810     CleanUpV italsList;
  1811     UpdatePa tient(FDFN );
  1812   end;
  1813  
  1814   procedure  TfrmGMV_In putLite.ac SaveInputE xecute(Sen der: TObje ct);
  1815   const
  1816     sLastPro cessedMess age = 'The  last pati ent in the  list proc essed' + # 13 + 'Clos e the inpu t window?' ;
  1817     sSelectH ospital =  'Please se lect a val id hospita l location  for this  patient.';
  1818   var
  1819     aTime: T DateTime;
  1820     sNoDataE ntered: St ring;
  1821     DT: TDat eTime;
  1822  
  1823     procedur e AssignIm ageIndex(a nIndex: In teger);
  1824     begin
  1825       if lvS elPatients .ItemFocus ed.SubItem s[3] = ''  then
  1826         begi n
  1827           lv SelPatient s.ItemFocu sed.ImageI ndex := an Index;
  1828           lv SelPatient s.ItemFocu sed.SubIte ms[3] := I ntToStr(an Index);
  1829         end
  1830       else
  1831         begi n
  1832           lv SelPatient s.ItemFocu sed.SubIte ms[3] := l vSelPatien ts.ItemFoc used.SubIt ems[3] + '  ' + IntTo Str(anInde x);
  1833           lv SelPatient s.ItemFocu sed.ImageI ndex := in dMultipleI nput;
  1834         end;
  1835     end;
  1836  
  1837     function  CheckData (aDT: TDat eTime): Bo olean;
  1838     var
  1839       i: Int eger;
  1840     begin
  1841       for i  := 0 to sb xMain.Comp onentCount  - 1 do
  1842         if n ot TfraGMV _InputOne2 (sbxMain.C omponents[ i]).Check( aDT) then
  1843           br eak;
  1844       Result  := i = sb xMain.Comp onentCount ;
  1845       if not  Result th en
  1846         begi n
  1847           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxInput.Se lStart :=  0;
  1848           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxInput.Se lLength :=  Length(Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxInput.Te xt);
  1849           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).c bxInput.Se tFocus;
  1850         end;
  1851     end;
  1852  
  1853     procedur e ProcessN ext(Result Index: Int eger);
  1854     begin
  1855       if (lv SelPatient s = nil) o r (lvSelPa tients.Ite ms.Count <  2) then
  1856         begi n
  1857           if  bSlave th en // DLL
  1858              begin
  1859                if chkbC loseOnSave .Checked o r (Sender  = btnSaveA ndExit) //  added vha ishandria  050707 for  DLL use
  1860                then
  1861                  begin
  1862                    Clos e;
  1863                    exit ; // Get o ut of here  now, we j ust trigge red the fo rm Destroy  with caFr ee
  1864                  end
  1865                else
  1866                  Update LatestVita ls(FDFN, T rue);
  1867              end
  1868           el se
  1869              begin
  1870                // Do we  need to c lose windo w if the l ist contai ns only on e patient?
  1871                // Yes w e do
  1872                // Do we  need to h ave a mess age?
  1873                // No we  don't
  1874                // s :=  LastProces sedMessage ;
  1875                // if Me ssageDlgS( S,mtInform ation,mbOK Cancel,0)  = mrOK the n
  1876                if Sende r = btnSav eAndExit t hen
  1877                  ModalR esult := m rOk;
  1878              end;
  1879         end;
  1880  
  1881       try
  1882         if l vSelPatien ts.ItemFoc used.Index  < 0 then
  1883           lv SelPatient s.ItemFocu sed := lvS elPatients .Items[0];
  1884       except
  1885         lvSe lPatients. ItemFocuse d := lvSel Patients.I tems[0];
  1886       end;
  1887  
  1888       try
  1889         if l vSelPatien ts.ItemFoc used.Index  < 0 then
  1890           lv SelPatient s.ItemFocu sed := lvS elPatients .Items[0];
  1891         if l vSelPatien ts.ItemFoc used.Index  < lvSelPa tients.Ite ms.Count -  1 then
  1892           be gin
  1893              AssignImag eIndex(Res ultIndex);
  1894              lvSelPatie nts.ItemFo cused := l vSelPatien ts.Items[l vSelPatien ts.ItemFoc used.Index  + 1];
  1895              lvSelPatie nts.ItemFo cused.Imag eIndex :=  1;
  1896              lvSelPatie ntsClick(S ender);
  1897              CleanUpVit alsList;
  1898               SetVitalsL ist(FNewTe mplate + ' ^' + FNewT emplateDes cription);  //  DN S      BELLC
  1899  
  1900              if not lvS elPatients .CheckBoxe s then
  1901                ckbOnPas s.Checked  := False;
  1902  
  1903              FocusInput Field;
  1904           en d
  1905         else
  1906           be gin
  1907              AssignImag eIndex(Res ultIndex);
  1908              lvSelPatie nts.Invali date;
  1909              // lvSelPa tientsClic k(Sender); // may be  it is too  much
  1910  
  1911              if lvSelPa tients.Ite ms.Count <  2 then
  1912                ModalRes ult := mrO k
  1913              else if Me ssageDLG(s LastProces sedMessage , mtInform ation, mbO KCancel, 0 ) = mrOk t hen
  1914                ModalRes ult := mrO k;
  1915           en d;
  1916       except
  1917       end;
  1918     end;
  1919  
  1920   begin
  1921     // Check  all input  panels fo r valid va lues
  1922     DT := Wi ndowsDateT imeToFMDat eTime(trun c(dtpDate. Date) + (d tpTime.Dat eTime - tr unc(dtpTim e.Date)));
  1923     if not C heckData(D T) then
  1924       exit;
  1925     // Hospi tal locati on should  be set bef ore saving  data -- 0 3/14/2003  AAN
  1926     if (_FHo spitalIEN  = '') or ( _FHospital IEN = '0')  then
  1927       Messag eDLG(sSele ctHospital , mtWarnin g, [mbOK],  0)
  1928     else
  1929       begin
  1930         if I nputString  <> '' the n
  1931           be gin
  1932              aTime := E ventStart( 'Save Vita ls -- Begi n');
  1933              SaveData(D T);
  1934              EventStop( 'Save Vita ls -- End' , '', aTim e);
  1935              if ckbOnPa ss.Checked  then
  1936                ProcessN ext(indOnP ass)
  1937              else
  1938                ProcessN ext(indSin gleInput);
  1939           en d
  1940         else
  1941           be gin
  1942              sNoDataEnt ered := 'N o data ent ered for p atient ' +  #13 + get PatientNam e + #13;
  1943              case lvSel Patients.I tems.Count  of
  1944                0, 1:
  1945                  begin
  1946                    if ( MessageDLG (sNoDataEn tered + 'C lose the w indow?', m tInformati on, [mbYes , mbNo], 0 ) = mrYes)  then
  1947                      if  bSlave th en
  1948                         Close
  1949                      el se
  1950                         ModalResul t := mrOk;
  1951                  end;
  1952              else
  1953                begin
  1954                  if (Me ssageDLG(s NoDataEnte red + 'Pro cess next  Patient?',  mtInforma tion, [mbY es, mbNo],  0) = mrYe s) then
  1955                    Proc essNext(in dBlankInpu t);
  1956                end;
  1957              end;
  1958           en d;
  1959       end;
  1960   end;
  1961  
  1962   procedure  TfrmGMV_In putLite.ck bOnPassCli ck(Sender:  TObject);
  1963   begin
  1964     acSetOnP assExecute (ckbOnPass );
  1965     if not c kbOnPass.C hecked the n
  1966       cbRCli ck(nil);
  1967   end;
  1968  
  1969   procedure  TfrmGMV_In putLite.Sp eedButton2 Click(Send er: TObjec t);
  1970   begin
  1971     pnlOptio ns.Visible  := not pn lOptions.V isible;
  1972   end;
  1973  
  1974   procedure  TfrmGMV_In putLite.ac DateTimeSe lectorExec ute(Sender : TObject) ;
  1975   var
  1976     aTime: T DateTime;
  1977   begin
  1978     Applicat ion.Create Form(TfGMV _DateTime,  fGMV_Date Time);
  1979     with fGM V_DateTime  do
  1980       begin
  1981         // E nter date  could not  be less th en a year  before --  //AAN 12/1 2/2002
  1982         fGMV _DateTime. mncCalenda r.minDate  := Now - 3 65; // AAN  12/12/200 2
  1983         fGMV _DateTime. mncCalenda r.Date :=  dtpDate.Da te;
  1984         fGMV _DateTime. edtTime.Te xt := Form atDateTime (GMV_TimeF ormat, dtp Time.Time) ;
  1985         fGMV _DateTime. SetDateTim eText;
  1986  
  1987         if f GMV_DateTi me.ShowMod al <> mrCa ncel then
  1988           be gin
  1989              CurrentTim e := fGMV_ DateTime.m ncCalendar .MaxDate;
  1990              aTime := t runc(fGMV_ DateTime.m ncCalendar .Date) + S trToTime(f GMV_DateTi me.edtTime .Text);
  1991              if dtpDate .MaxDate <  aTime the n
  1992                dtpDate. MaxDate :=  aTime;
  1993              dtpDate.Da te := aTim e;
  1994              dtpTime.Ti me := trun c(aTime) +  StrToTime (fGMV_Date Time.edtTi me.Text);
  1995              dtpTimeCha nge(Sender );
  1996           en d;
  1997       end;
  1998     fGMV_Dat eTime.Free ;
  1999   end;
  2000  
  2001   procedure  TfrmGMV_In putLite.ac HospitalSe lectorExec ute(Sender : TObject) ;
  2002   var
  2003     sLocatio nID, sLoca tionName:  String;
  2004   begin
  2005     sLocatio nID := _FH ospitalIEN ;
  2006     sLocatio nName := ' ';
  2007     if Selec tLocation2 (FDFN, sLo cationID,  sLocationN ame) then
  2008       begin
  2009         _FHo spitalIEN  := sLocati onID;
  2010         lblH ospital.Ca ption := s LocationNa me;
  2011       end;
  2012   end;
  2013  
  2014   procedure  TfrmGMV_In putLite.pn lLatestVit alsBgResiz e(Sender:  TObject);
  2015   begin
  2016     if pnlLa testVitals Bg.Height  > (pnlInpu t.Height d iv 4) * 3  then
  2017       pnlLat estVitalsB g.Height : = (pnlInpu t.Height d iv 4) * 3;
  2018     if pnlLa testVitals Bg.Height  < pnlInput .Height di v 5 then
  2019       pnlLat estVitalsB g.Height : = pnlInput .Height di v 5;
  2020   end;
  2021  
  2022   procedure  TfrmGMV_In putLite.CM VitalChang ed(var Mes sage: TMes sage);
  2023   begin
  2024     bDataUpd ated := Tr ue;
  2025   end;
  2026  
  2027   function T frmGMV_Inp utLite.Inp utString:  String;
  2028   var
  2029     i: Integ er;
  2030     s: Strin g;
  2031   begin
  2032     s := '';
  2033     for i :=  0 to sbxM ain.Contro lCount - 1  do
  2034       if sbx Main.Contr ols[i] is  TfraGMV_In putOne2 th en
  2035         with  TfraGMV_I nputOne2(s bxMain.Con trols[i])  do
  2036           if  ckbOnPass .Checked t hen
  2037              s := s + ' OnPass'
  2038           el se
  2039              s := s + V italsRate;
  2040     Result : = s;
  2041   end;
  2042  
  2043   procedure  TfrmGMV_In putLite.st rgLVDrawCe ll(Sender:  TObject;  ACol, ARow : Integer;  Rect: TRe ct; State:  TGridDraw State);
  2044   begin
  2045     with str gLV.canvas  do
  2046       begin
  2047         if A Row = 0 th en
  2048           Br ush.Color  := clBtnFa ce
  2049         else  if pos('* ', strgLV. Cells[2, A Row]) <> 0  then
  2050           be gin
  2051              Font.Color  := Displa yColors[GM VAbnormalT ext];
  2052              // if pos( FormatDate Time('mm/d d/yy',Now) ,strgLV.Ce lls[0,ARow ])<>0 then
  2053              // Brush.C olor := Di splayColor s[GMVAbnor malTodayBk gd]
  2054              // else
  2055              Brush.Colo r := Displ ayColors[G MVAbnormal Bkgd];
  2056           en d
  2057         else
  2058           be gin
  2059              Font.Color  := Displa yColors[GM VnormalTex t];
  2060              // if pos( FormatDate Time('mm/d d/yy',Now) ,strgLV.Ce lls[0,ARow ])<>0 then
  2061              // Brush.C olor := Di splayColor s[GMVnorma lTodayBkgd ]
  2062              // else
  2063              Brush.Colo r := Displ ayColors[G MVnormalBk gd];
  2064           en d;
  2065  
  2066         Fill Rect(Rect) ;
  2067         Text Rect(Rect,  Rect.Left  + 2, Rect .Top, strg LV.Cells[A Col, ARow] );
  2068       end;
  2069  
  2070   end;
  2071  
  2072   procedure  TfrmGMV_In putLite.Fo rmCreate(S ender: TOb ject);
  2073   var
  2074     i: Integ er;
  2075   begin
  2076     bSlave : = False;
  2077  
  2078     pnlMonit or.Visible  := False;
  2079  
  2080     with TVe rsionInfo. Create(Sel f) do
  2081       try
  2082         fFil eVersion : = FileVers ion;
  2083         fFil eComments  := Comment s;
  2084       finall y
  2085         Free ;
  2086       end;
  2087  
  2088   {$IFDEF US EVSMONITOR }
  2089     fMonitor  := TGMV_M onitor.Cre ate;
  2090     pnlMonit or.Visible  := True;
  2091     if (fMon itor <> ni l) and fMo nitor.Acti ve then
  2092       sbMoni tor.Captio n := 'Read  Monitor'  // 2009-04 -15 fMonit or.Model / / ReadMoni tor
  2093     else
  2094       begin
  2095         Free AndNil(fMo nitor);
  2096         sCas medPort :=  '';
  2097         for  i := 1 to  ParamCount  do // vha ishandria  20090112
  2098           be gin
  2099              if InStrin g(ParamStr (i), ['/ca smed='], F alse) then
  2100                begin
  2101                  sCasme dPort := P iece(Param Str(i), '= ', 2);
  2102                  break;
  2103                end;
  2104           en d;
  2105       end;
  2106   {$ENDIF}
  2107   {$IFDEF DL L}
  2108     HelpCont ext := 3;
  2109   {$ENDIF}
  2110  
  2111   end;
  2112  
  2113   procedure  TfrmGMV_In putLite.ck bUnavailab leEnter(Se nder: TObj ect);
  2114   begin
  2115     bvUnavai lable.Visi ble := Tru e;
  2116   end;
  2117  
  2118   procedure  TfrmGMV_In putLite.ck bUnavailab leExit(Sen der: TObje ct);
  2119   begin
  2120     bvUnavai lable.Visi ble := Fal se;
  2121   end;
  2122  
  2123   procedure  TfrmGMV_In putLite.ck bUnavailab leClick(Se nder: TObj ect);
  2124   begin
  2125     acSetOnP assExecute (ckbUnavai lable);
  2126   end;
  2127  
  2128   procedure  TfrmGMV_In putLite.ac Unavailabl eBoxStatus Execute(Se nder: TObj ect);
  2129  
  2130     procedur e SetUStat us(aStatus : Boolean) ;
  2131     var
  2132       i: Int eger;
  2133     begin
  2134       ckbUna vailable.V isible :=  aStatus;
  2135       lblUna vailable.V isible :=  aStatus;
  2136       for i  := 0 to sb xMain.Comp onentCount  - 1 do
  2137         begi n
  2138           if  sbxMain.C omponents[ i] is Tfra GMV_InputO ne2 then
  2139              begin
  2140                TfraGMV_ InputOne2( sbxMain.Co mponents[i ]).cbxUnav ailable.Vi sible := n ot aStatus ;
  2141                TfraGMV_ InputOne2( sbxMain.Co mponents[i ]).cbxUnav ailable.Ch ecked := c kbUnavaila ble.Checke d;
  2142                TfraGMV_ InputOne2( sbxMain.Co mponents[i ]).cbxUnav ailable.En abled := T rue;
  2143              end;
  2144         end;
  2145       if aSt atus then
  2146         begi n
  2147           hc .Sections[ 2].Text :=  'Refused' ;
  2148         end
  2149       else
  2150         hc.S ections[2] .Text := ' U... R...'
  2151     end;
  2152  
  2153   begin
  2154     SetUStat us(chkOneU navailable Box.Checke d);
  2155   end;
  2156  
  2157   procedure  TfrmGMV_In putLite.CM SaveInput( var Messag e: TMessag e);
  2158   begin
  2159     acSaveIn putExecute (nil);
  2160   end;
  2161  
  2162   procedure  TfrmGMV_In putLite.ac ParamsShow HideExecut e(Sender:  TObject);
  2163   begin
  2164     bShowPar ams := not  bShowPara ms;
  2165     // sbtnT emplateTre e.Down :=  bShowParam s;
  2166     sbtnTool ShowParams .Down := b ShowParams ;
  2167  
  2168     if pnlPa rams.Visib le and not  bShowPara ms then
  2169       splPar ams.Visibl e := False ;
  2170     pnlParam s.Visible  := bShowPa rams;
  2171     if Sende r <> nil t hen
  2172       try
  2173         Form Resize(Sen der);
  2174       except
  2175       end;
  2176     if pnlPa rams.Visib le then
  2177       splPar ams.Visibl e := True;
  2178     acParams ShowHide.C hecked :=  bShowParam s;
  2179   end;
  2180  
  2181   procedure  TfrmGMV_In putLite.ac AdjustTool barsExecut e(Sender:  TObject);
  2182   var
  2183     LabelLen , PanelLen : Integer;
  2184   begin
  2185     PanelLen  := pnlToo ls.Width -  pnlPatien t.Width -  pnlParamTo ols.Width  - pnlMonit or.Width;
  2186     LabelLen  := Max((l blHospital .Width + l blHospital .Left + 4) , (lblDate Time.Width  + lblDate Time.Left  + 4));
  2187     if Panel Len < Labe lLen then
  2188       begin
  2189         pnlT ools.Visib le := Fals e;
  2190         pnlT ools.Visib le := True ;
  2191         tlbI nput.Align  := alTop;
  2192         tlbI nput.Visib le := True ;
  2193         Appl ication.Pr ocessMessa ges;
  2194       end
  2195     else
  2196       tlbInp ut.Visible  := False;
  2197     pnlParam Tools.Visi ble := not  tlbInput. Visible;
  2198   end;
  2199  
  2200   procedure  TfrmGMV_In putLite.ac VitalsShow HideExecut e(Sender:  TObject);
  2201   begin
  2202     bShowVit als := not  bShowVita ls;
  2203     sbtnShow LatestVita ls.Down :=  bShowVita ls;
  2204     if pnlLa testVitals Bg.Visible  and not b ShowVitals  then
  2205       splLas tVitals.Vi sible := F alse;
  2206     pnlLates tVitalsBg. Visible :=  bShowVita ls;
  2207     if pnlLa testVitals Bg.Visible  then
  2208       begin
  2209         splL astVitals. Visible :=  True;
  2210       end
  2211     else
  2212       pnlInp utTemplate .Align :=  alClient;
  2213     acVitals ShowHide.C hecked :=  bShowVital s;
  2214   end;
  2215  
  2216   procedure  TfrmGMV_In putLite.lv SelPatient sClick(Sen der: TObje ct);
  2217   begin
  2218     PatientS elected;
  2219     acSetOnP assExecute (Sender);
  2220     cbRClick (nil); //  vhaishandr ia 060223
  2221   end;
  2222  
  2223   procedure  TfrmGMV_In putLite.lv SelPatient sChanging( Sender: TO bject; Ite m: TListIt em; Change : TItemCha nge; var A llowChange : Boolean) ;
  2224   var
  2225     i: Integ er;
  2226     bFlag: B oolean;
  2227   begin
  2228     bFlag :=  True;
  2229     for i :=  0 to sbxM ain.Compon entCount -  1 do
  2230       begin
  2231         if s bxMain.Com ponents[i]  is TfraGM V_InputOne 2 then
  2232           be gin
  2233              bFlag := b Flag and T fraGMV_Inp utOne2(sbx Main.Compo nents[i]). Valid;
  2234              if not bFl ag then
  2235                break;
  2236           en d;
  2237       end;
  2238     AllowCha nge := bFl ag;
  2239   end;
  2240  
  2241   procedure  TfrmGMV_In putLite.lv SelPatient sChange(Se nder: TObj ect; Item:  TListItem ; Change:  TItemChang e);
  2242   begin
  2243     try
  2244       if (It em.SubItem s[1] = FDF N) and (In putString  <> '') and  // 2003/0 8/29 AAN
  2245         bDat aUpdated t hen
  2246         if ( MessageDLG ('You are  selecting  another pa tient.' +  #13 + 'Som e of the i nput field s contain  data.' + # 13 + #13 +  'Save thi s data for  the patie nt "' + ge tPatientNa me + '"?',  mtConfirm ation, [mb Yes, mbNo] , 0) = mrY es) then
  2247           be gin
  2248              acSaveInpu tExecute(S ender);
  2249           en d
  2250         else
  2251           be gin
  2252              bDataUpdat ed := Fals e; // 2003 /08/29 AAN
  2253           en d
  2254       else / / 2003/08/ 29 AAN
  2255         bDat aUpdated : = InputStr ing <> '';  // 2003/0 8/29 AAN
  2256     except
  2257     end;
  2258   end;
  2259  
  2260   procedure  TfrmGMV_In putLite.Pa tientSelec ted;
  2261   var
  2262     i: Integ er;
  2263     s, sPati entID: Str ing;
  2264   begin
  2265     for i :=  0 to lvSe lPatients. Items.Coun t - 1 do
  2266       try
  2267         s :=  lvSelPati ents.Items [i].SubIte ms[3];
  2268         if s  = '' then
  2269           //  if lvSelP atients.It ems[i].Ima geIndex =  1 then
  2270           lv SelPatient s.Items[i] .ImageInde x := 0
  2271         else  if pos('  ', s) <> 0  then
  2272           lv SelPatient s.Items[i] .ImageInde x := indMu ltipleInpu t
  2273         else
  2274           //  lvSelPati ents.Items [i].ImageI ndex := in dSingleInp ut;
  2275           lv SelPatient s.Items[i] .ImageInde x := StrTo Int(s);
  2276       except
  2277       end;
  2278  
  2279     try
  2280       sPatie ntID := lv SelPatient s.ItemFocu sed.SubIte ms[1];
  2281       if lvS elPatients .ItemFocus ed.SubItem s[3] = ''  then
  2282         lvSe lPatients. ItemFocuse d.ImageInd ex := 1
  2283       else i f pos(' ',  lvSelPati ents.ItemF ocused.Sub Items[3])  <> 0 then
  2284         lvSe lPatients. ItemFocuse d.ImageInd ex := indM ultipleCur rent
  2285       else
  2286         lvSe lPatients. ItemFocuse d.ImageInd ex := indS ingleCurre nt;
  2287     except
  2288       sPatie ntID := '' ;
  2289     end;
  2290     if sPati entID = ''  then
  2291       exit;
  2292  
  2293     if lvSel Patients.C heckBoxes  then
  2294       ckbOnP ass.Checke d := lvSel Patients.I temFocused .Checked;
  2295  
  2296     setPatie ntInfoView (lvSelPati ents.ItemF ocused.Sub Items[0],  lvSelPatie nts.ItemFo cused.SubI tems[2]);  // vhaisha ndria 0603 09
  2297  
  2298     pnlLates tVitalsHea der.Captio n := '  La test Vital s for pati ent <' + g etPatientN ame + '>';
  2299  
  2300     FDFN :=  sPatientID ;
  2301  
  2302     UpdateLa testVitals (sPatientI D, True);
  2303  
  2304     bDataUpd ated := In putString  <> '';
  2305   end;
  2306  
  2307   procedure  TfrmGMV_In putLite.Fo rmDestroy( Sender: TO bject);
  2308   begin
  2309     if Statu s = stsDLL  then
  2310       CleanU pGlobals;
  2311   {$IFDEF US EVSMONITOR }
  2312     if fMoni tor <> nil  then
  2313       FreeAn dNil(fMoni tor);
  2314     if Assig ned(Casmed ) then
  2315       FreeAn dNil(Casme d);
  2316   {$ENDIF}
  2317   end;
  2318  
  2319   procedure  TfrmGMV_In putLite.se tStatus(aS tatus: Str ing);
  2320   begin
  2321     fStatus  := aStatus ;
  2322     if fStat us = stsDL L then
  2323       begin
  2324         SetU pGlobals;
  2325         GMVU ser.SetupS ignOnParam s;
  2326         GMVU ser.SetupU ser;
  2327       end;
  2328   end;
  2329  
  2330   /// ////// ////////// ////////// ////////// ////////// ////////// /////////  CASMED UNI T
  2331  
  2332   procedure  TfrmGMV_In putLite.ac GetCASMEDD escription Execute(Se nder: TObj ect);
  2333   begin
  2334   {$IFDEF US EVSMONITOR }
  2335     Screen.C ursor := c rHourGlass ;
  2336     if (fMon itor <> ni l) and fMo nitor.Acti ve then
  2337       begin
  2338         Show Message(fM onitor.Des cription);
  2339         Scre en.Cursor  := crDefau lt;
  2340       end
  2341     else
  2342       begin
  2343         // S tatusBar.V isible :=  True; // u ncomment t o show the  status of  the instr ument
  2344         Show Message(ge tCasmedDes cription(C asmed, sCa smedPort,  CasmedStat usIndicato r));
  2345       end;
  2346     Screen.C ursor := c rDefault;
  2347   {$ENDIF}
  2348   end;
  2349  
  2350   {$IFDEF US EVSMONITOR }
  2351  
  2352  
  2353   procedure  TfrmGMV_In putLite.Ca smedStatus Indicator( aStatus: S tring);
  2354   var
  2355     sKey: St ring;
  2356     i: Integ er;
  2357   begin
  2358     sKey :=  Piece(uppe rcase(aSta tus), ':',  1);
  2359     i := Sta tusBar.Pan els.Count  - 1;
  2360     if sKey  = 'MODEL'  then
  2361       i := 1 ;
  2362     if sKey  = 'PORT' t hen
  2363       i := 2 ;
  2364     if sKey  = 'STATUS'  then
  2365       i := 3 ;
  2366  
  2367     StatusBa r.Panels[i ].Text :=  ' ' + aSta tus + ' ';
  2368     Applicat ion.Proces sMessages;
  2369   end;
  2370  
  2371   procedure  TfrmGMV_In putLite.Ca smedProces s;
  2372   var
  2373     i: Integ er;
  2374     anIn: Tf raGMV_Inpu tOne2;
  2375     rr, rTem p: Real;
  2376  
  2377     sBP: Str ing;
  2378     sPulse:  String;
  2379     sTemp: S tring;
  2380     sTempUni t: String;
  2381     sSpO2: S tring;
  2382  
  2383     sCasmedE rror: Stri ng;
  2384   begin
  2385     try
  2386       // Sta tusBar.Vis ible := Tr ue; // inc omment to  indicate i nstrument  status
  2387       Screen .Cursor :=  crHourGla ss;
  2388       if not  Assigned( Casmed) th en
  2389         Casm ed := newA TE740X(sCa smedPort,  sCasmedErr or, Casmed StatusIndi cator);
  2390       Screen .Cursor :=  crDefault ;
  2391  
  2392       bCasme dUsed := F alse;
  2393       sCasme dError :=  errCheckSt atus { err CasmedNotF ound };
  2394       if not  Assigned( Casmed) th en
  2395         begi n
  2396           Sh owMessage( sCasmedErr or);
  2397           ex it;
  2398         end;
  2399  
  2400       if Cas med.Numeri cs <> 'ERR OR' then
  2401         begi n
  2402           sB P := Casme d.sBP;
  2403           sP ulse := Ca smed.sPuls e;
  2404           sS pO2 := Cas med.sSpO2;
  2405           rT emp := Cas med.fTemp;  // rTemp  := 33.3;
  2406           sT emp := Cas med.sTemp;  // sTemp  := '33.3';
  2407           sT empUnit :=  Casmed.Te mpUnit; //  sTempUnit  := 'C';
  2408           Fr eeAndNil(C asmed);
  2409           //  Casmed.Cl osePort;
  2410         end
  2411       else
  2412         begi n
  2413           Sh owMessage( 'Error get ting data  from CASME D');
  2414           Fr eeAndNil(C asmed);
  2415           //  Casmed.Cl osePort;
  2416           ex it;
  2417         end;
  2418  
  2419       // vha ishandria  20080929 t racking us e of the m onitor
  2420       bCasme dUsed := ( sBP <> '')  or (sPuls e <> '') o r (sSpO2 < > '') or ( rTemp <> 0 ) or (sTem p <> '') o r (sTempUn it <> '');
  2421  
  2422       for i  := 0 to sb xMain.Comp onentCount  - 1 do
  2423         begi n
  2424           if  sbxMain.C omponents[ i] is Tfra GMV_InputO ne2 then
  2425              begin
  2426                anIn :=  TfraGMV_In putOne2(sb xMain.Comp onents[i]) ;
  2427                if (anIn .TemplateV ital.Vital Name = 'TE MPERATURE' ) and (sTe mp <> '')  then
  2428                  begin
  2429                    if s TempUnit =  copy(anIn .lblUnit.C aption, 2,  1) then
  2430                      an In.cbxInpu t.Text :=  sTemp
  2431                    else
  2432                      be gin
  2433                         if sTempUn it = 'C' t hen
  2434                           rr := Co nvertCtoF( rTemp)
  2435                         else
  2436                           rr := Co nvertFtoC( rTemp);
  2437                         sTemp := F ormat('%4. 1f', [rr]) ;
  2438                         anIn.cbxIn put.Text : = sTemp
  2439                      en d;
  2440                    anIn .Check(0);
  2441                    sTem p := '';
  2442                  end;
  2443                if (anIn .TemplateV ital.Vital Name = 'PU LSE') and  (sPulse <>  '') then
  2444                  begin
  2445                    anIn .cbxInput. Text := sP ulse;
  2446                    sPul se := '';
  2447                  end;
  2448                if (anIn .TemplateV ital.Vital Name = 'BL OOD PRESSU RE') and ( sBP <> '')  then
  2449                  begin
  2450                    anIn .cbxInput. Text := sB P;
  2451                    sBP  := '';
  2452                  end;
  2453                if (anIn .TemplateV ital.Vital Name = 'PU LSE OXIMET RY') and ( sSpO2 <> ' ') then
  2454                  begin
  2455                    anIn .cbxInput. Text := sS pO2;
  2456                    sSpO 2 := '';
  2457                  end;
  2458              end;
  2459         end;
  2460     except
  2461       on E:  Exception  do
  2462         begi n
  2463           Sh owMessage( 'Getting C ASMED inst rument dat a error:'  + #13#10 +  E.Message );
  2464           if  Assigned( Casmed) th en
  2465              FreeAndNil (Casmed);
  2466         end;
  2467     end;
  2468   end;
  2469   /// ////// ////////// ////////// ////////// ////////// ////////// ///// CASM ED UNIT EN D
  2470  
  2471   procedure  TfrmGMV_In putLite.Mo nitorProce ss;
  2472   var
  2473     sBP, sBP Systolic,  sBPDiastol ic, sBPMea n, sPulse,  sSpO2, sT emp, sTemp Unit: Stri ng;
  2474     rTemp, r r: Real;
  2475  
  2476     i: Integ er;
  2477     anIn: Tf raGMV_Inpu tOne2;
  2478   begin
  2479     if fMoni tor = nil  then
  2480       exit;
  2481  
  2482     fMonitor .GetData;
  2483     sBP := f Monitor.sB P;
  2484     sPulse : = fMonitor .sPulse;
  2485     sSpO2 :=  fMonitor. sSpO2;
  2486     sTemp :=  fMonitor. sTemp; //  sTemp := ' 33.3';
  2487     sTempUni t := fMoni tor.sTempU nit; // sT empUnit :=  'C';
  2488  
  2489     for i :=  0 to sbxM ain.Compon entCount -  1 do
  2490       begin
  2491         if s bxMain.Com ponents[i]  is TfraGM V_InputOne 2 then
  2492           be gin
  2493              anIn := Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]);
  2494              if (anIn.T emplateVit al.VitalNa me = 'TEMP ERATURE')  and (sTemp  <> '') th en
  2495                begin
  2496                  if sTe mpUnit = c opy(anIn.l blUnit.Cap tion, 2, 1 ) then
  2497                    anIn .cbxInput. Text := sT emp
  2498                  else
  2499                    begi n
  2500                      rT emp := Str ToFloat(sT emp);
  2501                      if  sTempUnit  = 'C' the n
  2502                         rr := Conv ertCtoF(rT emp)
  2503                      el se
  2504                         rr := Conv ertFtoC(rT emp);
  2505                      sT emp := For mat('%4.1f ', [rr]);
  2506                      an In.cbxInpu t.Text :=  sTemp
  2507                    end;
  2508                  anIn.C heck(0);
  2509                  sTemp  := '';
  2510                end;
  2511              if (anIn.T emplateVit al.VitalNa me = 'PULS E') and (s Pulse <> ' ') then
  2512                begin
  2513                  anIn.c bxInput.Te xt := sPul se;
  2514                  sPulse  := '';
  2515                end;
  2516              if (anIn.T emplateVit al.VitalNa me = 'BLOO D PRESSURE ') and (sB P <> '') t hen
  2517                begin
  2518                  anIn.c bxInput.Te xt := sBP;
  2519                  sBP :=  '';
  2520                end;
  2521              if (anIn.T emplateVit al.VitalNa me = 'Syst olic_blood _pressure' ) and (sBP  <> '') th en
  2522                begin
  2523                  sBPSys tolic := s BP;
  2524                  sBP :=  '';
  2525                end;
  2526              if (anIn.T emplateVit al.VitalNa me = 'Dias tolic_bloo d_pressure ') and (sB P <> '') t hen
  2527                begin
  2528                  sBPDia stolic :=  sBP;
  2529                  sBP :=  '';
  2530                end;
  2531              if (anIn.T emplateVit al.VitalNa me = 'Mean _arterial_ pressure')  and (sBP  <> '') the n
  2532                begin
  2533                  sBPMea n := sBP;
  2534                  sBP :=  '';
  2535                end;
  2536              if (anIn.T emplateVit al.VitalNa me = 'PULS E OXIMETRY ') and (sS pO2 <> '')  then
  2537                begin
  2538                  anIn.c bxInput.Te xt := sSpO 2;
  2539                  sSpO2  := '';
  2540                end;
  2541           en d;
  2542       end;
  2543   end;
  2544   {$ENDIF}
  2545  
  2546  
  2547   procedure  TfrmGMV_In putLite.ac MonitorGet DataExecut e(Sender:  TObject);
  2548   begin
  2549   {$IFDEF US EVSMONITOR }
  2550     if Assig ned(fMonit or) and fM onitor.Act ive then
  2551       Monito rProcess
  2552     else
  2553       Casmed Process;
  2554   {$ENDIF}
  2555   end;
  2556  
  2557   procedure  TfrmGMV_In putLite.ac GetCASMEDD ataExecute (Sender: T Object);
  2558   begin
  2559   end;
  2560  
  2561   /// ////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// /
  2562  
  2563   procedure  TfrmGMV_In putLite.Fo rmKeyDown( Sender: TO bject; var  Key: Word ; Shift: T ShiftState );
  2564   begin
  2565     if (Key  = Word('Z' )) and (ss Ctrl in Sh ift) then
  2566       acGetC ASMEDDescr iptionExec ute(nil);  // CASMED
  2567     if Key =  VK_ESCAPE  then
  2568       btnCan celClick(n il);
  2569  
  2570     if Key =  VK_F1 the n
  2571       Applic ation.Help Command(0,  0);
  2572  
  2573     if (Key  = VK_Retur n) and (Ac tiveContro l = pnlPat ient) then
  2574       acPati entInfo.Ex ecute;
  2575   end;
  2576  
  2577   procedure  TfrmGMV_In putLite.cb RClick(Sen der: TObje ct);
  2578   var
  2579     i: Integ er;
  2580   begin
  2581     for i :=  0 to sbxM ain.Compon entCount -  1 do
  2582       begin
  2583         if s bxMain.Com ponents[i]  is TfraGM V_InputOne 2 then
  2584           be gin
  2585              if not ckb OnPass.Che cked then
  2586                begin
  2587                  TfraGM V_InputOne 2(sbxMain. Components [i]).cbxUn available. Enabled :=  cbU.Check ed;
  2588                  TfraGM V_InputOne 2(sbxMain. Components [i]).cbxRe fused.Enab led := cbR .Checked;
  2589                end;
  2590           en d
  2591       end;
  2592     acEnable U.Checked  := cbU.Che cked;
  2593     acEnable R.Checked  := cbR.Che cked;
  2594   end;
  2595  
  2596   procedure  TfrmGMV_In putLite.hc MouseMove( Sender: TO bject; Shi ft: TShift State; X,  Y: Integer );
  2597   var
  2598     j, i: In teger;
  2599   begin
  2600     hc.Enabl ed := True ;
  2601     j := 0;
  2602     for i :=  0 to hc.S ections.Co unt - 1 do
  2603       begin
  2604         j :=  j + hc.Se ctions[i]. Width;
  2605         if j  > X then
  2606           be gin
  2607              case i of
  2608                0:
  2609                  hc.hin t := 'Temp late Line  Number';
  2610                2:
  2611                  hc.hin t := 'U -  Unavailabl e, R - Ref used';
  2612                3:
  2613                  hc.hin t := 'Vita l Type';
  2614                4:
  2615                  hc.hin t := 'Vita l Value';
  2616                5:
  2617                  hc.hin t := 'Vita l Value Un its';
  2618                6:
  2619                  hc.hin t := 'Vita l Value Qu alifiers';
  2620              else
  2621                hc.hint  := hc.Sect ions[i].Te xt;
  2622              end;
  2623              break;
  2624           en d;
  2625       end;
  2626   end;
  2627  
  2628   procedure  TfrmGMV_In putLite.cb Conversion WarningCli ck(Sender:  TObject);
  2629   var
  2630     i: Integ er;
  2631   begin
  2632     for i :=  0 to sbxM ain.Compon entCount -  1 do
  2633       begin
  2634         if s bxMain.Com ponents[i]  is TfraGM V_InputOne 2 then
  2635           Tf raGMV_Inpu tOne2(sbxM ain.Compon ents[i]).C onversionW arning :=  cbConversi onWarning. Checked;
  2636       end;
  2637   end;
  2638  
  2639   procedure  TfrmGMV_In putLite.pn lPatientEn ter(Sender : TObject) ;
  2640   begin
  2641     pnlPatie nt.BevelIn ner := bvR aised; //  vhaishandr ia 060308
  2642   end;
  2643  
  2644   procedure  TfrmGMV_In putLite.pn lPatientEx it(Sender:  TObject);
  2645   begin
  2646     pnlPatie nt.BevelIn ner := bvN one; // vh aishandria  060308
  2647   end;
  2648  
  2649   procedure  TfrmGMV_In putLite.pn lPatientCl ick(Sender : TObject) ;
  2650   begin
  2651     acPatien tInfo.Exec ute;
  2652   end;
  2653  
  2654   procedure  TfrmGMV_In putLite.ac PatientInf oExecute(S ender: TOb ject);
  2655   begin
  2656     ShowPati entInfo(FD FN, 'Patie nt Inquiry  for: ' +  edPatientN ame.Text +  '  ' + ed PatientInf o.Text); / / vhaishan dria 06030 8
  2657   end;
  2658  
  2659   procedure  TfrmGMV_In putLite.se tPatientIn foView(aNa me, anInfo : String);
  2660   begin
  2661     edPatien tName.Text  := aName;
  2662     edPatien tInfo.Text  := anInfo ;
  2663   {$IFDEF DL L}
  2664     Caption  := 'Vitals  Lite: Ent er Vitals  for ' + aN ame + ' '  + anInfo;
  2665   {$ELSE}
  2666     Caption  := 'Vitals : Enter Vi tals for '  + aName +  ' ' + anI nfo;
  2667   {$ENDIF}
  2668   end;
  2669  
  2670   function T frmGMV_Inp utLite.get PatientNam e: String;
  2671   begin
  2672     Result : = edPatien tName.Text ;
  2673   end;
  2674  
  2675   procedure  TfrmGMV_In putLite.up datePatien tInfoView;
  2676   var
  2677     SL: TStr ingList;
  2678   begin
  2679     SL := ge tPatientHe ader(FDFN) ;
  2680     setPatie ntInfoView (FormatPat ientName(S L[1]), For matPatient Info(SL[1]  + SL[2])) ;
  2681     SL.Free;
  2682   end;
  2683  
  2684   procedure  TfrmGMV_In putLite.ed PatientNam eKeyDown(S ender: TOb ject; var  Key: Word;  Shift: TS hiftState) ;
  2685   begin
  2686     if Key =  VK_Return  then
  2687       acPati entInfo.Ex ecute;
  2688   end;
  2689  
  2690   procedure  TfrmGMV_In putLite.ac ShowStatus BarExecute (Sender: T Object);
  2691   begin
  2692     // Statu sBar.Visib le := not  StatusBar. Visible; / / uncommen t to indic ate instru ment statu s
  2693   end;
  2694  
  2695   procedure  TfrmGMV_In putLite.pn lPatientMo useDown(Se nder: TObj ect; Butto n: TMouseB utton; Shi ft: TShift State; X,  Y: Integer );
  2696   begin
  2697     pnlPatie nt.BevelOu ter := bvL owered;
  2698   end;
  2699  
  2700   procedure  TfrmGMV_In putLite.pn lPatientMo useUp(Send er: TObjec t; Button:  TMouseBut ton; Shift : TShiftSt ate; X, Y:  Integer);
  2701   begin
  2702     pnlPatie nt.BevelOu ter := bvR aised;
  2703     acPatien tInfo.Exec ute;
  2704   end;
  2705  
  2706   procedure  TfrmGMV_In putLite.ac LatestVita lsExecute( Sender: TO bject);
  2707   begin
  2708     ShowPati entLatestV itals(FDFN , 'Latest  Vitals for : ' + edPa tientName. Text + '   ' + edPati entInfo.Te xt);
  2709   end;
  2710  
  2711   procedure  TfrmGMV_In putLite.ac EnableUExe cute(Sende r: TObject );
  2712   begin
  2713     cbU.Chec ked := not  cbU.Check ed;
  2714   end;
  2715  
  2716   procedure  TfrmGMV_In putLite.ac EnableRExe cute(Sende r: TObject );
  2717   begin
  2718     cbR.Chec ked := not  cbR.Check ed;
  2719   end;
  2720  
  2721   procedure  TfrmGMV_In putLite.ac UnitsDDLEx ecute(Send er: TObjec t);
  2722   begin
  2723     chkCPRSS Tyle.Check ed := not  chkCPRSSTy le.Checked ;
  2724     acMetric StyleChang eExecute(S ender);
  2725   end;
  2726  
  2727   end.