Changeset 460 for cprs/branches/foia-cprs/CPRS-Chart/Orders/fODMeds.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/Orders/fODMeds.pas
r459 r460 86 86 memDrugMsg: TMemo; 87 87 txtNSS: TLabel; 88 SpeedButton1: TSpeedButton; 88 89 procedure FormCreate(Sender: TObject); 89 90 procedure btnSelectClick(Sender: TObject); … … 186 187 procedure cboScheduleExit(Sender: TObject); 187 188 procedure cboXScheduleExit(Sender: TObject); 189 procedure cboDosageKeyUp(Sender: TObject; var Key: Word; 190 Shift: TShiftState); 191 procedure cboXDosageKeyUp(Sender: TObject; var Key: Word; 192 Shift: TShiftState); 193 procedure txtSupplyClick(Sender: TObject); 194 procedure txtQuantityClick(Sender: TObject); 195 procedure txtRefillsClick(Sender: TObject); 196 procedure WMClose(var Msg : TWMClose); message WM_CLOSE; 197 procedure cboXScheduleEnter(Sender: TObject); 188 198 //procedure btnNSSClick(Sender: TObject); 189 199 private … … 236 246 FOrigiMsgDisp: boolean; 237 247 FNSSOther: boolean; 238 FFromClick: boolean;248 {selection} 239 249 FShowPnlXScheduleOk : boolean; 240 250 FRemoveText : Boolean; 241 {selection}251 FSmplPRNChkd: Boolean; 242 252 procedure ChangeDelayed; 243 253 function FindQuickOrder(const x: string): Integer; … … 302 312 // function ValidateRoute(RouteCombo: TORComboBox) : Boolean; Removed based on Site feeback. See CQ: 7518 303 313 function IsSupplyAndOutPatient : boolean; 314 function GetSchedListIndex(SchedCombo: TORComboBox; pSchedule: String):integer; 304 315 protected 305 316 procedure InitDialog; override; 306 317 procedure Validate(var AnErrMsg: string); override; 307 318 public 319 ARow1: integer; 308 320 procedure SetupDialog(OrderAction: Integer; const ID: string); override; 309 321 procedure CheckDecimal(var AStr: string); … … 319 331 320 332 uses rCore, uCore, ORFn, rODMeds, rODBase, rOrders, fRptBox, fODMedOIFA, 321 uAccessibleStringGrid, uOrders, fOtherSchedule, StrUtils ;333 uAccessibleStringGrid, uOrders, fOtherSchedule, StrUtils, fFrame; 322 334 323 335 const … … 329 341 COL_DURATION = 4; 330 342 COL_SEQUENCE = 5; 343 COL_CHKXPRN = 6; 331 344 VAL_DOSAGE = 10; 332 345 VAL_ROUTE = 20; … … 334 347 VAL_DURATION = 40; 335 348 VAL_SEQUENCE = 50; 349 VAL_CHKXPRN = 60; 336 350 TAB = #9; 337 351 {field identifiers} … … 387 401 TC_NO_DEA = 'DEA# Required'; 388 402 TX_NO_MED = 'Medication must be selected.'; 403 TX_NO_SEQ = 'Missing one or more conjunction.'; 389 404 TX_NO_DOSE = 'Dosage must be entered.'; 390 405 TX_DOSE_NUM = 'Dosage may not be numeric only'; … … 422 437 x: string; 423 438 begin 439 frmFrame.pnlVisit.Enabled := false; 424 440 AutoSizeDisabled := True; 425 441 inherited; 426 442 btnXDuration.Align := alClient; 427 443 AllowQuickOrder := True; 444 FSmplPRNChkd := False; // GE CQ7585 428 445 CheckAuthForMeds(x); 429 446 if Length(x) > 0 then … … 456 473 {if not FInptDlg then } Responses.SetPromptFormat('INSTR', '@'); 457 474 StatusText('Loading Schedules'); 458 LoadSchedules(cboSchedule.Items, FInptDlg); 475 //if (Self.EvtID > 0) then LoadSchedules(cboSchedule.Items) 476 //else LoadSchedules(cboSchedule.Items, FInptDlg); 477 LoadSchedules(cboSchedule.Items, FInptDlg); 459 478 StatusText(''); 460 479 if FInptDlg then SetControlsInpatient else SetControlsOutpatient; … … 466 485 begin 467 486 txtNss.Visible := True; 487 //cboSchedule.ListItemsOnly := True; 488 //cboXSchedule.ListItemsOnly := True; 468 489 end; 469 490 with grdDoses do … … 537 558 FAllDrugs.Free; 538 559 TAccessibleStringGrid.UnwrapControl(grdDoses); 560 frmFrame.pnlVisit.Enabled := true; 539 561 inherited; 540 562 end; … … 558 580 FQOInitial := False; 559 581 FNSSOther := False; 560 FFromClick := False;561 582 end; 562 583 563 584 procedure TfrmODMeds.SetupDialog(OrderAction: Integer; const ID: string); 564 585 var 565 AnInstr, OrderID, nsSch : string;586 AnInstr, OrderID, nsSch, Text: string; 566 587 ix: integer; 567 588 begin … … 606 627 begin 607 628 SetSchedule(nsSch); 629 {cboSchedule.SelectByID(nsSch); 630 if cboSchedule.ItemIndex < 0 then 631 begin 632 cboSchedule.Items.Add(nsSch); 633 cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(nsSch); 634 end;} 608 635 end; 609 636 end; … … 611 638 end; 612 639 end; //nss 613 UpdateRelated(FALSE); 640 if ((OrderAction <> Order_COPY) and (OrderAction <> Order_EDIT)) or 641 (XfInToOutNow = true) then UpdateRelated(FALSE); //AGP Change 614 642 Changing := False; 615 643 end; … … 624 652 then AnInstr := 'Copy: ' + AnInstr 625 653 else AnInstr := 'Change: ' + AnInstr; 626 Caption := AnInstr; 654 Text := AnsiReplaceText(AnInstr,CRLF,''); 655 Caption := Text; 627 656 memComment.Clear; // sometimes the sig is in the comment 628 657 end; … … 654 683 // and is not an outpaitent order, then display error text to require route 655 684 if (Length(x) = 0) and (Not IsSupplyAndOutPatient) then 685 begin 686 if cboRoute.Showing = true then cboRoute.SetFocus; //CQ: 7467 656 687 SetError(TX_NO_ROUTE); 688 end; 657 689 if (Length(x) > 0) and NeedLookup then 658 690 begin 659 691 LookupRoute(x, RouteID, RouteAbbr); 660 692 if RouteID = '0' 661 then SetError(TX_NF_ROUTE) 693 then 694 begin 695 if cboRoute.Showing = true then cboRoute.SetFocus; //CQ: 7467 696 SetError(TX_NF_ROUTE); 697 end 662 698 else Responses.Update('ROUTE', AnInstance, RouteID, RouteAbbr); 663 699 end; … … 678 714 else if (Length(tmpX) = 0) and FInptDlg and ScheduleRequired(txtMed.Tag, ARoute, ADrug) 679 715 then SetError(TX_NO_SCHED); 680 681 716 if Length(tmpX) > 0 then 682 717 begin … … 706 741 if (ValueOfResponse(FLD_DRUG_ID, i) = '') then 707 742 begin 708 if not ContainsAlpha(Responses.IValueFor('INSTR', i)) then SetError(TX_DOSE_NUM); 709 if Length(Responses.IValueFor('INSTR', i)) > 60 then SetError(TX_DOSE_LEN); 743 if not ContainsAlpha(Responses.IValueFor('INSTR', i)) then 744 begin 745 SetError(TX_DOSE_NUM); 746 if tabDose.TabIndex = TI_DOSE then 747 cboDosage.SetFocus; //CQ: 7467 748 end; 749 if Length(Responses.IValueFor('INSTR', i)) > 60 then 750 begin 751 SetError(TX_DOSE_LEN); 752 cboDosage.SetFocus; //CQ: 7467 753 end; 710 754 end; 711 755 ValidateRoute(Responses.EValueFor('ROUTE', i), Responses.IValueFor('ROUTE', i) = '', i); … … 713 757 i := Responses.NextInstance('INSTR', i); 714 758 end; 759 //AGP Change 26.45 Fix for then/and conjucntion PSI-04-069 760 if self.tabDose.TabIndex = 1 then 761 begin 762 for i := 2 to self.grdDoses.RowCount do 763 begin 764 if ((ValFor(COL_DOSAGE, i-1) <> '') and (ValFor(COL_DOSAGE, i) <> '')) and (ValFor(COL_SEQUENCE,i-1) = '') then 765 begin 766 SetError(TX_NO_SEQ); 767 Exit; 768 end; 769 end; 770 end; 715 771 if not FInptDlg then // outpatient stuff 716 772 begin … … 953 1009 UniqueText := False; 954 1010 FFromSelf := True; 1011 {AutoSelection is only based upon uniquely matching characters. 1012 Several CQs have been resolved relating to this issue: 1013 See CQ: 1014 7326 - Auto complete does not work correctly if user has quick orders in Medication list 1015 7328 - PSI-05-016: TAM-0205-31170 Med Error due to pre-populated med screen 1016 6715 PSI-04-044 Orders: NJH-0804-20315 Physician unable to enter medication order 1017 } 955 1018 if UniqueText then 956 1019 begin … … 1129 1192 QOQuantityStr := ''; 1130 1193 btnSelect.SetFocus; // let the exit events finish 1194 1131 1195 if pnlMeds.Visible then // display the medication fields 1132 1196 begin … … 1294 1358 lblQtyMsg.Caption := ''; 1295 1359 lblQuantity.Caption := 'Quantity'; 1360 FSmplPRNChkd := chkPRN.Checked; // GE CQ7585 1296 1361 chkPRN.Checked := False; 1297 1362 FLastUnits := ''; … … 1318 1383 QOPiUnChk := False; 1319 1384 PKIEnviron := False; 1320 if GetPKISite and GetPKIUse then //PKI check for crypto object on workstation 1321 begin 1322 try //PKI object creation 1323 crypto := CoXuDigSigS.Create; 1324 crypto.GetCSP; 1325 StatusText(crypto.Reason); 1326 PKIEnviron := True; 1327 except 1328 on E: Exception do 1329 begin 1330 {ShowMessage('An error has been encountered while trying to create PKI environment: '+ E.Message + 1331 '. This order will be processed without Digital Signature encryption.');} 1332 PKIEnviron := False; 1333 end; 1334 end; 1335 crypto := nil; 1336 end; 1337 if PKIEnviron = False then 1338 if GetPKISite then PKIEnviron := True; 1385 if GetPKISite then PKIEnviron := True; 1339 1386 with CtrlInits do 1340 1387 begin … … 1381 1428 end; 1382 1429 pnlTop.Height := pnlFields.Height - pnlBottom.Height; 1383 chkDoseNow.Top := memComment.Top + memComment.Height + 4;1430 chkDoseNow.Top := memComment.Top + memComment.Height + 1; 1384 1431 lblPriority.Top := memcomment.Top + memComment.Height + 1; 1385 1432 cboPriority.Top := lblPriority.Top + lblPriority.Height; 1386 1433 lblAdminTime.Left := chkDoseNow.Left; 1387 lblAdminTime.Top := chkDoseNow.Top + chkDoseNow.Height +1;1434 lblAdminTime.Top := chkDoseNow.Top + chkDoseNow.Height - 1; 1388 1435 end else 1389 1436 begin … … 1456 1503 SetDosage(IValueFor('INSTR', i)); 1457 1504 with cboDosage do 1458 if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex] else x := Text; 1505 if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex] 1506 else x := IValueFor('INSTR',i); //AGP Change 26.41 for CQ 9102 PSI-05-015 affect copy and edit functionality 1459 1507 grdDoses.Cells[COL_DOSAGE, i] := x; 1460 1508 SetControl(cboRoute, 'ROUTE', i); … … 1474 1522 if ItemIndex > -1 then x := x + TAB + Items[ItemIndex]; 1475 1523 grdDoses.Cells[COL_SCHEDULE, i] := x; 1524 if chkPRN.Checked = True then grdDoses.Cells[COL_CHKXPRN,i] := '1'; 1476 1525 grdDoses.Cells[COL_DURATION, i] := IValueFor('DAYS', i); 1477 1526 if IValueFor('CONJ', i) = 'A' then x := 'AND' … … 1597 1646 txtMed.SetFocus; 1598 1647 FDrugID := ''; 1599 ShowOrderMessage( False );1648 //ShowOrderMessage( False ); 1600 1649 end; 1601 1650 … … 1628 1677 1629 1678 procedure TfrmODMeds.ShowControlsSimple; 1630 var1631 dosagetxt: string;1679 //var 1680 //dosagetxt: string; 1632 1681 begin 1633 1682 //Commented out, no longer using CharsNeedMatch Property … … 1661 1710 procedure TfrmODMeds.ShowControlsComplex; 1662 1711 1663 procedure MoveCombo(SrcCombo, DestCombo: TORComboBox); 1664 begin 1665 DestCombo.Items.Clear; 1666 DestCombo.Items.Assign(SrcCombo.Items); 1667 DestCombo.ItemIndex := SrcCombo.ItemIndex; 1668 DestCombo.Text := Piece(SrcCombo.Text, TAB, 1); 1669 end; 1670 1671 var 1672 dosagetxt: string; 1712 procedure MoveCombo(SrcCombo, DestCombo: TORComboBox; CompSch: boolean = false); //AGP Changes 26.12 PSI-04-63 1713 var 1714 cnt,i,index: integer; 1715 node,text: string; 1716 begin 1717 if (CompSch = false) or not (FInptDlg)then 1718 begin 1719 DestCombo.Items.Clear; 1720 DestCombo.Items.Assign(SrcCombo.Items); 1721 DestCombo.ItemIndex := SrcCombo.ItemIndex; 1722 DestCombo.Text := Piece(SrcCombo.Text, TAB, 1); 1723 end; 1724 if (CompSch = true) and (FInptDlg) then // AGP Changes 26.12 PSI-04-63 1725 begin 1726 //AGP change 26.34 CQ 7201,6902 fix the problem with one time schedule still showing for inpatient complex orders 1727 DestCombo.ItemIndex := -1; 1728 Text := SrcCombo.Text; 1729 index := SrcCombo.ItemIndex; 1730 cnt := 0; 1731 for i := 0 to SrcCombo.Items.Count - 1 do 1732 begin 1733 node := SrcCombo.Items.Strings[i]; 1734 if piece(node,U,3) <> 'O' then 1735 begin 1736 DestCombo.Items.Add(SrcCombo.Items.Strings[i]); 1737 if Piece(node,U,1) = text then DestCombo.ItemIndex := index - cnt; 1738 end 1739 else cnt := cnt+1; 1740 end; 1741 end; 1742 end; 1743 1744 //var 1745 //dosagetxt: string; 1673 1746 begin 1674 1747 tabDose.TabIndex := TI_COMPLEX; 1675 1748 MoveCombo(cboDosage, cboXDosage); 1676 1749 MoveCombo(cboRoute, cboXRoute); 1677 MoveCombo(cboSchedule, cboXSchedule );1750 MoveCombo(cboSchedule, cboXSchedule, true); //AGP Changes 26.12 PSI-04-063 1678 1751 grdDoses.Visible := True; 1679 1752 btnXInsert.Visible := True; … … 1689 1762 ActiveControl := grdDoses; 1690 1763 //Commented out, no longer using CharsNeedMatch Property 1691 {NumCharsForMatch := 0;1764 { NumCharsForMatch := 0; 1692 1765 for i := 0 to cboXDosage.Items.Count - 1 do //find the shortest unit dose text on fifth piece 1693 1766 begin … … 1719 1792 Break; 1720 1793 end; 1721 if ((DoseIndex < 0) and (not IsTransferAction)) then Text := x 1722 else if ((DoseIndex < 0) and IsTransferAction) then Text := '' 1794 if DoseIndex <0 then Text := x 1795 (* if ((DoseIndex < 0) and (not IsTransferAction)) then Text := x 1796 else if ((DoseIndex < 0) and IsTransferAction) and (DosageTab = False) then Text := '' 1797 else if ((DoseIndex < 0) and IsTransferAction) and (DosageTab = True) then Text := x *) 1723 1798 else ItemIndex := DoseIndex; 1724 1799 end; … … 1740 1815 procedure TfrmODMeds.SetSchedule(const x: string); 1741 1816 var 1742 1817 NonPRNPart: string; 1743 1818 begin 1744 1819 cboSchedule.ItemIndex := -1; 1745 if Pos('PRN', x) > 0 then 1820 //AGP change CQ 10593, remove code to match the new expected first dose code 1821 //PSI-05-026 1822 (* if Pos('PRN', x) > 0 then 1746 1823 begin 1747 1824 NonPRNPart := Trim(Copy(x, 1, Pos('PRN', x) - 1)); … … 1762 1839 chkPRN.Checked := True; 1763 1840 end else 1764 begin 1841 begin *) 1765 1842 chkPRN.Checked := False; 1766 1843 cboSchedule.SelectByID(x); … … 1773 1850 else 1774 1851 begin 1775 cboSchedule.Items.Add(x); 1776 cboSchedule.Text := x; 1777 cboSchedule.SelectByID(x); 1852 if Pos('PRN', x) > 0 then 1853 begin 1854 NonPRNPart := Trim(Copy(x, 1, Pos('PRN', x) - 1)); 1855 chkPRN.Checked := True; 1856 cboSchedule.SelectByID(NonPRNPart); 1857 if cboSchedule.ItemIndex > -1 then EXIT; 1858 cboSchedule.Items.Add(NonPRNPart); 1859 cboSchedule.Text := NonPRNPart; 1860 cboSchedule.SelectByID(NonPRNPart); 1861 EXIT; 1862 end; 1863 cboSchedule.Items.Add(x); 1864 cboSchedule.Text := x; 1865 cboSchedule.SelectByID(x); 1778 1866 end; 1779 end;1780 1867 end; 1781 1868 end; 1782 1869 1783 1870 { Medication edit --------------------------------------------------------------------------- } 1784 1785 1871 procedure TfrmODMeds.tabDoseChange(Sender: TObject); 1786 1872 var 1787 x: string; 1788 1789 begin 1790 inherited; 1873 //text,x, tmpsch: string; 1874 text, x: string; 1875 reset: integer; 1876 begin 1877 inherited; 1878 reset := 0; 1879 //AGP change for CQ 6521 added warning message 1880 //AGP Change for CQ 7508 added tab information 1881 //GE Change warning message functionality show only cq 7590 1882 // when tab changes from complex to simple. 1883 //AGP Change for CQ 7834 and 7832 change text and added check to see if some values have been completed in row 1 1884 if (tabDose.TabIndex = 0) and ((ValFor(COL_DOSAGE, 1)<>'') or (ValFor(COL_SCHEDULE, 1)<>'') or (ValFor(COL_DURATION, 1)<>'') or 1885 (ValFor(COL_SEQUENCE, 1)<>'')) then 1886 begin 1887 text := 'By switching to the Dosage Tab, ' ; 1888 if (InfoBox(text +'you will lose all data on this screen. Click OK to continue or Cancel','Warning',MB_OKCANCEL)=IDCANCEL) then 1889 begin 1890 if tabDose.TabIndex = 1 then tabDose.TabIndex := 0 1891 else tabDose.TabIndex := 1; 1892 reset := 1; 1893 end; 1894 end; 1791 1895 case tabDose.TabIndex of 1792 1896 TI_DOSE: begin 1897 cboXSchedule.Clear; // Added to Fix CQ: 9603 1793 1898 // clean up responses? 1794 1899 FSuppressMsg := FOrigiMsgDisp; 1795 1900 ShowControlsSimple; 1796 ResetOnTabChange; 1901 if reset = 0 then ResetOnTabChange; 1902 txtNss.Left := lblSchedule.Left + lblSchedule.Width + 2; 1797 1903 if (FInptDlg) then txtNss.Visible := True 1798 1904 else txtNss.Visible := False; … … 1805 1911 TI_COMPLEX: begin 1806 1912 FSuppressMsg := FOrigiMsgDisp; 1913 if reset = 1 then exit; 1807 1914 ShowControlsComplex; 1808 1915 ResetOnTabChange; 1916 txtNss.Left := grdDoses.Left + grdDoses.ColWidths[0] + grdDoses.ColWidths[1] + grdDoses.ColWidths[2] + 3; 1809 1917 txtNss.Visible := False; 1810 if txtNss.Visible then txtNss.Visible := False;1811 1918 x := cboXDosage.Text + TAB; 1812 1919 with cboXDosage do if ItemIndex > -1 then x := x + Items[ItemIndex]; … … 1818 1925 with cboXSchedule do if ItemIndex > -1 then x := x + Items[ItemIndex]; 1819 1926 grdDoses.Cells[COL_SCHEDULE, 1] := x; 1927 UpdateStartExpires(ValFor(VAL_SCHEDULE,1)); 1820 1928 ControlChange(Self); 1821 1929 end; {TI_COMPLEX} 1822 1930 end; {case} 1823 1931 end; 1932 1824 1933 1825 1934 procedure TfrmODMeds.lblGuidelineClick(Sender: TObject); … … 1901 2010 1902 2011 procedure TfrmODMeds.cboDosageChange(Sender: TObject); 1903 var 1904 tmpIdx: integer; 1905 tmpTxt,tmpTxt1: string; 1906 begin 1907 inherited; 1908 //if length(cboDosage.Text) < 1 then 1909 // cboDosage.ItemIndex := -1; 2012 begin 2013 inherited; 1910 2014 UpdateRelated; 1911 2015 end; … … 1946 2050 begin 1947 2051 inherited; 1948 //if cboRoute.Text = '' then1949 // cboRoute.ItemIndex := -1;1950 2052 with cboRoute do 1951 2053 if ItemIndex > -1 then … … 1994 2096 begin 1995 2097 inherited; 1996 if (FInptDlg) and (cboSchedule.Text = 'OTHER') then2098 if (FInptDlg) and (cboSchedule.Text = 'OTHER') then 1997 2099 begin 1998 2100 othSch := CreateOtherScheduel; … … 2004 2106 end; 2005 2107 end; 2006 //if cboSchedule.Text = '' then2007 // cboSchedule.ItemIndex := -1;2008 2108 //Remove Deletion of Text, since we are changing the validation to be on exit of the control. 2009 2109 { if (Length(cboSchedule.Text)>0) and (cboSchedule.ItemIndex < 0) and FInptDlg then … … 2116 2216 if Length(Route) = 0 then Route := ValueOf(FLD_ROUTE_NM); 2117 2217 Schedule := ValueOf(FLD_SCHED_EX); 2118 if Length(Schedule) = 0 then Schedule := ValueOf(FLD_SCHEDULE); 2218 (* Schedule := Piece(Temp,U,1); 2219 if Piece(Temp,U,3) = '1' then Schedule := Schedule + ' AS NEEDED'; 2220 if UpperCase(Copy(Schedule, Length(Schedule) - 18, Length(Schedule))) = 'AS NEEDED AS NEEDED' 2221 then Schedule := Copy(Schedule, 1, Length(Schedule) - 10); *) 2222 if Length(Schedule) = 0 then 2223 begin 2224 Schedule := ValueOf(FLD_SCHEDULE); 2225 if RightStr(Schedule,3) = 'PRN' then 2226 begin 2227 Schedule := Copy(Schedule,1,Length(Schedule)-3); //Remove the Trailing PRN 2228 if (RightStr(Schedule,1) = ' ') or (RightStr(Schedule,1) = '-') then 2229 Schedule := Copy(Schedule,1,Length(Schedule)-1); 2230 Schedule := Schedule + ' AS NEEDED' 2231 end; 2232 end; 2119 2233 Result := FSIGVerb + ' ' + Dose + ' ' + Route + ' ' + Schedule; 2120 2234 end; … … 2140 2254 if Length(Route) = 0 then Route := ValueOf(FLD_ROUTE_NM, i); 2141 2255 Schedule := ValueOf(FLD_SCHED_EX, i); 2142 if Length(Schedule) = 0 then Schedule := ValueOf(FLD_SCHEDULE, i); 2256 //if Length(Schedule) = 0 then Schedule := ValueOf(FLD_SCHEDULE, i); 2257 if Length(Schedule) = 0 then 2258 begin 2259 Schedule := ValueOf(FLD_SCHEDULE); 2260 if RightStr(Schedule,3) = 'PRN' then 2261 begin 2262 Schedule := Copy(Schedule,1,Length(Schedule)-3); //Remove the Trailing PRN 2263 if (RightStr(Schedule,1) = ' ') or (RightStr(Schedule,1) = '-') then 2264 Schedule := Copy(Schedule,1,Length(Schedule)-1); 2265 Schedule := Schedule + ' AS NEEDED' 2266 end; 2267 end; 2143 2268 Duration := ValueOf(FLD_DURATION, i); 2144 2269 if Length(Duration) > 0 then Duration := 'FOR ' + Duration; … … 2241 2366 begin 2242 2367 Result := Piece(Piece(grdDoses.Cells[COL_DOSAGE, ARow], TAB, 2), U, 4); 2243 if (not FInptDlg) and (Length(FDrugID) > 0) then 2368 //AGP CHANGE 26.33 change for Remedy ticket 87476 fix for quick orders for complex 2369 //inpatient orders not displaying the correct unit dose in Pharmacy 2370 //if (not FInptDlg) and (Length(FDrugID) > 0) then 2371 if Length(FDrugID) > 0 then 2244 2372 begin 2245 2373 Result := ''; … … 2454 2582 TI_COMPLEX: 2455 2583 begin 2456 if txtNss.Visible then txtNss.Visible := False;2584 //if txtNss.Visible then txtNss.Visible := False; 2457 2585 with grdDoses do for i := 1 to Pred(RowCount) do 2458 2586 begin … … 2491 2619 else Responses.Update('ROUTE', i, '', x); 2492 2620 x := ValueOf(FLD_SCHEDULE, i); Responses.Update('SCHEDULE', i, x, x); 2621 if FSmplPRNChkd then // GE CQ7585 Carry PRN checked from simple to complex tab 2622 begin 2623 pnlXSchedule.Tag := 1; 2624 chkXPRN.Checked := True; 2625 //cboXScheduleClick(Self);// force onclick to fire when complex tab is entered 2626 FSmplPRNChkd := False; 2627 end; 2493 2628 x := ValueOf(FLD_DURATION, i); Responses.Update('DAYS', i, UpperCase(x), x); 2494 2629 x := ValueOf(FLD_SEQUENCE, i); … … 2508 2643 begin 2509 2644 Responses.Update('NOW', 1, ValueOf(FLD_NOW_ID), ValueOf(FLD_NOW_NM)); 2510 x := InpatientSig; Responses.Update('SIG', 1, TX_WPTYPE, x); 2645 x := InpatientSig; 2646 Responses.Update('SIG', 1, TX_WPTYPE, x); 2511 2647 end else // outpatient orders 2512 2648 begin … … 2548 2684 VAL_DURATION : Result := Piece(Cells[COL_DURATION, ARow], TAB, 1); 2549 2685 VAL_SEQUENCE : Result := Piece(Cells[COL_SEQUENCE, ARow], TAB, 1); 2686 VAL_CHKXPRN : Result := Cells[COL_CHKXPRN, ARow]; 2550 2687 end; 2551 2688 end; … … 2729 2866 procedure TfrmODMeds.ShowEditor(ACol, ARow: Integer; AChar: Char); 2730 2867 var 2731 x, NonPRNPart: string;2868 x,tmpText: string; 2732 2869 2733 2870 procedure PlaceControl(AControl: TWinControl); … … 2759 2896 begin 2760 2897 inherited; 2898 txtNSS.Visible := False; 2761 2899 //Make space just select editor. This blows up as soon as some joker makes a 2762 2900 //dosage starting with a space. … … 2784 2922 //grdDoses.Cells[COL_SCHEDULE, ARow] := grdDoses.Cells[COL_SCHEDULE, Pred(ARow)]; 2785 2923 end; 2786 if grdDoses.Cells[COL_SEQUENCE, Pred(ARow)] = '' then 2924 //AGP Change 26.45 remove auto-populate of the sequence field 2925 {* if grdDoses.Cells[COL_SEQUENCE, Pred(ARow)] = '' then 2787 2926 begin 2788 2927 if StrToIntDef(Piece(grdDoses.Cells[COL_DURATION, Pred(ARow)], ' ', 1), 0) > 0 2789 2928 then grdDoses.Cells[COL_SEQUENCE, Pred(ARow)] := 'THEN' 2790 2929 else grdDoses.Cells[COL_SEQUENCE, Pred(ARow)] := 'AND'; 2791 end; 2930 end; *} 2792 2931 end; 2793 2932 // set appropriate value for cboDosage … … 2806 2945 COL_SCHEDULE: begin 2807 2946 // set appropriate value for cboSchedule 2947 if FInptDlg then txtNSS.Visible := True; 2808 2948 x := Piece(grdDoses.Cells[COL_SCHEDULE, ARow], TAB, 1); 2809 2949 Changing := TRUE; 2810 chkXPRN.Checked := False; 2950 if ValFor(VAL_CHKXPRN,Arow)='1' then chkXPRN.Checked := true 2951 else chkXPRN.Checked := False; 2952 if Pos('PRN',x)>0 then 2953 begin 2954 cboXSchedule.SelectByID(x); 2955 if cboXSchedule.ItemIndex <0 then 2956 begin 2957 x := Trim(Copy(x, 1, Pos('PRN', x) - 1)); 2958 chkXPRN.Checked := true; 2959 end; 2960 end; 2811 2961 if Length(x) > 0 then 2812 2962 begin … … 2815 2965 end 2816 2966 else cboXSchedule.ItemIndex := -1; 2817 if Pos('PRN', x) > 0 then2967 (* if Pos('PRN', x) > 0 then 2818 2968 begin 2819 2969 NonPRNPart := Trim(Copy(x, 1, Pos('PRN', x) - 1)); … … 2825 2975 if cboXSchedule.ItemIndex < 0 then cboXSchedule.Text := x; 2826 2976 end; 2827 end; 2977 end; *) 2828 2978 Changing := FALSE; 2829 2979 pnlXSequence.Tag := ARow; … … 2844 2994 btnXDuration.Caption := 'days'; 2845 2995 end; 2996 tmpText := txtXDuration.Text; //Fix for CQ: 8107 - Kloogy but works. 2846 2997 UpdateDurationControls(False); 2847 2848 2998 Changing := FALSE; 2849 2999 pnlXDuration.Tag := ARow; 2850 3000 PlaceControl(pnlXDuration); 2851 3001 txtXDuration.SetFocus; 3002 ARow1 := ARow; 3003 txtXDuration.Text := tmpText; //Fix for CQ: 8107 - Kloogy but works. 2852 3004 if AChar <> #0 then PostMessage(Handle, UM_DELAYEVENT, Ord(AChar), COL_DURATION); 2853 3005 end; 2854 3006 COL_SEQUENCE: begin 2855 3007 x := ValFor(COL_SEQUENCE, ARow); 2856 if x = '' then x := 'then';3008 //if x = '' then x := 'and'; AGP Change 26.46 remove for CQ 9535 2857 3009 btnXSequence.Caption := x; 2858 3010 pnlXSequence.Caption := btnXSequence.Caption; 2859 3011 pnlXSequence.Tag := ARow; 3012 ARow1 := ARow; 2860 3013 PlaceControl(pnlXSequence); 2861 btnXSequence.Width := pnlXSequence.Width; 3014 btnXSequence.Width := pnlXSequence.Width; 2862 3015 end; 2863 3016 end; {case ACol} … … 2929 3082 then lblQtyMsg.Caption := TX_QTY_PRE + x + TX_QTY_POST 2930 3083 else lblQtyMsg.Caption := ''; 2931 2932 3084 end; 2933 3085 … … 2985 3137 cboXRoute.ItemIndex := -1; 2986 3138 Exit; 2987 end; 3139 end; 2988 3140 cboXRouteClick(Self); 2989 3141 cboXRoute.Tag := -1; … … 3013 3165 procedure TfrmODMeds.cboXScheduleChange(Sender: TObject); 3014 3166 var 3015 othSch, x , PRN: string;3167 othSch, x: string; 3016 3168 idx : integer; 3017 3169 begin … … 3031 3183 end; 3032 3184 end; 3033 3185 (* if chkXPRN.Checked then PRN := ' PRN' else PRN := ''; 3034 3186 with cboXSchedule do if ItemIndex > -1 3035 3187 then x := Text + PRN + TAB + Items[ItemIndex] 3036 else x := Text + PRN; 3188 else x := Text + PRN; *) 3189 with cboXSchedule do if ItemIndex > -1 3190 then x := Text + TAB + Items[ItemIndex] 3191 else x := Text; 3037 3192 grdDoses.Cells[COL_SCHEDULE, pnlXSchedule.Tag] := x; 3193 self.cboSchedule.Text := x; 3038 3194 UpdateRelated; 3039 3195 end; … … 3042 3198 procedure TfrmODMeds.cboXScheduleClick(Sender: TObject); 3043 3199 var 3044 x, PRN: string; 3045 begin 3046 inherited; 3047 if chkXPRN.Checked then PRN := ' PRN' else PRN := ''; 3200 x: string; 3201 begin 3202 inherited; 3203 //if chkXPRN.Checked then PRN := ' PRN' else PRN := ''; 3204 (* with cboXSchedule do if ItemIndex > -1 3205 then x := Text + PRN + TAB + Items[ItemIndex] 3206 else x := Text + PRN; *) 3048 3207 with cboXSchedule do if ItemIndex > -1 3049 then x := Text + PRN +TAB + Items[ItemIndex]3050 else x := Text + PRN;3051 if (Pos('PRN',X)>0) and (pnlXSchedule.Tag = 1) then3208 then x := Text + TAB + Items[ItemIndex] 3209 else x := Text; 3210 (* if (Pos('PRN',X)>0) and (pnlXSchedule.Tag = 1) then 3052 3211 if lblAdmintime.visible then 3053 lblAdmintime.Caption := ''; 3212 lblAdmintime.Caption := ''; *) 3054 3213 grdDoses.Cells[COL_SCHEDULE, pnlXSchedule.Tag] := x; 3214 UpdateStartExpires(x); 3055 3215 UpdateRelated; 3056 3216 end; 3057 3217 3058 3218 procedure TfrmODMeds.chkXPRNClick(Sender: TObject); 3059 begin 3060 inherited; 3219 var 3220 check: string; 3221 begin 3222 inherited; 3223 if self.chkXPRN.Checked = True then check := '1' 3224 else check := '0'; 3225 self.grdDoses.Cells[COL_CHKXPRN, self.grdDoses.Row] := check; 3061 3226 if not Changing then cboXScheduleClick(Self); 3062 3227 end; … … 3096 3261 var 3097 3262 I, Code: Integer; 3263 OrgValue: string; 3098 3264 begin 3099 3265 inherited; … … 3103 3269 Val(txtXDuration.Text, I, Code); 3104 3270 UpdateDurationControls(Code <> 0); 3105 if (Code <> 0) and (I=0) then 3106 begin 3107 ShowMessage('Free text input is not allowed!'); 3108 txtXDuration.Text := '0'; 3271 //Commented out the "and" to resolve CQ: 7557 3272 if (Code <> 0) {and (I=0)} then 3273 begin 3274 ShowMessage('Please use numeric characters only.'); 3275 with txtXDuration do 3276 begin 3277 Text := IntToStr(I); 3278 SelStart := Length(Text); 3279 end; 3109 3280 Exit; 3110 3281 btnXDuration.Width := 8; … … 3114 3285 PopDuration.Items.Tag := 0; 3115 3286 btnXDuration.Caption := ''; 3116 end 3287 end; 3288 {AGP change 26.19 for PSI-05-018 cq #7322 3117 3289 else if PopDuration.Items.Tag = 0 then 3118 3290 begin 3119 3291 PopDuration.Items.Tag := 3; //Days selection 3120 3292 btnXDuration.Caption := 'days'; 3121 end; 3293 end; } 3122 3294 grdDoses.Cells[COL_DURATION, pnlXDuration.Tag] := txtXDuration.Text + ' ' + Uppercase(btnXDuration.Caption); 3123 end else grdDoses.Cells[COL_DURATION, pnlXDuration.Tag] := ''; 3295 end else //AGP CHANGE ORDER 3296 begin 3297 if not(FInptDlg) then grdDoses.Cells[COL_DURATION, pnlXDuration.Tag] := ''; 3298 OrgValue := ValFor(COL_DURATION, pnlxDuration.tag); 3299 //if ((txtXDuration.Text = '0') or (txtXDuration.Text = '')) and ((ValFor(COL_SEQUENCE, ARow1) = 'THEN') and (FInptDlg)) then //AGP CHANGE ORDER 3300 //AGP change 26.33 Then/And conjunction requiring a duration to include outpatient orders also 3301 if ((txtXDuration.Text = '0') or (txtXDuration.Text = '')) and (ValFor(COL_SEQUENCE, ARow1) = 'THEN') then //AGP CHANGE ORDER 3302 begin 3303 if (InfoBox('A duration is required when using "Then" as a sequence.'+CRLF+'"Then" will be remove from the sequence field if you continue'+ 3304 CRLF+'Click "OK" to continue or click "Cancel"','Duration Warning', MB_OKCANCEL)=1) then 3305 begin 3306 grdDoses.Cells[COL_DURATION, pnlXDuration.Tag] := ''; 3307 pnlXSequence.Tag := ARow1; 3308 pnlXSequence.Caption := ''; 3309 grdDoses.Cells[COL_SEQUENCE, pnlXSequence.Tag] := ''; 3310 btnXSequence.Click; 3311 end 3312 else 3313 grdDoses.Cells[COL_DURATION, pnlXDuration.Tag] := OrgValue; 3314 end 3315 else grdDoses.Cells[COL_DURATION, pnlXDuration.Tag] := txtXDuration.Text; 3316 end; 3317 // end; 3124 3318 ControlChange(Self); 3125 3319 UpdateRelated; … … 3151 3345 begin 3152 3346 inherited; 3347 inherited; 3153 3348 with TSpeedButton(Sender) do APoint := ClientToScreen(Point(0, Height)); 3154 3349 popXSequence.Popup(APoint.X, APoint.Y); 3155 3350 pnlXSequence.Caption := btnXSequence.Caption; 3351 { 3352 with TSpeedButton(Sender) do APoint := ClientToScreen(Point(0, Height)); 3353 popXSequence.Popup(APoint.X, APoint.Y); 3354 pnlXSequence.Caption := btnXSequence.Caption; 3355 if (pnlXSequence.Caption = 'then') and 3356 ((ValFor(COL_DURATION, ARow1) = '') or 3357 (ValFor(COL_DURATION, ARow1) = '0')) then 3358 begin 3359 InfoBox('A duration is required when using "Then" as a conjunction','Duration Warning',MB_OK); 3360 pnlXSequence.Caption := ''; 3361 btnXSequence.Caption := ''; 3362 end; 3363 } 3156 3364 end; 3157 3365 … … 3162 3370 inherited; 3163 3371 with TMenuItem(Sender) do if Tag > 0 then x := Caption else x := ''; 3372 //AGP Changes 26.12 PSI-04-63 3373 //if ((x = 'then') and (FInptDlg)) and ((ValFor(COL_DURATION, ARow1) = '') or (ValFor(COL_DURATION, ARow1) = '0')) then 3374 //AGP change 26.32 Then/And conjunction requiring a duration to include outpatient orders 3375 if (x = 'then') and ((ValFor(COL_DURATION, ARow1) = '') or (ValFor(COL_DURATION, ARow1) = '0')) then 3376 begin 3377 InfoBox('A duration is required when using "Then" as a conjunction' + CRLF + CRLF+ 3378 'The patient will be instructed to take these doses consecutively, not concurrently.','Duration Warning',MB_OK); 3379 x := ''; 3380 end; 3164 3381 btnXSequence.Caption := x; 3165 3382 pnlXSequence.Caption := btnXSequence.Caption; … … 3279 3496 FLD_ROUTE_EX : with cboRoute do 3280 3497 if ItemIndex > -1 then Result := Piece(Items[ItemIndex], U, 4); 3281 FLD_SCHEDULE : begin 3498 FLD_SCHEDULE : begin //gary) 3282 3499 Result := UpperCase(Trim(cboSchedule.Text)); 3283 3500 if chkPRN.Checked then Result := Result + ' PRN'; … … 3287 3504 FLD_SCHED_EX : begin 3288 3505 with cboSchedule do 3506 begin 3289 3507 if ItemIndex > -1 then Result := Piece(Items[ItemIndex], U, 2); 3508 (* if (Length(Result)=0) and (ItemIndex > -1) then 3509 begin 3510 Result := Piece(Items[ItemIndex], U, 1); 3511 if Piece(Items[ItemIndex], U, 3) = 'P' then 3512 begin 3513 if RightStr(Result,3) = 'PRN' then 3514 begin 3515 Result := Copy(Result,1,Length(Result)-3); //Remove the Trailing PRN 3516 if (RightStr(Result,1) = ' ') or (RightStr(Result,1) = '-') then 3517 Result := Copy(Result,1,Length(Result)-1); 3518 end; 3519 Result := Result + ' AS NEEDED'; 3520 end; 3521 end; 3522 end; *) 3523 if RightStr(Result,3) = 'PRN' then 3524 begin 3525 Result := Copy(Result,1,Length(Result)-3); //Remove the Trailing PRN 3526 if (RightStr(Result,1) = ' ') or (RightStr(Result,1) = '-') then 3527 Result := Copy(Result,1,Length(Result)-1); 3528 Result := Result + ' AS NEEDED' 3529 end; 3290 3530 if (Length(Result) > 0) and chkPRN.Checked then Result := Result + ' AS NEEDED'; 3291 3531 if UpperCase(Copy(Result, Length(Result) - 18, Length(Result))) = 'AS NEEDED AS NEEDED' 3292 3532 then Result := Copy(Result, 1, Length(Result) - 10); 3533 if UpperCase(Copy(Result, Length(Result) - 12, Length(Result))) = 'PRN AS NEEDED' then 3534 begin 3535 Result := Copy(Result, 1, Length(Result) - 13); 3536 if RightStr(Result,1)=' ' then Result := Result + 'AS NEEDED' 3537 else Result := Result + ' AS NEEDED'; 3538 end; 3539 end; 3293 3540 end; 3294 3541 FLD_SCHED_TYP : with cboSchedule do … … 3330 3577 FLD_ROUTE_AB : Result := Piece(Piece(Cells[COL_ROUTE, ARow], TAB, 2), U, 3); 3331 3578 FLD_ROUTE_EX : Result := Piece(Piece(Cells[COL_ROUTE, ARow], TAB, 2), U, 4); 3332 FLD_SCHEDULE : Result := Piece(Cells[COL_SCHEDULE, ARow], TAB, 1); 3579 FLD_SCHEDULE : begin 3580 Result := Piece(Piece(Cells[COL_SCHEDULE, ARow], TAB, 2), U, 1); 3581 if Result = '' then Result := Piece(Cells[COL_SCHEDULE, ARow], TAB, 1); 3582 if valFor(VAL_CHKXPRN,ARow)='1' then Result := Result + ' PRN'; 3583 if UpperCase(Copy(Result, Length(Result) - 6, Length(Result))) = 'PRN PRN' then 3584 Result := Copy(Result, 1, Length(Result) - 4); 3585 end; 3333 3586 FLD_SCHED_EX : begin 3334 Result := Piece(Piece(Cells[COL_SCHEDULE, ARow], TAB, 2), U, 2);3587 (*Result := Piece(Piece(Cells[COL_SCHEDULE, ARow], TAB, 2), U, 2); 3335 3588 if Result = '' then //Added for CQ: 7639 3336 3589 begin … … 3343 3596 (Pos('PRN', Piece(Cells[COL_SCHEDULE, ARow], TAB, 1)) > 0) 3344 3597 then Result := Result + ' AS NEEDED'; 3598 end;*) 3599 Result := Piece(Piece(Cells[COL_SCHEDULE, ARow], TAB, 2),U,2); 3600 if Result = '' then Result := Piece(Piece(Cells[COL_SCHEDULE, ARow], TAB, 2),U,1); //Added for CQ: 7639 3601 if Result = '' then Result := Piece(Cells[COL_SCHEDULE, ARow], TAB, 1); 3602 if RightStr(Result,3) = 'PRN' then 3603 begin 3604 Result := Copy(Result,1,Length(Result)-3); //Remove the Trailing PRN 3605 if (RightStr(Result,1) = ' ') or (RightStr(Result,1) = '-') then 3606 Result := Copy(Result,1,Length(Result)-1); 3607 Result := Result + ' AS NEEDED'; 3608 end; 3609 if valFor(VAL_CHKXPRN,ARow)='1' then Result := Result + ' AS NEEDED'; 3610 if UpperCase(Copy(Result, Length(Result) - 18, Length(Result))) = 'AS NEEDED AS NEEDED' 3611 then Result := Copy(Result, 1, Length(Result) - 10); 3612 if UpperCase(Copy(Result, Length(Result) - 12, Length(Result))) = 'PRN AS NEEDED' then 3613 begin 3614 Result := Copy(Result, 1, Length(Result) - 13); 3615 if RightStr(Result,1)=' ' then Result := Result + 'AS NEEDED' 3616 else Result := Result + ' AS NEEDED'; 3617 end; 3345 3618 end; 3346 3619 FLD_SCHED_TYP : Result := Piece(Piece(Cells[COL_SCHEDULE, ARow], TAB, 2), U, 3); … … 3552 3825 procedure TfrmODMeds.UpdateStartExpires(const CurSchedule: string); 3553 3826 var 3554 ShowText, Duration, ASchedule: string;3827 CompSch, ShowText, Duration, ASchedule: string; 3555 3828 AdminTime: TFMDateTime; 3556 Interval, PrnPos: Integer;3829 i, j, Interval, PrnPos: Integer; 3557 3830 begin 3558 3831 if Length(CurSchedule)=0 then Exit; 3559 3832 ASchedule := Trim(CurSchedule); 3560 if (Pos('^',ASchedule)=0) then 3561 begin 3562 PrnPos := Pos('PRN',ASchedule); 3563 if (PrnPos > 1) and (CharAt(ASchedule,PrnPos-1) <> ';') then 3564 Delete(ASchedule, PrnPos, Length(ASchedule)); 3565 end 3566 else if (Pos('^',ASchedule)>0) then 3833 if (Pos('^',ASchedule)>0) then 3567 3834 begin 3568 3835 PrnPos := Pos('PRN',ASchedule); … … 3571 3838 end; 3572 3839 ASchedule := Trim(ASchedule); 3840 if self.tabDose.TabIndex = TI_COMPLEX then 3841 begin 3842 CompSch := valFor(VAL_SCHEDULE,1); 3843 if CompSch = '' then 3844 begin 3845 ASchedule := ''; 3846 AdminTime := -1; 3847 end; 3848 if CompSch <> '' then 3849 begin 3850 for i := 0 to self.cboXSchedule.Items.Count-1 do 3851 begin 3852 if (Piece(self.cboXSchedule.Items.Strings[i],U,1) = CompSch) and (Piece(self.cboXSchedule.Items.Strings[i],U,3)='P') then 3853 begin 3854 AdminTime := -1; 3855 Aschedule := ''; 3856 end; 3857 end; 3858 end; 3859 if valFor(VAL_CHKXPRN,1)='1' then 3860 begin 3861 AdminTime := -1; 3862 Aschedule := ''; 3863 end; 3864 if (ASchedule <> '') and (CompSch <> '') then ASchedule := ';' + CompSch; 3865 end; 3573 3866 if Length(ASchedule)>0 then 3574 LoadAdminInfo(ASchedule, txtMed.Tag, ShowText, AdminTime, Duration) 3575 else Exit; 3867 LoadAdminInfo(ASchedule, txtMed.Tag, ShowText, AdminTime, Duration); 3868 //else Exit; 3869 if (AdminTime > 0) and (self.tabDose.TabIndex = TI_DOSE) then 3870 begin 3871 if self.cboSchedule.ItemIndex = -1 then 3872 begin 3873 for j := 0 to self.cboSchedule.items.Count -1 do 3874 begin 3875 if (Piece(self.cboSchedule.Items.Strings[j],U,1) = Piece(Aschedule,';',2)) and (Piece(self.cboSchedule.Items.Strings[j],U,3)='P') then 3876 begin 3877 AdminTime := -1; 3878 break; 3879 end; 3880 end; 3881 end; 3882 if (self.cboSchedule.ItemIndex > -1) and (Piece(self.cboSchedule.Items.Strings[self.cboSchedule.ItemIndex],U,3)='P') then 3883 AdminTime := -1; 3884 if self.chkPRN.Checked = true then AdminTime := -1 3885 end; 3576 3886 if AdminTime > 0 then 3577 3887 begin … … 3630 3940 CurSupply, i, pNum, j: Integer; 3631 3941 CurQuantity: double; 3632 LackQtyInfo, SaveChanging : Boolean;3942 LackQtyInfo, SaveChanging, DispFirstDose: Boolean; 3633 3943 begin 3634 3944 inherited; … … 3637 3947 SaveChanging := Changing; 3638 3948 Changing := TRUE; 3949 DispFirstDose := FALSE; 3639 3950 // don't allow Exit procedure so Changing gets reset appropriately 3640 3951 CurUnits := ''; … … 3700 4011 or ((Length(cboSchedule.Text)>0) and (cboSchedule.ItemIndex < 0)) then 3701 4012 begin 3702 if (chkDoseNow.Checked) and (chkDoseNow.Visible) then 4013 if (chkDoseNow.Checked) and (chkDoseNow.Visible) then 4014 begin 4015 chkDoseNowClick(Self); 4016 chkDoseNow.Checked := False; 4017 end; 4018 for i := 0 to cboSchedule.Items.Count-1 do 3703 4019 begin 3704 chkDoseNowClick(Self); 3705 chkDoseNow.Checked := False; 4020 if Piece(cboSchedule.Items.Strings[i],U,1) = Uppercase(cboSchedule.Text) then 4021 begin 4022 DispFirstDose := True; 4023 break; 4024 end; 3706 4025 end; 3707 chkDoseNow.Visible := False; 3708 lblAdminTime.Visible := False; 4026 if not DispFirstDose then 4027 begin 4028 chkDoseNow.Visible := False; 4029 lblAdminTime.Visible := False; 4030 end; 3709 4031 end 3710 4032 else … … 3715 4037 if Responses.EventType in ['A','D','T','M','O'] then lblAdminTime.Visible := False; 3716 4038 end; 3717 if not FInptDlg then4039 if not FInptDlg then 3718 4040 begin 3719 4041 CurSchedule := CurScheduleOut; 3720 if CurInstruct <> FLastInstruct4042 if (CurInstruct <> FLastInstruct) and (CurUnits <> U) //AGP Change 26.48 Do not update quantity and day supply if no matching dose on the server 3721 4043 then UpdateDefaultSupply(CurUnits, CurSchedule, CurDuration, CurDispDrug, CurSupply, CurQuantity, 3722 4044 LackQtyInfo); … … 3751 4073 3752 4074 procedure TfrmODMeds.cmdAcceptClick(Sender: TObject); 3753 begin 3754 if (cboSchedule.Text = 'OTHER') and (FInptDlg)then 4075 var 4076 i: integer; 4077 begin 4078 if (FInptDlg) and (cboSchedule.Text = 'OTHER') then 3755 4079 begin 3756 4080 cboScheduleClick(Self); 3757 4081 Exit; 3758 4082 end; 4083 //AGP Change for 26.45 PSI-04-069 4084 if self.tabDose.TabIndex = 1 then 4085 begin 4086 for i := 2 to self.grdDoses.RowCount do 4087 begin 4088 if ((ValFor(COL_DOSAGE, i-1) <> '') and (ValFor(COL_DOSAGE, i) <> '')) and (ValFor(COL_SEQUENCE,i-1) = '') then 4089 begin 4090 infoBox('To be able to complete a complex order every row except for the last row must have a conjunction defined. ' + CRLF 4091 + CRLF + 'Verify that all rows have a conjunction defined.','Sequence Error',MB_OK); 4092 Exit; 4093 end; 4094 //text := Self.cboXDosage.Items.Strings[i]; 4095 end; 4096 end; 3759 4097 if FInptDlg and (not FOutptIV) 3760 4098 then DisplayGroup := DisplayGroupByName('UD RX') 3761 4099 else DisplayGroup := DisplayGroupByName('O RX'); 4100 //timCheckChangesTimer(Self); 3762 4101 DropLastSequence; 3763 4102 cmdAccept.SetFocus; 3764 4103 inherited; 4104 (*if self.Responses.Cancel = true then 4105 begin 4106 self.Destroy; 4107 exit; 4108 end; *) 3765 4109 end; 3766 4110 … … 3791 4135 if length(theSch)>0 then 3792 4136 begin 3793 if ( ValueOf(FLD_SCHED_TYP) <> 'O') and (InfoBox(T1+medNm+T+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then4137 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 3794 4138 begin 3795 4139 chkDoseNow.Checked := False; … … 3808 4152 if (tabDose.TabIndex = TI_COMPLEX) and chkDoseNow.Checked then 3809 4153 begin 3810 if ( ValueOf(FLD_SCHED_TYP) <> 'O') and (InfoBox('Give Additional Dose Now is in addition to those listed in the table.' + CRLF +4154 if ( (ValueOf(FLD_SCHED_TYP) <> 'O') and (InfoBox('Give Additional Dose Now is in addition to those listed in the table.' + CRLF + 3811 4155 'Please adjust the duration of the first row, if necessary.', 3812 'Give Additional Dose Now for Complex Order', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL) then4156 'Give Additional Dose Now for Complex Order', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL) ) then 3813 4157 begin 3814 4158 chkDoseNow.Checked := False; … … 3908 4252 var 3909 4253 tempSch: string; 3910 begin 3911 inherited; 3912 if chkPRN.Checked then lblAdminTime.Caption := '' 4254 PRNPos: integer; 4255 begin 4256 inherited; 4257 //GE CQ 7552 4258 if chkPRN.Checked then 4259 begin 4260 lblAdminTime.Caption := ''; 4261 PrnPos := Pos('PRN',cboSchedule.Text); 4262 if (PrnPos < 1) then 4263 UpdateStartExpires(cboSchedule.Text + ' PRN'); 4264 end 3913 4265 else 3914 4266 begin … … 3918 4270 UpdateStartExpires(tempSch); 3919 4271 end; 3920 lblAdminTime.Caption := FAdminTimeLbl;4272 //lblAdminTime.Caption := FAdminTimeLbl; 3921 4273 if txtQuantity.visible then 3922 4274 cboScheduleClick(Self); … … 4031 4383 end 4032 4384 else if (Key = #13) and (ActiveControl = txtMed) then 4033 Key := #0 //Don't let the base class turn it into a forward tab! 4034 else 4035 inherited; 4385 Key := #0; //Don't let the base class turn it into a forward tab! 4036 4386 end; 4037 4387 … … 4284 4634 inherited; 4285 4635 if MessageDlg('You can also select ' + '"' + 'Other' + '"' + ' from the schedule list' 4286 + ' to create a day-of-week or admin-time onlyschedule.'4636 + ' to create a day-of-week schedule.' 4287 4637 + #13#10 + 'Click OK to launch schedule builder', 4288 4638 mtInformation, [mbOK, mbCancel],0) = mrOK then … … 4292 4642 cboSchedule.SelectByID('OTHER'); 4293 4643 cboScheduleClick(Self); 4644 end; 4645 if (tabDose.TabIndex = TI_COMPLEX) then 4646 begin 4647 cboXSchedule.SelectByID('OTHER'); 4648 CBOXScheduleChange(Self); 4294 4649 end; 4295 4650 end; … … 4325 4680 4326 4681 procedure TfrmODMeds.ValidateInpatientSchedule(ScheduleCombo: TORComboBox); 4327 begin 4328 //CQ 7575 Schedule coming across lower-case, change all schedules to Upper-Case. 4682 var 4683 tmpIndex : Integer; 4684 begin 4685 4686 {CQ: 6690 - Orders - autopopulation of schedule field - overtyping only 1 character 4687 CQ: 7280 - PTM 32-34, 42 Meds: NJH-0205-20901 MED DIALOG DROPPING FIRST LETTER (schedule)} 4688 4689 //CQ 7575 Schedule coming across lower-case, change all schedules to Upper-Case. 4329 4690 if (Length(ScheduleCombo.Text) > 0) then 4330 ScheduleCombo.Text := UpperCase(ScheduleCombo.Text); 4691 ScheduleCombo.Text := TrimLeft(UpperCase(ScheduleCombo.Text)); 4692 {if user entered schedule verify it is in list} 4693 if ScheduleCombo.ItemIndex < 0 then // CQ: 7397 4694 begin //Fix for CQ: 9299 - Outpatient Med orders will not accept free text schedule 4695 tmpIndex := GetSchedListIndex(ScheduleCombo,ScheduleCombo.Text); 4696 if tmpIndex > -1 then 4697 ScheduleCombo.ItemIndex := tmpIndex; 4698 end; 4331 4699 if (Length(ScheduleCombo.Text) > 0) and (ScheduleCombo.ItemIndex < 0) and FInptDlg then 4332 4700 begin 4333 4701 FShowPnlXScheduleOk := False; //Added for CQ: 7370 4334 4702 Application.MessageBox('Please select a valid schedule from the list.'+#13+#13+ 4335 'If you would like to create a non-standardschedule please'+4703 'If you would like to create a Day-of-Week schedule please'+ 4336 4704 ' select ''OTHER'' from the list.', 4337 4705 'Incorrect Schedule.'); … … 4344 4712 4345 4713 //Removed based on Site feeback. See CQ: 7518 4346 {function TfrmODMeds.ValidateRoute(RouteCombo: TORComboBox) : Boolean; 4347 begin 4714 (*function TfrmODMeds.ValidateRoute(RouteCombo: TORComboBox) : Boolean; 4715 begin 4716 {CQ: 7331 - Medications - Route - Can not enter any route not listed in Route field in window} 4348 4717 Result := True; 4349 4718 if (Length(RouteCombo.Text) > 0) and (RouteCombo.ItemIndex < 0) and (Not IsSupplyAndOutPatient) then … … 4356 4725 Result := False; 4357 4726 end; 4358 end; }4727 end;*) 4359 4728 4360 4729 function TfrmODMeds.isUniqueQuickOrder(iText: string): Boolean; … … 4373 4742 function TfrmODMeds.IsSupplyAndOutPatient: boolean; 4374 4743 begin 4744 {CQ: 7331 - Medications - Route - Can not enter any route not listed in Route field in window} 4375 4745 Result := False; 4376 4746 if (MedIsSupply(txtMed.Tag)) and (not FInptDlg) then … … 4378 4748 end; 4379 4749 4750 // CQ: 7397 - Inpatient med orders with PRN cancel due to invalid schedule. 4751 function TfrmODMeds.GetSchedListIndex(SchedCombo: TORComboBox; pSchedule: String):integer; 4752 var i: integer; 4753 begin 4754 result := -1; 4755 for i := 0 to SchedCombo.items.Count-1 do 4756 begin 4757 if pSchedule = SchedCombo.DisplayText[i] then 4758 begin 4759 result := i; // match found 4760 break; 4761 end; 4762 end; 4763 end; 4764 4380 4765 4381 4766 procedure TfrmODMeds.cboXScheduleExit(Sender: TObject); 4382 4767 begin 4383 4768 inherited; 4769 {CQ: 7344 - Inconsistency with Schedule box: Allows free-text entry for Complex orders, 4770 doesn't for simple orders } 4384 4771 ValidateInpatientSchedule(cboXSchedule); 4385 4772 end; 4386 4773 4774 procedure TfrmODMeds.cboDosageKeyUp(Sender: TObject; var Key: Word; 4775 Shift: TShiftState); 4776 begin 4777 inherited; 4778 //Fix for CQ: 7545 4779 if cboDosage.ItemIndex > -1 then 4780 cboDosageClick(Sender); 4781 end; 4782 4783 procedure TfrmODMeds.cboXDosageKeyUp(Sender: TObject; var Key: Word; 4784 Shift: TShiftState); 4785 begin 4786 inherited; 4787 //Fix for CQ: 7545 4788 if cboXDosage.ItemIndex > -1 then 4789 cboXDosageClick(Sender); 4790 end; 4791 4792 procedure TfrmODMeds.txtSupplyClick(Sender: TObject); 4793 begin 4794 inherited; 4795 Self.txtSupply.SelectAll; 4796 end; 4797 4798 procedure TfrmODMeds.txtQuantityClick(Sender: TObject); 4799 begin 4800 inherited; 4801 self.txtQuantity.SelectAll; 4802 end; 4803 4804 procedure TfrmODMeds.txtRefillsClick(Sender: TObject); 4805 begin 4806 inherited; 4807 self.txtRefills.SelectAll; 4808 end; 4809 4810 procedure TfrmODMeds.WMClose(var Msg: TWMClose); 4811 begin 4812 if self <> nil then 4813 begin 4814 if (self.tabDose.TabIndex = TI_Dose) then 4815 begin 4816 if Trim(cboSchedule.Text) = '' then cboSchedule.ItemIndex := -1; 4817 ValidateInpatientSchedule(cboSchedule); 4818 if self.cboSchedule.Focused = true then exit; 4819 end; 4820 if (self.tabDose.TabIndex = TI_Complex) then 4821 begin 4822 ValidateInpatientSchedule(cboXSchedule); 4823 if self.cboXSchedule.Focused = true then exit; 4824 end; 4825 end; 4826 inherited 4827 end; 4828 4829 procedure TfrmODMeds.cboXScheduleEnter(Sender: TObject); 4830 begin 4831 inherited; 4832 //agp Change CQ 10719 4833 self.chkXPRN.OnClick(self.chkXPRN); 4834 end; 4835 4387 4836 end.
Note:
See TracChangeset
for help on using the changeset viewer.