Changeset 1679 for cprs/trunk/CPRS-Chart/Orders/fODMedIV.pas
- Timestamp:
- May 7, 2015, 12:34:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Orders/fODMedIV.pas
r829 r1679 45 45 txtAllIVRoutes: TLabel; 46 46 lblTypeHelp: TLabel; 47 cboAddFreq: TCaptionComboBox; 48 lblAddFreq: TLabel; 49 lblPrevAddFreq: TLabel; 50 lbl508Required: TVA508StaticText; 51 VA508CompOrderSig: TVA508ComponentAccessibility; 52 VA508CompRoute: TVA508ComponentAccessibility; 53 VA508CompType: TVA508ComponentAccessibility; 54 VA508CompSchedule: TVA508ComponentAccessibility; 55 VA508CompGrdSelected: TVA508ComponentAccessibility; 47 56 procedure FormCreate(Sender: TObject); 48 57 procedure tabFluidChange(Sender: TObject); … … 59 68 procedure FormResize(Sender: TObject); 60 69 procedure txtSelectedExit(Sender: TObject); 61 procedure cboSelectedExit(Sender: TObject);62 70 procedure ControlChange(Sender: TObject); 63 71 procedure txtSelectedChange(Sender: TObject); 64 procedure cboSelectedChange(Sender: TObject);65 72 procedure grdSelectedDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; 66 73 State: TGridDrawState); … … 94 101 procedure cboRouteClick(Sender: TObject); 95 102 procedure lblTypeHelpClick(Sender: TObject); 103 procedure cboSelectedCloseUp(Sender: TObject); 104 procedure cboRouteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 105 procedure cboScheduleKeyUp(Sender: TObject; var Key: Word; 106 Shift: TShiftState); 107 procedure cboPriorityKeyUp(Sender: TObject; var Key: Word; 108 Shift: TShiftState); 109 procedure cboAddFreqKeyDown(Sender: TObject; var Key: Word; 110 Shift: TShiftState); 111 procedure cboAddFreqCloseUp(Sender: TObject); 112 procedure FormKeyPress(Sender: TObject; var Key: Char); 113 procedure txtSelectedKeyDown(Sender: TObject; var Key: Word; 114 Shift: TShiftState); 115 procedure cboSelectedKeyDown(Sender: TObject; var Key: Word; 116 Shift: TShiftState); 117 procedure cboTypeKeyDown(Sender: TObject; var Key: Word; 118 Shift: TShiftState); 119 procedure cboRouteKeyDown(Sender: TObject; var Key: Word; 120 Shift: TShiftState); 121 procedure cboScheduleKeyDown(Sender: TObject; var Key: Word; 122 Shift: TShiftState); 123 procedure VA508CompOrderSigStateQuery(Sender: TObject; var Text: string); 124 procedure VA508CompRouteInstructionsQuery(Sender: TObject; 125 var Text: string); 126 procedure VA508CompTypeInstructionsQuery(Sender: TObject; var Text: string); 127 procedure VA508CompScheduleInstructionsQuery(Sender: TObject; 128 var Text: string); 129 procedure VA508CompGrdSelectedCaptionQuery(Sender: TObject; 130 var Text: string); 96 131 private 97 132 FInpatient: Boolean; … … 102 137 OSchedule: string; 103 138 oAdmin: string; 104 Action: integer;105 139 OrderIEN: string; 106 140 FAdminTimeText: string; … … 108 142 FOriginalDurationType: integer; 109 143 FOriginalInfusionType: integer; 110 FInitialOrderID: boolean; 144 FIVTypeDefined: boolean; 145 //FInitialOrderID: boolean; 111 146 procedure SetValuesFromResponses; 112 147 procedure DoSetFontSize( FontSize: integer); … … 119 154 procedure UpdateDuration(SchType: string); 120 155 procedure ClearAllFields; 156 function UpdateAddFreq(OI: integer): string; 157 function IsAltCtrl_L_Pressed(Shift : TShiftState; Key : Word) : Boolean; 158 procedure SetCtrlAlt_L_LabelAccessText(var Text: string; theLabel : TLabel); 121 159 public 160 OrdAction: integer; 122 161 procedure InitDialog; override; 123 162 procedure SetupDialog(OrderAction: Integer; const ID: string); override; … … 152 191 Units: string; 153 192 Volumes: string; 193 AddFreq: string; 154 194 end; 155 195 … … 168 208 TX_BAD_ROUTE = 'Route cannot be free-text'; 169 209 TX_LEADING_NUMERIC = 'this additive must start with a leading numeric value'; 210 TX_BAD_BAG = 'A valid additive frequency must be entered for '; 211 Tx_BAG_NO_COMMENTS ='"See Comments" entered for additive '; 212 TX_BAG_NO_COMMENTS1 = ' no comments defined for this order.'; 170 213 171 214 (* … … 200 243 Exit; 201 244 end; 245 OrdAction := -1; 202 246 DoSetFontSize(MainFontSize); 203 247 FillerID := 'PSIV'; // does 'on Display' order check **KCM** … … 221 265 var 222 266 bottom: integer; 223 begin 224 inherited; 267 isNewOrder: boolean; 268 begin 269 inherited; 270 if OrdAction in [ORDER_COPY, ORDER_EDIT] then isNewOrder := false 271 else isNewOrder := True; 225 272 with grdSelected do 226 273 begin 227 274 ColWidths[1] := Canvas.TextWidth(' 10000 ') + GetSystemMetrics(SM_CXVSCROLL); 228 275 ColWidths[2] := Canvas.TextWidth('meq.') + GetSystemMetrics(SM_CXVSCROLL); 229 ColWidths[0] := ClientWidth - ColWidths[1] - ColWidths[2] - 4; 276 //AGP ADDITIVE FREQUENCY CHANGES 277 ColWidths[3] := Canvas.TextWidth(lblAddFreq.Caption + ' ') + GetSystemMetrics(SM_CXVSCROLL); 278 if IsNewOrder = false then 279 begin 280 ColWidths[4] := Canvas.TextWidth(lblPrevAddFreq.Caption) + GetSystemMetrics(SM_CXVSCROLL); 281 ColWidths[0] := ClientWidth - ColWidths[1] - ColWidths[2] - ColWidths[3] - ColWidths[4] - 5; 282 end 283 else 284 begin 285 ColWidths[4] := 0; 286 ColWidths[0] := ClientWidth - ColWidths[1] - ColWidths[2] - ColWidths[3] - ColWidths[4] - 25; 287 end; 230 288 end; 231 289 lblAmount.Left := grdSelected.Left + grdSelected.ColWidths[0]; 290 lblAddFreq.Left := grdSelected.Left + grdSelected.ColWidths[0] + grdSelected.ColWidths[1] + grdSelected.ColWidths[2]; 291 if isNewOrder = false then 292 begin 293 lblPrevAddFreq.Visible := True; 294 lblPrevAddFreq.Left := grdSelected.Left + grdSelected.ColWidths[0] + grdSelected.ColWidths[1] + grdSelected.ColWidths[2] + grdSelected.ColWidths[3]; 295 end 296 else lblPrevAddFreq.Visible := False; 232 297 self.cboType.SelLength := 0; 233 298 self.cboInfusionTime.SelLength := 0; … … 243 308 self.lblAdminTime.Top := self.chkDoseNow.Top + self.chkDoseNow.Height + 2; 244 309 self.lblFirstDose.Top := self.lblAdminTime.Top + self.lblAdminTime.Height + 2; 245 if self.Label1.Top < (self.lblFirstDose.Top + self.lblFirstDose.Height) then 246 begin 247 self.Label1.Top := self.lblFirstDose.Top + self.lblFirstDose.Height + 2; 310 self.lbl508Required.Top := self.lblFirstDose.Top + self.lblFirstDose.Height + 5; 311 if self.Label1.Top < (self.lbl508Required.Top + self.lbl508Required.Height) then 312 begin 313 self.Label1.Top := self.lbl508Required.Top + self.lbl508Required.Height + 5; 248 314 self.memOrder.Top := self.Label1.Top + self.Label1.Height; 249 315 end; … … 262 328 //FRouteConflict := False; 263 329 //lblTypeHelp.Hint := IVTypeHelpText; 330 ClearAllFields; 331 //FIVTypeDefined := false; 264 332 lblType.Hint := IVTypeHelpText; 265 333 cboType.Hint := IVTYpeHelpText; … … 286 354 //if (Patient.Inpatient) and (cboSchedule.Items.IndexOfName('Other')<0) then 287 355 if cboSchedule.Items.IndexOf('Other') = -1 then cboSchedule.Items.Add('OTHER'); 288 289 356 cboSchedule.Enabled := False; 290 357 lblschedule.Enabled := False; … … 310 377 chkDoseNow.Visible := false; 311 378 chkPRN.Enabled := false; 379 //AGP ADDITIVE FREQUENCY CHANGES 380 if cboAddFreq.Items.Count = 0 then 381 begin 382 cboAddFreq.Items.Add('1 Bag/Day'); 383 cboAddFreq.Items.Add('All Bags'); 384 cboAddFreq.Items.Add('See Comments'); 385 end; 312 386 end; 313 387 tabFluid.TabIndex := 0; … … 330 404 oAdmin := ''; 331 405 self.txtAllIVRoutes.Visible := false; 406 memorder.text := ''; 407 memOrder.Lines.Clear; 332 408 end; 333 409 … … 339 415 CRLF + ' over a specified time period (e.g. Infuse over 30 min.).' + CRLF + CRLF + 340 416 'Examples:' + CRLF + 'Continuous = Infusion/drip' + CRLF + 'Intermittent = IVP/IVPB'; 417 end; 418 419 procedure TfrmODMedIV.SetCtrlAlt_L_LabelAccessText(var Text: string; theLabel : TLabel); 420 begin 421 if theLabel.Visible then 422 Text := 'Press Ctrl + Alt + L to access ' + theLabel.Caption; 341 423 end; 342 424 … … 455 537 end; 456 538 539 procedure TfrmODMedIV.VA508CompRouteInstructionsQuery( 540 Sender: TObject; var Text: string); 541 begin 542 inherited; 543 SetCtrlAlt_L_LabelAccessText(Text, txtAllIVRoutes); 544 end; 545 546 procedure TfrmODMedIV.VA508CompScheduleInstructionsQuery(Sender: TObject; 547 var Text: string); 548 begin 549 inherited; 550 SetCtrlAlt_L_LabelAccessText(Text, txtNSS); 551 end; 552 553 procedure TfrmODMedIV.VA508CompTypeInstructionsQuery(Sender: TObject; 554 var Text: string); 555 begin 556 inherited; 557 SetCtrlAlt_L_LabelAccessText(Text, lblTypeHelp); 558 end; 559 560 procedure TfrmODMedIV.VA508CompGrdSelectedCaptionQuery(Sender: TObject; 561 var Text: string); 562 begin 563 inherited; 564 if grdSelected.Col = 0 then 565 Text := lblComponent.Caption 566 else if grdSelected.Col = 1 then 567 Text := lblAmount.Caption 568 else if grdSelected.Col = 2 then 569 Text := lblAmount.Caption + ', Unit' 570 else if grdSelected.Col = 3 then 571 Text := lblAddFreq.Caption 572 else if grdSelected.Col = 4 then 573 Text := lblPrevAddFreq.Caption; 574 end; 575 576 procedure TfrmODMedIV.VA508CompOrderSigStateQuery(Sender: TObject; 577 var Text: string); 578 begin 579 inherited; 580 Text := memOrder.Text; 581 end; 582 457 583 procedure TfrmODMedIV.Validate(var AnErrMsg: string); 458 584 var 459 585 DispWarning, ItemOK, Result: Boolean; 460 LDec,RDec,x, tempStr, iunit, infError : string;586 LDec,RDec,x, tempStr, iunit, infError, Bag: string; 461 587 digits, i, j, Len, temp, Value: Integer; 462 588 … … 499 625 end; 500 626 end; 627 //AGP ADDITIVE FREQUENCY CHANGES 628 if MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous' then 629 begin 630 Bag := (Cells[3, i]); 631 if Length(Bag) = 0 then 632 begin 633 SetError(TX_BAD_BAG + cells[0, i]); 634 end 635 else if cboAddFreq.Items.IndexOf(Bag) = -1 then 636 begin 637 SetError(TX_BAD_BAG + cells[0, i]); 638 end 639 else if (MixedCase(Bag) = 'See Comments') and ((self.memComments.Text = '') or (self.memComments.Text = CRLF)) then 640 begin 641 SetError(Tx_BAG_NO_COMMENTS + cells[0,i] + Tx_BAG_NO_COMMENTS1); 642 end; 643 644 end; 501 645 end; 502 646 end; … … 574 718 else if (iunit = 'Hours') and (Len > 2) then setError('Infuse Over Time cannot exceed 2 spaces for ' + iunit); 575 719 end; 576 if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text = '') then SetError(TX_NO_SCHEDULE); 720 if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text = '') and (chkPRN.Checked = false) then SetError(TX_NO_SCHEDULE); 721 if (cboSchedule.ItemIndex > -1) and (cboSchedule.Text = '') then 722 begin 723 cboSchedule.ItemIndex := -1; 724 SetError(TX_NO_SCHEDULE) 725 end; 577 726 if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text <> '') then SetError(TX_BAD_SCHEDULE); 578 727 end; 579 728 if txtXDuration.Text = '' then 580 729 begin 581 if AnErrMsg = '' then self.FInitialOrderID := True; 582 exit; 730 if AnErrMsg = '' then exit; 731 //if AnErrMsg = '' then self.FInitialOrderID := True; 732 //exit; 583 733 end; 584 734 Len := Length(txtXDuration.Text); … … 607 757 SetError('Duration with a unit of "doses" must be greater then 0 and less then 2000000'); 608 758 end; 609 if AnErrMsg = '' then self.FInitialOrderID := True;759 //if AnErrMsg = '' then self.FInitialOrderID := True; 610 760 611 761 end; … … 629 779 procedure TfrmODMedIV.SetValuesFromResponses; 630 780 var 631 x, addRoute, tempSch, AdminTime, TempOrder, tmpSch, tempIRoute, tempRoute : string;632 AnInstance, i, idx : Integer;633 AResponse : TResponse;781 x, addRoute, tempSch, AdminTime, TempOrder, tmpSch, tempIRoute, tempRoute, PreAddFreq: string; 782 AnInstance, i, idx, j: Integer; 783 AResponse, AddFreqResp: TResponse; 634 784 AnIVComponent: TIVComponent; 635 785 AllIVRoute: TStringList; … … 637 787 begin 638 788 Changing := True; 639 self.FInitialOrderID := false;789 //self.FInitialOrderID := false; 640 790 with Responses do 641 791 begin 792 SetControl(cboType, 'TYPE', 1); 793 if cboType.ItemIndex > -1 then FIVTypeDefined := True; 642 794 FInpatient := OrderForInpatient; 643 795 AnInstance := NextInstance('ORDERABLE', 0); … … 682 834 Cells[1, RowCount - 1] := IntToStr(AnIVComponent.Amount); 683 835 Cells[2, RowCount - 1] := AnIVComponent.Units; 836 Cells[3, RowCount - 1] := 'N/A'; 684 837 end; 685 838 end; … … 721 874 AnIVComponent.Units := Piece(x, U, 1); 722 875 AnIVComponent.Volumes := Copy(x, Pos(U, x) + 1, Length(x)); 876 //AGP ADDITIVE FREQUENCY CHANGES 877 AnIVComponent.AddFreq := ''; 878 PreAddFreq := ''; 879 AddFreqResp := FindResponseByName('ADDFREQ', AnInstance); 880 if AddFreqResp <> nil then 881 begin 882 if cboAddFreq.Items.IndexOf(AddFreqResp.IValue) = -1 then 883 begin 884 AnIvComponent.AddFreq := ''; 885 end 886 else AnIvComponent.AddFreq := AddFreqResp.IValue; 887 PreAddFreq := AddFreqResp.IValue; 888 end; 723 889 with grdSelected do 724 890 begin … … 729 895 Cells[1, RowCount - 1] := IntToStr(AnIVComponent.Amount); 730 896 Cells[2, RowCount - 1] := AnIVComponent.Units; 897 Cells[3, RowCount -1] := AnIVComponent.AddFreq; 898 if OrdAction in [ORDER_COPY, ORDER_EDIT] then Cells[4, RowCount -1] := PreAddFreq; 731 899 end; 732 900 end; … … 803 971 //if (cboSchedule.ItemIndex > -1) then lblAdminTime.Caption := 'Admin. Time: ' + Piece(cboSchedule.Items.strings[cboSchedule.itemindex],U,5); 804 972 //if (cboSchedule.ItemIndex > -1) and (Piece(lblAdminTime.Caption, ':' ,2) = ' ') then lblAdminTime.Caption := 'Admin. Time: ' + AdminTime; 805 if ( Action in [ORDER_COPY, ORDER_EDIT]) then973 if (OrdAction in [ORDER_COPY, ORDER_EDIT]) then 806 974 begin 807 975 TempOrder := Piece(OrderIEN,';',1); … … 812 980 if AResponse <> nil then AdminTime := AResponse.EValue; 813 981 //lblAdminTime.Caption := 'Admin. Time: ' + AdminTime; 814 if cboSchedule.ItemIndex > -1then982 if (cboSchedule.ItemIndex > -1) and (AdminTime <> '') then 815 983 begin 816 984 tmpSch := cboSchedule.Items.Strings[cboSchedule.itemindex]; … … 848 1016 cboInfusionTime.itemindex := 0; 849 1017 end; 1018 For j := 0 to grdSelected.RowCount -1 do 1019 grdSelected.Cells[3,j] := 'N/A'; 850 1020 end 851 1021 else … … 890 1060 begin 891 1061 inherited; 892 Action := OrderAction;1062 OrdAction := OrderAction; 893 1063 OrderIEN := id; 894 self.FInitialOrderID := True;1064 //self.FInitialOrderID := True; 895 1065 if self.EvtID > 0 then FAdminTimeText := 'To Be Determined'; 1066 if isIMO = true then self.Caption := 'Clinic ' + self.Caption; 896 1067 if (isIMO) or ((patient.Inpatient = true) and (encounter.Location <> patient.Location)) and (FAdminTimeText = '') then 897 1068 FAdminTimeText := 'Not defined for Clinic Locations'; 898 1069 if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then 899 1070 begin 900 901 1071 SetValuesFromResponses; 902 1072 end; … … 928 1098 procedure TfrmODMedIV.cboSolutionNeedData(Sender: TObject; const StartFrom: string; 929 1099 Direction, InsertAt: Integer); 930 var 931 CurString: string; 932 begin 933 inherited; 934 if (Direction = 1) then 935 CurString := AnsiUpperCase(StartFrom) + ' '; 936 cboSolution.ForDataUse(SubSetOfOrderItems(CurString, Direction, 'S.IVB RX')); 1100 begin 1101 cboSolution.ForDataUse(SubSetOfOrderItems(StartFrom, Direction, 'S.IVB RX')); 937 1102 end; 938 1103 939 1104 procedure TfrmODMedIV.cbotypeChange(Sender: TObject); 1105 var 1106 i: integer; 940 1107 begin 941 1108 inherited; … … 955 1122 lblInfusionRate.Caption := 'Infuse Over Time (Optional)'; 956 1123 cboInfusionTime.Enabled := true; 957 cboDuration.Items.Add('doses'); 1124 if cboDuration.items.IndexOf('doses') = -1 then cboDuration.Items.Add('doses'); 1125 //AGP ADDITIVE FREQUECNY CHANGES 1126 lblAddFreq.Caption := 'Additive Frequency'; 1127 for i := 0 to grdselected.RowCount - 1 do 1128 begin 1129 if (TIVComponent(grdselected.Objects[0, i]) <> nil) and (TIVComponent(grdselected.Objects[0, i]).Fluid = 'A') then 1130 begin 1131 grdSelected.Cells[3, i] := 'N/A'; 1132 end; 1133 end; 958 1134 end 959 1135 //else if (self.cbotype.Text = 'Continuous') or (self.cboType.itemIndex = 0) then … … 975 1151 updateDuration(''); 976 1152 cboduration.Items.Delete(cboDuration.Items.IndexOf('doses')); 977 end; 1153 lblAddFreq.Caption := 'Additive Frequency*'; 1154 if FIVTypeDefined = True then 1155 begin 1156 for i := 0 to grdselected.RowCount - 1 do 1157 begin 1158 if (TIVComponent(grdselected.Objects[0, i]) <> nil) and (TIVComponent(grdselected.Objects[0, i]).Fluid = 'A') then 1159 begin 1160 grdSelected.Cells[3, i] := ''; 1161 end; 1162 end; 1163 end; 1164 end; 1165 FIVTypeDefined := True; 978 1166 self.txtRate.Text := ''; 979 1167 ControlChange(Sender); 1168 end; 1169 1170 procedure TfrmODMedIV.cboTypeKeyDown(Sender: TObject; var Key: Word; 1171 Shift: TShiftState); 1172 begin 1173 inherited; 1174 if IsAltCtrl_L_Pressed(Shift, Key) then 1175 lblTypeHelpClick(lblTypeHelp); 1176 end; 1177 1178 function TfrmODMedIV.IsAltCtrl_L_Pressed(Shift : TShiftState; Key : Word) : Boolean; 1179 begin 1180 Result := (ssCtrl in Shift) and (ssAlt in Shift) and (Key = Ord('L')); 980 1181 end; 981 1182 … … 986 1187 T2 = #13#13'The first order''s administrative schedule is "'; 987 1188 T3 = #13'The second order''s administrative schedule is "'; 988 T4 = #13#13'Do you want to continue?'; 1189 T4 = #13#13'Do you want to continue?'; 1190 T5 = '" and a priority of "'; 989 1191 T1A = 'By checking the "Give additional dose now" box, you have actually entered a new order with the schedule "NOW"'; 990 1192 T2A = ' in addition to the one you are placing for the same medication.'; … … 992 1194 medNm: string; 993 1195 theSch: string; 1196 ordPriority: string; 994 1197 //SchID: integer; 995 1198 begin … … 1000 1203 //SchID := cboSchedule.ItemIndex; 1001 1204 theSch := cboSchedule.Text; 1205 ordPriority := cboPriority.SelText; 1002 1206 if length(theSch)>0 then 1003 1207 begin 1004 1208 //if (InfoBox(T1+medNm+T+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then 1005 if (InfoBox(T1+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then 1209 //if (InfoBox(T1+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then 1210 if (InfoBox(T1+T2+'NOW'+T5+ordPriority+T+T3+theSch+T5+ordPriority+T+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then 1006 1211 begin 1007 1212 chkDoseNow.Checked := False; … … 1089 1294 Cells[1, RowCount - 1] := IntToStr(AnIVComponent.Amount); 1090 1295 Cells[2, RowCount - 1] := AnIVComponent.Units; 1296 Cells[3, RowCount - 1] := 'N/A'; 1091 1297 Row := RowCount - 1; 1092 1298 if Length(Piece(AnIVComponent.Volumes, U, 2)) > 0 then Col := 1 else Col := 0; 1093 if RowCount = 1 then // switch to additives after 1st IV1299 (* if RowCount = 1 then // switch to additives after 1st IV 1094 1300 begin 1095 1301 tabFluid.TabIndex := 1; 1096 1302 tabFluidChange(Self); 1097 end; 1303 end; *) 1098 1304 end; 1099 1305 Application.ProcessMessages; //CQ: 10157 1306 updateRoute; 1100 1307 ClickOnGridCell; 1101 updateRoute;1308 //updateRoute; 1102 1309 ControlChange(Sender); 1103 1310 //updateRoute(routeIEN); … … 1117 1324 procedure TfrmODMedIV.cboAdditiveNeedData(Sender: TObject; const StartFrom: string; 1118 1325 Direction, InsertAt: Integer); 1119 var 1120 CurString: string; 1121 begin 1122 inherited; 1123 if (Direction = 1) then 1124 CurString := AnsiUpperCase(StartFrom) + ' '; 1125 cboAdditive.ForDataUse(SubSetOfOrderItems(CurString, Direction, 'S.IVA RX')); 1326 begin 1327 cboAdditive.ForDataUse(SubSetOfOrderItems(StartFrom, Direction, 'S.IVA RX')); 1328 end; 1329 1330 procedure TfrmODMedIV.cboAddFreqCloseUp(Sender: TObject); 1331 begin 1332 inherited; 1333 with cboAddFreq do 1334 begin 1335 if tag < 0 then exit; 1336 grdSelected.Cells[Tag div 256, Tag mod 256] := MixedCase(items.Strings[itemindex]); 1337 Tag := -1; 1338 Hide; 1339 ControlChange(Sender); 1340 TControl(self.grdSelected).Enabled := True; 1341 ActiveControl := self.grdSelected; 1342 end; 1343 grdSelected.Refresh; 1344 end; 1345 1346 procedure TfrmODMedIV.cboAddFreqKeyDown(Sender: TObject; var Key: Word; 1347 Shift: TShiftState); 1348 begin 1349 inherited; 1350 if (Key = VK_RETURN) or (Key = VK_Tab) then 1351 begin 1352 cboAddFreqCloseUp(cboAddFreq); 1353 Key := 0; 1354 end; 1126 1355 end; 1127 1356 … … 1177 1406 cboPriority.SetFocus; 1178 1407 end; 1408 end; 1409 1410 procedure TfrmODMedIV.cboPriorityKeyUp(Sender: TObject; var Key: Word; 1411 Shift: TShiftState); 1412 begin 1413 inherited; 1414 if (Key = VK_BACK) and (cboPriority.Text = '') then cboPriority.ItemIndex := -1; 1179 1415 end; 1180 1416 … … 1232 1468 end; 1233 1469 1470 procedure TfrmODMedIV.cboRouteKeyDown(Sender: TObject; var Key: Word; 1471 Shift: TShiftState); 1472 begin 1473 inherited; 1474 if IsAltCtrl_L_Pressed(Shift, Key) then 1475 txtAllIVRoutesClick(txtAllIVRoutes); 1476 end; 1477 1478 procedure TfrmODMedIV.cboRouteKeyUp(Sender: TObject; var Key: Word; 1479 Shift: TShiftState); 1480 begin 1481 inherited; 1482 if (Key = VK_BACK) and (cboRoute.Text = '') then cboRoute.ItemIndex := -1; 1483 end; 1484 1234 1485 procedure TfrmODMedIV.cboAdditiveMouseClick(Sender: TObject); 1235 1486 var … … 1273 1524 Cells[0, RowCount - 1] := AnIVComponent.Name; 1274 1525 Cells[2, RowCount - 1] := AnIVComponent.Units; 1526 Cells[3, RowCount -1] := UpdateAddFreq(AnIVComponent.IEN); 1275 1527 Row := RowCount - 1; 1276 1528 Col := 1; … … 1302 1554 self.cboDuration.Text := ''; 1303 1555 self.txtAllIVRoutes.Visible := false; 1304 self.FInitialOrderID := True;1556 //self.FInitialOrderID := True; 1305 1557 cbotypeChange(self.cboType); 1306 1558 if self.cboroute.Items.Count > 0 then self.cboRoute.Clear; 1559 FIVTypeDefined := false; 1307 1560 end; 1308 1561 … … 1324 1577 SetFocus; 1325 1578 if AControl is TComboBox then //CQ: 10157 1326 TComboBox(AControl).DroppedDown := True; 1579 begin 1580 TComboBox(AControl).DroppedDown := True; 1581 TControl(self.grdSelected).Enabled := false; 1582 end; 1327 1583 end; 1328 1584 end; … … 1330 1586 begin 1331 1587 AnIVComponent := TIVComponent(grdSelected.Objects[0, grdSelected.Row]); 1332 if (AnIVComponent = nil) or (grdSelected.Col = 0) then Exit; 1588 if (AnIVComponent = nil) or (grdSelected.Col = 0) then 1589 begin 1590 if (AnIVComponent <> nil) and (grdSelected.Col = 0) then grdSelected.Refresh; 1591 Exit; 1592 end; 1333 1593 // allow selection if more the 1 unit to choose from 1334 1594 if (grdSelected.Col = 2) and (Length(Piece(AnIVComponent.Units, U, 2)) > 0) then … … 1354 1614 PlaceControl(txtSelected); 1355 1615 end; 1616 // AGP ADDITIVE FREQUENCY CHANGES 1617 if (Self.cboType.ItemIndex < 1) and (grdSelected.Col = 3) and (AnIVComponent.Fluid = 'A') then 1618 begin 1619 cboAddFreq.ItemIndex := cboAddFreq.Items.IndexOf(grdSelected.Cells[grdSelected.Col, grdSelected.Row]); 1620 cboAddFreq.Tag := (grdSelected.Col * 256) + grdSelected.Row; 1621 PlaceControl(cboAddFreq); 1622 end; 1356 1623 end; 1357 1624 … … 1376 1643 Hide; 1377 1644 end; 1645 grdSelected.Refresh; 1646 end; 1647 1648 1649 1650 procedure TfrmODMedIV.txtSelectedKeyDown(Sender: TObject; var Key: Word; 1651 Shift: TShiftState); 1652 begin 1653 inherited; 1654 if (Key = VK_RETURN) or (Key = VK_Tab) then 1655 begin 1656 ActiveControl := grdSelected; 1657 Key := 0; 1658 end; 1378 1659 end; 1379 1660 1380 1661 procedure TfrmODMedIV.cboScheduleChange(Sender: TObject); 1662 var 1663 othSch: string; 1664 idx: integer; 1381 1665 begin 1382 1666 inherited; … … 1386 1670 self.cboDuration.ItemIndex := -1; 1387 1671 end; 1388 if self.cboSchedule.ItemIndex > -1 then updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemindex],U,3)); 1672 if self.cboSchedule.ItemIndex > -1 then 1673 begin 1674 if cboSchedule.ItemIndex = cboSchedule.Items.IndexOf('Other') then 1675 begin 1676 othSch := CreateOtherSchedule; 1677 if length(trim(othSch)) > 1 then 1678 begin 1679 cboSchedule.Items.Add(othSch + U + U + NSSScheduleType + U + NSSAdminTime); 1680 idx := cboSchedule.Items.IndexOf(Piece(OthSch, U, 1)); 1681 cboSchedule.ItemIndex := idx; 1682 end 1683 else cboSchedule.itemindex := -1; 1684 end; 1685 if cboSchedule.itemIndex > -1 then updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemindex],U,3)); 1686 end; 1389 1687 ControlChange(sender); 1390 1688 end; … … 1393 1691 var 1394 1692 othSch: string; 1395 idx , i: integer;1693 idx: integer; 1396 1694 begin 1397 1695 inherited; … … 1402 1700 begin 1403 1701 cboSchedule.Items.Add(othSch + U + U + NSSScheduleType + U + NSSAdminTime); 1404 idx := -1; 1405 for I := 0 to cboSchedule.Items.Count - 1 do 1406 if Piece(cboSchedule.Items.Strings[i], U, 1) = othSch then 1407 begin 1408 idx := i; 1409 break; 1410 end; 1411 //idx := cboSchedule.Items.IndexOfName(othSch); 1702 idx := cboSchedule.Items.IndexOf(Piece(OthSch, U, 1)); 1412 1703 cboSchedule.ItemIndex := idx; 1413 1704 end; … … 1431 1722 cboSchedule.SetFocus; 1432 1723 end; 1433 end; 1434 1435 procedure TfrmODMedIV.cboSelectedChange(Sender: TObject); // combo editor for grid 1724 if (cboSchedule.ItemIndex > -1) and (cboSchedule.Text = '') then cboSchedule.ItemIndex := -1; 1725 end; 1726 1727 procedure TfrmODMedIV.cboScheduleKeyDown(Sender: TObject; var Key: Word; 1728 Shift: TShiftState); 1729 begin 1730 inherited; 1731 if IsAltCtrl_L_Pressed(Shift, Key) then 1732 txtNSSClick(txtNSS); 1733 end; 1734 1735 procedure TfrmODMedIV.cboScheduleKeyUp(Sender: TObject; var Key: Word; 1736 Shift: TShiftState); 1737 begin 1738 inherited; 1739 if (Key = VK_BACK) and (cboSchedule.Text = '') then cboSchedule.ItemIndex := -1; 1740 end; 1741 1742 procedure TfrmODMedIV.cboSelectedCloseUp(Sender: TObject); 1436 1743 begin 1437 1744 inherited; 1438 1745 with cboSelected do 1439 1746 begin 1440 if Tag < 0 then Exit; 1441 grdSelected.Cells[Tag div 256, Tag mod 256] := Text; 1442 end; 1443 ControlChange(Sender); 1444 end; 1445 1446 procedure TfrmODMedIV.cboSelectedExit(Sender: TObject); 1447 begin 1448 inherited; 1449 with cboSelected do 1450 begin 1451 grdSelected.Cells[Tag div 256, Tag mod 256] := Text; 1747 if tag < 0 then exit; 1748 grdSelected.Cells[Tag div 256, Tag mod 256] := MixedCase(items.Strings[itemindex]); 1452 1749 Tag := -1; 1453 1750 Hide; 1751 ControlChange(Sender); 1752 TControl(self.grdSelected).Enabled := True; 1753 ActiveControl := self.grdSelected; 1754 end; 1755 grdSelected.Refresh; 1756 end; 1757 1758 procedure TfrmODMedIV.cboSelectedKeyDown(Sender: TObject; var Key: Word; 1759 Shift: TShiftState); 1760 begin 1761 inherited; 1762 if (Key = VK_RETURN) or (Key = VK_Tab) then 1763 begin 1764 cboSelectedCloseUp(cboSelected); 1765 Key := 0; 1454 1766 end; 1455 1767 end; … … 1528 1840 if Length(Cells[1,i]) > 0 then Responses.Update('STRENGTH', CurAdd, Cells[1,i], Cells[1,i]); 1529 1841 if Length(Cells[2,i]) > 0 then Responses.Update('UNITS', CurAdd, Cells[2,i], Cells[2,i]); 1842 //AGP ADDITIVE FREQUECNY CHANGES 1843 if (Length(Cells[3,i]) > 0) and (Cells[3,i] <> 'N/A') then Responses.Update('ADDFREQ', CurAdd, Cells[3,i], Cells[3,i]); 1530 1844 Inc(CurAdd); 1531 1845 end; {if Fluid A} … … 1558 1872 end; 1559 1873 end; 1560 if cboType.Text = 'Intermittent' then iType := 'I' 1561 else iType := 'C'; 1874 if (cboType.ItemIndex > -1) and (cboType.Items.Strings[cboType.ItemIndex] = 'Intermittent') then iType := 'I' 1875 else if (cboType.ItemIndex > -1) and (cboType.Items.Strings[cboType.ItemIndex] = 'Continuous') then iType := 'C' 1876 else iType := ''; 1562 1877 Responses.Update('TYPE',1,iType,cboType.Text); 1563 1878 Responses.Update('ROUTE',1,cboRoute.ItemID,cboRoute.Text); … … 1635 1950 begin 1636 1951 aSchedule := ''; 1637 if not ShowOtherSchedule(aSchedule) then 1638 begin 1639 cboSchedule.ItemIndex := -1; 1640 cboSchedule.Text := ''; 1641 end 1642 else 1952 cboSchedule.ItemIndex := -1; 1953 cboSchedule.Text := ''; 1954 cboSchedule.DroppedDown := false; 1955 if ShowOtherSchedule(aSchedule) then 1643 1956 begin 1644 1957 Result := Piece(aSchedule,U,1); … … 1652 1965 begin 1653 1966 inherited; 1654 if Sender = ActiveControl then Exit;1655 if not (gdSelected in State) then Exit;1967 //if Sender = ActiveControl then Exit; 1968 //if not (gdSelected in State) then Exit; 1656 1969 with Sender as TStringGrid do 1657 1970 begin 1658 Canvas.Brush.Color := Color; 1659 Canvas.Font := Font; 1971 if State = [gdSelected..gdFocused] then 1972 begin 1973 Canvas.Font.Color := Get508CompliantColor(clWhite); 1974 Canvas.Brush.Color := clHighlight; 1975 //Canvas.Font.Color := clHighlightText; 1976 Canvas.Font.Style := [fsBold]; 1977 Canvas.MoveTo(Rect.Left,Rect.top); 1978 end 1979 else 1980 begin 1981 if (ACol = 4) and (ColWidths[4] > 0) then 1982 Canvas.Brush.Color := clInactiveBorder 1983 else Canvas.Brush.Color := clWindow; 1984 Canvas.Font := Font; 1985 end; 1986 Canvas.FillRect(Rect); 1987 //Canvas.Brush.Color := Color; 1988 1660 1989 Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[ACol, ARow]); 1661 1990 end; … … 1696 2025 tabFluidChange(tabFluid); 1697 2026 end; 2027 end; 2028 2029 procedure TfrmODMedIV.FormKeyPress(Sender: TObject; var Key: Char); 2030 begin 2031 if (Key = #13) and (ActiveControl = grdSelected) then 2032 Key := #0; //Don't let the base class turn it into a forward tab! 2033 inherited; 1698 2034 end; 1699 2035 … … 1781 2117 cboSchedule.ItemIndex := idx; 1782 2118 exit; 2119 end; 2120 //if PRN schedule than set the checkbox than exit 2121 if (X = ' PRN') or (X = 'PRN') then 2122 begin 2123 chkPRN.Checked := True; 2124 Exit; 1783 2125 end; 1784 2126 //Check to see if schedule is a Day-of-Week Schedule (MO-WE-FR@BID) … … 1805 2147 //tempSch := U + Piece(x, '@', 1) + '@' + Pieces(cboSchedule.Items.Strings[idx], U, 2, 5); 1806 2148 tempSch := Piece(x, '@', 1) + '@' + cboSchedule.Items.Strings[idx]; 1807 cboSchedule.Items.Add(tempSch);1808 2149 cboSchedule.Text := (Piece(tempSch,U,1)); 1809 2150 cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(Piece(tempSch, U, 1)); … … 1886 2227 end; 1887 2228 2229 function TfrmODMedIV.UpdateAddFreq(OI: integer): string; 2230 begin 2231 if (self.cboType.ItemIndex = -1) or (MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous') then 2232 Result := GetDefaultAddFreq(OI) 2233 else Result := ''; 2234 end; 2235 1888 2236 procedure TfrmODMedIV.UpdateDuration(SchType: string); 1889 2237 begin … … 1909 2257 i: integer; 1910 2258 OrderIds, TempIVRoute: TStringList; 1911 Default: boolean;2259 //Default: boolean; 1912 2260 begin 1913 2261 if self.grdSelected.RowCount > 0 then self.txtAllIVRoutes.Visible := True; … … 1928 2276 if OrderIds.Count > 0 then 1929 2277 begin 1930 if (self.FInitialOrderID = True) and (self.grdSelected.RowCount = 1) then Default := True 1931 else Default := False; 1932 LoadDosageFormIVRoutes(self.cboRoute.Items, OrderIds, Default); 1933 if default = True then 2278 //if (self.FInitialOrderID = True) and (self.grdSelected.RowCount = 1) then Default := True 2279 //else Default := False; 2280 LoadDosageFormIVRoutes(self.cboRoute.Items, OrderIds); 2281 //if default = True then 2282 // begin 2283 for I := 0 to cboRoute.items.Count - 1 do 1934 2284 begin 1935 for I := 0 to cboRoute.items.Count - 1 do 1936 if Piece(cboRoute.Items.Strings[i], U, 5) = 'D' then 1937 begin 1938 cboRoute.ItemIndex := i; 1939 break; 1940 end; 1941 self.FInitialOrderID := false; 2285 if Piece(cboRoute.Items.Strings[i], U, 5) = 'D' then 2286 begin 2287 cboRoute.ItemIndex := i; 2288 break; 2289 end; 1942 2290 end; 2291 // self.FInitialOrderID := false; 2292 //end; 1943 2293 OrderIds.Free; 1944 2294 end; … … 1954 2304 procedure TfrmODMedIV.txtAllIVRoutesClick(Sender: TObject); 1955 2305 var 1956 i: integer; 1957 begin 1958 inherited; 1959 if MessageDlg('You can also select "OTHER" from the Route list' 2306 i: integer; 2307 msg : String; 2308 begin 2309 inherited; 2310 msg := 'You can also select "OTHER" from the Route list' 1960 2311 + ' to select a Route from the Expanded Med Route List.' 1961 + #13#10 + 'Click OK to launch the Expanded Med Route List.' ,1962 mtInformation, [mbOK, mbCancel],0) = mrOKthen2312 + #13#10 + 'Click OK to launch the Expanded Med Route List.'; 2313 if ShowMsg(msg, smiInfo, smbOKCancel) = smrOk then 1963 2314 begin 1964 2315 for I := 0 to cboRoute.Items.Count - 1 do if cboRoute.Items.Strings[i] = U + 'OTHER' then break; … … 1971 2322 procedure TfrmODMedIV.txtNSSClick(Sender: TObject); 1972 2323 var 1973 i: integer; 1974 begin 1975 inherited; 1976 if MessageDlg('You can also select ' + '"' + 'Other' + '"' + ' from the schedule list' 2324 i: integer; 2325 msg : String; 2326 begin 2327 inherited; 2328 msg := 'You can also select ' + '"' + 'Other' + '"' + ' from the schedule list' 1977 2329 + ' to create a day-of-week schedule.' 1978 + #13#10 + 'Click OK to launch schedule builder' ,1979 mtInformation, [mbOK, mbCancel],0) =mrOK then2330 + #13#10 + 'Click OK to launch schedule builder'; 2331 if ShowMsg(msg, smiInfo, smbOKCancel) = smrOK then 1980 2332 begin 1981 2333 //cboSchedule.Items.Add(U + 'OTHER');
Note:
See TracChangeset
for help on using the changeset viewer.