Function

TfrmODBase.ValidSave

Module

fODBase

Last Modified

7/15/2014 3:26:40 PM

Comments

ThisSourceOrder: TOrder;

Visibility

Protected

Owner

TfrmODBase

Declaration

function ValidSave: Boolean;

Calls Hierarchy


TfrmODBase.ValidSave
 ├TfrmODBase.Validate
 │ ├TResponses.IValueFor
 │ ├StrToFMDateTime
 │ ├FMToday
 │ │ └FMNow
 │ ├PersonHasKey
 │ ├IsPFSSActive
 │ ├TResponses.PromptExists
 │ ├TResponses.Update
 │ │ ├TResponses.FindResponseByName
 │ │ └TResponses.IENForPrompt
 │ └TEncounter.GetVisitStr
 │   └TEncounter.GetVisitCategory
 ├TfrmODBase.AcceptOrderChecks
 │ ├OrderChecksEnabled
 │ ├TResponses.BuildOCItems
 │ │ ├TResponses.IValueFor
 │ │ └TResponses.EValueFor
 │ ├OrderChecksOnAccept
 │ └AcceptOrderWithChecks
 │   ├TfrmBase508Form.Create
 │   │ ├TfrmBase508Form.UpdateAccessibilityActions
 │   │ ├UnfocusableControlEnter
 │   │ └AdjustControls
 │   │   ├TfrmBase508Form.ModifyUnfocusableControl
 │   │   └..(rec)..
 │   ├IsMonograph
 │   └GetXtraTxt
 ├TfrmFrame.GetTimedOut
 │ └TimedOut
 ├AskAnotherOrder
 ├TfrmODBase.InitDialog
 │ ├TfrmODBase.ClearDialogControls
 │ │ ├ClearControl
 │ │ └TfrmODBase.ShowOrderMessage
 │ └TResponses.Clear
 ├TfrmODBase.ClearDialogControls...
 ├TfrmODBase.LESValidationCheck
 │ ├GetDispGroupForLES
 │ ├TResponses.IValueFor
 │ └LESValidationForChangedLabOrder
 ├TResponses.SaveOrder
 │ ├CheckQOGroup
 │ ├IsValidIMOLoc
 │ ├EventExist
 │ ├PutNewOrder
 │ │ ├SetupORDIALOG
 │ │ └SetOrderFields
 │ │   ├TOrder.Clear
 │ │   ├SeqOfDGroup
 │ │   │ └LoadDGroupMap
 │ │   └TopNameOfDGroup
 │ │     └LoadDGroupMap
 │ ├EventInfo
 │ ├SaveEvtForOrder
 │ └rpcGetBAMasterSwStatus
 ├SetDefaultCoPayToNewOrder
 ├ProcessOrderAcceptEventHook
 │ ├GetOrderAcceptGUIDs
 │ ├EnsureEventHookObjects
 │ │ └TCPRSEventHookManager.Create
 │ │   ├TCPRSBroker.Create
 │ │   └TCPRSState.Create
 │ └TCPRSEventHookManager.ProcessComObject
 │   └TCPRSBroker.Initialize
 ├GetEventDefaultDlg
 └TChanges.Add
   └TChangeItem.Create

Called-By Hierarchy


                                      TfrmODBase.ValidSave
                               TfrmODBase.cmdAcceptClick┤ 
                                   ActivateOrderDialog┘ │ 
                           TfrmRemDlg.btnFinishClick┤   │ 
           TfrmConsults.mnuActNewConsultRequestClick┤   │ 
                   TfrmConsults.cmdNewConsultClick┘ │   │ 
                TfrmConsults.mnuActNewProcedureClick┤   │ 
                      TfrmConsults.cmdNewProcClick┘ │   │ 
                                        ChangeOrders┤   │ 
                      TfrmOrders.mnuActChangeClick┤ │   │ 
                        TfrmMeds.mnuActChangeClick┘ │   │ 
                                     ChangeOrdersEvt┤   │ 
                                          CopyOrders┤   │ 
                        TfrmOrders.mnuActCopyClick┤ │   │ 
                          TfrmMeds.mnuActCopyClick┤ │   │ 
                           TfrmODActive.btnOKClick┘ │   │ 
                                      TransferOrders┤   │ 
                        TfrmOrders.mnuActCopyClick┤ │   │ 
                          TfrmMeds.mnuActCopyClick┤ │   │ 
                           TfrmODActive.btnOKClick┘ │   │ 
                            TfrmOrders.lstWriteClick┤   │ 
               TfrmOrders.PlaceOrderForDefaultDialog┤   │ 
                  TfrmOrders.DisplayDefaultDlgList┤ │   │ 
                       TfrmOrders.ResetOrderPage┘ │ │   │ 
               TfrmOrders.btnDelayedOrderClick┘   │ │   │ 
                                 DisplayEvntDialog┤ │   │ 
                             SetDelayEventForMed┘ │ │   │ 
                      TfrmMeds.mnuActCopyClick┘   │ │   │ 
                                 DisplayEvntDialog┤ │   │ 
                                  SetViewForCopy┘ │ │   │ 
                    TfrmOrders.mnuActCopyClick┘   │ │   │ 
                                 DisplayEvntDialog┘ │   │ 
                                ExecuteChangeEvt┘   │   │ 
                 TfrmOrders.mnuActChgEvntClick┘     │   │ 
                             TfrmMeds.mnuActNewClick┤   │ 
                           TfrmOMNavA.ActivateDialog┤   │ 
                         TfrmOMNavA.grdMenuKeyDown┤ │   │ 
                         TfrmOMNavA.grdMenuMouseUp┘ │   │ 
                                TfrmOMSet.DoNextItem┘   │ 
                              TfrmOMSet.InsertList┤     │ 
                               ActivateOrderList┘ │     │ 
                     TfrmRemDlg.btnFinishClick┤   │     │ 
                             ActivateOrderHTML┤   │     │ 
                    TfrmOrders.lstWriteClick┤ │   │     │ 
    TfrmOrders.PlaceOrderForDefaultDialog...┘ │   │     │ 
                              ActivateOrderSet┤   │     │ 
                   TfrmRemDlg.btnFinishClick┤ │   │     │ 
TfrmConsults.mnuActNewConsultRequestClick...┤ │   │     │ 
     TfrmConsults.mnuActNewProcedureClick...┤ │   │     │ 
                    TfrmOrders.lstWriteClick┤ │   │     │ 
    TfrmOrders.PlaceOrderForDefaultDialog...┤ │   │     │ 
                     TfrmMeds.mnuActNewClick┤ │   │     │ 
                TfrmOMNavA.ActivateDialog...┤ │   │     │ 
                     TfrmOMSet.DoNextItem...┘ │   │     │ 
                       TfrmOMNavA.DoSelectList┘   │     │ 
                     TfrmOMNavA.grdMenuKeyUp┤     │     │ 
                   TfrmOMNavA.grdMenuMouseUp┘     │     │ 
                                        SkipToNext┤     │ 
                         TfrmOMSet.DoNextItem...┘ │     │ 
                            TfrmOMSet.UMDelayEvent┘     │ 
                               TfrmODBase.FormCloseQuery┤ 
                                     TfrmODBase.TabClose┤ 
                            TfrmODAllergy.cmdAcceptClick┘ 

Calls

Name Declaration Comments
TfrmODBase.AcceptOrderChecks function AcceptOrderChecks: Boolean; -
TChanges.Add procedure Add(ItemType: Integer; const AnID, ItemText, GroupName: string; SignState: Integer; AParentID: string = ''; User: int64 = 0; OrderDG: String = ''; DCOrder: Boolean = False; Delay: Boolean = False; ProblemAdded: Boolean = False); -
AskAnotherOrder function AskAnotherOrder(ADialog: Integer): Boolean; -
TfrmODBase.ClearDialogControls procedure ClearDialogControls; -
GetEventDefaultDlg function GetEventDefaultDlg(AEvtID: integer): string; -
TfrmFrame.GetTimedOut function GetTimedOut: boolean; -
TfrmODBase.InitDialog procedure InitDialog; virtual; -
TfrmODBase.LESValidationCheck function LESValidationCheck: boolean; -
ProcessOrderAcceptEventHook function ProcessOrderAcceptEventHook(OrderID: string; DisplayGroup: integer): boolean; -
TResponses.SaveOrder procedure SaveOrder(var AnOrder: TOrder; DlgIEN: Integer; IsIMOOrder: boolean = False); -
SetDefaultCoPayToNewOrder procedure SetDefaultCoPayToNewOrder(AnOrderID, CoPayInfo:string); -
TfrmODBase.Validate procedure Validate(var AnErrMsg: string); virtual; -

Called-By

Name Declaration Comments
TfrmODBase.cmdAcceptClick procedure cmdAcceptClick(Sender: TObject); -
TfrmODAllergy.cmdAcceptClick procedure cmdAcceptClick(Sender: TObject); -
TfrmODBase.FormCloseQuery procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); -
TfrmODBase.TabClose procedure TabClose(var CanClose: Boolean); -


Source

1505  function TfrmODBase.ValidSave: Boolean;
1506  const
1507    TX_NO_SAVE     = 'This order cannot be saved for the following reason(s):' + CRLF + CRLF;
1508    TX_NO_SAVE_CAP = 'Unable to Save Order';
1509    TX_SAVE_ERR    = 'Unexpected error - it was not possible to save this order.';
1510  var
1511    ErrMsg: string;
1512    NewOrder: TOrder;
1513    CanSign, OrderAction: Integer;
1514    IsDelayOrder: boolean;
1515    //thisSourceOrder: TOrder;
1516  begin
1517    Result := True;
1518    IsDelayOrder := False;
1519    Validate(ErrMsg);
1520    if Length(ErrMsg) > 0 then
1521    begin
1522      InfoBox(TX_NO_SAVE + ErrMsg, TX_NO_SAVE_CAP, MB_OK);
1523      Result := False;
1524      Exit;
1525    end;
1526    if not AcceptOrderChecks then
1527    begin
1528      //added code to shut CPRS down without access violations if the fOCAccept is open when timing out.
1529      if frmFrame.TimedOut then
1530        begin
1531           Result := False;
1532           Exit;
1533        end;
1534      if AskAnotherOrder(DialogIEN) then
1535          InitDialog           // ClearDialogControls is in InitDialog
1536        else
1537          begin
1538            ClearDialogControls;    // to allow form to close without prompting to save order
1539            Close;
1540          end;
1541      Result := False;
1542      Exit;
1543    end;
1544    if FTestMode then
1545    begin
1546      Result := False;
1547      Exit;
1548    end;
1549    // LES validation checking for changed lab order
1550    if not LESValidationCheck then Exit;
1551    NewOrder := TOrder.Create;
1552  
1553    Responses.SaveOrder(NewOrder, DialogIEN, FIsIMO);
1554  
1555    if frmOrders.IsDefaultDlg then
1556    begin
1557      frmOrders.EventDefaultOrder := NewOrder.ID;
1558      frmOrders.EvtOrderList.Add(NewOrder.EventPtr + '^' + NewOrder.ID);
1559      frmOrders.IsDefaultDlg := False;
1560    end;
1561    if Length(DfltCopay)>0 then SetDefaultCoPayToNewOrder(NewOrder.ID, DfltCopay);
1562    if (Length(FEvtName)>0) then
1563    begin
1564      NewOrder.EventName := 'Delayed ' + MixedCase(FEvtName);
1565      FEvtName := '';
1566    end;
1567    if not ProcessOrderAcceptEventHook(NewOrder.ID, NewOrder.DGroup) then
1568    begin
1569      if NewOrder.ID <> '' then
1570      begin
1571        if (Encounter.Provider = User.DUZ) and User.CanSignOrders
1572          then CanSign := CH_SIGN_YES
1573          else CanSign := CH_SIGN_NA;
1574        if NewOrder.Signature = OSS_NOT_REQUIRE then CanSign := CH_SIGN_NA;
1575        if (NewOrder.EventPtr <> '') and (GetEventDefaultDlg(responses.FEventIFN) <> InttoStr(Responses.QuickOrder)) then
1576            IsDelayOrder := True;
1577        Changes.Add(CH_ORD, NewOrder.ID, NewOrder.Text, Responses.FViewName, CanSign,'',0, NewOrder.DGroupName, False, IsDelayOrder);
1578  
1579      UBAGlobals.TargetOrderID := NewOrder.ID;
1580  
1581        if Responses.EditOrder = '' then OrderAction := ORDER_NEW else OrderAction := ORDER_EDIT;
1582        SendMessage(Application.MainForm.Handle, UM_NEWORDER, OrderAction, Integer(NewOrder));
1583      end
1584      else InfoBox(TX_SAVE_ERR, TX_NO_SAVE_CAP, MB_OK);
1585    end;
1586    NewOrder.Free;      // free here - recieving forms should get own copy using assign
1587  end;