46. EPMO Open Source Coordination Office Redaction File Detail Report

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

46.1 Files compared

# Location File Last Modified
1 CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSVIEW mGMV_GridGraph.pas Tue Dec 13 19:28:36 2016 UTC
2 CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSVIEW mGMV_GridGraph.pas Fri Mar 31 15:33:33 2017 UTC

46.2 Comparison summary

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

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

46.4 Active regular expressions

No regular expressions were active.

46.5 Comparison detail

  1   unit mGMV_ GridGraph;
  2   {
  3   ========== ========== ========== ========== ========== ========== ========== ==========
  4   *
  5   *       Ap plication:   Vitals
  6   *       Re vision:      $Revisio n: 2 $  $M odtime: 8/ 14/09 2:03 p $
  7   *       De veloper:      PII                                             
  8   *       Si te:          Hines OI FO
  9   *
  10   *       De scription:   Manages  both tabul ar and gra phical dis play of a  patients
  11   *                       vitals r ecords.  U ses the TC hart compo nent which  requires
  12   *                       the Delp hi DB comp onents be  on the pal ette as we ll.
  13   *
  14   *       No tes:
  15   *
  16   ========== ========== ========== ========== ========== ========== ========== ==========
  17   *       $A rchive: /V itals/5.0  (Version 5 .0)/5.0.23  (Patch 23 )/VITALS_5 _0_23_8/So urce/VITAL SVIEW/mGMV _GridGraph .pas $
  18   *
  19   * $History : mGMV_Gri dGraph.pas  $
  20    * 
  21    * ******* **********   Version  2  ******* **********
  22    * User: V haishandri a Date: 8/ 20/09    T ime: 10:15 a
  23    * Updated  in $/Vita ls/5.0 (Ve rsion 5.0) /5.0.23 (P atch 23)/V ITALS_5_0_ 23_8/Sourc e/VITALSVI EW
  24    * 
  25    * ******* **********   Version  1  ******* **********
  26    * User: V haishandri a Date: 8/ 12/09    T ime: 8:29a
  27    * Created  in $/Vita ls/5.0 (Ve rsion 5.0) /5.0.23 (P atch 23)/V ITALS_5_0_ 23_8/Sourc e/VITALSVI EW
  28    * 
  29    * ******* **********   Version  1  ******* **********
  30    * User: V haishandri a Date: 3/ 09/09    T ime: 3:39p
  31    * Created  in $/Vita ls/5.0 (Ve rsion 5.0) /5.0.23 (P atch 23)/V ITALS_5_0_ 23_6/Sourc e/VITALSVI EW
  32    * 
  33    * ******* **********   Version  1  ******* **********
  34    * User: V haishandri a Date: 1/ 13/09    T ime: 1:26p
  35    * Created  in $/Vita ls/5.0 (Ve rsion 5.0) /5.0.23 (P atch 23)/V ITALS_5_0_ 23_4/Sourc e/VITALSVI EW
  36    * 
  37    * ******* **********   Version  7  ******* **********
  38    * User: V haishandri a Date: 6/ 17/08    T ime: 4:04p
  39    * Updated  in $/Vita ls/5.0 (Ve rsion 5.0) /VitalsGUI 2007/Vital s/VITALSVI EW
  40    * 
  41    * ******* **********   Version  4  ******* **********
  42    * User: V haishandri a Date: 2/ 20/08    T ime: 1:42p
  43    * Updated  in $/Vita ls GUI 200 7/Vitals/V ITALSVIEW
  44    * Build 5 .0.23.0
  45    * 
  46    * ******* **********   Version  3  ******* **********
  47    * User: V haishandri a Date: 1/ 07/08    T ime: 6:52p
  48    * Updated  in $/Vita ls GUI 200 7/Vitals/V ITALSVIEW
  49    *
  50    * ******* **********   Version  2  ******* **********
  51    * User: V haishandri a Date: 7/ 17/07    T ime: 2:30p
  52    * Updated  in $/Vita ls GUI 200 7/Vitals-5 -0-18/VITA LSVIEW
  53    *
  54    * ******* **********   Version  1  ******* **********
  55    * User: V haishandri a Date: 5/ 14/07    T ime: 10:31 a
  56    * Created  in $/Vita ls GUI 200 7/Vitals-5 -0-18/VITA LSVIEW
  57    * 
  58    * ******* **********   Version  2  ******* **********
  59    * User: V haishandri a Date: 6/ 13/06    T ime: 11:15 a
  60    * Updated  in $/Vita ls/VITALS- 5-0-18/Vit alsView
  61    * 
  62    * ******* **********   Version  1  ******* **********
  63    * User: V haishandri a Date: 5/ 16/06    T ime: 5:44p
  64    * Created  in $/Vita ls/VITALS- 5-0-18/Vit alsView
  65    * GUI v.  5.0.18 upd ates the d efault vit al type IE Ns with th e local
  66    * values.
  67    * 
  68    * ******* **********   Version  1  ******* **********
  69    * User: V haishandri a Date: 5/ 16/06    T ime: 5:33p
  70    * Created  in $/Vita ls/Vitals- 5-0-18/VIT ALS-5-0-18 /VitalsVie w
  71    *
  72    * ******* **********   Version  4  ******* **********
  73    * User: V haishandri a Date: 7/ 22/05    T ime: 3:51p
  74    * Updated  in $/Vita ls/Vitals  GUI  v 5.0 .2.1 -5.0. 3.1 - Patc h GMVR-5-7  (CASMed,  CCOW) - De lphi 6/Vit alsView
  75    *
  76    * ******* **********   Version  3  ******* **********
  77    * User: V haishandri a Date: 7/ 06/05    T ime: 12:11 p
  78    * Updated  in $/Vita ls/Vitals  GUI  v 5.0 .2.1 -5.0. 3.1 - Patc h GMVR-5-7  (CASMed,  CCOW) - De lphi 6/Vit alsView
  79    *
  80    * ******* **********   Version  2  ******* **********
  81    * User: V haishandri a Date: 6/ 03/05    T ime: 6:02p
  82    * Updated  in $/Vita ls/Vitals  GUI  v 5.0 .2.1 -5.0. 3.1 - Patc h GMVR-5-7  (CASMed,  CCOW) - De lphi 6/Vit alsView
  83    *
  84    * ******* **********   Version  1  ******* **********
  85    * User: V haishandri a Date: 5/ 24/05    T ime: 5:04p
  86    * Created  in $/Vita ls/Vitals  GUI  v 5.0 .2.1 -5.0. 3.1 - Patc h GMVR-5-7  (CASMed,  CCOW) - De lphi 6/Vit alsView
  87    *
  88   *
  89   ========== ========== ========== ========== ========== ========== ========== ==========
  90   }
  91   interface
  92  
  93   uses
  94     Windows,
  95     Messages ,
  96     SysUtils ,
  97     Classes,
  98     Graphics ,
  99     Controls ,
  100     Forms,
  101     Dialogs,
  102     StdCtrls ,
  103     Grids,
  104     ExtCtrls ,
  105     Chart,
  106     Buttons,
  107     ExtDlgs,
  108     Menus, A ctnList, I mgList, Co mCtrls
  109     , mGMV_M DateTime,  TeeProcs,  Series, Te Engine, St dActns, Sy stem.Actio ns,
  110     VclTee.T eeGDIPlus,  System.Im ageList
  111     ;
  112  
  113   type
  114     TStringT oDouble =  Function(a String: St ring): Dou ble;
  115  
  116     TfraGMV_ GridGraph  = class(TF rame)
  117       pnlMai n: TPanel;
  118       Action List1: TAc tionList;
  119       acResi zeGraph: T Action;
  120       acPrin tGraph: TA ction;
  121       acValu eCaptions:  TAction;
  122       ImageL ist1: TIma geList;
  123       acGrap hButtons:  TAction;
  124       pnlGri dGraph: TP anel;
  125       splGri dGraph: TS plitter;
  126       pnlGra ph: TPanel ;
  127       pnlGri d: TPanel;
  128       grdVit als: TStri ngGrid;
  129       pnlDat eRange: TP anel;
  130       acEnte rVitals: T Action;
  131       ac3D:  TAction;
  132       pnlTit le: TPanel ;
  133       pnlPtI nfo: TPane l;
  134       Panel9 : TPanel;
  135       lblHos pital: TLa bel;
  136       Label6 : TLabel;
  137       pnlAct ions: TPan el;
  138       sbEnte rVitals: T SpeedButto n;
  139       pnlGra phBackgrou nd: TPanel ;
  140       chrtVi tals: TCha rt;
  141       pnlGri dTop: TPan el;
  142       pnlGSe lect: TPan el;
  143       acOpti ons: TActi on;
  144       Label1 : TLabel;
  145       pnlDat eRangeInfo : TPanel;
  146       Label1 1: TLabel;
  147       lblDat eFromTitle : TLabel;
  148       pnlGBo t: TPanel;
  149       pnlGTo p: TPanel;
  150       pnlGLe ft: TPanel ;
  151       pnlGRi ght: TPane l;
  152       sbEnte redInError : TSpeedBu tton;
  153       acEnte redInError : TAction;
  154       acCust omRange: T Action;
  155       pnlGra phOptions:  TPanel;
  156       PopupM enu1: TPop upMenu;
  157       cbValu es: TCheck Box;
  158       ckb3D:  TCheckBox ;
  159       cbAllo wZoom: TCh eckBox;
  160       acZoom : TAction;
  161       acGrap hOptions:  TAction;
  162       ShowHi deGraphOpt ions1: TMe nuItem;
  163       Panel5 : TPanel;
  164       pnlPTo p: TPanel;
  165       pnlPRi ght: TPane l;
  166       pnlPLe ft: TPanel ;
  167       pnlPBo t: TPanel;
  168       pnlDat eRangeTop:  TPanel;
  169       lbDate Range: TLi stBox;
  170       Panel6 : TPanel;
  171       lblDat eRange: TL abel;
  172       acEnte redInError ByTime: TA ction;
  173       N1: TM enuItem;
  174       Markas EnteredInE rror1: TMe nuItem;
  175       N2: TM enuItem;
  176       Print1 : TMenuIte m;
  177       acPati entAllergi es: TActio n;
  178       sbtnAl lergies: T SpeedButto n;
  179       ColorS elect1: TC olorSelect ;
  180       ColorD ialog1: TC olorDialog ;
  181       cbChro no: TCheck Box;
  182       cbxGra ph: TCombo Box;
  183       Select GraphColor 1: TMenuIt em;
  184       EnterV itals1: TM enuItem;
  185       Allerg ies1: TMen uItem;
  186       Panel4 : TPanel;
  187       trbHGr aph: TTrac kBar;
  188       Bevel1 : TBevel;
  189       Bevel2 : TBevel;
  190       Bevel3 : TBevel;
  191       acZoom Out: TActi on;
  192       acZoom In: TActio n;
  193       acZoom Reset: TAc tion;
  194       pnlRig ht: TPanel ;
  195       pnlDeb ug: TPanel ;
  196       pnlZoo m: TPanel;
  197       sbPlus : TSpeedBu tton;
  198       sbMinu s: TSpeedB utton;
  199       sbRese t: TSpeedB utton;
  200       edZoom : TEdit;
  201       PrintD ialog1: TP rintDialog ;
  202       sbTest : TStatusB ar;
  203       Series 2: TLineSe ries;
  204       Series 3: TLineSe ries;
  205       Series 1: TLineSe ries;
  206       acUpda teGridColo rs: TActio n;
  207       Update GridColors 1: TMenuIt em;
  208       acPati entInfo: T Action;
  209       edPati entName: T Edit;
  210       edPati entInfo: T Edit;
  211       acVita lsReport:  TAction;
  212       acRPCL og: TActio n;
  213       pnlGSe lectLeft:  TPanel;
  214       pnlGSe lectRight:  TPanel;
  215       pnlGSe lectBottom : TPanel;
  216       pnlGSe lectTop: T Panel;
  217       acShow GraphRepor t: TAction ;
  218       proced ure cbxDat eRangeClic k(Sender:  TObject);
  219       proced ure cbxGra phChange(S ender: TOb ject);
  220       proced ure ShowHi deLabels(S ender: TOb ject);
  221       proced ure chrtVi talsClickS eries(Send er: TCusto mChart; Se ries: TCha rtSeries;
  222         Valu eIndex: in teger; But ton: TMous eButton; S hift: TShi ftState; x ,
  223         Y: i nteger);
  224       proced ure chrtVi talsAfterD raw(Sender : TObject) ;
  225       proced ure sbtnPr intGraphCl ick(Sender : TObject) ;
  226       proced ure sbtnLa belsClick( Sender: TO bject);
  227       proced ure sbtnMa xGraphClic k(Sender:  TObject);
  228       proced ure grdVit alsDrawCel l(Sender:  TObject; A Col, ARow:  integer;
  229         Rect : TRect; S tate: TGri dDrawState );
  230       proced ure grdVit alsSelectC ell(Sender : TObject;  Button: T MouseButto n;
  231         Shif t: TShiftS tate; x, Y : integer) ;
  232       proced ure acResi zeGraphExe cute(Sende r: TObject );
  233       proced ure acPrin tGraphExec ute(Sender : TObject) ;
  234       proced ure acValu eCaptionsE xecute(Sen der: TObje ct);
  235       proced ure acEnte rVitalsExe cute(Sende r: TObject );
  236       proced ure ac3DEx ecute(Send er: TObjec t);
  237       proced ure lbDate RangeMouse Move(Sende r: TObject ; Shift: T ShiftState ; X,
  238         Y: I nteger);
  239       proced ure Panel9 Resize(Sen der: TObje ct);
  240       proced ure scbHGr aphChange( Sender: TO bject);
  241       proced ure chrtVi talsResize (Sender: T Object);
  242       proced ure cbxGra phExit(Sen der: TObje ct);
  243       proced ure cbxGra phEnter(Se nder: TObj ect);
  244       proced ure lbDate RangeExit( Sender: TO bject);
  245       proced ure lbDate RangeEnter (Sender: T Object);
  246       proced ure grdVit alsEnter(S ender: TOb ject);
  247       proced ure grdVit alsExit(Se nder: TObj ect);
  248       proced ure acEnte redInError Execute(Se nder: TObj ect);
  249       proced ure acCust omRangeExe cute(Sende r: TObject );
  250       proced ure lbDate RangeKeyDo wn(Sender:  TObject;  var Key: W ord;
  251         Shif t: TShiftS tate);
  252       proced ure acZoom Execute(Se nder: TObj ect);
  253       proced ure acGrap hOptionsEx ecute(Send er: TObjec t);
  254       proced ure acEnte redInError ByTimeExec ute(Sender : TObject) ;
  255       proced ure acPati entAllergi esExecute( Sender: TO bject);
  256       proced ure ColorS elect1Acce pt(Sender:  TObject);
  257       proced ure sbGrap hColorClic k(Sender:  TObject);
  258       proced ure cbChro noClick(Se nder: TObj ect);
  259       proced ure lbDate RangeMouse Up(Sender:  TObject;  Button: TM ouseButton ;
  260         Shif t: TShiftS tate; X, Y : Integer) ;
  261       proced ure chrtVi talsBefore DrawSeries (Sender: T Object);
  262       proced ure grdVit alsTopLeft Changed(Se nder: TObj ect);
  263       proced ure chrtVi talsClickL egend(Send er: TCusto mChart;
  264         Butt on: TMouse Button; Sh ift: TShif tState; X,  Y: Intege r);
  265       proced ure acZoom OutExecute (Sender: T Object);
  266       proced ure acZoom InExecute( Sender: TO bject);
  267       proced ure acZoom ResetExecu te(Sender:  TObject);
  268       proced ure splGri dGraphMove d(Sender:  TObject);
  269       proced ure chrtVi talsDblCli ck(Sender:  TObject);
  270       proced ure acUpda teGridColo rsExecute( Sender: TO bject);
  271       proced ure pnlPtI nfoEnter(S ender: TOb ject);
  272       proced ure pnlPtI nfoExit(Se nder: TObj ect);
  273       proced ure acPati entInfoExe cute(Sende r: TObject );
  274       proced ure acVita lsReportEx ecute(Send er: TObjec t);
  275       proced ure pnlPtI nfoMouseDo wn(Sender:  TObject;  Button: TM ouseButton ;
  276         Shif t: TShiftS tate; X, Y : Integer) ;
  277       proced ure pnlPtI nfoMouseUp (Sender: T Object; Bu tton: TMou seButton;
  278         Shif t: TShiftS tate; X, Y : Integer) ;
  279       proced ure grdVit alsMouseMo ve(Sender:  TObject;  Shift: TSh iftState;  X,
  280         Y: I nteger);
  281       proced ure acRPCL ogExecute( Sender: TO bject);
  282       proced ure acShow GraphRepor tExecute(S ender: TOb ject);
  283     private
  284       fAxisM ax,
  285       fAxisM in: Double ;
  286       bLabel Show: Bool ean;
  287       bIgnor eBlueLines : Boolean;
  288       fXL,fX R: LongInt ;                     // X coord inates of  the Blue L ines
  289       FbgCol or: TColor ;                     // graph b g color
  290       FbgTod ayColor: T Color;                // graph b g color
  291  
  292       ptName :String;
  293       ptInfo : String;
  294       FPatie ntDFN: str ing;                  // parent  copy to en ter vitals , to retre ive data
  295       FMDate TimeRange:  TMDateTim eRange;    // parent  copy to re treive dat a
  296       FObser vationRang e: String;            // string  copy of th e above
  297       FPatie ntLocation : String;             // parent  copy to en ter vitals
  298       FPatie ntLocation Name:Strin g;
  299  
  300       fGridR ow:Integer ;
  301       fGraph Index:Inte ger;
  302       fFrame Initialize d: Boolean ;
  303       FStyle :String; / / fsVitals  or fsDLL
  304       FCurre ntPoint: I nteger;
  305       fSelec tedDateTim e:TDateTim e;  // ent ered in er ror
  306  
  307       iIgnor eCount:Int eger;
  308       iIgnor eGraph:Int eger;
  309  
  310       functi on MetricV alueString (_Row_:Int eger;_Valu e_:String) :String;//  AAN 06/24 /2002
  311       proced ure drawMi ssingDataL ines(Sende r: TObject );
  312       proced ure drawMi ssingLines (aStartPoi nt,aStopPo int:Intege r);
  313       proced ure maximi zeGraph(Se nder: TObj ect);
  314   //    proc edure prin tGraph(Sen der: TObje ct);
  315       proced ure setPat ientDFN(co nst Value:  string);
  316       proced ure getVit alsData(aF rom,aTo:St ring);
  317       proced ure GraphD ataByIndex (anIndex:I nteger);
  318       proced ure getGra phByName(a Name:Strin g);
  319       proced ure setGra phIndex(an Index:Inte ger);
  320  
  321       proced ure setSty le(aStyle: String);
  322       proced ure setPat ientLocati on(aLocati on:String) ;
  323       proced ure setPat ientLocati onName(aLo cationName :String);
  324       proced ure setMDa teTimeRang e(aMDTR: T MDateTimeR ange);
  325  
  326       proced ure setTRP ;
  327       proced ure setBP;
  328       proced ure setBPW eight;
  329       proced ure setHW;
  330  
  331       proced ure setSin gleGraph(a nIndex:Int eger;aName :String;
  332         aCon verter:TSt ringToDoub le = nil);
  333       proced ure setSin gleVital(a Row:Intege r;aSeria:I nteger=0;a Name:Strin g='';
  334         aCon verter:TSt ringToDoub le = nil);
  335       proced ure setSer iesAxis(Th eSeries:Ar ray of Int eger);
  336  
  337       proced ure setCur rentPoint( aValue: In teger);
  338       proced ure setGri dPosition( aPosition:  Integer);
  339  
  340       proced ure setObs ervationRa nge(aRange :String);
  341       proced ure setTra ckBarLimit s;
  342  
  343       proced ure update Lists;
  344       proced ure setCol or(aColor: TColor);
  345       proced ure setTod ayColor(aC olor:TColo r);
  346  
  347       functi on GraphNa meByGridRo w(aRow:Int eger):Stri ng;
  348       functi on GridRow ByGraphInd ex(anIndex :Integer): Integer;
  349  
  350       functi on getDefa ultGridPos ition: Int eger;
  351  
  352   //    proc edure setP atientInfo View(aName ,anInfo:St ring);
  353       functi on getPati entName:St ring;
  354       functi on getPati entInfo:St ring;
  355  
  356       functi on GridScr ollBarIsVi sible:Bool ean;
  357       proced ure ShowGr aphReport;
  358     public
  359       Packag eSignature : String;    //?
  360       InputT emplateNam e: String;
  361       proced ure setGra phTitle(aF irst,aSeco nd: String );
  362       proced ure update TimeLabels ;
  363       proced ure update Frame(Relo ad:Boolean =True);
  364       proced ure setUpF rame;
  365       proced ure saveSt atus;
  366       proced ure restor eUserPrefe rences;
  367       proced ure setGra phByABBR(a ABBR:Strin g);
  368       proced ure showVi talsReport ;
  369     publishe d
  370       proper ty BGColor : TColor r ead fBGCol or write S etColor;
  371       proper ty BGToday Color: TCo lor read f BGTodayCol or write S etTodayCol or;
  372       proper ty FrameIn itialized:  Boolean   read FFram eInitializ ed write F FrameIniti alized;
  373       proper ty GraphIn dex: Integ er         read FGrap hIndex wri te setGrap hIndex; // needs upda te
  374       proper ty FrameSt yle: Strin g          read FStyl e write Se tStyle; // CPRS or Vi tals
  375       proper ty Patient DFN: strin g          read FPati entDFN wri te SetPati entDFN;
  376       proper ty Patient Location:  string     read FPati entLocatio n write Se tPatientLo cation;
  377       proper ty Patient LocationNa me:string  read FPati entLocatio nName writ e SetPatie ntLocation Name;
  378       proper ty MDateTi meRange: T MDateTimeR ange read  FMDateTime Range writ e setMDate TimeRange;
  379       proper ty Current Point: Int eger       read FCurr entPoint w rite setCu rrentPoint ;
  380       proper ty Observa tionRange:  String    read FObse rvationRan ge write s etObservat ionRange;
  381       proper ty IgnoreC ount: Inte ger        read iIgno reCount wr ite iIgnor eCount;
  382       proper ty GridRow : Integer             read fGrid Row write  fGridRow;
  383       functi on GraphIn dexByGridR ow(aRow:In teger):Int eger;
  384     end;
  385  
  386   const
  387     fsVitals  = 'Vitals ';
  388     fsDLL =  'Dll';
  389  
  390   implementa tion
  391  
  392   uses
  393     fGMV_Dat eRange,
  394     fGMV_Sho wSingleVit al
  395     , uGMV_C onst
  396     , uGMV_G lobalVars
  397     , uGMV_U ser
  398     , uGMV_U tils
  399     , fGMV_I nputLite
  400     , uGMV_E ngine
  401     , fGMV_E nteredInEr ror
  402     , fGMV_P tInfo, uGM V_VitalTyp es
  403     , uGMV_C ommon
  404     , Math
  405     , Clipbr d, Printer s
  406     , fGMV_U serSetting s, fGMV_RP CLog
  407   {$IFNDEF D LL}
  408     , fGMV_U serMain
  409   {$ENDIF}
  410     , uGMV_L og
  411     ;
  412  
  413   {$R *.DFM}
  414   const
  415     rHeader  = 0;
  416     rTemp =  1;
  417     rPulse =  2;
  418     rResp =  3;
  419     rPOx = 4 ;
  420     rBP = 6;
  421     rWeight  = 7;
  422     rBMI = 8 ;
  423     rHeight  = 9;
  424     rGirth =  10;
  425     rCVP = 1 1;
  426     rIntake  = 12;
  427     rOutput  = 13;
  428     rPain =  14;
  429     rLocatio n = 15;
  430     rEntered By = 16;
  431     rSource  = 17; // D ata Source
  432  
  433     // Graph  names==== ========== ========== ========== ========== ========== ==========
  434     sgnNoGra ph = 'No G raph';
  435  
  436     sgnTRP =  'TPR';
  437     sgnBP =  'B/P';
  438     sgnHW =  'Height/We ight';
  439     sgnPOX =  'Pulse Ox .';
  440     sgnBPWei ght = 'B/P  -- Weight ';
  441  
  442     sgnTemp  = 'Tempera ture';
  443     sgnPulse  = 'Pulse' ;
  444     sgnResp  = 'Respira tion';//   Cells[0, 4 ] := ' P O x %:'; //A AN 2003/06 /03
  445     sgnWeigh t = 'Weigh t'; //     Cells[0, 7 ] := ' Wt  (lbs):';
  446     sgnBMI =  'BMI';        //     Cells[0, 8 ] := ' BMI :';
  447     sgnHeigh t = 'Heigh t'; //     Cells[0, 9 ] := ' Ht  (in):';
  448     sgnGirth  = 'C/G';      //     Cells[0, 1 0] := ' C/ G:';
  449     sgnCVP =  'CVP';        //     Cells[0, 1 1] := ' CV P (cmH2O): ';
  450     sgnIn =  'Intake';      //     Cells[0, 1 2] := ' In  24hr (c.c .):';
  451     sgnOutpu t = 'Outpu t'; //     Cells[0, 1 3] := ' Ou t 24hr (c. c.):';
  452     sgnPain  = 'Pain';      //     Cells[0, 1 4] := ' Pa in:';
  453  
  454     iMaximum Limit = 20 00;
  455     sNoData  = 'NO DATA ';
  456  
  457   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  458  
  459   function B PMeanBP(aS tring:Stri ng):Double ;
  460   begin
  461     Result : = BPMean(a String);
  462   end;
  463  
  464   function B PDias(aStr ing:String ):Double;
  465   var
  466     s2,s3:St ring;
  467   begin
  468     s2 := Pi ece(Piece( aString,'/ ',2),' ',1 );
  469     s3 := Pi ece(Piece( aString,'/ ',3),' ',1 );
  470     if s3 =  '' then
  471       Result  := iVal(s 2)
  472     else
  473       Result  := iVal(s 3);
  474   end;
  475  
  476   function P ainNo99(aS tring:Stri ng):Double ;
  477   begin
  478     if trim( aString) =  '99' then
  479       Result  := iIgnor e
  480     else
  481       Result  := iVal(a String);
  482   end;
  483  
  484   ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////
  485  
  486   function g etDateTime (aString:S tring):Str ing;
  487   var
  488     sDate,sT ime:String ;
  489   const
  490   //  sValid  = '24:00: 00'; // 06 1227 vhais handria
  491     sValid =  '23:59:59 ';
  492   begin
  493   //    Resu lt := Piec e(aString,  '^', 1) +  ' ' + Pie ce(aString , '^', 2);  // Date T ime
  494   // vhaisha ndria 0609 20 -- 1485 03 ------- ---------- ---------- ---------- ---- Start
  495     sDate :=  Piece(aSt ring, '^',  1);
  496     sTime :=  Piece(aSt ring, '^',  2);
  497  
  498   // 061228  vhaishandr ia: 24:00: 00 is corr ected when  data is a dded to th e series o nly.
  499   // no need  to change  data in t he Grid he ader.
  500   //  if sTi me = '24:0 0:00' then         sT ime := sVa lid
  501   //  else i f sTime =  '00:00:00'  then   sT ime := sVa lid
  502     ;
  503     // vhais handria 20 07-07-17 R emedy 1485 03 ------- ---------- ----------  begin
  504     // assum ing '00:00 :00' is a  valid time  for I/O o nly
  505     if sTime  = '00:00: 00' then    sTime :=  sValid;
  506     // vhais handria 20 07-07-17 R emedy 1485 03 ------- ---------- ---------- -- end
  507  
  508     Result : = sDate +  ' ' + sTim e;
  509   // vhaisha ndria 0609 20 -- 1485 03 ------- ---------- ---------- ---------- ---- End
  510   end;
  511  
  512   function g etTemperat ure(aStrin g:String): String;
  513   begin
  514     Result : = Piece(Pi ece(aStrin g, '^', 3) , '-', 1)  + Piece(Pi ece(aStrin g, '^', 3) , '-', 2);  //tempera ture
  515   end;
  516  
  517   function g etPulse(aS tring:Stri ng):String ;
  518   var
  519     s1,s2:St ring;
  520   begin
  521     s1 := Pi ece(Piece( aString, ' ^', 4), '- ', 1);
  522     s2 := Pi ece(Piece( aString, ' ^', 4), '- ', 2);
  523     while po s(' ',s2)= 1 do
  524       s2 :=  copy(s2,2, length(s2) -1);
  525     Result : = s1 + ' '  +Piece(s2 , ' ', 1)  + ' ' +
  526                           Piece(s2 , ' ', 2)  + ' ' +
  527                           Piece(s2 , ' ', 3)  + ' ' +
  528                           Piece(s2 , ' ', 4);
  529   end;
  530  
  531   function g etRespirat ion(aStrin g:String): String;
  532   begin
  533     Result : = Piece(Pi ece(aStrin g, '^', 5) , '-', 1)  +Piece(Pie ce(aString , '^', 5),  '-', 2);  // Respira tory
  534   end;
  535  
  536   function g etBP(aStri ng:String) :String;
  537   begin
  538     Result   := Piece(P iece(aStri ng, '^', 7 ), '-', 1)  + ' ' + P iece(Piece (aString,  '^', 7), ' -', 2);
  539   end;
  540  
  541   function g etWeight(a String:Str ing):Strin g;
  542   begin
  543     Result : = Piece(Pi ece(aStrin g, '^', 8) , '-', 1)  + Piece(Pi ece(aStrin g, '^', 8) , '-', 2);
  544   end;
  545  
  546   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  547   procedure  PrintBitma p(Canvas:   TCanvas;  DestRect:   TRect;  B itmap:  TB itmap);
  548   var
  549     BitmapHe ader:  pBi tmapInfo;
  550     BitmapIm age :  POI NTER;
  551     HeaderSi ze  :  DWO RD;    //  Use DWORD  for D3-D5  compatibil ity
  552     ImageSiz e   :  DWO RD;
  553   begin
  554     GetDIBSi zes(Bitmap .Handle, H eaderSize,  ImageSize );
  555     GetMem(B itmapHeade r, HeaderS ize);
  556     GetMem(B itmapImage ,  ImageSi ze);
  557     try
  558       GetDIB (Bitmap.Ha ndle, Bitm ap.Palette , BitmapHe ader^, Bit mapImage^) ;
  559       Stretc hDIBits(Ca nvas.Handl e,
  560                      De stRect.Lef t, DestRec t.Top,      // Destin ation Orig in
  561                      De stRect.Rig ht  - Dest Rect.Left,  // Destin ation Widt h
  562                      De stRect.Bot tom - Dest Rect.Top,   // Destin ation Heig ht
  563                      0,  0,                               // Source  Origin
  564                      Bi tmap.Width , Bitmap.H eight,      // Source  Width & H eight
  565                      Bi tmapImage,
  566                      TB itmapInfo( BitmapHead er^),
  567                      DI B_RGB_COLO RS,
  568                      SR CCOPY)
  569     finally
  570       FreeMe m(BitmapHe ader);
  571       FreeMe m(BitmapIm age)
  572     end
  573   end {Print Bitmap};
  574  
  575   procedure  CPRSPrintG raph(Graph Image: TCh art; PageT itle: stri ng);
  576   var
  577     AHeader:  TStringLi st;
  578     i, y, Li neHeight:  integer;
  579     GraphPic : TBitMap;
  580     Magnif:  integer;
  581   const
  582     TX_FONT_ SIZE = 12;
  583     TX_FONT_ NAME = 'Co urier New' ;
  584     CF_BITMA P = 2;       // from  Windows.pa s
  585   begin
  586     ClipBoar d;
  587     AHeader  := TString List.Creat e;
  588   //  Create PatientHea der(AHeade r, PageTit le);
  589     aHeader. Text := Pa geTitle;
  590     GraphPic  := TBitMa p.Create;
  591     try
  592       GraphI mage.CopyT oClipboard BitMap;
  593       GraphP ic.LoadFro mClipBoard Format(CF_ BITMAP, Cl ipBoard.Ge tAsHandle( CF_BITMAP) , 0);
  594       with P rinter do
  595         begi n
  596           Ca nvas.Font. Size := TX _FONT_SIZE ;
  597           Ca nvas.Font. Name := TX _FONT_NAME ;
  598           Ti tle := aHe ader[0];
  599           Ma gnif := (( Canvas.Tex tWidth(Str ingOfChar( '=', 74)))  div Graph Image.Widt h);
  600           Li neHeight : = Printer. Canvas.Tex tHeight(TX _FONT_NAME );
  601           y  := LineHei ght;
  602           Be ginDoc;
  603           tr y
  604              for i := 0  to AHeade r.Count -  1 do
  605                begin
  606                  Canvas .TextOut(0 , y, AHead er[i]);
  607                  y := y  + LineHei ght;
  608                end;
  609              y := y + ( 4 * LineHe ight);
  610              //GraphIma ge.PrintPa rtial(Rect (0, y, Can vas.TextWi dth(String OfChar('=' , 74)), y  + (Magnif  * GraphIma ge.Height) ));
  611              PrintBitma p(Canvas,  Rect(0, y,  Canvas.Te xtWidth(St ringOfChar ('=', 74)) , y + (Mag nif * Grap hImage.Hei ght)), Gra phPic);
  612           fi nally
  613              EndDoc;
  614           en d;
  615         end;
  616     finally
  617       ClipBo ard.Clear;
  618       GraphP ic.Free;
  619       AHeade r.Free;
  620     end;
  621   end;
  622  
  623   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  624   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  625   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  626  
  627   procedure  TfraGMV_Gr idGraph.ac PrintGraph Execute(Se nder: TObj ect);
  628   var
  629     bGrid,
  630     b:Boolea n;
  631     sName,sI nfo,
  632     sPatient ,sLocation ,sPrinted, sLabel,sTy pe,sPeriod ,
  633     ss,sss:  String;
  634     i,iLen:  Integer;
  635   begin
  636     if not P rintDialog 1.Execute  then Exit;
  637  
  638     b := bIg noreBlueLi nes;
  639     bIgnoreB lueLines : = true;
  640     iLen :=  74;
  641  
  642     sLocatio n := 'Hosp ital locat ion: '+lbl Hospital.C aption;
  643     sName :=  getPatien tName;
  644     sInfo :=  getPatien tInfo;
  645  
  646     sPatient  := sName
  647       + Stri ngOfChar('  ',iLen -1  - Length( sName) - L ength(sInf o)) + sInf o;
  648     sPrinted  := 'Print ed On: ' +  FormatDat eTime('mmm  dd, yyyy   hh:nn', N ow);
  649     sLabel : = ' WORK C OPY ONLY ' ;
  650  
  651     while Le ngth(sLabe l) < iLen  do sLabel  := '*'+sLa bel +'*';
  652     sLabel : = copy(sLa bel,1,ilen -1);
  653  
  654     sPeriod  := 'Period : '+lblDat eFromTitle .Caption;
  655     sType :=  'Vitals T ype: '+cbx Graph.Text ;
  656     sss := ' ';
  657     for i :=  1 to Leng th(sPeriod ) do
  658       begin
  659         if C opy(sPerio d,i,1) = ' /' then ss s := sss +  '-'
  660         else  sss := ss s + Copy(s Period,i,1 );
  661       end;
  662     sPeriod  := sss;
  663     sss := ' ';
  664     ss := sT ype + sPer iod;
  665  
  666     while Le ngth(ss) <  iLen-1 do
  667       begin
  668         sss  := sss + '  ';
  669         ss : = sType +  sss + sPer iod;
  670       end;
  671  
  672     ss :=
  673       ss + # 13 +
  674       sPatie nt + #13 +
  675       sLabel  +  #13 +
  676       sLocat ion + Stri ngOfChar('  ', iLen -  Length(sP rinted+sLo cation)-1)  + sPrinte d+#13
  677       ;
  678  
  679     ChrtVita ls.Invalid ate;
  680     Applicat ion.Proces sMessages;
  681  
  682     bGrid :=  pnlGrid.V isible;
  683     splGridG raph.Align  := alTop;
  684     if bGrid  then pnlG rid.Visibl e := false ;
  685  
  686     CPRSPrin tGraph(Chr tVitals,ss );
  687  
  688     pnlGrid. Visible :=  bGrid;
  689     splGridG raph.Align  := alBott om;
  690  
  691     bIgnoreB lueLines : = b;
  692     ChrtVita ls.Invalid ate;
  693     Applicat ion.Proces sMessages;
  694  
  695   end;
  696   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  697  
  698   procedure  TfraGMV_Gr idGraph.Ge tVitalsDat a(aFrom,aT o:String);
  699   var
  700     VMEntry:  TStringli st;
  701  
  702     procedur e CleanUpG rid;
  703     var
  704       c,r: I nteger;
  705     begin
  706       with g rdVitals d o
  707         begi n
  708           fo r c := 1 t o ColCount  - 1 do
  709           fo r r := 1 t o RowCount  - 1 do
  710              Cells[c, r ] := '';
  711         end;
  712     end;
  713  
  714     procedur e Populate Grid;
  715     var
  716       i, c,  j: integer ;
  717       _S_,__ S,s3,
  718       s1, s2 : string;
  719     begin
  720       with g rdVitals d o
  721         begi n
  722           c  := 1;
  723           Co lCount :=  VMEntry.Co unt + 1;
  724           fo r i := VME ntry.Count  - 1 downt o 0 do
  725              begin
  726                s1 := VM Entry[i];
  727                _s_ := V MEntry[i];
  728  
  729                Cells[c,  rHeader]  := getDate Time(_s_);
  730                Cells[c,  rTemp] :=  getTemper ature(_s_) ;
  731                Cells[c,  rPulse] : = getPulse (_s_);
  732                Cells[c,  rResp] :=  getRespir ation(_s_) ;
  733  
  734                // Pulse  Oximetry
  735                s1 := Pi ece(Piece( VMEntry[i] , '^', 6),  '-', 1);/ /Value
  736                s2 := Pi ece(Piece( VMEntry[i] , '^', 6),  '-', 2);/ /Method
  737                s3 := Pi ece(Piece( VMEntry[i] , '^', 6),  '--',2);/ / ?
  738                Cells[c,  rPOx{4}]  := s1;//Mo ving quali fiers away
  739  
  740                //  REME DY-152003:  Spaces  a round "/"  affect the  presentat ion- Start
  741                __s := P iece(Piece (VMEntry[i ], '^',6),  '-', 3)+' /'+
  742                  Piece( Piece(VMEn try[i],'^' , 6), '-',  4); //Pox
  743                if __s =  '/' then
  744                  Cells[ c, rPOx+1{ 5}] := s2
  745                else
  746                  Cells[ c, rPOx+1{ 5}] := __s + ' '+s2;  // vhaisha ndria 0607 27
  747                //  REME DY-152003:  Spaces  a round "/"  affect the  presentat ion -- end
  748  
  749                Cells[c,  rBP{6}] : = getBP(_s _);
  750  
  751                Cells[c,  rWeight{7 }] := getW eight(_s_) ;
  752  
  753                Cells[c,  rBMI{8}]  := Piece(P iece(VMEnt ry[i], '^' , 10), '-' , 1)
  754                              + Pie ce(Piece(V MEntry[i],  '^', 10),  '-', 2);
  755                Cells[c,  rHeight{9 }] := Piec e(Piece(VM Entry[i],  '^', 11),  '-', 1)
  756                              + Pie ce(Piece(V MEntry[i],  '^', 11),  '-', 2);
  757                Cells[c,  rGirth{10 }] := Piec e(Piece(VM Entry[i],  '^', 13),  '-', 1)
  758                               + Pi ece(Piece( VMEntry[i] , '^', 13) , '-', 2);
  759                Cells[c,  rCVP{11}]  := Piece( VMEntry[i] , '^', 15) ;
  760                Cells[c,  rIntake{1 2}] := Pie ce(Piece(V MEntry[i],  '^', 17),  '-', 1);
  761                Cells[c,  rOutput{1 3}] := Pie ce(Piece(V MEntry[i],  '^', 18),  '-', 1);
  762                Cells[c,  rPain{14} ] := Piece (Piece(VME ntry[i], ' ^', 19), ' -', 1);
  763  
  764                Cells[c,  rLocation ] := Piece (VMEntry[i ], '^', 22 );
  765                Cells[c,  rEnteredB y] := Piec e(VMEntry[ i], '^', 2 3);
  766   {$IFDEF PA TCH_5_0_23 }
  767                Cells[c,  rSource]  := Piece(V MEntry[i],  '^', 24);
  768   {$ENDIF}
  769                for j :=  0 to 14 d o                             // AAN 07/11/ 2002
  770                  if pos ('Unavail' ,Cells[c,j ]) <> 0  t hen     // AAN 07/11/ 2002
  771                    Cell s[c,j] :=  'Unavailab le';               // AAN 07/11/ 2002
  772  
  773                inc(c);
  774              end;
  775           Co l := ColCo unt - 1;
  776           Ro w := 1;
  777         end;
  778     end;
  779  
  780   begin
  781     if not A ssigned(MD ateTimeRan ge) or (MD ateTimeRan ge.getSWRa nge = '')
  782       or (FP atientDFN  = '') then
  783       Exit;
  784  
  785     try
  786       CleanU pGrid;
  787       VMEntr y := getAl lPatientDa ta(FPatien tDFN,aFrom ,aTo);
  788       if VME ntry.Count  > 0 then
  789         Popu lateGrid;
  790       GrdVit als.Refres h;
  791     finally
  792       VMEntr y.Free;
  793     end;
  794   end;
  795  
  796   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  797   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  798   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  799  
  800   procedure  TfraGMV_Gr idGraph.se tSeriesAxi s(TheSerie s:Array of  Integer);
  801   var
  802     i: Integ er;
  803     dXMin,dX Max,
  804     dMax,dMi n,dDelta:  Double;
  805  
  806     function  LocalMin( aSeries:TC hartSeries ): Double;
  807     var
  808       j: Int eger;
  809       LM: Do uble;
  810       flag:  Boolean;
  811     begin
  812       LM :=  500;
  813       flag : = false;
  814       for j  := 0 to aS eries.Coun t - 1 do
  815         if a Series.YVa lue[j] = 0  then cont inue
  816         else
  817           be gin
  818              LM := min( LM,aSeries .YValues[j ]);
  819              flag := Tr ue;
  820           en d;
  821       if Fla g then
  822         Resu lt := LM
  823       else
  824         Resu lt :=0;
  825     end;
  826  
  827     function  LocalXMin (aSeries:T ChartSerie s): Double ;
  828     var
  829       j: Int eger;
  830       LM: Do uble;
  831     begin
  832       LM :=  Now;
  833       for j  := 0 to aS eries.Coun t - 1 do
  834         if a Series.XVa lue[j] = 0  then cont inue
  835         else  LM := min (LM,aSerie s.XValues[ j]);
  836       Result  := LM
  837     end;
  838  
  839   begin
  840     if chrtV itals.Left Axis.Minim um > 0 the n chrtVita ls.LeftAxi s.Minimum  := 0;
  841  
  842     dMax :=  chrtVitals .Series[Lo w(TheSerie s)].MaxYVa lue;
  843     dXMax :=  chrtVital s.Series[L ow(TheSeri es)].MaxXV alue;
  844     dXMin :=  LocalXMin (chrtVital s.Series[L ow(TheSeri es)]);
  845  
  846     if cbChr ono.Checke d then dMi n := chrtV itals.Seri es[Low(The Series)].M inYValue
  847     else                       dMi n := Local Min(chrtVi tals.Serie s[Low(TheS eries)]);
  848  
  849     for i :=  Low(TheSe ries) to H igh(TheSer ies) do
  850       begin
  851         if n ot chrtVit als.Series [Theseries [i]].Activ e then Con tinue;
  852         dMax  := Max(dM ax,chrtVit als.Series [Theseries [i]].MaxYV alue);
  853         if c bChrono.Ch ecked then
  854           dM in := Min( dMin,chrtV itals.Seri es[i].MinY Value)
  855         else
  856           dM in := Min( dMin,Local Min(chrtVi tals.Serie s[i]));
  857  
  858         dXMa x := Max(d XMax,chrtV itals.Seri es[Theseri es[i]].Max XValue);
  859         dXMi n := Min(d XMin,Local XMin(chrtV itals.Seri es[Theseri es[i]]));
  860  
  861       end;
  862  
  863     dDelta : = 0.05*(dM ax - dMin) ;
  864     dDelta : = max(dDel ta,0.05*dM ax);
  865     if dDelt a = 0 then  dDelta :=  1
  866     else if  dDelta < 0  then dDel ta := - dD elta;
  867  
  868     try
  869       chrtVi tals.LeftA xis.Automa tic := Fal se;
  870       if dMa x+dDelta <  chrtVital s.LeftAxis .Minimum t hen
  871         begi n
  872           ch rtVitals.L eftAxis.Mi nimum := d Min-dDelta ;
  873           ch rtVitals.L eftAxis.Ma ximum := d Max+dDelta ;
  874         end
  875       else
  876         begi n
  877           ch rtVitals.L eftAxis.Ma ximum := d Max+dDelta ;
  878           ch rtVitals.L eftAxis.Mi nimum := d Min-dDelta ;
  879         end;
  880  
  881       fAxisM ax := dMax +dDelta;
  882       fAxisM in := dMin -dDelta;
  883  
  884     except
  885       on E:  Exception  do
  886         Show Message('( 2) Set Ser ies Axis e rror:'+#13 #10+E.Mess age);
  887     end;
  888  
  889     try
  890       if dXM ax < dXMin  then  dXM ax := dXMi n;
  891  
  892       chrtVi tals.Botto mAxis.Auto matic := F alse;
  893       if chr tVitals.Bo ttomAxis.M aximum < t runc(dXMax +1) then
  894         chrt Vitals.Bot tomAxis.Ma ximum := t runc(dXMax +1)
  895       else
  896         if d XMax < chr tVitals.Bo ttomAxis.M inimum the n
  897           be gin
  898              chrtVitals .BottomAxi s.Minimum  := trunc(d XMin);
  899              chrtVitals .BottomAxi s.Maximum  := trunc(d XMax+1);
  900           en d
  901         else
  902           be gin
  903              chrtVitals .BottomAxi s.Maximum  := trunc(d XMax+1);
  904              chrtVitals .BottomAxi s.Minimum  := trunc(d XMin);
  905           en d;
  906  
  907       if chr tVitals.Bo ttomAxis.M inimum = 0  then
  908         chrt Vitals.Bot tomAxis.Mi nimum := t runc(dXMin );
  909  
  910     except
  911       on E:  Exception  do
  912         Show Message('( 3) Set Ser ies Axis e rror:'+#13 #10+E.Mess age);
  913     end;
  914  
  915     chrtVita ls.BottomA xis.ExactD ateTime :=  True;// 0 51031 vhai shandria
  916     chrtVita ls.BottomA xis.Increm ent := Dat eTimeStep[ dtOneMinut e];// 0510 31 vhaisha ndria
  917  
  918   end;
  919  
  920   procedure  TfraGMV_Gr idGraph.se tSingleVit al(aRow:In teger;aSer ia:Integer =0;aName:S tring='';
  921         aCon verter:TSt ringToDoub le = nil);
  922   var
  923     gCol: in teger;
  924     dValue:  Double;
  925     d: Doubl e;
  926  
  927     function  ValueDate Time(aCol: Integer):D ouble;
  928     var
  929       ss:Str ing;
  930       dd: Do uble;
  931     begin
  932       try
  933         ss : = grdVital s.Cells[aC ol, rHeade r];
  934         ss : = ReplaceS tr(ss,'-', '/');
  935         // v haishandri a 061228 -  replaceme nt for cha rt only. t o fix posi tion
  936         ss : = ReplaceS tr(ss,'24: 00:00','23 :59:59');
  937  
  938         // v haishandri a 2007-07- 17 Remedy  148503 --- ---------- ---------- ---- begin
  939         // a ssuming '0 0:00:00' i s a valid  time for I /O only
  940         ss : = ReplaceS tr(ss,'00: 00:00','23 :59:59');
  941         // v haishandri a 2007-07- 17 Remedy  148503 --- ---------- ---------- ------ end
  942  
  943         dD : = StrToDat eTimeDef(s s, Now);
  944       except
  945         dd : = Now;
  946       end;
  947       Result  := dd;
  948     end;
  949  
  950   begin
  951     chrtVita ls.LeftAxi s.Automati c := False ;
  952     try
  953       if 0 <  chrtVital s.LeftAxis .Maximum t hen
  954         chrt Vitals.Lef tAxis.Mini mum := 0;
  955       chrtVi tals.LeftA xis.Maximu m := 500;
  956     except
  957       on E:  Exception  do
  958         Show Message('S et Single  Vital'+#13 +E.Message );
  959     end;
  960  
  961     chrtVita ls.Series[ aSeria].Cl ear;
  962  
  963     if aName  = '' then
  964       chrtVi tals.Serie s[aSeria]. Title := g rdVitals.C ells[0,aRo w]
  965     else
  966       chrtVi tals.Serie s[aSeria]. Title := a Name;
  967  
  968     chrtVita ls.Series[ aSeria].Id entifier : = IntToStr (aRow);
  969  
  970     gCol :=  1;
  971     with grd Vitals do
  972       while  (Cells[gCo l, rHeader ] <> '') a nd (gCol <  ColCount)  do
  973         begi n
  974           tr y
  975              d := Value DateTime(g Col);
  976  
  977              if cbChron o.Checked  then
  978                begin
  979                  if Has NumericVal ue(Cells[g Col, aRow] ) then
  980                    begi n
  981                      if  assigned( aConverter ) then
  982                         dValue :=  aConverter (Cells[gCo l, aRow])
  983                      el se
  984                         dValue :=  dVal(Cells [gCol, aRo w],grdVita ls.Cells[g Col, rHead er]);
  985  
  986                      if  dValue <>  iIgnore t hen
  987                         chrtVitals .Series[aS eria].AddX Y(d,dValue , SeriesLa bel(Cells[ gCol, rHea der]), clT eeColor);
  988                    end
  989   {$IFDEF LI NES}
  990                  else
  991                    chrt Vitals.Ser ies[aSeria ].AddNull( SeriesLabe l(Cells[gC ol, rHeade r]));
  992   {$ENDIF}
  993                    ;
  994                end
  995              else
  996                begin
  997                  if ass igned(aCon verter) th en
  998                    dVal ue := aCon verter(Cel ls[gCol, a Row])
  999                  else
  1000                     dVa lue := dVa l(Cells[gC ol, aRow], grdVitals. Cells[gCol , rHeader] );
  1001                  if dVa lue <> iIg nore then
  1002                    begi n
  1003                      if  HasNumeri cValue(Cel ls[gCol, a Row]) then
  1004                         chrtVitals .Series[aS eria].Add( dValue, Se riesLabel( Cells[gCol , rHeader] ), clTeeCo lor)
  1005                      el se
  1006                         chrtVitals .Series[aS eria].AddN ull(Series Label(Cell s[gCol, rH eader]));
  1007                    end
  1008                  else / / we can n ot just de lete 99 fo r pain
  1009                    chrt Vitals.Ser ies[aSeria ].AddNull( SeriesLabe l(Cells[gC ol, rHeade r]))
  1010                end;
  1011           ex cept
  1012              chrtVitals .Series[aS eria].AddN ull(Series Label(Cell s[gCol, rH eader]));
  1013           en d;
  1014           in c(gCol);
  1015         end;
  1016  
  1017     setSerie sAxis([aSe ria]);
  1018  
  1019     try
  1020       if aRo w = rPain  then chrtV itals.Left Axis.Minim um := -0.5 ;
  1021       if aRo w = rPain  then chrtV itals.Left Axis.Maxim um := 12;
  1022     except
  1023       on E:  Exception  do
  1024         Show Message('P ain setup  error:'+#1 3#10+E.Mes sage);
  1025     end;
  1026  
  1027     chrtVita ls.Series[ aSeria].Ac tive := Tr ue;
  1028  
  1029     try
  1030       if (gr dVitals.Co lCount = 2 ) and
  1031         ((po s(sNoData, grdVitals. Cells[1,0] ) = 1)
  1032           or  (trim(grd Vitals.Cel ls[1,aRow] )='')) the n
  1033        chrtV itals.Seri es[aSeria] .Active :=  False;
  1034     except
  1035     end;
  1036   end;
  1037  
  1038   procedure  TfraGMV_Gr idGraph.se tHW;
  1039   begin
  1040     SetSingl eVital(rHe ight,0,'He ight');
  1041     SetSingl eVital(rWe ight,1,'We ight');
  1042     setSerie sAxis([0,1 ]);
  1043   end;
  1044  
  1045   procedure  TfraGMV_Gr idGraph.se tTRP;
  1046   begin
  1047     SetSingl eVital(rTe mp,0,'Temp .');
  1048     SetSingl eVital(rPu lse,1,'Pul se');
  1049     SetSingl eVital(rRe sp,2,'Resp .');
  1050     setSerie sAxis([0,1 ,2]);
  1051   end;
  1052  
  1053   procedure  TfraGMV_Gr idGraph.se tBP;
  1054   begin
  1055     SetSingl eVital(rBP ,0,'Sys.') ;
  1056   //  SetSin gleVital(r BP,1,'Mean ',BPMeanBP );
  1057   //  SetSin gleVital(r BP,2,'Dias .',BPDias) ;
  1058   //  setSer iesAxis([0 ,1,2]);
  1059     SetSingl eVital(rBP ,1,'Dias.' ,BPDias);
  1060     setSerie sAxis([0,1 ]);
  1061   end;
  1062  
  1063   procedure  TfraGMV_Gr idGraph.se tBPWeight;
  1064   begin
  1065     SetSingl eVital(rBP ,0,'Sys.') ;
  1066     SetSingl eVital(rBP ,1,'Dias.' ,BPDias);
  1067     SetSingl eVital(rWe ight,2,'We ight');
  1068     setSerie sAxis([0,1 ,2]);
  1069   end;
  1070  
  1071   procedure  TfraGMV_Gr idGraph.se tSingleGra ph(anIndex :Integer;a Name:Strin g;
  1072         aCon verter:TSt ringToDoub le = nil);
  1073   begin
  1074     SetSingl eVital(anI ndex,0,aNa me,aConver ter);
  1075   end;
  1076  
  1077   //======== ========== ========== ========== ========== ========== ========== ==========
  1078   //======== ========== ========== ========== ========== ========== ========== ==========
  1079   //======== ========== ========== ========== ========== ========== ========== ==========
  1080  
  1081   function T fraGMV_Gri dGraph.get DefaultGri dPosition:  Integer;
  1082   begin
  1083     Result : = (grdVita ls.Width -  grdVitals .ColWidths [0]-grdVit als.GridLi neWidth)
  1084       div (g rdVitals.C olWidths[1 ]+grdVital s.GridLine Width);
  1085     Result : = grdVital s.ColCount  - Result;
  1086     if Resul t < 1 then
  1087       Result  := 1;
  1088   end;
  1089  
  1090   procedure  TfraGMV_Gr idGraph.ge tGraphByNa me(aName:S tring);
  1091  
  1092     function  DataFound :Boolean;
  1093     var
  1094       i: int eger;
  1095     begin
  1096       DataFo und := Fal se;
  1097       for i  := 1 to gr dVitals.Co lCount - 1  do
  1098         begi n
  1099           if  Trim(grdV itals.Cell s[i,fGridR ow]) = ''  then conti nue;
  1100           Da taFound :=  True;
  1101           Br eak;
  1102         end;
  1103     end;
  1104  
  1105     procedur e CleanUp;
  1106     var
  1107       j: Int eger;
  1108     begin
  1109       with c hrtVitals  do
  1110         begi n
  1111           Sc aleLastPag e := true;
  1112           Un doZoom;
  1113           fo r j := Ser iesList.Co unt-1 down to 0 do
  1114              begin
  1115                Series[j ].Clear;
  1116                Series[j ].Active : = False;
  1117                Series[j ].Marks.Vi sible := c bValues.Ch ecked;
  1118              end;
  1119         end;
  1120     end;
  1121  
  1122   begin
  1123     acGraphB uttons.Ena bled := Tr ue;
  1124     acResize Graph.Enab led := Tru e;
  1125  
  1126     if FPati entDFN = ' ' then  Ex it;
  1127  
  1128     if (aNam e = sgnNoG raph) or ( aName = sg nGirth) th en
  1129       begin
  1130         chrt Vitals.Vis ible := Fa lse;
  1131         acGr aphButtons .Enabled : = False;
  1132         acRe sizeGraph. Enabled :=  False;
  1133         if n ot pnlGrid .Visible t hen Maximi zeGraph(ni l);
  1134         if a Name = sgn NoGraph th en
  1135           pn lGraphBack ground.Cap tion := 'S orry there  is no dat a for this  graph.'
  1136         else
  1137           pn lGraphBack ground.Cap tion := 'S orry the g raph of <' +aName+'>  is not ava ilable.';
  1138         Exit ;
  1139       end
  1140     else
  1141       chrtVi tals.Visib le := True ;
  1142  
  1143     CleanUp;
  1144  
  1145     if aName  = sgnTRP  then setTR P
  1146     else if  aName = sg nBP then   setBP
  1147     else if  aName = sg nPain then  setSingle Graph(rPai n,sgnPain, PainNo99)  // values  of 99 will  be ignore d
  1148     else if  aName = sg nHW then s etHW
  1149     else if  aName = sg nPOX then  setSingleG raph(rPOx, sgnPOX)
  1150     else if  aName = sg nHeight th en setSing leGraph(rH eight,sgnH eight)
  1151     else if  aName = sg nWeight th en setSing leGraph(rW eight,sgnW eight)
  1152     else if  aName = sg nBMI then  setSingleG raph(rBMI, sgnBMI)
  1153     else if  aName = sg nTemp then  setSingle Graph(rTem p,sgnTemp)
  1154     else if  aName = sg nPulse the n setSingl eGraph(rPu lse,sgnPul se)
  1155     else if  aName = sg nResp then  setSingle Graph(rRes p,sgnResp)
  1156  
  1157     else if  aName = sg ngIRTH the n setSingl eGraph(rGi rth,sgngIR TH)
  1158     else if  aName = sg nCVP then  setSingleG raph(rCVP, sgnCVP)
  1159     else if  aName = sg nIn then s etSingleGr aph(rIntak e,sgnIn)
  1160     else if  aName = sg nOutput th en setSing leGraph(rO utput,sgnO utput)
  1161  
  1162     else if  aName = sg nBPWeight  then  setB PWeight
  1163     ;
  1164  
  1165     if aName  = sgnTemp  then
  1166       chrtVi tals.LeftA xis.MinorT ickCount : = 9
  1167     else
  1168       chrtVi tals.LeftA xis.MinorT ickCount : = 4;
  1169  
  1170     setTrack BarLimits;
  1171     // the n ext line w as uncomme nted to fi x Remedy 2 81003. vha ishandria  2008-11-03
  1172     CurrentP oint := ge tDefaultGr idPosition ; //commen ted  vhais handria 20 08-08-07
  1173     trbHGrap h.Position  := getDef aultGridPo sition;
  1174   end;
  1175  
  1176   procedure  TfraGMV_Gr idGraph.Gr aphDataByI ndex(anInd ex:Integer );
  1177   var
  1178     aTime: T DateTime;
  1179   begin
  1180     aTime :=  now;
  1181     getGraph ByName(cbx Graph.Item s[anIndex] );
  1182     EventAdd ('GraphDat aByIndex.U pdateFrame ',Format(' GraphIndex =%d',[Grap hIndex]),a Time);
  1183   end;
  1184  
  1185   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1186  
  1187   function T fraGMV_Gri dGraph.Gri dScrollBar IsVisible: Boolean;
  1188   begin
  1189     Result : = (GetWind owlong(grd Vitals.Han dle, GWL_S TYLE) and  WS_VSCROLL ) <> 0;//  vhaishandr ia 2008103 1
  1190   end;
  1191  
  1192   procedure  TfraGMV_Gr idGraph.se tTrackBarL imits;
  1193   var
  1194     iGridCol Count: Int eger;
  1195     iMax: In teger;
  1196   begin
  1197     iGridCol Count := ( grdVitals. Width - gr dVitals.Co lWidths[0] ) div
  1198       (grdVi tals.ColWi dths[1]+gr dVitals.Gr idLineWidt h);
  1199     if GridS crollBarIs Visible  t hen
  1200       Inc(iG ridColCoun t);
  1201  
  1202     iMax :=  (grdVitals .ColCount  - 1) - (iG ridColCoun t - 1);
  1203     if GridS crollBarIs Visible  t hen
  1204       Inc(iM ax);
  1205   (* vhaisha ndria 2008 -04-13 === ========== ========== ========== ========== ==========
  1206     if (Fram eStyle=fsV itals) the n //vhaish andria 051 205
  1207       iMax : = iMax - 1 ;
  1208   ========== ========== ========== ========== ========== ========== ========== ========*)
  1209     if iMax  < 1 then
  1210       iMax : = 1;
  1211  
  1212     trbHGrap h.min := 1 ;
  1213     trbHGrap h.max := i Max;
  1214   end;
  1215  
  1216   procedure  TfraGMV_Gr idGraph.se tGridPosit ion(aPosit ion: Integ er);
  1217   var
  1218     iPos,
  1219     iMin,iMa x: Integer ;
  1220  
  1221     function  getVisibl eColumnsCo unt:Intege r;
  1222     begin
  1223       Result  := ((grdV itals.Widt h - grdVit als.ColWid ths[0]) di v grdVital s.ColWidth s[1]);
  1224   (*  vhaish andria 200 8-04-13 == ========== ========== ========== ========== ==========
  1225       if (Fr ameStyle=f sVitals) t hen
  1226   //    and  scrollbarI sVisible t hen
  1227         Resu lt := Resu lt + 1;
  1228   ========== ========== ========== ========== ========== ========== ========== ========*)
  1229     end;
  1230  
  1231   begin
  1232     try
  1233       iPos : = aPositio n;
  1234       if iPo s < 1 then  iPos := 1 ;
  1235       grdVit als.LeftCo l := iPos;
  1236  
  1237       sbTest .SimpleTex t := Forma t(
  1238         ' Cu rrent Tab  Position:  %4d (%4d/% 4d)  Leftm ost Grid c olumn %4d  (Total: %4 d)',
  1239         [aPo sition,trb HGraph.Min ,trbHGraph .Max,grdVi tals.LeftC ol,grdVita ls.ColCoun t]);
  1240  
  1241       if not  cbChrono. Checked th en
  1242         begi n
  1243           ch rtVitals.B ottomAxis. Automatic  := False;
  1244           iM in := grdV itals.Left Col -1; //  needs cor rection be couse Seri es starts  from 0
  1245           iM ax  := iMi n + getVis ibleColumn sCount - 1 ;
  1246           if  iMin <= i Max then
  1247              begin
  1248                if chrtV itals.Bott omAxis.Min imum > iMi n then
  1249                  begin
  1250                    chrt Vitals.Bot tomAxis.Mi nimum := i Min;
  1251                    chrt Vitals.Bot tomAxis.Ma ximum := i Max;
  1252                  end
  1253                else
  1254                if chrtV itals.Bott omAxis.Max imum < iMa x then
  1255                  begin
  1256                    chrt Vitals.Bot tomAxis.Ma ximum := i Max;
  1257                    chrt Vitals.Bot tomAxis.Mi nimum := i Min;
  1258                  end
  1259                else
  1260                  begin
  1261                    chrt Vitals.Bot tomAxis.Mi nimum := 0 ;
  1262                    chrt Vitals.Bot tomAxis.Ma ximum := i Max;
  1263                    chrt Vitals.Bot tomAxis.Mi nimum := i Min;
  1264                  end;
  1265              end;
  1266           ch rtVitals.I nvalidate;
  1267         end
  1268       else
  1269         setS eriesAxis( [0,1,2]);
  1270  
  1271     except
  1272   {$IFDEF AA NTEST}
  1273       on E:  Exception  do
  1274         Show Message('3 '+#13#10+E .Message);
  1275   {$ENDIF}
  1276     end;
  1277   end;
  1278  
  1279   procedure  TfraGMV_Gr idGraph.se tCurrentPo int(aValue : Integer) ;
  1280   begin
  1281     FCurrent Point := a Value;
  1282     grdVital s.LeftCol  := aValue; // vhaisha ndria 0512 04
  1283   //  if iIg noreCount  > 0 then E xit; //vha ishandria  2008-08-07
  1284     Inc(iIgn oreCount);
  1285     setGridP osition(aV alue);
  1286     Dec(iIgn oreCount);
  1287   end;
  1288  
  1289   procedure  TfraGMV_Gr idGraph.sc bHGraphCha nge(Sender : TObject) ;
  1290   begin
  1291     CurrentP oint := tr bHGraph.Po sition;
  1292   end;
  1293  
  1294   procedure  TfraGMV_Gr idGraph.gr dVitalsTop LeftChange d(Sender:  TObject);
  1295   begin
  1296     trbHGrap h.Position  := grdVit als.LeftCo l;
  1297     CurrentP oint := gr dVitals.Le ftCol;
  1298     chrtVita ls.Invalid ate;
  1299   end;
  1300  
  1301   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1302  
  1303   procedure  TfraGMV_Gr idGraph.se tMDateTime Range(aMDT R: TMDateT imeRange);
  1304   begin
  1305     FMDateTi meRange :=  aMDTR;
  1306     UpdateTi meLabels;
  1307   end;
  1308  
  1309   procedure  TfraGMV_Gr idGraph.se tObservati onRange(aR ange:Strin g);
  1310   var
  1311     aTime: T DateTime;
  1312   begin
  1313     if MDate TimeRange. setMRange( aRange) th en
  1314       begin
  1315         if ( Uppercase( aRange) =  sDateRange ) then
  1316           Up dateLists;
  1317  
  1318         FObs ervationRa nge:= aRan ge;
  1319         upda teTimeLabe ls;
  1320         //se t interfac e elements
  1321         lbDa teRange.It emIndex :=  lbDateRan ge.Items.I ndexOf(FOb servationR ange);
  1322  
  1323         if i IGnoreCoun t > 0 then  Exit;
  1324         Inc( iIgnoreCou nt);
  1325         if F rameInitia lized then
  1326           be gin //vhai shandria 0 60610
  1327              aTime := E ventStart( 'SetObserv ationRange .UpdateFra me');
  1328              UpdateFram e;
  1329              EventStop( 'SetObserv ationRange .UpdateFra me','Reloa d',aTime);
  1330           en d;
  1331         Dec( iIgnoreCou nt);
  1332       end;
  1333   end;
  1334  
  1335   procedure  TfraGMV_Gr idGraph.cb xDateRange Click(Send er: TObjec t);
  1336   var
  1337     s: Strin g;
  1338   begin
  1339     try // v haishandri a 051208
  1340       if lbD ateRange.I temIndex =  -1 then
  1341         s :=  lbDateRan ge.Items[0 ]
  1342       else
  1343         s :=  lbDateRan ge.Items[l bDateRange .ItemIndex ];
  1344     except
  1345     end;
  1346  
  1347     Observat ionRange : = s;
  1348  
  1349     if fStyl e = fsVita ls then
  1350       GetPar entForm(Se lf).Perfor m(CM_PERIO DCHANGED,  0, 0);
  1351   end;
  1352  
  1353   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1354  
  1355   procedure  TfraGMV_Gr idGraph.Up dateFrame( Reload:Boo lean=True) ;
  1356   var
  1357     MDT: TMD ateTime;
  1358     aComment s: String;
  1359   begin
  1360     if not F rameInitia lized then
  1361       Exit;
  1362     aComment s := 'No R eload';
  1363     try
  1364       if Rel oad then   // vhaisha ndria 0606 09
  1365         begi n
  1366           aC omments :=  'Reload';
  1367           MD T := TMDat eTime.Crea te;
  1368           MD T.WDateTim e := MDate TimeRange. Stop.WDate Time;
  1369           MD T.WDateTim e := trunc (MDT.WDate Time)+1-5/ (3600*24);
  1370           Ge tVitalsDat a(MDateTim eRange.Sta rt.getSMDa teTime,MDT .getSMDate Time);
  1371           MD T.Free;
  1372         end;
  1373       GraphD ataByIndex (GraphInde x);
  1374  
  1375       grdVit als.Invali date;
  1376       chrtVi tals.Inval idate;
  1377     except
  1378       on E:E xception d o
  1379         Show Message('E rror in Tf raGMV_Grid Graph.Upda teFrame: '  + E.Messa ge);
  1380     end;
  1381   end;
  1382  
  1383   procedure  TfraGMV_Gr idGraph.se tPatientDF N(const Va lue: strin g);
  1384   var
  1385     aTime:TD ateTime;
  1386   begin
  1387     FPatient DFN := Val ue;
  1388     Visible  := (Value  <> '');
  1389     if iIgno reCount >  0 then
  1390       Exit;/ /  vhaisha ndria 0512 02
  1391  
  1392     if Assig ned(MDateT imeRange)  then
  1393       begin  //vhaishan dria 06061 0
  1394         aTim e := Event Start('Set PatientDFN  -- Begin' );
  1395         Upda teFrame;
  1396         Even tStop('Set PatientDFN  -- End',' DFN: '+fPa tientDFN,a Time);
  1397       end;
  1398   end;
  1399  
  1400   procedure  TfraGMV_Gr idGraph.se tGraphInde x(anIndex:  Integer);
  1401   begin
  1402     fGraphIn dex := anI ndex;
  1403  
  1404     if iIgno reCount >  0 then Exi t;
  1405     Inc(iIgn oreCount);
  1406  
  1407     if FGrap hIndex <>  iIgnoreGra ph then
  1408       begin
  1409         cbxG raph.ItemI ndex := fG raphIndex;
  1410         getG raphByName (cbxGraph. Items[Grap hIndex]);
  1411       end
  1412     else
  1413       begin
  1414         fGra phIndex :=  0;
  1415         getG raphByName (sgnNoGrap h);
  1416       end;
  1417  
  1418     grdVital s.Invalida te;
  1419     chrtVita ls.Invalid ate;
  1420  
  1421     Dec(iIgn oreCount);
  1422   end;
  1423  
  1424   procedure  TfraGMV_Gr idGraph.cb xGraphChan ge(Sender:  TObject);
  1425   begin
  1426     if Sende r = cbxGra ph then
  1427       GraphI ndex := cb xGraph.Ite mIndex;
  1428  
  1429     case Gra phIndex of
  1430       0: fGr idRow := 1 ;
  1431       1: fGr idRow := 2 ;
  1432       2: fGr idRow := 3 ;
  1433       3: fGr idRow := 6 ;
  1434       4: fGr idRow := 4 ;
  1435       5: fGr idRow := 9 ;
  1436       6: fGr idRow := 7 ;
  1437       7: fGr idRow := 8 ;
  1438       8: fGr idRow := 1 4;
  1439  
  1440       12: fG ridRow :=  10;
  1441       13: fG ridRow :=  11;
  1442       14: fG ridRow :=  12;
  1443       15: fG ridRow :=  13;
  1444     else fGr idRow := - 1;
  1445     end;
  1446  
  1447     //vhaish andria 060 610
  1448     UpdateFr ame;
  1449   end;
  1450  
  1451   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1452   // Resizin g ======== ========== ========== ========== ========== ========== ==========
  1453  
  1454   procedure  TfraGMV_Gr idGraph.ch rtVitalsRe size(Sende r: TObject );
  1455   begin
  1456     setTrack BarLimits;
  1457     setGridP osition(gr dVitals.Le ftCol{-1}) ;// vhaish andria 051 130
  1458   end;
  1459  
  1460   procedure  TfraGMV_Gr idGraph.Ma ximizeGrap h(Sender:  TObject);
  1461   begin
  1462     pnlGrid. Visible :=  (pnlGrid. Visible =  False);
  1463     if fStyl e = fsVita ls then
  1464       begin
  1465         if p nlGrid.Vis ible then
  1466           be gin
  1467              splGridGra ph.Visible  := True;
  1468              splGridGra ph.Align : = alTop;
  1469           en d
  1470         else
  1471           be gin
  1472              splGridGra ph.Visible  := False;
  1473              splGridGra ph.Align : = alBottom ;
  1474           en d;
  1475       end
  1476     else
  1477       begin
  1478         if p nlGrid.Vis ible then
  1479           be gin
  1480              splGridGra ph.Visible  := True;
  1481              splGridGra ph.Align : = alBottom ;
  1482           en d
  1483         else
  1484           be gin
  1485              splGridGra ph.Visible  := False;
  1486              splGridGra ph.Align : = alTop;
  1487           en d;
  1488       end;
  1489   end;
  1490  
  1491   procedure  TfraGMV_Gr idGraph.Pa nel9Resize (Sender: T Object);
  1492   begin
  1493     lblHospi tal.Width  := panel9. Width - lb lHospital. Left - 4;
  1494     lblHospi tal.Height  := panel9 .Height -  lblHospita l.Top - 2;
  1495   end;
  1496  
  1497   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1498  
  1499   procedure  TfraGMV_Gr idGraph.cb ChronoClic k(Sender:  TObject);
  1500   var
  1501     aTime: T DateTime;
  1502     iPos: In teger;
  1503   begin
  1504     if iIgno reCount >  0 then Exi t;
  1505     iPos :=  grdVitals. LeftCol; / / vhaishan dria 2008- 04-14
  1506  
  1507     ChrtVita ls.SeriesL ist[0].XVa lues.DateT ime := cbC hrono.Chec ked;
  1508     ChrtVita ls.SeriesL ist[1].XVa lues.DateT ime := cbC hrono.Chec ked;
  1509     ChrtVita ls.SeriesL ist[2].XVa lues.DateT ime := cbC hrono.Chec ked;
  1510  
  1511     ckb3D.En abled := c bChrono.Ch ecked;
  1512     if not c bChrono.Ch ecked then
  1513       begin
  1514         ckb3 D.Checked  := False;
  1515         ckb3 D.Enabled  := False;
  1516       end;
  1517  
  1518     aTime :=  Now;
  1519     UpdateFr ame;
  1520     EventAdd ('UpdateFr ame.cbChro noClick',' ',aTime);
  1521     grdVital s.LeftCol  := iPos; / / vhaishan dria 2008- 04-14
  1522  
  1523     // vhais handria 20 08-08-07 l ast minute  fix for P atch 5.0.2 2.7
  1524     // axis  X min is n ot set cor rectly whe n in Sychr o mode
  1525     CurrentP oint := tr bHGraph.Po sition;//  vhaishandr ia 2008-08 -07
  1526   end;
  1527  
  1528   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1529  
  1530   procedure  TfraGMV_Gr idGraph.Up dateTimeLa bels;
  1531   begin
  1532     lblDateF romTitle.C aption :=  MDateTimeR ange.Start .getSWDate ;
  1533     lblDateF romTitle.C aption :=  lblDateFro mTitle.Cap tion + ' - - ' + MDat eTimeRange .Stop.getS WDate;
  1534  
  1535     Applicat ion.Proces sMessages;
  1536   end;
  1537  
  1538   procedure  TfraGMV_Gr idGraph.Up dateLists;
  1539   begin
  1540     if (pos( MDateTimeR ange.getSW Range,lbDa teRange.It ems.Text)  = 0) then
  1541       begin
  1542         lbDa teRange.It ems.Add(MD ateTimeRan ge.getSWRa nge);
  1543         lbDa teRange.It emIndex :=  lbDateRan ge.Items.I ndexOf(MDa teTimeRang e.getSWRan ge);
  1544       end;
  1545   end;
  1546  
  1547   procedure  TfraGMV_Gr idGraph.se tGraphTitl e(aFirst,a Second: st ring);
  1548   begin
  1549     chrtVita ls.Title.T ext.Clear;
  1550     chrtVita ls.Title.T ext.Add(aF irst);
  1551     chrtVita ls.Title.T ext.Add(aS econd);
  1552  
  1553     edPatien tName.Text  := aFirst ;
  1554     edPatien tInfo.Text := aSecond ;
  1555  
  1556     ptName : = aFirst;
  1557     ptInfo : = aSecond;
  1558   end;
  1559  
  1560   procedure  TfraGMV_Gr idGraph.Sh owHideLabe ls(Sender:  TObject);
  1561   var
  1562     i: integ er;
  1563   begin
  1564     for i :=  0 to chrt Vitals.Ser iesCount -  1 do
  1565       if chr tVitals.Se ries[i].Ac tive then
  1566         chrt Vitals.Ser ies[i].Mar ks.Visible  := bLabel Show;
  1567   end;
  1568  
  1569   function T fraGMV_Gri dGraph.Met ricValueSt ring(_Row_ :Integer;_ Value_:Str ing):Strin g;
  1570   var
  1571     s: Strin g;
  1572     f: Exten ded;
  1573   begin
  1574     Result : = '';
  1575     s := pie ce(_Value_ ,' ');
  1576     if pos(' *',s)=Leng th(s) then  s := copy (s,1,Lengt h(s)-1);
  1577     case _Ro w_ of
  1578       1:try  //Temperat ure
  1579              f := StrTo Float(S);
  1580              f := (f-32 )/9*5;
  1581              s := forma t('%-8.1f  (C)',[f]);
  1582              Result :=  s;
  1583           ex cept
  1584           en d;
  1585       7:try  //Weight
  1586              f := StrTo Float(S);
  1587              f := f*0.4 535924;
  1588              s := forma t('%-8.2f  (kg)',[f]) ;
  1589              Result :=  s;
  1590         exce pt
  1591         end;
  1592       9,10:  try //Heig ht, C/G
  1593              f := StrTo Float(S);
  1594              f := f*2.5 4;
  1595              s := forma t('%-8.2f  (cm)',[f]) ;
  1596              Result :=  s;
  1597         exce pt
  1598         end;
  1599       else
  1600         Resu lt := '';
  1601     end;
  1602   end;
  1603  
  1604   procedure  TfraGMV_Gr idGraph.ch rtVitalsCl ickSeries( Sender: TC ustomChart ;
  1605     Series:  TChartSeri es; ValueI ndex: inte ger; Butto n: TMouseB utton;
  1606     Shift: T ShiftState ; x, Y: in teger);
  1607   const
  1608     iDate =  1;
  1609     iTime =  2;
  1610     iLocatio n = 22;
  1611     iEntered By = 23;
  1612  
  1613   var
  1614     iCol,iRo w:Integer;
  1615     d: Doubl e;
  1616     sFrom,sT o,sFor:Str ing;
  1617     AllVital sData,
  1618     VitalsDa ta: TStrin gList;
  1619     MDT: TMD ateTime;
  1620  
  1621     procedur e SetVital Info(aRow: Integer);
  1622     var
  1623       sv: St ring;
  1624       sName,
  1625       sValue , sMetric:  String;
  1626     begin
  1627       sName  := grdVita ls.Cells[0 , aRow];
  1628       if pos (':',sName ) = length (sName) th en
  1629         sNam e := copy( sName,1,Le ngth(sName )-1);
  1630       sV :=  grdVitals. Cells[iCol , aRow];
  1631       if Tri m(sV) <> ' ' then sVa lue := Tri m(sV)
  1632       else                     sVa lue := sNo Data;
  1633       sMetri c := Metri cValueStri ng(aRow,gr dVitals.Ce lls[iCol,  aRow]);
  1634  
  1635       Vitals Data.Add('   Vital:'  + #9 + sNa me);
  1636       Vitals Data.Add('   Value:'  + #9 + sVa lue);
  1637       if sMe tric <> ''  then  Vit alsData.Ad d('         ' + #9 +  sMetric);
  1638       if aRo w = 4 then        Vit alsData.Ad d('         ' + #9 +  grdVitals. Cells[iCol , 5]);
  1639       Vitals Data.Add(' ');
  1640     end;
  1641  
  1642     function  ConvertVi talsToText :String;
  1643     var
  1644       i: Int eger;
  1645       _S_,__ S,s3,//AAN
  1646       s1, s2 : string;
  1647       s,ss,
  1648       sDate, sTime, sLo cation,sEn teredBy, s OldInfo,sN ewInfo,
  1649       sTemp,  sPulse,sR esp,sBP,sP Ox, sFive,  sWt, sBMI ,
  1650       sHt, s Girth, sCV P, sIn, sO ut,sPain:S tring;
  1651     const
  1652       CRLF =  #13#10;
  1653       TAB =  char(VK_TA B);
  1654  
  1655       proced ure AddVal ue(aLabel, aValue:Str ing);
  1656       begin
  1657         if a Value <>''  then
  1658           be gin
  1659              ss := ss +  TAB+sTime  + TAB + a Label+Piec e(aValue,'  ',1)+TAB+ piece(aVal ue,' ',2,9 9) + CRLF;
  1660              sTime := T AB;
  1661           en d;
  1662       end;
  1663  
  1664     begin
  1665       sOldIn fo := '';
  1666       sNewIn fo := '';
  1667       s := ' ';
  1668       ss :=  '';
  1669       sDate  := '';
  1670       sTime  := '';
  1671  
  1672       for i  := 0 to  A llVitalsDa ta.Count -  1 do
  1673         begi n
  1674           s  := AllVita lsData[i];
  1675           s1  := s;
  1676           _s _ := s;
  1677  
  1678           sD ate := Pie ce(s,'^',i Date);
  1679           sT ime := Pie ce(s,'^',i Time);
  1680   // 061228  vhaishandr ia uncomme ning 2 lin es
  1681           if  i = 0 the n
  1682               ss := ss  + CRLF + T AB + sDate  + CRLF;
  1683  
  1684           sL ocation :=  Piece(s,' ^',iLocati on);
  1685           sE nteredBy : = Piece(s, '^',iEnter edBy);
  1686  
  1687           sN ewInfo :=  '--------- ------ Loc ation: '+  sLocation+  char(VK_T AB)+'  Ent ered By: ' +sEnteredB y+' ------ ---------' ;
  1688           if  sNewInfo  <> sOldInf o then
  1689              begin
  1690                ss := ss  + CRLF +  TAB+sNewIn fo+CRLF;
  1691                sOldInfo  := sNewIn fo;
  1692              end;
  1693   //         ss := ss +  TAB+sTime +CRLF;
  1694   //         ss := ss +  TAB+sTime ;
  1695           sT emp := Pie ce(Piece(s , '^', 3),  '-', 1) +  Piece(Pie ce(s, '^',  3), '-',  2); //temp erature
  1696  
  1697           s1  := Piece( Piece(s, ' ^', 4), '- ', 1);
  1698           s2  := Piece( Piece(s, ' ^', 4), '- ', 2);
  1699  
  1700           wh ile pos('  ',s2)=1 do   s2 := co py(s2,2,le ngth(s2)-1 );
  1701           sP ulse := s1  + ' ' +
  1702                                 Pi ece(s2, '  ', 1) + '  ' +
  1703                                 Pi ece(s2, '  ', 2) + '  ' +
  1704                                 Pi ece(s2, '  ', 3) + '  ' +
  1705                                 Pi ece(s2, '  ', 4);
  1706  
  1707           sR esp := Pie ce(Piece(s , '^', 5),  '-', 1) +  Piece(Pie ce(s, '^',  5), '-',  2); // Res piratory
  1708           //  Pulse Oxi metry
  1709           s1  := Piece( Piece(s, ' ^', 6), '- ', 1);//Va lue
  1710           s2  := Piece( Piece(s, ' ^', 6), '- ', 2);//Me thod
  1711           s3  := Piece( Piece(s, ' ^', 6), '- -',2);//
  1712           sP Ox := s1;/ /Moving qu alifiers a way
  1713           __ s := Piece (Piece(s,  '^',6), '- ', 3)+' /  '+
  1714                   Piece (Piece(s,' ^', 6), '- ', 4); //P ox
  1715           if  __s = ' /  ' then       sFive : = s2
  1716           el se                       sFive : = __s+ ' /  '+s2;
  1717           if  sFive <>  '' then sP Ox := sPOx  + ' '+sFi ve;
  1718           s1  := Piece( Piece(s, ' ^', 7), '- ', 1);
  1719           s2  := Piece( Piece(s, ' ^', 7), '- ', 2);
  1720           sB P := s1 +  ' ' + s2;
  1721  
  1722           sW t := Piece (Piece(s,  '^', 8), ' -', 1) + P iece(Piece (s, '^', 8 ), '-', 2) ;
  1723           sB MI := Piec e(Piece(s,  '^', 10),  '-', 1) +  Piece(Pie ce(s, '^',  10), '-',  2);
  1724           sH t := Piece (Piece(s,  '^', 11),  '-', 1) +  Piece(Piec e(s, '^',  11), '-',  2);
  1725           sG irth := Pi ece(Piece( s, '^', 13 ), '-', 1)  + Piece(P iece(s, '^ ', 13), '- ', 2);
  1726           sC VP := Piec e(s, '^',  15);
  1727           sI n := Piece (Piece(s,  '^', 17),  '-', 1);
  1728           sO ut := Piec e(Piece(s,  '^', 18),  '-', 1);
  1729           sP ain := Pie ce(Piece(s , '^', 19) , '-', 1);
  1730  
  1731           sB MI := trim (sBMI);
  1732  
  1733           Ad dValue('Te mp.:'+ TAB ,trim(sTem p));
  1734           Ad dValue('Pu lse:'+ TAB ,trim(sPul se));
  1735           Ad dValue('Re sp.:'+ TAB ,trim(sRes p));
  1736  
  1737           Ad dValue('PO x.: '+ TAB ,trim(sPOx ));
  1738           Ad dValue('BP :   '+ TAB ,trim(sBP) );
  1739  
  1740           Ad dValue('Wt :   '+ TAB ,trim(sWt) );
  1741           Ad dValue('Ht :   '+ TAB ,trim(sHt) );
  1742           Ad dValue('C/ G.: '+ TAB ,trim(sGir th));
  1743           Ad dValue('CV P:  '+ TAB ,trim(sCVP ));
  1744           Ad dValue('In :   '+ TAB ,trim(sIn) );
  1745           Ad dValue('Ou t:  '+ TAB ,trim(sOut ));
  1746           Ad dValue('Pa in: '+ TAB ,trim(sPai n));
  1747         end;
  1748       Result  := ss;
  1749     end;
  1750  
  1751   begin
  1752     iCol :=  ValueIndex  + 1;
  1753     iRow :=  StrToIntDe f(Series.I dentifier,  1);
  1754     VitalsDa ta := TStr ingList.Cr eate;
  1755     try
  1756       Vitals Data.Add(' ');
  1757       sFor : = piece(gr dVitals.Ce lls[iCol,  0],' ',1);
  1758   //    Vita lsData.Add ('  Date:'  + #9 + gr dVitals.Ce lls[iCol,  0]);
  1759       if cbx Graph.Item s[GraphInd ex] = sgnT RP then
  1760         begi n
  1761           Se tVitalInfo (1);
  1762           Se tVitalInfo (2);
  1763           Se tVitalInfo (3);
  1764         end
  1765       else i f cbxGraph .Items[Gra phIndex] =  sgnHW the n
  1766         begi n
  1767           Se tVitalInfo (7);
  1768           Se tVitalInfo (9);
  1769         end
  1770       else
  1771         SetV italInfo(i Row);
  1772  
  1773       {=== A LL VITALS  for the da y ======== ========== ========== ========== =========}
  1774       if cbC hrono.Chec ked then d  := Series .XValue[Va lueIndex]
  1775       else
  1776         begi n
  1777           sF rom := grd Vitals.Cel ls[ValueIn dex+1,0];
  1778           //  061228 vh aishandria  ......
  1779           //  vhaishand ria 061228  - replace ment was d one to fix  position  on the cha rt
  1780           sF rom := Rep laceStr(sF rom,'24:00 :00','23:5 9:59');
  1781           d  := getCell DateTime(s From);
  1782         end;
  1783       mdt :=  TMDateTim e.Create;
  1784       mdt.WD ateTime :=  trunc(d)+ 1/24/60/60 ;
  1785       sFrom  := mdt.get SMDate;
  1786       sFor : = mdt.getS WDate;
  1787       mdt.WD ateTime :=  d + 1 - 2 /24/60/60;
  1788       sTo :=  mdt.getSM Date;
  1789       AllVit alsData :=  getALLPat ientData(f PatientDFN ,sFrom,sTo );
  1790       Vitals Data.Text  := Convert VitalsToTe xt;
  1791       AllVit alsData.Fr ee;
  1792      {====== ========== ========== ========== ========== ========== ========== =========}
  1793       ShowIn fo('Vitals  '+getPati entName+'  for '+sFor ,VitalsDat a.Text);
  1794       mdt.Fr ee;
  1795     finally
  1796       FreeAn dNil(Vital sData);
  1797     end;
  1798   end;
  1799  
  1800   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  1801  
  1802   procedure  TfraGMV_Gr idGraph.Dr awMissingL ines(aStar tPoint,aSt opPoint:In teger);
  1803   var
  1804     rect, Re ctOld: TRe ct;
  1805     x,y,
  1806     i, j: in teger;
  1807     SeriesNu mber: inte ger;
  1808     FirstDat aPoint,
  1809     LastData Point  : i nteger;
  1810     CurrentS eries: TCh artSeries;
  1811     iActiveC ount: Inte ger;
  1812   const
  1813     iSize =  3;
  1814  
  1815     procedur e DrawElli pse;
  1816     begin
  1817       rect.l eft := Cur rentSeries .CalcXPos( i)-iSize;
  1818       rect.T op := Curr entSeries. CalcYPos(i )-iSize;
  1819       rect.R ight := Cu rrentSerie s.CalcXPos (i)+iSize;
  1820       rect.B ottom := C urrentSeri es.CalcYPo s(i)+iSize ;
  1821  
  1822       chrtVi tals.Canva s.Pen.Widt h := 4;
  1823       Brush. Style := b sSolid;
  1824       Brush. Color := C urrentSeri es.SeriesC olor;
  1825       chrtVi tals.Canva s.Ellipse( rect.Left, rect.top,r ect.right, rect.Botto m);
  1826       chrtVi tals.Canva s.Pen.Widt h := 2;
  1827     end;
  1828  
  1829     procedur e DrawRect ;
  1830     begin
  1831       rect.l eft := Cur rentSeries .CalcXPos( i)-iSize;
  1832       rect.T op := Curr entSeries. CalcYPos(i )-iSize;
  1833       rect.R ight := Cu rrentSerie s.CalcXPos (i)+iSize;
  1834       rect.B ottom := C urrentSeri es.CalcYPo s(i)+iSize ;
  1835       chrtVi tals.Canva s.Brush.Co lor := Cur rentSeries .SeriesCol or;
  1836       chrtVi tals.Canva s.FillRect (rect);
  1837     end;
  1838  
  1839     procedur e DrawPoly gon;
  1840     begin
  1841     end;
  1842  
  1843     function  yStep:Int eger;
  1844     begin
  1845       Result  := 0;
  1846       if not  chrtVital s.View3d t hen Exit;
  1847  
  1848       chrtVi tals.CalcS ize3dWalls ;
  1849       if chr tVitals.Se riesCount  > 0 then
  1850         Resu lt := chrt Vitals.Hei ght3D div  iActiveCou nt;
  1851     end;
  1852  
  1853     function  xStep:Int eger;
  1854     begin
  1855       Result  := 0;
  1856       if not  chrtVital s.View3d t hen Exit;
  1857  
  1858       chrtVi tals.CalcS ize3dWalls ;
  1859       if chr tVitals.Se riesCount  > 0 then
  1860         Resu lt := chrt Vitals.Wid th3D div i ActiveCoun t;
  1861     end;
  1862  
  1863     function  xDelta(ii : Integer) : Integer;
  1864     begin
  1865       Result  := 0;
  1866     end;
  1867  
  1868     function  yDelta(ii : Integer) : Integer;
  1869     begin
  1870       Result  := 0;
  1871   EXIT;
  1872       case i ActiveCoun t of
  1873         1:be gin
  1874              yDelta :=  yStep+2;
  1875           en d;
  1876         2: b egin
  1877              case ii of
  1878                0: yDelt a :=  - yS tep - 2
  1879              else
  1880                yDelta : = yStep;
  1881              end;
  1882           en d;
  1883         3: b egin
  1884              case ii of
  1885                0: yDelt a :=  ySte p + 2;
  1886                1: yDelt a := 0;
  1887                2: yDelt a := - ySt ep - 2
  1888              else
  1889               yDelta :=  0;
  1890              end;
  1891           en d;
  1892       else
  1893         yDel ta := 0;
  1894       end;
  1895  
  1896     end;
  1897  
  1898   begin
  1899     RectOld  := TCanvas (chrtVital s.Canvas). ClipRect;
  1900     chrtVita ls.Canvas. ClipRectan gle(chrtVi tals.chart Rect);
  1901  
  1902     iActiveC ount := 0;
  1903     for Seri esNumber : = 0 to chr tVitals.Se riesCount  - 1 do
  1904       if chr tVitals.Se ries[Serie sNumber].A ctive then
  1905           In c(iActiveC ount);
  1906  
  1907     for Seri esNumber : = 0 to chr tVitals.Se riesCount  - 1 do
  1908       if chr tVitals.Se ries[Serie sNumber].A ctive then
  1909         begi n
  1910           Cu rrentSerie s := chrtV itals.Seri es[SeriesN umber];
  1911           if  CurrentSe ries.Count  < 1 then  Continue;
  1912           Fi rstDataPoi nt :=0;
  1913           La stDataPoin t := Curre ntSeries.C ount-1;
  1914           j  := FirstDa taPoint;
  1915           fo r i := Fir stDataPoin t+1 to Las tDataPoint  do
  1916              begin
  1917                if not C urrentSeri es.IsNull( i) then
  1918                  begin
  1919                    with  chrtVital s.Canvas d o
  1920                      be gin
  1921                         Pen.Width  := 2;
  1922                         Pen.Color  := Current Series.Ser iesColor;
  1923   //                      if not c hrtVitals. View3d the n vhaishan dria 06010 6
  1924                         case Serie sNumber of
  1925                           0: DrawE llipse;
  1926                           1: DrawE llipse;
  1927                           2:begin
  1928                             Polygo n([
  1929                               Poin t(CurrentS eries.Calc XPos(i)-iS ize,Curren tSeries.Ca lcYPos(i)+ iSize),
  1930                               Poin t(CurrentS eries.Calc XPos(i)+iS ize,Curren tSeries.Ca lcYPos(i)+ iSize),
  1931                               Poin t(CurrentS eries.Calc XPos(i),Cu rrentSerie s.CalcYPos (i)-iSize)
  1932                             ])
  1933                           end;
  1934                           3:begin
  1935                             Polygo n([
  1936                               Poin t(CurrentS eries.Calc XPos(i)-iS ize,Curren tSeries.Ca lcYPos(i)- iSize),
  1937                               Poin t(CurrentS eries.Calc XPos(i)+iS ize,Curren tSeries.Ca lcYPos(i)- iSize),
  1938                               Poin t(CurrentS eries.Calc XPos(i),Cu rrentSerie s.CalcYPos (i)+iSize)
  1939                             ])
  1940                           end;
  1941                         end;
  1942  
  1943                         {}
  1944                      //  to avoid  starting w ith null o n the scre en
  1945                      if  {(j <> 0)  or}
  1946                         not Curren tSeries.Is Null(j)
  1947                         and not (( i = LastDa taPoint) a nd (Curren tSeries.Is Null(i)))
  1948                      th en
  1949                         begin
  1950                           x := Cur rentSeries .CalcXPos( j) + xDelt a(SeriesNu mber);
  1951                           y := Cur rentSeries .CalcYPos( j) + yDelt a(SeriesNu mber);
  1952                           MoveTo(x ,y);
  1953  
  1954                           x := Cur rentSeries .CalcXPos( i) + xDelt a(SeriesNu mber);
  1955                           y := Cur rentSeries .CalcYPos( i) + YDelt a(SeriesNu mber);
  1956                           LineTo(x ,y);
  1957   {
  1958                           Pen.Colo r := clRed ;
  1959                           y := y +  chrtVital s.SeriesHe ight3d;
  1960                           LineTo(x ,y);
  1961                           x := Cur rentSeries .CalcXPos( i) + xDelt a(SeriesNu mber);
  1962                           y := Cur rentSeries .CalcYPos( i) + YDelt a(SeriesNu mber);
  1963                           MoveTo(x ,y);
  1964                           x := x +  chrtVital s.SeriesWi dth3d;
  1965                           LineTo(x ,y);
  1966   }
  1967                         end;
  1968                      en d;
  1969                    j :=  i;
  1970                  end;
  1971              end;
  1972         end;
  1973     chrtVita ls.Canvas. ClipRectan gle(RectOl d);//Resto re ClipRec tangle
  1974   end;
  1975  
  1976   procedure  TfraGMV_Gr idGraph.Dr awMissingD ataLines(S ender: TOb ject);
  1977   var
  1978     FirstPoi ntOnPage,  LastPointO nPage: int eger;
  1979   begin
  1980     FirstPoi ntOnPage : = 0;
  1981     LastPoin tOnPage :=  chrtVital s.Series[0 ].Count-1;
  1982     DrawMiss ingLines(F irstPointO nPage,Last PointOnPag e);
  1983   end;
  1984  
  1985   procedure  TfraGMV_Gr idGraph.ch rtVitalsAf terDraw(Se nder: TObj ect);
  1986   begin
  1987   {$IFDEF LI NES}
  1988     Exit;
  1989   {$ENDIF}
  1990     if not c bChrono.Ch ecked then
  1991       DrawMi ssingDataL ines(nil);
  1992   end;
  1993  
  1994   procedure  TfraGMV_Gr idGraph.gr dVitalsDra wCell(
  1995     Sender:  TObject;
  1996     ACol, AR ow: intege r;
  1997     Rect: TR ect;
  1998     State: T GridDrawSt ate);
  1999  
  2000     function  CurrentGr aph:Boolea n;
  2001       begin
  2002         case  GraphInde x of
  2003           0. .3: Result  := aRow =  fGridRow;
  2004           4:  Result :=  (aRow = 4 ) or (aRow =5);
  2005           5. .8: Result  := aRow =  fGridRow;
  2006           9: Result :=  (aRow = 7)  or (aRow  = 9);
  2007           10 : Result : = (aRow =  1) or (aRo w = 2) or  (aRow=3);
  2008           11 : Result : = (aRow =  6) or (aRo w = 7);
  2009         else
  2010           Re sult := aR ow = fGrid Row;
  2011         end;
  2012       end;
  2013  
  2014   var
  2015     sToday,
  2016     Value: s tring;
  2017   // Uncomme nt if you  need a sep arate colo r for toda y's values
  2018   //  TodayV alue,
  2019     Abnormal Value: Boo lean;
  2020   begin
  2021  
  2022     sToday : =FormatDat eTime('mm- dd-yy',Now );
  2023     //with g rdVitals d o
  2024     with TSt ringGrid(S ender) do
  2025       begin
  2026         Valu e := trim( Cells[ACol , ARow]);
  2027         Abno rmalValue  := Pos('*' , Value) >  0;
  2028  
  2029   // Uncomme nt if you  need a sep arate colo r for toda y's values
  2030   //      To dayValue : = piece(Ce lls[aCol,0 ],' ',1) =  sToday;
  2031         // F ill in bac kground as  btnFace,  Abnormal,  Normal
  2032         if ( aRow > 14)  or (aRow= 0) then
  2033                Canvas.B rush.Color  := clBtnF ace
  2034         else  if (ACol  = 0) then
  2035           be gin
  2036              if (aRow<> 0) and Cur rentGraph  then
  2037                Canvas.B rush.Color  := clInfo Bk
  2038              else
  2039                Canvas.B rush.Color  := clSilv er;// clBt nFace;
  2040           en d
  2041         else  if Abnorm alValue th en
  2042           be gin
  2043   // Uncomme nt if you  need a sep arate colo r for toda y's values
  2044   //           if Today Value then
  2045   //             Canvas .Brush.Col or := DISP LAYCOLORS[ GMVAbnorma lTodayBkgd ]
  2046   //           else
  2047                Canvas.B rush.Color  := DISPLA YCOLORS[GM VAbnormalB kgd];
  2048           en d
  2049         else
  2050   // Uncomme nt if you  need a sep arate colo r for toda y's values
  2051   //           if Today Value then
  2052   //             Canvas .Brush.Col or := DISP LAYCOLORS[ GMVNormalT odayBkgd]
  2053   //           else
  2054                if Curre ntGraph th en
  2055                  Canvas .Brush.Col or := $00D FDFDF
  2056                else
  2057   //               Canv as.Brush.C olor :=  f BGColor; / /DISPLAYCO LORS[GMVNo rmalBkgd];
  2058                  Canvas .Brush.Col or :=  DIS PLAYCOLORS [GMVNormal Bkgd];
  2059         Canv as.FrameRe ct(Rect);
  2060  
  2061         {
  2062         // D raw rectan gle around  selected  cell
  2063         if ( ACol > 0)  and (ARow  > 0) and ( gdSelected  in State)  then
  2064           be gin
  2065              if Abnorma lValue the n
  2066                Canvas.P en.Color : = DISPLAYC OLORS[GMVA bnormalTex t]
  2067              else
  2068                Canvas.P en.Color : = DISPLAYC OLORS[GMVN ormalText] ;
  2069              Canvas.Fra meRect(Rec t);
  2070           en d;
  2071         }
  2072  
  2073         // S et up font  color as  btnText, A bnormal, N ormal
  2074         if ( ACol = 0)  or (ARow =  0) or (AR ow = 15) o r (ARow =  16) then
  2075           be gin
  2076              Canvas.Fon t.Color :=  clBtnText ;
  2077              Canvas.Fon t.Style :=  [];
  2078           en d
  2079         else  if Abnorm alValue th en
  2080           be gin
  2081              Canvas.Fon t.Color :=  DISPLAYCO LORS[GMVAb normalText ];
  2082              if GMVAbno rmalBold t hen  Canva s.Font.Sty le := [fsB old]
  2083              else                       Canva s.Font.Sty le := [];
  2084           en d
  2085         else
  2086           be gin
  2087              Canvas.Fon t.Color :=  DISPLAYCO LORS[GMVNo rmalText];
  2088              if GMVNorm alBold the n    Canva s.Font.Sty le := [fsB old]
  2089              else                       Canva s.Font.Sty le := [];
  2090           en d;
  2091  
  2092         // F ill in the  data
  2093         if ( (ACol = 0)  or (ARow  = 0)) and  (aRow <>15 ) and (aRo w <>16) th en
  2094           Ca nvas.TextR ect(Rect,  Rect.Left+ 10, Rect.T op, Value)
  2095         else  if ((aRow  = 15) or  (aRow=16))  {and (not  cbWho.Che cked)} the n
  2096           be gin
  2097              Canvas.Tex tRect(Rect , Rect.Lef t+10, Rect .Top, Valu e)
  2098           en d
  2099         else  if (aRow  = 5) then  // vhaisha ndria 2008 -01-07 --- ---------- ---- begin
  2100         // q ualifiers  are shown  regardless  of user p references (options)
  2101           be gin
  2102              if pos('*' ,trim(Cell s[ACol, 4] )) >0 then
  2103                begin
  2104                  if not  GMVAbnorm alQuals th en
  2105                    Valu e := '';
  2106                end
  2107              else if no t GMVNorma lQuals the n
  2108                Value :=  '';
  2109              Canvas.Tex tRect(Rect , Rect.Lef t+10, Rect .Top, Valu e);
  2110           en d // vhais handria 20 08-01-07 - ---------- ---------- ---------- ------ end
  2111         else  if Abnorm alValue th en
  2112           be gin
  2113              if GMVAbno rmalQuals  then Canva s.TextRect (Rect, Rec t.Left+10,  Rect.Top,  Value)
  2114              else                       Canva s.TextRect (Rect, Rec t.Left+10,  Rect.Top,  Piece(Val ue, ' ', 1 ))
  2115           en d
  2116         else
  2117           be gin
  2118              if GMVNorm alQuals th en  Canvas .TextRect( Rect, Rect .Left+10,  Rect.Top,  Value)
  2119              else                      Canvas .TextRect( Rect, Rect .Left+10,  Rect.Top,  Piece(Valu e, ' ', 1) );
  2120           en d;
  2121  
  2122         if g dSelected  in State t hen
  2123           be gin
  2124              Canvas.Bru sh.Color : = clRed; / / clBlack; //vhaishan dria 05070 5
  2125              Canvas.Fra meRect(Rec t);
  2126           en d;
  2127       end;
  2128   end;
  2129  
  2130   procedure  TfraGMV_Gr idGraph.gr dVitalsSel ectCell(Se nder: TObj ect; Butto n: TMouseB utton; Shi ft: TShift State; x,  Y: integer );
  2131   var
  2132     ACol, AR ow: Longin t;
  2133   begin
  2134     grdVital s.MouseToC ell(x, Y,  ACol, ARow );
  2135     if (aCol  = 0) then
  2136       begin
  2137         if G raphIndexB yGridRow(a Row) <> iI gnoreGraph  then
  2138           Gr aphIndex : = GraphInd exByGridRo w(aRow)
  2139         else
  2140           fG raphIndex  := 0;
  2141         fGri dRow := aR ow;
  2142  
  2143         Upda teFrame; / / vhaishan dria 06010 5
  2144  
  2145         grdV itals.Inva lidate;
  2146         chrt Vitals.Inv alidate;
  2147       end;
  2148  
  2149     if (ACol  > 0) and  (ARow = 0)  then
  2150       try
  2151         fSel ectedDateT ime := get CellDateTi me(grdVita ls.Cells[a Col, 0]);
  2152         acEn teredInErr orByTimeEx ecute(nil) ;
  2153       except
  2154       end;
  2155   end;
  2156  
  2157   procedure  TfraGMV_Gr idGraph.se tPatientLo cation(aLo cation: St ring);
  2158   begin
  2159     FPatient Location : = aLocatio n;
  2160   end;
  2161  
  2162   procedure  TfraGMV_Gr idGraph.se tPatientLo cationName (aLocation Name: Stri ng);
  2163   begin
  2164     FPatient LocationNa me := aLoc ationName;
  2165     lblHospi tal.Captio n := aLoca tionName;
  2166   end;
  2167  
  2168   // Actions  ========= ========== ========== ========== ========== ========== ==========
  2169  
  2170   procedure  TfraGMV_Gr idGraph.sb tnPrintGra phClick(Se nder: TObj ect);
  2171   begin
  2172     acPrintG raphExecut e(Sender);
  2173   end;
  2174  
  2175   procedure  TfraGMV_Gr idGraph.sb tnLabelsCl ick(Sender : TObject) ;
  2176   begin
  2177     acValueC aptionsExe cute(Sende r);
  2178   end;
  2179  
  2180   procedure  TfraGMV_Gr idGraph.sb tnMaxGraph Click(Send er: TObjec t);
  2181   begin
  2182     acResize GraphExecu te(Sender) ;
  2183   end;
  2184  
  2185   procedure  TfraGMV_Gr idGraph.ac CustomRang eExecute(S ender: TOb ject);
  2186   begin
  2187     setObser vationRang e(sDateRan ge);
  2188     UpdateLi sts;
  2189   end;
  2190  
  2191   procedure  TfraGMV_Gr idGraph.ac EnteredInE rrorExecut e(Sender:  TObject);
  2192   begin
  2193     if Enter VitalsInEr ror(FPatie ntDFN) <>  mrCancel t hen
  2194       cbxDat eRangeClic k(nil);
  2195   end;
  2196  
  2197   procedure  TfraGMV_Gr idGraph.ac ZoomExecut e(Sender:  TObject);
  2198   begin
  2199     chrtVita ls.AllowZo om := cbAl lowZoom.Ch ecked;
  2200     edZoom.E nabled :=  chrtVitals .AllowZoom ;
  2201     sbPlus.E nabled :=  chrtVitals .AllowZoom ;
  2202     sbMinus. Enabled :=  chrtVital s.AllowZoo m;
  2203     sbReset. Enabled :=  chrtVital s.AllowZoo m;
  2204   end;
  2205  
  2206   procedure  TfraGMV_Gr idGraph.ac GraphOptio nsExecute( Sender: TO bject);
  2207   begin
  2208     pnlGraph Options.Vi sible := n ot pnlGrap hOptions.V isible;
  2209     showHide GraphOptio ns1.Checke d := pnlGr aphOptions .Visible;
  2210   {$IFNDEF D LL}
  2211     if Assig ned(frmGMV _UserMain)  then
  2212       frmGMV _UserMain. showHideGr aphOptions 1.Checked  := pnlGrap hOptions.V isible;
  2213   {$ENDIF}
  2214   end;
  2215  
  2216   procedure  TfraGMV_Gr idGraph.ac EnteredInE rrorByTime Execute(Se nder: TObj ect);
  2217   begin
  2218     if fSele ctedDateTi me = 0 the n Exit;
  2219     if Enter edInErrorB yDate(FPat ientDFN,tr unc(fSelec tedDateTim e)+1-1/(36 00*24)) <>  mrCancel  then
  2220       cbxDat eRangeClic k(nil);
  2221   end;
  2222  
  2223   procedure  TfraGMV_Gr idGraph.ac PatientAll ergiesExec ute(Sender : TObject) ;
  2224   begin
  2225     sbtnAlle rgies.Down  := True;
  2226     ShowPati entAllergi es(FPatien tDFN,'Alle rgies for: '+edPatien tName.Text  +
  2227       '  ' +  edPatient Info.Text) ;
  2228     sbtnAlle rgies.Down  := False;
  2229   end;
  2230  
  2231   procedure  TfraGMV_Gr idGraph.Co lorSelect1 Accept(Sen der: TObje ct);
  2232   begin
  2233     BGColor  := ColorSe lect1.Dial og.Color;
  2234   end;
  2235  
  2236   procedure  TfraGMV_Gr idGraph.Se tColor;
  2237   begin
  2238     fBGColor  := aColor ;
  2239       begin
  2240         chrt Vitals.Col or := fBGC olor;
  2241   //      pn lRight.Col or := fBGC olor;
  2242         trbH Graph.Inva lidate;
  2243         grdV itals.Inva lidate;
  2244       end;
  2245   end;
  2246  
  2247   procedure  TfraGMV_Gr idGraph.Se tTodayColo r;
  2248   begin
  2249     fBGToday Color := a Color;
  2250       begin
  2251         trbH Graph.Inva lidate;
  2252         grdV itals.Inva lidate;
  2253       end;
  2254   end;
  2255  
  2256   procedure  TfraGMV_Gr idGraph.sb GraphColor Click(Send er: TObjec t);
  2257   begin
  2258     if Color Dialog1.Ex ecute then
  2259       BGColo r := Color Dialog1.Co lor;
  2260   end;
  2261  
  2262   procedure  TfraGMV_Gr idGraph.ac EnterVital sExecute(S ender: TOb ject);
  2263   var
  2264     aTime:TD ateTime;
  2265   begin
  2266     VitalsIn putDLG(
  2267        Patie ntDFN,
  2268        Patie ntLocation ,
  2269        '', / / Template
  2270        '', / / Signatur e
  2271        getSe rverWDateT ime,// sel ect server  date time   - vhaish andria 050 419
  2272        ptNam e,
  2273        ptInf o
  2274        ) ;
  2275     aTime :=  Now;
  2276     UpdateFr ame;
  2277     EventAdd ('fraGMV_G ridGraph.U pdateFrame ','Reload' ,aTime);
  2278   end;
  2279  
  2280   procedure  TfraGMV_Gr idGraph.ac ValueCapti onsExecute (Sender: T Object);
  2281   begin
  2282     bLabelSh ow := not  bLabelShow ;
  2283     ShowHide Labels(Sen der);
  2284   end;
  2285  
  2286   procedure  TfraGMV_Gr idGraph.ac 3DExecute( Sender: TO bject);
  2287   begin
  2288     chrtVita ls.View3D  := ckb3D.C hecked;
  2289     bIgnoreB lueLines : = ckb3D.Ch ecked;
  2290   end;
  2291  
  2292   procedure  TfraGMV_Gr idGraph.ac ResizeGrap hExecute(S ender: TOb ject);
  2293   begin
  2294     Maximize Graph(Send er);
  2295   end;
  2296   (*
  2297   procedure  TfraGMV_Gr idGraph.Pr intGraph(S ender: TOb ject);
  2298   begin
  2299     with TPr intDialog. Create(App lication)  do
  2300       try
  2301         if E xecute the n
  2302           be gin
  2303              chrtVitals .PrintProp ortional : = True;
  2304              chrtVitals .PrintMarg ins.Left : = 1;
  2305              chrtVitals .PrintMarg ins.Top :=  1;
  2306              chrtVitals .PrintMarg ins.Bottom  := 1;
  2307              chrtVitals .PrintMarg ins.Right  := 1;
  2308              chrtVitals .PrintReso lution :=  -10;//-70;
  2309              chrtVitals .BottomAxi s.LabelsAn gle := 0;
  2310              chrtVitals .BackImage Inside :=  False;
  2311              chrtVitals .Print;
  2312              chrtVitals .backimage inside :=  True;
  2313           en d;
  2314       finall y
  2315         free ;
  2316       end;
  2317   end;
  2318   *)
  2319   procedure  TfraGMV_Gr idGraph.lb DateRangeK eyDown(Sen der: TObje ct;
  2320     var Key:  Word; Shi ft: TShift State);
  2321   begin
  2322     if Key =  VK_RETURN  then
  2323         cbxD ateRangeCl ick(lbDate Range);
  2324   end;
  2325  
  2326   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  2327   function T fraGMV_Gri dGraph.Gra phNameByGr idRow(aRow :Integer): String;
  2328     begin
  2329       case a Row of
  2330         rTem p{1}: Resu lt := sgnT emp;
  2331         rPul se{2}:Resu lt := sgnP ulse;
  2332         rRes p{3}: Resu lt := sgnR esp;
  2333         rPOx {4}:  Resu lt := sgnP OX;
  2334         rPOX +1{5}: Res ult := sgn POX;
  2335         rBP{ 6}: Result  := sgnBP;
  2336         rWei ght{7}: Re sult := sg nWeight;
  2337         rBMI {8}: Resul t := sgnBM I;
  2338         rHei ght{9}: Re sult := sg nHeight;
  2339         rGir th{10}: Re sult := sg nGirth;
  2340         rCVP {11}: Resu lt := sgnC VP; //Grap hNameNoGra ph;
  2341         rInt ake{12}: R esult := s gnIn;//Gra phNameNoGr aph;
  2342         rOut put{13}: R esult := s gnOutput;/ /GraphName NoGraph;
  2343         rPai n{14}: Res ult := sgn Pain;
  2344       else
  2345         Resu lt := sgnN oGraph;
  2346       end;
  2347     end;
  2348  
  2349   function T fraGMV_Gri dGraph.Gra phIndexByG ridRow(aRo w:Integer) :Integer;
  2350   begin
  2351     case aRo w of
  2352       rTemp{ 1}:   Resu lt := 0;
  2353       rPulse {2}:  Resu lt := 1;
  2354       rResp{ 3}:   Resu lt := 2;
  2355       rPOx{4 }:    Resu lt := 4;
  2356       rPOx+1 {5}:  Resu lt := 4;
  2357       rBP{6} :     Resu lt := 3;
  2358       rWeigh t{7}: Resu lt := 6;
  2359       rBMI{8 }:    Resu lt := 7;
  2360       rHeigh t{9}: Resu lt := 5;
  2361       rGirth {10}: Resu lt := 12;  //iIgnoreG raph; // C /G
  2362       rCVP{1 1}:   Resu lt := 13;  //iIgnoreG raph;  //  CVP
  2363       rIntak e{12}:Resu lt := 14;  //iIgnoreG raph;  //  In
  2364       rOutpu t{13}:Resu lt := 15;  //iIgnoreG raph;  //  Out
  2365       rPain{ 14}:  Resu lt := 8;
  2366     else
  2367       Result  := iIgnor eGraph;
  2368     end;
  2369   end;
  2370  
  2371   function T fraGMV_Gri dGraph.Gri dRowByGrap hIndex(anI ndex:Integ er):Intege r;
  2372   begin
  2373     case anI ndex of
  2374       0: Res ult := rTe mp{1};
  2375       1: Res ult := rPu lse{2};
  2376       2: Res ult := rRe sp{3};
  2377       3: Res ult := rBP {6};
  2378       4: Res ult := rPO x{4};
  2379       5: Res ult := rHe ight{9};
  2380       6: Res ult := rWe ight{7};
  2381       7: Res ult := rBM I{8};
  2382       8: Res ult := rPa in{14};
  2383       9: Res ult := 0;
  2384       10:Res ult := 0;
  2385       11:Res ult := 0;
  2386       12:Res ult := rGi rth{11};//  CVP
  2387       13:Res ult := rCV P{12};// C VP
  2388       14:Res ult := rIn take{13};/ / In
  2389       15:Res ult := rOu tput{14};/ / Out
  2390  
  2391     else
  2392       if Gra phIndex <  9 then
  2393         Resu lt := Grid RowByGraph Index(Grap hIndex)
  2394       else
  2395         Resu lt := 0;
  2396     end;
  2397   end;
  2398  
  2399   procedure  TfraGMV_Gr idGraph.Se tStyle(aSt yle:String );
  2400   begin
  2401     splGridG raph.Align  := alTop;
  2402     pnlGrid. Align := a lBottom;
  2403     pnlGraph .Align :=  alClient;
  2404     splGridG raph.Align  := alBott om;
  2405  
  2406     pnlDateR angeTop.Vi sible := T rue;
  2407     pnlTitle .Visible : = aStyle < > fsVitals ;
  2408  
  2409     if aStyl e = fsVita ls then
  2410       pnlGri d.Constrai nts.MaxHei ght := pnl GridTop.He ight +
  2411         (grd Vitals.Row Count+1) *  (grdVital s.RowHeigh ts[0]+grdV itals.Grid LineWidth) ;
  2412  
  2413     FStyle : = aStyle;
  2414   end;
  2415  
  2416   procedure  TfraGMV_Gr idGraph.se tUpFrame;
  2417  
  2418     function  GridHeigh t:Integer;
  2419     var
  2420       i: Int eger;
  2421     begin
  2422       Result  := 0;
  2423       for i  := 0 to gr dVitals.Ro wCount - 1  do
  2424         Resu lt := Resu lt + grdVi tals.RowHe ights[i]+g rdVitals.G ridLineWid th;
  2425     end;
  2426  
  2427   begin
  2428     if Frame Initialize d then  Ex it;
  2429  
  2430     with grd Vitals do
  2431       begin
  2432   {$IFDEF PA TCH_5_0_23 }
  2433         RowC ount := 18 ;
  2434   {$ELSE}
  2435         RowC ount := 17 ;
  2436   {$ENDIF}
  2437         Defa ultRowHeig ht := 15;
  2438         Defa ultColWidt h := 100;
  2439         ColW idths[0] : = 100;
  2440         Cell s[0, rTemp {1}] := '  Temp:';
  2441         Cell s[0, rPuls e{2}] := '  Pulse:';
  2442         Cell s[0, rResp {3}] := '  Resp:';
  2443         Cell s[0, rPOx{ 4}] := ' P  Ox %:'; / /AAN 2003/ 06/03
  2444         Cell s[0, rPOx+ 1{5}] := '  L/Min/%:' ;
  2445         Cell s[0, rBP{6 }] := ' B/ P:';
  2446         Cell s[0, rWeig ht{7}] :=  ' Wt (lbs) :';
  2447         Cell s[0, rBMI{ 8}] := ' B MI:';
  2448         Cell s[0, rHeig ht{9}] :=  ' Ht (in): ';
  2449         Cell s[0, rGirt h{10}] :=  ' C/G:';
  2450         Cell s[0, rCVP{ 11}] := '  CVP (cmH2O ):';
  2451         Cell s[0, rInta ke{12}] :=  ' In 24hr  (ml):';
  2452         Cell s[0, rOutp ut{13}] :=  ' Out 24h r (ml):';
  2453         Cell s[0, rPain {14}] := '  Pain:';
  2454  
  2455         Cell s[0, rLoca tion{15}]  := 'Locati on:';
  2456         Cell s[0, rEnte redBy{16}]  := 'Enter ed By:';
  2457   {$IFDEF PA TCH_5_0_23 }
  2458         Cell s[0, rSour ce] := 'Da ta Source: ';
  2459   {$ENDIF}
  2460         Heig ht :=(Defa ultRowHeig ht * RowCo unt) + (Gr idLineWidt h * (RowCo unt+3)) +
  2461           Ge tSystemMet rics(SM_CY VSCROLL);
  2462  
  2463         if F rameStyle  <> fsVital s then
  2464           pn lGrid.Heig ht := pnlG ridTop.Hei ght + (Def aultRowHei ght * RowC ount) +
  2465              (GridLineW idth * (Ro wCount+3))  + GetSyst emMetrics( SM_CYVSCRO LL);
  2466  
  2467         Inva lidate;
  2468       end;
  2469  
  2470     lbDateRa nge.Items. Add('TODAY ');
  2471     lbDateRa nge.Items. Add('T-1') ;
  2472     lbDateRa nge.Items. Add('T-2') ;
  2473     lbDateRa nge.Items. Add('T-3') ;
  2474     lbDateRa nge.Items. Add('T-4') ;
  2475     lbDateRa nge.Items. Add('T-5') ;
  2476     lbDateRa nge.Items. Add('T-6') ;
  2477     lbDateRa nge.Items. Add('T-7') ;
  2478     lbDateRa nge.Items. Add('T-15' );
  2479     lbDateRa nge.Items. Add('T-30' );
  2480     lbDateRa nge.Items. Add('Six M onths');
  2481     lbDateRa nge.Items. Add('One Y ear');
  2482     lbDateRa nge.Items. Add('Two Y ears');
  2483     lbDateRa nge.Items. Add('All R esults');
  2484     lbDateRa nge.Items. Add(sDateR ange);  // vhaishandr ia 050421
  2485  
  2486  
  2487     cbxGraph .Items.Add (sgnTemp);
  2488     cbxGraph .Items.Add (sgnPulse) ;
  2489     cbxGraph .Items.Add (sgnResp);
  2490     cbxGraph .Items.Add (sgnBP);
  2491     cbxGraph .Items.Add (sgnPOX);
  2492     cbxGraph .Items.Add (sgnHeight );
  2493     cbxGraph .Items.Add (sgnWeight );
  2494     cbxGraph .Items.Add (sgnBMI);
  2495     cbxGraph .Items.Add (sgnPain);
  2496  
  2497     cbxGraph .Items.Add (sgnHW);
  2498     cbxGraph .Items.Add (sgnTRP);
  2499     cbxGraph .Items.Add (sgnBPWeig ht);
  2500  
  2501     cbxGraph .Items.Add (sgnGirth) ;
  2502     cbxGraph .Items.Add (sgnCVP);
  2503     cbxGraph .Items.Add (sgnIn);
  2504     cbxGraph .Items.Add (sgnOutput );
  2505  
  2506     iIgnoreG raph := 21 ;
  2507  
  2508     bLabelSH ow := Fals e;
  2509     Inc(iIgn oreCount);
  2510     GraphInd ex := 1;
  2511     Dec(iIgn oreCount);
  2512     cbxGraph .ItemIndex  := 1;
  2513  
  2514     if Assig ned(MDateT imeRange)  then
  2515       try
  2516         lbDa teRange.It ems.Add(MD ateTimeRan ge.getSWRa nge);
  2517         lbDa teRange.It emIndex :=  lbDateRan ge.Items.I ndexOf(MDa teTimeRang e.getSWRan ge);
  2518       except
  2519       end;
  2520  
  2521     fSelecte dDateTime  := 0;
  2522     iIgnoreC ount := 0;
  2523  
  2524     pnlGrid. Constraint s.MaxHeigh t := pnlGr idTop.Heig ht + gridH eight;
  2525     grdVital s.ColWidth s[0] := pn lDateRange .Width;
  2526  
  2527   {$IFDEF AA NTEST}
  2528     sbTest.V isible :=  True;
  2529     pnlDebug .Visible : = True;
  2530   {$ENDIF}
  2531  
  2532     FrameIni tialized : = True;
  2533   end;
  2534  
  2535   // Color f rames ==== ========== ========== ========== ========== ========== ==========
  2536  
  2537   procedure  TfraGMV_Gr idGraph.cb xGraphExit (Sender: T Object);
  2538   begin
  2539     cbxGraph .Color :=  clTabOut;
  2540     pnlGSele ctBottom.C olor := pn lGSelect.C olor;
  2541     pnlGSele ctTop.Colo r := pnlGS elect.Colo r;
  2542     pnlGSele ctLeft.Col or := pnlG Select.Col or;
  2543     pnlGSele ctRight.Co lor := pnl GSelect.Co lor;
  2544   end;
  2545  
  2546   procedure  TfraGMV_Gr idGraph.cb xGraphEnte r(Sender:  TObject);
  2547   begin
  2548     cbxGraph .Color :=  clTabIn;
  2549     pnlGSele ctBottom.C olor := cl TabIn;
  2550     pnlGSele ctTop.Colo r := clTab In;
  2551     pnlGSele ctLeft.Col or := clTa bIn;
  2552     pnlGSele ctRight.Co lor := clT abIn;
  2553   end;
  2554  
  2555   procedure  TfraGMV_Gr idGraph.lb DateRangeE xit(Sender : TObject) ;
  2556   begin
  2557     pnlPBot. Color := c lbtnFace;
  2558     pnlPTop. Color := c lbtnFace;
  2559     pnlPLeft .Color :=  clbtnFace;
  2560     pnlPRigh t.Color :=  clbtnFace ;
  2561   end;
  2562  
  2563   procedure  TfraGMV_Gr idGraph.lb DateRangeE nter(Sende r: TObject );
  2564   begin
  2565     pnlPBot. Color := c lTabIn;
  2566     pnlPTop. Color := c lTabIn;
  2567     pnlPLeft .Color :=  clTabIn;
  2568     pnlPRigh t.Color :=  clTabIn;
  2569   end;
  2570  
  2571   procedure  TfraGMV_Gr idGraph.gr dVitalsEnt er(Sender:  TObject);
  2572   begin
  2573     pnlGBot. Color := c lTabIn;
  2574     pnlGTop. Color := c lTabIn;
  2575     pnlGLeft .Color :=  clTabIn;
  2576     pnlGRigh t.Color :=  clTabIn;
  2577   end;
  2578  
  2579   procedure  TfraGMV_Gr idGraph.gr dVitalsExi t(Sender:  TObject);
  2580   begin
  2581     pnlGBot. Color := c lbtnFace;
  2582     pnlGTop. Color := c lbtnFace;
  2583     pnlGLeft .Color :=  clbtnFace;
  2584     pnlGRigh t.Color :=  clbtnFace ;
  2585   end;
  2586  
  2587   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  2588  
  2589   procedure  TfraGMV_Gr idGraph.ch rtVitalsBe foreDrawSe ries(Sende r: TObject );
  2590   var
  2591     iLeft,iR ight,
  2592     iDelta,
  2593     iMin,iMa x: LongInt ;
  2594  
  2595     dBeginPl us, dEndPl us,
  2596     dBegin,d End: Doubl e;
  2597  
  2598     function  ValueDate Time(aCol: Integer):D ouble;
  2599     var
  2600       ss:Str ing;
  2601     begin
  2602       try
  2603         ss : = grdVital s.Cells[aC ol, rHeade r];
  2604         if s s <>'' the n
  2605           be gin
  2606              ss := Repl aceStr(ss, '-','/');
  2607              if pos(' 2 4:',sS)>0  then
  2608                ss := pi ece(ss,' ' ,1);
  2609              Result :=  StrToDateT ime(ss);
  2610           en d
  2611         else
  2612           Re sult := No w;
  2613       except
  2614         Resu lt := Now;
  2615       end;
  2616     end;
  2617  
  2618     function  yStep:Int eger;
  2619     begin
  2620       Result  := 0;
  2621       if not  chrtVital s.View3d t hen Exit;
  2622  
  2623       chrtVi tals.CalcS ize3dWalls ;
  2624       Result  := chrtVi tals.Heigh t3D div 2;
  2625     end;
  2626  
  2627     function  xStep:Int eger;
  2628     begin
  2629       Result  := 0;
  2630       if not  chrtVital s.View3d t hen Exit;
  2631  
  2632       chrtVi tals.CalcS ize3dWalls ;
  2633       Result  := chrtVi tals.Width 3D;
  2634     end;
  2635  
  2636  
  2637   begin
  2638   {$IFDEF LI NES}
  2639     Exit;
  2640   {$ENDIF}
  2641  
  2642     if bIgno reBlueLine s then Exi t;
  2643     if chrtV itals.View 3D then Ex it;
  2644     try
  2645       if (gr dVitals.Co lCount = 2 ) and
  2646         ((po s(sNoData, grdVitals. Cells[1,0] ) = 1)
  2647           or
  2648          (tr im(grdVita ls.Cells[1 ,fGridRow] )='')
  2649         ) th en Exit;
  2650     except
  2651       Exit;
  2652     end;
  2653  
  2654     dBegin : = ValueDat eTime(grdV itals.Left Col);
  2655     if Frame Style = fs Vitals the n
  2656       dEnd : = ValueDat eTime(grdV itals.Left Col+grdVit als.Visibl eColCount)
  2657     else
  2658       dEnd : = ValueDat eTime(grdV itals.Left Col+grdVit als.Visibl eColCount- 1);
  2659  
  2660     if grdVi tals.LeftC ol > 1 the n
  2661       dBegin Plus := Va lueDateTim e(grdVital s.LeftCol  -1)
  2662     else
  2663       dBegin Plus := dB egin;
  2664  
  2665     if grdVi tals.LeftC ol+grdVita ls.Visible ColCount<  grdVitals. ColCount t hen
  2666       dEndPl us := Valu eDateTime( grdVitals. LeftCol+gr dVitals.Vi sibleColCo unt)
  2667     else
  2668       dEndPl us := dEnd ;
  2669  
  2670     fXL := ( round(chrt Vitals.Bot tomAxis.Ca lcPosValue (dBegin))+
  2671       round( chrtVitals .BottomAxi s.CalcPosV alue(dBegi nPlus))) d iv 2
  2672       +xStep ;
  2673  
  2674     fXR := ( round(chrt Vitals.Bot tomAxis.Ca lcPosValue (dEnd)) +
  2675       round( chrtVitals .BottomAxi s.CalcPosV alue(dEndP lus))) div  2
  2676       +xStep ;
  2677  
  2678   //  idelta  := round( 0.05*(chrt Vitals.Lef tAxis.Maxi mum-chrtVi tals.LeftA xis.Minimu m));
  2679   //  if iDe lta > 5 th en iDelta  := 5;
  2680     iDelta : = 5;
  2681  
  2682     iLeft :=  -1;
  2683     iRight : = -1;
  2684  
  2685     with chr tVitals.Ca nvas do
  2686       begin
  2687         iMin  := chrtVi tals.Chart Rect.Top+1  + yStep;
  2688         iMax  := chrtVi tals.Chart Rect.Botto m-1 + ySte p;
  2689         Pen. Color := c lBlue;
  2690         if ( fXL > chrt Vitals.Cha rtRect.Lef t) and (fX L < chrtVi tals.Chart Rect.Right ) then
  2691           be gin
  2692              iLeft := f XL+1;
  2693              MoveTo(fXL ,iMin);
  2694              LineTo(fXL ,iMax);
  2695           en d
  2696         else  if fXL <=  chrtVital s.ChartRec t.Left the n
  2697           iL eft := chr tVitals.Ch artRect.Le ft + 1;
  2698  
  2699         if ( fXR > chrt Vitals.Cha rtRect.Lef t) and (fX R < chrtVi tals.Chart Rect.Right ) then
  2700           be gin
  2701              iRight :=  fXR;
  2702              MoveTo(fXR ,iMin);
  2703              LineTo(fXR ,iMax);
  2704           en d
  2705         else  if fXR >=  chrtVital s.ChartRec t.Right th en
  2706           iR ight := ch rtVitals.C hartRect.R ight;
  2707  
  2708         Brus h.Color :=  clSilver;
  2709  
  2710         if ( iLeft > 0)  and (iRig ht > 0) th en
  2711           be gin
  2712              FillRect(R ect(iLeft, iMin,iRigh t,iMin+iDe lta));
  2713              FillRect(R ect(iLeft, iMax-iDelt a,iRight,i Max));
  2714           en d;
  2715       end;
  2716   end;
  2717  
  2718   //  Unknow n //////// ////////// ////////// ////////// ////////// ////////// //////////
  2719  
  2720   procedure  TfraGMV_Gr idGraph.lb DateRangeM ouseUp(Sen der: TObje ct;
  2721     Button:  TMouseButt on; Shift:  TShiftSta te; X, Y:  Integer);
  2722   begin
  2723     cbxDateR angeClick( nil);
  2724   end;
  2725  
  2726   procedure  TfraGMV_Gr idGraph.lb DateRangeM ouseMove(S ender: TOb ject;
  2727     Shift: T ShiftState ; X, Y: In teger);
  2728   var
  2729     i: Integ er;
  2730   begin
  2731     i := Y d iv lbDateR ange.ItemH eight + lb DateRange. TopIndex;
  2732     if (i <  lbDateRang e.Items.Co unt) and ( i>=0) then
  2733       lbDate Range.Hint  := lbDate Range.Item s[i];
  2734   end;
  2735  
  2736   procedure  TfraGMV_Gr idGraph.Sa veStatus;
  2737  
  2738     procedur e SaveInte gerItem(aV alue:Integ er;aName:S tring);
  2739     var
  2740       s: Str ing;
  2741     begin
  2742       try
  2743         s :=  IntToStr( aValue);
  2744         setU serSetting s(aName,s) ;
  2745       except
  2746       end;
  2747     end;
  2748  
  2749     procedur e SaveBool eanItem(aV alue:Boole an;aName:S tring);
  2750     begin
  2751       try
  2752         if a Value then  setUserSe ttings(aNa me,'ON')
  2753         else             setUserSe ttings(aNa me,'OFF');
  2754       except
  2755       end;
  2756     end;
  2757  
  2758   begin
  2759     try
  2760       GMVUse r.Setting[ usGridDate Range] :=  IntToStr(l bDateRange .ItemIndex );
  2761     except
  2762     end;
  2763  
  2764     SaveInte gerItem(pn lGrid.Heig ht,'GRIDSI ZE');
  2765     SaveInte gerItem(bg Color,'GRA PHCOLOR');
  2766  
  2767     SaveBool eanItem(pn lGraphOpti ons.Visibl e,'GRAPHOP TIONS');
  2768     SaveBool eanItem(cb Values.Che cked,'GRAP HOPTIONS-1 ');
  2769     SaveBool eanItem(ck b3D.Checke d,'GRAPHOP TIONS-2');
  2770     SaveBool eanItem(cb AllowZoom. Checked,'G RAPHOPTION S-3');
  2771     SaveBool eanItem(cb Chrono.Che cked,'GRAP HOPTIONS-4 ');
  2772  
  2773     SaveInte gerItem(Gr aphIndex,' GRAPH_INDE X');
  2774  
  2775     SaveInte gerItem(GM VAbnormalT ext, 'ABNO RMALTEXTCO LOR');
  2776     SaveInte gerItem(GM VAbnormalB kgd, 'ABNO RMALBGCOLO R');
  2777   //  SaveIn tegerItem( GMVAbnorma lTodayBkgd : integer  = 15;
  2778     SaveBool eanItem(GM VAbnormalB old, 'ABNO RMALBOLD') ;
  2779     SaveBool eanItem(GM VAbnormalQ uals, 'ABN ORMALQUALI FIERS');
  2780  
  2781     SaveInte gerItem(GM VNormalTex t, 'NORMAL TEXTCOLOR' );
  2782     SaveInte gerItem(GM VNormalBkg d, 'NORMAL BGCOLOR'); ;
  2783   //  SaveIn tegerItem( GMVNormalT odayBkgd:  integer =  15;
  2784     SaveBool eanItem(GM VNormalBol d, 'NORMAL BOLD');
  2785     SaveBool eanItem(GM VNormalQua ls, 'NORMA LQUALIFIER S');
  2786   end;
  2787  
  2788   procedure  TfraGMV_Gr idGraph.Re storeUserP references ;
  2789   var
  2790     s: Strin g;
  2791  
  2792     function  getBoolea n(aDefault :Boolean;  aName,aTru eString:St ring):Bool ean;
  2793     var
  2794       ss: St ring;
  2795     begin
  2796       ss :=  getUserSet tings(aNam e);
  2797       if ss  = '' then                 //  vh aishandria  20090814
  2798         Resu lt := aDef ault           //  Re medy 34243 4
  2799       else                             //
  2800         Resu lt := ss =  aTrueStri ng;
  2801     end;
  2802  
  2803     function  getIntege r(aDefault :Integer;a Name:Strin g):Integer ;
  2804     var
  2805       ss: St ring;
  2806     begin
  2807       ss :=  getUserSet tings(aNam e);
  2808       if ss  = '' then
  2809         Resu lt := aDef ault
  2810       else
  2811         try
  2812           Re sult := St rToIntDef( ss,aDefaul t);
  2813         exce pt
  2814           Re sult := aD efault;
  2815         end;
  2816     end;
  2817  
  2818   begin
  2819     s := get UserSettin gs('GRIDSI ZE');
  2820     if s <>  '' then pn lGrid.Heig ht := StrT oInt(s);
  2821  
  2822     BGColor  := getInte ger(clWind ow,'GRAPHC OLOR');
  2823     if BGCol or = 0 the n
  2824       BGColo r := clWin dow;
  2825  
  2826     s := get UserSettin gs('GRAPHO PTIONS');
  2827     pnlGraph Options.Vi sible := s  <> 'OFF';
  2828     ShowHide GraphOptio ns1.Checke d := s <>  'OFF';
  2829   {$IFNDEF D LL}
  2830     if assig ned(frmGMV _UserMain)  then
  2831       frmGMV _UserMain. ShowHideGr aphOptions 1.Checked  := s <> 'O FF';
  2832   {$ENDIF}
  2833     cbValues .Checked : = getBoole an(TRUE,'G RAPHOPTION S-1','ON') ;
  2834  
  2835     s := get UserSettin gs('GRAPHO PTIONS-4') ;
  2836     inc(iIgn oreCount);
  2837     cbChrono .Checked : = s <> 'OF F';
  2838     dec(iIgn oreCount);
  2839  
  2840     s := get UserSettin gs('GRAPHO PTIONS-3') ;
  2841     cbAllowZ oom.Checke d := s='ON ';
  2842     chrtVita ls.AllowZo om := s='O N';
  2843     acZoom.E xecute;
  2844  
  2845     s := get UserSettin gs('GRAPHO PTIONS-2') ;
  2846     ckb3D.Ch ecked := ( s='ON') an d cbChrono .Checked;
  2847     ckb3D.En abled := c bChrono.Ch ecked;
  2848  
  2849     if Frame Style = fs Vitals the n
  2850       begin
  2851         s :=  getUserSe ttings('GR APH_INDEX' );
  2852         if s  <> '' the n
  2853              GraphIndex := StrToIn t(s)
  2854         else
  2855              GraphIndex := 0;
  2856  
  2857         Grid Row:= Grid RowByGraph Index(Grap hIndex);
  2858       end;
  2859  
  2860     GMVAbnor malText :=  getIntege r(GMVAbnor malText,'A BNORMALTEX TCOLOR');
  2861     GMVAbnor malBkgd :=  getIntege r(GMVAbnor malBkgd, ' ABNORMALBG COLOR');
  2862   //  SaveIn tegerItem( GMVAbnorma lTodayBkgd : integer  = 15;
  2863     GMVAbnor malBold :=  getBoolea n(GMVAbnor malBold, ' ABNORMALBO LD','ON');
  2864     GMVAbnor malQuals : = getBoole an(True, ' ABNORMALQU ALIFIERS', 'ON');  // VHAISPBELL C  6/2/10
  2865  
  2866     GMVNorma lText := g etInteger( GMVNormalT ext, 'NORM ALTEXTCOLO R');
  2867     GMVNorma lBkgd := g etInteger( GMVNormalB kgd, 'NORM ALBGCOLOR' );;
  2868   //  SaveIn tegerItem( GMVNormalT odayBkgd:  integer =  15;
  2869     GMVNorma lBold := g etBoolean( GMVNormalB old, 'NORM ALBOLD','O N');
  2870     GMVNorma lQuals :=  getBoolean (True, 'NO RMALQUALIF IERS','ON' ); //VHAIS PBELLC 6/2 /10
  2871  
  2872     grdVital s.Invalida te;
  2873   end;
  2874  
  2875   procedure  TfraGMV_Gr idGraph.se tGraphByAB BR(aABBR:S tring);
  2876   var
  2877     aRow: In teger;
  2878   begin
  2879     if aABBR  = 'BMI' t hen aRow : = rBMI{8}  // vhaisha ndria 0609 13 BMI sel ection
  2880     else
  2881       case V italTypeBy ABBR(aABBR ) of
  2882         vtTe mp:aRow :=  rTemp{1};
  2883         vtPu lse:aRow : = rPulse{2 };
  2884         vtRe sp: aRow : = rResp{3} ;
  2885         vtPO 2: aRow :=  rPOx{4};
  2886         vtBP : aRow :=  rBP{6};
  2887         vtHe ight: aRow  := rHeigh t{9};
  2888         vtWe ight: aRow  := rWeigh t{7};
  2889     //    vt BMI: aRow  := 8; // v haishandri a 060913 B MI selecti on
  2890         vtCi rcum: aRow  := rGirth {10};
  2891         vtCV P: aRow :=  rCVP{11};
  2892     //    vt In: aRow : = 8;
  2893     //    vt Output: aR ow := 8;
  2894         vtPa in: aRow : = rPain{14 };
  2895       else
  2896         aRow  := 0;
  2897       end;
  2898  
  2899     grdVital s.Invalida te;
  2900  
  2901     getGraph ByName(Gra phNameByGr idRow(aRow ));
  2902     if Graph IndexByGri dRow(aRow)  <> iIgnor eGraph the n
  2903       fGridR ow := aRow ;
  2904     GraphInd ex := Grap hIndexByGr idRow(aRow );
  2905     grdVital s.Invalida te;
  2906   end;
  2907  
  2908   procedure  TfraGMV_Gr idGraph.ch rtVitalsCl ickLegend( Sender: TC ustomChart ;
  2909     Button:  TMouseButt on; Shift:  TShiftSta te; X, Y:  Integer);
  2910   begin
  2911     ShowGrap hReport;
  2912   end;
  2913  
  2914   procedure  TfraGMV_Gr idGraph.Sh owGraphRep ort;
  2915   var
  2916     bData: B oolean;
  2917     iActiveS eries: Int eger;
  2918     i,j,k,m:  Integer;
  2919     sName,sL ocation,
  2920     s,ss,s4:  String;
  2921     ST,
  2922     SL: TStr ingList;
  2923   const
  2924     sF = '%- 20s';
  2925     sNA = 'N /A';
  2926  
  2927     function  RowByName (aName:Str ing):Integ er;
  2928     begin
  2929       Result  := -1;
  2930       if (aN ame = sgnT emp) or (a Name = 'Te mp.') then    Result  := rTemp{1 }
  2931       else   if (aName  = sgnPulse )
  2932              or (aName  = 'Pulse')  then Resu lt := rPul se{2}
  2933       else   if (aName  = sgnResp)
  2934              or (aName  = 'Resp.')  then Resu lt := rRes p{3}
  2935       else   if (aName  = 'Pulse O x.') then  Result :=  rPOx{4}
  2936       else   if (aName  = 'Sys.')  then Resul t := rBP{6 }
  2937       else   if (aName  = 'Dias.')  then Resu lt := -1
  2938       else   if (aName  = sgnWeigh t) then Re sult := rW eight{7}
  2939       else   if (aName  = 'BMI') t hen Result  := rBMI{8 }
  2940       else   if (aName  = sgnHeigh t) then Re sult := rH eight{9}
  2941       else   if (aName  = sgnGirth ) then Res ult := rGi rth{10}
  2942       else   if (aName  = sgnCVP)  then Resul t := rCVP{ 11}
  2943       else   if (aName  = sgnIn) t hen Result  := rIntak e{12}
  2944       else   if (aName  = sgnOutpu t) then Re sult := rO utput{13}
  2945       else   if (aName  = sgnPain)  then Resu lt := rPai n{14}
  2946       ;
  2947     end;
  2948  
  2949     procedur e addTitle ;
  2950     var
  2951       s: Str ing; //CB  Removed Sl  (Remedy 3 70490)
  2952     begin
  2953       ss :=  ss + ' ' +  Format(sF ,['Locatio n'])+Forma t(sF,['Ent ered By']) ;  //CB Ad ded space  (Remedy 37 0490)
  2954       s := ' ';
  2955       while  length(s)  < Length(s s) do
  2956         s :=  s + '-';
  2957       SL.Add (ss);
  2958       SL.Add (s);
  2959     end;
  2960  
  2961   begin
  2962     bData :=  False;
  2963     iActiveS eries := 0 ;
  2964     SL := TS tringList. Create;
  2965     ST := TS tringList. Create;
  2966  
  2967     ss := Fo rmat(sF,[' Date/Time' ]);
  2968     for i :=  0 to chrt Vitals.Ser iesCount -  1 do
  2969       begin
  2970         if n ot chrtVit als.Series [i].Active  then cont inue;
  2971         inc( iActiveSer ies);
  2972         s :=  chrtVital s.Series[i ].Title;
  2973         j :=  RowByName (s);
  2974         if j  < 0 then  continue;
  2975         if s  = 'Sys.'  then s :=  'B/P';
  2976         ss : = ss + For mat(sF,[s] ) ;
  2977         ST.A dd(Format( sF,[s]));
  2978         ST.O bjects[ST. Count-1] : = Pointer( j);
  2979         if j  = rPOx th en
  2980           be gin
  2981              ST.Add('') ;
  2982              ST.Objects [ST.Count- 1] := Poin ter(rPOx+1 {5});
  2983           en d;
  2984       end;
  2985  
  2986     if iActi veSeries =  0 then
  2987       begin
  2988         Show Info('Grap h Report o n '+getPat ientName,' The graph  is empty', True);
  2989         exit ;
  2990       end;
  2991  
  2992     AddTitle ;
  2993  
  2994     for i :=  1 to grdV itals.ColC ount - 1 d o
  2995       begin
  2996         s :=  '';
  2997         m :=  0;
  2998         for  j := 0 to  ST.Count -  1 do
  2999           be gin
  3000              k := Integ er(Pointer (ST.Object s[j]));
  3001              ss := grdV itals.Cell s[i, k];
  3002              case k of
  3003                rPOx: s4  := ss;                             // 4
  3004                rPOx+1:  s := s + F ormat(sF,[ s4+' '+ss] ); // 5
  3005              else
  3006                s := s +  Format(sF ,[ss]);
  3007              end;
  3008              if k <> 4  then inc(m );
  3009           en d;
  3010         if t rim(s) <>  '' then
  3011           be gin
  3012              bData := T rue;
  3013              sName := g rdVitals.C ells[i,rEn teredBy];  if sName =  '' then s Name := sN A;
  3014              sLocation  := grdVita ls.Cells[i ,rLocation ];  if sLo cation = ' ' then sLo cation :=  sNA;
  3015  
  3016              k := m * 2 0;
  3017              while (Len gth(s) > k ) and (cop y(s,Length (s),1)=' ' ) and (s<> '') do
  3018                s := cop y(s,1,Leng th(s)-1);
  3019              if Length( s) = k the n
  3020                s := s +  ' ';
  3021              s := Forma t(sF,[grdV itals.Cell s[i,0]]) +  s + Forma t(sF,[sLoc ation]);
  3022              k := (m+2)  * 20;
  3023              while (Len gth(s) > k ) and (cop y(s,Length (s),1)=' ' ) and (s<> '') do
  3024                s := cop y(s,1,Leng th(s)-1);
  3025              if Length( s) = k the n
  3026                s := s +  ' ';
  3027              s := s + F ormat(sF,[ sName]);
  3028              SL.Add(s);
  3029           en d;
  3030       end;
  3031  
  3032     if not b Data then
  3033       SL.Add ('No data  available  in the gra ph')
  3034     else
  3035       begin
  3036       //  Pa tient DOB
  3037       //  Wa rd and Bed
  3038       //  Pa ge number
  3039  
  3040         SL.I nsert(0,'' );
  3041         SL.I nsert(0,'L ocation: ' + lblHospi tal.Captio n); // vha ishandria  061116
  3042         SL.I nsert(0,pt Info); //  vhaishandr ia 061116
  3043         SL.I nsert(0,'V itals on ' +getPatien tName+' (' +copy(edPa tientInfo. Text,8,4)+ ')');
  3044       end;
  3045     ShowInfo ('Graph Re port on '+ getPatient Name,SL.Te xt,True);
  3046  
  3047     SL.Free;
  3048     ST.Free;
  3049   end;
  3050  
  3051   procedure  TfraGMV_Gr idGraph.ac ZoomOutExe cute(Sende r: TObject );
  3052   var
  3053     d: Doubl e;
  3054     i: Integ er;
  3055   begin
  3056     if chrtV itals.Left Axis.Maxim um > iMaxi mumLimit t hen Exit;
  3057  
  3058     try
  3059       i := S trToIntDef (edZoom.Te xt,50);
  3060       if i >  100 then  i := 100;
  3061       if i =  100 then  edZoom.Tex t := '100' ;
  3062     except
  3063       begin
  3064         edZo om.Text :=  '50';
  3065         i :=  50;
  3066       end;
  3067     end;
  3068  
  3069     d := i/1 00;
  3070     try
  3071       chrtVi tals.LeftA xis.Maximu m := (1+d)  * chrtVit als.LeftAx is.Maximum ;
  3072       if chr tVitals.Le ftAxis.Min imum >=0 t hen
  3073         chrt Vitals.Lef tAxis.Mini mum := (1- d) * chrtV itals.Left Axis.Minim um;
  3074     except
  3075       on E:  Exception  do
  3076         Show Message('Z oom In'+#1 3#10+E.Mes sage);
  3077     end;
  3078   end;
  3079  
  3080   procedure  TfraGMV_Gr idGraph.ac ZoomInExec ute(Sender : TObject) ;
  3081   var
  3082     d: Doubl e;
  3083     i: Integ er;
  3084   begin
  3085     try
  3086       i := S trToIntDef (edZoom.Te xt,50);
  3087     except
  3088       begin
  3089         edZo om.Text :=  '50';
  3090         i :=  50;
  3091       end;
  3092     end;
  3093     d := i/1 00;
  3094  
  3095     if ((1-d ) * chrtVi tals.LeftA xis.Maximu m >= (1+d)  * chrtVit als.LeftAx is.Minimum )  then
  3096       begin
  3097         try
  3098           ch rtVitals.L eftAxis.Ma ximum := ( 1-d) * chr tVitals.Le ftAxis.Max imum;
  3099           if  chrtVital s.LeftAxis .Minimum > =0 then
  3100              chrtVitals .LeftAxis. Minimum :=  (1+d) * c hrtVitals. LeftAxis.M inimum;
  3101         exce pt
  3102           on  E: Except ion do
  3103              ShowMessag e('Zoom Ou t'+#13#10+ E.Message) ;
  3104         end;
  3105       end;
  3106   end;
  3107  
  3108   procedure  TfraGMV_Gr idGraph.ac ZoomResetE xecute(Sen der: TObje ct);
  3109   begin
  3110     try
  3111       chrtVi tals.LeftA xis.Maximu m := fAxis Max;
  3112       chrtVi tals.LeftA xis.Minimu m := fAxis Min;
  3113     except
  3114       on E:  Exception  do
  3115         Show Message('Z oom Reset  '+#13#10+E .Message);
  3116     end;
  3117   end;
  3118  
  3119   procedure  TfraGMV_Gr idGraph.sp lGridGraph Moved(Send er: TObjec t);
  3120   begin
  3121     splGridG raph.Align  := alTop;
  3122     Applicat ion.Proces sMessages;
  3123     splGridG raph.Align  := alBott om;
  3124     Applicat ion.Proces sMessages;
  3125   end;
  3126  
  3127   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  3128   // debug / /
  3129   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  3130   procedure  TfraGMV_Gr idGraph.ch rtVitalsDb lClick(Sen der: TObje ct);
  3131   begin
  3132   {$IFDEF AA NTEST}
  3133     chrtVita ls.CalcSiz e3DWalls;
  3134     ShowMess age(Format ('Width =  %d Height  = %d',[chr tVitals.Wi dth3d,chrt Vitals.Hei ght3D]));
  3135   {$ENDIF}
  3136   end;
  3137  
  3138   procedure  TfraGMV_Gr idGraph.ac UpdateGrid ColorsExec ute(Sender : TObject) ;
  3139   begin
  3140     UpdateUs erSettings ;
  3141     BGTodayC olor := GM VNormalTod ayBkgd;
  3142     try
  3143       grdVit als.Refres h;
  3144     except
  3145     end;
  3146   end;
  3147  
  3148   ////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
  3149  
  3150   procedure  TfraGMV_Gr idGraph.ac PatientInf oExecute(S ender: TOb ject);
  3151   begin
  3152     ShowPati entInfo(Pa tientDFN,' Patient In quiry for: '+edPatien tName.Text  +
  3153       '  ' +  edPatient Info.Text) ; // vhais handria 06 0308
  3154   end;
  3155  
  3156   procedure  TfraGMV_Gr idGraph.pn lPtInfoEnt er(Sender:  TObject);
  3157   begin
  3158     pnlPtInf o.BevelOut er := bvRa ised; // v haishandri a 060308
  3159   end;
  3160  
  3161   procedure  TfraGMV_Gr idGraph.pn lPtInfoExi t(Sender:  TObject);
  3162   begin
  3163     pnlPtInf o.BevelOut er := bvNo ne; // vha ishandria  060308
  3164   end;
  3165  
  3166   function T fraGMV_Gri dGraph.get PatientNam e:String;
  3167   begin
  3168     Result : = edPatien tName.Text ;
  3169   end;
  3170  
  3171   function T fraGMV_Gri dGraph.get PatientInf o:String;
  3172   begin
  3173     Result : = edPatien tInfo.Text ;
  3174   end;
  3175  
  3176   procedure  TfraGMV_Gr idGraph.sh owVitalsRe port;
  3177   var
  3178     sTime, s Start,sEnd ,sLine, s, sItem,sVal : String;
  3179     j,iEnd,i Count,iSta rt,iStartL ine,i: int eger;
  3180   begin
  3181     s := '';
  3182     iCount : = 0;
  3183     iStartLi ne := grdV itals.Left Col + 2;
  3184     iStart : = 1;
  3185     iEnd :=  grdVitals. ColCount-1 ;
  3186  
  3187     for i :=  iStart to  iEnd do
  3188       begin
  3189         if ( i = iStart ) then
  3190           sS tart := gr dVitals.Ce lls[i,0];
  3191         if ( i = iEnd)  then
  3192           sE nd := grdV itals.Cell s[i,0];
  3193  
  3194         sTim e := Forma t(' %s',[g rdVitals.C ells[i,0]] );
  3195         sVal  := '';
  3196         sLin e := '';
  3197         for  j := 1 to  grdVitals. RowCount -  1 do
  3198           be gin
  3199              sItem := g rdVitals.C ells[i,j];
  3200              if trim(sI tem)<>'' t hen
  3201                begin
  3202                  sLine  := sLine +  Format('  %s %s;',[g rdVitals.C ells[0,j], sItem]);
  3203                  sVal : = sVal + s Item;
  3204                end;
  3205           en d;
  3206  
  3207         if T rim(sLine)  <> '' the n  // R141 401 - vhai shandria 0 60921 ---- ----------
  3208           s  := s + sTi me + sLine  + #13#10;
  3209         if s Val <> ''  then inc(i Count);
  3210       end;
  3211     if trim( lblHospita l.Caption)  <> '' the n
  3212       sLine  := lblHosp ital.Capti on
  3213     else
  3214       sLine  := 'no loc ation sele cted';
  3215  
  3216     s := 'Pa tient Loca tion: '+ s Line  +#13 #10 +
  3217       'Date  Range: '+l blDateFrom Title.Capt ion + #13# 10 +
  3218       'The f ollowing ' +IntToStr( iCount)+
  3219       ' line s are curr ently visi ble in the  data grid  display.' +#13#10 +  s;
  3220  
  3221     ShowInfo ('Data Gri d Report f or '+getPa tientName+  ' ' + get PatientInf o,s, False ,iStartLin e);
  3222   end;
  3223  
  3224   procedure  TfraGMV_Gr idGraph.ac VitalsRepo rtExecute( Sender: TO bject);
  3225   begin
  3226     ShowVita lsReport;
  3227   end;
  3228  
  3229   procedure  TfraGMV_Gr idGraph.pn lPtInfoMou seDown(Sen der: TObje ct;
  3230     Button:  TMouseButt on; Shift:  TShiftSta te; X, Y:  Integer);
  3231   begin
  3232     pnlPtInf o.BevelOut er := bvLo wered; //  vhaishandr ia 060308
  3233   end;
  3234  
  3235   procedure  TfraGMV_Gr idGraph.pn lPtInfoMou seUp(Sende r: TObject ;
  3236     Button:  TMouseButt on; Shift:  TShiftSta te; X, Y:  Integer);
  3237   begin
  3238     pnlPtInf o.BevelOut er := bvNo ne; // vha ishandria  060308
  3239     acPatien tInfo.Exec ute;
  3240   end;
  3241   // R144771  (Zoom dis torts Grap h display
  3242   //      Se ries.Marks .Clipped s et to True
  3243   //      Ch art ClipPo ints set t o True
  3244   procedure  TfraGMV_Gr idGraph.gr dVitalsMou seMove(Sen der: TObje ct;
  3245     Shift: T ShiftState ; X, Y: In teger);
  3246   var
  3247     Column,  Row: Longi nt;
  3248   begin // 1 41396 - Sc roll data  cells
  3249     grdVital s.MouseToC ell(X, Y,  Column, Ro w);
  3250       if (Column  < 0) or ( Row < 0) t hen exit;  // DN S      BELLC
  3251     if (Colu mn <= grdV itals.ColC ount - 1)  and (Row < = grdVital s.RowCount  - 1) then
  3252       try
  3253         grdV itals.Hint  := '  ' +  grdVitals .Cells[Col umn,Row];
  3254       except
  3255       end;
  3256   end;
  3257  
  3258   procedure  TfraGMV_Gr idGraph.ac RPCLogExec ute(Sender : TObject) ;
  3259   begin
  3260     ShowRPCL og;
  3261   end;
  3262  
  3263   procedure  TfraGMV_Gr idGraph.ac ShowGraphR eportExecu te(Sender:  TObject);
  3264   begin
  3265     ShowGrap hReport;
  3266   end;
  3267  
  3268   end.
  3269