Procedure

TfrmNotes.cmdChangeClick

Module

fNotes

Last Modified

7/15/2014 3:26:38 PM

Visibility

Public/Published

Owner

TfrmNotes

Declaration

procedure cmdChangeClick(Sender: TObject);

Calls Hierarchy


TfrmNotes.cmdChangeClick
 ├ExecuteNoteProperties
 │ ├TfrmBase508Form.Create
 │ │ ├TfrmBase508Form.UpdateAccessibilityActions
 │ │ ├UnfocusableControlEnter
 │ │ └AdjustControls
 │ │   ├TfrmBase508Form.ModifyUnfocusableControl
 │ │   └..(rec)..
 │ ├FMToday
 │ │ └FMNow
 │ ├ListClinProcTitlesShort
 │ │ └LoadClinProcTitles
 │ │   ├IdentifyClinProcClass
 │ │   └TClinProcTitles.Create
 │ ├ListConsultTitlesShort
 │ │ └LoadConsultTitles
 │ │   ├IdentifyConsultsClass
 │ │   └TConsultTitles.Create
 │ ├ListSurgeryTitlesShort
 │ │ └LoadSurgeryTitles
 │ │   └TSurgeryTitles.Create
 │ ├GetUnresolvedConsultsInfo
 │ ├ListNoteTitlesShort
 │ │ └LoadNoteTitles
 │ │   └TNoteTitles.Create
 │ ├TfrmNoteProperties.ShowClinProcFields
 │ ├TfrmNoteProperties.SetCosignerRequired
 │ │ ├AskCosignerForDocument
 │ │ │ └TIUPatch175Installed
 │ │ │   └ServerHasPatch
 │ │ ├AskCosignerForTitle
 │ │ │ └TIUPatch175Installed...
 │ │ └DefaultCosigner
 │ │   └LoadTIUPrefs
 │ │     └ExternalName
 │ ├TfrmNoteProperties.SetGenericFormSize
 │ ├TfrmNoteProperties.ShowRequestList
 │ │ └ListConsultRequests
 │ ├TfrmNoteProperties.ShowSurgCaseList
 │ │ └ListSurgeryCases
 │ ├TfrmNoteProperties.ShowPRFList
 │ │ ├TPRFActions.Create
 │ │ ├TPRFActions.Load
 │ │ └TPRFActions.ShowActionsOnList
 │ │   └TPRFActions.SelActionHasNote
 │ ├IsConsultTitle
 │ ├IsSurgeryTitle
 │ │ └ShowSurgeryTab
 │ ├IsPRFTitle
 │ ├TfrmNoteProperties.cboNewTitleExit
 │ │ └TfrmNoteProperties.cboNewTitleMouseClick
 │ │   ├IsConsultTitle
 │ │   ├TfrmNoteProperties.SetGenericFormSize
 │ │   ├TfrmNoteProperties.ShowRequestList...
 │ │   ├TfrmNoteProperties.ShowSurgCaseList...
 │ │   ├IsSurgeryTitle...
 │ │   ├TfrmNoteProperties.ShowPRFList...
 │ │   ├IsPRFTitle
 │ │   └TfrmNoteProperties.SetCosignerRequired...
 │ ├TfrmNoteProperties.FormatRequestList
 │ │ └TfrmNoteProperties.ShowRequestList...
 │ ├PrintNameForTitle
 │ ├TEncounter.GetLocationName
 │ │ └TEncounter.UpdateText
 │ │   └GetEncounterText
 │ ├TPRFActions.GetPRF_IEN
 │ └TPRFActions.GetActionIEN
 ├TChanges.ReplaceSignState
 ├MakeNoteDisplayText
 ├TChanges.ReplaceText
 ├TfrmNotes.GetTitleText
 ├TfrmNotes.LockConsultRequest
 │ ├GetConsultOrderIEN
 │ └OrderCanBeLocked
 │   └LockOrder
 ├UnlockOrderIfAble
 │ └UnlockOrder
 ├GetConsultOrderIEN
 └TfrmNotes.mnuActLoadBoilerClick
   ├LoadBoilerPlate
   ├GetLinkedTemplate
   │ ├GetLinkedTemplateData
   │ └AddTemplate
   │   ├TTemplate.Create
   │   │ └TTemplate.ReminderDialogIEN
   │   └TTemplate.AddChild
   │     └TTemplate.GetItems
   │       └ExpandTemplate
   │         ├TTemplate.GetChildren
   │         ├GetTemplateChildren
   │         ├AddTemplate...
   │         └TTemplate.ItemIENs
   │           └TTemplate.GetItems...
   ├MakeXMLParamTIU
   │ └ExternalName
   ├AssignBoilerText
   │ ├QuickCopyWith508Msg
   │ │ └SpeakTextInserted
   │ └TfrmNotes.UpdateNoteAuthor
   │   ├GetXMLParamReturnValueTIU
   │   ├ExternalName
   │   ├AskCosignerForTitle...
   │   └TfrmNotes.cmdChangeClick...
   ├QueryBoilerPlate
   │ └TfrmBase508Form.Create...
   ├QuickAddWith508Msg
   │ └SpeakTextInserted
   └TfrmNotes.UpdateNoteAuthor...

Called-By Hierarchy


              TfrmNotes.cmdChangeClick
             TfrmNotes.InsertNewNote┤ 
          TfrmNotes.mnuActNewClick┤ │ 
       TfrmNotes.cmdNewNoteClick┘ │ │ 
   TfrmNotes.mnuActAddIDEntryClick┘ │ 
            TfrmNotes.InsertAddendum┤ 
       TfrmNotes.mnuActAddendClick┘ │ 
               TfrmNotes.LoadForEdit┤ 
         TfrmNotes.mnuActEditClick┘ │ 
         TfrmNotes.mnuActChangeClick┤ 
          TfrmNotes.UpdateNoteAuthor┘ 
        TfrmNotes.InsertNewNote...┤   
                  AssignBoilerText┤   
 TfrmNotes.mnuActLoadBoilerClick┘ │   
   TfrmNotes.cmdChangeClick...┘   │   
TfrmNotes.mnuActLoadBoilerClick...┘   

Calls

Name Declaration Comments
ExecuteNoteProperties function ExecuteNoteProperties(var ANote: TEditNoteRec; CallingTab: integer; IDNoteTitlesOnly, IsNewIDEntry: boolean; AClassName: string; CPStatusFlag: integer): Boolean; -
GetConsultOrderIEN function GetConsultOrderIEN(ConsultIEN: integer): string; -
TfrmNotes.GetTitleText function GetTitleText(AnIndex: Integer): string; -
TfrmNotes.LockConsultRequest function LockConsultRequest(AConsult: Integer): Boolean; -
MakeNoteDisplayText function MakeNoteDisplayText(RawText: string): string; -
TfrmNotes.mnuActLoadBoilerClick procedure mnuActLoadBoilerClick(Sender: TObject); -
TChanges.ReplaceSignState procedure ReplaceSignState(ItemType: Integer; const AnID: string; NewState: Integer); -
TChanges.ReplaceText procedure ReplaceText(ItemType: Integer; const AnID, NewText: string); -
UnlockOrderIfAble procedure UnlockOrderIfAble(OrderID: string); -

Called-By

Name Declaration Comments
TfrmNotes.InsertAddendum procedure InsertAddendum; -
TfrmNotes.InsertNewNote procedure InsertNewNote(IsIDChild: boolean; AnIDParent: integer); -
TfrmNotes.LoadForEdit procedure LoadForEdit; -
TfrmNotes.mnuActChangeClick procedure mnuActChangeClick(Sender: TObject); -
TfrmNotes.UpdateNoteAuthor procedure UpdateNoteAuthor(DocInfo: string); -


Source

1522  procedure TfrmNotes.cmdChangeClick(Sender: TObject);
1523  var
1524    LastTitle, LastConsult: Integer;
1525    OKPressed, IsIDChild: Boolean;
1526    x: string;
1527    DisAssoText : String;
1528  begin
1529    inherited;
1530    IsIDChild := uIDNotesActive and (FEditNote.IDParent > 0);
1531    LastTitle   := FEditNote.Title;
1532    FEditNote.IsNewNote := False;
1533    DisAssoText := '';
1534    if (FEditNote.PkgPtr = PKG_CONSULTS) then
1535      DisAssoText := 'Consults';
1536    if (FEditNote.PkgPtr = PKG_PRF) then
1537      DisAssoText := 'Patient Record Flags';
1538    if (DisAssoText <> '') and (Sender <> Self) then
1539      if InfoBox('If this title is changed, Any '+DisAssoText+' will be disassociated'+
1540                 ' with this note',
1541                 'Disassociate '+DisAssoText+'?',MB_OKCANCEL) = IDCANCEL	 then
1542        exit;
1543    if FEditNote.PkgPtr = PKG_CONSULTS then LastConsult := FEditNote.PkgIEN else LastConsult := 0;;
1544    if Sender <> Self then OKPressed := ExecuteNoteProperties(FEditNote, CT_NOTES, IsIDChild, FNewIDChild, '', 0)
1545      else OKPressed := True;
1546    if not OKPressed then Exit;
1547    // update display fields & uPCEEdit
1548    lblNewTitle.Caption := ' ' + FEditNote.TitleName + ' ';
1549    if (FEditNote.Addend > 0) and (CompareText(Copy(lblNewTitle.Caption, 2, 8), 'Addendum') <> 0)
1550      then lblNewTitle.Caption := ' Addendum to:' + lblNewTitle.Caption;
1551    with lblNewTitle do bvlNewTitle.SetBounds(Left - 1, Top - 1, Width + 2, Height + 2);
1552    lblRefDate.Caption := FormatFMDateTime('mmm dd,yyyy@hh:nn', FEditNote.DateTime);
1553    lblAuthor.Caption  := FEditNote.AuthorName;
1554    if uPCEEdit.Inpatient then x := 'Adm: ' else x := 'Vst: ';
1555    x := x + FormatFMDateTime('mm/dd/yy', FEditNote.VisitDate) + '  ' + FEditNote.LocationName;
1556    lblVisit.Caption   := x;
1557    if Length(FEditNote.CosignerName) > 0
1558      then lblCosigner.Caption := 'Expected Cosigner: ' + FEditNote.CosignerName
1559      else lblCosigner.Caption := '';
1560    uPCEEdit.NoteTitle  := FEditNote.Title;
1561    // modify signature requirements if author or cosigner changed
1562    if (User.DUZ <> FEditNote.Author) and (User.DUZ <> FEditNote.Cosigner)
1563      then Changes.ReplaceSignState(CH_DOC, lstNotes.ItemID, CH_SIGN_NA)
1564      else Changes.ReplaceSignState(CH_DOC, lstNotes.ItemID, CH_SIGN_YES);
1565    x := lstNotes.Items[EditingIndex];
1566    SetPiece(x, U, 2, lblNewTitle.Caption);
1567    SetPiece(x, U, 3, FloatToStr(FEditNote.DateTime));
1568    tvNotes.Selected.Text := MakeNoteDisplayText(x);
1569    TORTreeNode(tvNotes.Selected).StringData := x;
1570    lstNotes.Items[EditingIndex] := x;
1571    Changes.ReplaceText(CH_DOC, lstNotes.ItemID, GetTitleText(EditingIndex));
1572    with FEditNote do
1573    begin
1574    if (PkgPtr = PKG_CONSULTS) and (LastConsult <> PkgIEN) then
1575    begin
1576      // try to lock the new consult, reset to previous if unable
1577      if (PkgIEN > 0) and not LockConsultRequest(PkgIEN) then
1578      begin
1579        Infobox(TX_NO_ORD_CHG, TC_NO_ORD_CHG, MB_OK);
1580        PkgIEN := LastConsult;
1581      end else
1582      begin
1583        // unlock the previous consult
1584        if LastConsult > 0 then UnlockOrderIfAble(GetConsultOrderIEN(LastConsult));
1585        if PkgIEN = 0 then FOrderID := '';
1586      end;
1587    end;
1588    //Link Note to PRF Action
1589    if PRF_IEN <> 0 then
1590      if sCallV('TIU LINK TO FLAG', [lstNotes.ItemIEN,PRF_IEN,ActionIEN,Patient.DFN]) = '0' then
1591        ShowMsg('TIU LINK TO FLAG: FAILED');
1592    end;
1593  
1594    if LastTitle <> FEditNote.Title then mnuActLoadBoilerClick(Self);
1595  end;