BTPWTIAD ;VNGT/HS/ALA-Create an Addendum to a Note ; 07 Jun 2010 6:54 AM
;;1.0;CARE MANAGEMENT EVENT TRACKING;;Feb 07, 2011
;
;
EN(NDATA,TIUDA,TEXT) ; EP -- BTPW TIU ADDENDUM
; Input
; TIUDA - IEN of the original document
; TEXT - TEXT of the addendum to be created
NEW UID,II,TIUX,RESULT
S II=0
;
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BTPWTINT D UNWIND^%ZTER" ; SAC 2006 2.2.3
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S NDATA=$NA(^TMP("BTPWTIAD",UID))
K @NDATA
S TIUX(1202)=DUZ
S TIUX(1301)=$$NOW^XLFDT()
S @NDATA@(II)="I00010RESULT^T01024MSG^I00010ADIEN"_$C(30)
;
S TEXT=$G(TEXT,"")
I TEXT="" D
. N LIST,BN
. S LIST="",BN=""
. F S BN=$O(TEXT(BN)) Q:BN="" S LIST=LIST_TEXT(BN)
. K TEXT
. S TEXT=LIST
. K LIST
;
;Define Addendum Text
I TEXT'="" F I=1:1:$L(TEXT,$C(10)) S TIUX("TEXT",I,0)=$P(TEXT,$C(10),I)
I '$D(TIUX("TEXT")) S TIUX("TEXT",1,0)="CMET Notification marked as Entered in Error"
;
D MAKEADD^TIUSRVP(.RESULT,TIUDA,.TIUX,1)
I $P(RESULT,U,1)=0 D Q
. S II=II+1,@NDATA@(II)="-1^"_$P(RESULT,U,2)_$C(30)
. S II=II+1,@NDATA@(II)=$C(31)
S II=II+1,@NDATA@(II)="1^^"_$P(RESULT,U,1)_$C(30)
S II=II+1,@NDATA@(II)=$C(31)
Q
BTPWTIAD ;VNGT/HS/ALA-Create an Addendum to a Note ; 07 Jun 2010 6:54 AM
+1 ;;1.0;CARE MANAGEMENT EVENT TRACKING;;Feb 07, 2011
+2 ;
+3 ;
EN(NDATA,TIUDA,TEXT) ; EP -- BTPW TIU ADDENDUM
+1 ; Input
+2 ; TIUDA - IEN of the original document
+3 ; TEXT - TEXT of the addendum to be created
+4 NEW UID,II,TIUX,RESULT
+5 SET II=0
+6 ;
+7 ; SAC 2006 2.2.3
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BTPWTINT D UNWIND^%ZTER"
+8 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+9 SET NDATA=$NAME(^TMP("BTPWTIAD",UID))
+10 KILL @NDATA
+11 SET TIUX(1202)=DUZ
+12 SET TIUX(1301)=$$NOW^XLFDT()
+13 SET @NDATA@(II)="I00010RESULT^T01024MSG^I00010ADIEN"_$CHAR(30)
+14 ;
+15 SET TEXT=$GET(TEXT,"")
+16 IF TEXT=""
Begin DoDot:1
+17 NEW LIST,BN
+18 SET LIST=""
SET BN=""
+19 FOR
SET BN=$ORDER(TEXT(BN))
IF BN=""
QUIT
SET LIST=LIST_TEXT(BN)
+20 KILL TEXT
+21 SET TEXT=LIST
+22 KILL LIST
End DoDot:1
+23 ;
+24 ;Define Addendum Text
+25 IF TEXT'=""
FOR I=1:1:$LENGTH(TEXT,$CHAR(10))
SET TIUX("TEXT",I,0)=$PIECE(TEXT,$CHAR(10),I)
+26 IF '$DATA(TIUX("TEXT"))
SET TIUX("TEXT",1,0)="CMET Notification marked as Entered in Error"
+27 ;
+28 DO MAKEADD^TIUSRVP(.RESULT,TIUDA,.TIUX,1)
+29 IF $PIECE(RESULT,U,1)=0
Begin DoDot:1
+30 SET II=II+1
SET @NDATA@(II)="-1^"_$PIECE(RESULT,U,2)_$CHAR(30)
+31 SET II=II+1
SET @NDATA@(II)=$CHAR(31)
End DoDot:1
QUIT
+32 SET II=II+1
SET @NDATA@(II)="1^^"_$PIECE(RESULT,U,1)_$CHAR(30)
+33 SET II=II+1
SET @NDATA@(II)=$CHAR(31)
+34 QUIT