Function

TfrmNotes.LockConsultRequestAndNote

Module

fNotes

Last Modified

7/15/2014 3:26:38 PM

Comments

Returns true if note and associated request successfully locked

Visibility

Private

Owner

TfrmNotes

Declaration

function LockConsultRequestAndNote(AnIEN: Int64): Boolean;

Calls Hierarchy


TfrmNotes.LockConsultRequestAndNote
 ├TfrmConsults.ActiveEditOf
 │ └GetPackageRefForNote
 ├TChanges.Exist
 ├IsConsultTitle
 ├TitleForNote
 ├GetPackageRefForNote
 ├TfrmNotes.LockConsultRequest
 │ ├GetConsultOrderIEN
 │ └OrderCanBeLocked
 │   └LockOrder
 ├LockDocument
 └UnlockOrderIfAble
   └UnlockOrder

Called-By Hierarchy


                                     TfrmNotes.LockConsultRequestAndNote
                                                 TfrmNotes.LoadForEdit┤ 
                                           TfrmNotes.mnuActEditClick┘ │ 
                                         TfrmNotes.mnuActSignListClick┤ 
                                           TfrmNotes.mnuActDeleteClick┤ 
                                            TfrmNotes.SaveEditedNote┘ │ 
                                         TfrmNotes.SaveCurrentNote┘   │ 
                                    TfrmNotes.AllowContextChange┤     │ 
                               TfrmFrame.AllowContextChangeAll┘ │     │ 
                                    TfrmFrame.FormCloseQuery┤   │     │ 
                                  TfrmFrame.mnuFileNextClick┤   │     │ 
                                TfrmFrame.mnuFileOpenClick┤ │   │     │ 
                                    TfrmFrame.UMInitiate┤ │ │   │     │ 
                           TfrmFrame.mnuFileNextClick...┤ │ │   │     │ 
                           TfrmFrame.mnuFileRefreshClick┤ │ │   │     │ 
                           TfrmOrders.CheckOrderStatus┤ │ │ │   │     │ 
                       TfrmOrders.mnuActChgEvntClick┤ │ │ │ │   │     │ 
                          TfrmOrders.mnuActHoldClick┤ │ │ │ │   │     │ 
                        TfrmOrders.mnuActUnholdClick┤ │ │ │ │   │     │ 
                         TfrmOrders.mnuActRenewClick┤ │ │ │ │   │     │ 
                        TfrmOrders.mnuActChangeClick┤ │ │ │ │   │     │ 
                          TfrmOrders.mnuActCopyClick┘ │ │ │ │   │     │ 
                                TfrmMeds.mnuActDCClick┤ │ │ │   │     │ 
                               TfrmMeds.CheckMedStatus┘ │ │ │   │     │ 
                            TfrmMeds.mnuActHoldClick┤   │ │ │   │     │ 
                           TfrmMeds.mnuActRenewClick┤   │ │ │   │     │ 
                          TfrmMeds.mnuActUnholdClick┤   │ │ │   │     │ 
                          TfrmMeds.mnuActChangeClick┤   │ │ │   │     │ 
                            TfrmMeds.mnuActCopyClick┤   │ │ │   │     │ 
                          TfrmMeds.mnuActRefillClick┘   │ │ │   │     │ 
                                      TfrmFrame.ViewInfo┘ │ │   │     │ 
                                   TfrmDCSumm.ViewInfo┤   │ │   │     │ 
                                 TfrmConsults.ViewInfo┤   │ │   │     │ 
                         TfrmFrame.pnlRemindersMouseUp┤   │ │   │     │ 
                          TfrmFrame.RemindersChanged┘ │   │ │   │     │ 
                              TfrmFrame.FormCreate┘   │   │ │   │     │ 
                                TfrmFrame.pnlCIRNClick┤   │ │   │     │ 
                          TfrmFrame.pnlVistaWebClick┤ │   │ │   │     │ 
                               TfrmFrame.FormKeyDown┘ │   │ │   │     │ 
                             TfrmFrame.pnlPatientClick┤   │ │   │     │ 
                               TfrmFrame.pnlVisitClick┤   │ │   │     │ 
                         TfrmFrame.pnlPrimaryCareClick┤   │ │   │     │ 
                           TfrmFrame.pnlRemindersClick┤   │ │   │     │ 
                            TfrmFrame.pnlPostingsClick┤   │ │   │     │ 
                                TfrmFrame.pnlFlagClick┤   │ │   │     │ 
                                  TfrmFrame.laMHVClick┤   │ │   │     │ 
                                 TfrmFrame.laVAA2Click┤   │ │   │     │ 
                                   TfrmOrders.ViewInfo┤   │ │   │     │ 
                                     TfrmMeds.ViewInfo┤   │ │   │     │ 
                                  TfrmSurgery.ViewInfo┤   │ │   │     │ 
                                    TfrmNotes.ViewInfo┤   │ │   │     │ 
                                 TfrmProblems.ViewInfo┘   │ │   │     │ 
                         TfrmFrame.mnuFileNotifRemoveClick┤ │   │     │ 
                                 TfrmFrame.NextButtonClick┘ │   │     │ 
                               TfrmFrame.SetUpNextButton┘   │   │     │ 
                         TfrmFrame.mnuFileOpenClick...┤     │   │     │ 
                                  TfrmFrame.FormResize┘     │   │     │ 
                                TfrmFrame.ChangeFont┘       │   │     │ 
                        TfrmFrame.LoadSizesForUser┤         │   │     │ 
                   TfrmFrame.LoadUserPreferences┘ │         │   │     │ 
                          TfrmFrame.UMInitiate┘   │         │   │     │ 
                        TfrmFrame.mnuFontSizeClick┘         │   │     │ 
                               TfrmFrame.mnuFileOpenClick...┤   │     │ 
                               TfrmFrame.ctxContextorPending┤   │     │ 
                              TfrmFrame.StartCCOWContextor┘ │   │     │ 
                                    TfrmFrame.FormCreate┘   │   │     │ 
                             TfrmFrame.ctxContextorCommitted┤   │     │ 
                           TfrmFrame.StartCCOWContextor...┘ │   │     │ 
                      TfrmFrame.mnuFileResumeContextGetClick┤   │     │ 
                      TfrmFrame.mnuFileResumeContextSetClick┘   │     │ 
                                       TfrmNotes.LstNotesToPrint┤     │ 
                      TfrmFrame.mnuFilePrintSelectedItemsClick┘ │     │ 
                                          TfrmNotes.RequestPrint┤     │ 
                                   TfrmFrame.mnuFilePrintClick┘ │     │ 
                                          TfrmNotes.mnuViewClick┤     │ 
                                      TfrmNotes.SetViewContext┤ │     │ 
                                       TfrmNotes.DisplayPage┤ │ │     │ 
                       TfrmNotes.mnuViewReturntoDefaultClick┘ │ │     │ 
                           TfrmNotes.mnuViewSaveAsDefaultClick┘ │     │ 
                                          TfrmNotes.StartNewEdit┤     │ 
                                      TfrmNotes.mnuActNewClick┤ │     │ 
                                   TfrmNotes.cmdNewNoteClick┘ │ │     │ 
                               TfrmNotes.mnuActAddIDEntryClick┤ │     │ 
                                   TfrmNotes.mnuActAddendClick┤ │     │ 
                                     TfrmNotes.mnuActEditClick┘ │     │ 
                         TfrmNotes.mnuActDetachFromIDParentClick┤     │ 
                                  TfrmNotes.mnuActDeleteClick...┤     │ 
                                       TfrmNotes.mnuActSaveClick┤     │ 
                                       TfrmNotes.mnuActSignClick┤     │ 
                                          TfrmNotes.SaveSignItem┤     │ 
                                         TfrmReview.cmdOKClick┘ │     │ 
                                               ReviewChanges┘   │     │ 
                        TfrmFrame.AllowContextChangeAll...┤     │     │ 
                                  TfrmFrame.FormCloseQuery┤     │     │ 
                              TfrmFrame.mnuFileReviewClick┤     │     │ 
                                           UpdateEncounter┘     │     │ 
                         TfrmFrame.mnuFileEncounterClick┤       │     │ 
                                 TfrmFrame.ViewInfo...┤ │       │     │ 
                    TfrmODMedIV.SetValuesFromResponses┤ │       │     │ 
                             TfrmODMedIV.SetupDialog┤ │ │       │     │ 
                   TfrmODMedIV.cboSolutionMouseClick┘ │ │       │     │ 
                       TfrmODMedIV.cboSolutionExit┘   │ │       │     │ 
                  TfrmODMedIV.cboSolutionMouseClick...┤ │       │     │ 
                     TfrmODMedIV.cboAdditiveMouseClick┤ │       │     │ 
                         TfrmODMedIV.cboAdditiveExit┘ │ │       │     │ 
                                TfrmODAuto.SetupDialog┤ │       │     │ 
                                   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┘   │ │       │     │ 
                               TfrmOMSet.InsertList...┤ │       │     │ 
                                TfrmODMeds.SetupDialog┤ │       │     │ 
                             TfrmODMeds.btnSelectClick┤ │       │     │ 
                             TfrmODMeds.UMDelayClick┘ │ │       │     │ 
                                    ExecuteRenewOrders┘ │       │     │ 
                         TfrmOrders.mnuActRenewClick┤   │       │     │ 
                           TfrmMeds.mnuActRenewClick┘   │       │     │ 
                                        EncounterPresent┤       │     │ 
                                      ReadyForNewOrder┤ │       │     │ 
                           TfrmRemDlg.btnFinishClick┤ │ │       │     │ 
        TfrmConsults.mnuActNewConsultRequestClick...┤ │ │       │     │ 
             TfrmConsults.mnuActNewProcedureClick...┤ │ │       │     │ 
                                     ChangeOrders...┤ │ │       │     │ 
                                     ChangeOrdersEvt┤ │ │       │     │ 
                                       CopyOrders...┤ │ │       │     │ 
                                   TransferOrders...┤ │ │       │     │ 
                            TfrmOrders.lstWriteClick┤ │ │       │     │ 
                             TfrmMeds.mnuActNewClick┘ │ │       │     │ 
                                     ReadyForNewOrder1┤ │       │     │ 
            TfrmOrders.PlaceOrderForDefaultDialog...┘ │ │       │     │ 
                              TfrmOrders.mnuActDCClick┤ │       │     │ 
                             TfrmOrders.mnuActRelClick┤ │       │     │ 
                            TfrmOrders.mnuActHoldClick┤ │       │     │ 
                          TfrmOrders.mnuActUnholdClick┤ │       │     │ 
                           TfrmOrders.mnuActRenewClick┤ │       │     │ 
                         TfrmOrders.mnuActReleaseClick┤ │       │     │ 
                         TfrmOrders.mnuActOnChartClick┤ │       │     │ 
                            TfrmOrders.mnuActSignClick┤ │       │     │ 
                                TfrmMeds.mnuActDCClick┤ │       │     │ 
                              TfrmMeds.mnuActHoldClick┤ │       │     │ 
                             TfrmMeds.mnuActRenewClick┤ │       │     │ 
                            TfrmMeds.mnuActUnholdClick┤ │       │     │ 
                              TfrmMeds.mnuActCopyClick┤ │       │     │ 
                            TfrmMeds.mnuActRefillClick┘ │       │     │ 
                                     EncounterPresentEDO┤       │     │ 
                                   ReadyForNewOrder...┤ │       │     │ 
                         TfrmOrders.mnuActChgEvntClick┤ │       │     │ 
                          TfrmOrders.mnuActChangeClick┤ │       │     │ 
                            TfrmOrders.mnuActCopyClick┤ │       │     │ 
                       TfrmOrders.btnDelayedOrderClick┤ │       │     │ 
                            TfrmMeds.mnuActChangeClick┤ │       │     │ 
                              TfrmMeds.mnuActCopyClick┘ │       │     │ 
                                             UpdateVisit┤       │     │ 
                                           EditPCEData┤ │       │     │ 
                             TfrmSurgery.cmdPCEClick┤ │ │       │     │ 
                                 UpdateEncounterInfo┘ │ │       │     │ 
                             TfrmNotes.cmdPCEClick┘   │ │       │     │ 
                        TfrmVitals.btnEnterVitalsClick┘ │       │     │ 
                                             UpdateVisit┤       │     │ 
                                        EncounterPresent┘       │     │ 
                         TfrmProblems.lstProbActsClick┘         │     │ 
                     TfrmProblems.wgProbDataDblClick┤           │     │ 
                           TfrmProblems.lstViewClick┘           │     │ 
                   TfrmProblems.HighlightDuplicate┘             │     │ 
                         TfrmProblems.AddProblem┤               │     │ 
              TfrmProblems.lstProbActsClick...┤ │               │     │ 
                 TfrmProblems.lstProbPickClick┤ │               │     │ 
              TfrmProblems.lstProbPickDblClick┤ │               │     │ 
              TfrmProblems.edProbEntKeyPress┘ │ │               │     │ 
                      TfrmProblems.UMPLLexicon┘ │               │     │ 
                   TfrmdlgProb.bbChangeProbClick┘               │     │ 
                                             TfrmNotes.FormClose┤     │ 
                        TfrmNotes.mnuActIdentifyAddlSignersClick┤     │ 
                            TfrmNotes.popNoteMemoAddlSignClick┘ │     │ 
                                  TfrmNotes.ProcessNotifications┤     │ 
                                         TfrmNotes.DisplayPage┘ │     │ 
                                     TfrmNotes.SetViewContext...┤     │ 
                                       TfrmNotes.tvNotesDragDrop┤     │ 
                           TfrmNotes.mnuActAttachtoIDParentClick┘     │ 
                                             TfrmNotes.mnuActSignClick┤ 
                           TfrmNotes.mnuActIdentifyAddlSignersClick...┘ 

Calls

Name Declaration Comments
TfrmConsults.ActiveEditOf function ActiveEditOf(AnIEN: Int64): Boolean; -
TChanges.Exist function Exist(ItemType: Integer; const AnID: string): Boolean; -
GetPackageRefForNote function GetPackageRefForNote(NoteIEN: integer): string; -
IsConsultTitle function IsConsultTitle(TitleIEN: Integer): Boolean; -
TfrmNotes.LockConsultRequest function LockConsultRequest(AConsult: Integer): Boolean; -
LockDocument procedure LockDocument(IEN: Int64; var AnErrMsg: string); -
TitleForNote function TitleForNote(IEN: Int64): Integer; -
UnlockOrderIfAble procedure UnlockOrderIfAble(OrderID: string); -

Called-By

Name Declaration Comments
TfrmNotes.LoadForEdit procedure LoadForEdit; -
TfrmNotes.mnuActDeleteClick procedure mnuActDeleteClick(Sender: TObject); -
TfrmNotes.mnuActIdentifyAddlSignersClick procedure mnuActIdentifyAddlSignersClick(Sender: TObject); -
TfrmNotes.mnuActSignClick procedure mnuActSignClick(Sender: TObject); -
TfrmNotes.mnuActSignListClick procedure mnuActSignListClick(Sender: TObject); -


Source

864   function TfrmNotes.LockConsultRequestAndNote(AnIEN: Int64): Boolean;
865   { returns true if note and associated request successfully locked }
866   var
867     AConsult: Integer;
868     LockMsg, x: string;
869   begin
870     Result := True;
871     AConsult := 0;
872     if frmConsults.ActiveEditOf(AnIEN) then
873       begin
874         InfoBox(TX_ORDER_LOCKED, TC_ORDER_LOCKED, MB_OK);
875         Result := False;
876         Exit;
877       end;
878       if Changes.Exist(CH_DOC, IntToStr(AnIEN)) then Exit;  // already locked
879     // try to lock the consult request first, if there is one
880     if IsConsultTitle(TitleForNote(AnIEN)) then
881     begin
882       x := GetPackageRefForNote(lstNotes.ItemIEN);
883       AConsult := StrToIntDef(Piece(x, ';', 1), 0);
884       Result := LockConsultRequest(AConsult);
885     end;
886     // now try to lock the note
887     if Result then
888     begin
889       LockDocument(AnIEN, LockMsg);
890       if LockMsg <> '' then
891       begin
892         Result := False;
893         // if can't lock the note, unlock the consult request that was just locked
894         if AConsult > 0 then
895         begin
896           UnlockOrderIfAble(FOrderID);
897           FOrderID := '';
898         end;
899         InfoBox(LockMsg, TC_NO_LOCK, MB_OK);
900       end;
901     end;
902   end;