Ignore:
Timestamp:
May 7, 2015, 12:34:29 PM (9 years ago)
Author:
healthsevak
Message:

Updating the working copy to CPRS version 28

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/Orders/uOrders.pas

    r829 r1679  
    44
    55uses
    6   Windows, Messages, SysUtils, Classes, Controls, Forms, uConst, rOrders, ORFn,
    7   Dialogs, ORCtrls, stdCtrls, strUtils, fODBase, fODMedOIFA;
     6  Windows, Messages, SysUtils, Classes, Controls, Forms, uConst, rConsults,
     7  rOrders, ORFn, Dialogs, ORCtrls, stdCtrls, strUtils, fODBase, fODMedOIFA,
     8  VA508AccessibilityRouter;
    89
    910type
     
    7273function AllowActionOnIMO(AnEvtTyp: char): boolean;
    7374function IMOActionValidation(AnId: string; var IsIMOOD: boolean; var x: string; AnEventType: char): boolean;
     75function IMOTimeFrame: TFMDateTime;
    7476
    7577
     
    290292    ((Encounter.Provider > 0) and (not PersonHasKey(Encounter.Provider, 'PROVIDER'))) then
    291293  begin
    292     UpdateEncounter(NPF_PROVIDER);
     294    UpdateEncounter(NPF_PROVIDER, 0, 0, True);
    293295    frmFrame.DisplayEncounterText;
    294296  end;
     
    491493  MedsNVADlgFormID := FormIDForDialog(MedsNVADlgIen);
    492494  MedsIVDlgFormID := FormIDForDialog(MedsIVDlgIen);
     495end;
     496
     497function CanCloseDialog(dialog : TfrmODBase) : Boolean;
     498begin
     499  if uOrderDialog.FillerID = 'GMRC' then
     500    result := fODConsult.CanFreeConsultDialog(dialog)
     501            or fODProc.CanFreeProcDialog(dialog);
    493502end;
    494503
     
    750759    case AFormID of
    751760      OM_ALLERGY:     if ARTPatchInstalled then
    752                         DialogClass := TfrmARTAllergy
     761                      begin
     762//                        DialogClass := TfrmARTAllergy;
     763                          EnterEditAllergy(0, TRUE, FALSE, AnOwner, ARefNum);
     764                          Result := True;
     765//                          uOrderMenu.Close;
     766                          Exit;
     767                      end
    753768                      else
    754769                        begin
     
    786801  TX_EVTDEL_DIET_CONFLICT = 'Have you done either of the above?';
    787802  TC_EVTDEL_DIET_CONFLICT = 'Possible delayed order conflict';
     803  TX_INACTIVE_SVC = 'This consult service is currently inactive and not receiving requests.' + CRLF +
     804                    'Please contact your Clinical Coordinator/IRM staff to fix this order.';
     805  TX_INACTIVE_SVC_CAP = 'Inactive Service';
     806  TX_NO_SVC = 'The order or quick order you have selected does not specify a consult service.' + CRLF +
     807              'Please contact your Clinical Coordinator/IRM staff to fix this order.';
     808  TC_NO_SVC = 'No service specified';
    788809var
    789810  ResolvedDialog: TOrderDialogResolved;
     
    796817  CxMsg: string;
    797818  AButton: TButton;
     819  SvcIEN: string;
     820  //CsltFrmID: integer;
    798821begin
    799822  IsPsoSupply := False;
     
    807830  DrugTestDlgType := false;
    808831  //QOAltOI.OI := 0;
     832  Application.ProcessMessages;
    809833  // double check environment before continuing with order
    810834  if uOrderDialog <> nil then uOrderDialog.Close; // then x := uOrderDialog.Name else x := '';
     
    859883  OrderPtEvtID := GetOrderPtEvtID(Copy(AnID, 2, Length(AnID)));
    860884  OrderEvtID := Piece(EventInfo(OrderPtEvtID),'^',2);
     885  //CQ 18660 Orders for events should be modal. Orders for non-event should not be modal
     886  if AnEvent.EventIFN > 0 then frmOrders.NeedShowModal := true
     887  else frmOrders.NeedShowModal := false;
    861888  // evaluate order dialog, build response list & see what form should be presented
    862889  FillChar(ResolvedDialog, SizeOf(ResolvedDialog), #0);
     
    967994    if QuickLevel = QL_REJECT then InfoBox(ShowText, TC_DLG_REJECT, MB_OK);
    968995    if (QuickLevel = QL_VERIFY) and (IsPharmacyOrder or ANeedVerify) then  ShowVerifyText(QuickLevel, ShowText, DisplayGroup=InptDisp);
    969     if QuickLevel = QL_AUTO   then FormID := OD_AUTOACK;
     996    if QuickLevel = QL_AUTO then
     997    begin
     998      //CsltFrmID := FormID;
     999      FormID := OD_AUTOACK;
     1000    end;
    9701001    if (QuickLevel = QL_REJECT) or (QuickLevel = QL_CANCEL) then Exit;
    9711002    PushKeyVars(ResolvedDialog.QOKeyVars);
     
    10461077                    uOrderDialog.IsSupply := True;
    10471078                  SetupDialog(ORDER_QUICK, ResolvedDialog.ResponseID);
     1079                  {if ((ResolvedDialog.DisplayGroup = CsltDisp)
     1080                    and (ResolvedDialog.QuickLevel = QL_AUTO)) then
     1081                    TfrmODCslt.SetupDialog(ORDER_QUICK, ResolvedDialog.ResponseID);}
    10481082                end;
    10491083          end;
    10501084
    10511085          if Assigned(uOrderDialog) then
    1052             with uOrderDialog do if AbortOrder then
    1053               begin
    1054                 Close;
    1055                 Exit;
    1056               end;
     1086            with uOrderDialog do
     1087              if AbortOrder and CanCloseDialog(uOrderDialog) then
     1088                begin
     1089                  Close;
     1090                  if Assigned(uOrderDialog) then
     1091                    uOrderDialog.Destroy;
     1092                  Exit;
     1093                end;
    10571094
    10581095          if CharAt(AnID, 1) = 'T' then
     
    11481185                 if ValidateDrugAutoAccept(tempDrug, tempUnit, tempSch, tempDur, tempOI, StrtoInt(tempSupply), StrtoInt(tempQuantity), StrtoInt(tempRefills)) = false then Exit;
    11491186               end;
     1187             if ((ResolvedDialog.DisplayGroup = CsltDisp) and (ResolvedDialog.QuickLevel = QL_AUTO)) then
     1188             begin
     1189               with Responses do
     1190               begin
     1191                 Changing := True;
     1192                 tmpResp := TResponse(FindResponseByName('ORDERABLE',1));
     1193                 if tmpResp <> nil then
     1194                   SvcIEN := GetServiceIEN(tmpResp.IValue)
     1195                 else
     1196                 begin
     1197                   InfoBox(TX_NO_SVC, TC_NO_SVC, MB_ICONERROR or MB_OK);
     1198                   //AbortOrder := True;
     1199                   //Close;
     1200                   Exit;
     1201                 end;
     1202                 if SvcIEN = '-1' then
     1203                 begin
     1204                   InfoBox(TX_INACTIVE_SVC, TX_INACTIVE_SVC_CAP, MB_OK);
     1205                   //AbortOrder := True;
     1206                   //Close;
     1207                   Exit;
     1208                 end;
     1209               end;
     1210             end;
    11501211             cmdAcceptClick(Application);  // auto-accept order
    11511212             Result := uOrderDialog.AcceptOK;
     1213             if (result = true) and (ScreenReaderActive) then
     1214               GetScreenReader.Speak('Auto Accept Quick Order '+ Responses.DialogDisplayName + ' placed.');
    11521215
    11531216             //BAPHII 1.3.2
     
    13041367var
    13051368  InitialCall: Boolean;
     1369  i: integer;
     1370  str: string;
    13061371begin
    13071372  InitialCall := False;
     1373  if ScreenReaderActive then
     1374    begin
     1375      for i := 0 to AList.Count - 1 do
     1376         begin
     1377           if Piece(Alist.Strings[i],U,2) = 'Q' then str := str + CRLF + 'Quick Order ' + Piece(Alist.Strings[i],U,3)
     1378           else if Piece(Alist.Strings[i],U,2) = 'S' then str := str + CRLF + 'Order Set ' + Piece(Alist.Strings[i],U,3)
     1379           else if Piece(Alist.Strings[i],U,2) = 'M' then str := str + CRLF + 'Order Menu ' + Piece(Alist.Strings[i],U,3)
     1380           else if Piece(Alist.Strings[i],U,2) = 'A' then str := str + CRLF + 'Order Action ' + Piece(Alist.Strings[i],U,3)
     1381           else str := str + CRLF + 'Order Dialog ' + Piece(Alist.Strings[i],U,3);
     1382         end;
     1383      if infoBox('This order set contains the following items:'+ CRLF + str + CRLF+ CRLF + 'Select the OK button to start this order set.' +
     1384                 'To stop the order set while it is in process, press “Alt +F6” to navigate to the order set dialog, and select the Stop Order Set Button.', 'Starting Order Set'  ,MB_OKCANCEL) = IDCANCEL then
     1385        begin
     1386          Result := False;
     1387          exit;
     1388        end;
     1389    end;
    13081390  if uOrderSet = nil then
    13091391  begin
     
    13791461  { make sure a location and provider are selected before ordering }
    13801462  if not AuthorizedUser then Exit;
    1381   if (not Patient.Inpatient) and (AnEvent.EventIFN > 0 ) then x := ''
     1463  //Added to force users without the Provider or ORES key to select an a provider when adding new orders to existing delay orders
     1464  if (not Patient.Inpatient) and (AnEvent.EventIFN > 0 ) then
     1465    begin
     1466      if (User.OrderRole = OR_PHYSICIAN) and (Encounter.Provider = User.DUZ) and (User.IsProvider) then
     1467        x := ''
     1468      else if not EncounterPresentEDO then Exit;
     1469      x := '';
     1470    end
    13821471  else
    13831472  begin
     
    18421931  //else
    18431932  //Encounter.Location := PrintLoc;
     1933  if (PrintLoc = 0) and (Encounter.Location > 0) then PrintLoc := Encounter.Location;
    18441934  if PrintLoc = 0
    18451935    then PrintLoc := CommonLocationForOrders(OrderList);
    1846   if (PrintLoc = 0) and (Encounter.Location > 0) then PrintLoc := Encounter.Location;
    1847  
    18481936  if PrintLoc = 0 then                      // location required for DEVINFO
    18491937  begin
     
    18651953  end
    18661954  else InfoBox(TX_SIGN_LOC, TC_REQ_LOC, MB_OK or MB_ICONWARNING);
    1867  (*   Encounter.Location := PrintLoc;
    1868   if Encounter.Location = 0
    1869     then Encounter.Location := CommonLocationForOrders(OrderList);
    1870   if Encounter.Location = 0 then                      // location required for DEVINFO
    1871   begin
    1872     LookupLocation(ALocation, AName, LOC_ALL, TX_LOC_PRINT);
    1873     if ALocation > 0 then Encounter.Location := ALocation;
    1874   end;
    1875   if printLoc = 0 then frmFrame.DisplayEncounterText;
    1876   if Encounter.Location <> 0 then
    1877   begin
    1878     SetupOrdersPrint(OrderList, DeviceInfo, Nature, False, PrintIt, PrintName);
    1879     if PrintIt then
    1880       PrintOrdersOnReview(OrderList, DeviceInfo)
    1881     else
    1882       PrintServiceCopies(OrderList);
    1883   end
    1884   else InfoBox(TX_SIGN_LOC, TC_REQ_LOC, MB_OK or MB_ICONWARNING);  *)
    18851955end;
    18861956
     
    19161986  result := False;
    19171987  IsInptDlg := False;
    1918   Td := FMToday;
     1988  //CQ #15188 - allow IMO functionality 23 hours after encounter date/time - TDP
     1989  //Td := FMToday;
     1990  Td := IMOTimeFrame;
    19191991  if ( (DlgID = MedsInDlgIen) or (DlgID = MedsIVDlgIen) or (IsInptQO(dlgId)) or (IsIVQO(dlgId))) then IsInptDlg := TRUE;
    19201992  IsIMOLocation := IsValidIMOLoc(Encounter.Location,Patient.DFN);
     
    19362008  else
    19372009  begin
    1938     Td := FMToday;
     2010    //CQ #15188 - allow IMO functionality 23 hours after encounter date/time - TDP
     2011    //Td := FMToday;
     2012    Td := IMOTimeFrame;
    19392013    if IsValidIMOLoc(Encounter.Location,Patient.DFN) and (Encounter.DateTime > Td) then
    19402014      Result := True
     
    20042078    end;
    20052079  end;
     2080end;
     2081
     2082//CQ #15188 - New function to allow IMO functionality 23 hours after encounter date/time - TDP
     2083function IMOTimeFrame: TFMDateTime;
     2084begin
     2085  Result := DateTimeToFMDateTime(FMDateTimeToDateTime(FMNow) - (23/24));
    20062086end;
    20072087
Note: See TracChangeset for help on using the changeset viewer.