Changeset 460 for cprs/branches/foia-cprs/CPRS-Chart/fFrame.pas
- Timestamp:
- Jul 6, 2008, 8:20:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/foia-cprs/CPRS-Chart/fFrame.pas
r459 r460 5 5 {$OPTIMIZATION OFF} // REMOVE AFTER UNIT IS DEBUGGED 6 6 {$WARN SYMBOL_PLATFORM OFF} 7 {$DEFINE CCOWBROKER} 7 8 8 9 {.$define debug} … … 120 121 mnuAlertRenew: TMenuItem; 121 122 AppEvents: TApplicationEvents; 123 paVAA: TKeyClickPanel; 124 mnuToolsGraphing: TMenuItem; 125 laVAA2: TButton; 126 laMHV: TButton; 127 lblCIRNAvail: TLabel; 128 mnuViewInformation: TMenuItem; 129 mnuViewVisits: TMenuItem; 130 mnuViewPrimaryCare: TMenuItem; 131 mnuViewMyHealtheVet: TMenuItem; 132 mnuInsurance: TMenuItem; 133 mnuViewFlags: TMenuItem; 134 mnuViewRemoteData: TMenuItem; 122 135 procedure tabPageChange(Sender: TObject); 123 136 procedure FormCreate(Sender: TObject); … … 142 155 procedure mnuHelpBrokerClick(Sender: TObject); 143 156 procedure mnuFileEncounterClick(Sender: TObject); 144 procedure mnuViewDemoClick(Sender: TObject);145 157 procedure mnuViewPostingsClick(Sender: TObject); 146 158 procedure mnuHelpAboutClick(Sender: TObject); … … 171 183 function FormHelp(Command: Word; Data: Integer; 172 184 var CallHelp: Boolean): Boolean; 173 procedure mnuViewRemindersClick(Sender: TObject);174 185 procedure pnlRemindersMouseDown(Sender: TObject; Button: TMouseButton; 175 186 Shift: TShiftState; X, Y: Integer); … … 219 230 procedure AppEventsActivate(Sender: TObject); 220 231 procedure ScreenActiveFormChange(Sender: TObject); 232 procedure AppEventsShortCut(var Msg: TWMKey; var Handled: Boolean); 221 233 procedure mnuToolsClick(Sender: TObject); 234 procedure mnuToolsGraphingClick(Sender: TObject); 235 procedure pnlCIRNMouseDown(Sender: TObject; Button: TMouseButton; 236 Shift: TShiftState; X, Y: Integer); 237 procedure pnlCIRNMouseUp(Sender: TObject; Button: TMouseButton; 238 Shift: TShiftState; X, Y: Integer); 239 procedure laMHVClick(Sender: TObject); 240 procedure laVAA2Click(Sender: TObject); 241 procedure ViewInfo(Sender: TObject); 242 procedure mnuViewInformationClick(Sender: TObject); 222 243 private 223 244 FJustEnteredApp : boolean; … … 228 249 FCCOWBusy: boolean; 229 250 FCCOWError: boolean; 251 FNoPatientSelected: boolean; 230 252 FRefreshing: boolean; 231 253 FClosing: boolean; … … 242 264 FTabChanged: TNotifyEvent; 243 265 FOldActivate: TNotifyEvent; 266 FOldActiveFormChange: TNotifyEvent; 244 267 FECSAuthUser: Boolean; 245 268 FFixedStatusWidth: integer; … … 248 271 FFlagList: TStringList; 249 272 FPrevPtID: string; 273 FVitalsDLLActive: boolean; 274 FGraphFloatActive: boolean; 275 FGraphContext: string; 250 276 procedure RefreshFixedStatusWidth; 277 procedure FocusApplicationTopForm; 251 278 procedure AppActivated(Sender: TObject); 252 279 procedure AppDeActivated(Sender: TObject); … … 272 299 procedure SetDebugMenu; 273 300 procedure SetupPatient(AFlaggedList : TStringList = nil); 274 procedure SetUpCIRN;301 //procedure SetUpCIRN; 275 302 procedure RemindersChanged(Sender: TObject); 276 303 procedure ReportsOnlyDisplay; … … 283 310 procedure UpdateECSParameter(var CmdParameter: string); 284 311 function ValidECSUser: boolean; 285 function AllowCCOWContextChange(NewDFN: string): boolean; 312 procedure StartCCOWContextor; 313 function AllowCCOWContextChange(var CCOWResponse: UserResponse; NewDFN: string): boolean; 286 314 procedure UpdateCCOWContext; 287 315 procedure CheckHyperlinkResponse(aContextItemCollection: IDispatch; var HyperlinkReason: string); 288 316 procedure CheckForDifferentPatient(aContextItemCollection: IDispatch; var PtChanged: boolean); 317 {$IFDEF CCOWBROKER} 318 procedure CheckForDifferentUser(aContextItemCollection: IDispatch; var UserChanged: boolean); 319 {$ENDIF} 289 320 procedure HideEverything; 290 321 procedure ShowEverything; 291 322 //function FindBestCCOWDFN(var APatientName: string): string; 292 function 323 function FindBestCCOWDFN: string; 293 324 procedure HandleCCOWError(AMessage: string); 294 325 public 295 326 EnduringPtSelSplitterPos: integer; 296 327 procedure SetBADxList; 297 328 … … 309 340 property Closing: Boolean read FClosing; 310 341 property OnTabChanged: TNotifyEvent read FTabChanged write FTabChanged; 342 property VitalsDLLActive: boolean read FVitalsDLLActive write FVitalsDLLActive; 343 property GraphFloatActive: boolean read FGraphFloatActive write FGraphFloatActive; 344 property GraphContext: string read FGraphContext write FGraphContext; 345 procedure ToggleMenuItemChecked(Sender: TObject); 346 procedure SetUpCIRN; 311 347 end; 312 348 … … 331 367 uses 332 368 ORNet, rCore, fPtSelMsg, fPtSel, fCover, fProbs, fMeds, fOrders, rOrders, fNotes, fConsults, fDCSumm, 333 rMisc, Clipbrd, fLabs, fReports, fPtDemo, fEncnt, fPtCWAD, uCore, fAbout, fReview, fxBroker,369 rMisc, Clipbrd, fLabs, fReports, rReports, fPtDemo, fEncnt, fPtCWAD, uCore, fAbout, fReview, fxBroker, 334 370 fxLists, fxServer, ORSystem, fRptBox, fSplash, rODAllergy, uInit, fLabTests, fLabInfo, 335 371 uReminders, fReminderTree, ORClasses, fDeviceSelect, fDrawers, fReminderDialog, ShellAPI, rVitals, 336 fOptions, rTemplates, fSurgery, rSurgery, uEventHooks, uSignItems, fDefaultEvent,rECS,372 fOptions, fGraphs, rTemplates, fSurgery, rSurgery, uEventHooks, uSignItems, fDefaultEvent,rECS, 337 373 fIconLegend, uOrders, fPtSelOptns, DateUtils, uSpell, uOrPtf, fPatientFlagMulti, 338 fAlertForward, UBAGlobals, fBAOptionsDiagnoses,UBACore,fOrdersSign; 374 fAlertForward, UBAGlobals, fBAOptionsDiagnoses, UBACore, fOrdersSign, uVitals, fOrdersRenew, uFormMonitor 375 {$IFDEF CCOWBROKER} 376 , CCOW_const 377 {$ENDIF} 378 ; 379 380 var // RV 05/11/04 381 IsRunExecuted: Boolean = FALSE; // RV 05/11/04 382 GraphFloat: TfrmGraphs; 339 383 340 384 const … … 410 454 procedure TfrmFrame.TimeOutAction; 411 455 begin 412 Close; 456 if frmFrame.VitalsDLLActive then 457 CloseVitalsDLL() 458 else 459 Close; 413 460 end; 414 461 … … 460 507 FContextChanging := True; 461 508 Result := True; 462 if COMObjectActive or SpellCheckInProgress then509 if COMObjectActive or SpellCheckInProgress or VitalsDLLActive then 463 510 begin 464 511 Reason := 'COM_OBJECT_ACTIVE'; … … 531 578 HasFlag := False; 532 579 HidePatientSelectMessages; 580 if (GraphFloat <> nil) and GraphFloatActive then 581 with GraphFloat do 582 begin 583 Initialize; 584 DisplayData('top'); 585 DisplayData('bottom'); 586 lstCheck.Items.Clear; 587 Caption := 'CPRS Graphing - Patient: ' + MixedCase(Patient.Name); 588 end; 533 589 end; 534 590 … … 564 620 FJustEnteredApp := false; 565 621 SizeHolder := TSizeHolder.Create; 622 FOldActiveFormChange := Screen.OnActiveFormChange; 566 623 Screen.OnActiveFormChange := ScreenActiveFormChange; 567 624 if not (ParamSearch('CCOW')='DISABLE') then 568 625 try 569 ctxContextor := TContextorControl.Create(Self); 570 with ctxContextor do 571 begin 572 OnPending := ctxContextorPending; 573 OnCommitted := ctxContextorCommitted; 574 OnCanceled := ctxContextorCanceled; 575 end; 576 FCCOWBusy := False; 577 FCCOWInstalled := True; 578 FCCOWDrivedChange := False; 626 StartCCOWContextor; 579 627 except 628 IsRunExecuted := False; 580 629 FCCOWInstalled := False; 581 630 pnlCCOW.Visible := False; … … 585 634 else 586 635 begin 636 IsRunExecuted := False; 587 637 FCCOWInstalled := False; 588 638 pnlCCOW.Visible := False; … … 603 653 FCreateProgress := FCP_SERVER; 604 654 655 {$IFDEF CCOWBROKER} 656 EnsureBroker; 657 if ctxContextor <> nil then 658 begin 659 if ParamSearch('CCOW') = 'PATIENTONLY' then 660 RPCBrokerV.Contextor := nil 661 else 662 RPCBrokerV.Contextor := ctxContextor; 663 end 664 else 665 RPCBrokerV.Contextor := nil; 666 {$ENDIF} 667 605 668 if not ConnectToServer(TX_OPTION) then 606 669 begin 670 if Assigned(RPCBrokerV) then 671 InfoBox(RPCBrokerV.RPCBError, 'Error', MB_OK or MB_ICONERROR); 607 672 Close; 608 673 Exit; 674 end; 675 676 if ctxContextor <> nil then 677 begin 678 if not (ParamSearch('CCOW') = 'PATIENTONLY') then 679 ctxContextor.NotificationFilter := ctxContextor.NotificationFilter + ';User'; 609 680 end; 610 681 … … 616 687 FOldActivate := Application.OnActivate; 617 688 Application.OnActivate := AppActivated; 618 Application.OnDe activate := AppDeActivated;619 689 Application.OnDeActivate := AppDeActivated; 690 620 691 // create initial core objects 621 692 FCreateProgress := FCP_OBJECTS; … … 695 766 HasFlag := False; 696 767 FlagList := TStringList.Create; 697 FPrevPtID := '';698 768 // set up structures specific to the user 699 769 Caption := TX_IN_USE + MixedCase(User.Name) + ' (' + RPCBrokerV.Server + ')'; … … 729 799 FCreateProgress := FCP_FINISH; 730 800 pnlReminders.Visible := InteractiveRemindersActive; 801 GraphFloatActive := false; 802 GraphContext := ''; 731 803 uRemoteType := ''; 804 FPrevPtID := ''; 732 805 SetUserTools; 733 806 EnduringPtSelSplitterPos := 0; … … 736 809 InitialOrderVariables; 737 810 PostMessage(Handle, UM_INITIATE, 0, 0); // select patient after main form is created 738 739 811 // mnuFileOpenClick(Self); 740 812 // if Patient.DFN = '' then //*DFN* … … 744 816 // end; 745 817 // if WindowState = wsMinimized then WindowState := wsNormal; 746 end; 747 748 procedure TfrmFrame.UMInitiate(var Message: TMessage); 749 begin 750 NotifyOtherApps(NAE_OPEN, IntToStr(User.DUZ)); 751 752 if FCCOWInstalled then // Please see me re: changes here - Thanks - RV. 818 SetFormMonitoring(true); 819 end; 820 821 procedure TfrmFrame.StartCCOWContextor; 822 begin 753 823 try 754 // To re-enable the multiple instance functionality, remove the '#' from the following line 755 ctxContextor.Run('CPRSChart', '', TRUE, '*'); 756 757 // Uncomment the following line to run in secure binding mode, once the vault is configured to do so. 758 // Also comment out the 'ctxContextor.Run' line above. 759 //ctxContextor.Run('CPRSChart', PASSCODE, TRUE, '*'); 824 ctxContextor := TContextorControl.Create(Self); 825 with ctxContextor do 826 begin 827 OnPending := ctxContextorPending; 828 OnCommitted := ctxContextorCommitted; 829 OnCanceled := ctxContextorCanceled; 830 end; 831 FCCOWBusy := False; 832 FCCOWInstalled := True; 833 FCCOWDrivedChange := False; 834 ctxContextor.Run('CPRSChart', '', TRUE, 'Patient'); 835 IsRunExecuted := True; 760 836 except 761 837 on exc : EOleException do 762 begin 763 try 764 // Uncomment the following line to run in secure binding mode, once the vault is configured to do so. 765 ctxContextor.Run('CPRSChart' + '#', '', TRUE, '*'); 766 //ctxContextor.Run('CPRSChart' + '#', PASSCODE, TRUE, '*'); 767 768 if ParamSearch('CCOW') = 'FORCE' then 838 begin 839 IsRunExecuted := False; 840 FreeAndNil(ctxContextor); 841 try 842 ctxContextor := TContextorControl.Create(Self); 843 with ctxContextor do 769 844 begin 770 mnuFileResumeContext.Enabled := False; 771 mnuFileBreakContext.Visible := True; 772 mnuFileBreakContext.Enabled := True; 773 end 774 else 775 begin 776 ctxContextor.Suspend; 777 mnuFileResumeContext.Visible := True; 778 mnuFileBreakContext.Visible := True; 779 mnuFileBreakContext.Enabled := False; 845 OnPending := ctxContextorPending; 846 OnCommitted := ctxContextorCommitted; 847 OnCanceled := ctxContextorCanceled; 780 848 end; 781 except 782 on exc : EOleException do 783 begin 784 FCCOWInstalled := False; 785 pnlCCOW.Visible := False; 786 mnuFileResumeContext.Visible := False; 787 mnuFileBreakContext.Visible := False; 788 end; 849 FCCOWBusy := False; 850 FCCOWInstalled := True; 851 FCCOWDrivedChange := False; 852 ctxContextor.Run('CPRSChart' + '#', '', TRUE, 'Patient'); 853 IsRunExecuted := True; 854 if ParamSearch('CCOW') = 'FORCE' then 855 begin 856 mnuFileResumeContext.Enabled := False; 857 mnuFileBreakContext.Visible := True; 858 mnuFileBreakContext.Enabled := True; 859 end 860 else 861 begin 862 ctxContextor.Suspend; 863 mnuFileResumeContext.Visible := True; 864 mnuFileBreakContext.Visible := True; 865 mnuFileBreakContext.Enabled := False; 789 866 end; 790 end; // on exc 791 end; // try/except 792 867 except 868 IsRunExecuted := False; 869 FCCOWInstalled := False; 870 FreeAndNil(ctxContextor); 871 pnlCCOW.Visible := False; 872 mnuFileResumeContext.Visible := False; 873 mnuFileBreakContext.Visible := False; 874 end; 875 end; 876 end 877 end; 878 879 procedure TfrmFrame.UMInitiate(var Message: TMessage); 880 begin 881 NotifyOtherApps(NAE_OPEN, IntToStr(User.DUZ)); 793 882 LoadUserPreferences; 794 GetBAStatus(User.DUZ, Encounter.Location);883 GetBAStatus(User.DUZ,Patient.DFN); 795 884 mnuFileOpenClick(Self); 796 885 Enabled := True; … … 803 892 begin 804 893 Application.OnActivate := FOldActivate; 894 Screen.OnActiveFormChange := FOldActiveFormChange; 805 895 FNextButtonBitmap.Free; 806 896 uTabList.Free; … … 814 904 User.Free; 815 905 SizeHolder.Free; 906 ctxContextor.Free; 816 907 end; 817 908 … … 833 924 834 925 procedure TfrmFrame.SetUserTools; 835 const836 TX_M_NOT_CONFIG = 'Tools/Options menu on M side not configured properly -'+837 ' please notify your IRM support immediately';838 TC_M_NOT_CONFIG = 'Warning: Check Tools/Options Menu in M';839 926 var 840 927 ToolItems: TToolItemList; … … 885 972 UserTool.Hint := Action; 886 973 UserTool.OnClick := ToolClick; 887 if i < mnuTools.Count then 888 mnuTools.Insert(i, UserTool) 889 else 890 begin 891 mnuTools.Add(UserTool); 892 InfoBox(TX_M_NOT_CONFIG, TC_M_NOT_CONFIG, MB_ICONWARNING or MB_OK) 893 end; 974 mnuTools.Insert(i, UserTool); 894 975 end; 895 976 end; … … 965 1046 begin 966 1047 FClosing := TRUE; 1048 SetFormMonitoring(false); 967 1049 if FCreateProgress < FCP_FINISH then FTerminate := True; 968 1050 … … 970 1052 if FCreateProgress = FCP_FINISH then NotifyOtherApps(NAE_CLOSE, ''); 971 1053 TerminateOtherAppNotification; 1054 1055 if GraphFloat <> nil then 1056 begin 1057 if frmFrame.GraphFloatActive then 1058 GraphFloat.Close; 1059 GraphFloat.Release; 1060 end; 972 1061 973 1062 // unhook the timeout hooks … … 976 1065 if FCreateProgress = FCP_FINISH then Changes.Clear; 977 1066 // clear server side flag global tmp 978 ClearFlag;1067 if FCreateProgress = FCP_FINISH then ClearFlag; 979 1068 // save user preferences 980 1069 if FCreateProgress = FCP_FINISH then SaveUserPreferences; … … 1005 1094 //Application.ProcessMessages; // so everything finishes closing 1006 1095 // if < FCP_FINISH we came here from inside FormCreate, so need to call terminate 1096 //if GraphFloat <> nil then GraphFloat.Release; 1007 1097 if FCreateProgress < FCP_FINISH then Application.Terminate; 1008 1098 end; … … 1234 1324 NotifyOtherApps(NAE_NEWPT, SSN + U + FloatToStr(DOB) + U + Name); 1235 1325 SelectMsg := ''; 1236 if (not FRefreshing) then1237 begin1238 if not Assigned(AFlaggedList) then ShowFlags1239 else if (AFlaggedList.IndexOf(Patient.DFN) < 0) then ShowFlags;1240 end;1241 1326 if MeansTestRequired(Patient.DFN, AMsg) then SelectMsg := AMsg; 1242 1327 if HasLegacyData(Patient.DFN, AMsg) then SelectMsg := SelectMsg + CRLF + AMsg; 1328 1243 1329 HasActiveFlg(FlagList, HasFlag, Patient.DFN); 1244 if FPrevPtID <> patient.DFN then 1245 begin 1246 if HasFlag then 1247 begin 1248 pnlFlag.Enabled := True; 1249 lblFlag.Font.Color := clMaroon; 1250 lblFlag.Enabled := True; 1251 if not FReFreshing then 1252 ShowFlags; 1253 end else 1254 begin 1255 pnlFlag.Enabled := False; 1256 lblFlag.Font.Color := clBtnFace; 1257 lblFlag.Enabled := False; 1258 end; 1259 FPrevPtID := patient.DFN; 1330 if HasFlag then 1331 begin 1332 pnlFlag.Enabled := True; 1333 lblFlag.Font.Color := clMaroon; 1334 lblFlag.Enabled := True; 1335 if (not FReFreshing) and (TriggerPRFPopUp(Patient.DFN)) then 1336 ShowFlags; 1337 end else 1338 begin 1339 pnlFlag.Enabled := False; 1340 lblFlag.Font.Color := clBtnFace; 1341 lblFlag.Enabled := False; 1260 1342 end; 1261 1343 FPrevPtID := patient.DFN; 1344 frmCover.UpdateVAAButton; //VAA CQ7525 (moved here in v26.30 (RV)) 1262 1345 ProcessPatientChangeEventHook; 1263 1346 if Length(SelectMsg) > 0 then ShowPatientSelectMessages(SelectMsg); … … 1270 1353 NextIndex: Integer; 1271 1354 Reason: string; 1355 CCOWResponse: UserResponse; 1272 1356 begin 1273 1357 SaveDFN := Patient.DFN; … … 1293 1377 HasActiveFlg(FlagList, HasFlag, NewDFN); 1294 1378 end; 1295 if (FCCOWInstalled and (ctxContextor.State = csSuspended)) or (AllowCCOWContextChange( Patient.DFN)) then1379 if (FCCOWInstalled and (ctxContextor.State = csSuspended)) or (AllowCCOWContextChange(CCOWResponse, Patient.DFN)) then 1296 1380 begin 1297 1381 if Patient.Inpatient then … … 1333 1417 mnuFileNotifRemove.Enabled := Notifications.Followup in [NF_FLAGGED_ORDERS, 1334 1418 NF_ORDER_REQUIRES_ELEC_SIGNATURE, 1335 NF_MEDICATIONS_EXPIRING, 1419 NF_MEDICATIONS_EXPIRING_INPT, 1420 NF_MEDICATIONS_EXPIRING_OUTPT, 1336 1421 NF_UNVERIFIED_MEDICATION_ORDER, 1337 1422 NF_UNVERIFIED_ORDER, … … 1361 1446 NextIndex := PageIDToTab(CT_REPORTS); 1362 1447 NF_DNR_EXPIRING : NextIndex := PageIDToTab(CT_ORDERS); 1363 NF_MEDICATIONS_EXPIRING : NextIndex := PageIDToTab(CT_ORDERS); 1448 NF_MEDICATIONS_EXPIRING_INPT : NextIndex := PageIDToTab(CT_ORDERS); 1449 NF_MEDICATIONS_EXPIRING_OUTPT : NextIndex := PageIDToTab(CT_ORDERS); 1364 1450 NF_UNVERIFIED_MEDICATION_ORDER : NextIndex := PageIDToTab(CT_ORDERS); 1365 1451 NF_NEW_ORDER : NextIndex := PageIDToTab(CT_ORDERS); … … 1431 1517 SaveDFN, Reason: string; 1432 1518 //NextTab: Integer; // moved up for visibility - v23.4 rV 1433 ok, OldRemindersStarted : boolean;1519 ok, OldRemindersStarted, PtSelCancelled: boolean; 1434 1520 //i: smallint; 1435 begin 1521 CCOWResponse: UserResponse; 1522 begin 1523 PtSelCancelled := FALSE; 1436 1524 DetermineNextTab; 1437 1525 (* if (FRefreshing or User.UseLastTab) and (not FFirstLoad) then … … 1471 1559 end; 1472 1560 1473 SaveDFN := Patient.DFN; 1561 if FNoPatientSelected then 1562 SaveDFN := '' 1563 else 1564 SaveDFN := Patient.DFN; 1565 1474 1566 OldRemindersStarted := RemindersStarted; 1475 1567 RemindersStarted := FALSE; … … 1502 1594 end; 1503 1595 if (Patient.DFN = '') or (Sender = mnuFileOpen) or (Sender = mnuFileNext) or (Sender = mnuViewDemo) then 1504 SelectPatient(SHOW_NOTIFICATIONS, Font.Size); 1596 SelectPatient(SHOW_NOTIFICATIONS, Font.Size, PtSelCancelled); 1597 if PtSelCancelled then exit; 1505 1598 ShowEverything; 1506 1599 DisplayEncounterText; … … 1536 1629 begin 1537 1630 Notifications.Clear; 1538 SelectPatient(False, Font.Size); // Call Pt. Sel. w/o notifications. 1631 SelectPatient(False, Font.Size, PtSelCancelled); // Call Pt. Sel. w/o notifications. 1632 if PtSelCancelled then exit; 1539 1633 ShowEverything; 1540 DisplayEncounterText; 1634 DisplayEncounterText; 1541 1635 FPrevInPatient := Patient.Inpatient; 1542 1636 ok := TRUE; … … 1547 1641 if FCCOWInstalled and (ctxContextor.State = csParticipating) and (not FRefreshing) then 1548 1642 begin 1549 if (AllowCCOWContextChange( Patient.DFN)) then1643 if (AllowCCOWContextChange(CCOWResponse, Patient.DFN)) then 1550 1644 begin 1551 1645 SetupPatient; … … 1555 1649 else 1556 1650 begin 1557 Patient.DFN := SaveDFN; 1558 SetupPatient; 1559 tabPage.TabIndex := PageIDToTab(NextTab); 1560 tabPageChange(tabPage); 1651 case CCOWResponse of 1652 urCancel: UpdateCCOWContext; 1653 urBreak: 1654 begin 1655 // do not revert to old DFN if context was manually broken by user - v26 (RV) 1656 if (ctxContextor.State = csParticipating) then Patient.DFN := SaveDFN; 1657 SetupPatient; 1658 tabPage.TabIndex := PageIDToTab(NextTab); 1659 tabPageChange(tabPage); 1660 end; 1661 end; 1561 1662 end; 1562 1663 end … … 1576 1677 if BILLING_AWARE then frmFrame.SetBADxList; //end IsBillingAware 1577 1678 {End BillingAware} 1578 1679 //frmCover.UpdateVAAButton; //VAA CQ7525 CQ#7933 - moved to SetupPatient, before event hook execution (RV) 1579 1680 end; 1580 1681 … … 1669 1770 { View Menu Events ------------------------------------------------------------------------- } 1670 1771 1671 procedure TfrmFrame.mnuViewDemoClick(Sender: TObject);1672 { displays patient inquiry report (which optionally allows new patient to be selected) }1673 var1674 SelectNew: Boolean;1675 begin1676 StatusText(TX_PTINQ);1677 PatientInquiry(SelectNew);1678 if Assigned(FLastPage) then1679 FLastPage.FocusFirstControl;1680 StatusText('');1681 if SelectNew then mnuFileOpenClick(mnuViewDemo);1682 end;1683 1684 1772 procedure TfrmFrame.mnuViewPostingsClick(Sender: TObject); 1685 { displays the window that shows crisis notes, warnings, allergies, & advance directives } 1686 begin 1687 ShowCWAD; 1773 begin 1688 1774 end; 1689 1775 … … 1933 2019 { emulate a button press in the patient identification panel } 1934 2020 begin 2021 if pnlPatient.BevelOuter = bvLowered then exit; 1935 2022 pnlPatient.BevelOuter := bvLowered; 1936 2023 with lblPtName do SetBounds(Left+2, Top+2, Width, Height); … … 1943 2030 { emulate the button raising in the patient identification panel & call Patient Inquiry } 1944 2031 begin 2032 if pnlPatient.BevelOuter = bvRaised then exit; 1945 2033 pnlPatient.BevelOuter := bvRaised; 1946 2034 with lblPtName do SetBounds(Left-2, Top-2, Width, Height); … … 2034 2122 SetUserBounds2(RemDlgSplitters, RemDlgSpltr1, RemDlgSpltr2, Dummy ,Dummy); 2035 2123 SetUserBounds2(DrawerSplitters,s1, s2, s3, Dummy); 2124 if Assigned(frmSurgery) then frmSurgery.Drawers.LastOpenSize := Dummy; //CQ7315 2036 2125 frmNotes.Drawers.LastOpenSize := s1; 2037 2126 frmConsults.Drawers.LastOpenSize := s2; … … 2045 2134 frmMeds.pnlBottom.Height := panelBottom; 2046 2135 frmMeds.pnlMedIn.Height := panelMedIn; 2136 //Meds Tab Non-VA meds columns 2137 SetUserColumns(TControl(hdrMedsNonVA)); //CQ7314 2047 2138 end; 2048 2139 2049 frmCover.DisableAlign;2140 frmCover.DisableAlign; 2050 2141 try 2051 2142 SetUserBounds2(CoverSplitters1, s1, s2, s3, s4); … … 2076 2167 var 2077 2168 SizeList: TStringList; 2169 SurgTempHt: integer; 2078 2170 begin 2079 2171 SaveUserFontSize(MainFontSize); … … 2098 2190 Add(StrUserBounds2(RemDlgName, RemDlgLeft, RemDlgTop, RemDlgWidth, RemDlgHeight)); 2099 2191 Add(StrUserBounds2(RemDlgSplitters, RemDlgSpltr1, RemDlgSpltr2, 0 ,0)); 2192 2193 //v26.47 - RV - access violation if Surgery Tab not enabled. Set to designer height as default. 2194 if Assigned(frmSurgery) then SurgTempHt := frmSurgery.Drawers.pnlTemplates.Height else SurgTempHt := 85; 2100 2195 Add(StrUserBounds2(DrawerSplitters, frmNotes.Drawers.LastOpenSize, 2101 2196 frmConsults.Drawers.LastOpenSize, 2102 frmDCSumm.Drawers.LastOpenSize,0)); 2197 frmDCSumm.Drawers.LastOpenSize, 2198 SurgTempHt)); // last parameter = CQ7315 2199 2103 2200 Add(StrUserBounds2(CoverSplitters1, 2104 2201 frmCover.pnl_1.Width, … … 2114 2211 //Meds Tab Splitters 2115 2212 Add(StrUserBounds2(frmMeds.Name+'Split',frmMeds.pnlBottom.Height,frmMeds.pnlMedIn.Height,0,0)); 2213 2214 //Meds Tab Non-VA meds columns 2215 Add(StrUserColumns(fMeds.frmMeds.hdrMedsNonVA)); //CQ7314 2216 2217 //Orders Tab columns 2218 Add(StrUserColumns(fOrders.frmOrders.hdrOrders)); //CQ6328 2116 2219 2117 2220 if EnduringPtSelSplitterPos <> 0 then … … 2185 2288 with lstCIRNLocations do Font.Size := NewFontSize; 2186 2289 with tabPage do Font.Size := NewFontSize; 2290 with laMHV do Font.Size := NewFontSize; //VAA 2291 with laVAA2 do Font.Size := NewFontSize; //VAA 2187 2292 2188 2293 tabPage.Height := MainFontHeight + TAB_VOFFSET; // resize tab selector … … 2192 2297 stsArea.Panels[0].Width := ResizeWidth( OldFont, Font, stsArea.Panels[0].Width); 2193 2298 stsArea.Panels[2].Width := ResizeWidth( OldFont, Font, stsArea.Panels[2].Width); 2299 2300 //VAA CQ8271 2301 if ((fCover.PtIsVAA and fCover.PtIsMHV)) then 2302 begin 2303 laMHV.Height := (pnlToolBar.Height div 2) -1; 2304 with laVAA2 do 2305 begin 2306 Top := laMHV.Top + laMHV.Height; 2307 Height := (pnlToolBar.Height div 2) -1; 2308 end; 2309 end; 2310 //end VAA 2311 2194 2312 RefreshFixedStatusWidth; 2195 2313 FormResize( self ); … … 2206 2324 lblPtCWAD.Font.Color := clWindowText; 2207 2325 lblFlag.Font.Color := clWindowText; 2326 end; 2327 2328 case (NewFontSize) of 2329 8: mnu8pt.Checked := true; 2330 10: mnu10pt1.Checked := true; 2331 12: mnu12pt1.Checked := true; 2332 14: mnu14pt1.Checked := true; 2333 18: mnu18pt1.Checked := true; 2334 24: mnu24pt1.Checked := true; 2208 2335 end; 2209 2336 … … 2223 2350 if Assigned(frmRemDlg) then frmRemDlg.SetFontSize; 2224 2351 if Assigned(frmReminderTree) then frmReminderTree.SetFontSize(NewFontSize); 2352 if GraphFloat <> nil then ResizeAnchoredFormToFont(GraphFloat); 2225 2353 end; 2226 2354 … … 2231 2359 VISIT_WIDTH = 36; 2232 2360 POSTING_WIDTH = 11.5; 2233 FLAG_WIDTH = 5;2361 FLAG_WIDTH = 5; 2234 2362 CIRN_WIDTH = 7; 2363 MHV_WIDTH = 6; 2235 2364 LINES_HIGH = 2; 2236 2365 M_HORIZ = 4; … … 2239 2368 M_WVERT = 6; 2240 2369 TINY_MARGIN = 2; 2241 var2242 WidthNeeded: integer;2370 //var 2371 //WidthNeeded: integer; 2243 2372 begin 2244 2373 pnlToolbar.Height := (LINES_HIGH * lblPtName.Height) + M_HORIZ + M_MIDDLE + M_HORIZ; … … 2257 2386 pnlFlag.Width := Round(FLAG_WIDTH * MainFontWidth); 2258 2387 pnlFlag.Width := Round(FLAG_WIDTH * MainFontWidth); 2259 pnlCIRN.Width := Round(CIRN_WIDTH * MainFontWidth) + M_WVERT; 2388 pnlCIRN.Width := Round(CIRN_WIDTH * MainFontWidth) + M_WVERT; 2389 paVAA.Width := Round(MHV_WIDTH * MainFontWidth) + M_WVERT; 2260 2390 with lblPtPostings do 2261 2391 SetBounds(M_WVERT, M_HORIZ, pnlPostings.Width-M_WVERT-M_WVERT, lblPtName.Height); … … 2274 2404 end; 2275 2405 //If that is not enough, add scroll bars to form 2276 if pnlPrimaryCare.Width < HigherOf( lblPtCare.Left + lblPtCare.Width, lblPtAttending.Left + lblPtAttending.Width) + TINY_MARGIN then2406 {if pnlPrimaryCare.Width < HigherOf( lblPtCare.Left + lblPtCare.Width, lblPtAttending.Left + lblPtAttending.Width) + TINY_MARGIN then 2277 2407 begin 2278 2408 WidthNeeded := HigherOf( lblPtCare.Left + lblPtCare.Width, lblPtAttending.Left + lblPtAttending.Width) + TINY_MARGIN - pnlPrimaryCare.Width; … … 2280 2410 Width := Width + WidthNeeded; 2281 2411 end 2282 else 2412 else } // commented out - BA 2283 2413 HorzScrollBar.Range := 0; 2284 2414 end; 2285 2415 2286 2416 { Temporary Calls -------------------------------------------------------------------------- } 2417 2418 procedure TfrmFrame.ToggleMenuItemChecked(Sender: TObject); 2419 begin 2420 with (Sender as TMenuItem) do 2421 begin 2422 if not Checked then 2423 Checked := true 2424 else 2425 Checked := false; 2426 end; 2427 end; 2287 2428 2288 2429 procedure TfrmFrame.mnuFontSizeClick(Sender: TObject); … … 2290 2431 if (frmRemDlg <> nil) then 2291 2432 ShowMessage('Please close the reminder dialog before changing font sizes.') 2292 else if (dlgProbs <> nil) then 2433 else 2434 if (dlgProbs <> nil) then 2293 2435 ShowMessage('Font size cannot be changed while adding or editing a problem.') 2294 2436 else 2295 with Sender as TMenuItem do ChangeFont(Tag); 2437 begin 2438 with (Sender as TMenuItem) do 2439 begin 2440 ToggleMenuItemChecked(Sender); 2441 fMeds.oldFont := MainFontSize; //CQ9182 2442 ChangeFont(Tag); 2443 end; 2444 end; 2296 2445 end; 2297 2446 … … 2413 2562 inherited; 2414 2563 end; 2415 end; 2416 2417 procedure TfrmFrame.mnuViewRemindersClick(Sender: TObject); 2418 begin 2419 ViewReminderTree; 2564 if Message.WParam = SC_MAXIMIZE then 2565 begin 2566 // form becomes maximized; 2567 frmOrders.mnuOptimizeFieldsClick(self); 2568 frmProblems.mnuOptimizeFieldsClick(self); 2569 frmMeds.mnuOptimizeFieldsClick(self); 2570 end 2571 else if Message.WParam = SC_MINIMIZE then 2572 begin 2573 // form becomes maximized; 2574 end 2575 else if Message.WParam = SC_RESTORE then 2576 begin 2577 // form is restored (from maximized); 2578 frmOrders.mnuOptimizeFieldsClick(self); 2579 frmProblems.mnuOptimizeFieldsClick(self); 2580 frmMeds.mnuOptimizeFieldsClick(self); 2581 end; 2420 2582 end; 2421 2583 … … 2423 2585 var 2424 2586 ImgName: string; 2425 2426 2587 begin 2427 2588 pnlReminders.tag := HAVE_REMINDERS; … … 2497 2658 pnlReminders.BevelOuter := bvRaised; 2498 2659 if(pnlReminders.tag = HAVE_REMINDERS) then 2499 mnuViewRemindersClick(Self);2660 ViewInfo(mnuViewReminders); 2500 2661 end; 2501 2662 … … 2505 2666 var 2506 2667 i: integer; 2668 aAutoQuery: string; 2507 2669 ASite: TRemoteSite; 2508 2670 begin 2509 2671 with RemoteSites do 2672 if UseVistaWeb then 2510 2673 begin 2511 2674 ChangePatient(Patient.DFN); 2675 lblCIRN.Caption := 'Remote'; //VistaWeb On 2676 lblCIRNData.Caption := 'Data*'; 2677 pnlCIRN.Caption := 'Remote Data'; 2678 lblCIRN.Width := 43; 2679 lblCIRNData.Width := 43; 2680 lblCIRNData.Alignment := taCenter; 2681 lblCIRN.Alignment := taCenter; 2682 lblCIRN.Enabled := True; 2683 lblCIRNData.Enabled := True; 2684 lblCIRNAvail.Enabled := True; 2685 pnlCIRN.TabStop := True; 2512 2686 if RemoteDataExists and (RemoteSites.Count > 0) then 2513 2687 begin 2514 2688 lblCIRN.Enabled := True; 2515 2689 lblCIRNData.Enabled := True; 2690 lblCIRNAvail.Enabled := True; 2516 2691 pnlCIRN.TabStop := True; 2517 2692 if ColorToRGB(clWindowText) = ColorToRGB(clBlack) then … … 2519 2694 lblCIRN.Font.Color := clBlue; 2520 2695 lblCIRNData.Font.Color := clBlue; 2696 lblCIRNAvail.Font.Color := clBlue; 2521 2697 lstCIRNLocations.Font.Color := clBlue; 2698 lblCIRN.Caption := 'Remote'; 2699 lblCIRNData.Caption := 'Data*'; 2700 lblCIRNAvail.Caption := 'Available'; 2701 pnlCIRN.Caption := 'Remote Data Available'; 2522 2702 end 2523 2703 else … … 2525 2705 lblCIRN.Font.Color := clWindowText; 2526 2706 lblCIRNData.Font.Color := clWindowText; 2707 lblCIRNAvail.Font.Color := clWindowText; 2527 2708 lstCIRNLocations.Font.Color := clWindowText; 2528 2709 end; 2710 end 2711 else 2712 begin 2713 lblCIRN.Font.Color := clWindowText; 2714 lblCIRNData.Font.Color := clWindowText; 2715 lblCIRNAvail.Font.Color := clWindowText; 2716 lblCIRN.Enabled := False; 2717 lblCIRNData.Enabled := False; 2718 lblCIRNAvail.Enabled := False; 2719 pnlCIRN.TabStop := False; 2720 pnlCIRN.Hint := NoDataReason; 2721 end; 2722 pnlCIRN.Hint := 'Click to open VistaWeb'; 2723 end 2724 else 2725 begin 2726 ChangePatient(Patient.DFN); 2727 lblCIRN.Caption := ' Remote'; 2728 lblCIRNData.Caption := 'Data'; 2729 pnlCIRN.Caption := 'Remote Data'; 2730 lblCIRNAvail.Caption := ''; 2731 lblCIRN.Width := 43; 2732 lblCIRNData.Width := 43; 2733 lblCIRNData.Alignment := taCenter; 2734 lblCIRN.Alignment := taCenter; 2735 if RemoteDataExists and (RemoteSites.Count > 0) then 2736 begin 2737 lblCIRN.Enabled := True; 2738 lblCIRNData.Enabled := True; 2739 lblCIRNAvail.Enabled := True; 2740 pnlCIRN.TabStop := True; 2741 if ColorToRGB(clWindowText) = ColorToRGB(clBlack) then 2742 begin 2743 lblCIRN.Font.Color := clBlue; 2744 lblCIRNData.Font.Color := clBlue; 2745 lblCIRNAvail.Font.Color := clBlue; 2746 lstCIRNLocations.Font.Color := clBlue; 2747 lblCIRN.Caption := 'Remote'; 2748 lblCIRNData.Caption := 'Data'; 2749 lblCIRNAvail.Caption := 'Available'; 2750 pnlCIRN.Caption := 'Remote Data Available'; 2751 end 2752 else 2753 begin 2754 lblCIRN.Font.Color := clWindowText; 2755 lblCIRNData.Font.Color := clWindowText; 2756 lblCIRNAvail.Font.Color := clWindowText; 2757 lstCIRNLocations.Font.Color := clWindowText; 2758 lblCIRNAvail.Color := clWindowText; 2759 end; 2529 2760 pnlCIRN.Hint := 'Click to display other facilities having data for this patient.'; 2761 lstCIRNLocations.Items.Add('-1' + U + 'Use VistaWeb from now on'); 2530 2762 if RemoteSites.Count > 0 then 2531 2763 lstCIRNLocations.Items.Add('0' + U + 'All Available Sites'); … … 2541 2773 lblCIRN.Font.Color := clWindowText; 2542 2774 lblCIRNData.Font.Color := clWindowText; 2775 lblCIRNAvail.Font.Color := clWindowText; 2543 2776 lblCIRN.Enabled := False; 2544 2777 lblCIRNData.Enabled := False; 2778 lblCIRNAvail.Enabled := False; 2545 2779 pnlCIRN.TabStop := False; 2546 2780 pnlCIRN.Hint := NoDataReason; 2547 2781 end; 2782 aAutoQuery := AutoRDV; //Check to see if Remote Queries should be used for all available sites 2783 if (aAutoQuery = '1') and (lstCIRNLocations.Count > 0) then 2784 begin 2785 lstCIRNLocations.ItemIndex := 1; 2786 lstCIRNLocations.Checked[1] := true; 2787 lstCIRNLocationsClick(self); 2788 end; 2789 end; 2790 end; 2791 2792 procedure TfrmFrame.pnlCIRNClick(Sender: TObject); 2793 //var 2794 // aAddress: string; 2795 begin 2796 {if UseVistaWeb then 2797 begin 2798 pnlCIRN.BevelOuter := bvRaised; 2799 pnlCIRN.Hint := 'Click to open VistaWeb'; 2800 lblCIRN.Width := 43; 2801 lblCIRNData.Width := 43; 2802 lblCIRNData.Alignment := taCenter; 2803 lblCIRN.Alignment := taCenter; 2804 lstCIRNLocations.Visible := false; 2805 lstCIRNLocations.SendToBack; 2806 aAddress := GetVistaWebAddress(Patient.DFN); 2807 ShellExecute(Handle, 'open', PChar(aAddress), PChar(''), '', SW_NORMAL); 2808 Exit; 2548 2809 end; 2549 end;2550 2551 procedure TfrmFrame.pnlCIRNClick(Sender: TObject);2552 begin2553 2810 if not RemoteSites.RemoteDataExists then Exit; 2554 2811 if (not lstCIRNLocations.Visible) then … … 2566 2823 lstCIRNLocations.SendToBack; 2567 2824 pnlCIRN.Hint := 'Click to display other facilities having data for this patient.'; 2568 end 2825 end } 2826 ViewInfo(mnuViewRemoteData); 2569 2827 end; 2570 2828 … … 2581 2839 AccessStatus: integer; 2582 2840 begin 2583 iAll := 0;2841 iAll := 1; 2584 2842 AccessStatus := 0; 2843 iIndex := lstCIRNLocations.ItemIndex; 2844 if iIndex = 0 then 2845 if (piece(lstCIRNLocations.Items[0],'^',1) = '-1') and (lstCIRNLocations.Checked[iIndex] = true) then 2846 begin 2847 if MessageDlg('Are you sure you want to make VistaWeb your default for viewing Remote Data?', 2848 mtConfirmation, [mbYes, mbNo], 0) = mrYes then 2849 begin 2850 ChangeVistaWebParam('1'); 2851 lblCIRN.Caption := 'Remote'; //VistaWeb On 2852 lblCIRNData.Caption := 'Data*'; 2853 pnlCIRN.Caption := 'Remote Data'; 2854 lblCIRNAvail.Caption := ''; 2855 lblCIRN.Width := 43; 2856 lblCIRNData.Width := 43; 2857 lblCIRNData.Alignment := taCenter; 2858 lblCIRN.Alignment := taCenter; 2859 with RemoteSites do if RemoteDataExists and (RemoteSites.Count > 0) then 2860 begin 2861 lblCIRN.Enabled := True; 2862 lblCIRNData.Enabled := True; 2863 pnlCIRN.TabStop := True; 2864 if ColorToRGB(clWindowText) = ColorToRGB(clBlack) then 2865 begin 2866 lblCIRN.Font.Color := clBlue; 2867 lblCIRNData.Font.Color := clBlue; 2868 lstCIRNLocations.Font.Color := clBlue; 2869 lblCIRN.Caption := 'Remote'; 2870 lblCIRNData.Caption := 'Data*'; 2871 lblCIRNAvail.Caption := 'Available'; 2872 pnlCIRN.Caption := 'Remote Data Available'; 2873 end 2874 else 2875 begin 2876 lblCIRN.Font.Color := clWindowText; 2877 lblCIRNData.Font.Color := clWindowText; 2878 lstCIRNLocations.Font.Color := clWindowText; 2879 lblCIRNAvail.Font.Color := clWindowText; 2880 end; 2881 end; 2882 pnlCIRNClick(self); 2883 Exit; 2884 end 2885 else 2886 lstCIRNLocations.Checked[iIndex] := false; 2887 end 2888 else 2889 begin 2890 ChangeVistaWebParam('0'); 2891 lblCIRN.Caption := 'Remote'; 2892 lblCIRNData.Caption := 'Data'; 2893 pnlCIRN.Caption := 'Remote Data'; 2894 lblCIRN.Width := 43; 2895 lblCIRNData.Width := 43; 2896 lblCIRNData.Alignment := taCenter; 2897 lblCIRN.Alignment := taCenter; 2898 pnlCIRNClick(self); 2899 Exit; 2900 end; 2585 2901 if not CheckHL7TCPLink then 2586 2902 begin 2587 2903 InfoBox('Local HL7 TCP Link is down.' + CRLF + 'Unable to retrieve remote data.', TC_DGSR_ERR, MB_OK); 2588 lstCIRNLocations.Checked[ lstCIRNLocations.ItemIndex] := false;2904 lstCIRNLocations.Checked[iIndex] := false; 2589 2905 Exit; 2590 2906 end; 2591 if lstCIRNLocations.Items.Count > 0 then 2592 if piece(lstCIRNLocations.Items[0],'^',1) = '0' then 2593 iAll := 1; 2594 iIndex := lstCIRNLocations.ItemIndex; 2907 if lstCIRNLocations.Items.Count > 1 then 2908 if piece(lstCIRNLocations.Items[1],'^',1) = '0' then 2909 iAll := 2; 2595 2910 with frmReports do 2596 2911 if piece(uRemoteType,'^',2) = 'V' then … … 2612 2927 with RemoteSites.SiteList do 2613 2928 for j := 0 to Count - 1 do 2614 if lstCIRNLocations.Checked[j+ 1] = true then2929 if lstCIRNLocations.Checked[j+2] = true then 2615 2930 begin 2616 lstCIRNLocations.Checked[j+ 1] := false;2931 lstCIRNLocations.Checked[j+2] := false; 2617 2932 TRemoteSite(RemoteSites.SiteList[j]).Selected := false; 2618 2933 TRemoteSite(RemoteSites.SiteList[j]).ReportClear; … … 2630 2945 Screen.Cursor := crDefault; 2631 2946 aMsg := aMsg + ' at site: ' + TRemoteSite(Items[j]).SiteName; 2632 s := lstCIRNLocations.Items[j+ 1];2633 lstCIRNLocations.Items[j+ 1] := pieces(s, '^', 1, 3);2947 s := lstCIRNLocations.Items[j+2]; 2948 lstCIRNLocations.Items[j+2] := pieces(s, '^', 1, 3); 2634 2949 case AccessStatus of 2635 2950 DGSR_FAIL: begin 2636 2951 if piece(aMsg,':',1) = 'RPC name not found at site' then //Allow for backward compatibility 2637 2952 begin 2638 lstCIRNLocations.Checked[j+ 1] := true;2953 lstCIRNLocations.Checked[j+2] := true; 2639 2954 TRemoteSite(RemoteSites.SiteList[j]).ReportClear; 2640 2955 TRemoteSite(RemoteSites.SiteList[j]).LabClear; … … 2644 2959 begin 2645 2960 InfoBox(aMsg, TC_DGSR_ERR, MB_OK); 2646 lstCIRNLocations.Checked[j+ 1] := false;2647 lstCIRNLocations.Items[j+ 1] := pieces(s, '^', 1, 3) + '^' + TC_DGSR_ERR;2961 lstCIRNLocations.Checked[j+2] := false; 2962 lstCIRNLocations.Items[j+2] := pieces(s, '^', 1, 3) + '^' + TC_DGSR_ERR; 2648 2963 TRemoteSite(Items[j]).Selected := false; 2649 2964 Continue; … … 2651 2966 end; 2652 2967 DGSR_NONE: begin 2653 lstCIRNLocations.Checked[j+ 1] := true;2968 lstCIRNLocations.Checked[j+2] := true; 2654 2969 TRemoteSite(RemoteSites.SiteList[j]).ReportClear; 2655 2970 TRemoteSite(RemoteSites.SiteList[j]).LabClear; … … 2658 2973 DGSR_SHOW: begin 2659 2974 InfoBox(AMsg, TC_DGSR_SHOW, MB_OK); 2660 lstCIRNLocations.Checked[j+ 1] := true;2975 lstCIRNLocations.Checked[j+2] := true; 2661 2976 TRemoteSite(RemoteSites.SiteList[j]).ReportClear; 2662 2977 TRemoteSite(RemoteSites.SiteList[j]).LabClear; … … 2666 2981 MB_DEFBUTTON2) = IDYES then 2667 2982 begin 2668 lstCIRNLocations.Checked[j+ 1] := true;2983 lstCIRNLocations.Checked[j+2] := true; 2669 2984 TRemoteSite(RemoteSites.SiteList[j]).ReportClear; 2670 2985 TRemoteSite(RemoteSites.SiteList[j]).LabClear; … … 2673 2988 else 2674 2989 begin 2675 lstCIRNLocations.Checked[j+ 1] := false;2676 lstCIRNLocations.Items[j+ 1] := pieces(s, '^', 1, 3) + '^' + TC_DGSR_SHOW;2990 lstCIRNLocations.Checked[j+2] := false; 2991 lstCIRNLocations.Items[j+2] := pieces(s, '^', 1, 3) + '^' + TC_DGSR_SHOW; 2677 2992 TRemoteSite(Items[j]).Selected := false; 2678 2993 Continue; … … 2680 2995 else begin 2681 2996 InfoBox(AMsg, TC_DGSR_DENY, MB_OK); 2682 lstCIRNLocations.Checked[j+ 1] := false;2683 lstCIRNLocations.Items[j+ 1] := pieces(s, '^', 1, 3) + '^' + TC_DGSR_DENY;2997 lstCIRNLocations.Checked[j+2] := false; 2998 lstCIRNLocations.Items[j+2] := pieces(s, '^', 1, 3) + '^' + TC_DGSR_DENY; 2684 2999 TRemoteSite(Items[j]).Selected := false; 2685 3000 Continue; … … 2690 3005 else 2691 3006 begin 2692 if iIndex > -1then3007 if iIndex > 0 then 2693 3008 begin 2694 3009 iCur := iIndex - iAll; … … 2779 3094 TRemoteSite(Items[j])); 2780 3095 end; 2781 frmLabs.TabControl1.OnChange(nil); 2782 frmReports.TabControl1.OnChange(nil); 3096 //frmLabs.TabControl1.OnChange(nil); 3097 //frmReports.TabControl1.OnChange(nil); 3098 if frmReports.tvReports.SelectionCount > 0 then frmReports.tvReportsClick(self); 3099 if frmLabs.lstReports.ItemIndex > -1 then frmLabs.ExtlstReportsClick(self, true); 2783 3100 StatusText(''); 2784 3101 end; … … 2817 3134 procedure TfrmFrame.lstCIRNLocationsChange(Sender: TObject); 2818 3135 begin 2819 if lstCIRNLocations.ItemIndex > -1then3136 if lstCIRNLocations.ItemIndex > 0 then 2820 3137 if (lstCIRNLocations.Selected[lstCIRNLocations.ItemIndex] = true) and (uUpdateStat = false) then 2821 if not (piece(lstCIRNLocations.Items[ 0],'^',1) = '0') then3138 if not (piece(lstCIRNLocations.Items[1],'^',1) = '0') then 2822 3139 lstCIRNLocations.OnClick(nil); 2823 3140 end; … … 2852 3169 if not Notifications.Active then Exit; 2853 3170 case Notifications.Followup of 2854 NF_MEDICATIONS_EXPIRING : AlertType := 'Expiring Medications'; 3171 NF_MEDICATIONS_EXPIRING_INPT : AlertType := 'Expiring Medications'; 3172 NF_MEDICATIONS_EXPIRING_OUTPT : AlertType := 'Expiring Medications'; 2855 3173 NF_ORDER_REQUIRES_ELEC_SIGNATURE: AlertType := 'Unsigned Orders'; 2856 3174 NF_FLAGGED_ORDERS : AlertType := 'Flagged Orders (for clarification)'; … … 2935 3253 FOSTFhintWindow.ReleaseHandle; 2936 3254 FOSTFHintWndActive := False ; 2937 3255 end; 3256 if FHintWinActive then // graphing - hints on values 3257 begin 3258 FHintWin.ReleaseHandle; 3259 FHintWinActive := false; 2938 3260 end; 2939 3261 end; … … 3080 3402 Patient.Clear; 3081 3403 Patient.DFN := tmpDFN; 3404 uCore.TempEncounterLoc := 0; //hds7591 Clinic/Ward movement. 3405 uCore.TempEncounterLocName := ''; //hds7591 Clinic/Ward movement. 3082 3406 3083 3407 if (FPrevInPatient and Patient.Inpatient) then //transfering inside hospital … … 3092 3416 begin 3093 3417 Encounter.Inpatient := True; 3418 uCore.TempEncounterLoc := Encounter.Location; //hds7591 Clinic/Ward movement. 3419 uCore.TempEncounterLocName := Encounter.LocationName; //hds7591 Clinic/Ward movement. 3094 3420 Encounter.Location := Patient.Location; 3095 3421 Encounter.DateTime := Patient.AdmitTime; … … 3101 3427 end; 3102 3428 3103 procedure TfrmFrame.FormKeyDown(Sender: TObject; var Key: Word; 3104 Shift: TShiftState); 3429 procedure TfrmFrame.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 3105 3430 var 3106 3431 NewTabIndex: integer; … … 3108 3433 //CQ2844: Toggle Remote Data button using Alt+R 3109 3434 case Key of 3110 82,114: begin 3111 if (ssAlt in Shift) then 3435 82,114: if (ssAlt in Shift) then 3112 3436 frmFrame.pnlCIRNClick(Sender); 3113 end;3114 3437 end; 3115 3438 … … 3173 3496 procedure TfrmFrame.pnlPatientClick(Sender: TObject); 3174 3497 begin 3175 mnuViewDemoClick(Self);3498 ViewInfo(mnuViewDemo); 3176 3499 end; 3177 3500 3178 3501 procedure TfrmFrame.pnlVisitClick(Sender: TObject); 3179 3502 begin 3180 if (not User.IsReportsOnly) then // Reports Only tab. 3181 mnuFileEncounterClick(Self); 3503 //if (not User.IsReportsOnly) then // Reports Only tab. 3504 // mnuFileEncounterClick(Self); 3505 ViewInfo(mnuViewVisits); 3182 3506 end; 3183 3507 3184 3508 procedure TfrmFrame.pnlPrimaryCareClick(Sender: TObject); 3185 3509 begin 3186 ReportBox(DetailPrimaryCare(Patient.DFN), 'Primary Care', True); 3510 //ReportBox(DetailPrimaryCare(Patient.DFN), 'Primary Care', True); 3511 ViewInfo(mnuViewPrimaryCare); 3187 3512 end; 3188 3513 … … 3190 3515 begin 3191 3516 if(pnlReminders.tag = HAVE_REMINDERS) then 3192 mnuViewRemindersClick(Self); 3517 ViewInfo(mnuViewReminders); 3518 3193 3519 end; 3194 3520 3195 3521 procedure TfrmFrame.pnlPostingsClick(Sender: TObject); 3196 3522 begin 3197 mnuViewPostingsClick(Self);3523 ViewInfo(mnuViewPostings); 3198 3524 end; 3199 3525 … … 3216 3542 end; 3217 3543 3218 function TfrmFrame.AllowCCOWContextChange( NewDFN: string): boolean;3544 function TfrmFrame.AllowCCOWContextChange(var CCOWResponse: UserResponse; NewDFN: string): boolean; 3219 3545 var 3220 3546 PtData : IContextItemCollection; … … 3248 3574 IsProdAcct := User.IsProductionAccount; 3249 3575 3576 {$IFDEF CCOWBROKER} 3577 //IsProdAcct := RPCBrokerV.Login.IsProduction; //not yet 3578 {$ENDIF} 3579 3250 3580 PtDataItem2 := CoContextItem.Create(); 3251 3581 PtDataItem2.Set_Name('Patient.co.PatientName'); // Patient.Name … … 3293 3623 end; 3294 3624 3625 CCOWResponse := response; 3295 3626 if (response = UrCommit) then 3296 3627 begin … … 3355 3686 Reason, HyperLinkReason: string; 3356 3687 PtChanged: boolean; 3688 {$IFDEF CCOWBROKER} 3689 UserChanged: boolean; 3690 {$ENDIF} 3357 3691 begin 3358 3692 // If the app would lose data, or have other problems changing context at … … 3370 3704 try 3371 3705 CheckForDifferentPatient(aContextItemCollection, PtChanged); 3706 {$IFDEF CCOWBROKER} 3707 CheckForDifferentUser(aContextItemCollection, UserChanged); 3708 {$ENDIF} 3372 3709 except 3373 3710 on E: Exception do HandleCCOWError(E.Message); … … 3379 3716 end; 3380 3717 3718 {$IFDEF CCOWBROKER} 3719 if PtChanged or UserChanged then 3720 {$ELSE} 3381 3721 if PtChanged then 3722 {$ENDIF} 3382 3723 begin 3383 3724 FCCOWContextChanging := True; … … 3404 3745 FCCOWError := False; 3405 3746 try 3406 CheckForDifferentPatient(ctxContextor.CurrentContext, PtChanged); 3747 {$IFDEF CCOWBROKER} 3748 with RPCBrokerV do if (WasUserDefined and IsUserCleared and (ctxContextor.CurrentContext.Present(CCOW_USER_NAME) = nil)) then // RV 05/11/04 3749 begin 3750 Reason := 'COMMIT'; 3751 if AllowContextChangeAll(Reason) then 3752 begin 3753 Close; 3754 Exit; 3755 end; 3756 end; 3757 {$ENDIF} 3758 CheckForDifferentPatient(ctxContextor.CurrentContext, PtChanged); 3407 3759 except 3408 3760 on E: Exception do HandleCCOWError(E.Message); … … 3457 3809 end; 3458 3810 IsProdAcct := User.IsProductionAccount; 3811 {$IFDEF CCOWBROKER} 3812 //IsProdAcct := RPCBrokerV.Login.IsProduction; //not yet 3813 {$ENDIF} 3459 3814 // Get an item collection of the current context 3460 3815 FCCOWError := False; … … 3495 3850 //PtDFN := FindBestCCOWDFN(PtName); 3496 3851 PtDFN := FindBestCCOWDFN; 3497 if PtDFN <> ''then3852 if StrToInt64Def(PtDFN, 0) > 0 then 3498 3853 begin 3499 3854 // Select new patient based on context value … … 3517 3872 end; 3518 3873 if User.IsProvider then Encounter.Provider := User.DUZ; 3519 SetupPatient; 3874 if not FFirstLoad then SetupPatient; 3875 frmCover.UpdateVAAButton; //VAA 3520 3876 DetermineNextTab; 3521 3877 tabPage.TabIndex := PageIDToTab(NextTab); … … 3571 3927 3572 3928 procedure TfrmFrame.mnuFileResumeContextSetClick(Sender: TObject); 3573 begin 3929 var 3930 CCOWResponse: UserResponse; 3931 Reason: string; 3932 begin 3933 Reason := ''; 3934 if not AllowContextChangeAll(Reason) then exit; 3574 3935 FCCOWIconName := 'BMP_CCOW_CHANGING'; 3575 3936 pnlCCOW.Hint := TX_CCOW_CHANGING; … … 3582 3943 end; 3583 3944 if FCCOWError then exit; 3584 if (AllowCCOWContextChange( Patient.DFN)) then3945 if (AllowCCOWContextChange(CCOWResponse, Patient.DFN)) then 3585 3946 begin 3586 3947 mnuFileResumeContext.Enabled := False; … … 3598 3959 pnlCCOW.Hint := TX_CCOW_BROKEN; 3599 3960 imgCCOW.Picture.BitMap.LoadFromResourceName(hInstance, FCCOWIconName); 3961 try 3962 if ctxContextor.State in [csParticipating] then ctxContextor.Suspend; 3963 except 3964 on E: Exception do HandleCCOWError(E.Message); 3965 end; 3600 3966 end; 3601 3967 SetupPatient; … … 3607 3973 var 3608 3974 data : IContextItemCollection; 3609 anItem 3975 anItem: IContextItem; 3610 3976 PtDFN, PtName: string; 3611 3977 begin … … 3623 3989 PtChanged := not ((PtDFN = Patient.DFN) and (PtName = Piece(Patient.Name, ',', 1) + U + Piece(Patient.Name, ',', 2) + '^^^^')); 3624 3990 end; 3991 3992 {$IFDEF CCOWBROKER} 3993 procedure TfrmFrame.CheckForDifferentUser(aContextItemCollection: IDispatch; var UserChanged: boolean); 3994 var 3995 data : IContextItemCollection; 3996 begin 3997 if uCore.User = nil then 3998 begin 3999 UserChanged := False; 4000 Exit; 4001 end; 4002 data := IContextItemCollection(aContextItemCollection) ; 4003 UserChanged := RPCBrokerV.IsUserContextPending(data); 4004 end; 4005 {$ENDIF} 3625 4006 3626 4007 procedure TfrmFrame.CheckHyperlinkResponse(aContextItemCollection: IDispatch; var HyperlinkReason: string); … … 3651 4032 procedure TfrmFrame.HideEverything; 3652 4033 begin 4034 FNoPatientSelected := TRUE; 3653 4035 pnlNoPatientSelected.Visible := True; 3654 4036 pnlNoPatientSelected.BringToFront; … … 3671 4053 procedure TfrmFrame.ShowEverything; 3672 4054 begin 4055 FNoPatientSelected := FALSE; 3673 4056 pnlNoPatientSelected.Visible := False; 3674 4057 pnlNoPatientSelected.SendToBack; … … 3711 4094 procedure TfrmFrame.pnlFlagClick(Sender: TObject); 3712 4095 begin 3713 ShowFlags; 4096 //ShowFlags; 4097 ViewInfo(mnuViewFlags); 3714 4098 end; 3715 4099 … … 3812 4196 3813 4197 procedure TfrmFrame.ScreenActiveFormChange(Sender: TObject); 4198 begin 4199 if(assigned(FOldActiveFormChange)) then 4200 FOldActiveFormChange(Sender); 4201 //Focus the Form that Stays on Top after the Application Regains focus. 4202 if FJustEnteredApp then 4203 FocusApplicationTopForm; 4204 FJustEnteredApp := false; 4205 end; 4206 4207 procedure TfrmFrame.FocusApplicationTopForm; 3814 4208 var 3815 4209 I : integer; 3816 4210 begin 3817 //Locate the Form that Stays on Top after the Application Regains focus. 3818 if FJustEnteredApp then 3819 begin 3820 for I := (Screen.FormCount-1) downto 0 do //Set the last one opened last 3821 begin 3822 with Screen.Forms[I] do 3823 if (FormStyle = fsStayOnTop) and (Enabled) and (Visible) then 3824 SetFocus; 4211 for I := (Screen.FormCount-1) downto 0 do //Set the last one opened last 4212 begin 4213 with Screen.Forms[I] do 4214 if (FormStyle = fsStayOnTop) and (Enabled) and (Visible) then 4215 SetFocus; 4216 end; 4217 end; 4218 4219 procedure TfrmFrame.AppEventsShortCut(var Msg: TWMKey; 4220 var Handled: Boolean); 4221 begin 4222 if ((Boolean(Hi(GetKeyState(VK_MENU{ALT})))) and (Msg.CharCode = VK_F1)) then 4223 begin 4224 FocusApplicationTopForm; 4225 Handled := True; 4226 end; 4227 end; 4228 4229 procedure TfrmFrame.mnuToolsGraphingClick(Sender: TObject); 4230 begin 4231 Screen.Cursor := crHourGlass; 4232 if GraphFloat = nil then // new graph 4233 begin 4234 GraphFloat := TfrmGraphs.Create(self); 4235 try 4236 with GraphFloat do 4237 begin 4238 if btnClose.Tag = 1 then 4239 Exit; 4240 Initialize; 4241 Caption := 'CPRS Graphing - Patient: ' + MixedCase(Patient.Name); 4242 BorderIcons := [biSystemMenu, biMaximize, biMinimize]; 4243 BorderStyle := bsSizeable; 4244 BorderWidth := 1; 4245 // context sensitive type (tabPage.TabIndex) & [item] 4246 ResizeAnchoredFormToFont(GraphFloat); 4247 Show; 4248 end; 4249 finally 4250 if GraphFloat.btnClose.Tag = 1 then 4251 begin 4252 GraphFloatActive := false; 4253 GraphFloat.Free; 4254 GraphFloat := nil; 4255 end 4256 else 4257 GraphFloatActive := true; 3825 4258 end; 3826 FJustEnteredApp := false; 3827 end; 3828 end; 3829 4259 end 4260 else if GraphFloat.btnClose.Tag = 1 then 4261 Exit 4262 else if GraphFloatActive and (GraphFloat.lstTypes.Hint = Patient.DFN) then 4263 GraphFloat.BringToFront // graph is active, same patient 4264 else if GraphFloat.lstTypes.Hint = Patient.DFN then 4265 begin // graph is not active, same patient 4266 // context sensitive 4267 GraphFloat.Show; 4268 GraphFloatActive := true; 4269 end 4270 else 4271 //with GraphFloat do // new patient 4272 begin 4273 GraphFloat.InitialRetain; 4274 GraphFloatActive := false; 4275 GraphFloat.Free; 4276 GraphFloat := nil; 4277 mnuToolsGraphingClick(self); // delete and recurse 4278 {//FormCreate(self); //**************** 4279 Initialize; 4280 DisplayData('top'); 4281 DisplayData('bottom'); 4282 lstCheck.Items.Clear; 4283 Caption := 'CPRS Graphing - Patient: ' + MixedCase(Patient.Name); 4284 // context sensitive 4285 Show; 4286 GraphFloatActive := true;} 4287 end; 4288 Screen.Cursor := crDefault; 4289 end; 4290 4291 procedure TfrmFrame.pnlCIRNMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 4292 begin 4293 pnlCIRN.BevelOuter := bvLowered; 4294 end; 4295 4296 procedure TfrmFrame.pnlCIRNMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 4297 begin 4298 pnlCIRN.BevelOuter := bvRaised; 4299 end; 4300 4301 procedure TfrmFrame.laMHVClick(Sender: TObject); 4302 begin 4303 //if laMHV.Caption = 'MHV' then 4304 // ShellExecute(Handle, 'open', PChar('http://www.myhealth.va.gov/'), '', '', SW_NORMAL); 4305 ViewInfo(mnuViewMyHealtheVet); 4306 end; 4307 4308 procedure TfrmFrame.laVAA2Click(Sender: TObject); 4309 {var 4310 InsuranceSubscriberName: string; 4311 ReportString: TStringList; //CQ7782 } 4312 begin 4313 {if fCover.VAAFlag[0] <> '0' then //'0' means subscriber not found 4314 begin 4315 InsuranceSubscriberName := fCover.VAAFlag[12]; 4316 //CQ7782 4317 //ReportString := TStringList.Create; 4318 ReportString := VAAFlag; 4319 ReportString[0] := ''; 4320 ReportBox(ReportString, InsuranceSubscriberName, True); 4321 //end CQ7782 4322 end;} 4323 ViewInfo(mnuInsurance); 4324 end; 4325 4326 procedure TfrmFrame.ViewInfo(Sender: TObject); 4327 var 4328 SelectNew: Boolean; 4329 InsuranceSubscriberName: string; 4330 ReportString: TStringList; 4331 aAddress: string; 4332 begin 4333 case (Sender as TMenuItem).Tag of 4334 1:begin { displays patient inquiry report (which optionally allows new patient to be selected) } 4335 StatusText(TX_PTINQ); 4336 PatientInquiry(SelectNew); 4337 if Assigned(FLastPage) then 4338 FLastPage.FocusFirstControl; 4339 StatusText(''); 4340 if SelectNew then mnuFileOpenClick(mnuViewDemo); 4341 end; 4342 2:begin 4343 if (not User.IsReportsOnly) then // Reports Only tab. 4344 mnuFileEncounterClick(Self); 4345 end; 4346 3:begin 4347 ReportBox(DetailPrimaryCare(Patient.DFN), 'Primary Care', True); 4348 end; 4349 4:begin 4350 if laMHV.Caption = 'MHV' then 4351 ShellExecute(laMHV.Handle, 'open', PChar('http://www.myhealth.va.gov/'), '', '', SW_NORMAL); 4352 end; 4353 5:begin 4354 if fCover.VAAFlag[0] <> '0' then //'0' means subscriber not found 4355 begin 4356 InsuranceSubscriberName := fCover.VAAFlag[12]; 4357 ReportString := VAAFlag; 4358 ReportString[0] := ''; 4359 ReportBox(ReportString, InsuranceSubscriberName, True); 4360 end; 4361 end; 4362 6:begin 4363 ShowFlags; 4364 end; 4365 7:begin 4366 if UseVistaWeb then 4367 begin 4368 pnlCIRN.BevelOuter := bvRaised; 4369 pnlCIRN.Hint := 'Click to open VistaWeb'; 4370 lblCIRN.Width := 43; 4371 lblCIRNData.Width := 43; 4372 lblCIRNData.Alignment := taCenter; 4373 lblCIRN.Alignment := taCenter; 4374 lstCIRNLocations.Visible := false; 4375 lstCIRNLocations.SendToBack; 4376 aAddress := GetVistaWebAddress(Patient.DFN); 4377 ShellExecute(pnlCirn.Handle, 'open', PChar(aAddress), PChar(''), '', SW_NORMAL); 4378 Exit; 4379 end; 4380 if not RemoteSites.RemoteDataExists then Exit; 4381 if (not lstCIRNLocations.Visible) then 4382 begin 4383 pnlCIRN.BevelOuter := bvLowered; 4384 lstCIRNLocations.Visible := True; 4385 lstCIRNLocations.BringToFront; 4386 lstCIRNLocations.SetFocus; 4387 pnlCIRN.Hint := 'Click to close list.'; 4388 end 4389 else 4390 begin 4391 pnlCIRN.BevelOuter := bvRaised; 4392 lstCIRNLocations.Visible := False; 4393 lstCIRNLocations.SendToBack; 4394 pnlCIRN.Hint := 'Click to display other facilities having data for this patient.'; 4395 end; 4396 end; 4397 8:begin 4398 ViewReminderTree; 4399 end; 4400 9:begin { displays the window that shows crisis notes, warnings, allergies, & advance directives } 4401 ShowCWAD; 4402 end; 4403 end; 4404 end; 4405 4406 procedure TfrmFrame.mnuViewInformationClick(Sender: TObject); 4407 begin 4408 mnuViewDemo.Enabled := frmFrame.pnlPatient.Enabled; 4409 mnuViewVisits.Enabled := frmFrame.pnlVisit.Enabled; 4410 mnuViewPrimaryCare.Enabled := frmFrame.pnlPrimaryCare.Enabled; 4411 mnuViewMyHealtheVet.Enabled := not (Copy(frmFrame.laMHV.Hint, 1, 2) = 'No'); 4412 mnuInsurance.Enabled := not (Copy(frmFrame.laVAA2.Hint, 1, 2) = 'No'); 4413 mnuViewFlags.Enabled := frmFrame.lblFlag.Enabled; 4414 mnuViewRemoteData.Enabled := frmFrame.lblCirn.Enabled; 4415 mnuViewReminders.Enabled := frmFrame.pnlReminders.Enabled; 4416 mnuViewPostings.Enabled := frmFrame.pnlPostings.Enabled; 4417 end; 3830 4418 3831 4419 initialization … … 3833 4421 finalization 3834 4422 4423 3835 4424 end. 3836 4425 4426
Note:
See TracChangeset
for help on using the changeset viewer.