Changeset 830 for cprs/trunk/CPRS-Chart/fLabs.pas
- Timestamp:
- Jul 7, 2010, 4:51:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/fLabs.pas
r456 r830 7 7 fHSplit, StdCtrls, ExtCtrls, ORCtrls, ComCtrls, Grids, Buttons, fLabTest, 8 8 fLabTests, fLabTestGroups, ORFn, TeeProcs, TeEngine, Chart, Series, Menus, 9 uConst, ORDtTmRng, OleCtrls, SHDocVw, Variants, StrUtils; 9 uConst, ORDtTmRng, OleCtrls, SHDocVw, Variants, StrUtils, fBase508Form, 10 VA508AccessibilityManager; 10 11 11 12 type 13 TGrdLab508Manager = class(TVA508ComponentManager) 14 private 15 function GetTextToSpeak(sg: TCaptionStringGrid): String; 16 function ToBlankIfEmpty(aString : String) : String; 17 public 18 constructor Create; override; 19 function GetValue(Component: TWinControl): string; override; 20 function GetItem(Component: TWinControl): TObject; override; 21 end; 22 12 23 TfrmLabs = class(TfrmHSplit) 13 lblHeading: TOROffsetLabel;14 lstReports: TORListBox;15 lstHeaders: TORListBox;16 lstDates: TORListBox;17 pnlHeader: TORAutoPanel;18 pnlFooter: TORAutoPanel;19 grdLab: TCaptionStringGrid;20 pnlChart: TPanel;21 memLab: TRichEdit;22 lblSpecimen: TLabel;23 lblSingleTest: TLabel;24 lstTests: TORListBox;25 lblFooter: TOROffsetLabel;26 lblReports: TOROffsetLabel;27 lblDates: TOROffsetLabel;28 lblHeaders: TOROffsetLabel;29 bvlHeader: TBevel;30 pnlButtons: TORAutoPanel;31 cmdNext: TButton;32 cmdPrev: TButton;33 cmdRecent: TButton;34 cmdOld: TButton;35 lblDateFloat: TLabel;36 lblOld: TOROffsetLabel;37 lblPrev: TOROffsetLabel;38 lblNext: TOROffsetLabel;39 lblRecent: TOROffsetLabel;40 pnlOtherTests: TORAutoPanel;41 cmdOtherTests: TButton;42 chtChart: TChart;43 serHigh: TLineSeries;44 serLow: TLineSeries;45 serTest: TLineSeries;46 bvlOtherTests: TBevel;47 lblMostRecent: TLabel;48 lblDate: TLabel;49 lblCollection: TLabel;50 pnlWorksheet: TORAutoPanel;51 chkValues: TCheckBox;52 chk3D: TCheckBox;53 ragHorV: TRadioGroup;54 chkAbnormals: TCheckBox;55 ragCorG: TRadioGroup;56 lstTestGraph: TORListBox;57 pnlGraph: TORAutoPanel;58 chkGraph3D: TCheckBox;59 chkGraphValues: TCheckBox;60 lblGraphInfo: TLabel;61 chkGraphZoom: TCheckBox;62 24 PopupMenu1: TPopupMenu; 63 25 GotoTop1: TMenuItem; … … 65 27 FreezeText1: TMenuItem; 66 28 UnfreezeText1: TMenuItem; 67 Memo1: TMemo;68 chkZoom: TCheckBox;69 29 popChart: TPopupMenu; 70 30 popValues: TMenuItem; … … 81 41 popPrint: TMenuItem; 82 42 Timer1: TTimer; 43 pnlRightBottom: TPanel; 44 Memo1: TMemo; 45 memLab: TRichEdit; 46 pnlRightTop: TPanel; 47 bvlHeader: TBevel; 48 pnlHeader: TORAutoPanel; 49 lblDateFloat: TLabel; 50 pnlWorksheet: TORAutoPanel; 51 chkValues: TCheckBox; 52 chk3D: TCheckBox; 53 ragHorV: TRadioGroup; 54 chkAbnormals: TCheckBox; 55 ragCorG: TRadioGroup; 56 chkZoom: TCheckBox; 57 pnlGraph: TORAutoPanel; 58 lblGraphInfo: TLabel; 59 chkGraph3D: TCheckBox; 60 chkGraphValues: TCheckBox; 61 chkGraphZoom: TCheckBox; 62 pnlButtons: TORAutoPanel; 63 lblOld: TOROffsetLabel; 64 lblPrev: TOROffsetLabel; 65 lblNext: TOROffsetLabel; 66 lblRecent: TOROffsetLabel; 67 lblMostRecent: TLabel; 68 lblCollection: TLabel; 69 lblDate: TVA508StaticText; 70 cmdNext: TButton; 71 cmdPrev: TButton; 72 cmdRecent: TButton; 73 cmdOld: TButton; 83 74 TabControl1: TTabControl; 84 WebBrowser1: TWebBrowser; 75 grdLab: TCaptionStringGrid; 76 pnlChart: TPanel; 85 77 lblGraph: TLabel; 78 lstTestGraph: TORListBox; 79 chtChart: TChart; 80 serHigh: TLineSeries; 81 serLow: TLineSeries; 82 serTest: TLineSeries; 83 pnlRightTopHeader: TPanel; 84 lblHeading: TOROffsetLabel; 85 lblTitle: TOROffsetLabel; 86 PopupMenu2: TPopupMenu; 87 Print1: TMenuItem; 88 Copy1: TMenuItem; 89 SelectAll1: TMenuItem; 90 PopupMenu3: TPopupMenu; 91 Print2: TMenuItem; 92 Copy2: TMenuItem; 93 SelectAll2: TMenuItem; 94 MenuItem1: TMenuItem; 95 MenuItem2: TMenuItem; 96 MenuItem3: TMenuItem; 97 MenuItem4: TMenuItem; 98 sptHorzRight: TSplitter; 99 pnlFooter: TORAutoPanel; 100 lblSpecimen: TLabel; 101 lblSingleTest: TLabel; 102 lblFooter: TOROffsetLabel; 103 lstTests: TORListBox; 104 lvReports: TCaptionListView; 105 pnlLefTop: TPanel; 106 lblReports: TOROffsetLabel; 107 tvReports: TORTreeView; 108 pnlLeftBottom: TPanel; 109 lstQualifier: TORListBox; 110 lblQualifier: TOROffsetLabel; 111 lblHeaders: TOROffsetLabel; 112 lstHeaders: TORListBox; 113 lblDates: TOROffsetLabel; 114 lstDates: TORListBox; 115 Splitter1: TSplitter; 116 pnlOtherTests: TORAutoPanel; 117 bvlOtherTests: TBevel; 118 cmdOtherTests: TButton; 119 chkMaxFreq: TCheckBox; 86 120 procedure FormCreate(Sender: TObject); 87 procedure DisplayHeading ;88 procedure lstReportsClick(Sender: TObject);121 procedure DisplayHeading(aRanges: string); 122 //procedure lstReportsClick(Sender: TObject); 89 123 procedure lstHeadersClick(Sender: TObject); 90 124 procedure lstDatesClick(Sender: TObject); … … 135 169 Shift: TShiftState); 136 170 procedure UpdateRemoteStatus(aSiteID, aStatus: string); 171 procedure lblDateEnter(Sender: TObject); 172 procedure LoadTreeView; 173 procedure LoadListView(aReportData: TStringList); 174 procedure tvReportsClick(Sender: TObject); 175 procedure lstQualifierClick(Sender: TObject); 176 procedure tvReportsKeyDown(Sender: TObject; var Key: Word; 177 Shift: TShiftState); 178 procedure tvReportsCollapsing(Sender: TObject; Node: TTreeNode; 179 var AllowCollapse: Boolean); 180 procedure tvReportsExpanding(Sender: TObject; Node: TTreeNode; 181 var AllowExpansion: Boolean); 182 procedure lvReportsKeyUp(Sender: TObject; var Key: Word; 183 Shift: TShiftState); 184 procedure SelectAll1Click(Sender: TObject); 185 procedure Print1Click(Sender: TObject); 186 procedure Copy1Click(Sender: TObject); 187 procedure Copy2Click(Sender: TObject); 188 procedure Print2Click(Sender: TObject); 189 procedure lvReportsCompare(Sender: TObject; Item1, Item2: TListItem; 190 Data: Integer; var Compare: Integer); 191 procedure lvReportsColumnClick(Sender: TObject; Column: TListColumn); 192 procedure lvReportsSelectItem(Sender: TObject; Item: TListItem; 193 Selected: Boolean); 194 procedure sptHorzRightCanResize(Sender: TObject; var NewSize: Integer; 195 var Accept: Boolean); 196 procedure Splitter1CanResize(Sender: TObject; var NewSize: Integer; 197 var Accept: Boolean); 198 procedure SelectAll2Click(Sender: TObject); 199 procedure chkMaxFreqClick(Sender: TObject); 200 procedure sptHorzRightMoved(Sender: TObject); 137 201 private 138 202 { Private declarations } 203 SortIdx1, SortIdx2, SortIdx3: Integer; 204 grdLab508Manager : TGrdLab508Manager; 139 205 procedure AlignList; 140 206 procedure HGrid(griddata: TStrings); … … 150 216 procedure ProcessNotifications; 151 217 procedure PrintLabGraph; 152 procedure GoRemote(Dest: TStringList; AItem, AReportID: Int64; AQualifier, 153 ARpc, AHSType, ADaysBack, ASection: string; ADate1, ADate2: TFMDateTime); 218 procedure GoRemoteOld(Dest: TStringList; AItem, AReportID: Int64; AQualifier, ARpc, AHSType, ADaysBack, ASection: string; ADate1, ADate2: TFMDateTime); 219 procedure GoRemote(Dest: TStringList; AItem: string; AQualifier, ARpc: string; AHSTag: string; AHDR: string; aFHIE: string); 220 procedure ShowTabControl; 154 221 procedure ChkBrowser; 155 procedure CommonComponentVisible(A1,A2,A3,A4,A5,A6,A7,A8,A9 : Boolean);222 procedure CommonComponentVisible(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12: Boolean); 156 223 public 157 224 procedure ClearPtData; override; … … 161 228 function FMToDateTime(FMDateTime: string): TDateTime; 162 229 procedure RequestPrint; override; 163 procedure ExtlstReportsClick(Sender: TObject; Ext: boolean);230 //procedure ExtlstReportsClick(Sender: TObject; Ext: boolean); 164 231 165 232 end; … … 167 234 var 168 235 frmLabs: TfrmLabs; 169 uPrevReportIndex, uFormat: integer; 236 uFormat: integer; 237 uPrevReportNode: TTreeNode; 170 238 uDate1, uDate2: Tdatetime; 171 239 tmpGrid: TStringList; 172 240 uLabLocalReportData: TStringList; //Storage for Local report data 173 241 uLabRemoteReportData: TStringList; //Storage for Remote lab query 174 uUpdateStat: boolean; //flag turned on when remote status is being updated 242 uUpdateStat: boolean; //flag turned on when remote status is being updated 243 uScreenSplitMoved: boolean; //set if user moves the sptHorzRight Bar 244 uScreenSplitLoc: Integer; //location of user changed split - sptHorzRight Bar 245 uTreeStrings: TStrings; 246 uReportInstruction: String; //User Instructions 247 uColChange: string; //determines when column widths have changed 248 uQualifier: string; 249 uReportType: string; 250 uSortOrder: string; 251 uMaxOcc: string; 252 UpdatingLvReports: Boolean; //Currently updating lvReports 253 uColumns: TStringList; 254 uNewColumn: TListColumn; 255 uLocalReportData: TStringList; //Storage for Local report data 256 uRemoteReportData: TStringList; //Storage for status of Remote data 257 uQualifierType: Integer; 258 uHState: string; 259 uFirstSort: Integer; 260 uSecondSort: Integer; 261 uThirdSort: Integer; 262 ulvSelectOn: boolean; //flag turned on when multiple items in lvReports control have been selected 175 263 176 264 implementation 177 265 178 uses uCore, rLabs, rCore, rCover, rOrders, fLabPrint, fFrame, fRptBox, Printers, 179 clipbrd, rReports, rGraphs, activex, mshtml, uAccessibleStringGrid; 266 uses uCore, rLabs, rCore, rCover, rOrders, fLabPrint, fFrame, fRptBox, Printers, fReportsPrint, 267 clipbrd, rReports, rGraphs, activex, mshtml, VA508AccessibilityRouter, uReports, 268 VAUtils 269 { TODO -oRV -cWVEHR Long Age : Changed to use long age } 270 , rWVEHR; 271 180 272 181 273 const 274 QT_OTHER = 0; 275 QT_MOSTRECENT = 1; 276 QT_DATERANGE = 2; 277 QT_IMAGING = 3; 278 QT_NUTR = 4; 279 QT_PROCEDURES = 19; 280 QT_SURGERY = 28; 281 QT_HSCOMPONENT = 5; 282 QT_HSWPCOMPONENT = 6; 182 283 CT_LABS = 9; // ID for Labs tab used by frmFrame 183 284 TX_NOREPORT = 'No report is currently selected.'; … … 196 297 uRemoteCount: Integer; 197 298 uHTMLDoc: string; 198 uReportType: string;199 299 uReportRPC: string; 200 300 uHTMLPatient: ANSIstring; 301 uEmptyImageList: TImageList; 302 uRptID: String; 303 uDirect: String; 304 ColumnToSort: Integer; 305 ColumnSortForward: Boolean; 201 306 202 307 procedure TfrmLabs.RequestPrint; 203 begin 204 with lstReports do 205 begin 206 if ItemIEN = 0 then InfoBox(TX_NOREPORT, TX_NOREPORT_CAP, MB_OK); 207 case ItemIen of 208 1: begin 209 InfoBox('Unable to print ''Most Recent'' report.', 'No Print Available', MB_OK); 210 end; 211 2: begin 212 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 213 end; 214 3: begin 215 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 216 end; 217 4: begin 218 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 219 end; 220 5: begin 221 InfoBox('Unable to print ''Worksheet'' report.', 'No Print Available', MB_OK); 222 end; 223 6: begin 224 if chtChart.Visible then PrintLabGraph; 225 end; 226 8: begin 227 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 228 end; 229 9: begin 230 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 231 end; 232 10: begin 233 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 234 end; 235 20: begin 236 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 237 end; 238 21: begin 239 PrintLabs(ItemIEN, DisplayText[ItemIndex], lstDates.ItemIEN); 240 end; 241 end; 242 end; 308 var 309 aID : integer; 310 begin 311 aID := 0; 312 if CharAt(uRPTID,2) =':' then 313 aID := strToInt(piece(uRPTID,':',1)); 314 if (aID = 0) and (CharAt(uRPTID,3) =':') then 315 aID := StrToInt(piece(uRptID,':',1)); 316 if uReportType = 'M' then 317 begin 318 InfoBox(TX_NOREPORT, TX_NOREPORT_CAP, MB_OK); 319 Exit; 320 end; 321 if (uReportType = 'V') and (length(piece(uHState,';',2)) > 0) then 322 begin 323 if lvReports.Items.Count < 1 then 324 begin 325 InfoBox('There are no items to be printed.', 'No Items to Print', MB_OK); 326 Exit; 327 end; 328 if lvReports.SelCount < 1 then 329 begin 330 InfoBox('Please select one or more items from the list to be printed.', 'No Items Selected', MB_OK); 331 Exit; 332 end; 333 end; 334 {if (uReportType = 'G') and GraphFormActive then 335 with GraphForm do 336 begin 337 if (lvwItemsTop.SelCount < 1) and (lvwItemsBottom.SelCount < 1) then 338 begin 339 InfoBox('There are no items graphed.', 'No Items to Print', MB_OK); 340 Exit; 341 end 342 else 343 begin 344 mnuPopGraphPrintClick(mnuPopGraphPrint); 345 Exit; 346 end; 347 end; } 348 if uQualifierType = QT_DATERANGE then 349 begin // = 2 350 if lstQualifier.ItemIndex < 0 then 351 begin 352 InfoBox('Please select from one of the Date Range items before printing', 'Incomplete Information', MB_OK); 353 end 354 else 355 PrintReports(uRptID, piece(uRemoteType,'^',4)); 356 end 357 else 358 if uQualifierType = 0 then 359 begin 360 if aID = 0 then InfoBox(TX_NOREPORT, TX_NOREPORT_CAP, MB_OK); 361 case aID of 362 1: begin 363 InfoBox('Unable to print ''Most Recent'' report.', 'No Print Available', MB_OK); 364 end; 365 2: begin 366 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 367 end; 368 3: begin 369 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 370 end; 371 4: begin 372 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 373 end; 374 5: begin 375 InfoBox('Unable to print ''Worksheet'' report.', 'No Print Available', MB_OK); 376 end; 377 6: begin 378 if chtChart.Visible then PrintLabGraph; 379 end; 380 8: begin 381 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 382 end; 383 9: begin 384 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 385 end; 386 10: begin 387 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 388 end; 389 20: begin 390 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 391 end; 392 21: begin 393 PrintLabs(IntToStr(aID), piece(uRemoteType,'^',4), lstDates.ItemIEN); 394 end; 395 end; 396 end 397 else 398 PrintLabs(uRptID, piece(uRemoteType,'^',4), lstDates.ItemIEN); 243 399 end; 244 400 … … 250 406 inherited; 251 407 PageID := CT_LABS; 252 grdLab.Color := ReadOnlyColor;253 memLab.Color := ReadOnlyColor;254 408 uFrozen := False; 409 uScreenSplitMoved := False; 255 410 aList := TStringList.Create; 256 411 FastAssign(rpcGetGraphSettings, aList); … … 261 416 uLabLocalReportData := TStringList.Create; 262 417 uLabRemoteReportData := TStringList.Create; 263 uPrevReportIndex := 0; 264 lstReports.ItemIndex := uPrevReportIndex; 418 uColumns := TStringList.Create; 419 uTreeStrings := TStringList.Create; 420 uEmptyImageList := TImageList.Create(Self); 421 uEmptyImageList.Width := 0; 422 uLocalReportData := TStringList.Create; 423 uRemoteReportData := TStringList.Create; 424 uPrevReportNode := tvReports.Items.GetFirstNode; 425 tvReports.Selected := uPrevReportNode; 265 426 if Patient.Inpatient then lstDates.ItemIndex := 2 else lstDates.ItemIndex := 5; 266 427 lblSingleTest.Caption := ''; … … 268 429 SerTest.GetHorizAxis.ExactDateTime := true; 269 430 SerTest.GetHorizAxis.Increment := DateTimeStep[dtOneMinute]; 270 TAccessibleStringGrid.WrapControl(grdLab); 431 grdLab508Manager := TGrdLab508Manager.Create; 432 amgrMain.ComponentManager[grdLab] := grdLab508Manager; 433 memo1.Visible := false; 271 434 end; 272 435 … … 329 492 TabControl1.Visible := false; 330 493 tmpGrid.Clear; 494 lvReports.SmallImages := uEmptyImageList; 495 uLocalReportData.Clear; 496 uRemoteReportData.Clear; 331 497 with grdLab do 332 498 begin … … 338 504 339 505 procedure TfrmLabs.DisplayPage; 506 var 507 i: integer; 340 508 begin 341 509 inherited DisplayPage; … … 349 517 + '<TD nowrap><B>Patient: ' + Patient.Name + '</B></TD>' 350 518 + '<TD nowrap><B>' + Patient.SSN + '</B></TD>' 351 + '<TD nowrap><B>Age: ' + IntToStr(Patient.Age) + '</B></TD>' 519 { TODO -oRV -cWVEHR Long Age : Changed to use long age } 520 //+ '<TD nowrap><B>Age: ' + IntToStr(Patient.Age) + '</B></TD>' 521 + '<TD nowrap><B>Age: ' + GetPatientBriefAge(Patient.DFN) + '</B></TD>' 522 {} 352 523 + '</TR></TABLE></DIV><HR>'; 353 524 //the preferred method would be to use headers and footers … … 355 526 if InitPage then 356 527 begin 357 ListLabReports(lstReports.Items); 528 Splitter1.Visible := false; 529 pnlLeftBottom.Visible := false; 530 uColChange := ''; 531 uMaxOcc := ''; 532 LoadTreeView; 358 533 end; 359 534 if InitPatient and not (CallingContext = CC_NOTIFICATION) then 360 535 begin 536 uColChange := ''; 361 537 if Patient.Inpatient then lstDates.ItemIndex := 2 else lstDates.ItemIndex := 5; 362 lstReports.ItemIndex := 0;363 lstReportsClick(self);538 tvReports.Selected := tvReports.Items.GetFirstNode; 539 tvReportsClick(self); 364 540 end; 541 if InitPatient and not (CallingContext = CC_NOTIFICATION) then 542 begin 543 uColChange := ''; 544 lstQualifier.Clear; 545 //tvProcedures.Items.Clear; 546 //lblProcTypeMsg.Visible := FALSE; 547 lvReports.SmallImages := uEmptyImageList; 548 lvReports.Items.Clear; 549 lvReports.Columns.Clear; 550 lblTitle.Caption := ''; 551 lvReports.Caption := ''; 552 Splitter1.Visible := false; 553 pnlLeftBottom.Visible := false; 554 memLab.Parent := pnlRightBottom; 555 memLab.Align := alClient; 556 memLab.Clear; 557 uReportInstruction := ''; 558 uLocalReportData.Clear; 559 for i := 0 to RemoteSites.SiteList.Count - 1 do 560 TRemoteSite(RemoteSites.SiteList.Items[i]).ReportClear; 561 //pnlRightTop.Height := lblTitle.Height + TabControl1.Height; 562 StatusText(''); 563 with tvReports do 564 if Items.Count > 0 then 565 begin 566 tvReports.Selected := tvReports.Items.GetFirstNode; 567 tvReportsClick(self); 568 end; 569 end; 365 570 case CallingContext of 366 571 CC_INIT_PATIENT: if not InitPatient then 367 572 begin 368 573 if Patient.Inpatient then lstDates.ItemIndex := 2 else lstDates.ItemIndex := 5; 369 lstReports.ItemIndex := 0; 370 lstReportsClick(self); 574 tvReports.Selected := tvReports.Items.GetFirstNode; 575 tvReportsClick(self); 576 lvReports.SmallImages := uEmptyImageList; 577 lstQualifier.Clear; 578 //tvProcedures.Items.Clear; 579 //lblProcTypeMsg.Visible := FALSE; 580 lvReports.SmallImages := uEmptyImageList; 581 lvReports.Items.Clear; 582 Splitter1.Visible := false; 583 pnlLeftBottom.Visible := false; 584 with tvReports do 585 if Items.Count > 0 then 586 begin 587 tvReports.Selected := tvReports.Items.GetFirstNode; 588 tvReportsClick(self); 589 end; 371 590 end; 372 591 CC_NOTIFICATION: ProcessNotifications; … … 380 599 end; 381 600 382 procedure TfrmLabs.DisplayHeading; 383 begin 384 with lblHeading do 601 procedure TfrmLabs.LoadListView(aReportData: TStringList); 602 var 603 j,k,aErr: integer; 604 aTmpAray: TStringList; 605 aColCtr, aCurCol, aCurRow, aColID: integer; 606 x,y,z,c,aSite: string; 607 ListItem: TListItem; 608 begin 609 aSite := ''; 610 aErr := 0; 611 ListItem := nil; 612 case uQualifierType of 613 QT_HSCOMPONENT: 614 begin // = 5 615 if (length(piece(uHState,';',2)) > 0) then 616 begin 617 with lvReports do 618 begin 619 ViewStyle := vsReport; 620 for j := 0 to aReportData.Count - 1 do 621 begin 622 if piece(aReportData[j],'^',1) = '-1' then //error condition, most likely remote call 623 continue; 624 ListItem := Items.Add; 625 aSite := piece(aReportData[j],'^',1); 626 ListItem.Caption := piece(aSite,';',1); 627 for k := 2 to uColumns.Count do 628 begin 629 ListItem.SubItems.Add(piece(aReportData[j],'^',k)); 630 end; 631 end; 632 if aReportData.Count = 0 then 633 begin 634 uReportInstruction := '<No Data Available>'; 635 memLab.Lines.Clear; 636 memLab.Lines.Add(uReportInstruction); 637 end 638 else 639 memLab.Lines.Clear; 640 end; 641 end; 642 end; 643 QT_HSWPCOMPONENT: 644 begin // = 6 645 if (length(piece(uHState,';',2)) > 0) then //and (chkText.Checked = false) then 646 begin 647 aTmpAray := TStringList.Create; 648 aCurRow := 0; 649 aCurCol := 0; 650 aColCtr := 9; 651 aTmpAray.Clear; 652 with lvReports do 653 begin 654 for j := 0 to aReportData.Count - 1 do 655 begin 656 x := aReportData[j]; 657 aColID := StrToIntDef(piece(x,'^',1),-1); 658 if aColID < 0 then //this is an error condition most likely an incompatible remote call 659 continue; 660 if aColID > (uColumns.Count - 1) then 661 begin 662 aErr := 1; 663 continue; //extract is out of sync with columns defined in 101.24 664 end; 665 if aColID < aColCtr then 666 begin 667 if aTmpAray.Count > 0 then 668 begin 669 if aColCtr = 1 then 670 begin 671 ListItem := Items.Add; 672 aSite := piece(aTmpAray[j],'^',1); 673 ListItem.Caption := piece(aSite,';',1); 674 ListItem.SubItems.Add(IntToStr(aCurRow) + ':' + IntToStr(aCurCol)); 675 end 676 else 677 begin 678 c := aTmpAray[0]; 679 if piece(uColumns.Strings[aCurCol],'^',4) = '1' then 680 c := c + '...'; 681 z := piece(c,'^',1); 682 y := copy(c, (pos('^', c)), 9999); 683 if pos('^',y) > 0 then 684 begin 685 while pos('^',y) > 0 do 686 begin 687 y := copy(y, (pos('^', y)+1), 9999); 688 z := z + '^' + y; 689 end; 690 ListItem.SubItems.Add(z); 691 end 692 else 693 begin 694 ListItem.SubItems.Add(y); 695 end; 696 end; 697 RowObjects.Add(aSite, IntToStr(aCurRow) + ':' + IntToStr(aCurCol), uColumns.Strings[aCurCol], aTmpAray); 698 aTmpAray.Clear; 699 end; 700 aColCtr := 0; 701 aCurCol := aColID; 702 aCurRow := aCurRow + 1; 703 end 704 else 705 if aColID = aCurCol then 706 begin 707 z := ''; 708 y := piece(x,'^',2); 709 if length(y) > 0 then z := y; 710 y := copy(x, (pos('^', x)+1), 9999); 711 if pos('^',y) > 0 then 712 begin 713 while pos('^',y) > 0 do 714 begin 715 y := copy(y, (pos('^', y)+1), 9999); 716 z := z + '^' + y; 717 end; 718 aTmpAray.Add(z); 719 end 720 else 721 begin 722 aTmpAray.Add(y); 723 end; 724 continue; 725 end; 726 if aTmpAray.Count > 0 then 727 begin 728 if aColCtr = 1 then 729 begin 730 ListItem := Items.Add; 731 aSite := piece(aTmpAray[0],'^',1); 732 ListItem.Caption := piece(aSite,';',1); 733 ListItem.SubItems.Add(IntToStr(aCurRow) + ':' + IntToStr(aCurCol)); 734 end 735 else 736 begin 737 c := aTmpAray[0]; 738 if piece(uColumns.Strings[aCurCol],'^',4) = '1' then 739 c := c + '...'; 740 ListItem.SubItems.Add(c); 741 end; 742 RowObjects.Add(aSite, IntToStr(aCurRow) + ':' + IntToStr(aCurCol), uColumns.Strings[aCurCol], aTmpAray); 743 aTmpAray.Clear; 744 end; 745 aCurCol := aColID; 746 Inc(aColCtr); 747 y := ''; 748 for k := 2 to 10 do 749 if length(piece(x,'^',k)) > 0 then 750 begin 751 if length(y) > 0 then y := y + '^' + piece(x,'^',k) 752 else y := y + piece(x,'^',k); 753 end; 754 aTmpAray.Add(y); 755 if aColCtr > 0 then 756 while aColCtr < aCurCol do 757 begin 758 ListItem.SubItems.Add(''); 759 Inc(aColCtr); 760 end; 761 end; 762 if aTmpAray.Count > 0 then 763 begin 764 if aColCtr = 1 then 765 begin 766 ListItem := Items.Add; 767 aSite := piece(aTmpAray[0],'^',1); 768 ListItem.Caption := piece(aSite,';',1); 769 ListItem.SubItems.Add(IntToStr(aCurRow) + ':' + IntToStr(aCurCol)); 770 end 771 else 772 begin 773 c := aTmpAray[0]; 774 if piece(uColumns.Strings[aCurCol],'^',4) = '1' then 775 c := c + '...'; 776 ListItem.SubItems.Add(c); 777 end; 778 RowObjects.Add(aSite, IntToStr(aCurRow) + ':' + IntToStr(aCurCol), uColumns.Strings[aCurCol], aTmpAray); 779 aTmpAray.Clear; 780 end; 781 end; 782 aTmpAray.Free; 783 end; 784 end; 785 end; 786 if aErr = 1 then 787 if User.HasKey('XUPROGMODE') then 788 ShowMsg('Programmer message: One or more Column ID''s in file 101.24 do not match ID''s coded in extract routine'); 789 end; 790 791 procedure TfrmLabs.DisplayHeading(aRanges: string); 792 var 793 x,x1,x2,y,z,DaysBack: string; 794 d1,d2: TFMDateTime; 795 begin 796 with lblTitle do 385 797 begin 386 Caption := 'Laboratory Results - ' + lstReports.DisplayText[lstReports.ItemIndex]; 387 if lstDates.Visible then 388 Caption := Caption + ' - ' + lstDates.DisplayText[lstDates.ItemIndex]; 798 x := ''; 799 if tvReports.Selected = nil then 800 tvReports.Selected := tvReports.Items.GetFirstNode; 801 if tvReports.Selected.Parent <> nil then 802 x := tvReports.Selected.Parent.Text + ' ' + tvReports.Selected.Text 803 else 804 x := tvReports.Selected.Text; 805 x1 := ''; 806 x2 := ''; 807 if (uReportType <> 'M') and (not(uRptID = '1:MOST RECENT')) then 808 begin 809 if CharAt(aRanges, 1) = 'd' then 810 begin 811 if length(piece(aRanges,';',2)) > 0 then 812 begin 813 x2 := ' Max/site:' + piece(aRanges,';',2); 814 aRanges := piece(aRanges,';',1); 815 end; 816 DaysBack := Copy(aRanges, 2, Length(aRanges)); 817 if DaysBack = '0' then 818 aRanges := 'T' + ';T' 819 else 820 aRanges := 'T-' + DaysBack + ';T'; 821 end; 822 if length(piece(aRanges,';',1)) > 0 then 823 begin 824 d1 := ValidDateTimeStr(piece(aRanges,';',1),''); 825 d2 := ValidDateTimeStr(piece(aRanges,';',2),''); 826 y := FormatFMDateTime('mmm dd,yyyy',d1); 827 if Copy(y,8,2) = '18' then y := 'EARLIEST RESULT'; 828 z := FormatFMDateTime('mmm dd,yyyy',d2); 829 x1 := ' [From: ' + y + ' to ' + z + ']'; 830 end; 831 if length(piece(aRanges,';',3)) > 0 then 832 x2 := ' Max/site:' + piece(aRanges,';',3); 833 case uQualifierType of 834 QT_DATERANGE: 835 x := x + x1; 836 QT_HSCOMPONENT: 837 x := x + x1 + x2; 838 QT_HSWPCOMPONENT: 839 x := x + x1 + x2; 840 QT_IMAGING: 841 x := x + x1 + x2; 842 0: 843 x := x + x1; 844 end; 845 end; 846 if piece(uRemoteType, '^', 9) = '1' then x := x + ' <<ONLY REMOTE DOD DATA INCLUDED IN REPORT>>'; 847 Caption := x; 389 848 end; 849 lvReports.Caption := x; 390 850 end; 391 851 … … 393 853 begin 394 854 lblReports.Top := 0; 395 lstReports.Top := lblReports.Height;396 855 lstDates.Height := pnlLeft.Height div 3 - (lblDates.Height div 2); 397 856 lstDates.Top := pnlLeft.Height - lstDates.Height; 398 857 lblDates.Top := lstDates.Top - lblDates.Height; 858 lstQualifier.Height := pnlLeft.Height div 3 - (lblQualifier.Height div 2); 859 lstQualifier.Top := pnlLeft.Height - lstQualifier.Height; 860 lblQualifier.Top := lstQualifier.Top - lblQualifier.Height; 399 861 pnlOtherTests.Top := lblDates.Top - pnlOtherTests.Height; 400 862 lstHeaders.Height := pnlLeft.Height div 3 - (lblHeaders.Height * 3); 401 863 lstHeaders.Top := lblDates.Top - lstHeaders.Height; 402 864 lblHeaders.Top := lstHeaders.Top - lblHeaders.Height; 403 lstReports.Repaint;404 865 lstDates.Repaint; 405 866 lstHeaders.Repaint; 406 end; 407 408 procedure TfrmLabs.lstReportsClick(Sender: TObject); 867 lstQualifier.Repaint; 868 end; 869 870 procedure TfrmLabs.LoadTreeView; 871 var 872 i: integer; 873 currentNode, parentNode, grandParentNode, gtGrandParentNode: TTreeNode; 874 x: string; 875 addchild, addgrandchild, addgtgrandchild: boolean; 876 begin 877 tvReports.Items.Clear; 878 memLab.Clear; 879 uHTMLDoc := ''; 880 //WebBrowser1.Navigate('about:blank'); **Browser Remove** 881 //tvProcedures.Items.Clear; 882 //lblProcTypeMsg.Visible := FALSE; 883 lvReports.SmallImages := uEmptyImageList; 884 lvReports.Items.Clear; 885 uTreeStrings.Clear; 886 //lblTitle.Caption := ''; 887 lvReports.Caption := ''; 888 ListLabReports(uTreeStrings); 889 addchild := false; 890 addgrandchild := false; 891 addgtgrandchild := false; 892 parentNode := nil; 893 grandParentNode := nil; 894 gtGrandParentNode := nil; 895 currentNode := nil; 896 for i := 0 to uTreeStrings.Count - 1 do 897 begin 898 x := uTreeStrings[i]; 899 if UpperCase(Piece(x,'^',1))='[PARENT END]' then 900 begin 901 if addgtgrandchild = true then 902 begin 903 currentNode := gtgrandParentNode; 904 addgtgrandchild := false; 905 end 906 else 907 if addgrandchild = true then 908 begin 909 currentNode := grandParentNode; 910 addgrandchild := false; 911 end 912 else 913 begin 914 currentNode := parentNode; 915 addchild := false; 916 end; 917 continue; 918 end; 919 if UpperCase(Piece(x,'^',1))='[PARENT START]' then 920 begin 921 if addgtgrandchild = true then 922 currentNode := tvReports.Items.AddChildObject(gtGrandParentNode,Piece(x,'^',3),MakeReportTreeObject(Pieces(x,'^',2,21))) 923 else 924 if addgrandchild = true then 925 begin 926 currentNode := tvReports.Items.AddChildObject(grandParentNode,Piece(x,'^',3),MakeReportTreeObject(Pieces(x,'^',2,21))); 927 addgtgrandchild := true; 928 gtgrandParentNode := currentNode; 929 end 930 else 931 if addchild = true then 932 begin 933 currentNode := tvReports.Items.AddChildObject(parentNode,Piece(x,'^',3),MakeReportTreeObject(Pieces(x,'^',2,21))); 934 addgrandchild := true; 935 grandParentNode := currentNode; 936 end 937 else 938 begin 939 currentNode := tvReports.Items.AddObject(currentNode,Piece(x,'^',3),MakeReportTreeObject(Pieces(x,'^',2,21))); 940 parentNode := currentNode; 941 addchild := true; 942 end; 943 end 944 else 945 if addchild = false then 946 begin 947 currentNode := tvReports.Items.AddObject(currentNode,Piece(x,'^',2),MakeReportTreeObject(x)); 948 parentNode := currentNode; 949 end 950 else 951 begin 952 if addgtgrandchild = true then 953 currentNode := tvReports.Items.AddChildObject(gtGrandParentNode,Piece(x,'^',2),MakeReportTreeObject(x)) 954 else 955 if addgrandchild = true then 956 currentNode := tvReports.Items.AddChildObject(grandParentNode,Piece(x,'^',2),MakeReportTreeObject(x)) 957 else 958 currentNode := tvReports.Items.AddChildObject(parentNode,Piece(x,'^',2),MakeReportTreeObject(x)); 959 end; 960 end; 961 if tvReports.Items.Count > 0 then begin 962 tvReports.Selected := tvReports.Items.GetFirstNode; 963 tvReportsClick(self); 964 end; 965 end; 966 967 {procedure TfrmLabs.lstReportsClick(Sender: TObject); 409 968 begin 410 969 ExtlstReportsClick(Sender, false); 411 end; 412 413 procedure TfrmLabs.ExtlstReportsClick(Sender: TObject; Ext: boolean);970 end; } 971 972 {procedure TfrmLabs.ExtlstReportsClick(Sender: TObject; Ext: boolean); 414 973 var 415 974 i,iCat: integer; … … 440 999 case lstReports.ItemIEN of 441 1000 1: begin // Most Recent 442 CommonComponentVisible(false,false,false,false,false,true,true,false,true );1001 CommonComponentVisible(false,false,false,false,false,true,true,false,true,false,false,false); 443 1002 pnlButtons.Visible := true; 444 1003 pnlWorksheet.Visible := false; … … 448 1007 grdLab.Align := alClient; 449 1008 memLab.Clear; 450 if uReportType = 'H' then451 begin452 WebBrowser1.Navigate('about:blank');453 WebBrowser1.Align := alBottom;454 WebBrowser1.Height := pnlLeft.Height div 5;455 WebBrowser1.Visible := true;456 WebBrowser1.BringToFront;457 memLab.Visible := false;458 end459 else460 begin461 WebBrowser1.Visible := false;462 WebBrowser1.SendToBack;463 memLab.Visible := true;464 memLab.BringToFront;465 end;1009 //if uReportType = 'H' then **Browser Remove** 1010 //begin 1011 //WebBrowser1.Navigate('about:blank'); 1012 //WebBrowser1.Align := alBottom; 1013 //WebBrowser1.Height := pnlLeft.Height div 5; 1014 //WebBrowser1.Visible := true; 1015 //WebBrowser1.BringToFront; 1016 //memLab.Visible := false; 1017 //end 1018 //else 1019 //begin 1020 //WebBrowser1.Visible := false; 1021 //WebBrowser1.SendToBack; 1022 //memLab.Visible := true; 1023 //memLab.BringToFront; 1024 //end; 466 1025 FormResize(self); 467 1026 cmdRecentClick(self); … … 477 1036 if lstTests.Items.Count > 0 then 478 1037 begin 479 CommonComponentVisible(false,false,true,true,true,false,false,false,true );1038 CommonComponentVisible(false,false,true,true,true,false,false,false,true,false,false,false); 480 1039 memLab.Clear; 481 1040 chkBrowser; … … 483 1042 RedrawActivate(memLab.Handle); 484 1043 lstDatesClick(self); 1044 //lstQualifierClick(self); 485 1045 if not Ext then cmdOtherTests.SetFocus; 486 1046 cmdOtherTests.Default := true; … … 497 1057 if lstTests.Items.Count > 0 then 498 1058 begin 499 CommonComponentVisible(false,false,true,true,true,true,true,false,false );1059 CommonComponentVisible(false,false,true,true,true,true,true,false,false,false,false,false); 500 1060 chtChart.Visible := true; 501 1061 memLab.Visible := false; … … 509 1069 //chkZoom.Checked := false; 510 1070 //chkZoomClick(self); 511 lstDatesClick(self); 1071 //lstDatesClick(self); 1072 lstQualifierClick(self); 512 1073 if not Ext then cmdOtherTests.SetFocus; 513 1074 cmdOtherTests.Default := true; … … 523 1084 FormResize(self); 524 1085 memLab.Align := alClient; 525 CommonComponentVisible(false,false,false,false,false,false,false,false,false );1086 CommonComponentVisible(false,false,false,false,false,false,false,false,false,false,false,false); 526 1087 RedrawActivate(memLab.Handle); 527 1088 StatusText(''); … … 542 1103 if (length(lblSingleTest.Caption) > 2) and (length(lblSpecimen.Caption) > 2) then 543 1104 begin 544 CommonComponentVisible(false,false,true,true,true,true,false,false,true );1105 CommonComponentVisible(false,false,true,true,true,true,false,false,true,false,false,false); 545 1106 pnlChart.Visible := true; 546 1107 chtChart.Visible := true; … … 550 1111 memLab.Height := pnlRight.Height div 5; 551 1112 memLab.Clear; 552 if uReportType = 'H' then553 begin554 WebBrowser1.Visible := true;555 WebBrowser1.Navigate('about:blank');556 WebBrowser1.Height := pnlRight.Height div 5;557 WebBrowser1.BringToFront;558 memLab.Visible := false;559 end560 else561 begin562 WebBrowser1.Visible := false;563 WebBrowser1.SendToBack;564 memLab.Visible := true;565 memLab.BringToFront;566 end;1113 //if uReportType = 'H' then **Browser Remove** 1114 //begin 1115 //WebBrowser1.Visible := true; 1116 //WebBrowser1.Navigate('about:blank'); 1117 //WebBrowser1.Height := pnlRight.Height div 5; 1118 //WebBrowser1.BringToFront; 1119 //memLab.Visible := false; 1120 //end 1121 //else 1122 //begin 1123 //WebBrowser1.Visible := false; 1124 //WebBrowser1.SendToBack; 1125 //memLab.Visible := true; 1126 //memLab.BringToFront; 1127 //end; 567 1128 lstTestGraph.Items.Clear; 568 1129 lstTestGraph.Width := 0; … … 574 1135 chkGraph3DClick(self); 575 1136 chkGraphValuesClick(self); 576 lstDatesClick(self); 1137 //lstDatesClick(self); 1138 lstQualifierClick(self); 577 1139 if not Ext then cmdOtherTests.SetFocus; 578 1140 cmdOtherTests.Default := true; … … 590 1152 memLab.Align := alClient; 591 1153 case iCat of 592 {Categories of reports:593 0:Fixed594 1:Fixed w/Dates595 2:Fixed w/Headers596 3:Fixed w/Dates & Headers597 4:Specialized598 5:Graphic}1154 //Categories of reports: 1155 //0:Fixed 1156 //1:Fixed w/Dates 1157 //2:Fixed w/Headers 1158 //3:Fixed w/Dates & Headers 1159 //4:Specialized 1160 //5:Graphic 599 1161 600 1162 0: begin 601 CommonComponentVisible(false,false,false,false,false,false,false,false,false );1163 CommonComponentVisible(false,false,false,false,false,false,false,false,false,false,false,false); 602 1164 StatusText('Retrieving data...'); 603 GoRemote (uLabRemoteReportData,lstReports.ItemIEN,1,'',uReportRPC,'0','9999','1',0,0);1165 GoRemoteOld(uLabRemoteReportData,lstReports.ItemIEN,1,'',uReportRPC,'0','9999','1',0,0); 604 1166 TabControl1.OnChange(nil); 605 1167 Reports(uLabLocalReportData,Patient.DFN, Piece(Rpt,'^',1), '0', '9999', '1', 0, 0, uReportRPC); … … 615 1177 else 616 1178 uHTMLDoc := uHTMLPatient + uLabLocalReportData.Text; 617 if WebBrowser1.Visible = true then WebBrowser1.Navigate('about:blank');1179 //if WebBrowser1.Visible = true then WebBrowser1.Navigate('about:blank'); **Browser Remove** 618 1180 end; 619 1181 1: begin 620 CommonComponentVisible(false,false,false,true,true,false,false,false,false );1182 CommonComponentVisible(false,false,false,true,true,false,false,false,false,false,false,false); 621 1183 memLab.Repaint; 622 lstDatesClick(self); 1184 //lstDatesClick(self); 1185 lstQualifierClick(self); 623 1186 end; 624 1187 2: begin 625 CommonComponentVisible(true,true,false,false,false,false,false,false,false );1188 CommonComponentVisible(true,true,false,false,false,false,false,false,false,false,false,false); 626 1189 lstHeaders.Clear; 627 1190 StatusText('Retrieving data...'); 628 GoRemote (uLabRemoteReportData,lstReports.ItemIEN,1,'',uReportRPC,'0','9999','1',0,0);1191 GoRemoteOld(uLabRemoteReportData,lstReports.ItemIEN,1,'',uReportRPC,'0','9999','1',0,0); 629 1192 TabControl1.OnChange(nil); 630 1193 Reports(uLabLocalReportData,Patient.DFN, Piece(Rpt,'^',1), '0', '9999', '1', 0, 0, uReportRPC); … … 642 1205 else 643 1206 uHTMLDoc := uHTMLPatient + uLabLocalReportData.Text; 644 if WebBrowser1.Visible = true then WebBrowser1.Navigate('about:blank');1207 //if WebBrowser1.Visible = true then WebBrowser1.Navigate('about:blank'); **Browser Remove** 645 1208 end; 646 1209 3: begin 647 CommonComponentVisible(true,true,false,true,true,false,false,false,true); 648 lstDatesClick(self); 1210 CommonComponentVisible(true,true,false,true,true,false,false,false,true,false,false,false); 1211 //lstDatesClick(self); 1212 lstQualifierClick(self); 649 1213 memLab.Lines.Insert(0,' '); 650 1214 memLab.Lines.Delete(0); … … 654 1218 end; 655 1219 uPrevReportIndex := lstReports.ItemIndex; 656 DisplayHeading ;657 end; 1220 DisplayHeading(''); 1221 end; } 658 1222 659 1223 procedure TfrmLabs.lstHeadersClick(Sender: TObject); … … 668 1232 end; 669 1233 670 procedure TfrmLabs.lstDatesClick(Sender: TObject); 671 var 1234 procedure TfrmLabs.lstQualifierClick(Sender: TObject); 1235 var 1236 MoreID: String; //Restores MaxOcc value 1237 aRemote, aHDR, aFHIE: string; 1238 i: integer; 672 1239 tmpList: TStringList; 673 1240 daysback: integer; 674 1241 date1, date2: TFMDateTime; 675 1242 today: TDateTime; 676 i: integer; 677 Rpt: string; 678 begin 679 inherited; 680 uRemoteCount := 0; 681 if uFrozen = True then memo1.visible := False; 682 Screen.Cursor := crHourGlass; 683 DisplayHeading; 684 uHTMLDoc := ''; 685 Rpt := lstReports.Items[lstReports.ItemIndex]; 686 uReportRPC := UpperCase(Piece(Rpt,'^',6)); 687 chkBrowser; 1243 begin 1244 inherited; 1245 if uFrozen = True then 1246 begin 1247 memo1.visible := False; 1248 memo1.TabStop := False; 1249 end; 688 1250 if (lstDates.ItemID = 'S') then 689 1251 begin … … 696 1258 lstDates.ItemIndex := lstDates.Items.Add(RelativeStart + ';' + 697 1259 RelativeStop + U + TextOfStart + ' to ' + TextOfStop); 698 DisplayHeading ;1260 DisplayHeading(''); 699 1261 end 700 1262 else … … 719 1281 BeginEndDates(date1,date2,daysback); 720 1282 date1 := date1 + 0.2359; 1283 MoreID := ';' + Piece(uQualifier,';',3); 1284 if chkMaxFreq.checked = true then 1285 begin 1286 MoreID := ''; 1287 SetPiece(uQualifier,';',3,''); 1288 end; 1289 aRemote := piece(uRemoteType,'^',1); 1290 aHDR := piece(uRemoteType,'^',7); 1291 aFHIE := piece(uRemoteType,'^',8); 1292 SetPiece(uRemoteType,'^',5,lstQualifier.ItemID); 1293 //tvProcedures.Items.Clear; 1294 //lblProcTypeMsg.Visible := FALSE; 721 1295 uHTMLDoc := ''; 722 WebBrowser1.Navigate('about:blank'); 723 case lstReports.ItemIEN of 1296 {if uReportType = 'H' then **Browser Remove** 1297 begin 1298 WebBrowser1.Visible := true; 1299 WebBrowser1.TabStop := true; 1300 WebBrowser1.Navigate('about:blank'); 1301 WebBrowser1.BringToFront; 1302 memLab.Visible := false; 1303 memLab.TabStop := false; 1304 end 1305 else 1306 begin 1307 WebBrowser1.Visible := false; 1308 WebBrowser1.TabStop := false; } 1309 memLab.Visible := true; 1310 memLab.TabStop := true; 1311 memLab.BringToFront; 1312 RedrawActivate(memLab.Handle); 1313 //end; } 1314 uLocalReportData.Clear; 1315 uRemoteReportData.Clear; 1316 for i := 0 to RemoteSites.SiteList.Count - 1 do 1317 TRemoteSite(RemoteSites.SiteList.Items[i]).ReportClear; 1318 uRemoteCount := 0; 1319 if aHDR = '1' then 1320 DisplayHeading(lstQualifier.ItemID) 1321 else 1322 DisplayHeading(lstQualifier.ItemID + MoreID); 1323 if lstQualifier.ItemID = 'ds' then 1324 begin 1325 with calLabRange do 1326 if Not (Execute) then 1327 begin 1328 lstQualifier.ItemIndex := -1; 1329 Exit; 1330 end 1331 else if (Length(TextOfStart) > 0) and (Length(TextOfStop) > 0) then 1332 begin 1333 if (Length(piece(uRemoteType,'^',6)) > 0) and (StrToInt(piece(uRemoteType,'^',6)) > 0) then 1334 if abs(FMDateTimeToDateTime(FMDateStart) - FMDateTimeToDateTime(FMDateStop)) > StrToInt(piece(uRemoteType,'^',6)) then 1335 begin 1336 InfoBox('The Date Range selected is greater than the' + CRLF + 'Maximum Days Allowed of ' + piece(uRemoteType,'^',6) 1337 + ' for this report.', 'No Report Generated',MB_OK); 1338 lstQualifier.ItemIndex := -1; 1339 exit; 1340 end; 1341 lstQualifier.ItemIndex := lstQualifier.Items.Add(RelativeStart + 1342 ';' + RelativeStop + U + TextOfStart + ' to ' + TextOfStop); 1343 DisplayHeading(lstQualifier.ItemID + MoreID); 1344 SetPiece(uRemoteType,'^',5,lstQualifier.ItemID); 1345 end 1346 else 1347 begin 1348 lstQualifier.ItemIndex := -1; 1349 InfoBox('Invalid Date Range entered. Please try again','Invalid Date/time entry',MB_OK); 1350 if (Execute) and (Length(TextOfStart) > 0) and (Length(TextOfStop) > 0) then 1351 begin 1352 lstQualifier.ItemIndex := lstQualifier.Items.Add(RelativeStart + 1353 ';' + RelativeStop + U + TextOfStart + ' to ' + TextOfStop); 1354 DisplayHeading(lstQualifier.ItemID + MoreID); 1355 SetPiece(uRemoteType,'^',5,lstQualifier.ItemID); 1356 end 1357 else 1358 begin 1359 lstQualifier.ItemIndex := -1; 1360 InfoBox('No Report Generated!','Invalid Date/time entry',MB_OK); 1361 exit; 1362 end; 1363 end; 1364 end; 1365 if (CharAt(lstQualifier.ItemID,1) = 'd') and (Length(piece(uRemoteType,'^',6)) > 0) and (StrToInt(piece(uRemoteType,'^',6)) > 0) then 1366 if ExtractInteger(lstQualifier.ItemID) > (StrToInt(piece(uRemoteType,'^',6))) then 1367 begin 1368 InfoBox('The Date Range selected is greater than the' + CRLF + 'Maximum Days Allowed of ' + piece(uRemoteType,'^',6) 1369 + ' for this report.', 'No Report Generated',MB_OK); 1370 lstQualifier.ItemIndex := -1; 1371 exit; 1372 end; 1373 Screen.Cursor := crHourGlass; 1374 uReportInstruction := #13#10 + 'Retrieving data...'; 1375 memLab.Lines.Add(uReportInstruction); 1376 {if WebBrowser1.Visible = true then **Browser Remove** 1377 begin 1378 uHTMLDoc := HTML_PRE + uReportInstruction + HTML_POST; 1379 WebBrowser1.Navigate('about:blank'); 1380 end; } 1381 case uQualifierType of 1382 QT_HSCOMPONENT: 1383 begin // = 5 1384 lvReports.SmallImages := uEmptyImageList; 1385 lvReports.Items.Clear; 1386 memLab.Lines.Clear; 1387 RowObjects.Clear; 1388 if ((aRemote = '1') or (aRemote = '2')) then 1389 GoRemote(uRemoteReportData, 'L:' + uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState, aHDR, aFHIE); 1390 if not(piece(uRemoteType, '^', 9) = '1') then 1391 if (length(piece(uHState,';',2)) > 0) then 1392 begin 1393 if not(aRemote = '2') then 1394 LoadReportText(uLocalReportData, 'L:' + uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState); 1395 LoadListView(uLocalReportData); 1396 end 1397 else 1398 begin 1399 if ((aRemote = '1') or (aRemote = '2')) then 1400 ShowTabControl; 1401 LoadReportText(uLocalReportData, 'L:' + uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState); 1402 if uLocalReportData.Count < 1 then 1403 begin 1404 uReportInstruction := '<No Report Available>'; 1405 memLab.Lines.Add(uReportInstruction); 1406 end 1407 else 1408 begin 1409 QuickCopy(uLocalReportData,memLab); 1410 TabControl1.OnChange(nil); 1411 end; 1412 end; 1413 end; 1414 QT_HSWPCOMPONENT: 1415 begin // = 6 1416 lvReports.SmallImages := uEmptyImageList; 1417 lvReports.Items.Clear; 1418 RowObjects.Clear; 1419 memLab.Lines.Clear; 1420 if ((aRemote = '1') or (aRemote = '2')) then 1421 begin 1422 Screen.Cursor := crDefault; 1423 GoRemote(uRemoteReportData, 'L:' + uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState, aHDR, aFHIE); 1424 end; 1425 if not(piece(uRemoteType, '^', 9) = '1') then 1426 if (length(piece(uHState,';',2)) > 0) then 1427 begin 1428 if not(aRemote = '2') then 1429 LoadReportText(uLocalReportData, 'L:' + uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState); 1430 LoadListView(uLocalReportData); 1431 end 1432 else 1433 begin 1434 {if ((aRemote = '1') or (aRemote = '2')) then 1435 ShowTabControl;} 1436 if not (aRemote = '2') then 1437 begin 1438 LoadReportText(uLocalReportData, 'L:' + uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState); 1439 if uLocalReportData.Count < 1 then 1440 begin 1441 uReportInstruction := '<No Report Available>'; 1442 memLab.Lines.Add(uReportInstruction); 1443 end 1444 else 1445 QuickCopy(uLocalReportData,memLab); 1446 end; 1447 end; 1448 end 1449 else 1450 begin 1451 Screen.Cursor := crDefault; 1452 //GoRemote(uRemoteReportData, uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState, aHDR, aFHIE); 1453 //************************************************************************** 1454 case StrToInt(Piece(uRptID,':',1)) of 724 1455 21: begin // Cumulative 725 1456 lstHeaders.Clear; … … 728 1459 uLabRemoteReportData.Clear; 729 1460 StatusText('Retrieving data for cumulative report...'); 730 GoRemote (uLabRemoteReportData,0,2,'',uReportRPC,'',IntToStr(daysback),'',date1,date2);1461 GoRemoteOld(uLabRemoteReportData,0,2,'',uReportRPC,'',IntToStr(daysback),'',date1,date2); 731 1462 TabControl1.OnChange(nil); 732 1463 Cumulative(uLabLocalReportData, Patient.DFN, daysback, date1, date2, uReportRPC); … … 744 1475 uLabRemoteReportData.Clear; 745 1476 StatusText('Retrieving data for interim report...'); 746 GoRemote (uLabRemoteReportData,0,3,'',uReportRPC,'','','',date1,date2);1477 GoRemoteOld(uLabRemoteReportData,0,3,'',uReportRPC,'','','',date1,date2); 747 1478 TabControl1.OnChange(nil); 748 1479 Interim(uLabLocalReportData, Patient.DFN, date1, date2, uReportRPC); … … 761 1492 try 762 1493 StatusText('Retrieving data for selected tests...'); 763 uLabLocalReportData.Assign(InterimSelect(Patient.DFN, date1, date2, lstTests.Items));1494 FastAssign(InterimSelect(Patient.DFN, date1, date2, lstTests.Items), uLabLocalReportData); 764 1495 if uLabLocalReportData.Count > 0 then 765 1496 QuickCopy(uLabLocalReportData,memLab) … … 781 1512 grdLab.Align := alClient; 782 1513 StatusText('Retrieving data for worksheet...'); 783 tmpGrid.Assign(Worksheet(Patient.DFN, date1, date2,784 Piece(lblSpecimen.Caption, '^', 1), lstTests.Items) );1514 FastAssign(Worksheet(Patient.DFN, date1, date2, 1515 Piece(lblSpecimen.Caption, '^', 1), lstTests.Items), tmpGrid); 785 1516 if ragHorV.ItemIndex = 0 then 786 1517 HGrid(tmpGrid) … … 803 1534 try 804 1535 StatusText('Retrieving data for graph...'); 805 tmpList.Assign(GetChart(Patient.DFN, date1, date2,1536 FastAssign(GetChart(Patient.DFN, date1, date2, 806 1537 Piece(lblSpecimen.Caption, '^', 1), 807 Piece(lblSingleTest.Caption, '^', 1)) );1538 Piece(lblSingleTest.Caption, '^', 1)), tmpList); 808 1539 if tmpList.Count > 1 then 809 1540 begin … … 845 1576 uLabRemoteReportData.Clear; 846 1577 StatusText('Retrieving microbiology data...'); 847 GoRemote (uLabRemoteReportData,0,4,'',uReportRPC,'','','',date1,date2);1578 GoRemoteOld(uLabRemoteReportData,0,4,'',uReportRPC,'','','',date1,date2); 848 1579 TabControl1.OnChange(nil); 849 1580 Micro(uLabLocalReportData, Patient.DFN, date1, date2, uReportRPC); … … 861 1592 uLabRemoteReportData.Clear; 862 1593 StatusText('Retrieving lab status data...'); 863 GoRemote (uLabRemoteReportData,9,1,'',uReportRPC,'',IntToStr(daysback),'',date1,date2);1594 GoRemoteOld(uLabRemoteReportData,9,1,'',uReportRPC,'',IntToStr(daysback),'',date1,date2); 864 1595 TabControl1.OnChange(nil); 865 Reports(uLabLocalReportData,Patient.DFN, ' 9', '', IntToStr(daysback),'',1596 Reports(uLabLocalReportData,Patient.DFN, 'L:' + '9', '', IntToStr(daysback),'', 866 1597 date1, date2, uReportRPC); 867 1598 if uLabLocalReportData.Count < 1 then … … 879 1610 uLabRemoteReportData.Clear; 880 1611 StatusText('Retrieving lab data...'); 881 GoRemote (uLabRemoteReportData, StrToInt(Piece(Rpt,'^',1)), 1, '',882 1612 GoRemoteOld(uLabRemoteReportData, 1, 1, '', uReportRPC, '', IntToStr(daysback), '', date1, date2); 1613 //GoRemoteOld(uLabRemoteReportData, StrToInt(Piece(uRptID,'^',1)), 1, '', uReportRPC, '', IntToStr(daysback), '', date1, date2); 883 1614 TabControl1.OnChange(nil); 884 Reports(uLabLocalReportData,Patient.DFN, Piece(Rpt,'^',1), '',1615 Reports(uLabLocalReportData,Patient.DFN, 'L:' + Piece(uRptID,'^',1), '', 885 1616 IntToStr(daysback), '', date1, date2, uReportRPC); 886 1617 if uLabLocalReportData.Count < 1 then … … 893 1624 end; 894 1625 end; 1626 //************************************************************************** 1627 {LoadReportText(uLocalReportData, uRptID, lstQualifier.ItemID + MoreID, uReportRPC, uHState); 1628 if TabControl1.TabIndex < 1 then 1629 QuickCopy(uLocalReportData,memLab); } 1630 end; 1631 end; 1632 Screen.Cursor := crDefault; 1633 StatusText(''); 1634 memLab.Lines.Insert(0,' '); 1635 memLab.Lines.Delete(0); 1636 {if WebBrowser1.Visible = true then **Browser Remove** 1637 begin 1638 if uReportType = 'R' then 1639 uHTMLDoc := HTML_PRE + uLocalReportData.Text + HTML_POST 1640 else 1641 uHTMLDoc := uHTMLPatient + uLocalReportData.Text; 1642 WebBrowser1.Navigate('about:blank'); 1643 end; } 1644 end; 1645 1646 procedure TfrmLabs.lblDateEnter(Sender: TObject); 1647 begin 1648 inherited; 1649 amgrMain.AccessText[lblDate] := 'Date Collected '+lblDate.Caption; 1650 end; 1651 1652 procedure TfrmLabs.lstDatesClick(Sender: TObject); 1653 var 1654 tmpList: TStringList; 1655 daysback: integer; 1656 date1, date2: TFMDateTime; 1657 today: TDateTime; 1658 i: integer; 1659 x,x1,x2,aID: string; 1660 begin 1661 inherited; 1662 uRemoteCount := 0; 1663 if uFrozen = True then memo1.visible := False; 1664 Screen.Cursor := crHourGlass; 1665 DisplayHeading(''); 1666 uHTMLDoc := ''; 1667 //Rpt := lstReports.Items[lstReports.ItemIndex]; 1668 //uReportRPC := UpperCase(Piece(Rpt,'^',6)); 1669 chkBrowser; 1670 if (lstDates.ItemID = 'S') then 1671 begin 1672 with calLabRange do 1673 begin 1674 if Execute then 1675 if Length(TextOfStart) > 0 then 1676 if Length(TextOfStop) > 0 then 1677 begin 1678 lstDates.ItemIndex := lstDates.Items.Add(RelativeStart + ';' + 1679 RelativeStop + U + TextOfStart + ' to ' + TextOfStop); 1680 DisplayHeading(''); 1681 end 1682 else 1683 lstDates.ItemIndex := -1 1684 else 1685 lstDates.ItemIndex := -1 1686 else 1687 lstDates.ItemIndex := -1; 1688 end; 1689 end; 1690 today := FMToDateTime(floattostr(FMToday)); 1691 if lstDates.ItemIEN > 0 then 1692 begin 1693 daysback := lstDates.ItemIEN; 1694 date1 := FMToday; 1695 If daysback = 1 then 1696 date2 := DateTimeToFMDateTime(today) 1697 Else 1698 date2 := DateTimeToFMDateTime(today - daysback); 1699 end 1700 else 1701 BeginEndDates(date1,date2,daysback); 1702 date1 := date1 + 0.2359; 1703 uHTMLDoc := ''; 1704 //WebBrowser1.Navigate('about:blank'); **Browser Remove** 1705 aID := piece(uRptID,':',1); 1706 if aID = '21' then 1707 begin // Cumulative 1708 lstHeaders.Clear; 1709 memLab.Clear; 1710 uLabLocalReportData.Clear; 1711 uLabRemoteReportData.Clear; 1712 StatusText('Retrieving data for cumulative report...'); 1713 GoRemoteOld(uLabRemoteReportData,0,2,'',uReportRPC,'',IntToStr(daysback),'',date1,date2); 1714 TabControl1.OnChange(nil); 1715 Cumulative(uLabLocalReportData, Patient.DFN, daysback, date1, date2, uReportRPC); 1716 if uLabLocalReportData.Count > 0 then 1717 begin 1718 TabControl1.OnChange(nil); 1719 if lstHeaders.Items.Count > 0 then lstHeaders.ItemIndex := 0; 1720 end; 1721 memLab.Lines.Insert(0,' '); 1722 memLab.Lines.Delete(0); 1723 end 1724 else if aID = '3' then 1725 begin // Interim 1726 memLab.Clear; 1727 uLabLocalReportData.Clear; 1728 uLabRemoteReportData.Clear; 1729 StatusText('Retrieving data for interim report...'); 1730 GoRemoteOld(uLabRemoteReportData,0,3,'',uReportRPC,'','','',date1,date2); 1731 TabControl1.OnChange(nil); 1732 Interim(uLabLocalReportData, Patient.DFN, date1, date2, uReportRPC); 1733 if uLabLocalReportData.Count < 1 then 1734 uLabLocalReportData.Add('<No results for this date range.>'); 1735 if TabControl1.TabIndex < 1 then 1736 QuickCopy(uLabLocalReportData,memLab); 1737 memLab.Lines.Insert(0,' '); 1738 memLab.Lines.Delete(0); 1739 memLab.SelStart := 0; 1740 end 1741 else if aID = '4' then 1742 begin // Interim for Selected Tests 1743 memLab.Clear; 1744 uLabLocalReportData.Clear; 1745 uLabRemoteReportData.Clear; 1746 try 1747 StatusText('Retrieving data for selected tests...'); 1748 FastAssign(InterimSelect(Patient.DFN, date1, date2, lstTests.Items), uLabLocalReportData); 1749 if uLabLocalReportData.Count > 0 then 1750 QuickCopy(uLabLocalReportData,memLab) 1751 else 1752 memLab.Lines.Add('<No results for selected tests in this date range.>'); 1753 memLab.SelStart := 0; 1754 finally 1755 //tmpList.Free; 1756 end; 1757 end 1758 else if aID = '5' then 1759 begin // Worksheet 1760 chtChart.BottomAxis.Automatic := true; 1761 chkZoom.Checked := false; 1762 //chkZoomClick(self); 1763 chkAbnormals.Checked := false; 1764 memLab.Clear; 1765 uLabLocalReportData.Clear; 1766 uLabRemoteReportData.Clear; 1767 grdLab.Align := alClient; 1768 StatusText('Retrieving data for worksheet...'); 1769 FastAssign(Worksheet(Patient.DFN, date1, date2, 1770 Piece(lblSpecimen.Caption, '^', 1), lstTests.Items), tmpGrid); 1771 if ragHorV.ItemIndex = 0 then 1772 HGrid(tmpGrid) 1773 else 1774 VGrid(tmpGrid); 1775 GraphList(tmpGrid); 1776 GridComments(tmpGrid); 1777 ragCorGClick(self); 1778 end 1779 else if aID = '6' then 1780 begin // Graph 1781 if not uGraphingActivated then 1782 begin 1783 chtChart.BottomAxis.Automatic := true; 1784 chkGraphZoom.Checked := false; 1785 chkGraphZoomClick(self); 1786 memLab.Clear; 1787 uLabLocalReportData.Clear; 1788 uLabRemoteReportData.Clear; 1789 tmpList := TStringList.Create; 1790 try 1791 StatusText('Retrieving data for graph...'); 1792 FastAssign(GetChart(Patient.DFN, date1, date2, 1793 Piece(lblSpecimen.Caption, '^', 1), 1794 Piece(lblSingleTest.Caption, '^', 1)), tmpList); 1795 if tmpList.Count > 1 then 1796 begin 1797 chtChart.Visible := true; 1798 GraphChart(lblSingleTest.Caption, tmpList); 1799 chtChart.ZoomPercent(ZOOM_PERCENT); 1800 for i := strtoint(Piece(tmpList[0], '^', 1)) + 1 to tmpList.Count - 1 1801 do memLab.Lines.Add(tmpList[i]); 1802 if memLab.Lines.Count < 2 then 1803 memLab.Lines.Add('<No comments on specimens.>'); 1804 memLab.SelStart := 0; 1805 lblGraph.Visible := false; 1806 end 1807 else 1808 begin 1809 lblGraph.Left := chtChart.Left + ((chtChart.Width - lblGraph.Width) div 2); 1810 lblGraph.Top := 2; 1811 lblGraph.Visible := true; 1812 if Piece(lblSpecimen.Caption, '^', 1) = '0' then 1813 pnlChart.Caption := '<No results can be graphed for ' + 1814 Piece(lblSingleTest.Caption, '^', 2) + ' in this date range.> ' 1815 + 'Results may be available, but cannot be graphed. Please try an alternate view.' 1816 else 1817 pnlChart.Caption := '<No results can be graphed for ' + 1818 Piece(lblSingleTest.Caption, '^', 2) 1819 + ' (' + Piece(lblSpecimen.Caption, '^', 2) + 1820 ') in this date range.> ' 1821 + 'Results may be available, but cannot be graphed. Please try an alternate view.'; 1822 chtChart.Visible := false; 1823 end; 1824 finally 1825 tmpList.Free; 1826 end; 1827 end; 1828 end 1829 else if aID = '9' then 1830 begin // Micro 1831 memLab.Clear; 1832 uLabLocalReportData.Clear; 1833 uLabRemoteReportData.Clear; 1834 StatusText('Retrieving microbiology data...'); 1835 GoRemoteOld(uLabRemoteReportData,0,4,'',uReportRPC,'','','',date1,date2); 1836 TabControl1.OnChange(nil); 1837 Micro(uLabLocalReportData, Patient.DFN, date1, date2, uReportRPC); 1838 if uLabLocalReportData.Count < 1 then 1839 uLabLocalReportData.Add('<No microbiology results for this date range.>'); 1840 if TabControl1.TabIndex < 1 then 1841 QuickCopy(uLabLocalReportData,memLab); 1842 memLab.Lines.Insert(0,' '); 1843 memLab.Lines.Delete(0); 1844 memLab.SelStart := 0; 1845 end 1846 else if aID = '10' then 1847 begin // Lab Status 1848 memLab.Clear; 1849 uLabLocalReportData.Clear; 1850 uLabRemoteReportData.Clear; 1851 StatusText('Retrieving lab status data...'); 1852 GoRemoteOld(uLabRemoteReportData,10,1,'',uReportRPC,'',IntToStr(daysback),'',date1,date2); 1853 TabControl1.OnChange(nil); 1854 Reports(uLabLocalReportData,Patient.DFN, 'L:10', '', IntToStr(daysback),'', 1855 date1, date2, uReportRPC); 1856 if uLabLocalReportData.Count < 1 then 1857 uLabLocalReportData.Add('<No laboratory orders for this date range.>'); 1858 if TabControl1.TabIndex < 1 then 1859 QuickCopy(uLabLocalReportData,memLab); 1860 memLab.Lines.Insert(0,' '); 1861 memLab.Lines.Delete(0); 1862 memLab.SelStart := 0; 1863 end 1864 else begin //Anything Else 1865 lstHeaders.Clear; 1866 memLab.Clear; 1867 uLabLocalReportData.Clear; 1868 uLabRemoteReportData.Clear; 1869 StatusText('Retrieving lab data...'); 1870 //GoRemoteOld(uLabRemoteReportData, StrToInt(Piece(uRptID,'^',1)), 1, '', uReportRPC, '', IntToStr(daysback), '', date1, date2); 1871 GoRemoteOld(uLabRemoteReportData, 1, 1, '', uReportRPC, '', IntToStr(daysback), '', date1, date2); 1872 TabControl1.OnChange(nil); 1873 Reports(uLabLocalReportData,Patient.DFN, 'L:' + Piece(uRptID,'^',1), '', 1874 IntToStr(daysback), '', date1, date2, uReportRPC); 1875 if uLabLocalReportData.Count < 1 then 1876 uLabLocalReportData.Add('<No data for this date range.>'); 1877 if TabControl1.TabIndex < 1 then 1878 QuickCopy(uLabLocalReportData,memLab); 1879 memLab.Lines.Insert(0,' '); 1880 memLab.Lines.Delete(0); 1881 memLab.SelStart := 0; 1882 end; 895 1883 if uReportType = 'R' then 896 1884 uHTMLDoc := HTML_PRE + uLabLocalReportData.Text + HTML_POST … … 898 1886 uHTMLDoc := uHTMLPatient + uLabLocalReportData.Text; 899 1887 Screen.Cursor := crDefault; 1888 x := lstDates.DisplayText[lstDates.ItemIndex]; 1889 x1 := piece(x,' ',1); 1890 x2 := piece(x,' ',2); 1891 if not(uRptID = '1:MOST RECENT') and (Uppercase(Copy(x1,1,1)) = 'T') and (Uppercase(Copy(x2,1,1)) = 'T') then 1892 DisplayHeading(piece(x,' ',1) + ';' + piece(x,' ',2)) 1893 else 1894 DisplayHeading('d' + lstDates.ItemID); 900 1895 StatusText(''); 901 1896 end; … … 904 1899 begin 905 1900 inherited; 906 lstReportsClick(self);1901 tvReportsClick(self); 907 1902 end; 908 1903 … … 937 1932 var 938 1933 testcnt, datecnt, datacnt, linecnt, offset, x, y, i: integer; 1934 DisplayDateTime: string; 939 1935 begin 940 1936 offset := 0; … … 976 1972 for i := testcnt + 1 to testcnt + datecnt do 977 1973 begin 978 Cells[0, i - testcnt] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(Piece(griddata[i + offset], '^', 2))); 1974 //------------------------------------------------------------------------------------------ 1975 //v27.2 - RV - PSI-05-118 / Remedy HD0000000123277 - don't show "00:00" if no time present 1976 if LabPatchInstalled then // Requires lab patch in const "PSI_05_118" 1977 begin 1978 DisplayDateTime := Piece(griddata[i + offset], '^', 2); 1979 if length(DisplayDateTime) > 7 then 1980 Cells[0, i - testcnt] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(DisplayDateTime)) 1981 else if length(DisplayDateTime) > 0 then 1982 Cells[0, i - testcnt] := FormatFMDateTime('mm/dd/yy',MakeFMDateTime(DisplayDateTime)) 1983 else 1984 Cells[0, i - testcnt] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(Piece(griddata[i + offset], '^', 2))); 1985 end 1986 else // If no lab patch in const "PSI_05_118", continue as is 1987 begin 1988 Cells[0, i - testcnt] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(Piece(griddata[i + offset], '^', 2))); 1989 end; 1990 //------------------------------------------------------------------------------------------ 979 1991 Cells[1, i - testcnt] := MixedCase(Piece(griddata[i + offset], '^', 4)) + ' ' + Piece(griddata[i + offset], '^', 5); 980 1992 end; … … 991 2003 var 992 2004 testcnt, datecnt, datacnt, linecnt, offset, x, y, i: integer; 2005 DisplayDateTime: string; 993 2006 begin 994 2007 offset := 0; … … 1030 2043 for i := testcnt + 1 to testcnt + datecnt do 1031 2044 begin 1032 Cells[i - testcnt, 0] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(Piece(griddata[i + offset], '^', 2))); 2045 //------------------------------------------------------------------------------------------ 2046 if LabPatchInstalled then // Requires lab patch in const "PSI_05_118" 2047 begin 2048 DisplayDateTime := Piece(griddata[i + offset], '^', 2); 2049 if length(DisplayDateTime) > 7 then 2050 Cells[i - testcnt, 0] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(DisplayDateTime)) 2051 else if length(DisplayDateTime) > 0 then 2052 Cells[i - testcnt, 0] := FormatFMDateTime('mm/dd/yy',MakeFMDateTime(DisplayDateTime)) 2053 else 2054 Cells[i - testcnt, 0] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(Piece(griddata[i + offset], '^', 2))); 2055 end 2056 else // If no lab patch in const "PSI_05_118", continue as is 2057 begin 2058 Cells[i - testcnt, 0] := FormatFMDateTime('mm/dd/yy hh:nn',MakeFMDateTime(Piece(griddata[i + offset], '^', 2))); 2059 end; 2060 //------------------------------------------------------------------------------------------ 1033 2061 Cells[i - testcnt, 1] := MixedCase(Piece(griddata[i + offset], '^', 4)); 1034 2062 end; … … 1058 2086 1059 2087 procedure TfrmLabs.FormDestroy(Sender: TObject); 1060 begin 1061 inherited; 2088 var 2089 i: integer; 2090 aColChange: string; 2091 begin 2092 inherited; 2093 if length(uColChange) > 0 then 2094 begin 2095 aColChange := ''; 2096 for i := 0 to lvReports.Columns.Count - 1 do 2097 aColChange := aColChange + IntToStr(lvReports.Column[i].width) + ','; 2098 if (Length(aColChange) > 0) and (aColChange <> piece(uColchange,'^',2)) then 2099 SaveColumnSizes(piece(uColChange,'^',1) + '^' + aColChange); 2100 uColChange := ''; 2101 end; 2102 RemoteQueryAbortAll; 1062 2103 tmpGrid.free; 1063 2104 uLabLocalReportData.Free; 1064 2105 uLabRemoteReportData.Free; 1065 TAccessibleStringGrid.UnwrapControl(grdLab); 2106 uTreeStrings.Free; 2107 uEmptyImageList.Free; 2108 uColumns.Free; 2109 uLocalReportData.Free; 2110 uRemoteReportData.Free; 1066 2111 end; 1067 2112 … … 1122 2167 tmpList: TStringList; 1123 2168 nexton, prevon: boolean; 1124 newest, oldest : string;2169 newest, oldest, DisplayDate: string; 1125 2170 begin 1126 2171 tmpList := TStringList.Create; … … 1129 2174 prevon := true; 1130 2175 try 1131 tmpList.Assign(InterimGrid(Patient.DFN, adatetime, direction, uFormat));2176 FastAssign(InterimGrid(Patient.DFN, adatetime, direction, uFormat), tmpList); 1132 2177 if tmpList.Count > 0 then 1133 2178 begin 1134 2179 lblDateFloat.Caption := Piece(tmpList[0], '^', 3); 1135 2180 uFormat := strtointdef(Piece(tmpList[0], '^', 9), 1); 1136 if length(lblDateFloat.Caption) > 0 then 1137 lblDate.Caption := FormatFMDateTime('MMM DD, YYYY hh:nn', strtofloat(lblDateFloat.Caption)); 2181 //------------------------------------------------------------------------------------------ 2182 //v27.1 - RV - PSI-05-118 / Remedy HD0000000123277 - don't show "00:00" if no time present 2183 if LabPatchInstalled then // Requires lab patch in const "PSI_05_118" 2184 begin 2185 DisplayDate := Piece(tmpList[0], '^', 3); 2186 if length(DisplayDate) > 7 then 2187 lblDate.Caption := FormatFMDateTime('MMM DD, YYYY hh:nn', strtofloat(DisplayDate)) 2188 else if length(DisplayDate) > 0 then 2189 lblDate.Caption := FormatFMDateTime('MMM DD, YYYY', strtofloat(DisplayDate)) 2190 else 2191 if length(lblDateFloat.Caption) > 0 then 2192 lblDate.Caption := FormatFMDateTime('MMM DD, YYYY hh:nn', strtofloat(lblDateFloat.Caption)); 2193 end 2194 else // If no lab patch in const "PSI_05_118", continue as is 2195 begin 2196 if length(lblDateFloat.Caption) > 0 then 2197 lblDate.Caption := FormatFMDateTime('MMM DD, YYYY hh:nn', strtofloat(lblDateFloat.Caption)); 2198 end; 2199 //------------------------------------------------------------------------------------------ 1138 2200 if length(lblDateFloat.Caption) < 1 1139 2201 then … … 1183 2245 FillGrid(grdLab, tmpList); 1184 2246 FillComments(memLab, tmpList); 1185 memLab.Align := alBottom; 2247 if uScreenSplitMoved = false then 2248 begin 2249 pnlRightTop.Height := pnlRight.Height - (pnlRight.Height div 5); 2250 uScreenSplitLoc := sptHorzRight.Top; 2251 end 2252 else 2253 pnlRightTop.Height := uScreenSplitLoc; 2254 pnlRightBottom.Height := pnlLeft.Height div 5; 1186 2255 memLab.Height := pnlLeft.Height div 5; 2256 memLab.Lines.Insert(0,' '); 2257 memLab.Lines.Delete(0); 2258 memLab.SelStart := 0; 1187 2259 grdLab.Align := alClient; 1188 2260 grdLab.Visible := true; … … 1195 2267 if (grdLab.VisibleRowCount + 1) < grdLab.RowCount then 1196 2268 grdLab.ColWidths[4] := grdLab.ColWidths[4] - 18; 2269 memLab.Align := alClient; 1197 2270 memLab.Repaint; 1198 2271 end; … … 1200 2273 begin 1201 2274 tmpList.Delete(0); 1202 memLab.Lines.Assign(tmpList);2275 QuickCopy(tmpList, memLab); 1203 2276 memLab.SelStart := 0; 1204 2277 grdLab.Visible := false; 1205 2278 pnlFooter.Visible := false; 2279 sptHorzRight.Visible := true; 2280 pnlRightTop.Height := pnlHeader.Height + TabControl1.Height; 2281 memLab.Height := pnlRight.Height - (lblHeading.Height + lblTitle.Height + pnlHeader.Height); 2282 pnlRightTop.Visible := true; 1206 2283 memLab.Align := alClient; 2284 memLab.Repaint; 1207 2285 end; 1208 2286 end … … 1230 2308 if cmdNext.Enabled then cmdNext.SetFocus 1231 2309 else if cmdPrev.Enabled then cmdPrev.SetFocus 1232 else lstReports.SetFocus;2310 else tvReports.SetFocus; 1233 2311 end; 1234 2312 end; … … 1246 2324 if cmdPrev.Enabled then cmdPrev.SetFocus 1247 2325 else if cmdNext.Enabled then cmdNext.SetFocus 1248 else lstReports.SetFocus;2326 else tvReports.Setfocus; 1249 2327 end; 1250 2328 end; … … 1407 2485 1408 2486 procedure TfrmLabs.FormResize(Sender: TObject); 2487 //var 2488 //aID: integer; 1409 2489 begin 1410 2490 inherited; … … 1415 2495 pnlFooter.Height := lblReports.Height + 5; 1416 2496 lblFooter.Height := lblReports.Height; 1417 case lstReports.ItemIEN of 2497 {aID := 0; 2498 if CharAt(uRPTID,2) =':' then 2499 aID := StrToInt(piece(uRptID,':',1)); 2500 if (aID = 0) and (CharAt(uRPTID,3) =':') then 2501 aID := StrToInt(piece(uRptID,':',1)); } 2502 {case lstReports.ItemIEN of } 2503 {case aID of 1418 2504 1: begin // Most Recent 1419 2505 pnlHeader.Align := alTop; … … 1428 2514 pnlFooter.Align := alBottom; 1429 2515 memLab.Repaint; 2516 pnlRightTop.Height := pnlLeft.Height - (pnlLeft.Height div 5); 2517 //*pnlRightTop.Visible := true; 2518 //*pnlButtons.Visible := true; 2519 //*pnlWorksheet.Visible := false; 2520 //*pnlGraph.Visible := false; 2521 //memLab.Align := alBottom; 2522 sptHorzRight.Visible := true; 2523 pnlRightBottom.Height := pnlLeft.Height div 5; 2524 //memLab.Height := pnlLeft.Height div 5; 2525 //grdLab.Align := alClient; 1430 2526 end; 1431 2 : begin // Cumulative2527 21: begin // Cumulative 1432 2528 pnlFooter.Top := pnlLeft.Height - pnlFooter.Height; 1433 2529 pnlFooter.Align := alBottom; … … 1471 2567 end; 1472 2568 end; 1473 7: begin // Anatomic Path2569 20: begin // Anatomic Path 1474 2570 memLab.Repaint; 1475 2571 end; 1476 8: begin // Blood Bank2572 2: begin // Blood Bank 1477 2573 memLab.Repaint; 1478 2574 end; … … 1483 2579 memLab.Repaint; 1484 2580 end; 1485 end; 2581 end; } 1486 2582 end; 1487 2583 … … 1577 2673 chkValues.Enabled := false; 1578 2674 pnlChart.Visible:= false; 1579 grdLab.Align := alNone; 1580 memLab.Height := pnlRight.Height div 6; 1581 memLab.Top := pnlRight.Height - pnlFooter.Height - memLab.Height; 1582 memLab.Align := alBottom; 2675 pnlRightTop.Align := alTop; 2676 pnlRightTop.Height := pnlRight.Height - (pnlRight.Height div 6); 2677 pnlRightBottom.Visible := true; 2678 pnlRightBottom.Align := alClient; 2679 memLab.Align := alClient; 1583 2680 memLab.Visible := true; 1584 2681 grdLab.Align := alClient; … … 1592 2689 chkValuesClick(self); 1593 2690 memLab.Visible := false; 1594 grdLab.Align := alNone; 1595 //pnlChart.Height := pnlLeft.Height - pnlOtherTests.Top - pnlFooter.Height; 1596 //pnlChart.Top := pnlOtherTests.Top; 2691 pnlRightBottom.Visible := false; 2692 pnlRightTop.Align := alClient; 1597 2693 pnlChart.Height := pnlRight.Height div 2; 1598 2694 pnlChart.Top := pnlRight.Height - pnlFooter.Height - pnlChart.Height; … … 1615 2711 end; 1616 2712 2713 procedure TfrmLabs.Print1Click(Sender: TObject); 2714 begin 2715 inherited; 2716 RequestPrint; 2717 end; 2718 2719 procedure TfrmLabs.Copy1Click(Sender: TObject); 2720 var 2721 i,j: integer; 2722 line: string; 2723 ListItem: TListItem; 2724 aText: String; 2725 begin 2726 inherited; 2727 ClipBoard; 2728 aText := ''; 2729 for i := 0 to lvReports.Items.Count - 1 do 2730 if lvReports.Items[i].Selected then 2731 begin 2732 ListItem := lvReports.Items[i]; 2733 line := ''; 2734 for j := 1 to lvReports.Columns.Count - 1 do 2735 begin 2736 if (lvReports.Column[j].Width <> 0) and (j < (ListItem.SubItems.Count + 1)) then 2737 line := line + ' ' + ListItem.SubItems[j-1]; 2738 end; 2739 if (length(line) > 0) and (lvReports.Column[0].Width <> 0) then 2740 line := ListItem.Caption + ' ' + line; 2741 if length(aText) > 0 then 2742 aText := aText + CRLF + line 2743 else aText := line; 2744 end; 2745 ClipBoard.Clear; 2746 ClipBoard.AsText := aText; 2747 end; 2748 2749 procedure TfrmLabs.Copy2Click(Sender: TObject); 2750 begin 2751 inherited; 2752 memLab.CopyToClipboard; 2753 end; 2754 2755 procedure TfrmLabs.Print2Click(Sender: TObject); 2756 begin 2757 inherited; 2758 RequestPrint; 2759 end; 2760 2761 procedure TfrmLabs.lvReportsColumnClick(Sender: TObject; 2762 Column: TListColumn); 2763 var 2764 ClickedColumn: Integer; 2765 a1, a2: integer; 2766 s,s1,s2: string; 2767 begin 2768 inherited; 2769 a1 := StrToIntDef(piece(uSortOrder,':',1),0) - 1; 2770 a2 := StrToIntDef(piece(uSortOrder,':',2),0) - 1; 2771 ClickedColumn := Column.Index; 2772 ColumnToSort := Column.Index; 2773 SortIdx1 := StrToIntDef(piece(uColumns[ColumnToSort],'^',9),0); 2774 SortIdx2 := 0; 2775 SortIdx3 := 0; 2776 if a1 > -1 then SortIdx2 := StrToIntDef(piece(uColumns[a1],'^',9),0); 2777 if a2 > -1 then SortIdx3 := StrToIntDef(piece(uColumns[a2],'^',9),0); 2778 if a1 = ColumnToSort then 2779 begin 2780 SortIdx2 := SortIdx3; 2781 SortIdx3 := 0; 2782 end; 2783 if a2 = ColumnToSort then 2784 SortIdx3 := 0; 2785 if ClickedColumn = ColumnToSort then 2786 ColumnSortForward := not ColumnSortForward 2787 else 2788 ColumnSortForward := true; 2789 ColumnToSort := ClickedColumn; 2790 uFirstSort := ColumnToSort; 2791 uSecondSort := a1; 2792 uThirdSort := a2; 2793 lvReports.Hint := ''; 2794 if ColumnSortForward = true then 2795 s := 'Sorted forward' 2796 else 2797 s := 'Sorted reverse'; 2798 s1 := piece(uColumns[uFirstSort],'^',1); 2799 s2 := ''; 2800 if length(piece(s1,' ',2)) > 0 then 2801 s2 := pieces(s1,' ',2,99); 2802 if length(s2) > 0 then s2 := StripSpace(s2); 2803 s := s + ' by ' + piece(s1,' ',1) + ' ' + s2; 2804 if (a1 <> uFirstSort) and (a1 > -1) then 2805 begin 2806 s1 := piece(uColumns[a1], '^', 1); 2807 s2 := ''; 2808 if length(piece(s1,' ',2)) > 0 then 2809 s2 := pieces(s1,' ',2,99); 2810 if length(s2) > 0 then s2 := StripSpace(s2); 2811 s := s + ' then by ' + piece(s1,' ',1) + ' ' + s2; 2812 end; 2813 if (a2 <> uFirstSort) and (a2 > -1) then 2814 begin 2815 s1 := piece(uColumns[a2], '^', 1); 2816 s2 := ''; 2817 if length(piece(s1,' ',2)) > 0 then 2818 s2 := pieces(s1,' ',2,99); 2819 if length(s2) > 0 then s2 := StripSpace(s2); 2820 s := s + ' then by ' + piece(s1,' ',1) + ' ' + s2; 2821 end; 2822 lvReports.Hint := s; 2823 lvReports.CustomSort(nil, 0); 2824 end; 2825 2826 procedure TfrmLabs.lvReportsCompare(Sender: TObject; Item1, 2827 Item2: TListItem; Data: Integer; var Compare: Integer); 2828 2829 function CompareValues(Col: Integer): integer; 2830 var 2831 ix: Integer; 2832 s1, s2: string; 2833 v1, v2: extended; 2834 d1, d2: TFMDateTime; 2835 begin 2836 inherited; 2837 if ColumnToSort = 0 then 2838 Result := CompareText(Item1.Caption,Item2.Caption) 2839 else 2840 begin 2841 ix := ColumnToSort - 1; 2842 case Col of 2843 0: //strings 2844 begin 2845 if(Item1.SubItems.Count > 0) and (ix < Item1.SubItems.Count) then 2846 s1 := Item1.SubItems[ix] 2847 else 2848 s1 := '0'; 2849 if(Item2.SubItems.Count > 0) and (ix < Item2.SubItems.Count) then 2850 s2 := Item2.SubItems[ix] 2851 else 2852 s2 := '0'; 2853 Result := CompareText(s1,s2); 2854 end; 2855 2856 1: //integers 2857 begin 2858 if(Item1.SubItems.Count > 0) and (ix < Item1.SubItems.Count) then 2859 s1 := Item1.SubItems[ix] 2860 else 2861 s1 := '0'; 2862 if(Item2.SubItems.Count > 0) and (ix < Item2.SubItems.Count) then 2863 s2 := Item2.SubItems[ix] 2864 else 2865 s2 := '0'; 2866 IsValidNumber(s1, v1); 2867 IsValidNumber(s2, v2); 2868 if v1 > v2 then 2869 Result := 1 2870 else 2871 if v1 < v2 then 2872 Result := -1 2873 else 2874 Result := 0; 2875 end; 2876 2877 2: //date/times 2878 begin 2879 if(Item1.SubItems.Count > 1) and (ix < Item1.SubItems.Count) then 2880 s1 := Item1.SubItems[ix] 2881 else 2882 s1 := '1/1/1700'; 2883 if(Item2.SubItems.Count > 1) and (ix < Item2.SubItems.Count) then 2884 s2 := Item2.SubItems[ix] 2885 else 2886 s2 := '1/1/1700'; 2887 d1 := StringToFMDateTime(s1); 2888 d2 := StringToFMDateTime(s2); 2889 if d1 > d2 then 2890 Result := 1 2891 else 2892 if d1 < d2 then 2893 Result := -1 2894 else 2895 Result := 0; 2896 end; 2897 else 2898 Result := 0; // to make the compiler happy 2899 end; 2900 end; 2901 end; 2902 begin 2903 ColumnToSort := uFirstSort; 2904 Compare := CompareValues(SortIdx1); 2905 if Compare = 0 then 2906 begin 2907 if (uSecondSort > -1) and (uFirstSort <> uSecondSort) then 2908 begin 2909 ColumnToSort := uSecondSort; 2910 Compare := CompareValues(SortIdx2); 2911 end; 2912 if Compare = 0 then 2913 if (uThirdSort > -1) and (uFirstSort <> uThirdSort) and (uSecondSort <> uThirdSort) then 2914 begin 2915 ColumnToSort := uThirdSort; 2916 Compare := CompareValues(SortIdx3); 2917 end; 2918 end; 2919 if not ColumnSortForward then Compare := -Compare; 2920 end; 2921 2922 procedure TfrmLabs.lvReportsKeyUp(Sender: TObject; var Key: Word; 2923 Shift: TShiftState); 2924 begin 2925 inherited; 2926 if (Key = 67) and (ssCtrl in Shift) then 2927 Copy1Click(Self); 2928 if (Key = 65) and (ssCtrl in Shift) then 2929 SelectAll1Click(Self); 2930 end; 2931 2932 procedure TfrmLabs.lvReportsSelectItem(Sender: TObject; Item: TListItem; 2933 Selected: Boolean); 2934 var 2935 aID, aSID: string; 2936 i,j,k: integer; 2937 aBasket: TStringList; 2938 aWPFlag: Boolean; 2939 x, HasImages: string; 2940 2941 begin 2942 inherited; 2943 if not selected then Exit; 2944 aBasket := TStringList.Create; 2945 uLocalReportData.Clear; 2946 aWPFlag := false; 2947 with lvReports do 2948 begin 2949 aID := Item.SubItems[0]; 2950 case uQualifierType of 2951 QT_OTHER: 2952 begin // = 0 2953 2954 end; 2955 QT_DATERANGE: 2956 begin // = 2 2957 2958 end; 2959 QT_IMAGING: 2960 begin // = 3 2961 2962 end; 2963 QT_NUTR: 2964 begin // = 4 2965 2966 end; 2967 QT_HSWPCOMPONENT: 2968 begin // = 6 2969 if lvReports.SelCount < 3 then 2970 begin 2971 memLab.Lines.Clear; 2972 ulvSelectOn := false; 2973 end; 2974 aBasket.Clear; 2975 if (SelCount = 2) and (ulvSelectOn = false) then 2976 begin 2977 ulvSelectOn := true; 2978 for i := 0 to Items.Count - 1 do 2979 if (Items[i].Selected) and (aID <> Items[i].SubItems[0]) then 2980 begin 2981 aSID := Items[i].SubItems[0]; 2982 for j := 0 to RowObjects.ColumnList.Count - 1 do 2983 if piece(aSID,':',1) = piece(TCellObject(RowObjects.ColumnList[j]).Handle,':',1) then 2984 if Item.Caption = (piece(TCellObject(RowObjects.ColumnList[j]).Site,';',1)) then 2985 if (TCellObject(RowObjects.ColumnList[j]).Data.Count > 0) and 2986 (TCellObject(RowObjects.ColumnList[j]).Include = '1') then 2987 begin 2988 aWPFlag := true; 2989 MemLab.Lines.Add(TCellObject(RowObjects.ColumnList[j]).Name); 2990 FastAssign(TCellObject(RowObjects.ColumnList[j]).Data, aBasket); 2991 for k := 0 to aBasket.Count - 1 do 2992 MemLab.Lines.Add(' ' + aBasket[k]); 2993 end; 2994 if aWPFlag = true then 2995 begin 2996 memLab.Lines.Add('Facility: ' + Item.Caption); 2997 memLab.Lines.Add('==============================================================================='); 2998 end; 2999 end; 3000 end; 3001 aBasket.Clear; 3002 aWPFlag := false; 3003 for i := 0 to RowObjects.ColumnList.Count - 1 do 3004 if piece(aID,':',1) = piece(TCellObject(RowObjects.ColumnList[i]).Handle,':',1) then 3005 if Item.Caption = (piece(TCellObject(RowObjects.ColumnList[i]).Site,';',1)) then 3006 if (TCellObject(RowObjects.ColumnList[i]).Data.Count > 0) and 3007 (TCellObject(RowObjects.ColumnList[i]).Include = '1') then 3008 begin 3009 aWPFlag := true; 3010 MemLab.Lines.Add(TCellObject(RowObjects.ColumnList[i]).Name); 3011 FastAssign(TCellObject(RowObjects.ColumnList[i]).Data, aBasket); 3012 for j := 0 to aBasket.Count - 1 do 3013 MemLab.Lines.Add(' ' + aBasket[j]); 3014 end; 3015 if aWPFlag = true then 3016 begin 3017 memLab.Lines.Add('Facility: ' + Item.Caption); 3018 memLab.Lines.Add('==============================================================================='); 3019 end; 3020 if uRptID = 'OR_R18:IMAGING' then 3021 begin 3022 if (Item.SubItems.Count > 8) then //has id, may have case (?) 3023 begin 3024 x := 'RA^' + Item.SubItems[8] + U + Item.SubItems[4] + U + Item.Caption; 3025 SetPiece(x, U, 10, BOOLCHAR[Item.SubItemImages[1] = IMG_1_IMAGE]); 3026 NotifyOtherApps(NAE_REPORT, x); 3027 end 3028 else if (Item.SubItems.Count > 4) then 3029 begin 3030 x := 'RA^' + U + U + Item.SubItems[4] + U + Item.Caption; 3031 SetPiece(x, U, 10, BOOLCHAR[Item.SubItemImages[1] = IMG_1_IMAGE]); 3032 NotifyOtherApps(NAE_REPORT, x); 3033 end 3034 else if Item.SubItemImages[1] = IMG_1_IMAGE then 3035 begin 3036 memLab.Lines.Insert(0,'<Imaging links not active at this site>'); 3037 memLab.Lines.Insert(1,' '); 3038 end; 3039 end; 3040 if uRptID = 'OR_PN:PROGRESS NOTES' then 3041 if (Item.SubItems.Count > 7) then 3042 begin 3043 if StrToIntDef(Item.SubItems[7], 0) > 0 then HasImages := '1' else HasImages := '0'; 3044 x := 'PN^' + Item.SubItems[7] + U + Item.SubItems[1] + U + Item.Caption; 3045 SetPiece(x, U, 10, HasImages); 3046 NotifyOtherApps(NAE_REPORT, x); 3047 end; 3048 end; 3049 QT_PROCEDURES: 3050 begin // = 19 3051 3052 end; 3053 QT_SURGERY: 3054 begin // = 28 3055 3056 end; 3057 end; 3058 memLab.Lines.Insert(0,' '); 3059 memLab.Lines.Delete(0); 3060 end; 3061 aBasket.Free; 3062 end; 3063 3064 procedure TfrmLabs.SelectAll1Click(Sender: TObject); 3065 var 3066 i: integer; 3067 begin 3068 inherited; 3069 for i := 0 to lvReports.Items.Count - 1 do 3070 lvReports.Items[i].Selected := true; 3071 end; 3072 3073 procedure TfrmLabs.SelectAll2Click(Sender: TObject); 3074 begin 3075 inherited; 3076 memLab.SelectAll; 3077 end; 1617 3078 1618 3079 procedure TfrmLabs.chkGraphValuesClick(Sender: TObject); … … 1639 3100 lblGraphInfo.Visible := chkGraphZoom.Checked; 1640 3101 if not chkGraphZoom.Checked then chtChart.UndoZoom; 3102 end; 3103 3104 procedure TfrmLabs.chkMaxFreqClick(Sender: TObject); 3105 begin 3106 inherited; 3107 if chkMaxFreq.Checked = true then 3108 begin 3109 uMaxOcc := piece(uQualifier, ';', 3); 3110 SetPiece(uQualifier, ';', 3, ''); 3111 end 3112 else 3113 begin 3114 SetPiece(uQualifier, ';', 3, uMaxOcc); 3115 end; 3116 tvReportsClick(self); 1641 3117 end; 1642 3118 … … 1724 3200 Else 1725 3201 GotoBottom1.Enabled := False; 1726 case lstReports.ItemIEN of3202 {case lstReports.ItemIEN of 1727 3203 1: FreezeText1.Enabled := False; 1728 3204 5: FreezeText1.Enabled := False; 1729 3205 6: FreezeText1.Enabled := False; 1730 end; 3206 end; } 1731 3207 end; 1732 3208 … … 1737 3213 begin 1738 3214 {uNewest := ''; 1739 uOldest := ''; 3215 uOldest := ''; 1740 3216 GetNewestOldest(Patient.DFN, uNewest, uOldest); } 1741 3217 {AlertDate := Trunc(StrToFMDateTime(Piece(Piece(Notifications.RecordID, U, 2), ';', 3))); … … 1757 3233 if StrToIntDef(OrderIFN,0) > 0 then 1758 3234 begin 3235 //the following if condition & clause resolves CQ 16405 & 17076 - a mixture of two different patient's lab results in one display. 3236 if (AnsiContainsStr(tvReports.Selected.Text, 'Microbiology')) or (AnsiContainsStr(tvReports.Selected.Text, 'Anatomic Pathology')) 3237 or (AnsiContainsStr(tvReports.Selected.Text, 'Cytology')) or (AnsiContainsStr(tvReports.Selected.Text, 'Electron Microscopy')) 3238 or (AnsiContainsStr(tvReports.Selected.Text, 'Surgical Pathology')) and (lvReports.Visible = TRUE) then 3239 begin 3240 tvReports.Selected := tvReports.TopItem; 3241 lvReports.Visible := FALSE; 3242 DisplayHeading(''); 3243 end; 1759 3244 lstDates.ItemIndex := -1; 1760 lstReports.ItemIndex := -1;1761 3245 Memo1.Visible := false; 1762 3246 lblHeaders.Visible := false; … … 1768 3252 grdLab.Visible := false; 1769 3253 pnlChart.Visible := false; 1770 WebBrowser1.Visible := false;1771 WebBrowser1.SendToBack;3254 //WebBrowser1.Visible := false; **Browser Remove** 3255 //WebBrowser1.SendToBack; **Browser Remove** 1772 3256 memLab.Visible := true; 1773 3257 memLab.BringToFront; … … 1776 3260 uLabLocalReportData.Clear; 1777 3261 uLabRemoteReportData.Clear; 3262 pnlRightTop.Height := 5; 1778 3263 memLab.Align := alClient; 1779 3264 FormResize(self); 1780 memLab.Lines.Assign(ResultOrder(OrderIFN));3265 QuickCopy(ResultOrder(OrderIFN), memLab); 1781 3266 memLab.SelStart := 0; 1782 3267 memLab.Repaint; … … 1786 3271 begin 1787 3272 if Patient.Inpatient then lstDates.ItemIndex := 2 else lstDates.ItemIndex := 5; 1788 lstReports.ItemIndex := 0;1789 lstReportsClick(self);3273 tvReports.Selected := tvReports.Items.GetFirstNode; 3274 tvReportsClick(self); 1790 3275 end; 1791 3276 … … 2096 3581 end; 2097 3582 2098 procedure TfrmLabs.GoRemote(Dest: TStringList; AItem, AReportID: Int64; AQualifier, 3583 procedure TfrmLabs.tvReportsClick(Sender: TObject); 3584 var 3585 i: integer; 3586 ListItem: TListItem; 3587 aHeading, aReportType, aRPC, aQualifier, aStartTime, aStopTime, aMax, aRptCode, aRemote, aCategory, aSortOrder, aDaysBack, x, x1, x2: string; 3588 aIFN, aOldID: integer; 3589 aID, aHSTag, aRadParam, aColChange, aDirect, aHDR, aFHIE, aFHIEONLY, aQualifierID: string; 3590 CurrentParentNode, CurrentNode: TTreeNode; 3591 begin 3592 inherited; 3593 lvReports.Hint := 'To sort, click on column headers|'; 3594 tvReports.TopItem := tvReports.Selected; 3595 uRemoteCount := 0; 3596 uReportInstruction := ''; 3597 aHeading := PReportTreeObject(tvReports.Selected.Data)^.Heading; 3598 aRemote := PReportTreeObject(tvReports.Selected.Data)^.Remote; 3599 aReportType := PReportTreeObject(tvReports.Selected.Data)^.RptType; 3600 aQualifier := PReportTreeObject(tvReports.Selected.Data)^.Qualifier; 3601 aID := PReportTreeObject(tvReports.Selected.Data)^.ID; 3602 aRPC := PReportTreeObject(tvReports.Selected.Data)^.RPCName; 3603 aHSTag := PReportTreeObject(tvReports.Selected.Data)^.HSTag; 3604 aCategory := PReportTreeObject(tvReports.Selected.Data)^.Category; 3605 aSortOrder := PReportTreeObject(tvReports.Selected.Data)^.SortOrder; 3606 aDaysBack := PReportTreeObject(tvReports.Selected.Data)^.MaxDaysBack; 3607 aIFN := StrToIntDef(PReportTreeObject(tvReports.Selected.Data)^.IFN,0); 3608 aDirect := PReportTreeObject(tvReports.Selected.Data)^.Direct; 3609 aHDR := PReportTreeObject(tvReports.Selected.Data)^.HDR; 3610 aFHIE := PReportTreeObject(tvReports.Selected.Data)^.FHIE; 3611 aFHIEONLY := PReportTreeObject(tvReports.Selected.Data)^.FHIEONLY; 3612 aStartTime := Piece(aQualifier,';',1); 3613 aStopTime := Piece(aQualifier,';',2); 3614 aMax := Piece(aQualifier,';',3); 3615 aRptCode := Piece(aQualifier,';',4); 3616 aQualifierID:= ''; 3617 lstQualifier.ItemIndex := -1; 3618 if length(uColChange) > 0 then 3619 begin 3620 aColChange := ''; 3621 for i := 0 to lvReports.Columns.Count - 1 do 3622 aColChange := aColChange + IntToStr(lvReports.Column[i].width) + ','; 3623 if (Length(aColChange) > 0) and (aColChange <> piece(uColchange,'^',2)) then 3624 SaveColumnSizes(piece(uColChange,'^',1) + '^' + aColChange); 3625 uColChange := ''; 3626 end; 3627 if (aReportType <> 'M') and (aRPC = '') and (CharAt(aID,1) = 'H') then 3628 begin 3629 aReportType := 'R'; 3630 aRptCode := LowerCase(CharAt(aID,1)) + Copy(aID, 2, Length(aID)); 3631 aID := '1'; 3632 aRPC := 'ORWRP REPORT TEXT'; 3633 aHSTag := ''; 3634 end; 3635 uLabLocalReportData.Clear; 3636 uLabRemoteReportData.Clear; 3637 if aReportType = '' then aReportType := 'R'; 3638 uReportRPC := aRPC; 3639 uRptID := aID; 3640 uDirect := aDirect; 3641 uReportType := aReportType; 3642 uQualifier := aQualifier; 3643 uSortOrder := aSortOrder; 3644 uRemoteType := aRemote + '^' + aReportType + '^' + IntToStr(aIFN) + '^' + aHeading + '^' + aRptCode + '^' + aDaysBack + '^' + aHDR + '^' + aFHIE + '^' + aFHIEONLY; 3645 pnlRightTop.Height := lblTitle.Height; // see below 3646 RedrawSuspend(tvReports.Handle); 3647 RedrawSuspend(memLab.Handle); 3648 uHState := aHSTag; 3649 Timer1.Enabled := False; 3650 TabControl1.Visible := false; 3651 TabControl1.TabStop := false; 3652 sptHorzRight.Visible := true; 3653 lvReports.Visible := false; 3654 if (aRemote = '1') or (aRemote = '2') then 3655 if not(uReportType = 'V') then 3656 if TabControl1.Tabs.Count > 1 then 3657 begin 3658 TabControl1.Visible := true; 3659 TabControl1.TabStop := true; 3660 pnlRightTop.Height := lblTitle.Height + TabControl1.Height; 3661 end; 3662 StatusText(''); 3663 uHTMLDoc := ''; 3664 //WebBrowser1.Navigate('about:blank'); **Browser Remove** 3665 memLab.Lines.Clear; 3666 memLab.Parent := pnlRightBottom; 3667 memLab.Align := alClient; 3668 lvReports.SmallImages := uEmptyImageList; 3669 lvReports.Items.Clear; 3670 lvReports.Columns.Clear; 3671 lblHeading.Caption := ''; //clears Notification text to reduce confusion with lblTitle.Caption. 3672 DisplayHeading(''); 3673 if uReportType = 'H' then 3674 begin 3675 lvReports.Visible := false; 3676 pnlRightBottom.Visible := true; 3677 {WebBrowser1.Visible := true; **Browser Remove** 3678 WebBrowser1.TabStop := true; 3679 WebBrowser1.Navigate('about:blank'); 3680 WebBrowser1.BringToFront; } 3681 memLab.Visible := false; 3682 memLab.TabStop := false; 3683 end 3684 else 3685 if uReportType = 'V' then 3686 begin 3687 with lvReports do 3688 begin 3689 RedrawSuspend(lvReports.Handle); 3690 Columns.BeginUpdate; 3691 ViewStyle := vsReport; 3692 ColumnHeaders(uColumns, IntToStr(aIFN)); 3693 for i := 0 to uColumns.Count -1 do 3694 begin 3695 uNewColumn := Columns.Add; 3696 uNewColumn.Caption := piece(uColumns.Strings[i],'^',1); 3697 if length(uColChange) < 1 then uColChange := IntToStr(aIFN) + '^'; 3698 if piece(uColumns.Strings[i],'^',2) = '1' then 3699 begin 3700 uNewColumn.Width := 0; 3701 uColChange := uColChange + '0,'; 3702 end 3703 else 3704 if length(piece(uColumns.Strings[i],'^',10)) > 0 then 3705 begin 3706 uColChange := uColChange + piece(uColumns.Strings[i],'^',10) + ','; 3707 uNewColumn.Width := StrToInt(piece(uColumns.Strings[i],'^',10)) 3708 end 3709 else 3710 uNewColumn.Width := ColumnHeaderWidth; //ColumnTextWidth for width of text 3711 if (i = 0) and (((aRemote <> '2') and (aRemote <> '1')) or ((TabControl1.Tabs.Count < 2) and (not (aHDR = '1')))) then 3712 uNewColumn.Width := 0; 3713 end; 3714 Columns.EndUpdate; 3715 RedrawActivate(lvReports.Handle); 3716 end; 3717 lvReports.Visible := true; 3718 sptHorzRight.Visible := true; 3719 //WebBrowser1.Visible := false; **Browser Remove** 3720 //WebBrowser1.TabStop := false; **Browser Remove** 3721 pnlRightBottom.Visible := true; 3722 memLab.Visible := true; 3723 memLab.TabStop := true; 3724 memLab.BringToFront; 3725 RedrawActivate(memLab.Handle); 3726 end 3727 else 3728 begin 3729 lvReports.Visible := true; 3730 sptHorzRight.Visible := false; 3731 //WebBrowser1.Visible := false; **Browser Remove** 3732 //WebBrowser1.TabStop := false; **Browser Remove** 3733 pnlRightBottom.Visible := True; 3734 memLab.Visible := true; 3735 memLab.TabStop := true; 3736 memLab.BringToFront; 3737 RedrawActivate(memLab.Handle); 3738 end; 3739 uLocalReportData.Clear; 3740 RowObjects.Clear; 3741 uRemoteReportData.Clear; 3742 lstHeaders.Visible := false; 3743 lstHeaders.TabStop := false; 3744 lblHeaders.Visible := false; 3745 lstHeaders.Clear; 3746 for i := 0 to RemoteSites.SiteList.Count - 1 do 3747 TRemoteSite(RemoteSites.SiteList.Items[i]).LabClear; 3748 if uFrozen = True then 3749 begin 3750 memo1.visible := False; 3751 memo1.TabStop := False; 3752 end; 3753 Screen.Cursor := crHourGlass; 3754 if aReportType = 'M' then 3755 begin 3756 pnlLeftBottom.Visible := false; 3757 splitter1.Visible := false; 3758 CommonComponentVisible(false,false,false,false,false,false,false,false,false,false,false,false); 3759 memLab.Clear; 3760 chkBrowser; 3761 pnlHeader.Visible := false; 3762 sptHorzRight.Visible := true; 3763 lvReports.Visible := false; 3764 pnlRighttop.Height := lblHeading.Height; 3765 memLab.Height := pnlRight.Height - (lblHeading.Height + lblTitle.Height); 3766 pnlRightTop.Visible := true; 3767 memLab.Align := alClient; 3768 FormResize(self); 3769 end 3770 else 3771 begin 3772 uQualifierType := StrToIntDef(aRptCode,0); 3773 case uQualifierType of 3774 QT_OTHER: 3775 begin // = 0 3776 memLab.Lines.Clear; 3777 If aID = '1:MOST RECENT' then 3778 begin 3779 CommonComponentVisible(false,false,false,false,false,true,true,false,true,false,false,false); 3780 pnlRightTop.Height := pnlLeft.Height - (pnlLeft.Height div 5); 3781 pnlRightTop.Visible := true; 3782 pnlButtons.Visible := true; 3783 pnlWorksheet.Visible := false; 3784 pnlGraph.Visible := false; 3785 memLab.Align := alBottom; 3786 pnlRightTop.Align := alTop; 3787 pnlRightBottom.Align := alclient; 3788 sptHorzRight.Visible := true; 3789 pnlRightBottom.Visible := true; 3790 pnlRightBottom.Height := pnlLeft.Height div 5; 3791 memLab.Height := pnlLeft.Height div 5; 3792 grdLab.Align := alTop; 3793 memLab.Clear; 3794 {if uReportType = 'H' then **Browser Remove** 3795 begin 3796 WebBrowser1.Navigate('about:blank'); 3797 WebBrowser1.Align := alBottom; 3798 WebBrowser1.Height := pnlLeft.Height div 5; 3799 WebBrowser1.Visible := true; 3800 WebBrowser1.BringToFront; 3801 memLab.Visible := false; 3802 end 3803 else 3804 begin 3805 WebBrowser1.Visible := false; 3806 WebBrowser1.SendToBack; } 3807 memLab.Visible := true; 3808 memLab.BringToFront; 3809 //end; } 3810 FormResize(self); 3811 cmdRecentClick(self); 3812 uPrevReportNode := tvReports.Selected; 3813 end 3814 else if aID = '4:SELECTED TESTS BY DATE' then 3815 begin // Interim for Selected Tests 3816 if uPrevReportNode <> tvReports.Selected then 3817 begin 3818 lstTests.Clear; 3819 lblSpecimen.Caption := ''; 3820 end; 3821 SelectTests(Font.Size); 3822 if lstTests.Items.Count > 0 then 3823 begin 3824 CommonComponentVisible(false,false,true,true,true,false,false,false,true,false,false,false); 3825 pnlRighttop.Height := lblHeading.Height + lblTitle.Height; 3826 pnlRightTop.Visible := false; 3827 memLab.Clear; 3828 chkBrowser; 3829 FormResize(self); 3830 RedrawActivate(memLab.Handle); 3831 lstDatesClick(self); 3832 //lstQualifierClick(self); 3833 cmdOtherTests.SetFocus; 3834 cmdOtherTests.Default := true; 3835 uPrevReportNode := tvReports.Selected; 3836 end 3837 else tvReports.Selected := uPrevReportNode; 3838 end 3839 else if aID = '5:WORKSHEET' then 3840 begin // Worksheet 3841 if uPrevReportNode <> tvReports.Selected then 3842 begin 3843 lstTests.Clear; 3844 lblSpecimen.Caption := ''; 3845 end; 3846 SelectTestGroups(Font.Size); 3847 if lstTests.Items.Count > 0 then 3848 begin 3849 CommonComponentVisible(false,false,true,true,true,true,true,false,false,false,false,false); 3850 pnlRighttop.Height := pnlRight.Height - (pnlRight.Height div 4); 3851 pnlRightTop.Visible := true; 3852 pnlHeader.Align := alTop; 3853 pnlChart.Align := alTop; 3854 sptHorzRight.Visible := true; 3855 chtChart.Visible := true; 3856 memLab.Visible := false; 3857 pnlButtons.Visible := false; 3858 pnlWorksheet.Visible := true; 3859 pnlGraph.Visible := false; 3860 lstTestGraph.Width := 97; 3861 ragCorG.ItemIndex := 0; 3862 FormResize(self); 3863 lblFooter.Caption := ' KEY: "L" = Abnormal Low, "H" = Abnormal High, "*" = Critical Value, "**" = Comments on Specimen'; 3864 //chkZoom.Checked := false; 3865 //chkZoomClick(self); 3866 lstDatesClick(self); 3867 //lstQualifierClick(self); 3868 cmdOtherTests.SetFocus; 3869 cmdOtherTests.Default := true; 3870 uPrevReportNode := tvReports.Selected; 3871 if ScreenReaderSystemActive then 3872 grdLab.SetFocus; 3873 end 3874 else tvReports.Selected := uPrevReportNode; 3875 end 3876 3877 else if aID = '6:GRAPH' then 3878 begin // Graph 3879 // do if graphing is activiated 3880 if uGraphingActivated then 3881 begin 3882 memLab.Clear; 3883 chkBrowser; 3884 FormResize(self); 3885 memLab.Align := alClient; 3886 CommonComponentVisible(false,false,false,false,false,false,false,false,false,false,false,false); 3887 pnlRightTop.Visible := false; 3888 RedrawActivate(memLab.Handle); 3889 StatusText(''); 3890 memLab.Lines.Insert(0, ' '); 3891 memLab.Lines.Insert(1, 'Graphing activated'); 3892 memLab.SelStart := 0; 3893 frmFrame.mnuToolsGraphingClick(self); // make it just lab tests ?? 3894 //tvReports.Selected := uPrevReportNode; 3895 end 3896 else // otherwise, do lab graph 3897 begin 3898 if uPrevReportNode <> tvReports.Selected then 3899 begin 3900 lblSingleTest.Caption := ''; 3901 lblSpecimen.Caption := ''; 3902 end; 3903 SelectTest(Font.Size); 3904 if (length(lblSingleTest.Caption) > 2) and (length(lblSpecimen.Caption) > 2) then 3905 begin 3906 CommonComponentVisible(false,false,true,true,true,true,false,false,true,false,false,false); 3907 pnlChart.Visible := true; 3908 chtChart.Visible := true; 3909 pnlButtons.Visible := false; 3910 pnlWorksheet.Visible := false; 3911 pnlGraph.Visible := true; 3912 memLab.Height := pnlRight.Height div 5; 3913 memLab.Clear; 3914 {if uReportType = 'H' then **Browser Remove** 3915 begin 3916 WebBrowser1.Visible := true; 3917 WebBrowser1.Navigate('about:blank'); 3918 WebBrowser1.Height := pnlRight.Height div 5; 3919 WebBrowser1.BringToFront; 3920 memLab.Visible := false; 3921 end 3922 else 3923 begin 3924 WebBrowser1.Visible := false; 3925 WebBrowser1.SendToBack; } 3926 memLab.Visible := true; 3927 memLab.BringToFront; 3928 //end; } 3929 lstTestGraph.Items.Clear; 3930 lstTestGraph.Width := 0; 3931 FormResize(self); 3932 RedrawActivate(memLab.Handle); 3933 lblFooter.Caption := ''; 3934 chkGraphZoom.Checked := false; 3935 chkGraphZoomClick(self); 3936 chkGraph3DClick(self); 3937 chkGraphValuesClick(self); 3938 lstDatesClick(self); 3939 //lstQualifierClick(self); 3940 cmdOtherTests.SetFocus; 3941 cmdOtherTests.Default := true; 3942 uPrevReportNode := tvReports.Selected; 3943 end 3944 else 3945 tvReports.Selected := uPrevReportNode; 3946 end; 3947 end 3948 3949 else if (aID = '9:MICROBIOLOGY') or (aID = '20:ANATOMIC PATHOLOGY') or (aID = '2:BLOOD BANK') or (aID = '10:LAB STATUS') or (aID = '3:ALL TESTS BY DATE') or (aID = '21:CUMULATIVE') or (aID = '27:AUTOPSY') then 3950 begin 3951 //added to deal with other reports from file 101.24 3952 memLab.Clear; 3953 chkBrowser; 3954 pnlHeader.Visible := false; 3955 pnlRightTop.Visible := false; 3956 pnlRightBottom.Visible := false; 3957 sptHorzRight.Visible := false; 3958 pnlRightTop.Height := lblHeading.Height; 3959 pnlRightTop.Align := alTop; 3960 pnlRightBottom.Align := alclient; 3961 sptHorzRight.Visible := true; 3962 pnlRightBottom.Visible := true; 3963 lvReports.Visible := false; 3964 memLab.Height := pnlRight.Height - (lblHeading.Height + lblTitle.Height); 3965 memLab.Align := alClient; 3966 FormResize(self); 3967 aOldID := 1; 3968 if aID = '9:MICROBIOLOGY' then aOldID := 4; 3969 //if aID = '20:ANATOMIC PATHOLOGY' then AOldID := 8; 3970 if aID = '2:BLOOD BANK' then AOldID := 9; 3971 if aID = '10:LAB STATUS' then AOldID := 10; 3972 if aID = '3:ALL TESTS BY DATE' then AOldID := 3; 3973 if aID = '21:CUMULATIVE' then AOldID := 2; 3974 case StrToInt(aCategory) of 3975 {Categories of reports: 3976 0:Fixed 3977 1:Fixed w/Dates 3978 2:Fixed w/Headers 3979 3:Fixed w/Dates & Headers 3980 4:Specialized 3981 5:Graphic} 3982 3983 0: begin 3984 CommonComponentVisible(false,false,false,false,false,false,false,false,false,false,false,false); 3985 StatusText('Retrieving data...'); 3986 GoRemoteOld(uLabRemoteReportData,0,aOldID,'',uReportRPC,'0','9999','1',0,0); 3987 //GoRemote(uRemoteReportData, aID, aRptCode, aRPC, uHState, aHDR, aFHIE); 3988 TabControl1.OnChange(nil); 3989 Reports(uLabLocalReportData,Patient.DFN, 'L:' + Piece(aID,':',1), '0', '9999', '1', 0, 0, uReportRPC); 3990 if TabControl1.TabIndex < 1 then 3991 QuickCopy(uLabLocalReportData,memLab); 3992 RedrawActivate(memLab.Handle); 3993 StatusText(''); 3994 memLab.Lines.Insert(0,' '); 3995 memLab.Lines.Delete(0); 3996 memLab.SelStart := 0; 3997 if uReportType = 'R' then 3998 uHTMLDoc := HTML_PRE + uLabLocalReportData.Text + HTML_POST 3999 else 4000 uHTMLDoc := uHTMLPatient + uLabLocalReportData.Text; 4001 //if WebBrowser1.Visible = true then WebBrowser1.Navigate('about:blank'); **Browser Remove** 4002 end; 4003 1: begin 4004 CommonComponentVisible(false,false,false,true,true,false,false,false,false,false,false,false); 4005 memLab.Repaint; 4006 lstDatesClick(self); 4007 //lstQualifierClick(self); 4008 end; 4009 2: begin 4010 CommonComponentVisible(true,true,false,false,false,false,false,false,false,false,false,false); 4011 lstHeaders.Clear; 4012 StatusText('Retrieving data...'); 4013 GoRemoteOld(uLabRemoteReportData,0,aOldID,'',uReportRPC,'0','9999','1',0,0); 4014 //GoRemote(uRemoteReportData, aID, aRptCode, aRPC, uHState, aHDR, aFHIE); 4015 TabControl1.OnChange(nil); 4016 Reports(uLabLocalReportData,Patient.DFN, Piece(aID,':',1), '0', '9999', '1', 0, 0, uReportRPC); 4017 if uLabLocalReportData.Count > 0 then 4018 begin 4019 TabControl1.OnChange(nil); 4020 if lstHeaders.Items.Count > 0 then lstHeaders.ItemIndex := 0; 4021 end; 4022 RedrawActivate(memLab.Handle); 4023 StatusText(''); 4024 memLab.Lines.Insert(0,' '); 4025 memLab.Lines.Delete(0); 4026 if uReportType = 'R' then 4027 uHTMLDoc := HTML_PRE + uLabLocalReportData.Text + HTML_POST 4028 else 4029 uHTMLDoc := uHTMLPatient + uLabLocalReportData.Text; 4030 //if WebBrowser1.Visible = true then WebBrowser1.Navigate('about:blank'); **Browser Remove** 4031 end; 4032 3: begin 4033 CommonComponentVisible(true,true,false,true,true,false,false,false,true,false,false,false); 4034 lstDatesClick(self); 4035 //lstQualifierClick(self); 4036 memLab.Lines.Insert(0,' '); 4037 memLab.Lines.Delete(0); 4038 end; 4039 end; 4040 uPrevReportNode := tvReports.Selected; 4041 end 4042 4043 //else if aID = '20:ANATOMIC PATHOLOGY' then 4044 4045 //else if aID = '2:BLOOD BANK' then 4046 4047 //else if aID = '10:LAB STATUS' then 4048 4049 4050 else 4051 begin 4052 pnlLeftBottom.Visible := false; 4053 splitter1.Visible := false; 4054 CommonComponentVisible(true,true,false,false,false,false,false,false,false,false,false,false); 4055 pnlRightTop.Visible := true; 4056 StatusText('Retrieving ' + tvReports.Selected.Text + '...'); 4057 GoRemote(uRemoteReportData, 'L:' + aID, aRptCode, aRPC, uHState, aHDR, aFHIE); 4058 uReportInstruction := #13#10 + 'Retrieving data...'; 4059 TabControl1.OnChange(nil); 4060 if not(piece(uRemoteType, '^', 9) = '1') then 4061 LoadReportText(uLocalReportData, 'L:' + aID, aRptCode, aRPC, uHState); 4062 QuickCopy(uLocalReportData, memLab); 4063 if uLocalReportData.Count > 0 then 4064 TabControl1.OnChange(nil); 4065 StatusText(''); 4066 uPrevReportNode := tvReports.Selected; 4067 end; 4068 end; 4069 QT_DATERANGE: 4070 begin // = 2 4071 4072 ListReportDateRanges(lstQualifier.Items); 4073 if lstQualifier.ItemID = '' then 4074 begin 4075 lstQualifier.ItemIndex := lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4076 lvReports.SmallImages := uEmptyImageList; 4077 lvReports.Items.Clear; 4078 lstQualifierClick(self); 4079 end 4080 else 4081 lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4082 4083 lblQualifier.Caption := 'Date Range'; 4084 pnlLeftBottom.Visible := true; 4085 splitter1.Visible := true; 4086 uPrevReportNode := tvReports.Selected; 4087 end; 4088 QT_HSCOMPONENT: 4089 begin // = 5 4090 pnlRightTop.Height := pnlRight.Height - (pnlRight.Height div 4); 4091 pnlLeftBottom.Visible := false; 4092 splitter1.Visible := false; 4093 StatusText('Retrieving ' + tvReports.Selected.Text + '...'); 4094 uReportInstruction := #13#10 + 'Retrieving data...'; 4095 CommonComponentVisible(false,false,false,false,false,false,false,false,false,false,true,true); 4096 pnlRightTop.Visible := true; 4097 lvReports.Visible := true; 4098 lvReports.SmallImages := uEmptyImageList; 4099 lvReports.Items.Clear; 4100 RowObjects.Clear; 4101 memLab.Lines.Clear; 4102 if (length(piece(aHSTag,';',2)) > 0) then 4103 begin 4104 if aCategory <> '0' then 4105 begin 4106 ListReportDateRanges(lstQualifier.Items); 4107 aQualifierID := lstQualifier.ItemID; 4108 if aQualifierID = '' then 4109 begin 4110 if aHDR = '1' then 4111 lstQualifier.ItemIndex := lstQualifier.Items.Add('T-50000' + ';' + 'T+50000' + '^' + 'T-50000' + ' to ' + 'T+50000') 4112 else 4113 if length(aStartTime) > 0 then lstQualifier.ItemIndex := lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4114 lstQualifierClick(self); 4115 end 4116 else 4117 begin 4118 GoRemote(uRemoteReportData, 'L:' + aID, aQualifier, aRPC, uHState, aHDR, aFHIE); 4119 if aHDR = '1' then 4120 lstQualifier.ItemIndex := lstQualifier.Items.Add('T-50000' + ';' + 'T+50000' + '^' + 'T-50000' + ' to ' + 'T+50000') 4121 else 4122 if length(aStartTime) > 0 then lstQualifier.ItemIndex := lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4123 lstQualifierClick(self); 4124 end; 4125 lblQualifier.Caption := 'Date Range'; 4126 pnlLeftBottom.Visible := true; 4127 splitter1.Visible := true; 4128 end 4129 else 4130 begin 4131 if not (aRemote = '2' ) then 4132 GoRemote(uRemoteReportData, 'L:' + aID, aQualifier, aRPC, uHState, aHDR, aFHIE); 4133 if not(piece(uRemoteType, '^', 9) = '1') then 4134 begin 4135 LoadReportText(uLocalReportData, 'L:' + aID, aQualifier, aRPC, uHState); 4136 LoadListView(uLocalReportData); 4137 end; 4138 end; 4139 end 4140 else 4141 begin 4142 if (aRemote = '1') or (aRemote = '2') then 4143 if TabControl1.Tabs.Count > 1 then 4144 ShowTabControl; 4145 GoRemote(uRemoteReportData, 'L:' + aID, aQualifier, aRPC, uHState, aHDR, aFHIE); 4146 if not(piece(uRemoteType, '^', 9) = '1') then 4147 LoadReportText(uLocalReportData, 'L:' + aID, aQualifier, aRPC, uHState); 4148 if uLocalReportData.Count < 1 then 4149 uReportInstruction := '<No Report Available>' 4150 else 4151 begin 4152 if TabControl1.TabIndex < 1 then 4153 QuickCopy(uLocalReportData,memLab); 4154 end; 4155 TabControl1.OnChange(nil); 4156 if aCategory <> '0' then 4157 begin 4158 ListReportDateRanges(lstQualifier.Items); 4159 if lstQualifier.ItemID = '' then 4160 begin 4161 lstQualifier.ItemIndex := lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4162 lstQualifierClick(self); 4163 end 4164 else 4165 lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4166 4167 lblQualifier.Caption := 'Date Range'; 4168 pnlLeftBottom.Visible := true; 4169 splitter1.Visible := true; 4170 end 4171 else 4172 begin 4173 if uLocalReportData.Count < 1 then 4174 begin 4175 uReportInstruction := '<No Report Available>'; 4176 memLab.Lines.Add(uReportInstruction); 4177 end 4178 else 4179 begin 4180 QuickCopy(uLocalReportData,memLab); 4181 TabControl1.OnChange(nil); 4182 end; 4183 end; 4184 end; 4185 StatusText(''); 4186 uPrevReportNode := tvReports.Selected; 4187 end; 4188 QT_HSWPCOMPONENT: 4189 begin // = 6 4190 if uScreenSplitMoved = false then 4191 begin 4192 pnlRightTop.Height := pnlRight.Height - (pnlRight.Height div 2); 4193 uScreenSplitLoc := sptHorzRight.Top; 4194 end 4195 else 4196 pnlRightTop.Height := uScreenSplitLoc; 4197 pnlLeftBottom.Visible := false; 4198 splitter1.Visible := false; 4199 StatusText('Retrieving ' + tvReports.Selected.Text + '...'); 4200 uReportInstruction := #13#10 + 'Retrieving data...'; 4201 CommonComponentVisible(false,false,false,false,false,false,false,false,false,false,false,false); 4202 pnlRightTop.Visible := true; 4203 lvReports.Visible := true; 4204 sptHorzRight.Visible := true; 4205 memLab.Visible := true; 4206 TabControl1.OnChange(nil); 4207 RowObjects.Clear; 4208 memLab.Lines.Clear; 4209 lvReports.SmallImages := uEmptyImageList; 4210 lvReports.Items.Clear; 4211 if (length(piece(aHSTag,';',2)) > 0) then 4212 begin 4213 if aCategory <> '0' then 4214 begin 4215 ListReportDateRanges(lstQualifier.Items); 4216 aQualifierID := lstQualifier.ItemID; 4217 if aQualifierID = '' then 4218 begin 4219 if aHDR = '1' then 4220 lstQualifier.ItemIndex := lstQualifier.Items.Add('T-50000' + ';' + 'T+50000' + '^' + 'T-50000' + ' to ' + 'T+50000') 4221 else 4222 if length(aStartTime) > 0 then lstQualifier.ItemIndex := lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4223 lstQualifierClick(self); 4224 end 4225 else 4226 begin 4227 GoRemote(uRemoteReportData, 'L:' + aID, aQualifier, aRPC, uHState, aHDR, aFHIE); 4228 if aHDR = '1' then 4229 lstQualifier.ItemIndex := lstQualifier.Items.Add('T-50000' + ';' + 'T+50000' + '^' + 'T-50000' + ' to ' + 'T+50000') 4230 else 4231 if length(aStartTime) > 0 then lstQualifier.ItemIndex := lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4232 lstQualifierClick(self); 4233 end; 4234 lblQualifier.Caption := 'Date Range'; 4235 CommonComponentVisible(false,false,false,false,false,false,false,false,false,true,true,true); 4236 pnlLeftBottom.Visible := true; 4237 splitter1.Visible := true; 4238 end 4239 else 4240 begin 4241 GoRemote(uRemoteReportData, 'L:' + aID, aQualifier, aRPC, uHState, aHDR, aFHIE); 4242 if not (aRemote = '2' ) and (not(piece(uRemoteType, '^', 9) = '1')) then 4243 begin 4244 LoadReportText(uLocalReportData, 'L:' + aID, aQualifier, aRPC, uHState); 4245 LoadListView(uLocalReportData); 4246 end; 4247 end; 4248 end 4249 else 4250 begin 4251 if (aRemote = '1') or (aRemote = '2') then 4252 ShowTabControl; 4253 GoRemote(uRemoteReportData, 'L:' + aID, aQualifier, aRPC, uHState, aHDR, aFHIE); 4254 if not(piece(uRemoteType, '^', 9) = '1') then 4255 LoadReportText(uLocalReportData, 'L:' + aID, aQualifier, aRPC, uHState); 4256 if uLocalReportData.Count < 1 then 4257 uReportInstruction := '<No Report Available>' 4258 else 4259 begin 4260 if TabControl1.TabIndex < 1 then 4261 QuickCopy(uLocalReportData,memLab); 4262 end; 4263 TabControl1.OnChange(nil); 4264 if aCategory <> '0' then 4265 begin 4266 4267 ListReportDateRanges(lstQualifier.Items); 4268 if lstQualifier.ItemID = '' then 4269 begin 4270 lstQualifier.ItemIndex := lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4271 lstQualifierClick(self); 4272 end 4273 else 4274 lstQualifier.Items.Add(aStartTime + ';' + aStopTime + '^' + aStartTime + ' to ' + aStopTime); 4275 4276 lblQualifier.Caption := 'Date Range'; 4277 pnlLeftBottom.Visible := true; 4278 splitter1.Visible := true; 4279 end 4280 else 4281 begin 4282 LoadListView(uLocalReportData); 4283 end; 4284 end; 4285 StatusText(''); 4286 uPrevReportNode := tvReports.Selected; 4287 end; 4288 else 4289 begin // = ? 4290 uQualifierType := QT_OTHER; 4291 pnlLeftBottom.Visible := false; 4292 splitter1.Visible := false; 4293 StatusText('Retrieving ' + tvReports.Selected.Text + '...'); 4294 GoRemote(uRemoteReportData, 'L:' + aID, aRptCode, aRPC, uHState, aHDR, aFHIE); 4295 uReportInstruction := #13#10 + 'Retrieving data...'; 4296 TabControl1.OnChange(nil); 4297 //LoadReportText(uLocalReportData, 'L:' + aID, aRptCode, aRPC, uHState); 4298 if not(piece(uRemoteType, '^', 9) = '1') then 4299 LoadReportText(uLocalReportData, 'L:' + aID, '', aRPC, uHState); 4300 if uLocalReportData.Count < 1 then 4301 uReportInstruction := '<No Report Available>' 4302 else 4303 begin 4304 if TabControl1.TabIndex < 1 then 4305 QuickCopy(uLocalReportData,memLab); 4306 end; 4307 TabControl1.OnChange(nil); 4308 StatusText(''); 4309 uPrevReportNode := tvReports.Selected; 4310 end; 4311 lstQualifier.Caption := lblQualifier.Caption; 4312 end; 4313 end; 4314 if lstQualifier.ItemIndex > -1 then 4315 begin 4316 if not (aHDR = '1') then 4317 if aCategory <> '0' then 4318 DisplayHeading(uQualifier) 4319 else 4320 DisplayHeading(''); 4321 end 4322 else 4323 begin 4324 if not (aHDR = '1') then 4325 if aCategory <> '0' then 4326 begin 4327 //lstDatesClick(self); 4328 x := lstDates.DisplayText[lstDates.ItemIndex]; 4329 x1 := piece(x,' ',1); 4330 x2 := piece(x,' ',2); 4331 if (Uppercase(Copy(x1,1,1)) = 'T') and (Uppercase(Copy(x2,1,1)) = 'T') then 4332 DisplayHeading(piece(x,' ',1) + ';' + piece(x,' ',2)) 4333 else 4334 DisplayHeading('d' + lstDates.ItemID); 4335 end 4336 else 4337 DisplayHeading(''); 4338 end; 4339 4340 SendMessage(tvReports.Handle, WM_HSCROLL, SB_THUMBTRACK, 0); 4341 RedrawActivate(tvReports.Handle); 4342 4343 memLab.Visible := true; 4344 memLab.TabStop := true; 4345 memLab.BringToFront; 4346 RedrawActivate(memLab.Handle); 4347 4348 {if WebBrowser1.Visible = true then **Browser Remove** 4349 begin 4350 WebBrowser1.Navigate('about:blank'); 4351 WebBrowser1.BringToFront; 4352 end } 4353 {else if not GraphFormActive then 4354 begin 4355 memLab.Visible := true; 4356 memLab.TabStop := true; 4357 memLab.BringToFront; 4358 RedrawActivate(memLab.Handle); 4359 end} 4360 //else **Browser Remove** 4361 //begin **Browser Remove** 4362 {GraphPanel(true); 4363 with GraphForm do 4364 begin 4365 lstDateRange.Items := cboDateRange.Items; 4366 lstDateRange.ItemIndex := cboDateRange.ItemIndex; 4367 ViewSelections; 4368 BringToFront; 4369 end; } 4370 //end; **Browser Remove** 4371 lvReports.Columns.BeginUpdate; 4372 lvReports.Columns.EndUpdate; 4373 Screen.Cursor := crDefault; 4374 end; 4375 4376 procedure TfrmLabs.tvReportsCollapsing(Sender: TObject; Node: TTreeNode; 4377 var AllowCollapse: Boolean); 4378 begin 4379 inherited; 4380 tvReports.Selected := Node; 4381 end; 4382 4383 procedure TfrmLabs.tvReportsExpanding(Sender: TObject; Node: TTreeNode; 4384 var AllowExpansion: Boolean); 4385 begin 4386 inherited; 4387 tvReports.Selected := Node; 4388 end; 4389 4390 procedure TfrmLabs.tvReportsKeyDown(Sender: TObject; var Key: Word; 4391 Shift: TShiftState); 4392 begin 4393 inherited; 4394 case Key of 4395 VK_LBUTTON, VK_RETURN, VK_SPACE: 4396 begin 4397 tvReportsClick(Sender); 4398 Key := 0; 4399 end; 4400 end; 4401 end; 4402 4403 procedure TfrmLabs.GoRemote(Dest: TStringList; AItem: string; AQualifier, ARpc: string; AHSTag: string; AHDR: string; aFHIE: string); 4404 var 4405 i, j: integer; 4406 LocalHandle, Query, Report, Seq: string; 4407 HSType, DaysBack, ExamID, MaxOcc: string; 4408 Alpha, Omega, Trans: double; 4409 begin 4410 HSType := ''; 4411 DaysBack := ''; 4412 ExamID := ''; 4413 Alpha := 0; 4414 Omega := 0; 4415 Seq := ''; 4416 if AHDR = '1' then 4417 begin 4418 if HDRActive = '0' then 4419 begin 4420 InfoBox('The HDR is currently inactive.' + CRLF + 'Unable to retrieve HDR data at this time.', 'HDR Error', MB_OK); 4421 Exit; 4422 end; 4423 InfoBox('You must use VistaWeb to view this report.', 'Use VistaWeb for HDR data', MB_OK); 4424 if (Piece(AItem, ':', 1) = 'OR_VWAL') or (Piece(AItem, ':', 1) = 'OR_VWRX') then 4425 AQualifier := 'T-50000;T+50000;99999'; 4426 if (Piece(AItem, ':', 1) = 'OR_VWVS') and (CharAt(AQualifier, 1) = ';') then 4427 AQualifier := 'T-50000;T+50000;99999'; 4428 end; 4429 if CharAt(AQualifier, 1) = 'd' then 4430 begin 4431 DaysBack := Copy(AQualifier, 2, Length(AQualifier)); 4432 AQualifier := ('T-' + Piece(DaysBack,';',1) + ';T;' + Pieces(AQualifier,';',2,3)); 4433 DaysBack := ''; 4434 end; 4435 if CharAt(AQualifier, 1) = 'T' then 4436 begin 4437 if Piece(AQualifier,';',1) = 'T-0' then SetPiece(AQualifier,';',1,'T'); 4438 if (Piece(Aqualifier,';',1) = 'T') and (Piece(Aqualifier,';',2) = 'T') 4439 then SetPiece(AQualifier,';',2,'T+1'); 4440 Alpha := StrToFMDateTime(Piece(AQualifier,';',1)); 4441 Omega := StrToFMDateTime(Piece(AQualifier,';',2)); 4442 if Alpha > Omega then 4443 begin 4444 Trans := Omega; 4445 Omega := Alpha; 4446 Alpha := Trans; 4447 end; 4448 MaxOcc := Piece(AQualifier,';',3); 4449 SetPiece(AHSTag,';',4,MaxOcc); 4450 end; 4451 if CharAt(AQualifier, 1) = 'h' then HSType := Copy(AQualifier, 2, Length(AQualifier)); 4452 if CharAt(AQualifier, 1) = 'i' then ExamID := Copy(AQualifier, 2, Length(AQualifier)); 4453 with RemoteSites.SiteList do for i := 0 to Count - 1 do 4454 begin 4455 if (AHDR='1') and (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200HD') then 4456 begin 4457 TRemoteSite(Items[i]).Selected := true; 4458 frmFrame.lstCIRNLocations.Checked[i+2] := true; 4459 end; 4460 if TRemoteSite(Items[i]).Selected then 4461 begin 4462 TRemoteSite(Items[i]).ReportClear; 4463 if (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200HD') and not(AHDR = '1') then 4464 begin 4465 TRemoteSite(Items[i]).QueryStatus := '1^Not Included'; 4466 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED'); 4467 TRemoteSite(Items[i]).RemoteHandle := ''; 4468 TRemoteSite(Items[i]).QueryStatus := '1^Done'; 4469 if uQualifierType = 6 then seq := '1^'; 4470 TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName); 4471 if uQualifierType = 6 then seq := '2^'; 4472 TRemoteSite(Items[i]).Data.Add(seq + '<No HDR Data Included> - Use "HDR Reports" menu for HDR Data.'); 4473 TabControl1.OnChange(nil); 4474 if (length(piece(uHState,';',2)) > 0) then 4475 LoadListView(TRemoteSite(Items[i]).Data); 4476 continue; 4477 end; 4478 if (AHDR = '1') and not(LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200HD') then 4479 begin 4480 TRemoteSite(Items[i]).QueryStatus := '1^Not Included'; 4481 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED'); 4482 TRemoteSite(Items[i]).RemoteHandle := ''; 4483 TRemoteSite(Items[i]).QueryStatus := '1^Done'; 4484 if uQualifierType = 6 then seq := '1^'; 4485 TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName); 4486 if uQualifierType = 6 then seq := '2^'; 4487 TRemoteSite(Items[i]).Data.Add(seq + '<No HDR Data> This site is not a source for HDR Data.'); 4488 TabControl1.OnChange(nil); 4489 if (length(piece(uHState,';',2)) > 0) then 4490 LoadListView(TRemoteSite(Items[i]).Data); 4491 continue; 4492 end; 4493 if (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200') and not(aFHIE = '1') then 4494 begin 4495 TRemoteSite(Items[i]).QueryStatus := '1^Not Included'; 4496 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED'); 4497 TRemoteSite(Items[i]).RemoteHandle := ''; 4498 TRemoteSite(Items[i]).QueryStatus := '1^Done'; 4499 if uQualifierType = 6 then seq := '1^'; 4500 TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName); 4501 if uQualifierType = 6 then seq := '2^'; 4502 TRemoteSite(Items[i]).Data.Add(seq + '<No DOD Data> - Use "Dept. of Defense Reports" Menu to retrieve data from DOD.'); 4503 TabControl1.OnChange(nil); 4504 if (length(piece(uHState,';',2)) > 0) then 4505 LoadListView(TRemoteSite(Items[i]).Data); 4506 continue; 4507 end; 4508 TRemoteSite(Items[i]).CurrentReportQuery := 'Report' + Patient.DFN + ';' 4509 + Patient.ICN + '^' + AItem + '^^^' + ARpc + '^' + HSType + 4510 '^' + DaysBack + '^' + ExamID + '^' + FloatToStr(Alpha) + '^' + 4511 FloatToStr(Omega) + '^' + TRemoteSite(Items[i]).SiteID + '^' + AHSTag + '^' + AHDR; 4512 LocalHandle := ''; 4513 Query := TRemoteSite(Items[i]).CurrentReportQuery; 4514 for j := 0 to RemoteReports.Count - 1 do 4515 begin 4516 Report := TRemoteReport(RemoteReports.ReportList.Items[j]).Report; 4517 if Report = Query then 4518 begin 4519 LocalHandle := TRemoteReport(RemoteReports.ReportList.Items[j]).Handle; 4520 break; 4521 end; 4522 end; 4523 if Length(LocalHandle) > 1 then 4524 with RemoteSites.SiteList do 4525 begin 4526 GetRemoteData(TRemoteSite(Items[i]).Data,LocalHandle,Items[i]); 4527 TRemoteSite(Items[i]).RemoteHandle := ''; 4528 TRemoteSite(Items[i]).QueryStatus := '1^Done'; 4529 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Done'); 4530 TabControl1.OnChange(nil); 4531 if (length(piece(uHState,';',2)) > 0) then //and (chkText.Checked = false) then 4532 LoadListView(TRemoteSite(Items[i]).Data); 4533 end 4534 else 4535 begin 4536 if uDirect = '1' then 4537 begin 4538 StatusText('Retrieving reports from ' + TRemoteSite(Items[i]).SiteName + '...'); 4539 TRemoteSite(Items[i]).QueryStatus := '1^Direct Call'; 4540 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Direct Call'); 4541 DirectQuery(Dest, AItem, HSType, Daysback, ExamID, Alpha, Omega, TRemoteSite(Items[i]).SiteID, ARpc, AHSTag); 4542 if Copy(Dest[0],1,2) = '-1' then 4543 begin 4544 TRemoteSite(Items[i]).QueryStatus := '-1^Communication error'; 4545 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID,'Communication error'); 4546 if uQualifierType = 6 then seq := '1^'; 4547 TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName); 4548 if uQualifierType = 6 then seq := '2^'; 4549 TRemoteSite(Items[i]).Data.Add(seq + '<ERROR>- Unable to communicate with Remote site'); 4550 TabControl1.OnChange(nil); 4551 if (length(piece(uHState,';',2)) > 0) then 4552 LoadListView(TRemoteSite(Items[i]).Data); 4553 end 4554 else 4555 begin 4556 QuickCopy(Dest,TRemoteSite(Items[i]).Data); 4557 TRemoteSite(Items[i]).RemoteHandle := ''; 4558 TRemoteSite(Items[i]).QueryStatus := '1^Done'; 4559 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Done'); 4560 TabControl1.OnChange(nil); 4561 if (length(piece(uHState,';',2)) > 0) then 4562 LoadListView(TRemoteSite(Items[i]).Data); 4563 end; 4564 StatusText(''); 4565 end 4566 else 4567 begin 4568 RemoteQuery(Dest, AItem, HSType, Daysback, ExamID, Alpha, Omega, TRemoteSite(Items[i]).SiteID, ARpc, AHSTag); 4569 if Dest[0] = '' then 4570 begin 4571 TRemoteSite(Items[i]).QueryStatus := '-1^Communication error'; 4572 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID,'Communication error'); 4573 if uQualifierType = 6 then seq := '1^'; 4574 TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName); 4575 if uQualifierType = 6 then seq := '2^'; 4576 TRemoteSite(Items[i]).Data.Add(seq + '<ERROR>- Unable to communicate with Remote site'); 4577 TabControl1.OnChange(nil); 4578 if (length(piece(uHState,';',2)) > 0) then 4579 LoadListView(TRemoteSite(Items[i]).Data); 4580 end 4581 else 4582 begin 4583 TRemoteSite(Items[i]).RemoteHandle := Dest[0]; 4584 TRemoteSite(Items[i]).QueryStatus := '0^initialization...'; 4585 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'initialization'); 4586 Timer1.Enabled := True; 4587 StatusText('Retrieving reports from ' + TRemoteSite(Items[i]).SiteName + '...'); 4588 end; 4589 end; 4590 end; 4591 end; 4592 end; 4593 end; 4594 4595 procedure TfrmLabs.GoRemoteOld(Dest: TStringList; AItem, AReportID: Int64; AQualifier, 2099 4596 ARpc, AHSType, ADaysBack, ASection: string; ADate1, ADate2: TFMDateTime); 2100 4597 var 2101 4598 i,j: integer; 2102 LocalHandle, Report, Query : String;4599 LocalHandle, Report, Query, seq: String; 2103 4600 begin 2104 4601 { AReportID := 1 Generic report RemoteLabReports … … 2106 4603 3 Interim RemoteLabInterim 2107 4604 4 Microbioloby RemoteLabMicro } 4605 seq := ''; 2108 4606 with RemoteSites.SiteList do 2109 4607 for i := 0 to Count - 1 do … … 2118 4616 continue; 2119 4617 end; 4618 if (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200') then 4619 begin 4620 TRemoteSite(Items[i]).QueryStatus := '1^Not Included'; 4621 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED'); 4622 TabControl1.OnChange(nil); 4623 continue; 4624 end; 2120 4625 TRemoteSite(Items[i]).CurrentLabQuery := 'Lab' + Patient.DFN + ';' + Patient.ICN + 2121 '^' + IntToStr(AItem) + '^' + IntToStr(AReportID) + '^^' + ARpc + '^' + AHSType +4626 '^' + IntToStr(AItem) + '^' + 'L:' + IntToStr(AReportID) + '^^' + ARpc + '^' + AHSType + 2122 4627 '^' + ADaysBack + '^' + ASection + '^' + DateToStr(ADate1) + '^' + DateToStr(ADate2) + '^' + 2123 4628 TRemoteSite(Items[i]).SiteID; … … 2256 4761 end; 2257 4762 2258 procedure TfrmLabs.WebBrowser1DocumentComplete(Sender: TObject; 4763 procedure TfrmLabs.WebBrowser1DocumentComplete(Sender: TObject; //**Browser Remove** 2259 4764 const pDisp: IDispatch; var URL: OleVariant); 2260 4765 var 2261 WebDoc: IHtmlDocument2;4766 //WebDoc: IHtmlDocument2; **Browser Remove** 2262 4767 v: variant; 2263 4768 begin 2264 4769 inherited; 2265 4770 if uHTMLDoc = '' then Exit; 2266 if not(uReportType = 'H') then Exit; //this can be removed if & when browser replaces mem textcontrol2267 if not Assigned(WebBrowser1.Document) then Exit;2268 WebDoc := WebBrowser1.Document as IHtmlDocument2;4771 if not(uReportType = 'H') then Exit; //this can be removed if & when browser replaces memLab control 4772 //if not Assigned(WebBrowser1.Document) then Exit; **Browser Remove** 4773 //WebDoc := WebBrowser1.Document as IHtmlDocument2; **Browser Remove** 2269 4774 v := VarArrayCreate([0, 0], varVariant); 2270 4775 v[0] := uHTMLDoc; 2271 WebDoc.write(PSafeArray(TVarData(v).VArray));2272 WebDoc.close;4776 //WebDoc.write(PSafeArray(TVarData(v).VArray)); **Browser Remove** 4777 //WebDoc.close; **Browser Remove** 2273 4778 //uHTMLDoc := ''; 2274 4779 end; 2275 4780 2276 procedure TfrmLabs.ChkBrowser; 2277 begin 2278 if uReportType = 'H' then4781 procedure TfrmLabs.ChkBrowser; // **Browser Remove** 4782 begin 4783 {if uReportType = 'H' then **Browser Remove** 2279 4784 begin 2280 4785 WebBrowser1.Visible := true; … … 2286 4791 begin 2287 4792 WebBrowser1.Visible := false; 2288 WebBrowser1.SendToBack; 4793 WebBrowser1.SendToBack; } 2289 4794 memLab.Visible := true; 2290 4795 memLab.BringToFront; 2291 end;2292 end; 2293 2294 procedure TfrmLabs.CommonComponentVisible(A1,A2,A3,A4,A5,A6,A7,A8,A9 : Boolean);4796 //end; } 4797 end; 4798 4799 procedure TfrmLabs.CommonComponentVisible(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12: Boolean); 2295 4800 begin 2296 4801 lstDates.Visible := false; // turned off to realign correctly 2297 4802 lblDates.Visible := false; 4803 lstQualifier.Visible := false; 4804 lblQualifier.Visible := false; 2298 4805 pnlOtherTests.Visible := false; 2299 4806 lstHeaders.Visible := false; 2300 4807 lblHeaders.Visible := false; 4808 sptHorzRight.Visible := false; 4809 lblHeaders.Visible := A1; 4810 lstHeaders.Visible := A2; 4811 lblQualifier.Visible := A11; 4812 lstQualifier.Visible := A12; 4813 lblDates.Visible := A4; 2301 4814 lstDates.Visible := A5; // reordered to realign 2302 lblDates.Visible := A4;2303 4815 pnlOtherTests.Visible := A3; 2304 lstHeaders.Visible := A2;2305 lblHeaders.Visible := A1;2306 4816 pnlHeader.Visible := A6; 2307 4817 grdLab.Visible := A7; 2308 4818 pnlChart.Visible := A8; 2309 4819 pnlFooter.Visible := A9; 4820 lvReports.Visible := A10; 4821 sptHorzRight.Visible := A10; 2310 4822 if A4 and A1 and (lblDates.Top < lblHeaders.Top) then 2311 4823 begin … … 2320 4832 lstDates.Caption := lblDates.Caption; 2321 4833 lstHeaders.Caption := lblHeaders.Caption; 4834 if A4 or A2 or A12 then 4835 begin 4836 pnlLeftBottom.Visible := true; 4837 Splitter1.Visible := true; 4838 end; 4839 end; 4840 4841 procedure TfrmLabs.ShowTabControl; 4842 begin 4843 if TabControl1.Tabs.Count > 1 then 4844 begin 4845 TabControl1.Visible := true; 4846 TabControl1.TabStop := true; 4847 pnlRightTop.Height := lblTitle.Height + TabControl1.Height; 4848 end; 4849 end; 4850 4851 procedure TfrmLabs.Splitter1CanResize(Sender: TObject; var NewSize: Integer; 4852 var Accept: Boolean); 4853 begin 4854 inherited; 4855 if NewSize < 150 then 4856 Newsize := 150; 4857 end; 4858 4859 procedure TfrmLabs.sptHorzRightCanResize(Sender: TObject; var NewSize: Integer; 4860 var Accept: Boolean); 4861 begin 4862 inherited; 4863 if NewSize < 10 then 4864 Newsize := 10; 4865 end; 4866 4867 procedure TfrmLabs.sptHorzRightMoved(Sender: TObject); 4868 begin 4869 inherited; 4870 uScreenSplitMoved := true; 4871 uScreenSplitLoc := sptHorzRight.Top; 2322 4872 end; 2323 4873 … … 2345 4895 end; 2346 4896 4897 { TGrdLab508Manager } 4898 4899 constructor TGrdLab508Manager.Create; 4900 begin 4901 inherited Create([mtValue, mtItemChange]); 4902 end; 4903 4904 function TGrdLab508Manager.GetItem(Component: TWinControl): TObject; 4905 var 4906 sg : TCaptionStringGrid; 4907 begin 4908 sg := TCaptionStringGrid(Component); 4909 Result := TObject(sg.Selection.Top + sg.Selection.Left); 4910 end; 4911 4912 function TGrdLab508Manager.GetTextToSpeak(sg: TCaptionStringGrid): String; 4913 var 4914 textToSpeak : String; 4915 CurrRowStrings,HeaderStrings : TStrings; 4916 i : integer; 4917 begin 4918 textToSpeak := ''; 4919 HeaderStrings := sg.Rows[0]; 4920 CurrRowStrings := sg.Rows[sg.Selection.Top]; 4921 for i := 0 to CurrRowStrings.Count - 1 do begin 4922 textToSpeak := TextToSpeak + ', ' + HeaderStrings[i] + ', ' + ToBlankIfEmpty(CurrRowStrings[i]); 4923 end; 4924 Result := textToSpeak; 4925 end; 4926 4927 function TGrdLab508Manager.GetValue(Component: TWinControl): string; 4928 var 4929 sg : TCaptionStringGrid; 4930 begin 4931 sg := TCaptionStringGrid(Component); 4932 Result := GetTextToSpeak(sg); 4933 end; 4934 4935 function TGrdLab508Manager.ToBlankIfEmpty(aString: String): String; 4936 begin 4937 Result := aString; 4938 if aString = '' then 4939 Result := 'blank'; 4940 end; 4941 4942 initialization 4943 SpecifyFormIsNotADialog(TfrmLabs); 4944 2347 4945 end.
Note:
See TracChangeset
for help on using the changeset viewer.