MAGGNTI1 ;WOIFO/GEK - Imaging interface to TIU. RPC Calls etc. ; 04 Apr 2002 2:37 PM
;;3.0;IMAGING;**46,59**;Nov 27, 2007;Build 20
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
NEW(MAGRY,MAGDFN,MAGTITLE,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGLOC,MAGDATE,MAGCNSLT,MAGTEXT) ;RPC [MAG3 TIU NEW]
;
; RPC call to create a New Note
; and Optionally :
; Electronically Sign,
; Administratively Close
; or Add Text to the Note.
;
; - - - Required - - -
; MAGDFN - Patient DFN
; MAGTITLE - IEN of TIU Document Title in file 8925.1
; - - - Optional - - -
; Use DUZ for TIUAUTH
; Use NOW for TIURDT
; MAGTEXT - Array of Text to add to the New Note.
; MAGLOC - IEN in Hospital Location File 44
; MAGES - The encrypted Electronic Signature
; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
; MAGADCL - 1 = Mark this Note as Administratively Closed
; MAGMODE - Mode of Admin Closure: "S" = Scanned Document
; "M" = Manual closure, "E" = Electronically Filed
; MAGDATE - Date of the Note. For New Notes.
; MAGCNSLT - DA of Consult to Link to.
;
N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
S MAGDFN=$G(MAGDFN),MAGTITLE=$G(MAGTITLE),MAGLOC=$G(MAGLOC)
S MAGES=$G(MAGES),MAGADCL=$G(MAGADCL)
S MAGESBY=$S($G(MAGESBY):MAGESBY,1:DUZ)
S MAGMODE=$S($L($G(MAGMODE)):MAGMODE,1:"S")
S MAGDATE=$G(MAGDATE),MAGCNSLT=$G(MAGCNSLT)
N MAGTIUDA,I,NODE,MAGTY,ISVAL,MAGISC,MTXT,MUPD,MAGX,MAGVSTR,MAGTIUX
;
; MAGMODE is only sent if Admin Closure is wanted.
I (MAGMODE="S") S MAGTEXT(.1)=" VistA Imaging - Scanned Document"
I (MAGMODE="M") S MAGTEXT(.1)=" VistA Imaging - Manual Closure"
I "MSE"'[MAGMODE S MAGRY="0^Invalid Mode of Closure: """_MAGMODE_"""" Q
;
; Here if we have no Text, we'll add at least a line.
I $O(MAGTEXT(""))="" S MAGTEXT(.1)=" VistA Imaging - - Scanned Document"
; Reformat Text - "TEXT",i,0)" for TIU Call.
S I="",NODE=0
F S I=$O(MAGTEXT(I)) Q:I="" D
. S NODE=NODE+1 S MAGTIUX("TEXT",NODE,0)=MAGTEXT(I)
. Q
; validate the DFN
I '$D(^DPT(+MAGDFN,0)) S MAGRY="0^Invalid data: Patient DFN is invalid" Q
; validate the User
I '$D(^VA(200,MAGESBY,0)) S MAGRY="0^Invalid data: Author DUZ is invalid" Q
; validate the TIU TITLE
I '$D(^TIU(8925.1,MAGTITLE,0)) S MAGRY="0^Invalid data: Note TITLE is invalid" Q
; validate Esig first, if caller wants to also mark this Note as Signed
I +$G(MAGES) I '$$VALES^MAGGNTI2(MAGES) S MAGRY="0^Invalid data: E-sign is invalid" Q
; validate the Date MAGDATE is changed to INternal if it is valid.
I +$L(MAGDATE) I '$$VALID^MAGGSIV1(8925,1301,.MAGDATE,.MAGX) S MAGRY="0^"_MAGX Q
I '$L(MAGDATE) S MAGDATE=$$NOW^XLFDT
; LINK TO CONSULT
; can user create Notes with This Title
I '$$CANENTR^TIULP(MAGTITLE) S MAGRY="0^You need privileges to enter notes of that Title" Q
;
D ISCNSLT^TIUCNSLT(.MAGISC,MAGTITLE)
I MAGISC D I 'MAGISC S MAGRY=MAGISC Q
. ; See if a Consult DA was sent.
. IF 'MAGCNSLT S MAGISC="0^A Consult is needed to link to this note title"
. Q
I ('MAGISC)&(MAGCNSLT) S MAGRY="0^Cannot Link Consult with a Non Consult Title" Q
;
; make a VSTR for TIU Call.
S MAGVSTR=MAGLOC_";"_MAGDATE_";E"
;
; Call to NEW^TIUPNAPI wasn't doing what we needed. Now call TIU CREATE RECORD
; MAKE(SUCCESS,DFN,TITLE,VDT,VLOC,VSIT,TIUX,VSTR,SUPPRESS,NOASF)
D MAKE^TIUSRVP(.MAGTIUDA,MAGDFN,MAGTITLE,"",MAGLOC,"",.MAGTIUX,MAGVSTR)
I 'MAGTIUDA!(MAGTIUDA=-1) S MAGRY="0^Error creating Note"_$G(MAGTIUDA) Q
S MAGRY=MAGTIUDA_"^Note was created."
S MAGTY=MAGRY
;
; ;Put in the Date that was sent.
I '$$VALID^MAGGSIV1(8925,1301,.MAGDATE,.MAGRES) S MAGRY=MAGRY_" "_MAGRES
E S MTXT(1301)=MAGDATE
; - Fix in T30, if DUZ isn't MAGESBY, we have Author different than User.
I MAGESBY'=DUZ S MTXT("1202")=MAGESBY
; Update and LINK TO CONSULT if needed.
I MAGISC S MTXT("1405")=MAGCNSLT_";GMR(123,"
I $D(MTXT) D I 'MUPD S MAGRY=MUPD Q
. D UPDATE^TIUSRVP(.MUPD,MAGTIUDA,.MTXT)
. Q
;
; If Admin Close, then We quit.
I MAGADCL="1" D Q
. D ADMNCLOS^MAGGNTI2(.MAGTY,MAGDFN,MAGTIUDA,MAGMODE)
. S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_" Administrative Closure.")
. Q
;
; if caller sent esignature to Sign this Note.
I $L(MAGES) D
. D SIGN^MAGGNTI3(.MAGTY,MAGDFN,MAGTIUDA,MAGES,MAGESBY)
. S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_" Signed.")
. Q
Q
;
;(MAGRY,MAGDFN,MAGTITLE,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGLOC,MAGTEXT)
NEWADD(MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGDATE,MAGTEXT) ; RPC [MAG3 TIU CREATE ADDENDUM]
; RPC call to create an Addendum to a Note
; and Optionally :
; Electronically Sign,
; Administratively Close,
; or Add Text to the Addendum
;
; - - - Required - - -
; MAGDFN - Patient DFN
; MAGTIUDA - IEN of TIU NOTE in file 8925
; - - - Optional - - -
; MAGTEXT - Array of Text to add to the New Note.
; MAGES - The encrypted Electronic Signature
; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
; MAGADCL - 1 = Mark this Note as Administratively Closed
; MAGMODE - Mode of Admin Closure: "S" = Scanned Document "M" = Manual closure "E" = Electronically Filed
; MAGDATE - Date of the Addendum.
;
N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
S MAGDFN=$G(MAGDFN),MAGTIUDA=$G(MAGTIUDA),MAGES=$G(MAGES),MAGADCL=$G(MAGADCL)
S MAGESBY=$S($G(MAGESBY):MAGESBY,1:DUZ),MAGMODE=$S($L($G(MAGMODE)):MAGMODE,1:"S")
S MAGDATE=$G(MAGDATE)
;
I '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA) Q
N MAGXT,I,CT,NEWTIUDA,MAGY,MAGRES,MAGUPD
S CT=1,I=""
S MAGXT("TEXT",1,0)="VistA Imaging Scanned Document - Addendum."
I $D(MAGTEXT) F S I=$O(MAGTEXT(I)) Q:I="" D
. S CT=CT+1,MAGXT("TEXT",CT,0)=MAGTEXT(I)
. Q
;
; Calling TIU CREATE ADDENDUM RECORD
D MAKEADD^TIUSRVP(.MAGRY,MAGTIUDA,.MAGXT)
; MAGRY could be 0^error message
; -1^message
; TIUDA
I $P(MAGRY,"^")<0 S $P(MAGRY,"^")=0 Q
S NEWTIUDA=+MAGRY
S MAGRY=MAGRY_"^Addendum was created."
;
;Put in the Date that was sent.
K MAGUPD
I '$$VALID^MAGGSIV1(8925,1301,.MAGDATE,.MAGRES) S MAGRY=MAGRY_" "_MAGRES
E D
. S MAGUPD(1301)=MAGDATE
. S MAGUPD(1211)=$$GET1^DIQ(8925,1211,MAGTIUDA,"I")
; - Fix in T30, if DUZ isn't MAGESBY, we have Author different than User.
I MAGESBY'=DUZ S MAGUPD("1202")=MAGESBY
I $D(MAGUPD) D
. D UPDATE^TIUSRVP(.MAGY,NEWTIUDA,.MAGUPD)
. I 'MAGY S MAGRY=MAGRY_" TIU Data was Not Correctly Filed."
. Q
;
; if caller sent esignature to Sign this Addendum.
I $L(MAGES) D Q
. D SIGN^MAGGNTI3(.MAGTY,MAGDFN,NEWTIUDA,MAGES,MAGESBY)
. S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_" Signed.")
. Q
;
; if caller wants to Admin Close this Addendum.
I MAGADCL="1" D Q
. D ADMNCLOS^MAGGNTI2(.MAGTY,MAGDFN,NEWTIUDA,MAGMODE)
. S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_" Administrative Closure.")
. Q
Q
MOD(MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGTEXT) ; RPC [MAG3 TIU MODIFY NOTE]
; After a Note is filed, we call this to Modify the Note. We do this to sign it.
; That way the Signed Date is After the Image Association Date/Time.
N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
S MAGDFN=$G(MAGDFN),MAGTIUDA=$G(MAGTIUDA)
S MAGADCL=$G(MAGADCL)
S MAGMODE=$S($L($G(MAGMODE)):MAGMODE,1:"S")
S MAGES=$G(MAGES)
S MAGESBY=$S($G(MAGESBY):MAGESBY,1:DUZ)
D MOD^MAGGNTI3(.MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY)
Q
ERR ; ERROR TRAP
N ERR S ERR=$$EC^%ZOSV
S MAGRY="0^ETRAP: "_ERR
D @^%ZOSF("ERRTN")
Q
SIGN(MAGRY,MAGDFN,MAGTIUDA,MAGES,MAGESBY) ;RPC [MAG3 TIU SIGN RECORD]
; RPC Call to 'Sign' a Note.
D SIGN^MAGGNTI3(.MAGRY,$G(MAGDFN),$G(MAGTIUDA),$G(MAGES),$G(MAGESBY))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGNTI1 8903 printed Oct 16, 2024@18:03:17 Page 2
MAGGNTI1 ;WOIFO/GEK - Imaging interface to TIU. RPC Calls etc. ; 04 Apr 2002 2:37 PM
+1 ;;3.0;IMAGING;**46,59**;Nov 27, 2007;Build 20
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | |
+11 ;; | The Food and Drug Administration classifies this software as |
+12 ;; | a medical device. As such, it may not be changed in any way. |
+13 ;; | Modifications to this software may result in an adulterated |
+14 ;; | medical device under 21CFR820, the use of which is considered |
+15 ;; | to be a violation of US Federal Statutes. |
+16 ;; +---------------------------------------------------------------+
+17 ;;
+18 QUIT
NEW(MAGRY,MAGDFN,MAGTITLE,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGLOC,MAGDATE,MAGCNSLT,MAGTEXT) ;RPC [MAG3 TIU NEW]
+1 ;
+2 ; RPC call to create a New Note
+3 ; and Optionally :
+4 ; Electronically Sign,
+5 ; Administratively Close
+6 ; or Add Text to the Note.
+7 ;
+8 ; - - - Required - - -
+9 ; MAGDFN - Patient DFN
+10 ; MAGTITLE - IEN of TIU Document Title in file 8925.1
+11 ; - - - Optional - - -
+12 ; Use DUZ for TIUAUTH
+13 ; Use NOW for TIURDT
+14 ; MAGTEXT - Array of Text to add to the New Note.
+15 ; MAGLOC - IEN in Hospital Location File 44
+16 ; MAGES - The encrypted Electronic Signature
+17 ; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
+18 ; MAGADCL - 1 = Mark this Note as Administratively Closed
+19 ; MAGMODE - Mode of Admin Closure: "S" = Scanned Document
+20 ; "M" = Manual closure, "E" = Electronically Filed
+21 ; MAGDATE - Date of the Note. For New Notes.
+22 ; MAGCNSLT - DA of Consult to Link to.
+23 ;
+24 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^"_$TEXT(+0)
+25 SET MAGDFN=$GET(MAGDFN)
SET MAGTITLE=$GET(MAGTITLE)
SET MAGLOC=$GET(MAGLOC)
+26 SET MAGES=$GET(MAGES)
SET MAGADCL=$GET(MAGADCL)
+27 SET MAGESBY=$SELECT($GET(MAGESBY):MAGESBY,1:DUZ)
+28 SET MAGMODE=$SELECT($LENGTH($GET(MAGMODE)):MAGMODE,1:"S")
+29 SET MAGDATE=$GET(MAGDATE)
SET MAGCNSLT=$GET(MAGCNSLT)
+30 NEW MAGTIUDA,I,NODE,MAGTY,ISVAL,MAGISC,MTXT,MUPD,MAGX,MAGVSTR,MAGTIUX
+31 ;
+32 ; MAGMODE is only sent if Admin Closure is wanted.
+33 IF (MAGMODE="S")
SET MAGTEXT(.1)=" VistA Imaging - Scanned Document"
+34 IF (MAGMODE="M")
SET MAGTEXT(.1)=" VistA Imaging - Manual Closure"
+35 IF "MSE"'[MAGMODE
SET MAGRY="0^Invalid Mode of Closure: """_MAGMODE_""""
QUIT
+36 ;
+37 ; Here if we have no Text, we'll add at least a line.
+38 IF $ORDER(MAGTEXT(""))=""
SET MAGTEXT(.1)=" VistA Imaging - - Scanned Document"
+39 ; Reformat Text - "TEXT",i,0)" for TIU Call.
+40 SET I=""
SET NODE=0
+41 FOR
SET I=$ORDER(MAGTEXT(I))
if I=""
QUIT
Begin DoDot:1
+42 SET NODE=NODE+1
SET MAGTIUX("TEXT",NODE,0)=MAGTEXT(I)
+43 QUIT
End DoDot:1
+44 ; validate the DFN
+45 IF '$DATA(^DPT(+MAGDFN,0))
SET MAGRY="0^Invalid data: Patient DFN is invalid"
QUIT
+46 ; validate the User
+47 IF '$DATA(^VA(200,MAGESBY,0))
SET MAGRY="0^Invalid data: Author DUZ is invalid"
QUIT
+48 ; validate the TIU TITLE
+49 IF '$DATA(^TIU(8925.1,MAGTITLE,0))
SET MAGRY="0^Invalid data: Note TITLE is invalid"
QUIT
+50 ; validate Esig first, if caller wants to also mark this Note as Signed
+51 IF +$GET(MAGES)
IF '$$VALES^MAGGNTI2(MAGES)
SET MAGRY="0^Invalid data: E-sign is invalid"
QUIT
+52 ; validate the Date MAGDATE is changed to INternal if it is valid.
+53 IF +$LENGTH(MAGDATE)
IF '$$VALID^MAGGSIV1(8925,1301,.MAGDATE,.MAGX)
SET MAGRY="0^"_MAGX
QUIT
+54 IF '$LENGTH(MAGDATE)
SET MAGDATE=$$NOW^XLFDT
+55 ; LINK TO CONSULT
+56 ; can user create Notes with This Title
+57 IF '$$CANENTR^TIULP(MAGTITLE)
SET MAGRY="0^You need privileges to enter notes of that Title"
QUIT
+58 ;
+59 DO ISCNSLT^TIUCNSLT(.MAGISC,MAGTITLE)
+60 IF MAGISC
Begin DoDot:1
+61 ; See if a Consult DA was sent.
+62 IF 'MAGCNSLT
SET MAGISC="0^A Consult is needed to link to this note title"
+63 QUIT
End DoDot:1
IF 'MAGISC
SET MAGRY=MAGISC
QUIT
+64 IF ('MAGISC)&(MAGCNSLT)
SET MAGRY="0^Cannot Link Consult with a Non Consult Title"
QUIT
+65 ;
+66 ; make a VSTR for TIU Call.
+67 SET MAGVSTR=MAGLOC_";"_MAGDATE_";E"
+68 ;
+69 ; Call to NEW^TIUPNAPI wasn't doing what we needed. Now call TIU CREATE RECORD
+70 ; MAKE(SUCCESS,DFN,TITLE,VDT,VLOC,VSIT,TIUX,VSTR,SUPPRESS,NOASF)
+71 DO MAKE^TIUSRVP(.MAGTIUDA,MAGDFN,MAGTITLE,"",MAGLOC,"",.MAGTIUX,MAGVSTR)
+72 IF 'MAGTIUDA!(MAGTIUDA=-1)
SET MAGRY="0^Error creating Note"_$GET(MAGTIUDA)
QUIT
+73 SET MAGRY=MAGTIUDA_"^Note was created."
+74 SET MAGTY=MAGRY
+75 ;
+76 ; ;Put in the Date that was sent.
+77 IF '$$VALID^MAGGSIV1(8925,1301,.MAGDATE,.MAGRES)
SET MAGRY=MAGRY_" "_MAGRES
+78 IF '$TEST
SET MTXT(1301)=MAGDATE
+79 ; - Fix in T30, if DUZ isn't MAGESBY, we have Author different than User.
+80 IF MAGESBY'=DUZ
SET MTXT("1202")=MAGESBY
+81 ; Update and LINK TO CONSULT if needed.
+82 IF MAGISC
SET MTXT("1405")=MAGCNSLT_";GMR(123,"
+83 IF $DATA(MTXT)
Begin DoDot:1
+84 DO UPDATE^TIUSRVP(.MUPD,MAGTIUDA,.MTXT)
+85 QUIT
End DoDot:1
IF 'MUPD
SET MAGRY=MUPD
QUIT
+86 ;
+87 ; If Admin Close, then We quit.
+88 IF MAGADCL="1"
Begin DoDot:1
+89 DO ADMNCLOS^MAGGNTI2(.MAGTY,MAGDFN,MAGTIUDA,MAGMODE)
+90 SET MAGRY=$SELECT('MAGTY:MAGTY,1:MAGRY_" Administrative Closure.")
+91 QUIT
End DoDot:1
QUIT
+92 ;
+93 ; if caller sent esignature to Sign this Note.
+94 IF $LENGTH(MAGES)
Begin DoDot:1
+95 DO SIGN^MAGGNTI3(.MAGTY,MAGDFN,MAGTIUDA,MAGES,MAGESBY)
+96 SET MAGRY=$SELECT('MAGTY:MAGTY,1:MAGRY_" Signed.")
+97 QUIT
End DoDot:1
+98 QUIT
+99 ;
+100 ;(MAGRY,MAGDFN,MAGTITLE,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGLOC,MAGTEXT)
NEWADD(MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGDATE,MAGTEXT) ; RPC [MAG3 TIU CREATE ADDENDUM]
+1 ; RPC call to create an Addendum to a Note
+2 ; and Optionally :
+3 ; Electronically Sign,
+4 ; Administratively Close,
+5 ; or Add Text to the Addendum
+6 ;
+7 ; - - - Required - - -
+8 ; MAGDFN - Patient DFN
+9 ; MAGTIUDA - IEN of TIU NOTE in file 8925
+10 ; - - - Optional - - -
+11 ; MAGTEXT - Array of Text to add to the New Note.
+12 ; MAGES - The encrypted Electronic Signature
+13 ; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
+14 ; MAGADCL - 1 = Mark this Note as Administratively Closed
+15 ; MAGMODE - Mode of Admin Closure: "S" = Scanned Document "M" = Manual closure "E" = Electronically Filed
+16 ; MAGDATE - Date of the Addendum.
+17 ;
+18 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^"_$TEXT(+0)
+19 SET MAGDFN=$GET(MAGDFN)
SET MAGTIUDA=$GET(MAGTIUDA)
SET MAGES=$GET(MAGES)
SET MAGADCL=$GET(MAGADCL)
+20 SET MAGESBY=$SELECT($GET(MAGESBY):MAGESBY,1:DUZ)
SET MAGMODE=$SELECT($LENGTH($GET(MAGMODE)):MAGMODE,1:"S")
+21 SET MAGDATE=$GET(MAGDATE)
+22 ;
+23 IF '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA)
QUIT
+24 NEW MAGXT,I,CT,NEWTIUDA,MAGY,MAGRES,MAGUPD
+25 SET CT=1
SET I=""
+26 SET MAGXT("TEXT",1,0)="VistA Imaging Scanned Document - Addendum."
+27 IF $DATA(MAGTEXT)
FOR
SET I=$ORDER(MAGTEXT(I))
if I=""
QUIT
Begin DoDot:1
+28 SET CT=CT+1
SET MAGXT("TEXT",CT,0)=MAGTEXT(I)
+29 QUIT
End DoDot:1
+30 ;
+31 ; Calling TIU CREATE ADDENDUM RECORD
+32 DO MAKEADD^TIUSRVP(.MAGRY,MAGTIUDA,.MAGXT)
+33 ; MAGRY could be 0^error message
+34 ; -1^message
+35 ; TIUDA
+36 IF $PIECE(MAGRY,"^")<0
SET $PIECE(MAGRY,"^")=0
QUIT
+37 SET NEWTIUDA=+MAGRY
+38 SET MAGRY=MAGRY_"^Addendum was created."
+39 ;
+40 ;Put in the Date that was sent.
+41 KILL MAGUPD
+42 IF '$$VALID^MAGGSIV1(8925,1301,.MAGDATE,.MAGRES)
SET MAGRY=MAGRY_" "_MAGRES
+43 IF '$TEST
Begin DoDot:1
+44 SET MAGUPD(1301)=MAGDATE
+45 SET MAGUPD(1211)=$$GET1^DIQ(8925,1211,MAGTIUDA,"I")
End DoDot:1
+46 ; - Fix in T30, if DUZ isn't MAGESBY, we have Author different than User.
+47 IF MAGESBY'=DUZ
SET MAGUPD("1202")=MAGESBY
+48 IF $DATA(MAGUPD)
Begin DoDot:1
+49 DO UPDATE^TIUSRVP(.MAGY,NEWTIUDA,.MAGUPD)
+50 IF 'MAGY
SET MAGRY=MAGRY_" TIU Data was Not Correctly Filed."
+51 QUIT
End DoDot:1
+52 ;
+53 ; if caller sent esignature to Sign this Addendum.
+54 IF $LENGTH(MAGES)
Begin DoDot:1
+55 DO SIGN^MAGGNTI3(.MAGTY,MAGDFN,NEWTIUDA,MAGES,MAGESBY)
+56 SET MAGRY=$SELECT('MAGTY:MAGTY,1:MAGRY_" Signed.")
+57 QUIT
End DoDot:1
QUIT
+58 ;
+59 ; if caller wants to Admin Close this Addendum.
+60 IF MAGADCL="1"
Begin DoDot:1
+61 DO ADMNCLOS^MAGGNTI2(.MAGTY,MAGDFN,NEWTIUDA,MAGMODE)
+62 SET MAGRY=$SELECT('MAGTY:MAGTY,1:MAGRY_" Administrative Closure.")
+63 QUIT
End DoDot:1
QUIT
+64 QUIT
MOD(MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGTEXT) ; RPC [MAG3 TIU MODIFY NOTE]
+1 ; After a Note is filed, we call this to Modify the Note. We do this to sign it.
+2 ; That way the Signed Date is After the Image Association Date/Time.
+3 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^"_$TEXT(+0)
+4 SET MAGDFN=$GET(MAGDFN)
SET MAGTIUDA=$GET(MAGTIUDA)
+5 SET MAGADCL=$GET(MAGADCL)
+6 SET MAGMODE=$SELECT($LENGTH($GET(MAGMODE)):MAGMODE,1:"S")
+7 SET MAGES=$GET(MAGES)
+8 SET MAGESBY=$SELECT($GET(MAGESBY):MAGESBY,1:DUZ)
+9 DO MOD^MAGGNTI3(.MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY)
+10 QUIT
ERR ; ERROR TRAP
+1 NEW ERR
SET ERR=$$EC^%ZOSV
+2 SET MAGRY="0^ETRAP: "_ERR
+3 DO @^%ZOSF("ERRTN")
+4 QUIT
SIGN(MAGRY,MAGDFN,MAGTIUDA,MAGES,MAGESBY) ;RPC [MAG3 TIU SIGN RECORD]
+1 ; RPC Call to 'Sign' a Note.
+2 DO SIGN^MAGGNTI3(.MAGRY,$GET(MAGDFN),$GET(MAGTIUDA),$GET(MAGES),$GET(MAGESBY))
+3 QUIT