Changeset 1679 for cprs/trunk/CPRS-Chart/Orders/fODMeds.pas
- Timestamp:
- May 7, 2015, 12:34:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Orders/fODMeds.pas
r829 r1679 189 189 procedure cboXSequenceEnter(Sender: TObject); 190 190 procedure txtRefillsChange(Sender: TObject); 191 procedure QuantityMessageCheck(Tag: integer) ; 192 procedure pnlXDurationButtonEnter(Sender: TObject); 193 procedure cboRouteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 194 procedure cboScheduleKeyUp(Sender: TObject; var Key: Word; 195 Shift: TShiftState); 196 procedure cboXScheduleKeyUp(Sender: TObject; var Key: Word; 197 Shift: TShiftState); 198 procedure cboXSequenceKeyUp(Sender: TObject; var Key: Word; 199 Shift: TShiftState); 200 procedure cboPriorityKeyUp(Sender: TObject; var Key: Word; 201 Shift: TShiftState); 191 202 //procedure btnNSSClick(Sender: TObject); 192 203 private … … 289 300 procedure UpdateDefaultSupply(const CurUnits, CurSchedule, CurDuration, CurDispDrug: string; 290 301 var CurSupply: Integer; var CurQuantity: double; var SkipQtyCheck: Boolean); 291 procedure UpdateSupplyQuantity(const CurUnits, CurSchedule, CurDuration, CurDispDrug : string;302 procedure UpdateSupplyQuantity(const CurUnits, CurSchedule, CurDuration, CurDispDrug, CurInstruct: string; 292 303 var CurSupply: Integer; var CurQuantity: double); 293 304 procedure UpdateDurationControls( FreeText: boolean); … … 397 408 FLD_COMMENT = 80; 398 409 FLD_PTINSTR = 85; 410 FLD_DRUG_ID_INT = 90; 399 411 {dosage type tab index values} 400 412 TI_DOSE = 0; … … 542 554 end; 543 555 if self.EvtID > 0 then FAdminTimeText := 'To Be Determined'; 556 if (isIMO = True) then self.Caption := 'Clinic Orders Medications' 557 else if FInptDlg = True then self.Caption := 'Inpatient Medications' 558 else if DlgFormID = OD_MEDOUTPT then self.Caption := 'Outpatient Medications' 559 else self.Caption := 'Medications Orders'; 544 560 ListForOrderable(FCacheIEN, ListCount, x); 545 561 lstAll.Items.Count := ListCount; … … 614 630 procedure TfrmODMeds.SetupDialog(OrderAction: Integer; const ID: string); 615 631 var 616 AnInstr, OrderID, nsSch, Text, tempOrder, tempSchString, tempSchType, AdminTime : string;617 i x: integer;632 AnInstr, OrderID, nsSch, Text, tempOrder, tempSchString, tempSchType, AdminTime, x: string; 633 i, ix: integer; 618 634 LocChange: boolean; 619 635 AResponse: TResponse; … … 631 647 //AGP 27.72 Order Action behave similar to QO this is why Edit and Copy are setting FIsQuickOrder to true 632 648 //this is not the best approach but this should fix the problem with order edit losing the quantity value. 633 if ( OrderAction = ORDER_QUICK) or (OrderAction = ORDER_EDIT) or (OrderAction = ORDER_COPY) then649 if ((OrderAction = ORDER_QUICK) or (OrderAction = ORDER_EDIT) or (OrderAction = ORDER_COPY)) then 634 650 begin 635 651 FIsQuickOrder := True; … … 647 663 Changing := True; 648 664 txtMed.Tag := StrToIntDef(Responses.IValueFor('ORDERABLE', 1), 0); 665 if OrderAction = ORDER_QUICK then 666 begin 667 if DEACheckFailed(txtMed.Tag, FInptDlg) then 668 begin 669 //btnSelect.Visible := False; 670 btnSelect.Enabled := False; 671 InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); 672 AbortOrder := True; 673 Exit; 674 end; 675 end; 649 676 if (OrderAction = ORDER_QUICK) and (uOrders.PassDrugTstCall = False) and 650 677 (uOrders.OutptDisp = OutptDisp) and (PassDrugTest(txtMed.Tag, 'Q', false) = False) then Exit; … … 672 699 if length(nsSch) > 0 then 673 700 begin 674 SetSchedule( nsSch);701 SetSchedule(UpperCase(nsSch)); 675 702 {cboSchedule.SelectByID(nsSch); 676 703 if cboSchedule.ItemIndex < 0 then … … 694 721 AResponse := Responses.FindResponseByName('ADMIN', 1); 695 722 if AResponse <> nil then AdminTime := AResponse.EValue; 696 if self.cboSchedule.ItemIndex > -1then723 if (self.cboSchedule.ItemIndex > -1) and (AdminTime <> '') then 697 724 begin 698 725 tempSchString := self.cboSchedule.Items.Strings[cboSchedule.itemindex]; … … 700 727 self.cboSchedule.Items.strings[cboSchedule.ItemIndex] := tempSchString; 701 728 end; 702 if self.tabDose.TabIndex = TI_COMPLEXthen729 if (self.tabDose.TabIndex = TI_COMPLEX) and (Responses.InstanceCount('INSTR') = 1) and (AdminTime <> '') then 703 730 begin 704 731 if self.cboXSchedule.ItemIndex > -1 then … … 722 749 end; 723 750 end; 724 if self.tabDose.TabIndex = TI_COMPLEXthen751 if (self.tabDose.TabIndex = TI_COMPLEX) and (Responses.InstanceCount('INSTR') = 1) then 725 752 begin 726 753 if self.cboXSchedule.ItemIndex > -1 then … … 742 769 end; 743 770 if ((OrderAction <> Order_COPY) and (OrderAction <> Order_EDIT)) or 744 (XfInToOutNow = true) or (FIsQuickOrder) then UpdateRelated(FALSE); //AGP Change 771 (XfInToOutNow = true) or (FIsQuickOrder) then 772 begin 773 UpdateRelated(FALSE); //AGP Change 774 //Need to do the following code to reset the FLastUnits and FLastSchedule in case a free text Dose is found. If the following 775 //code is not done than the quantity will reset to zero 776 if not FInptDlg then 777 begin 778 FLastUnits := ''; 779 FLastSchedule := ''; 780 FLastInstruct := ''; 781 //Lasti := Responses.InstanceCount('INSTR'); 782 //Lasti := Responses.NextInstance('DOSE', 0); 783 for I := 1 to Responses.InstanceCount('INSTR') do 784 begin 785 x := ValueOfResponse(FLD_DOSEUNIT, i); 786 FLastUnits := FLastUnits + x + U; 787 x := Responses.IValueFor('INSTR', i); 788 FLastInstruct := FLastInstruct + x + U; 789 x := ValueOfResponse(FLD_SCHEDULE, i); 790 FLastSchedule := FLastSchedule + x + U; 791 end; 792 end; 793 end; 745 794 Changing := False; 746 795 if ((OrderAction = Order_Copy) or (OrderAction = Order_Edit)) and … … 762 811 memComment.Clear; // sometimes the sig is in the comment 763 812 end; 813 FQOInitial := False; 764 814 ControlChange(Self); 765 815 if Self.IsSupply then … … 818 868 ADrug := ValueOfResponse(FLD_DRUG_ID, AnInstance); 819 869 tmpX := x; //Changed for CQ: 7370 - it was tmpX := Trim(x); 870 if Pos(CRLF, tmpX)> 0 then 871 begin 872 SetError('Schedule cannot contains control characters'); 873 Exit; 874 end; 820 875 if (Length(tmpX) = 0) and (not FInptDlg) then SetError(TX_NO_SCHED) 821 876 else if (Length(tmpX) = 0) and FInptDlg and ScheduleRequired(txtMed.Tag, ARoute, ADrug) … … 824 879 begin 825 880 if FInptDlg then ValidLevel := ValidSchedule(tmpX) else ValidLevel := ValidSchedule(tmpX, 'O'); 881 (* if FInptDlg and (tmpX <> '') and (cboSchedule.ItemIndex = -1) and 882 (self.tabDose.TabIndex = TI_DOSE) then 883 //SetError('Unique Schedule Selection Required'); 884 SetError('More than one schedule starts with "'+tmpX+'". Please select a schedule from the list.'); *) 826 885 if ValidLevel = SCH_NO_RTN then 827 886 begin … … 857 916 if Length(Responses.IValueFor('INSTR', i)) > 60 then 858 917 begin 859 SetError(TX_DOSE_LEN); 860 cboDosage.SetFocus; //CQ: 7467 918 if self.tabDose.TabIndex = TI_COMPLEX then 919 begin 920 SetError('Dosage: ' + Responses.IValueFor('INSTR', i) + CRLF + TX_DOSE_LEN); 921 end 922 else 923 begin 924 SetError(TX_DOSE_LEN); 925 cboDosage.SetFocus; //CQ: 7467 926 end; 861 927 end; 862 928 end; … … 889 955 Exit; 890 956 end; 957 if Uppercase(ValFor(Col_Sequence, i)) = 'THEN' then 958 begin 959 if ValFor(Col_Duration,i) = '' then 960 begin 961 SetError('A duration is required when using "Then" as a sequence.'); 962 Exit; 963 end; 964 end; 891 965 end; 892 966 end; … … 1318 1392 chunk := GetCacheChunkIndex(Item.Index); 1319 1393 list := TStringList(FMedCache[chunk]); 1320 x := list[Item.Index mod MED_CACHE_CHUNK_SIZE]; 1321 Item.Caption := Piece(x, U, 2); 1322 Item.Data := Pointer(StrToIntDef(Piece(x, U, 1), 0)); 1394 //This is to make sure that the index that is being used is not outside of the stringlist 1395 If Item.Index mod MED_CACHE_CHUNK_SIZE < list.Count then begin 1396 x := list[Item.Index mod MED_CACHE_CHUNK_SIZE]; 1397 Item.Caption := Piece(x, U, 2); 1398 Item.Data := Pointer(StrToIntDef(Piece(x, U, 1), 0)); 1399 end; 1323 1400 end; 1324 1401 … … 1415 1492 end; *) 1416 1493 FAltChecked := True; 1417 ;1418 1494 SetOnMedSelect; // set up for this medication 1419 1495 SetOnQuickOrder; // insert quick order responses … … 1424 1500 if (txtQuantity.Text = '0') and (Length(QOQuantityStr)>0) then 1425 1501 txtQuantity.Text := QOQuantityStr; 1502 //FQOInitial := False; 1426 1503 end 1427 1504 else if (FActiveMedList = lstAll) and (lstAll.Selected <> nil) then // orderable item … … 1453 1530 begin 1454 1531 temp := self.MedName; 1455 CheckFormularyOI( MedIEN, temp, FInptDlg);1532 CheckFormularyOI(medIEN, temp, FInptDlg); 1456 1533 FAltChecked := True; 1534 txtMed.Text := ''; 1457 1535 end; 1458 1536 if MedIEN <> txtMed.Tag then … … 1481 1559 else ShowMedSelect; // show the selection fields 1482 1560 FNoZERO := False; 1561 if FQOInitial = True then FQOInitial := False; 1562 1483 1563 end; 1484 1564 … … 1585 1665 // set up lists & initial values based on orderable item 1586 1666 SetControl(txtMed, 'Medication'); 1587 if (self.MedName <> '') then1667 if (self.MedName <> '') then 1588 1668 begin 1589 1669 if (txtMed.Text <> self.MedName) then … … 1603 1683 AResponse := Responses.FindResponseByName('SCHEDULE',1); 1604 1684 if (AResponse <> nil) and (AResponse.EValue <> '') then x := AResponse.EValue; 1605 SetSchedule( x);1685 SetSchedule(UpperCase(x)); 1606 1686 (* if x <> '' then 1607 1687 begin … … 1716 1796 var 1717 1797 AResponse: TResponse; 1718 x,LocRoute,TempSch,DispGrp : string;1798 x,LocRoute,TempSch,DispGrp, SchType: string; 1719 1799 i, DispDrug: Integer; 1720 1800 begin … … 1730 1810 SetDosage(IValueFor('INSTR', i)); 1731 1811 with cboDosage do 1732 if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex] 1812 //agp change QO code to populate the Grid with the same fields after selection CQ 15933 1813 //if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex] 1814 if ItemIndex > -1 then x := Piece(Text, TAB, 1) + TAB + Items[ItemIndex] 1733 1815 else x := IValueFor('INSTR',i); //AGP Change 26.41 for CQ 9102 PSI-05-015 affect copy and edit functionality 1734 1816 grdDoses.Cells[COL_DOSAGE, i] := x; … … 1737 1819 if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex] else x := Text; 1738 1820 grdDoses.Cells[COL_ROUTE, i] := x; 1739 if FIsQuickOrder then TempSch := cboSchedule.Text; 1740 SetSchedule(IValueFor('SCHEDULE', i)); 1741 if (cboSchedule.Text = '') and (FIsQuickOrder) and (NSSchedule = False) then 1742 begin 1743 cboSchedule.SelectByID(TempSch); 1744 cboSchedule.Text := TempSch; 1745 end; 1821 SetSchedule(UpperCase(IValueFor('SCHEDULE', i))); 1746 1822 if (cboSchedule.Text = '') and (FIsQuickOrder) and (NSSchedule = True) then cboSchedule.ItemIndex := -1; 1747 1823 x := cboSchedule.Text; … … 1755 1831 begin 1756 1832 if IValueFor('ADMIN', i) <> '' then grdDoses.Cells[COL_ADMINTIME, i] := IValueFor('ADMIN', i) 1757 else if cboSchedule.ItemIndex > -1then1833 else if (cboSchedule.ItemIndex > -1) and (chkPRN.Checked = false) then 1758 1834 grdDoses.Cells[COL_ADMINTIME, i] := Piece(cboSchedule.Items.Strings[cboSchedule.itemIndex],U,4) 1759 1835 else grdDoses.Cells[COL_ADMINTIME, i] := ''; 1760 1836 if grdDoses.Cells[COL_ADMINTIME, i] = '' then grdDoses.Cells[COL_ADMINTIME, i] := 'Not Defined'; 1761 1837 if FAdminTimeText <> '' then grdDoses.Cells[COL_ADMINTIME, i] := FAdminTimeText; 1838 //done to prevent admin time showing up in schedules that should not have admin times. Also remove Not Defined for schedule 1839 //should not show the admin time 1840 if (cboSchedule.ItemIndex > -1) or (chkPRN.Checked = True) then 1841 begin 1842 SchType := ''; 1843 if (cboSchedule.ItemIndex > -1) then SchType := Piece(cboSchedule.Items.Strings[cboSchedule.itemIndex],U,3); 1844 if (SchType = 'P') or (SchType = 'O') or (SchType = 'OC') or (ChkPRN.Checked = True) then 1845 grdDoses.Cells[COL_ADMINTIME, i] := ''; 1846 end; 1762 1847 end; 1848 chkPRN.Checked := false; 1763 1849 if IValueFor('CONJ', i) = 'A' then x := 'AND' 1764 1850 else if IValueFor('CONJ', i) = 'T' then x := 'THEN' … … 1779 1865 SetDosage(IValueFor('INSTR', 1)); 1780 1866 SetControl(cboRoute, 'ROUTE', 1); 1781 SetSchedule( IValueFor('SCHEDULE', 1));1867 SetSchedule(UpperCase(IValueFor('SCHEDULE', 1))); 1782 1868 if (cboSchedule.Text = '') and (FIsQuickOrder) and (NSSchedule = False) then 1783 1869 begin … … 1845 1931 end; {if FInptDlg..else} 1846 1932 end; {with} 1847 if FInptDlgthen1933 if (FInptDlg) then 1848 1934 begin 1849 1935 x := ValueOfResponse(FLD_SCHEDULE, 1); … … 1901 1987 btnSelect.Default := False; 1902 1988 cmdAccept.Visible := True; 1903 cmdAccept.Default := True;1989 cmdAccept.Default := False; 1904 1990 cmdAccept.Left := cmdQuit.Left; 1905 1991 cmdAccept.Top := MemOrder.Top; … … 1996 2082 begin 1997 2083 tabDose.TabIndex := TI_COMPLEX; 2084 lblAdminSchSetTexT(''); 1998 2085 MoveCombo(cboDosage, cboXDosage); 1999 2086 MoveCombo(cboRoute, cboXRoute); … … 2079 2166 end; 2080 2167 cboSchedule.ItemIndex := -1; 2168 cboSchedule.Text := ''; 2081 2169 if chkPRN.Checked = True then chkPRN.Checked := False; 2082 2170 cboSchedule.SelectByID(x); 2083 2171 if cboSchedule.ItemIndex > -1 then exit; 2172 if (X = ' PRN') or (X = 'PRN') then 2173 begin 2174 chkPRN.Checked := True; 2175 Exit; 2176 end; 2084 2177 // if cboSchedule.ItemIndex < 0 then 2085 2178 //begin … … 2433 2526 end; 2434 2527 2528 procedure TfrmODMeds.cboRouteKeyUp(Sender: TObject; var Key: Word; 2529 Shift: TShiftState); 2530 begin 2531 inherited; 2532 if (Key = VK_BACK) and (cboRoute.Text = '') then cboRoute.ItemIndex := -1; 2533 end; 2534 2435 2535 { cboSchedule ----------------------------------- } 2436 2536 … … 2472 2572 if length(trim(othSch)) > 1 then 2473 2573 begin 2574 othSch := othSch + U + U + NSSScheduleType + U + NSSAdminTime; 2474 2575 cboSchedule.Items.Add(othSch); 2475 idx := cboSchedule.Items.IndexOf( OthSch);2576 idx := cboSchedule.Items.IndexOf(Piece(OthSch, U, 1)); 2476 2577 cboSchedule.ItemIndex := idx; 2477 2578 end; … … 2526 2627 txtXDurationChange(Sender); 2527 2628 ControlChange(Sender); 2629 end; 2630 2631 procedure TfrmODMeds.QuantityMessageCheck(tag: integer); 2632 var 2633 DispDrug: integer; 2634 x: string; 2635 2636 begin 2637 if FInptDlg then Exit; 2638 DispDrug := StrToIntDef(ValueOf(FLD_DRUG_ID, tag), 0); 2639 if DispDrug > 0 then 2640 begin 2641 if not FSuppressMsg then 2642 begin 2643 DispOrderMessage(DispenseMessage(DispDrug)); 2644 FSuppressMsg := False; 2645 end; 2646 x := QuantityMessage(DispDrug); 2647 end 2648 else x := ''; 2649 if Length(x) > 0 2650 then lblQtyMsg.Caption := TX_QTY_PRE + x + TX_QTY_POST 2651 else lblQtyMsg.Caption := ''; 2528 2652 end; 2529 2653 … … 2742 2866 for i := 0 to Pred(FAllDoses.Count) do 2743 2867 begin 2744 if AnsiSameText(DoseDrug, Copy(FAllDoses[i], 1, Length(DoseDrug))) then 2868 // CQ #16957 - Corrected code that would potentially mis-match drugs - JCS 2869 //if AnsiSameText(DoseDrug, Copy(FAllDoses[i], 1, Length(DoseDrug))) then 2870 if AnsiSameText(DoseDrug, Pieces(FAllDoses[i],U,1,2)) then 2745 2871 begin 2746 2872 Result := Piece(FAllDoses[i], U, 3); … … 3142 3268 if Piece(x, ' ', 2) = 'MONTHS' then DoseMinutes := ExtractInteger(x) * 43200; 3143 3269 if Piece(x, ' ', 2) = 'WEEKS' then DoseMinutes := ExtractInteger(x) * 10080; 3144 if P iece(x, ' ', 2) = 'DAYS'then DoseMinutes := ExtractInteger(x) * 1440;3270 if Pos('DAY',Piece(x, ' ', 2))>0 then DoseMinutes := ExtractInteger(x) * 1440; 3145 3271 if Piece(x, ' ', 2) = 'HOURS' then DoseMinutes := ExtractInteger(x) * 60; 3146 3272 if Piece(x, ' ', 2) = 'MINUTES' then DoseMinutes := ExtractInteger(x); … … 3182 3308 with grdDoses do 3183 3309 begin 3184 i := grdDoses.Width - 12; // 12 = 4pixel margin + 8 pixel column 03310 i := grdDoses.Width - 20; // 20 = 12 pixel margin + 8 pixel column 0 3185 3311 i := i - GetSystemMetrics(SM_CXVSCROLL); // compensate for appearance of scroll bar 3186 3312 if (not FinptDlg) or (FAdminTimeText = 'Not defined for Clinic Locations') then … … 3464 3590 DisableDefaultButton(self); 3465 3591 DisableCancelButton(self); 3592 QuantityMessageCheck(cboXDosage.Tag); 3466 3593 end; 3467 3594 … … 3730 3857 str := str + CRLF + CRLF + AdminTimeHelpText; 3731 3858 infoBox(str,'Administration Time Information',MB_OK); 3859 end; 3860 3861 procedure TfrmODMeds.pnlXDurationButtonEnter(Sender: TObject); 3862 begin 3863 inherited; 3864 QuantityMessageCheck(self.grdDoses.Row); 3732 3865 end; 3733 3866 … … 4074 4207 FLD_QUANTITY : 4075 4208 begin 4076 if Pos(',', txtQuantity.Text)>0 then 4209 if Pos(',', txtQuantity.Text)>0 then 4077 4210 Result := Piece(txtQuantity.Text,',',1) + Piece(txtQuantity.Text,',',2) 4078 4211 else … … 4129 4262 begin 4130 4263 Checked := false; 4131 4264 if ((StrToFloatDef(txtQuantity.Text, 0) = 0) and (StrToIntDef(txtSupply.Text, 0) = 0) and 4132 4265 (txtQuantity.Tag = 0) and (txtSupply.Tag = 0) and (cboDosage.Text <> '')) 4133 4266 or ((cboDosage.ItemIndex < 0) and (not FIsQuickOrder)) or … … 4137 4270 ADrug := Piece(CurDispDrug, U, 1); 4138 4271 CurSupply := DefaultDays(ADrug, CurUnits, CurSchedule); 4139 if CurSupply > 0 then 4272 if CurSupply > 0 then 4140 4273 begin 4141 4274 spnSupply.Position := CurSupply; … … 4160 4293 SkipQtyCheck := TRUE; 4161 4294 end; 4162 if FQOInitial = true then FQOInitial := False;4295 //if FQOInitial = true then FQOInitial := False; 4163 4296 end; 4164 4297 if (IsClozapineOrder = true) and (CurDispDrug <> '') and (CurDispDrug <> U)and (Checked = false) then … … 4185 4318 end; 4186 4319 4187 procedure TfrmODMeds.UpdateSupplyQuantity(const CurUnits, CurSchedule, CurDuration, CurDispDrug: string; 4320 //add CURInstrcut to this procedure. This address a problem with an user starting with a free-text dosage and changing 4321 //to another free-text dose and the quantity value not updating. 4322 procedure TfrmODMeds.UpdateSupplyQuantity(const CurUnits, CurSchedule, CurDuration, CurDispDrug, CurInstruct: string; 4188 4323 var CurSupply: Integer; var CurQuantity: double); 4189 4324 const … … 4197 4332 ADrug: string; 4198 4333 SaveChanging: Boolean; 4199 tmpQuty: Double; 4200 begin 4201 tmpQuty := 0; 4334 tmpQuantity: double; 4335 begin 4202 4336 if (tabDose.TabIndex = TI_COMPLEX) and (txtSupply.Tag = 0) and (txtQuantity.Tag = 0) then 4203 4337 begin … … 4220 4354 (CurDuration = FLastDuration) and 4221 4355 (CurQuantity = FLastQuantity) and 4222 (CurSupply = FLastSupply) then Exit; 4356 (CurSupply = FLastSupply) and 4357 (CurInstruct = FLastInstruct) then Exit; 4223 4358 // exit if supply & quantity have both been directly edited 4224 4359 if (txtSupply.Tag > 0) and (txtQuantity.Tag > 0) then Exit; … … 4229 4364 else if (CurSupply <> FLastSupply) and (txtQuantity.Tag = 0) then UpdateControl := UPD_QUANTITY 4230 4365 else if (CurQuantity <> FLastQuantity) and (txtSupply.Tag = 0) then UpdateControl := UPD_SUPPLY; 4231 if (UpdateControl = UPD_NONE) and (( CurUnits <> FLastUnits) or (CurSchedule <> FLastSchedule)) then4366 if (UpdateControl = UPD_NONE) and (((CurUnits <> FLastUnits) or (CurInstruct <> FLastInstruct)) or (CurSchedule <> FLastSchedule)) then 4232 4367 begin 4233 4368 if txtQuantity.Tag = 0 then UpdateControl := UPD_QUANTITY … … 4239 4374 if FIsQuickOrder and (CurQuantity > 0) and FQOInitial then 4240 4375 begin 4241 FQOInitial := False;4376 txtQuantity.Text := FloatToStr(CurQuantity); 4242 4377 Exit; 4243 4378 end; 4244 if FIsQuickOrder and (CurQuantity > 0) then4245 tmpQuty := CurQuantity;4246 4379 CurQuantity := DaysToQty(CurSupply, CurUnits, CurSchedule, CurDuration, ADrug); 4247 if (tmpQuty > 0) and (CurQuantity <= 0) then 4248 begin 4249 txtQuantity.Text := FloatToStr(tmpQuty); 4250 CurQuantity := tmpQuty; 4251 end else if (CurQuantity >= 0) then 4380 if (CurQuantity >= 0) then 4252 4381 txtQuantity.Text := FloatToStr(CurQuantity); 4253 4382 end; … … 4258 4387 UPD_BOTH : begin 4259 4388 txtSupply.Text := IntToStr(CurSupply); 4260 tmpQuty := 0; 4389 spnSupply.Position := StrToIntDef(txtSupply.Text, 0); 4390 tmpQuantity := DaysToQty(CurSupply, CurUnits, CurSchedule, CurDuration, ADrug); 4261 4391 if FIsQuickOrder and (CurQuantity > 0) and FQOInitial then 4392 begin 4393 txtQuantity.Text := FloatToStr(CurQuantity); 4394 Exit; 4395 end; 4396 (* if FIsQuickOrder and (CurQuantity > 0) and (tmpQuantity = 0) and FQOInitial then 4262 4397 begin 4263 FQOInitial := False;4398 txtQuantity.Text := FloatToStr(CurQuantity); 4264 4399 Exit; 4265 end; 4266 if FIsQuickOrder and (CurQuantity > 0) then 4267 tmpQuty := CurQuantity; 4268 CurQuantity := DaysToQty(CurSupply, CurUnits, CurSchedule, CurDuration, ADrug); 4269 if (tmpQuty > 0) and (CurQuantity <= 0) then 4270 begin 4271 txtQuantity.Text := FloatToStr(tmpQuty); 4272 CurQuantity := tmpQuty; 4273 end else if CurQuantity >= 0 then 4400 end; *) 4401 //CurQuantity := DaysToQty(CurSupply, CurUnits, CurSchedule, CurDuration, ADrug); 4402 CurQuantity := tmpQuantity; 4403 if CurQuantity >= 0 then 4274 4404 txtQuantity.Text := FloatToStr(CurQuantity); 4275 4405 end; … … 4579 4709 lblAdminTime.Caption := ''; 4580 4710 end; 4581 if (self.tabDose.TabIndex = TI_DOSE) and (CurSchedule <> FLastSchedule) then UpdateStartExpires(CurSchedule); 4582 //AGP remove this code for CQ 11772 4583 (*if (ValueOf(FLD_SCHED_TYP) = 'O') 4584 or (Responses.EventType in ['A','D','T','M','O']) 4585 or ((Length(cboSchedule.Text)>0) and (cboSchedule.ItemIndex < 0)) then 4586 begin 4587 if (chkDoseNow.Checked) and (chkDoseNow.Visible) then 4588 begin 4589 chkDoseNowClick(Self); 4590 chkDoseNow.Checked := False; 4591 end; 4592 chkDoseNow.Visible := False; 4593 lblAdminTime.Visible := False; 4594 end 4595 else 4596 begin 4597 chkDoseNow.Visible := TRUE; 4598 lblAdminTime.Visible := not chkDoseNow.Checked; 4599 end; *) 4711 if (self.tabDose.TabIndex = TI_DOSE) and (CurSchedule <> FLastSchedule) then 4712 UpdateStartExpires(CurSchedule); 4600 4713 if Responses.EventType in ['A','D','T','M','O'] then lblAdminTime.Visible := False; 4601 4714 end; 4602 4715 if not FInptDlg then 4603 4716 begin 4604 4717 CurSchedule := CurScheduleOut; 4605 4718 if ((CurInstruct <> FLastInstruct) and (CurUnits <> U)) or ((IsClozapineOrder = true) and (CurDispDrug <> '') and (CurDispDrug <> U)) //AGP Change 26.48 Do not update quantity and day supply if no matching dose on the server 4719 //if ((CurInstruct <> FLastInstruct) and (CurUnits <> U)) 4606 4720 then UpdateDefaultSupply(CurUnits, CurSchedule, CurDuration, CurDispDrug, CurSupply, CurQuantity, 4607 4721 LackQtyInfo); … … 4611 4725 end 4612 4726 else 4613 UpdateSupplyQuantity(CurUnits, CurSchedule, CurDuration, CurDispDrug, Cur Supply, CurQuantity);4727 UpdateSupplyQuantity(CurUnits, CurSchedule, CurDuration, CurDispDrug, CurInstruct, CurSupply, CurQuantity); 4614 4728 // if (CurDispDrug <> FLastDispDrug) then UpdateSC(CurDispDrug); 4615 4729 if ((CurDispDrug <> FLastDispDrug) or (CurSupply <> FLastSupply)) and ((CurDispDrug <> '') and (CurSupply > 0)) then … … 4633 4747 if FUpdated then ControlChange(Self); 4634 4748 FScheduleChanged := false; 4749 //FQOInitial := False; 4635 4750 end; 4636 4751 … … 4644 4759 Exit; 4645 4760 end; 4761 if timCheckChanges.Enabled = True then sleep(1500); 4646 4762 //AGP Change for 26.45 PSI-04-069 4647 4763 if self.tabDose.TabIndex = 1 then … … 4690 4806 T = '"'; 4691 4807 T1 = 'By checking the "Give additional dose now" box, you have actually entered two orders for the same medication "'; 4692 T2 = #13#13'The first order''s administrative schedule is"';4693 T3 = #13'The second order''s administrative schedule is"';4808 T2 = #13#13'The "Give additional dose now" order has an administration schedule of "'; 4809 T3 = #13'The "Ongoing" order has an administration schedule of "'; 4694 4810 T4 = #13#13'Do you want to continue?'; 4811 T5 = '" and a priority of "'; 4695 4812 T1A = 'By checking the "Give additional dose now" box, you have actually entered a new order with the schedule "NOW"'; 4696 4813 T2A = ' in addition to the one you are placing for the same medication "'; … … 4698 4815 medNm: string; 4699 4816 theSch: string; 4817 ordPriority: string; 4700 4818 begin 4701 4819 inherited; … … 4704 4822 medNm := txtMed.Text; 4705 4823 theSch := cboSchedule.Text; 4824 ordPriority := cboPriority.SelText; 4706 4825 if length(theSch)>0 then 4707 4826 begin 4708 4827 //if ( (ValueOf(FLD_SCHED_TYP) <> 'O') and (InfoBox(T1+medNm+T+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL) )then 4709 if InfoBox(T1+medNm+T+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL then 4828 //if InfoBox(T1+medNm+T+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL then 4829 if InfoBox(T1+medNm+T+T2+'NOW'+T5+ordPriority+T+T3+theSch+T5+ordPriority+T+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL then 4710 4830 begin 4711 4831 chkDoseNow.Checked := False; … … 4832 4952 lblAdminTime.Caption := ''; 4833 4953 PrnPos := Pos('PRN',cboSchedule.Text); 4834 if (PrnPos < 1) then4954 if (PrnPos < 1) and (FQOInitial = false) then 4835 4955 UpdateStartExpires(cboSchedule.Text + ' PRN'); 4836 4956 end … … 4840 4960 begin 4841 4961 tempSch := ';'+Trim(cboSchedule.Text); 4842 UpdateStartExpires(tempSch);4962 if FQOInitial = false then UpdateStartExpires(tempSch); 4843 4963 end; 4844 4964 //lblAdminTime.Caption := FAdminTimeLbl; … … 4846 4966 cboScheduleClick(Self); 4847 4967 end; 4968 if FQOInitial = false then updateRelated(False); 4969 //updateRelated(False); 4848 4970 ControlChange(Self); 4849 4971 end; … … 4965 5087 procedure TfrmODMeds.FormKeyPress(Sender: TObject; var Key: Char); 4966 5088 begin 4967 (* if (Key = #13) and (ActiveControl = grdDoses{pnlXSequence}) then 4968 begin 4969 ShowEditor(grdDoses.Col, grdDoses.Row, #0); 4970 Key := #0; //Don't let the base class turn it into a forward tab! 4971 end *) 4972 //else 4973 if (Key = #13) and (ActiveControl = txtMed) then 4974 Key := #0; //Don't let the base class turn it into a forward tab! 5089 if (Key = #13) and (ActiveControl = txtMed) then 5090 Key := #0 //Don't let the base class turn it into a forward tab! 5091 else if (Key = #13) and (self.tabDose.TabIndex = TI_Complex) then 5092 Key := #0 5093 else 5094 inherited; 4975 5095 end; 4976 5096 … … 4993 5113 DisableDefaultButton(self); 4994 5114 DisableCancelButton(self); 5115 QuantityMessageCheck(self.grdDoses.Row); 4995 5116 end; 4996 5117 … … 5041 5162 tempAdmin := lblAdminSchGetText; 5042 5163 if tempAdmin <> '' then lblAdminSchSetText('Admin Time: ' + tempAdmin); 5164 if not (FInptDLG) then 5165 begin 5166 if self.cboPriority.Left < (self.grpPickup.Left + self.grpPickup.Width) then 5167 begin 5168 self.cboPriority.Left := self.grpPickup.Left + self.grpPickup.Width + 2; 5169 if self.Width < (self.cboPriority.Left + self.cboPriority.Width) then 5170 begin 5171 self.Width := self.cboPriority.Left + self.cboPriority.Width + 9; 5172 self.cboPriority.Left := self.pnlBottom.Width - self.cboPriority.Width - 2; 5173 end; 5174 self.lblPriority.Left := self.cboPriority.Left; 5175 end; 5176 end; 5043 5177 end; 5044 5178 … … 5134 5268 result := False; 5135 5269 IsInptDlg := False; 5136 Td := FMToday; 5270 // CQ #15188 - changed to use function to determine Td value - TDP 5271 //Td := FMToday; 5272 Td := IMOTimeFrame; 5137 5273 if DlgFormID = MedsInDlgFormId then IsInptDlg := TRUE; 5138 5274 IsIMOLocation := IsValidIMOLoc(Encounter.Location,Patient.DFN); 5275 5276 // CQ #15188 - allow IMO functionality 23 hours after encounter date/time - JCS 5277 // CQ #15188 - changed to use function to set Td. Reverted this line back to original - TDP 5278 {if (IsInptDlg) and (not Patient.Inpatient) and IsIMOLocation and 5279 (Encounter.DateTime > DateTimeToFMDateTime(FMDateTimeToDateTime(FMNow) - (23/24))) then} 5139 5280 if (IsInptDlg) and (not Patient.Inpatient) and IsIMOLocation and (Encounter.DateTime > Td) then 5140 5281 result := True; … … 5271 5412 cboSchedule.ItemIndex := -1; 5272 5413 ValidateInpatientSchedule(cboSchedule); 5414 updateRelated(False); 5415 end; 5416 5417 5418 procedure TfrmODMeds.cboScheduleKeyUp(Sender: TObject; var Key: Word; 5419 Shift: TShiftState); 5420 begin 5421 inherited; 5422 if (Key = VK_BACK) and (cboSchedule.Text = '') then cboSchedule.itemindex:= -1; 5273 5423 end; 5274 5424 … … 5285 5435 ScheduleCombo.Text := TrimLeft(UpperCase(ScheduleCombo.Text)); 5286 5436 {if user entered schedule verify it is in list} 5287 if ScheduleCombo.ItemIndex < 0 then // CQ: 73975437 if (ScheduleCombo.ItemIndex < 0) and (not FInptDlg) then // CQ: 7397 and CQ 17934 5288 5438 begin //Fix for CQ: 9299 - Outpatient Med orders will not accept free text schedule 5289 5439 tmpIndex := GetSchedListIndex(ScheduleCombo,ScheduleCombo.Text); … … 5298 5448 ' select ''OTHER'' from the list.', 5299 5449 'Incorrect Schedule.'); 5450 ScheduleCombo.ItemIndex := -1; 5451 ScheduleCombo.Text := ''; 5300 5452 FShowPnlXScheduleOk := True; //Added for CQ: 7370 5301 5453 if ScheduleCombo.CanFocus then 5302 5454 ScheduleCombo.SetFocus; 5303 ScheduleCombo.SelStart := Length(ScheduleCombo.Text);5455 //ScheduleCombo.SelStart := Length(ScheduleCombo.Text); 5304 5456 end; 5305 5457 end; … … 5369 5521 doesn't for simple orders } 5370 5522 ValidateInpatientSchedule(cboXSchedule); 5523 end; 5524 5525 5526 procedure TfrmODMeds.cboXScheduleKeyUp(Sender: TObject; var Key: Word; 5527 Shift: TShiftState); 5528 begin 5529 inherited; 5530 if (Key = VK_BACK) and (cboXSchedule.Text = '') then cboXSchedule.ItemIndex := -1; 5371 5531 end; 5372 5532 … … 5396 5556 DisableDefaultButton(self); 5397 5557 DisableCancelButton(self); 5558 QuantityMessageCheck(self.grdDoses.Row); 5398 5559 end; 5399 5560 … … 5427 5588 end; 5428 5589 5590 5591 procedure TfrmODMeds.cboXSequenceKeyUp(Sender: TObject; var Key: Word; 5592 Shift: TShiftState); 5593 begin 5594 inherited; 5595 if (Key = VK_BACK) and (cboXSequence.Text = '') then cboXSequence.ItemIndex := -1; 5596 end; 5597 5429 5598 procedure TfrmODMeds.cboXSequence1Exit(Sender: TObject); 5430 5599 begin … … 5437 5606 begin 5438 5607 inherited; 5608 if (Key = VK_BACK) and (cboDosage.Text = '') then cboDosage.ItemIndex := -1; 5439 5609 //Fix for CQ: 7545 5440 5610 if cboDosage.ItemIndex > -1 then … … 5444 5614 end; 5445 5615 5616 5617 procedure TfrmODMeds.cboPriorityKeyUp(Sender: TObject; var Key: Word; 5618 Shift: TShiftState); 5619 begin 5620 inherited; 5621 if (Key = VK_BACK) and (cboPriority.Text = '') then cboPriority.ItemIndex := -1; 5622 end; 5623 5446 5624 procedure TfrmODMeds.cboXDosageKeyUp(Sender: TObject; var Key: Word; 5447 5625 Shift: TShiftState); 5448 5626 begin 5449 5627 inherited; 5628 if (Key = VK_BACK) and (cboXDosage.Text = '') then cboXDosage.itemindex := -1; 5450 5629 //Fix for CQ: 7545 5451 5630 if cboXDosage.ItemIndex > -1 then … … 5506 5685 //agp Change CQ 10719 5507 5686 self.chkXPRN.OnClick(self.chkXPRN); 5687 QuantityMessageCheck(self.grdDoses.Row); 5508 5688 end; 5509 5689
Note:
See TracChangeset
for help on using the changeset viewer.