| 1 | //kt -- Modified with SourceScanner on 8/17/2007 | 
|---|
| 2 | {Modifications | 
|---|
| 3 | Date: 4/1/98 RAB/ISL | 
|---|
| 4 | Description: Added procedure SelectVital(FontSize:integer; idx: integer) | 
|---|
| 5 | To be able to pass the row index into the form.  This will enable the vital | 
|---|
| 6 | entry form to open the apropriate line on this form (If this screen is opened | 
|---|
| 7 | by the vital entry screen) | 
|---|
| 8 |  | 
|---|
| 9 | Date: 4/9/98 RAB/ISL | 
|---|
| 10 | Descriotion:  Added button and click event to call vital entry screen. | 
|---|
| 11 |  | 
|---|
| 12 | Date: 4/9/98 RAB/ISL | 
|---|
| 13 | Descriotion:  if Idx passed into procedure SelectVital is '99' then the botton to | 
|---|
| 14 | call the vital entry screen will be disabled. | 
|---|
| 15 |  | 
|---|
| 16 | Date: 4/23/98 | 
|---|
| 17 | By: Robert Bott | 
|---|
| 18 | Description: Set position of form to poScreenCenter. | 
|---|
| 19 | Date: 4/23/98 | 
|---|
| 20 | By: Robert Bott | 
|---|
| 21 | Description: Forced an update after returning from vital entry form. | 
|---|
| 22 |  | 
|---|
| 23 | //Modifed: 6/23/98 | 
|---|
| 24 | //By: Robert Bott | 
|---|
| 25 | //Location: ISL | 
|---|
| 26 | //Description of Mod: | 
|---|
| 27 | //  Moved code that verifies valid provider and visit from fvit into fVitals. | 
|---|
| 28 | //   now found in procedure TfrmVitals.btnEnterVitalsClick(Sender: TObject); | 
|---|
| 29 | //   formerly in procedure TfrmVit.FormActivate(Sender: TObject); | 
|---|
| 30 |  | 
|---|
| 31 | } | 
|---|
| 32 |  | 
|---|
| 33 | unit fVitals; | 
|---|
| 34 |  | 
|---|
| 35 | interface | 
|---|
| 36 |  | 
|---|
| 37 | uses | 
|---|
| 38 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, | 
|---|
| 39 | StdCtrls, ORCtrls, TeEngine, Series, TeeProcs, Chart, ExtCtrls, Grids, | 
|---|
| 40 | Buttons, ORNet, ORFn, uConst, Menus, ORDtTmRng | 
|---|
| 41 | , ComCtrls | 
|---|
| 42 | , uVitals, DKLang | 
|---|
| 43 | ;  {*KCM*} | 
|---|
| 44 |  | 
|---|
| 45 | type | 
|---|
| 46 | TfrmVitals = class(TForm) | 
|---|
| 47 | pnlTop: TPanel; | 
|---|
| 48 | chtChart: TChart; | 
|---|
| 49 | serTest: TLineSeries; | 
|---|
| 50 | pnlLeft: TORAutoPanel; | 
|---|
| 51 | lstDates: TORListBox; | 
|---|
| 52 | pnlBottom: TPanel; | 
|---|
| 53 | grdVitals: TCaptionStringGrid; | 
|---|
| 54 | pnlButtons: TPanel; | 
|---|
| 55 | lstVitals: TCaptionListBox; | 
|---|
| 56 | serTestX: TLineSeries; | 
|---|
| 57 | serTime: TPointSeries; | 
|---|
| 58 | lblNoResults: TStaticText; | 
|---|
| 59 | serTestY: TLineSeries; | 
|---|
| 60 | pnlLeftClient: TORAutoPanel; | 
|---|
| 61 | chkValues: TCheckBox; | 
|---|
| 62 | chk3D: TCheckBox; | 
|---|
| 63 | chkZoom: TCheckBox; | 
|---|
| 64 | pnlEnterVitals: TPanel; | 
|---|
| 65 | btnEnterVitals: TButton; | 
|---|
| 66 | popChart: TPopupMenu; | 
|---|
| 67 | popValues: TMenuItem; | 
|---|
| 68 | pop3D: TMenuItem; | 
|---|
| 69 | popZoom: TMenuItem; | 
|---|
| 70 | popZoomBack: TMenuItem; | 
|---|
| 71 | N1: TMenuItem; | 
|---|
| 72 | popCopy: TMenuItem; | 
|---|
| 73 | N2: TMenuItem; | 
|---|
| 74 | popDetails: TMenuItem; | 
|---|
| 75 | calVitalsRange: TORDateRangeDlg; | 
|---|
| 76 | N3: TMenuItem; | 
|---|
| 77 | popPrint: TMenuItem; | 
|---|
| 78 | dlgWinPrint: TPrintDialog; | 
|---|
| 79 | DKLanguageController1: TDKLanguageController; | 
|---|
| 80 | procedure lstDatesClick(Sender: TObject); | 
|---|
| 81 | procedure FormCreate(Sender: TObject); | 
|---|
| 82 | procedure FormDestroy(Sender: TObject); | 
|---|
| 83 | procedure lstVitalsClick(Sender: TObject); | 
|---|
| 84 | procedure grdVitalsSelectCell(Sender: TObject; Col, Row: Integer; | 
|---|
| 85 | var CanSelect: Boolean); | 
|---|
| 86 | procedure chkZoomClick(Sender: TObject); | 
|---|
| 87 | procedure chk3DClick(Sender: TObject); | 
|---|
| 88 | procedure chkValuesClick(Sender: TObject); | 
|---|
| 89 | procedure FormShow(Sender: TObject); | 
|---|
| 90 | procedure pnlEnterVitalsResize(Sender: TObject); | 
|---|
| 91 | procedure btnEnterVitalsClick(Sender: TObject); | 
|---|
| 92 | procedure chtChartUndoZoom(Sender: TObject); | 
|---|
| 93 | procedure popValuesClick(Sender: TObject); | 
|---|
| 94 | procedure pop3DClick(Sender: TObject); | 
|---|
| 95 | procedure popZoomClick(Sender: TObject); | 
|---|
| 96 | procedure popZoomBackClick(Sender: TObject); | 
|---|
| 97 | procedure popCopyClick(Sender: TObject); | 
|---|
| 98 | procedure popDetailsClick(Sender: TObject); | 
|---|
| 99 | procedure chtChartClickSeries(Sender: TCustomChart; | 
|---|
| 100 | Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton; | 
|---|
| 101 | Shift: TShiftState; X, Y: Integer); | 
|---|
| 102 | procedure chtChartMouseDown(Sender: TObject; Button: TMouseButton; | 
|---|
| 103 | Shift: TShiftState; X, Y: Integer); | 
|---|
| 104 | procedure chtChartClickLegend(Sender: TCustomChart; | 
|---|
| 105 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
|---|
| 106 | procedure popChartPopup(Sender: TObject); | 
|---|
| 107 | procedure popPrintClick(Sender: TObject); | 
|---|
| 108 | procedure BeginEndDates(var ADate1, ADate2: TFMDateTime; var ADaysBack: integer); | 
|---|
| 109 | procedure FormKeyUp(Sender: TObject; var Key: Word; | 
|---|
| 110 | Shift: TShiftState); | 
|---|
| 111 | private | 
|---|
| 112 | { Private declarations } | 
|---|
| 113 | procedure VGrid(griddata: TStrings); | 
|---|
| 114 | procedure WorksheetChart(test: string; aitems: TStrings); | 
|---|
| 115 | procedure GetStartStop(var start, stop: string; aitems: TStrings); | 
|---|
| 116 | public | 
|---|
| 117 | { Public declarations } | 
|---|
| 118 | function FMToDateTime(FMDateTime: string): TDateTime; | 
|---|
| 119 | end; | 
|---|
| 120 |  | 
|---|
| 121 |  | 
|---|
| 122 | var | 
|---|
| 123 | frmVitals: TfrmVitals; | 
|---|
| 124 | tmpGrid: TStringList; | 
|---|
| 125 | uDate1, uDate2: Tdatetime; | 
|---|
| 126 |  | 
|---|
| 127 | procedure SelectVital(FontSize:integer; idx: integer); | 
|---|
| 128 | procedure SelectVitals(VitalType: String); | 
|---|
| 129 | function VitalsGrid(const patient: string; date1, date2: TFMDateTime; restrictdates: integer; tests: TStrings): TStrings;  //*DFN* | 
|---|
| 130 | function VitalsMemo(const patient: string; date1, date2: TFMDateTime; tests: TStrings): TStrings;  //*DFN* | 
|---|
| 131 |  | 
|---|
| 132 | implementation | 
|---|
| 133 |  | 
|---|
| 134 | uses fCover, uCore, rCore, fVit, fFrame, fEncnt, fVisit, fRptBox, rReports, | 
|---|
| 135 | uAccessibleStringGrid, uInit; | 
|---|
| 136 |  | 
|---|
| 137 | const | 
|---|
| 138 | ZOOM_PERCENT = 99;        // padding for inflating margins | 
|---|
| 139 |  | 
|---|
| 140 | {$R *.DFM} | 
|---|
| 141 |  | 
|---|
| 142 |  | 
|---|
| 143 | procedure SelectVital(FontSize:integer; idx: integer); | 
|---|
| 144 | var | 
|---|
| 145 | frmVitals: TfrmVitals; | 
|---|
| 146 | begin | 
|---|
| 147 | frmVitals := TfrmVitals.Create(Application); | 
|---|
| 148 | try | 
|---|
| 149 | ResizeAnchoredFormToFont(frmVitals); | 
|---|
| 150 | with frmVitals do | 
|---|
| 151 | begin | 
|---|
| 152 | if idx <= lstvitals.items.count then lstVitals.ItemIndex := idx | 
|---|
| 153 | else lstVitals.ItemIndex := 0; | 
|---|
| 154 |  | 
|---|
| 155 | if idx = 99 then | 
|---|
| 156 | btnEnterVitals.enabled := False; | 
|---|
| 157 | ShowModal; | 
|---|
| 158 | end; | 
|---|
| 159 |  | 
|---|
| 160 | finally | 
|---|
| 161 | frmVitals.Release; | 
|---|
| 162 | end; | 
|---|
| 163 | end; | 
|---|
| 164 |  | 
|---|
| 165 | function getVitalsStartDate : String; | 
|---|
| 166 | begin | 
|---|
| 167 | result := ''; | 
|---|
| 168 | if Patient.Inpatient then | 
|---|
| 169 | result := FormatDateTime('mm/dd/yy',Now - 7) | 
|---|
| 170 | else | 
|---|
| 171 | result := FormatDateTime('mm/dd/yy',IncMonth(Now,-6)); | 
|---|
| 172 | end; | 
|---|
| 173 |  | 
|---|
| 174 | procedure SelectVitals(VitalType: String); | 
|---|
| 175 | var | 
|---|
| 176 | VLPtVitals : TGMV_VitalsViewForm; | 
|---|
| 177 | GMV_FName, | 
|---|
| 178 | GMV_LibName: String; | 
|---|
| 179 | //kt start ------------- | 
|---|
| 180 | aDFN, aLocation, | 
|---|
| 181 | DateStart, DateStop, | 
|---|
| 182 | aSignature, | 
|---|
| 183 | aContextIn,aContextOut, | 
|---|
| 184 | aName,anInfo, | 
|---|
| 185 | aDynamicParameter {HospitolName^Vital Type Abbreviation} :String; | 
|---|
| 186 | //kt end ------------------ | 
|---|
| 187 |  | 
|---|
| 188 | begin | 
|---|
| 189 | { Availble Forms: | 
|---|
| 190 | GMV_FName :='GMV_VitalsEnterDLG'; | 
|---|
| 191 | GMV_FName :='GMV_VitalsEnterForm'; | 
|---|
| 192 | GMV_FName :='GMV_VitalsViewForm'; | 
|---|
| 193 | GMV_FName :='GMV_VitalsViewDLG'; | 
|---|
| 194 | } | 
|---|
| 195 | GMV_FName :='GMV_VitalsViewDLG'; | 
|---|
| 196 | GMV_LibName :='GMV_VitalsViewEnter.dll'; | 
|---|
| 197 | GMV_LibName := GetProgramFilesPath + SHARE_DIR + GMV_LibName; | 
|---|
| 198 | VitalsDLLHandle := LoadLibrary(PChar(GMV_LibName)); | 
|---|
| 199 | // UpdateTimeOutInterval(5000); | 
|---|
| 200 | if VitalsDLLHandle <> 0 then | 
|---|
| 201 | begin | 
|---|
| 202 | @VLPtVitals := GetProcAddress(VitalsDLLHandle,PChar(GMV_FName)); | 
|---|
| 203 | if assigned(VLPtVitals) then begin | 
|---|
| 204 | VLPtVitals(RPCBrokerV,Patient.DFN,FloatToStr(Encounter.Location), | 
|---|
| 205 | getVitalsStartDate(),FormatDateTime('mm/dd/yy',Now), | 
|---|
| 206 | GMV_APP_SIGNATURE, | 
|---|
| 207 | GMV_CONTEXT,GMV_CONTEXT, | 
|---|
| 208 | Patient.Name, | 
|---|
| 209 | frmFrame.lblPtSSN.Caption + '    ' + frmFrame.lblPtAge.Caption, | 
|---|
| 210 | Encounter.LocationName +U+ VitalType) | 
|---|
| 211 | end else | 
|---|
| 212 | //     MessageDLG('Can''t find function "'+GMV_FName+'".',mtError,[mbok],0);  <-- original line.  //kt 8/17/2007 | 
|---|
| 213 | MessageDLG(DKLangConstW('fVitals_Canxxt_find_function_x')+GMV_FName+'".',mtError,[mbok],0); //kt added 8/17/2007 | 
|---|
| 214 | end | 
|---|
| 215 | else | 
|---|
| 216 | //  MessageDLG('Can''t find library "'+GMV_LibName+'".',mtError,[mbok],0);  <-- original line.  //kt 8/17/2007 | 
|---|
| 217 | MessageDLG(DKLangConstW('fVitals_Canxxt_find_library_x')+GMV_LibName+'".',mtError,[mbok],0); //kt added 8/17/2007 | 
|---|
| 218 | @VLPtVitals := nil; | 
|---|
| 219 | FreeLibrary(VitalsDLLHandle); | 
|---|
| 220 | if DLLForceClose then | 
|---|
| 221 | frmFrame.Close; // Fix for CQ: 7535 | 
|---|
| 222 | end; | 
|---|
| 223 |  | 
|---|
| 224 | (* | 
|---|
| 225 | procedure SelectVitals(FontSize: Integer); | 
|---|
| 226 | var | 
|---|
| 227 | frmVitals: TfrmVitals; | 
|---|
| 228 | firstchar: string; | 
|---|
| 229 | i: integer; | 
|---|
| 230 | begin | 
|---|
| 231 | frmVitals := TfrmVitals.Create(Application); | 
|---|
| 232 | try | 
|---|
| 233 | ResizeAnchoredFormToFont(frmVitals); | 
|---|
| 234 | with frmVitals do | 
|---|
| 235 | begin | 
|---|
| 236 | with frmCover do | 
|---|
| 237 | for i := ComponentCount - 1 downto 0 do | 
|---|
| 238 | begin | 
|---|
| 239 | if Components[i] is TORListBox then | 
|---|
| 240 | begin | 
|---|
| 241 | case Components[i].Tag of | 
|---|
| 242 | 70: | 
|---|
| 243 | if (Components[i] as TORListBox).ItemIndex > -1 then | 
|---|
| 244 | begin | 
|---|
| 245 | // changed to look at 2 chars so pain & pulse not confused {*KCM*} | 
|---|
| 246 | firstchar := UpperCase(Copy(Piece((Components[i] as TORListBox).Items[(Components[i] as TORListBox).ItemIndex], '^', 2), 1, 2)); | 
|---|
| 247 | if firstchar = 'T' then | 
|---|
| 248 | lstVitals.ItemIndex := 0 | 
|---|
| 249 | else if firstchar = 'P' then | 
|---|
| 250 | lstVitals.ItemIndex := 1 | 
|---|
| 251 | else if firstchar = 'R' then | 
|---|
| 252 | lstVitals.ItemIndex := 2 | 
|---|
| 253 | else if firstchar = 'BP' then | 
|---|
| 254 | lstVitals.ItemIndex := 3 | 
|---|
| 255 | else if firstchar = 'HT' then | 
|---|
| 256 | lstVitals.ItemIndex := 4 | 
|---|
| 257 | else if firstchar = 'WT' then | 
|---|
| 258 | lstVitals.ItemIndex := 5 | 
|---|
| 259 | else if firstchar = 'PN' then | 
|---|
| 260 | lstVitals.ItemIndex := 6; | 
|---|
| 261 | end | 
|---|
| 262 | else | 
|---|
| 263 | begin | 
|---|
| 264 | firstchar := ''; | 
|---|
| 265 | lstVitals.ItemIndex := 0; | 
|---|
| 266 | end; | 
|---|
| 267 | end; | 
|---|
| 268 | end; | 
|---|
| 269 | end; | 
|---|
| 270 | ShowModal; | 
|---|
| 271 | end; | 
|---|
| 272 | finally | 
|---|
| 273 | frmVitals.Release; | 
|---|
| 274 | end; | 
|---|
| 275 | end; | 
|---|
| 276 | *) | 
|---|
| 277 | procedure TfrmVitals.VGrid(griddata: TStrings); | 
|---|
| 278 | var | 
|---|
| 279 | testcnt, datecnt, datacnt, linecnt, x, y, i: integer; | 
|---|
| 280 | begin | 
|---|
| 281 | testcnt := strtoint(Piece(griddata[0], '^', 1)); | 
|---|
| 282 | datecnt := strtoint(Piece(griddata[0], '^', 2)); | 
|---|
| 283 | datacnt := strtoint(Piece(griddata[0], '^', 3)); | 
|---|
| 284 | linecnt := testcnt + datecnt + datacnt; | 
|---|
| 285 | with grdVitals do | 
|---|
| 286 | begin | 
|---|
| 287 | if datecnt = 0 then ColCount := 1 else ColCount := datecnt; | 
|---|
| 288 | if testcnt = 0 then RowCount := 2 else RowCount := testcnt + 1; | 
|---|
| 289 | DefaultColWidth := 80; | 
|---|
| 290 | FixedCols := 0; | 
|---|
| 291 | FixedRows := 1; | 
|---|
| 292 | for y := 0 to RowCount - 1 do | 
|---|
| 293 | for x := 0 to ColCount - 1 do | 
|---|
| 294 | Cells[x, y] := ''; | 
|---|
| 295 | if datecnt = 0 then | 
|---|
| 296 | begin | 
|---|
| 297 | //    Cells[1, 0] := 'no results';  <-- original line.  //kt 8/17/2007 | 
|---|
| 298 | Cells[1, 0] := DKLangConstW('fVitals_no_results'); //kt added 8/17/2007 | 
|---|
| 299 | for x := 1 to RowCount - 1 do | 
|---|
| 300 | Cells[x, 1] := ''; | 
|---|
| 301 | end; | 
|---|
| 302 | for i := testcnt + 1 to testcnt + datecnt do | 
|---|
| 303 | begin | 
|---|
| 304 | Cells[i - testcnt - 1, 0] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(Piece(griddata[i], '^', 2))); | 
|---|
| 305 | end; | 
|---|
| 306 | for i := testcnt + datecnt + 1 to linecnt do | 
|---|
| 307 | begin | 
|---|
| 308 | x := strtoint(Piece(griddata[i], '^', 1)); | 
|---|
| 309 | y := strtoint(Piece(griddata[i], '^', 2)); | 
|---|
| 310 | Cells[x - 1, y]  := Piece(griddata[i], '^', 3); | 
|---|
| 311 | end; | 
|---|
| 312 | end; | 
|---|
| 313 | end; | 
|---|
| 314 |  | 
|---|
| 315 | function VitalsGrid(const patient: string; date1, date2: TFMDateTime; restrictdates: integer; tests: TStrings): TStrings;  //*DFN* | 
|---|
| 316 | begin | 
|---|
| 317 | CallV('GMV ORQQVI1 GRID', [patient, date1, date2, restrictdates, tests]); | 
|---|
| 318 | Result := RPCBrokerV.Results; | 
|---|
| 319 | end; | 
|---|
| 320 |  | 
|---|
| 321 | function VitalsMemo(const patient: string; date1, date2: TFMDateTime; tests: TStrings): TStrings;  //*DFN* | 
|---|
| 322 | begin | 
|---|
| 323 | CallV('GMV ORQQVI1 DETAIL', [patient, date1, date2, 0, tests]); | 
|---|
| 324 | Result := RPCBrokerV.Results; | 
|---|
| 325 | end; | 
|---|
| 326 |  | 
|---|
| 327 | procedure TfrmVitals.lstDatesClick(Sender: TObject); | 
|---|
| 328 | var | 
|---|
| 329 | daysback, vindex: integer; | 
|---|
| 330 | date1, date2: TFMDateTime; | 
|---|
| 331 | today: TDateTime; | 
|---|
| 332 | begin | 
|---|
| 333 | if (lstDates.ItemID = 'S') then | 
|---|
| 334 | begin | 
|---|
| 335 | with calVitalsRange do | 
|---|
| 336 | begin | 
|---|
| 337 | if Execute then | 
|---|
| 338 | begin | 
|---|
| 339 | lstDates.ItemIndex := lstDates.Items.Add(RelativeStart + ';' + | 
|---|
| 340 | //        RelativeStop + U + TextOfStart + ' to ' + TextOfStop);  <-- original line.  //kt 8/17/2007 | 
|---|
| 341 | RelativeStop + U + TextOfStart + DKLangConstW('fVitals_to') + TextOfStop); //kt added 8/17/2007 | 
|---|
| 342 | end | 
|---|
| 343 | else | 
|---|
| 344 | lstDates.ItemIndex := -1; | 
|---|
| 345 | end; | 
|---|
| 346 | end; | 
|---|
| 347 | today := FMToDateTime(floattostr(FMToday)); | 
|---|
| 348 | if lstDates.ItemIEN > 0 then | 
|---|
| 349 | begin | 
|---|
| 350 | daysback := lstDates.ItemIEN; | 
|---|
| 351 | date1 := FMToday + 0.2359; | 
|---|
| 352 | If daysback = 1 then | 
|---|
| 353 | date2 := DateTimeToFMDateTime(today) | 
|---|
| 354 | Else | 
|---|
| 355 | date2 := DateTimeToFMDateTime(today - daysback); | 
|---|
| 356 | end | 
|---|
| 357 | else | 
|---|
| 358 | BeginEndDates(date1,date2,daysback); | 
|---|
| 359 | //date1 := date1 + 0.2359; | 
|---|
| 360 | tmpGrid.Assign(VitalsGrid(Patient.DFN, date1, date2, 0, lstVitals.Items)); | 
|---|
| 361 | vindex := lstVitals.ItemIndex; | 
|---|
| 362 | VGrid(tmpGrid); | 
|---|
| 363 | lstVitals.ItemIndex := vindex; | 
|---|
| 364 | lstVitalsClick(self); | 
|---|
| 365 | chtChart.BottomAxis.Automatic := true;    //*********** | 
|---|
| 366 | chkZoom.Checked := false; | 
|---|
| 367 | chtChart.UndoZoom; | 
|---|
| 368 | if lstVitals.ItemIndex > -1 then | 
|---|
| 369 | begin | 
|---|
| 370 | WorksheetChart(inttostr(lstVitals.ItemIndex + 1), tmpGrid); | 
|---|
| 371 | if (serTest.Count > 1) and not chkZoom.Checked then | 
|---|
| 372 | begin | 
|---|
| 373 | chtChart.UndoZoom; | 
|---|
| 374 | chtChart.ZoomPercent(ZOOM_PERCENT); | 
|---|
| 375 | end; | 
|---|
| 376 | end; | 
|---|
| 377 | end; | 
|---|
| 378 |  | 
|---|
| 379 | procedure TfrmVitals.FormCreate(Sender: TObject); | 
|---|
| 380 | begin | 
|---|
| 381 | grdVitals.Color := ReadOnlyColor; | 
|---|
| 382 | tmpGrid := TStringList.Create; | 
|---|
| 383 | if Patient.Inpatient then lstDates.ItemIndex := 1 else lstDates.ItemIndex := 4; | 
|---|
| 384 | SerTest.GetHorizAxis.ExactDateTime := true; | 
|---|
| 385 | SerTest.GetHorizAxis.Increment := DateTimeStep[dtOneMinute]; | 
|---|
| 386 | TAccessibleStringGrid.WrapControl(grdVitals); | 
|---|
| 387 | end; | 
|---|
| 388 |  | 
|---|
| 389 | procedure TfrmVitals.FormDestroy(Sender: TObject); | 
|---|
| 390 | begin | 
|---|
| 391 | tmpGrid.free; | 
|---|
| 392 | TAccessibleStringGrid.UnwrapControl(grdVitals); | 
|---|
| 393 | end; | 
|---|
| 394 |  | 
|---|
| 395 | function TfrmVitals.FMToDateTime(FMDateTime: string): TDateTime; | 
|---|
| 396 | var | 
|---|
| 397 | x, Year: string; | 
|---|
| 398 | begin | 
|---|
| 399 | { Note: TDateTime cannot store month only or year only dates } | 
|---|
| 400 | x := FMDateTime + '0000000'; | 
|---|
| 401 | if Length(x) > 12 then x := Copy(x, 1, 12); | 
|---|
| 402 | if StrToInt(Copy(x, 9, 4)) > 2359 then x := Copy(x,1,7) + '.2359'; | 
|---|
| 403 | Year := IntToStr(17 + StrToInt(Copy(x,1,1))) + Copy(x,2,2); | 
|---|
| 404 | x := Copy(x,4,2) + '/' + Copy(x,6,2) + '/' + Year + ' ' + Copy(x,9,2) + ':' + Copy(x,11,2); | 
|---|
| 405 | Result := StrToDateTime(x); | 
|---|
| 406 | end; | 
|---|
| 407 |  | 
|---|
| 408 | procedure TfrmVitals.lstVitalsClick(Sender: TObject); | 
|---|
| 409 | begin | 
|---|
| 410 | with grdVitals do | 
|---|
| 411 | begin | 
|---|
| 412 | Row := lstVitals.ItemIndex + 1; | 
|---|
| 413 | Col := grdVitals.ColCount - 1; | 
|---|
| 414 | end; | 
|---|
| 415 | end; | 
|---|
| 416 |  | 
|---|
| 417 | procedure TfrmVitals.WorksheetChart(test: string; aitems: TStrings); | 
|---|
| 418 |  | 
|---|
| 419 | function OkFloatValue(value: string): boolean; | 
|---|
| 420 | var | 
|---|
| 421 | i, j: integer; | 
|---|
| 422 | first, second: string; | 
|---|
| 423 | begin | 
|---|
| 424 | Result := false; | 
|---|
| 425 | i := strtointdef(value, -99999); | 
|---|
| 426 | if i <> -99999 then Result := true | 
|---|
| 427 | else if pos(Pieces(value, '.', 2, 3), '.') > 0 then Result := false | 
|---|
| 428 | else | 
|---|
| 429 | begin | 
|---|
| 430 | first := Piece(value, '.', 1); | 
|---|
| 431 | second := Piece(value, '.', 2); | 
|---|
| 432 | if length(second) > 0 then | 
|---|
| 433 | begin | 
|---|
| 434 | i := strtointdef(first, -99999); | 
|---|
| 435 | j := strtointdef(second, -99999); | 
|---|
| 436 | if (i <> -99999) and (j <> -99999) then Result := true; | 
|---|
| 437 | end | 
|---|
| 438 | else | 
|---|
| 439 | begin | 
|---|
| 440 | i :=strtointdef(first, -99999); | 
|---|
| 441 | if i <> -99999 then Result := true; | 
|---|
| 442 | end; | 
|---|
| 443 | end; | 
|---|
| 444 | end; | 
|---|
| 445 |  | 
|---|
| 446 | var | 
|---|
| 447 | datevalue, oldstart, oldend: TDateTime; | 
|---|
| 448 | labvalue, labvalue1, labvalue2, labvalue3: double; | 
|---|
| 449 | i, numtest, numcol, numvalues, valuecount: integer; | 
|---|
| 450 | high, start, stop, value, value1, value2, value3, testcheck, units, testname, testnum, testorder: string; | 
|---|
| 451 | begin | 
|---|
| 452 |  | 
|---|
| 453 |  | 
|---|
| 454 | valuecount := 0; | 
|---|
| 455 | testnum := Piece(test, '^', 1); | 
|---|
| 456 | testname := lstVitals.Items[strtoint(testnum) - 1]; | 
|---|
| 457 | numtest := strtoint(Piece(aitems[0], '^', 1)); | 
|---|
| 458 | numcol := strtoint(Piece(aitems[0], '^', 2)); | 
|---|
| 459 | numvalues := strtoint(Piece(aitems[0], '^', 3)); | 
|---|
| 460 | if numvalues = 0 then | 
|---|
| 461 | chtChart.Visible := false | 
|---|
| 462 | else | 
|---|
| 463 | begin | 
|---|
| 464 | chtChart.Visible := true; | 
|---|
| 465 | serTest.Clear;  serTestX.Clear;  serTime.Clear; | 
|---|
| 466 | if numtest > 0 then | 
|---|
| 467 | begin | 
|---|
| 468 | for i := 1 to numtest do | 
|---|
| 469 | if testnum = Piece(aitems[i], '^', 1) then | 
|---|
| 470 | begin | 
|---|
| 471 | testorder := inttostr(i); | 
|---|
| 472 | break; | 
|---|
| 473 | end; | 
|---|
| 474 | GetStartStop(start, stop, aitems); | 
|---|
| 475 | chtChart.Legend.Color := grdVitals.Color; | 
|---|
| 476 | chtChart.Title.Font.Size := MainFontSize; | 
|---|
| 477 | chtChart.LeftAxis.Title.Caption := units; | 
|---|
| 478 | serTest.Title := Piece(test, '^', 2); | 
|---|
| 479 | testcheck := testorder; | 
|---|
| 480 | high := '0'; | 
|---|
| 481 | //    if testname = 'Blood Pressure' then  <-- original line.  //kt 8/17/2007 | 
|---|
| 482 | if testname = DKLangConstW('fVitals_Blood_Pressure') then //kt added 8/17/2007 | 
|---|
| 483 | begin | 
|---|
| 484 | serTestY.Active := false; | 
|---|
| 485 | for i := numtest + numcol + 1 to numtest + numcol + numvalues do | 
|---|
| 486 | if Piece(aitems[i], '^', 2) = testcheck then | 
|---|
| 487 | begin | 
|---|
| 488 | serTestX.Active := true; | 
|---|
| 489 | serTestX.Marks.Visible := chkValues.Checked; | 
|---|
| 490 | serTestY.Marks.Visible := chkValues.Checked; | 
|---|
| 491 | value := Piece(aitems[i], '^', 3); | 
|---|
| 492 | value1 := Piece(value, '/', 1); | 
|---|
| 493 | value2 := Piece(value, '/', 2); | 
|---|
| 494 | value3 := Piece(value, '/', 3); | 
|---|
| 495 | if OkFloatValue(value1) and OKFloatValue(value2) then | 
|---|
| 496 | begin | 
|---|
| 497 | high := value1; | 
|---|
| 498 | labvalue1 := strtofloat(value1); | 
|---|
| 499 | labvalue2 := strtofloat(value2); | 
|---|
| 500 | datevalue := FMToDateTime(Piece(aitems[numtest + strtoint(Piece(aitems[i], '^', 1))], '^', 2)); | 
|---|
| 501 | serTest.AddXY(datevalue, labvalue1, '', clTeeColor); | 
|---|
| 502 | serTestX.AddXY(datevalue, labvalue2, '', clTeeColor); | 
|---|
| 503 | inc(valuecount); | 
|---|
| 504 | if OKFloatValue(value3) then | 
|---|
| 505 | begin | 
|---|
| 506 | labvalue3 := strtofloat(value3); | 
|---|
| 507 | serTestY.AddXY(datevalue, labvalue3, '', clTeeColor); | 
|---|
| 508 | serTestY.Active := true; | 
|---|
| 509 | end; | 
|---|
| 510 | end; | 
|---|
| 511 | end; | 
|---|
| 512 | //      serTest.Title := 'Systolic';  <-- original line.  //kt 8/17/2007 | 
|---|
| 513 | serTest.Title := DKLangConstW('fVitals_Systolic'); //kt added 8/17/2007 | 
|---|
| 514 | //      serTestX.Title := 'Diastolic';  <-- original line.  //kt 8/17/2007 | 
|---|
| 515 | serTestX.Title := DKLangConstW('fVitals_Diastolic'); //kt added 8/17/2007 | 
|---|
| 516 | end    // blood pressure | 
|---|
| 517 | else | 
|---|
| 518 | begin | 
|---|
| 519 | for i := numtest + numcol + 1 to numtest + numcol + numvalues do | 
|---|
| 520 | if Piece(aitems[i], '^', 2) = testcheck then | 
|---|
| 521 | begin | 
|---|
| 522 | serTestX.Active := false; | 
|---|
| 523 | serTestY.Active := false; | 
|---|
| 524 | value := Piece(aitems[i], '^', 3); | 
|---|
| 525 | if OkFloatValue(value) then | 
|---|
| 526 | begin | 
|---|
| 527 | high := value; | 
|---|
| 528 | labvalue := strtofloat(value); | 
|---|
| 529 | datevalue := FMToDateTime(Piece(aitems[numtest + strtoint(Piece(aitems[i], '^', 1))], '^', 2)); | 
|---|
| 530 | serTest.AddXY(datevalue, labvalue, '', clTeeColor); | 
|---|
| 531 | inc(valuecount); | 
|---|
| 532 | end; | 
|---|
| 533 | end; | 
|---|
| 534 | serTest.Title := lstVitals.Items[lstVitals.ItemIndex]; | 
|---|
| 535 | end;   // not blood pressure | 
|---|
| 536 | serTime.AddXY(FMToDateTime(start), strtofloat(high), '',clTeeColor); | 
|---|
| 537 | serTime.AddXY(FMToDateTime(stop), strtofloat(high), '',clTeeColor); | 
|---|
| 538 | end;   // numtest > 0 | 
|---|
| 539 | if chkZoom.Checked and chtChart.Visible then | 
|---|
| 540 | begin | 
|---|
| 541 | oldstart := chtChart.BottomAxis.Minimum; | 
|---|
| 542 | oldend := chtChart.BottomAxis.Maximum; | 
|---|
| 543 | chtChart.UndoZoom; | 
|---|
| 544 | chtChart.BottomAxis.Automatic := false; | 
|---|
| 545 | chtChart.BottomAxis.Minimum := oldstart; | 
|---|
| 546 | chtChart.BottomAxis.Maximum := oldend; | 
|---|
| 547 | end | 
|---|
| 548 | else | 
|---|
| 549 | begin | 
|---|
| 550 | chtChart.BottomAxis.Automatic := true; | 
|---|
| 551 | end; | 
|---|
| 552 | if valuecount = 0 then chtChart.Visible := false; | 
|---|
| 553 | end;  // numvalues not 0 | 
|---|
| 554 | end; | 
|---|
| 555 |  | 
|---|
| 556 | procedure TfrmVitals.GetStartStop(var start, stop: string; aitems: TStrings); | 
|---|
| 557 | var | 
|---|
| 558 | numtest, numcol: integer; | 
|---|
| 559 | begin | 
|---|
| 560 | numtest := strtoint(Piece(aitems[0], '^', 1)); | 
|---|
| 561 | numcol := strtoint(Piece(aitems[0], '^', 2)); | 
|---|
| 562 | start := Piece(aitems[numtest + 1], '^', 2); | 
|---|
| 563 | stop := Piece(aitems[numtest + numcol], '^', 2); | 
|---|
| 564 | end; | 
|---|
| 565 |  | 
|---|
| 566 | procedure TfrmVitals.grdVitalsSelectCell(Sender: TObject; Col, | 
|---|
| 567 | Row: Integer; var CanSelect: Boolean); | 
|---|
| 568 | begin | 
|---|
| 569 | lstVitals.ItemIndex := Row - 1; | 
|---|
| 570 | if lstVitals.ItemIndex > -1 then | 
|---|
| 571 | begin | 
|---|
| 572 | WorksheetChart(inttostr(lstVitals.ItemIndex + 1), tmpGrid); | 
|---|
| 573 | if (serTest.Count > 1) and not chkZoom.Checked then | 
|---|
| 574 | begin | 
|---|
| 575 | chtChart.UndoZoom; | 
|---|
| 576 | chtChart.ZoomPercent(ZOOM_PERCENT); | 
|---|
| 577 | end; | 
|---|
| 578 | end; | 
|---|
| 579 | end; | 
|---|
| 580 |  | 
|---|
| 581 | procedure TfrmVitals.chkZoomClick(Sender: TObject); | 
|---|
| 582 | begin | 
|---|
| 583 | chtChart.AllowZoom := chkZoom.Checked; | 
|---|
| 584 | chtChart.AnimatedZoom := chkZoom.Checked; | 
|---|
| 585 | if not chkZoom.Checked then | 
|---|
| 586 | begin | 
|---|
| 587 | chtChart.UndoZoom; | 
|---|
| 588 | if serTest.Count > 1 then chtChart.ZoomPercent(ZOOM_PERCENT); | 
|---|
| 589 | end; | 
|---|
| 590 | end; | 
|---|
| 591 |  | 
|---|
| 592 | procedure TfrmVitals.chk3DClick(Sender: TObject); | 
|---|
| 593 | begin | 
|---|
| 594 | chtChart.View3D := chk3D.Checked; | 
|---|
| 595 | end; | 
|---|
| 596 |  | 
|---|
| 597 | procedure TfrmVitals.chkValuesClick(Sender: TObject); | 
|---|
| 598 | begin | 
|---|
| 599 | serTest.Marks.Visible := chkValues.Checked; | 
|---|
| 600 | if serTestX.Active then serTestX.Marks.Visible := chkValues.Checked; | 
|---|
| 601 | if serTestY.Active then serTestY.Marks.Visible := chkValues.Checked; | 
|---|
| 602 | end; | 
|---|
| 603 |  | 
|---|
| 604 | procedure TfrmVitals.FormShow(Sender: TObject); | 
|---|
| 605 | begin | 
|---|
| 606 | lstDatesClick(self); | 
|---|
| 607 | end; | 
|---|
| 608 |  | 
|---|
| 609 |  | 
|---|
| 610 |  | 
|---|
| 611 |  | 
|---|
| 612 | procedure TfrmVitals.pnlEnterVitalsResize(Sender: TObject); | 
|---|
| 613 | begin | 
|---|
| 614 | btnEnterVitals.top := pnlEnterVitals.top; | 
|---|
| 615 | btnEnterVitals.left := pnlEnterVitals.left; | 
|---|
| 616 | btnEnterVitals.height := pnlEnterVitals.height; | 
|---|
| 617 | btnEnterVitals.width := pnlEnterVitals.width; | 
|---|
| 618 | end; | 
|---|
| 619 |  | 
|---|
| 620 | procedure TfrmVitals.btnEnterVitalsClick(Sender: TObject); | 
|---|
| 621 | begin | 
|---|
| 622 | If Encounter.location > 0.0 then //if it has been assigned. | 
|---|
| 623 | uVitalLocation := Encounter.Location | 
|---|
| 624 | else | 
|---|
| 625 | begin | 
|---|
| 626 | //assign location | 
|---|
| 627 | if Encounter.NeedVisit then | 
|---|
| 628 | begin | 
|---|
| 629 | UpdateVisit(Font.Size); | 
|---|
| 630 | frmFrame.DisplayEncounterText; | 
|---|
| 631 | end; | 
|---|
| 632 | if Encounter.NeedVisit and (not frmFrame.CCOWDrivedChange) then | 
|---|
| 633 | begin | 
|---|
| 634 | InfoBox(TX_NEED_VISIT, TX_NO_VISIT, MB_OK or MB_ICONWARNING); | 
|---|
| 635 | exit;                                  {RAB 6/23/98} | 
|---|
| 636 | end | 
|---|
| 637 | else | 
|---|
| 638 | uVitalLocation := Encounter.Location; | 
|---|
| 639 | end; | 
|---|
| 640 |  | 
|---|
| 641 | if (not encounter.needvisit) then | 
|---|
| 642 | try | 
|---|
| 643 | Application.CreateForm(TfrmVit, frmVit); | 
|---|
| 644 | frmvit.showmodal; | 
|---|
| 645 | //refresh vital info | 
|---|
| 646 | lstDatesClick(self); | 
|---|
| 647 | finally | 
|---|
| 648 | frmvit.release; | 
|---|
| 649 | end; | 
|---|
| 650 | end; | 
|---|
| 651 |  | 
|---|
| 652 | procedure TfrmVitals.chtChartUndoZoom(Sender: TObject); | 
|---|
| 653 | begin | 
|---|
| 654 | chtChart.BottomAxis.Automatic := true; | 
|---|
| 655 | end; | 
|---|
| 656 |  | 
|---|
| 657 | procedure TfrmVitals.popValuesClick(Sender: TObject); | 
|---|
| 658 | begin | 
|---|
| 659 | chkValues.Checked := not chkValues.Checked; | 
|---|
| 660 | chkValuesClick(self); | 
|---|
| 661 | end; | 
|---|
| 662 |  | 
|---|
| 663 | procedure TfrmVitals.pop3DClick(Sender: TObject); | 
|---|
| 664 | begin | 
|---|
| 665 | chk3D.Checked := not chk3D.Checked; | 
|---|
| 666 | chk3DClick(self); | 
|---|
| 667 | end; | 
|---|
| 668 |  | 
|---|
| 669 | procedure TfrmVitals.popZoomClick(Sender: TObject); | 
|---|
| 670 | begin | 
|---|
| 671 | chkZoom.Checked := not chkZoom.Checked; | 
|---|
| 672 | chkZoomClick(self); | 
|---|
| 673 | end; | 
|---|
| 674 |  | 
|---|
| 675 | procedure TfrmVitals.popZoomBackClick(Sender: TObject); | 
|---|
| 676 | begin | 
|---|
| 677 | chtChart.UndoZoom; | 
|---|
| 678 | end; | 
|---|
| 679 |  | 
|---|
| 680 | procedure TfrmVitals.popCopyClick(Sender: TObject); | 
|---|
| 681 | begin | 
|---|
| 682 | chtChart.CopyToClipboardBitmap; | 
|---|
| 683 | end; | 
|---|
| 684 |  | 
|---|
| 685 | procedure TfrmVitals.popDetailsClick(Sender: TObject); | 
|---|
| 686 | var | 
|---|
| 687 | tmpList: TStringList; | 
|---|
| 688 | date1, date2: TFMDateTime; | 
|---|
| 689 | strdate1, strdate2: string; | 
|---|
| 690 | begin | 
|---|
| 691 | inherited; | 
|---|
| 692 | Screen.Cursor := crHourGlass; | 
|---|
| 693 | if chtChart.Tag > 0 then | 
|---|
| 694 | begin | 
|---|
| 695 | strdate1 := FormatDateTime('mm/dd/yyyy', uDate1); | 
|---|
| 696 | strdate2 := FormatDateTime('mm/dd/yyyy', uDate2); | 
|---|
| 697 | uDate1 := StrToDateTime(strdate1); | 
|---|
| 698 | uDate2 := StrToDateTime(strdate2); | 
|---|
| 699 | date1 := DateTimeToFMDateTime(uDate1 + 1); | 
|---|
| 700 | date2 := DateTimeToFMDateTime(uDate2); | 
|---|
| 701 | //  StatusText('Retrieving data for ' + FormatDateTime('dddd, mmmm d, yyyy', uDate2) + '...');  <-- original line.  //kt 8/17/2007 | 
|---|
| 702 | StatusText(DKLangConstW('fVitals_Retrieving_data_for')+' ' + FormatDateTime('dddd, mmmm d, yyyy', uDate2) + '...'); //kt added 8/17/2007 | 
|---|
| 703 | //  ReportBox(VitalsMemo(Patient.DFN, date1, date2, lstVitals.Items), 'Vitals on ' + Patient.Name + ' for ' + FormatDateTime('dddd, mmmm d, yyyy', uDate2), True);  <-- original line.  //kt 8/17/2007 | 
|---|
| 704 | ReportBox(VitalsMemo(Patient.DFN, date1, date2, lstVitals.Items), DKLangConstW('fVitals_Vitals_on')+' ' + Patient.Name + DKLangConstW('fVitals_for')+' ' + FormatDateTime('dddd, mmmm d, yyyy', uDate2), True); //kt added 8/17/2007 | 
|---|
| 705 | end | 
|---|
| 706 | else | 
|---|
| 707 | begin | 
|---|
| 708 | date1 := DateTimeToFMDateTime(chtChart.BottomAxis.Maximum); | 
|---|
| 709 | date2 := DateTimeToFMDateTime(chtChart.BottomAxis.Minimum); | 
|---|
| 710 | tmpList := TStringList.Create; | 
|---|
| 711 | try | 
|---|
| 712 | tmpList.Add(lstVitals.Items[lstVitals.ItemIndex]); | 
|---|
| 713 | //    if serTest.Title = 'Systolic' then  <-- original line.  //kt 8/17/2007 | 
|---|
| 714 | if serTest.Title = DKLangConstW('fVitals_Systolic') then //kt added 8/17/2007 | 
|---|
| 715 | //      StatusText('Retrieving data for Blood Pressure...')  <-- original line.  //kt 8/17/2007 | 
|---|
| 716 | StatusText(DKLangConstW('fVitals_Retrieving_data_for_Blood_Pressurexxx')) //kt added 8/17/2007 | 
|---|
| 717 | else | 
|---|
| 718 | //      StatusText('Retrieving data for ' + serTest.Title + '...');  <-- original line.  //kt 8/17/2007 | 
|---|
| 719 | StatusText(DKLangConstW('fVitals_Retrieving_data_for') + serTest.Title + '...'); //kt added 8/17/2007 | 
|---|
| 720 | //    ReportBox(VitalsMemo(Patient.DFN, date1, date2, tmpList), serTest.Title + ' results on ' + Patient.Name, True);  <-- original line.  //kt 8/17/2007 | 
|---|
| 721 | ReportBox(VitalsMemo(Patient.DFN, date1, date2, tmpList), serTest.Title + DKLangConstW('fVitals_results_on') + Patient.Name, True); //kt added 8/17/2007 | 
|---|
| 722 | finally | 
|---|
| 723 | tmpList.Free; | 
|---|
| 724 | end; | 
|---|
| 725 | end; | 
|---|
| 726 | Screen.Cursor := crDefault; | 
|---|
| 727 | StatusText(''); | 
|---|
| 728 | end; | 
|---|
| 729 |  | 
|---|
| 730 | procedure TfrmVitals.chtChartClickSeries(Sender: TCustomChart; | 
|---|
| 731 | Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton; | 
|---|
| 732 | Shift: TShiftState; X, Y: Integer); | 
|---|
| 733 | begin | 
|---|
| 734 | uDate1 := Series.XValue[ValueIndex]; | 
|---|
| 735 | uDate2 := uDate1; | 
|---|
| 736 | //  chtChart.Hint := 'Details - Vitals for ' + FormatDateTime('dddd, mmmm d, yyyy', Series.XValue[ValueIndex]) + '...';  <-- original line.  //kt 8/17/2007 | 
|---|
| 737 | chtChart.Hint := DKLangConstW('fVitals_Details_x_Vitals_for')+' ' + FormatDateTime('dddd, mmmm d, yyyy', Series.XValue[ValueIndex]) + '...'; //kt added 8/17/2007 | 
|---|
| 738 | chtChart.Tag := ValueIndex + 1; | 
|---|
| 739 | if Button <> mbRight then  popDetailsClick(self); | 
|---|
| 740 | end; | 
|---|
| 741 |  | 
|---|
| 742 | procedure TfrmVitals.chtChartMouseDown(Sender: TObject; | 
|---|
| 743 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
|---|
| 744 | begin | 
|---|
| 745 | chtChart.Hint := ''; | 
|---|
| 746 | chtChart.Tag := 0; | 
|---|
| 747 | end; | 
|---|
| 748 |  | 
|---|
| 749 | procedure TfrmVitals.chtChartClickLegend(Sender: TCustomChart; | 
|---|
| 750 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
|---|
| 751 | begin | 
|---|
| 752 | //if serTest.Title = 'Systolic' then  <-- original line.  //kt 8/17/2007 | 
|---|
| 753 | if serTest.Title = DKLangConstW('fVitals_Systolic') then //kt added 8/17/2007 | 
|---|
| 754 | //  chtChart.Hint := 'Details - for Blood Pressure...'  <-- original line.  //kt 8/17/2007 | 
|---|
| 755 | chtChart.Hint := DKLangConstW('fVitals_Details_x_for_Blood_Pressurexxx') //kt added 8/17/2007 | 
|---|
| 756 | else | 
|---|
| 757 | //  chtChart.Hint := 'Details - for ' + serTest.Title + '...';  <-- original line.  //kt 8/17/2007 | 
|---|
| 758 | chtChart.Hint := DKLangConstW('fVitals_Details_x_for') + serTest.Title + '...'; //kt added 8/17/2007 | 
|---|
| 759 | chtChart.Tag := 0; | 
|---|
| 760 | if Button <> mbRight then  popDetailsClick(self); | 
|---|
| 761 | end; | 
|---|
| 762 |  | 
|---|
| 763 | procedure TfrmVitals.popChartPopup(Sender: TObject); | 
|---|
| 764 | begin | 
|---|
| 765 | popValues.Checked := chkValues.Checked; | 
|---|
| 766 | pop3D.Checked := chk3D.Checked; | 
|---|
| 767 | popZoom.Checked := chkZoom.Checked; | 
|---|
| 768 | popZoomBack.Enabled := popZoom.Checked and not chtChart.BottomAxis.Automatic;; | 
|---|
| 769 | if chtChart.Hint <> '' then | 
|---|
| 770 | begin | 
|---|
| 771 | popDetails.Caption := chtChart.Hint; | 
|---|
| 772 | popDetails.Enabled := true; | 
|---|
| 773 | end | 
|---|
| 774 | else | 
|---|
| 775 | begin | 
|---|
| 776 | //  popDetails.Caption := 'Details...';  <-- original line.  //kt 8/17/2007 | 
|---|
| 777 | popDetails.Caption := DKLangConstW('fVitals_Detailsxxx'); //kt added 8/17/2007 | 
|---|
| 778 | popDetails.Enabled := false; | 
|---|
| 779 | end; | 
|---|
| 780 | end; | 
|---|
| 781 |  | 
|---|
| 782 | procedure TfrmVitals.popPrintClick(Sender: TObject); | 
|---|
| 783 | var | 
|---|
| 784 | GraphTitle: string; | 
|---|
| 785 | begin | 
|---|
| 786 | GraphTitle := lstVitals.Items[lstVitals.ItemIndex] + | 
|---|
| 787 | ' - ' + | 
|---|
| 788 | lstDates.DisplayText[lstDates.ItemIndex]; | 
|---|
| 789 | if dlgWinPrint.Execute then PrintGraph(chtChart, GraphTitle); | 
|---|
| 790 | end; | 
|---|
| 791 |  | 
|---|
| 792 | procedure TfrmVitals.BeginEndDates(var ADate1, ADate2: TFMDateTime; var ADaysBack: integer); | 
|---|
| 793 | var | 
|---|
| 794 | datetemp: TFMDateTime; | 
|---|
| 795 | today, datetime1, datetime2: TDateTime; | 
|---|
| 796 | relativedate: string; | 
|---|
| 797 | begin | 
|---|
| 798 | today := FMToDateTime(floattostr(FMToday)); | 
|---|
| 799 | relativedate := Piece(lstDates.ItemID, ';', 1); | 
|---|
| 800 | relativedate := Piece(relativedate, '-', 2); | 
|---|
| 801 | ADaysBack := strtointdef(relativedate, 0); | 
|---|
| 802 | ADate1 := DateTimeToFMDateTime(today - ADaysBack); | 
|---|
| 803 | relativedate := Piece(lstDates.ItemID, ';', 2); | 
|---|
| 804 | if StrToIntDef(Piece(relativedate, '+', 2), 0) > 0 then | 
|---|
| 805 | begin | 
|---|
| 806 | relativedate := Piece(relativedate, '+', 2); | 
|---|
| 807 | ADaysBack := strtointdef(relativedate, 0); | 
|---|
| 808 | ADate2 := DateTimeToFMDateTime(today + ADaysBack + 1); | 
|---|
| 809 | end | 
|---|
| 810 | else | 
|---|
| 811 | begin | 
|---|
| 812 | relativedate := Piece(relativedate, '-', 2); | 
|---|
| 813 | ADaysBack := strtointdef(relativedate, 0); | 
|---|
| 814 | ADate2 := DateTimeToFMDateTime(today - ADaysBack); | 
|---|
| 815 | end; | 
|---|
| 816 | datetime1 := FMDateTimeToDateTime(ADate1); | 
|---|
| 817 | datetime2 := FMDateTimeToDateTime(ADate2); | 
|---|
| 818 | if datetime1 < datetime2 then                 // reorder dates, if needed | 
|---|
| 819 | begin | 
|---|
| 820 | datetemp := ADate1; | 
|---|
| 821 | ADate1 := ADate2; | 
|---|
| 822 | ADate2 := datetemp | 
|---|
| 823 | end; | 
|---|
| 824 | ADate1 := ADate1 + 0.2359; | 
|---|
| 825 | end; | 
|---|
| 826 |  | 
|---|
| 827 | procedure TfrmVitals.FormKeyUp(Sender: TObject; var Key: Word; | 
|---|
| 828 | Shift: TShiftState); | 
|---|
| 829 | begin | 
|---|
| 830 | if Key = VK_ESCAPE then | 
|---|
| 831 | begin | 
|---|
| 832 | Key := 0; | 
|---|
| 833 | Close; | 
|---|
| 834 | end; | 
|---|
| 835 | end; | 
|---|
| 836 |  | 
|---|
| 837 | end. | 
|---|