Changeset 460 for cprs/branches/foia-cprs/CPRS-Chart/fMeds.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/fMeds.pas
r459 r460 72 72 lstMedsOut: TCaptionListBox; 73 73 hdrMedsOut: THeaderControl; 74 mnuViewInformation: TMenuItem; 75 mnuViewDemo: TMenuItem; 76 mnuViewVisits: TMenuItem; 77 mnuViewPrimaryCare: TMenuItem; 78 mnuViewMyHealtheVet: TMenuItem; 79 mnuInsurance: TMenuItem; 80 mnuViewFlags: TMenuItem; 81 mnuViewReminders: TMenuItem; 82 mnuViewRemoteData: TMenuItem; 83 mnuViewPostings: TMenuItem; 84 mnuOptimizeFields: TMenuItem; 74 85 procedure mnuChartTabClick(Sender: TObject); 75 86 procedure FormCreate(Sender: TObject); … … 96 107 procedure mnuActRefillClick(Sender: TObject); 97 108 procedure mnuActClick(Sender: TObject); 98 procedure pnlMedOut1Resize(Sender: TObject);99 109 procedure mnuViewHistoryClick(Sender: TObject); 100 110 procedure popMedPopup(Sender: TObject); … … 114 124 procedure splitBottomMoved(Sender: TObject); 115 125 procedure splitTopMoved(Sender: TObject); 126 procedure hdrMedsOutMouseDown(Sender: TObject; Button: TMouseButton; 127 Shift: TShiftState; X, Y: Integer); 128 procedure hdrMedsNonVAMouseDown(Sender: TObject; Button: TMouseButton; 129 Shift: TShiftState; X, Y: Integer); 130 procedure hdrMedsInMouseDown(Sender: TObject; Button: TMouseButton; 131 Shift: TShiftState; X, Y: Integer); 132 procedure hdrMedsOutMouseUp(Sender: TObject; Button: TMouseButton; 133 Shift: TShiftState; X, Y: Integer); 134 procedure hdrMedsNonVAMouseUp(Sender: TObject; Button: TMouseButton; 135 Shift: TShiftState; X, Y: Integer); 136 procedure hdrMedsInMouseUp(Sender: TObject; Button: TMouseButton; 137 Shift: TShiftState; X, Y: Integer); 138 //procedure ActivateDeactiveRenew(AListBox: TListBox); 139 procedure ViewInfo(Sender: TObject); 140 procedure mnuViewInformationClick(Sender: TObject); 141 procedure mnuOptimizeFieldsClick(Sender: TObject); 142 procedure hdrMedsOutSectionClick(HeaderControl: THeaderControl; 143 Section: THeaderSection); 144 procedure hdrMedsNonVASectionClick(HeaderControl: THeaderControl; 145 Section: THeaderSection); 146 procedure hdrMedsInSectionClick(HeaderControl: THeaderControl; 147 Section: THeaderSection); 116 148 private 117 149 FIterating: Boolean; … … 138 170 function GetMedList(Control: TWinControl): TList; 139 171 function GetPharmacyOrders(Control: TWinControl): TStringList; 172 function PatientStatusChanged: boolean; 173 procedure ClearChildODList; 140 174 public 141 function PctOfTotalHeight(thisPanel: TPanel) : integer;142 175 procedure RefreshMedLists; 143 176 procedure ClearPtData; override; … … 148 181 property ParentComplexOrderID: string read FParentComplexOrderID write FParentComplexOrderID; 149 182 procedure InitfMedsSize; 150 end; 183 procedure SetSectionWidths(Sender: TObject); 184 function GetTotalSectionsWidth(Sender: TObject) : integer; 185 function CheckMedStatus(ActiveList: TListBox): boolean; 186 end; 187 188 type 189 arOrigOutPtSecWidths = array[0..6] of integer; //CQ7586 190 arOrigInPtSecWidths = array[0..4] of integer; //CQ7586 191 arOrigNonVASecWidths = array[0..3] of integer; //CQ7586 151 192 152 193 var … … 154 195 // LargePanelPortion: Integer; 155 196 // SmallPanelPortion: integer; 197 198 OrigOutPtSecWidths: arOrigOutPtSecWidths; //CQ7586 199 OrigInPtSecWidths : arOrigInPtSecWidths; //CQ7586 200 OrigNonVASecWidths: arOrigNonVASecWidths; //CQ7586 201 156 202 MedOutSize: double; 157 203 s: string; … … 161 207 162 208 totalHeight: integer; 163 MedOutPctOfTotalHeight: integer;164 NonVAPctOfTotalHeight: integer;165 MedInpctOfTotalHeight : integer;166 209 167 210 resizedTotalHeight: integer; … … 171 214 172 215 splitterTop: TSplitter; 173 splitterBottom: TSplitter; 216 splitterBottom: TSplitter; 217 218 oldFont: integer; //CQ9182 219 174 220 175 221 implementation 176 222 177 uses uCore, fFrame, fRptBox, uOrders, fODBase, fOrdersDC, fOrdersHold, 178 fOrdersRenew, fOMNavA, fOrdersRefill, fMedCopy, fOrders, fODChild, rODBase; 223 uses uCore, rCore, fFrame, fRptBox, uOrders, fODBase, fOrdersDC, fOrdersHold, 224 fOrdersRenew, fOMNavA, fOrdersRefill, fMedCopy, fOrders, fODChild, rODBase, 225 StrUtils, fActivateDeactivate; 179 226 180 227 {$R *.DFM} 181 228 182 229 const 230 SMALL_PANEL = 20; 231 LARGE_PANEL = 60; 183 232 COL_MEDNAME = 1; 184 233 DG_OUT = 0; … … 215 264 begin 216 265 inherited ClearPtData; 266 ClearChildODList; 217 267 lstMedsIn.Clear; 218 268 lstMedsOut.Clear; … … 225 275 uPharmacyOrdersOut.Clear; 226 276 uMedListNonVA.Clear; 277 totalHeight := 0; 227 278 228 279 end; … … 231 282 const 232 283 RATIO_SMALL = 0.13; //0.1866; 284 285 233 286 begin 234 287 inherited DisplayPage; … … 251 304 252 305 if Patient.Inpatient then 253 306 begin 254 307 splitBottom.Align := alNone; 255 hdrMedsIn.Align := alNone; 256 257 lstMedsIn.Parent := pnlTop; 258 lstMedsIn.Align := alClient; 308 hdrMedsIn.Align := alNone; 309 lstMedsIn.Align := alNone; 310 311 lstMedsIn.Parent := pnlTop; 312 lstMedsIn.Align := alClient; 259 313 lstMedsOut.Parent := pnlMedIn; 260 314 261 hdrMedsIn.Parent := pnlTop;262 hdrMedsIn.Align := alTop;315 hdrMedsIn.Parent := pnlTop; 316 hdrMedsIn.Align := alTop; 263 317 264 318 hdrMedsOut.Parent := pnlMedIn; 265 splitBottom.Align := alBottom; 266 end 319 splitBottom.Align := alBottom; 320 321 lstMedsIn.Height := lstMedsIn.Height - 1; // added to cause repaint if user makes area small 322 lstMedsIn.Height := lstMedsIn.Height + 1; // added to cause repaint if user makes area small. 323 lstMedsOut.Height := lstMedsOut.Height + 1; // added to cause repaint if user makes area small 324 lstMedsOut.Height := lstMedsOut.Height - 1; // added to cause repaint if user makes area small 325 326 end 267 327 else 268 328 begin 269 splitBottom.Align := alNone; 270 hdrMedsIn.Align := alNone; 271 272 lstMedsIn.Parent := pnlMedIn; 273 lstMedsOut.Parent := pnlTop; 274 lstMedsOut.Align := alClient; 275 276 hdrMedsIn.Parent := pnlMedIn; 277 hdrMedsIn.Align := alTop; 278 279 hdrMedsOut.Parent := pnlTop; 280 splitBottom.Align := alBottom; 329 splitBottom.Align := alNone; 330 hdrMedsIn.Align := alNone; 331 332 lstMedsIn.Parent := pnlMedIn; 333 lstMedsOut.Parent := pnlTop; 334 lstMedsOut.Align := alClient; 335 336 hdrMedsIn.Parent := pnlMedIn; 337 hdrMedsIn.Align := alTop; 338 339 hdrMedsOut.Parent := pnlTop; 340 splitBottom.Align := alBottom; 341 342 lstMedsIn.Height := lstMedsIn.Height - 1; // added to cause repaint if user makes area small 343 lstMedsIn.Height := lstMedsIn.Height + 1; // added to cause repaint if user makes area small. 344 lstMedsOut.Height := lstMedsOut.Height + 1; // added to cause repaint if user makes area small 345 lstMedsOut.Height := lstMedsOut.Height - 1; // added to cause repaint if user makes area small 281 346 end; 282 283 284 RefreshMedLists; 347 RefreshMedLists; 285 348 286 349 end; … … 332 395 if AnOrder <> nil then 333 396 begin 397 //AGP Change 26.24 CQ 7150 fixes the problem with non-va meds initially showing up in the inpatient section 334 398 if uDGrp[DG_OUT] = AnOrder.DGroup then AMedList := uMedListOut; 335 for i := 1 to 6 do if uDGrp[i] = AnOrder.DGroup then AMedList := uMedListIn; 399 If uDGrp[DG_NVA] = AnOrder.DGroup then AMedList := uMedListNonVA; 400 if (AMedList <> uMedListOut) and (AMedList <> uMedListNonVA) then 401 for i := 1 to 6 do if uDGrp[i] = AnOrder.DGroup then AMedList := uMedListIn; 336 402 end; 337 403 case OrderAction of … … 409 475 end 410 476 else uPendingChanges.Add(Piece(AnOrder.ActionOn, ';', 1) + '=' + 411 Piece(AnOrder.ActionOn, '=', 2) + U + AnOrder.ID + '^^' + AnOrder.OrderLocName); 477 Piece(AnOrder.ActionOn, '=', 2) + U + AnOrder.ID + '^^' + AnOrder.OrderLocName); 478 412 479 end; {if AMedList} 413 480 ORDER_CPLXRN: … … 450 517 begin 451 518 inherited SetFontSize(FontSize); 519 mnuOptimizeFieldsClick(self); 452 520 if Patient.DFN <> '' then 453 521 RefreshMedLists; … … 459 527 var 460 528 medsSplitFnd : boolean; 461 panelBottom, panelMedIn : integer;462 529 retList : TStringList; 463 530 i: integer; … … 486 553 ChildODList := TStringList.Create; 487 554 488 555 556 489 557 //DETECT 1st TIME USER. 490 558 //If first time user (medSplitFound=false), then manually set panel heights. … … 501 569 if strPos(PChar(x),PChar(MEDS_SPLIT_FORM)) <> nil then 502 570 begin 503 medsSplitFnd := TRUE;571 medsSplitFnd := False;//TRUE; 504 572 Break; 505 573 end; … … 510 578 pnlBottom.Height := frmMeds.Height div 2; 511 579 pnlMedIn.Height := pnlBottom.Height div 2; 512 panelBottom := pnlBottom.Height;513 panelMedIn := pnlMedIn.Height;514 580 end; 515 581 end; 516 582 517 518 583 //CQ9622 584 if hdrMedsIn.Sections[1].Width < 100 then 585 begin 586 hdrMedsIn.Sections[1].Width := 100; 587 hdrMedsIn.Refresh; 588 end; 589 if hdrMedsNonVA.Sections[1].Width < 100 then 590 begin 591 hdrMedsNonVA.Sections[1].Width := 100; 592 lstMedsNonVA.Refresh; 593 end; 594 if hdrMedsOut.Sections[1].Width < 100 then 595 begin 596 hdrMedsOut.Sections[1].Width := 100; 597 hdrMedsOut.Refresh; 598 end; 599 //end CQ9622 519 600 end; 520 601 … … 522 603 begin 523 604 inherited; 605 ClearChildODList; 524 606 ClearMedList(uMedListIn); 525 607 ClearMedList(uMedListOut); … … 706 788 result := ''; 707 789 Detail := ''; 790 if AMed.Status = 'Suspended' then AMed.Status := 'Active/Susp'; //HDS00007547 PSI-03-033 Interim Solution. 708 791 case Column of 709 792 0: result := GetActionText(AMed); 710 793 1: result := GetInstructText(AMed, Detail); 711 794 2: result := FormatFMDateTime('mm/dd/yy', AMed.StopDate); 712 3: result := AMed.Status;795 3: result := AMed.Status; 713 796 4: 714 797 begin … … 748 831 TAG_INPT: result := hdrMedsIn; 749 832 750 else result := nil; 833 else 834 result := nil; 751 835 end; 752 836 end; … … 758 842 TAG_NONVA: result := uMedListNonVA; 759 843 TAG_INPT: result := uMedListIn; 760 else result := nil; 844 else 845 result := nil; 761 846 end; 762 847 end; … … 768 853 TAG_NONVA: result := uNonVAOrdersOut; 769 854 TAG_INPT: result := uPharmacyOrdersIn; 770 else 855 else 771 856 result := nil; 772 857 end; … … 813 898 end; 814 899 815 procedure TfrmMeds.lstMedsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; 816 State: TOwnerDrawState); 900 procedure TfrmMeds.lstMedsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); 817 901 var 818 902 ReturnHt: Integer; … … 838 922 begin 839 923 Canvas.Font.Style := [fsBold]; 840 if ColorToRGB(clWindowText) = ColorToRGB(clBlack) then 924 //AGP Change 26.29 CQ #8188 Fix for highlighted new meds displaying blue font with a blue background. 925 if odSelected in State then 926 begin 927 Canvas.Brush.Color := clHighlight; 928 Canvas.Font.Color := clHighlightText; 929 //Canvas.FillRect(ARect); 930 Canvas.Font.Color := clWhite; 931 end; 932 if (ColorToRGB(clWindowText) = ColorToRGB(clBlack)) and (Canvas.Font.Color <> clWhite) then 841 933 Canvas.Font.Color := clBlue; 842 934 if (Length(Piece(AnAction,'^',4)) > 0) then … … 851 943 ARect := ItemRect(Index); 852 944 ARect.Left := RectLeft + 2; 853 ARect.Right := ARect.Left + AHeader.Sections[i].Width - 6; 945 ARect.Right := (ARect.Left + AHeader.Sections[i].Width - 6); 946 947 //if ((ARect.Right - ARect.Left) < 100) then 948 //ARect.Right := ARect.Right + (100 - (ARect.Left + AHeader.Sections[i].Width - 6)); 949 854 950 ReturnHt := DrawText(Canvas.Handle, PChar(x), Length(x), ARect, DT_LEFT or DT_NOPREFIX 855 951 or DT_WORDBREAK); … … 884 980 begin 885 981 inherited; 982 983 if PatientStatusChanged then exit; 886 984 with lstMedsOut do for i := 0 to Items.Count -1 do 887 985 Selected[i] := false; … … 895 993 begin 896 994 inherited; 995 996 if PatientStatusChanged then exit; 897 997 with lstMedsIn do for i := 0 to Items.Count -1 do 898 998 Selected[i] := false; … … 901 1001 end; 902 1002 903 procedure TfrmMeds.hdrMedsOutSectionResize(HeaderControl: THeaderControl; 904 Section: THeaderSection); 1003 procedure TfrmMeds.hdrMedsOutSectionResize(HeaderControl: THeaderControl; Section: THeaderSection); 905 1004 begin 906 1005 inherited; … … 916 1015 end; 917 1016 918 procedure TfrmMeds.hdrMedsInSectionResize(HeaderControl: THeaderControl; 919 Section: THeaderSection); 1017 procedure TfrmMeds.hdrMedsInSectionResize(HeaderControl: THeaderControl; Section: THeaderSection); 920 1018 begin 921 1019 inherited; … … 926 1024 IntegralHeight := not IntegralHeight; // listbox window to be recreated 927 1025 end; 1026 928 1027 RedrawActivate(Self.Handle); 929 1028 lstMedsIn.Invalidate; … … 936 1035 begin 937 1036 inherited; 938 //frmFrame.UpdatePtInfoOnRefresh;1037 if PatientStatusChanged then exit; 939 1038 if lstMedsOut.SelCount > 0 then 940 1039 begin … … 972 1071 begin 973 1072 ValidateSelected(ActiveList, OA_DC, TX_NO_DC, TC_NO_DC); 1073 //ActivateDeactiveRenew(ActiveList); AGP 26.53 TURN OFF UNTIL FINAL DECISION CAN BE MADE 974 1074 MakeSelectedList(ActiveList, SelectedList); 975 1075 if ExecuteDCOrders(SelectedList,DelEvt) then … … 999 1099 if ActiveList = nil then Exit; 1000 1100 SelectedList := TList.Create; 1101 if CheckMedStatus(ActiveList) = True then Exit; 1001 1102 try 1002 1103 FIterating := True; … … 1034 1135 try 1035 1136 FIterating := True; 1137 if CheckMedStatus(ActiveList) = True then Exit; 1036 1138 if AuthorizedUser and EncounterPresent and LockedForOrdering then 1037 1139 begin … … 1084 1186 ChangeIFNList := TStringList.Create; 1085 1187 try 1188 FIterating := true; 1189 if CheckMedStatus(ActiveList) = True then Exit; 1190 ValidateSelected(ActiveList, OA_CHANGE, TX_NO_CHANGE, TC_NO_CHANGE); 1086 1191 MakeSelectedList(Activelist, SelectedList); 1087 1192 with SelectedList do for i := 0 to Count - 1 do ChangeIFNList.Add(TOrder(Items[i]).ID); … … 1136 1241 DoesDestEvtOccur := False; 1137 1242 ActiveList := ListSelected(TX_NOSEL); 1243 if CheckMedStatus(ActiveList) = True then Exit; 1138 1244 if ActiveList = nil then Exit; 1139 1245 NewOrderCreated := False; … … 1296 1402 if ActiveList = nil then Exit; 1297 1403 SelectedList := TList.Create; 1404 if CheckMedStatus(ActiveList) = True then Exit; 1298 1405 try 1299 1406 FIterating := True; … … 1344 1451 begin 1345 1452 Selected[i] := False; 1346 MessageDlg('You can not renew inpatient medication order on a clinic location for selected inpatient.', mtWarning, [mbOK], 0);1453 MessageDlg('You cannot renew inpatient medication orders from a clinic location for selected patient.', mtWarning, [mbOK], 0); 1347 1454 end; 1348 1455 CurID := uPendingChanges.Values[Piece(Piece(SomePharmacyOrders[i], U, 2), ';', 1)]; … … 1412 1519 end; 1413 1520 end; 1414 idx := -1;1415 1521 idx := ChildODList.IndexOf(AnOrder.ID); 1416 1522 if idx > - 1 then … … 1426 1532 1427 1533 procedure TfrmMeds.SynchListToOrders(AListBox: TListBox; AList: TList); 1428 { shows selected med orders as selected } 1429 //var 1430 // i, j: Integer; 1431 // AMedListRec: TMedListRec; 1432 // AnOrder: TOrder; 1433 begin 1434 // with AListBox do for i := 0 to Items.Count - 1 do 1435 // begin 1436 // AMedListRec := TMedListRec(AListBox.Items.Objects[i]); 1437 // with AList do for j := 0 to Count - 1 do 1438 // begin 1439 // AnOrder := TOrder(AList.Items[j]); 1440 // if Piece(AMedListRec.OrderID, ';', 1) = Piece(AnOrder.ID, ';', 1) then 1441 // begin 1442 // //AMedListRec.Instruct := AMedListRec.Instruct + ' * EDITED *'; 1443 // //AMedListRec.Action := MED_NEW; //*KCM* 1444 // //AListBox.Selected[i] := True; // resets valid selections to indicate changes //*KCM* 1445 // end; 1446 // end; 1447 // end; 1534 begin 1448 1535 AListBox.Invalidate; 1449 1536 end; 1450 1537 1451 procedure TfrmMeds.pnlMedOut1Resize(Sender: TObject);1452 begin1453 inherited;1454 //if pnlMedOut.Height < 20 then pnlMedOut.Height := 20;1455 end;1456 1457 1458 1538 procedure TfrmMeds.popMedPopup(Sender: TObject); 1459 1539 begin 1460 1540 inherited; 1461 //frmFrame.UpdatePtInfoOnRefresh;1541 if PatientStatusChanged then exit; 1462 1542 end; 1463 1543 … … 1465 1545 begin 1466 1546 inherited; 1467 //frmFrame.UpdatePtInfoOnRefresh;1547 if PatientStatusChanged then exit; 1468 1548 end; 1469 1549 … … 1473 1553 begin 1474 1554 inherited; 1555 if PatientStatusChanged then exit; 1475 1556 with lstMedsIn do for i := 0 to Items.Count -1 do 1476 1557 Selected[i] := false; … … 1491 1572 end; 1492 1573 1493 procedure TfrmMeds.hdrMedsNonVASectionResize(HeaderControl: THeaderControl; 1494 Section: THeaderSection); 1574 procedure TfrmMeds.hdrMedsNonVASectionResize(HeaderControl: THeaderControl; Section: THeaderSection); 1495 1575 begin 1496 1576 inherited; … … 1506 1586 end; 1507 1587 1508 function TfrmMeds.PctOfTotalHeight(thisPanel: TPanel) : integer; 1509 var 1510 pctOfTotal: real; 1511 begin 1512 pctOfTotal := ((thisPanel.Height / totalHeight) * 100); 1513 Result := Round(pctOfTotal); 1588 function FontChanged : boolean; 1589 //CQ9182: SEE ALSO procedure TfrmFrame.mnuFontSizeClick() 1590 begin 1591 Result := false; 1592 if Assigned(frmMeds) then 1593 begin 1594 if fMeds.oldFont = 0 then Result := False 1595 else 1596 if (fMeds.oldFont <> MainFontSize) then 1597 Result := true; 1598 end; 1514 1599 end; 1515 1600 1516 1601 procedure TfrmMeds.FormResize(Sender: TObject); 1602 var 1603 maxPanelHeight: integer; 1604 1517 1605 begin 1518 1606 inherited; 1519 1607 if Assigned(frmMeds) then 1608 begin 1609 //CQ9522 v26.51 Make sure all three panels are visible regardless of font size 1610 if Assigned(self.Parent) then 1520 1611 begin 1521 //Adjust splitter positions to always be in view, regardless of window size 1522 if (pnlBottom.Height > frmMeds.Height-50) then pnlBottom.Height := frmMeds.Height-50; 1523 if (pnlMedIn.Height > pnlBottom.Height-50) then pnlMedIn.Height := pnlBottom.Height-50; 1524 end; 1612 if self.Height > parent.ClientHeight then 1613 self.Height := parent.ClientHeight; 1614 maxPanelHeight := round((parent.ClientHeight-20)/3); 1615 if pnlTop.Height + pnlBottom.Height > parent.ClientHeight then 1616 begin 1617 pnlBottom.Height := maxPanelHeight*2; 1618 pnlTop.Height := maxPanelHeight; 1619 end; 1620 end; //assigned(self.parent) 1621 end; 1525 1622 end; 1526 1623 … … 1537 1634 inherited; 1538 1635 with hdrMedsOut do 1539 begin 1540 if Height < 16 then Height := 16; 1541 if Height > 16 then Height := 16; 1636 begin 1637 Height := TextHeightByFont(Font.Handle, Sections[0].Text); 1542 1638 Invalidate; 1543 1639 end; 1544 1640 end; 1545 1641 … … 1548 1644 inherited; 1549 1645 with hdrMedsNonVA do 1550 begin 1551 if Height < 16 then Height := 16; 1552 if Height > 16 then Height := 16; 1646 begin 1647 Height := TextHeightByFont(Font.Handle, Sections[0].Text); 1553 1648 Invalidate; 1554 1649 end; 1555 1650 end; 1556 1651 … … 1559 1654 inherited; 1560 1655 with hdrMedsIn do 1561 begin 1562 if Height < 16 then Height := 16; 1563 if Height > 16 then Height := 16; 1656 begin 1657 Height := TextHeightByFont(Font.Handle, Sections[0].Text); 1564 1658 Invalidate; 1565 1659 end; 1566 1660 end; 1567 1661 … … 1581 1675 begin 1582 1676 inherited; 1583 if splitBottom.Height > 5 thensplitBottom.Height := 5;1677 splitBottom.Height := 5; 1584 1678 end; 1585 1679 … … 1587 1681 begin 1588 1682 inherited; 1589 if splitTop.Height > 5 thensplitTop.Height := 5;1683 splitTop.Height := 5; 1590 1684 end; 1591 1685 … … 1612 1706 x := retList.strings[i]; 1613 1707 if strPos(PChar(x),PChar(MEDS_SPLIT_FORM)) <> nil then 1614 1708 begin 1615 1709 medsSplitFnd := TRUE; 1616 1710 Break; … … 1631 1725 end; 1632 1726 1727 function TfrmMeds.PatientStatusChanged: boolean; 1728 const 1729 1730 msgTxt1 = 'Patient status was changed from '; 1731 msgTxt2 = 'CPRS needs to refresh patient information to display patient latest record.'; 1732 //GE CQ9537 - Change message text 1733 msgTxt3 = 'Patient has been admitted.'; 1734 msgTxt4 = CRLF +'You will be prompted to sign your orders. Any new orders subsequently' + 1735 CRLF + 'entered and signed will be directed to the inpatient staff.'; 1736 1737 var 1738 PtSelect: TPtSelect; 1739 IsInpatientNow: boolean; 1740 ptSts: string; 1741 begin 1742 result := False; 1743 SelectPatient(Patient.DFN, PtSelect); 1744 IsInpatientNow := Length(PtSelect.Location) > 0; 1745 //GE CQ9537 - Change message text 1746 if Patient.Inpatient <> IsInpatientNow then 1747 begin 1748 if (not Patient.Inpatient) then MessageDlg(msgTxt3 + msgTxt4, mtWarning, [mbOK], 0); 1749 if Patient.Inpatient then ptSts := 'Inpatient to Outpatient.'; 1750 MessageDlg(msgTxt1 + ptSts + #13#10#13 + msgTxt2, mtWarning, [mbOK], 0); 1751 frmFrame.mnuFileRefreshClick(Application); 1752 Result := True; 1753 end; 1754 end; 1755 1756 function TfrmMeds.GetTotalSectionsWidth(Sender: TObject) : integer; 1757 //CQ7586 1758 //Return stored values of column widths 1759 var 1760 i: integer; 1761 begin 1762 Result := 0; 1763 1764 if (Sender as THeaderControl).Name = 'hdrMedsOut' then 1765 for i := 0 to hdrMedsOut.Sections.Count - 1 do 1766 Result := Result + hdrMedsOut.Sections[i].Width; 1767 1768 if (Sender as THeaderControl).Name = 'hdrMedsIn' then 1769 for i := 0 to hdrMedsIn.Sections.Count - 1 do 1770 Result := Result + hdrMedsIn.Sections[i].Width; 1771 1772 if (Sender as THeaderControl).Name = 'hdrMedsNonVA' then 1773 for i := 0 to hdrMedsNonVA.Sections.Count - 1 do 1774 Result := Result + hdrMedsNonVA.Sections[i].Width; 1775 end; 1776 1777 procedure TfrmMeds.SetSectionWidths(Sender: TObject); 1778 //CQ7586 1779 //Copy values of column widths into array variables. 1780 var 1781 i: integer; 1782 begin 1783 if (Sender as THeaderControl).Name = 'hdrMedsOut' then 1784 for i := 0 to hdrMedsOut.Sections.Count - 1 do 1785 OrigOutPtSecWidths[i] := hdrMedsOut.Sections[i].Width; 1786 1787 if (Sender as THeaderControl).Name = 'hdrMedsIn' then 1788 for i := 0 to hdrMedsIn.Sections.Count - 1 do 1789 OrigInPtSecWidths[i] := hdrMedsIn.Sections[i].Width; 1790 1791 if (Sender as THeaderControl).Name = 'hdrMedsNonVA' then 1792 for i := 0 to hdrMedsNonVA.Sections.Count - 1 do 1793 OrigNonVASecWidths[i] := hdrMedsNonVA.Sections[i].Width; 1794 end; 1795 1796 procedure TfrmMeds.hdrMedsOutMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1797 begin 1798 inherited; 1799 Self.SetSectionWidths(Sender); //CQ7586 1800 end; 1801 1802 procedure TfrmMeds.hdrMedsNonVAMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1803 begin 1804 inherited; 1805 Self.SetSectionWidths(Sender); //CQ7586 1806 end; 1807 1808 procedure TfrmMeds.hdrMedsInMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1809 begin 1810 inherited; 1811 Self.SetSectionWidths(Sender); //CQ7586 1812 end; 1813 1814 procedure TfrmMeds.hdrMedsOutMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1815 //CQ7586 1816 var 1817 i: integer; 1818 totalSectionsWidth, originalwidth: integer; 1819 begin 1820 inherited; 1821 totalSectionsWidth := Self.GetTotalSectionsWidth(Sender); 1822 if totalSectionsWidth > lstMedsOut.Width - 5 then //could used any of the three list boxes here, since all are same width 1823 begin 1824 originalwidth := 0; 1825 for i := 0 to hdrMedsOut.Sections.Count - 1 do 1826 originalwidth := originalwidth + OrigOutPtSecWidths[i]; 1827 if originalwidth < totalSectionsWidth then 1828 begin 1829 for i := 0 to hdrMedsOut.Sections.Count - 1 do 1830 hdrMedsOut.Sections[i].Width := OrigOutPtSecWidths[i]; 1831 lstMedsOut.Invalidate; 1832 end; 1833 end; 1834 //CQ9622 1835 if hdrMedsOut.Sections[1].Width < 100 then 1836 begin 1837 hdrMedsOut.Sections[1].Width := 100; 1838 lstMedsOut.Refresh; 1839 end; 1840 //end CQ9622 1841 pnlBottom.Height := pnlBottom.Height - 1; // forces autopanel resize 1842 pnlBottom.Height := pnlBottom.Height + 1; // forces autopanel resize 1843 end; 1844 1845 procedure TfrmMeds.hdrMedsNonVAMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1846 //CQ7586 1847 var 1848 i: integer; 1849 totalSectionsWidth, originalwidth: integer; 1850 begin 1851 inherited; 1852 totalSectionsWidth := Self.GetTotalSectionsWidth(Sender); 1853 if totalSectionsWidth > lstMedsNonVA.Width - 5 then //could used any of the three list boxes here, since all are same width 1854 begin 1855 originalwidth := 0; 1856 for i := 0 to hdrMedsNonVA.Sections.Count - 1 do 1857 originalwidth := originalwidth + OrigNonVASecWidths[i]; 1858 if originalwidth < totalSectionsWidth then 1859 begin 1860 for i := 0 to hdrMedsNonVA.Sections.Count - 1 do 1861 hdrMedsNonVA.Sections[i].Width := OrigNonVASecWidths[i]; 1862 lstMedsNonVA.Invalidate; 1863 end; 1864 end; 1865 //CQ9622 1866 if hdrMedsNonVA.Sections[1].Width < 100 then 1867 begin 1868 hdrMedsNonVA.Sections[1].Width := 100; 1869 lstMedsNonVA.Refresh; 1870 end; 1871 //end CQ9622 1872 pnlNonVA.Height := pnlNonVA.Height - 1; // forces autopanel resize 1873 pnlNonVA.Height := pnlNonVA.Height + 1; // forces autopanel resize 1874 end; 1875 1876 procedure TfrmMeds.hdrMedsInMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1877 //CQ7586 1878 var 1879 i: integer; 1880 totalSectionsWidth, originalwidth: integer; 1881 begin 1882 inherited; 1883 totalSectionsWidth := Self.GetTotalSectionsWidth(Sender); 1884 if totalSectionsWidth > lstMedsIn.Width - 5 then //could used any of the three list boxes here, since all are same width 1885 begin 1886 originalwidth := 0; 1887 for i := 0 to hdrMedsIn.Sections.Count - 1 do 1888 originalwidth := originalwidth + OrigInPtSecWidths[i]; 1889 if originalwidth < totalSectionsWidth then 1890 begin 1891 for i := 0 to hdrMedsIn.Sections.Count - 1 do 1892 hdrMedsIn.Sections[i].Width := OrigInPtSecWidths[i]; 1893 lstMedsIn.Invalidate; 1894 end; 1895 end; 1896 //CQ9622 1897 if hdrMedsIn.Sections[1].Width < 100 then 1898 begin 1899 hdrMedsIn.Sections[1].Width := 100; 1900 lstMedsIn.Refresh; 1901 end; 1902 //end CQ9622 1903 pnlBottom.Height := pnlBottom.Height - 1; // forces autopanel resize 1904 pnlBottom.Height := pnlBottom.Height + 1; // forces autopanel resize 1905 end; 1906 1907 procedure TfrmMeds.ClearChildODList; 1908 var 1909 i: integer; 1910 begin 1911 for i := 0 to ChildODList.count-1 do 1912 if(assigned(ChildODList.Objects[i])) then 1913 ChildODList.Objects[i].Free; 1914 ChildODList.Clear; 1915 end; 1916 1917 function TfrmMeds.CheckMedStatus(ActiveList: TListBox): boolean; 1918 var 1919 i: integer; 1920 tmpList: TStringList; 1921 Str: string; 1922 AMed: TMedListRec; 1923 AMedList: TList; 1924 1925 begin 1926 result := False; 1927 tmpList:= TStringList.Create; 1928 if TMedListRec = nil then exit; 1929 AMedList := GetMedList(ActiveList); 1930 for i := 0 to ActiveList.Count - 1 do if ActiveList.Selected[i] then 1931 begin 1932 AMed := TMedListRec(AMedList[i]); 1933 str := Amed.PharmID + U + AMed.Status; 1934 tmpList.Add(Str); 1935 end; 1936 if tmpList <> nil then 1937 begin 1938 Result := GetMedStatus(tmpList); 1939 tmpList.Free; 1940 end; 1941 if Result = True then 1942 begin 1943 MessageDlg('The Medication status has change.' + #13#10#13 + 'CPRS needs to refresh patient information to display the correct medication status', mtWarning, [mbOK], 0); 1944 frmFrame.mnuFileRefreshClick(Application); 1945 end; 1946 end; 1947 1948 (*procedure TfrmMeds.ActivateDeactiveRenew(AListBox: TListBox); 1949 var 1950 i: Integer; 1951 CurID: string; 1952 SomePharmacyOrders: TStringList; 1953 tmpArr: TStringList; 1954 begin 1955 tmpArr := TStringList.Create; 1956 SomePharmacyOrders := GetPharmacyOrders(AListBox); 1957 with AListBox do for i := 0 to Items.Count - 1 do if Selected[i] then 1958 begin 1959 CurID := uPendingChanges.Values[Piece(Piece(SomePharmacyOrders[i], U, 2), ';', 1)]; 1960 if Length(CurID) > 0 then CurID := Piece(CurID, U, 2) 1961 else CurID := Piece(SomePharmacyOrders[i], U, 2); 1962 tmpArr.Add(curID); 1963 end; 1964 if tmpArr <> nil then frmActivateDeactive.fActivateDeactive(tmpArr, AListBox); 1965 end; *) 1966 1967 procedure TfrmMeds.ViewInfo(Sender: TObject); 1968 begin 1969 inherited; 1970 frmFrame.ViewInfo(Sender); 1971 end; 1972 1973 procedure TfrmMeds.mnuViewInformationClick(Sender: TObject); 1974 begin 1975 inherited; 1976 mnuViewDemo.Enabled := frmFrame.pnlPatient.Enabled; 1977 mnuViewVisits.Enabled := frmFrame.pnlVisit.Enabled; 1978 mnuViewPrimaryCare.Enabled := frmFrame.pnlPrimaryCare.Enabled; 1979 mnuViewMyHealtheVet.Enabled := not (Copy(frmFrame.laMHV.Hint, 1, 2) = 'No'); 1980 mnuInsurance.Enabled := not (Copy(frmFrame.laVAA2.Hint, 1, 2) = 'No'); 1981 mnuViewFlags.Enabled := frmFrame.lblFlag.Enabled; 1982 mnuViewRemoteData.Enabled := frmFrame.lblCirn.Enabled; 1983 mnuViewReminders.Enabled := frmFrame.pnlReminders.Enabled; 1984 mnuViewPostings.Enabled := frmFrame.pnlPostings.Enabled; 1985 end; 1986 1987 procedure TfrmMeds.mnuOptimizeFieldsClick(Sender: TObject); 1988 var 1989 totalSectionsWidth, unit1, unit2, unit8: integer; 1990 begin 1991 totalSectionsWidth := pnlTop.Width - 5; 1992 if totalSectionsWidth < 16 then exit; 1993 unit1 := (totalSectionsWidth div 16) - 1; 1994 unit2 := unit1 * 2; 1995 unit8 := unit1 * 8; 1996 1997 with hdrMedsNonVA do 1998 begin 1999 Sections[0].Width := unit1; 2000 Sections[1].Width := unit8; 2001 Sections[2].Width := unit2; 2002 Sections[3].Width := unit2; 2003 end; 2004 hdrMedsNonVASectionResize(hdrMedsNonVA, hdrMedsNonVA.Sections[0]); 2005 hdrMedsNonVA.Repaint; 2006 2007 with hdrMedsIn do 2008 begin 2009 Sections[0].Width := unit1; 2010 Sections[1].Width := unit8; 2011 Sections[2].Width := unit2; 2012 Sections[3].Width := unit2; 2013 Sections[4].Width := unit2; 2014 end; 2015 hdrMedsInSectionResize(hdrMedsIn, hdrMedsIn.Sections[0]); 2016 hdrMedsIn.Repaint; 2017 with hdrMedsOut do 2018 begin 2019 Sections[0].Width := unit1; 2020 Sections[1].Width := unit8; 2021 Sections[2].Width := unit2; 2022 Sections[3].Width := unit2; 2023 Sections[4].Width := unit2; 2024 Sections[5].Width := unit1; 2025 end; 2026 hdrMedsOutSectionResize(hdrMedsOut, hdrMedsOut.Sections[0]); 2027 hdrMedsOut.Repaint; 2028 end; 2029 2030 procedure TfrmMeds.hdrMedsOutSectionClick(HeaderControl: THeaderControl; 2031 Section: THeaderSection); 2032 begin 2033 inherited; 2034 //if Section = hdrMedsOut.Sections[1] then 2035 mnuOptimizeFieldsClick(self); 2036 end; 2037 2038 procedure TfrmMeds.hdrMedsNonVASectionClick(HeaderControl: THeaderControl; 2039 Section: THeaderSection); 2040 begin 2041 inherited; 2042 //if Section = hdrMedsNonVA.Sections[1] then 2043 mnuOptimizeFieldsClick(self); 2044 end; 2045 2046 procedure TfrmMeds.hdrMedsInSectionClick(HeaderControl: THeaderControl; 2047 Section: THeaderSection); 2048 begin 2049 inherited; 2050 //if Section = hdrMedsIn.Sections[1] then 2051 mnuOptimizeFieldsClick(self); 2052 end; 2053 1633 2054 end. 1634 2055
Note:
See TracChangeset
for help on using the changeset viewer.