Procedure

TfrmDCSumm.InsertAddendum

Module

fDCSumm

Last Modified

7/15/2014 3:26:36 PM

Comments

Sets up fields of pnlWrite to write an addendum for the selected Summary

Visibility

Private

Owner

TfrmDCSumm

Declaration

procedure InsertAddendum;

Calls Hierarchy


TfrmDCSumm.InsertAddendum
 ├TfrmDCSumm.ClearEditControls
 │ ├TPCEData.Clear
 │ │ ├ClearList
 │ │ ├TPCEProc.Clear
 │ │ │ └TPCEItem.Clear
 │ │ │   └TPCEItem.SetComment
 │ │ └TPCEProviderList.Clear
 │ │   └TPCEProviderList.GetPrimaryIdx
 │ └TfrmDCSumm.SetEditingIndex
 ├TitleForNote
 ├FMNow
 ├TfrmDCSumm.LacksRequiredForCreate
 │ ├AskCosignerForDocument
 │ │ └TIUPatch175Installed
 │ │   └ServerHasPatch
 │ └AskCosignerForTitle
 │   └TIUPatch175Installed...
 ├ExecuteDCSummProperties
 │ ├TfrmBase508Form.Create
 │ │ ├TfrmBase508Form.UpdateAccessibilityActions
 │ │ ├UnfocusableControlEnter
 │ │ └AdjustControls
 │ │   ├TfrmBase508Form.ModifyUnfocusableControl
 │ │   └..(rec)..
 │ ├ListDCSummTitlesShort
 │ │ └LoadDCSummTitles
 │ │   └TDCSummTitles.Create
 │ ├LoadDCUrgencies
 │ ├TfrmDCSummProperties.ShowAdmissionList
 │ │ └ListAdmitAll
 │ ├PrintNameForTitle
 │ ├StrToFMDateTime
 │ ├GetDischargeDate
 │ ├FMNow
 │ └GetTIUListItem
 ├TPCEData.PCEForNote
 │ ├TEncounter.GetVisitStr
 │ │ └TEncounter.GetVisitCategory
 │ ├VisitStrForNote
 │ ├TPCEData.GetVisitString
 │ │ └TPCEData.VisitDateTime
 │ │   └TPCEData.IsSecondaryVisit
 │ ├TPCEData.CopyPCEData
 │ │ ├TPCEData.Clear...
 │ │ ├TPCEProc.CopyProc
 │ │ │ └TPCEItem.SetComment
 │ │ ├TPCEProviderList.Assign
 │ │ └TPCEData.CopyPCEItems
 │ │   └TPCEItem.Assign
 │ │     └TPCEItem.SetComment
 │ ├TPCEData.IsSecondaryVisit
 │ ├GetLocSecondaryVisitCode
 │ ├TPCEData.Clear...
 │ ├LoadPCEDataForNote
 │ ├ListVisitTypeByLoc
 │ ├SetRPCEncLocation
 │ ├SCCValue
 │ ├TPCEProviderList.Add
 │ │ ├TPCEProviderList.GetPrimaryIdx
 │ │ ├TPCEProviderList.IndexOfProvider
 │ │ └TPCEProviderList.SetPrimaryIdx
 │ │   ├TPCEProviderList.GetPrimaryIdx
 │ │   └TPCEProviderList.SetPrimary
 │ ├AppendComment
 │ ├TPCEDiag.SetFromString
 │ │ └TPCEItem.SetFromString
 │ │   └TPCEItem.SetComment
 │ ├TPCEProc.SetFromString
 │ │ └TPCEItem.SetFromString...
 │ ├TPCEImm.SetFromString
 │ │ └TPCEItem.SetFromString...
 │ ├TPCESkin.SetFromString
 │ │ ├TPCEItem.SetFromString...
 │ │ └StrToFMDateTime
 │ ├TPCEPat.SetFromString
 │ │ └TPCEItem.SetFromString...
 │ ├TPCEHealth.SetFromString
 │ │ └TPCEItem.SetFromString...
 │ └TPCEExams.SetFromString
 │   └TPCEItem.SetFromString...
 ├ExternalName
 ├StrToFMDateTime
 ├GetDischargeDate
 ├PutDCAddendum
 │ └SetText
 │   └InitParams
 ├LockDocument
 ├MakeDCSummTreeObject
 │ └MakeDCSummDisplayText
 ├MakeDCSummDisplayText
 ├TChanges.Add
 │ └TChangeItem.Create
 ├TfrmDCSumm.GetTitleText
 ├TfrmDCSumm.SetEditingIndex
 ├TfrmDCSumm.cmdChangeClick
 │ ├ExecuteDCSummProperties...
 │ ├TChanges.ReplaceSignState
 │ ├MakeDCSummDisplayText
 │ ├TChanges.ReplaceText
 │ ├TfrmDCSumm.GetTitleText
 │ └TfrmDCSumm.mnuActLoadBoilerClick
 │   ├TfrmDCSumm.NoSummSelected
 │   ├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
 │   ├QueryBoilerPlate
 │   │ └TfrmBase508Form.Create...
 │   └QuickAddWith508Msg
 │     └SpeakTextInserted
 └TfrmDCSumm.lstSummsClick
   ├MakeDCSummDisplayText
   ├LoadDocumentText
   ├TfrmDCSumm.DisplayPCE
   │ ├TPCEData.AddStrData
   │ │ ├Add
   │ │ ├TPCEData.StrVisitType
   │ │ │ ├GetPCEDataText
   │ │ │ │ └GetDiagnosisText
   │ │ │ ├TPCEProc.ModText
   │ │ │ │ └ModifierName
   │ │ │ │   └ModifierIdx
   │ │ │ │     ├TPCEData.VisitDateTime...
   │ │ │ │     ├FMToday
   │ │ │ │     │ └FMNow
   │ │ │ │     └MixedCaseModifier
   │ │ │ └TPCEData.StrVisitType
   │ │ │   └AddTxt
   │ │ ├TPCEData.StrDiagnoses
   │ │ │ └GetPCEDataText...
   │ │ ├TPCEData.StrProcedures
   │ │ │ ├GetPCEDataText...
   │ │ │ └TPCEProc.ModText...
   │ │ ├TPCEData.StrImmunizations
   │ │ │ └GetPCEDataText...
   │ │ ├TPCEData.StrSkinTests
   │ │ │ └GetPCEDataText...
   │ │ ├TPCEData.StrPatientEds
   │ │ │ └GetPCEDataText...
   │ │ ├TPCEData.StrHealthFactors
   │ │ │ └GetPCEDataText...
   │ │ └TPCEData.StrExams
   │ │   └GetPCEDataText...
   │ ├GetVitalsFromDate
   │ │ ├TPCEData.IsSecondaryVisit
   │ │ └GetVitalsFromEncDateTime
   │ ├TPCEData.AddVitalData
   │ │ └FormatVitalForNote
   │ │   └ConvertVitalData
   │ ├CanEditPCE
   │ │ ├GetAskPCE
   │ │ └FutureEncounter
   │ │   └FMToday...
   │ ├TfrmDCSumm.ShowPCEControls
   │ ├TfrmDrawers.DisplayDrawers
   │ │ └..(rec)..
   │ ├ActOnDocument
   │ ├TPCEData.PCEForNote...
   │ └GetVitalsFromNote
   │   ├TPCEData.IsSecondaryVisit
   │   ├GetVitalsFromEncDateTime
   │   └GetVitalFromNoteIEN
   └NotifyOtherApps
     ├AppNotificationEnabled
     │ └TNotifyAppsThread.CreateThread
     └TNotifyAppsThread.ResumeIfIdle

Called-By Hierarchy


     TfrmDCSumm.InsertAddendum
TfrmDCSumm.mnuActAddendClick┘ 

Calls

Name Declaration Comments
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); -
TfrmDCSumm.ClearEditControls procedure ClearEditControls; -
TfrmDCSumm.cmdChangeClick procedure cmdChangeClick(Sender: TObject); -
ExecuteDCSummProperties function ExecuteDCSummProperties(var ASumm: TEditDCSummRec; var ListBoxItem: string; ShowAdmissions, IDNoteTitlesOnly: boolean): Boolean; -
ExternalName function ExternalName(IEN: Int64; FileNumber: Double): string; -
FMNow function FMNow: TFMDateTime; -
GetDischargeDate function GetDischargeDate(const DFN: string; AdmitDateTime: string): string; -
TfrmDCSumm.GetTitleText function GetTitleText(AnIndex: Integer): string; -
TfrmDCSumm.LacksRequiredForCreate function LacksRequiredForCreate: Boolean; -
LockDocument procedure LockDocument(IEN: Int64; var AnErrMsg: string); -
TfrmDCSumm.lstSummsClick procedure lstSummsClick(Sender: TObject); -
MakeDCSummDisplayText function MakeDCSummDisplayText(RawText: string): string; -
MakeDCSummTreeObject function MakeDCSummTreeObject(x: string): PDocTreeObject; -
TPCEData.PCEForNote procedure PCEForNote(NoteIEN: Integer; EditObj: TPCEData);(* overload; -
PutDCAddendum procedure PutDCAddendum(var CreatedDoc: TCreatedDoc; const DCSummRec: TDCSummRec; AddendumTo: Integer); -
TfrmDCSumm.SetEditingIndex procedure SetEditingIndex(const Value: Integer); -
StrToFMDateTime function StrToFMDateTime(const AString: string): TFMDateTime; -
TitleForNote function TitleForNote(IEN: Int64): Integer; -

Called-By

Name Declaration Comments
TfrmDCSumm.mnuActAddendClick procedure mnuActAddendClick(Sender: TObject); -


Source

853   procedure TfrmDCSumm.InsertAddendum;
854   { sets up fields of pnlWrite to write an addendum for the selected Summary}
855   const
856     AS_ADDENDUM = True;
857     IS_ID_CHILD = False;
858   var
859     HaveRequired: Boolean;
860     CreatedSumm: TCreatedDoc;
861     ListItemForEdit: string;
862     tmpNode: TTreeNode;
863     x: string;
864   begin
865     ClearEditControls;
866     FShowAdmissions := False;
867     with FEditDCSumm do
868     begin
869       DocType          := TYP_ADDENDUM;
870       Title            := TitleForNote(lstSumms.ItemIEN);
871       TitleName        := Piece(lstSumms.Items[lstSumms.ItemIndex], U, 2);
872       if Copy(TitleName,1,1) = '+' then TitleName := Copy(TitleName, 3, 199);
873       DictDateTime     := FMNow;
874       Dictator         := User.DUZ;
875       DictatorName     := User.Name;
876       Addend           := lstSumms.ItemIEN;
877     end;
878     // check to see if interaction necessary to get required fields
879     if LacksRequiredForCreate
880       then HaveRequired := ExecuteDCSummProperties(FEditDCSumm, ListItemForEdit, FShowAdmissions, IS_ID_CHILD)
881       else HaveRequired := True;
882     if HaveRequired then
883     begin
884       with FEditDCSumm do
885         begin
886           uPCEEdit.NoteDateTime := DischargeDateTime;
887           uPCEEdit.PCEForNote(Addend, uPCEShow);
888           Location     := uPCEEdit.Location;
889           LocationName := ExternalName(uPCEEdit.Location, 44);
890           AdmitDateTime    := uPCEEdit.DateTime;
891           DischargeDateTime := StrToFMDateTime(GetDischargeDate(Patient.DFN, FloatToStr(AdmitDateTime)));
892           if DischargeDateTime <= 0 then DischargeDateTime := FMNow;
893         end;
894       PutDCAddendum(CreatedSumm, FEditDCSumm, FEditDCSumm.Addend);
895       uPCEEdit.NoteIEN := CreatedSumm.IEN;
896       if CreatedSumm.IEN > 0 then LockDocument(CreatedSumm.IEN, CreatedSumm.ErrorText);
897       if CreatedSumm.ErrorText = '' then
898       begin
899         with FEditDCSumm do
900           begin
901             x := IntToStr(CreatedSumm.IEN) + U + 'Addendum to ' + TitleName + U + FloatToStr(DischargeDateTime) + U +
902                  Patient.Name + U + IntToStr(Dictator) + ';' + DictatorName + U + LocationName + U + 'new' + U +
903                  'Adm: ' + FormatFMDateTime('mmm dd,yyyy', AdmitDateTime) + ';' + FloatToStr(AdmitDateTime) + U +
904                  'Dis: ' + FormatFMDateTime('mmm dd,yyyy', DischargeDateTime) + ';' + FloatToStr(DischargeDateTime) +
905                  U + U + U + U + U + U;
906           end;
907         lstSumms.Items.Insert(0, x);
908         uChanging := True;
909         tvSumms.Items.BeginUpdate;
910         tmpNode := tvSumms.Items.AddObjectFirst(tvSumms.Items.GetFirstNode, 'New Addendum in Progress',
911                                                 MakeDCSummTreeObject('ADDENDUM^New Addendum in Progress^^^^^^^^^^^%^0'));
912         TORTreeNode(tmpNode).StringData := 'ADDENDUM^New Addendum in Progress^^^^^^^^^^^%^0';
913         tmpNode.ImageIndex := IMG_TOP_LEVEL;
914         tmpNode := tvSumms.Items.AddChildObjectFirst(tmpNode, MakeDCSummDisplayText(x), MakeDCSummTreeObject(x));
915         TORTreeNode(tmpNode).StringData := x;
916         tmpNode.ImageIndex := IMG_ADDENDUM;
917         tmpNode.SelectedIndex := IMG_ADDENDUM;
918         tvSumms.Selected := tmpNode;
919         tvSumms.Items.EndUpdate;
920         uChanging := False;
921         Changes.Add(CH_SUM, IntToStr(CreatedSumm.IEN), GetTitleText(0), '', CH_SIGN_YES);
922         lstSumms.ItemIndex := 0;
923         EditingIndex := 0;
924         cmdChangeClick(Self); // will set captions, sign state for Changes
925         lstSummsClick(Self);  // will make pnlWrite visible
926         if timAutoSave.Interval <> 0 then timAutoSave.Enabled := True;
927         memNewSumm.SetFocus;
928       end else
929       begin
930         InfoBox(CreatedSumm.ErrorText, TX_CREATE_ERR, MB_OK);
931         HaveRequired := False;
932       end; {if CreatedNote.IEN}
933     end; {if HaveRequired}
934     if not HaveRequired then ClearEditControls;
935   end;