BEHOTIUI ;MSC/IND/DKM - TIU inits;21-Nov-2007 11:56;DKM
;;1.1;BEH COMPONENTS;**015002**;Sep 18, 2007
;=================================================================
; Pre-init
PRE Q
; Post-init
POST N CCIEN,STIEN
D REGMENU^BEHUTIL("BEHOTI MAIN",,"TIU")
D REGMENU^BEHUTIL("BTIU MENU1",,"CLN","BEHOTI MAIN")
D REGMENU^BEHUTIL("BTIU MENU2",,"HIS","BEHOTI MAIN")
S CCIEN=$$FIND1^DIC(8930,,"X","CLINICAL COORDINATOR")
S STIEN=$$FIND1^DIC(8925.6,,"X","ACTIVE")
I $$NEWDEF("ANNOTATIONS","DC","PROGRESS NOTES"),$$NEWDEF("ANNOTATION","DOC","ANNOTATIONS")
Q
; Create document definition if does not exist
NEWDEF(NAME,TYPE,PARENT) ;
N IEN,FDA
S PARENT=$$FIND1^DIC(8925.1,,"X",PARENT)
S IEN=$$FIND1^DIC(8925.1,,"X",NAME)
I 'IEN D
.S FDA=$NA(FDA(8925.1,"+1,"))
.S @FDA@(.01)=NAME
.S @FDA@(.03)=NAME
.S @FDA@(.04)=TYPE
.S @FDA@(.06)=CCIEN
.S @FDA@(.07)=STIEN
.S @FDA@(3.02)=1
.S @FDA@(99)=$H
.S IEN=$$UPDATE("The following error occurred while trying to create document definition "_NAME_":")
I IEN,PARENT,'$D(^TIU(8925.1,PARENT,10,"B",IEN)) D
.S FDA=$NA(FDA(8925.14,"+1,"_PARENT_","))
.S @FDA@(.01)=IEN
.S @FDA@(2)="ANN"
.I $$UPDATE("The following error occurred while trying to set the parent for document definition "_NAME_":")
Q IEN
UPDATE(ERR) ;
N IEN,MSG
D UPDATE^DIE("","FDA","IEN","MSG")
I $D(MSG("DIERR")) D
.D BMES^XPDUTL(ERR)
.S MSG=""
.F S MSG=$O(MSG("DIERR",1,"TEXT",MSG)) Q:MSG="" D MES^XPDUTL(MSG("DIERR",1,"TEXT",MSG))
.S IEN=0
E S IEN=IEN(1)
K FDA
Q IEN
BEHOTIUI ;MSC/IND/DKM - TIU inits;21-Nov-2007 11:56;DKM
+1 ;;1.1;BEH COMPONENTS;**015002**;Sep 18, 2007
+2 ;=================================================================
+3 ; Pre-init
PRE QUIT
+1 ; Post-init
POST NEW CCIEN,STIEN
+1 DO REGMENU^BEHUTIL("BEHOTI MAIN",,"TIU")
+2 DO REGMENU^BEHUTIL("BTIU MENU1",,"CLN","BEHOTI MAIN")
+3 DO REGMENU^BEHUTIL("BTIU MENU2",,"HIS","BEHOTI MAIN")
+4 SET CCIEN=$$FIND1^DIC(8930,,"X","CLINICAL COORDINATOR")
+5 SET STIEN=$$FIND1^DIC(8925.6,,"X","ACTIVE")
+6 IF $$NEWDEF("ANNOTATIONS","DC","PROGRESS NOTES")
IF $$NEWDEF("ANNOTATION","DOC","ANNOTATIONS")
+7 QUIT
+8 ; Create document definition if does not exist
NEWDEF(NAME,TYPE,PARENT) ;
+1 NEW IEN,FDA
+2 SET PARENT=$$FIND1^DIC(8925.1,,"X",PARENT)
+3 SET IEN=$$FIND1^DIC(8925.1,,"X",NAME)
+4 IF 'IEN
Begin DoDot:1
+5 SET FDA=$NAME(FDA(8925.1,"+1,"))
+6 SET @FDA@(.01)=NAME
+7 SET @FDA@(.03)=NAME
+8 SET @FDA@(.04)=TYPE
+9 SET @FDA@(.06)=CCIEN
+10 SET @FDA@(.07)=STIEN
+11 SET @FDA@(3.02)=1
+12 SET @FDA@(99)=$HOROLOG
+13 SET IEN=$$UPDATE("The following error occurred while trying to create document definition "_NAME_":")
End DoDot:1
+14 IF IEN
IF PARENT
IF '$DATA(^TIU(8925.1,PARENT,10,"B",IEN))
Begin DoDot:1
+15 SET FDA=$NAME(FDA(8925.14,"+1,"_PARENT_","))
+16 SET @FDA@(.01)=IEN
+17 SET @FDA@(2)="ANN"
+18 IF $$UPDATE("The following error occurred while trying to set the parent for document definition "_NAME_":")
End DoDot:1
+19 QUIT IEN
UPDATE(ERR) ;
+1 NEW IEN,MSG
+2 DO UPDATE^DIE("","FDA","IEN","MSG")
+3 IF $DATA(MSG("DIERR"))
Begin DoDot:1
+4 DO BMES^XPDUTL(ERR)
+5 SET MSG=""
+6 FOR
SET MSG=$ORDER(MSG("DIERR",1,"TEXT",MSG))
IF MSG=""
QUIT
DO MES^XPDUTL(MSG("DIERR",1,"TEXT",MSG))
+7 SET IEN=0
End DoDot:1
+8 IF '$TEST
SET IEN=IEN(1)
+9 KILL FDA
+10 QUIT IEN