VSIT ;ISD/MRL,RJP - Visit Tracking ; 5/9/02 4:31pm
;;1.0;PCE PATIENT CARE ENCOUNTER;**76,111,118**;Aug 12, 1996
; Patch PX*1*76 changes the 2nd line of all VSIT* routines to reflect
; the incorporation of the module into PCE. For historical reference,
; the old (VISIT TRACKING) 2nd line is included below to reference VSIT
; patches.
;
;;2.0;VISIT TRACKING;**1**;Aug 12, 1996
;
; - pass VSIT = <visit date [and time] in FM format>
; DFN = <patient file pointer>
; [VSIT(0)] = <functional parameters>
; [VSIT("xxx")] = <used in match logic if VSIT(0)["M">
; - rtns VSIT("IEN") = <visit record # in format as Y w/ ^DIC>
; VSIT(##,"XXX") = visit values passed by mneomonics
; If VSIT("IEN") = -1 Error in creation/lookup.
; If Vsit("IEN") = -2 Package is turned off or not defined in the
; Visit Tracking Parameters file.
S VSIT("IEN")=$$GET($G(VSIT),$G(DFN),$G(VSIT(0)),.VSIT)
EXIT ;
Q
;
GET(VDT,DFN,PRAM,VSIT) ; find or create a visit
;
; - pass {VDT/VSIT("VDT")} = <visit date [and time] in FM format>
; {DFN/VSIT("PAT")} = <patient file pointer>
; [PRAM/VSIT(0)] = <functional paramerets>
; [VSIT("xxx")] = <array w/ mnemonic subscript>
; <used in match logic if VISIT(O)["M">
; <for SVC, TYP, INS, DSS, ELG , LOC>
; - rtns = <visit record # in format as Y w/ ^DIC>
;
I $G(VSITPKG)]"" S VSIT("PKG")=VSITPKG
E S (VSITPKG,VSIT("PKG"))=$G(VSIT("PKG"))
N VSITPKGP
S VSITPKGP=$$GETPKG^VSIT0($G(VSITPKG))
;Check Inactive Flag
I VSITPKGP<1 S VSIT("IEN")=-2 G DONE ;Need to update Visit Tracking Parameters File
I $$ACTIVE^VSIT0(VSITPKGP)'=1 S VSIT("IEN")=-2 G DONE ;Quit if package is not active
;Check that we now the site part of the Encounter ID
I $P($G(^DIC(150.9,1,4)),"^",2)<1 S VSIT("IEN")=-1 G DONE
;
K VSIT("IEN"),^TMP("VSITDD",$J),^TMP($J,"VSIT-ERROR")
S:$G(VDT)]"" VSIT("VDT")=VDT
S:$G(DFN) VSIT("PAT")=+DFN
S:$G(PRAM)]"" VSIT(0)=PRAM
;See if the old CLN nodes needs moved into the DSS node.
I '($D(VSIT("DSS"))#2),$D(VSIT("CLN"))#2 S VSIT("DSS")=VSIT("CLN")
;
D FLD^VSITFLD
;Set all of the VSIT nodes with $GET
D SETALL^VSITCK
;
;Inpatient movement
N VSITIPM S VSITIPM=+$$IP^VSITCK1(+VSIT("VDT"),+VSIT("PAT"))
;Do the defaulting of the fields that need to be defaulted be for lookup
I $$REQUIRED^VSITDEF S VSIT("IEN")=-1 G DONE
;
D:'$D(DT) DT^DICRW
;
;If Force new visit, make the visit and exit
I VSIT(0)["F" D G QUIT
. D DEFAULTS^VSITDEF
. D ^VSITPUT
;
;If not forcing new visit try to look up the visit
D LST^VSITGET("","","",.VSIT,.VSITGET)
;
I +$G(VSITGET)=0,VSIT(0)["N" D G QUIT
. D DEFAULTS^VSITDEF
. D ^VSITPUT
I +$G(VSITGET)=1 S VSIT("IEN")=$P(VSITGET(1),"|")_"^"_$P($P(VSITGET(1),"^"),"|",2) G QUIT
I +$G(VSITGET)>1,VSIT(0)["I" S Y=$$VSIT^VSITASK(VSIT("PAT"),.VSITGET) S:'+Y Y=1 S VSIT("IEN")=$P(VSITGET(+Y),"|")_"^"_$P($P(VSITGET(+Y),"^"),"|",2) G QUIT
I +$G(VSITGET)>1,VSIT(0)'["I" S VSIT("IEN")=$P(VSITGET(1),"|")_"^"_$P($P(VSITGET(1),"^"),"|",2) G QUIT
S VSIT("IEN")=-1
;
QUIT ; - end of job
;
; set vsit api
I +$G(VSIT("IEN"))=0 S VSIT("IEN")=-1
D:VSIT("IEN")>0 ALL^VSITVAR(+VSIT("IEN"),"B",1)
;
DONE I $D(^TMP($J,"VSIT-ERROR")),$G(VSIT("IEN"))'>0,VSIT(0)["N"!(VSIT(0)["F") D SND^VSITBUL
K VSITGET
K ^TMP("VSITDD",$J)
Q VSIT("IEN")
;
ADD ; - add to dependency count
; called via cross references on pointer files
D ADD^AUPNVSIT
Q
;
SUB ; - subtract from dependency count
; called via cross references on pointer files
;
D SUB^AUPNVSIT
Q
;
UPD ; Update Visit File
Q:$G(VSIT("IEN"))<1
Q:'$D(^AUPNVSIT(VSIT("IEN"),0))
N DR,DIE,DA,VSITDR,VSITDATA,VSITFLD
N %,%H,%I,X
D NOW^%DTC
S VSIT("MDT")=%
D FLD^VSITFLD
S DIE=9000010,DA=VSIT("IEN")
S (VSITDR,DR)=""
L +^AUPNVSIT(+VSIT("IEN")):10
F S VSITDR=$O(VSIT(VSITDR)) Q:VSITDR="" I $G(^TMP("VSITDD",$J,VSITDR))'="" D
.S VSITFLD=$P($G(^TMP("VSITDD",$J,VSITDR)),";",2) ;Field
.S VSITDATA=VSIT(VSITDR) ;Data
.;S DR=""_VSITFLD_"////"_VSITDATA_"" D ^DIE S DR="" ;Calls DIE each fld
.I $L(DR)<245 S DR=$P($G(^TMP("VSITDD",$J,VSITDR)),";",2)_"////"_VSIT(VSITDR)_";"_DR
.I $L(DR)>244 S DR=$E(DR,1,$L(DR)-1) D ^DIE S DR=$P($G(^TMP("VSITDD",$J,VSITDR)),";",2)_"////"_VSIT(VSITDR)_";"
I $G(DR)["////" S DR=$E(DR,1,$L(DR)-1) D ^DIE
;
;PX*1*111 - Update NTR file for Head & Neck
D
. N HNCARR,HNCERR
. K HNCARR,HNCERR
. D GETS^DIQ(9000010,+VSIT("IEN"),80006,"I","HNCARR","HNCERR")
. I $D(HNCERR) Q ;No data found
. I $G(HNCARR(9000010,(+VSIT("IEN")_","),80006,"I"))'=1 Q
. ;Answer is 'Y' to HNC question
. N SDELG0,DGARR,PCEXDFN
. S PCEXDFN=$G(DFN)
. I PCEXDFN="" S PCEXDFN=$G(PXAA("PATIENT"))
. I PCEXDFN="" Q
. S SDELG0=$$GETCUR^DGNTAPI(PCEXDFN,"DGARR")
. S SDELG0=+$G(DGARR("STAT"))
. I SDELG0'=3 Q ;NTR File does not require editing
. S SDELG0=$$FILEHNC^DGNTAPI1(PCEXDFN)
;
L -^AUPNVSIT(+VSIT("IEN"))
K ^TMP("VSITDD",$J)
Q
PKG2IEN(PKG) ;Pass in package name space and
; returns pointer to the package in the Package file #9.4
Q $$PKG2IEN^VSIT0($G(PKG))
;
PKG(PKG,VALUE) ;-Entry point to add package to multiple in tracking param
;-PKG=Package Name Space
;-VALUE=Value on the ON/OFF flag under package multiple
;--1=ON 0=OFF
Q $$PKG^VSIT0($G(PKG),$G(VALUE))
;
PKGON(PKG) ; -- Returns the active flage for the package
; 1 the package can create visits
; 0 the package cannot create visits
; -1 called wrong or could not find package in VT parameters file
Q $$PKGON^VSIT0($G(PKG))
;
IEN2VID(IEN) ; -- Call with Visit IEN and returns the Visit ID
Q:'($D(^AUPNVSIT(+IEN,150))#2) -1
Q $P(^AUPNVSIT(IEN,150),"^",1)
;
VID2IEN(VID) ; -- Call with Visit's ID and returns the Visit IEN
N IEN
S IEN=$O(^AUPNVSIT("VID",VID,0))
Q $S(IEN]"":IEN,1:-1)
;
LOOKUP(IEN,FMT,WITHIEN) ; -- Lookup a visit and return all of its information
;DBIA #: 1906
;Parameters:
; IEN is the IEN for the Visit OR the Visit's ID
; FMT is the format that you want the output where
; I ::= internal format
; E ::= external format
; B ::= both internal and external format
; B is the default if FMT is anything other than "I" or "E"
; WITHIEN is 0 if you do not want the IEN of the VSIT( as the first
; subscript and 1 if you do. "1" is the default.
;
;Return: -1 if IEN was not a valid IEN or Visit ID
; otherwise returns IEN
; VSIT( an array VSIT(Visit IEN,field) or VSIT(field) depending
; on the value of WITHIEN. The array is all of the fields
; in the visit file. If B(oth) internal and external format
; are returned the format is: internal^external.
; If I(nternal) format is requested only the internal part
; is returned.
; If E(xternal) format is requested the format is: ^external
; External values, if requested, are always returned in the
; second pieces of the array elements.
;
Q:$G(IEN)']"" -1
S:+IEN'=IEN IEN=$$VID2IEN(IEN) ;PX*1.0*118
Q:'($D(^AUPNVSIT(+IEN,0))#2) -1
S FMT=$G(FMT)
S FMT=$S(FMT["B":"B",FMT["I":"I",FMT["E":"E",1:"B")
S WITHIEN=$S($G(WITHIEN)=0:0,1:1)
D ALL^VSITVAR(IEN,FMT,WITHIEN)
Q IEN
;
SELECTED(DFN,SDT,EDT,HOSLOC,ENCTYPE,NENCTYPE,SERVCAT,NSERVCAT,LASTN) ;
; -- Returns selected visits depending on screens passed in.
D VSITAPI^VSITOE($G(DFN),$G(SDT),$G(EDT),$G(HOSLOC),$G(ENCTYPE),$G(NENCTYPE),$G(SERVCAT),$G(NSERVCAT),$G(LASTN))
Q
;
HISTORIC(IEN) ; -- Returns 1 if it is an Historical visit ("E" in #.07)
; 0 if it is not an Historical visit.
; -1 if the IEN is bad
Q $S('($D(^AUPNVSIT(IEN,0))#2):-1,1:$P($G(^AUPNVSIT(IEN,0)),"^",7)="E")
;
MODIFIED(IEN) ;Sets the Date Last Modified (.13) field to NOW
;
N VSIT
S VSIT("IEN")=IEN
D UPD
Q
VSIT ;ISD/MRL,RJP - Visit Tracking ; 5/9/02 4:31pm
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**76,111,118**;Aug 12, 1996
+2 ; Patch PX*1*76 changes the 2nd line of all VSIT* routines to reflect
+3 ; the incorporation of the module into PCE. For historical reference,
+4 ; the old (VISIT TRACKING) 2nd line is included below to reference VSIT
+5 ; patches.
+6 ;
+7 ;;2.0;VISIT TRACKING;**1**;Aug 12, 1996
+8 ;
+9 ; - pass VSIT = <visit date [and time] in FM format>
+10 ; DFN = <patient file pointer>
+11 ; [VSIT(0)] = <functional parameters>
+12 ; [VSIT("xxx")] = <used in match logic if VSIT(0)["M">
+13 ; - rtns VSIT("IEN") = <visit record # in format as Y w/ ^DIC>
+14 ; VSIT(##,"XXX") = visit values passed by mneomonics
+15 ; If VSIT("IEN") = -1 Error in creation/lookup.
+16 ; If Vsit("IEN") = -2 Package is turned off or not defined in the
+17 ; Visit Tracking Parameters file.
+18 SET VSIT("IEN")=$$GET($GET(VSIT),$GET(DFN),$GET(VSIT(0)),.VSIT)
EXIT ;
+1 QUIT
+2 ;
GET(VDT,DFN,PRAM,VSIT) ; find or create a visit
+1 ;
+2 ; - pass {VDT/VSIT("VDT")} = <visit date [and time] in FM format>
+3 ; {DFN/VSIT("PAT")} = <patient file pointer>
+4 ; [PRAM/VSIT(0)] = <functional paramerets>
+5 ; [VSIT("xxx")] = <array w/ mnemonic subscript>
+6 ; <used in match logic if VISIT(O)["M">
+7 ; <for SVC, TYP, INS, DSS, ELG , LOC>
+8 ; - rtns = <visit record # in format as Y w/ ^DIC>
+9 ;
+10 IF $GET(VSITPKG)]""
SET VSIT("PKG")=VSITPKG
+11 IF '$TEST
SET (VSITPKG,VSIT("PKG"))=$GET(VSIT("PKG"))
+12 NEW VSITPKGP
+13 SET VSITPKGP=$$GETPKG^VSIT0($GET(VSITPKG))
+14 ;Check Inactive Flag
+15 ;Need to update Visit Tracking Parameters File
IF VSITPKGP<1
SET VSIT("IEN")=-2
GOTO DONE
+16 ;Quit if package is not active
IF $$ACTIVE^VSIT0(VSITPKGP)'=1
SET VSIT("IEN")=-2
GOTO DONE
+17 ;Check that we now the site part of the Encounter ID
+18 IF $PIECE($GET(^DIC(150.9,1,4)),"^",2)<1
SET VSIT("IEN")=-1
GOTO DONE
+19 ;
+20 KILL VSIT("IEN"),^TMP("VSITDD",$JOB),^TMP($JOB,"VSIT-ERROR")
+21 IF $GET(VDT)]""
SET VSIT("VDT")=VDT
+22 IF $GET(DFN)
SET VSIT("PAT")=+DFN
+23 IF $GET(PRAM)]""
SET VSIT(0)=PRAM
+24 ;See if the old CLN nodes needs moved into the DSS node.
+25 IF '($DATA(VSIT("DSS"))#2)
IF $DATA(VSIT("CLN"))#2
SET VSIT("DSS")=VSIT("CLN")
+26 ;
+27 DO FLD^VSITFLD
+28 ;Set all of the VSIT nodes with $GET
+29 DO SETALL^VSITCK
+30 ;
+31 ;Inpatient movement
+32 NEW VSITIPM
SET VSITIPM=+$$IP^VSITCK1(+VSIT("VDT"),+VSIT("PAT"))
+33 ;Do the defaulting of the fields that need to be defaulted be for lookup
+34 IF $$REQUIRED^VSITDEF
SET VSIT("IEN")=-1
GOTO DONE
+35 ;
+36 IF '$DATA(DT)
DO DT^DICRW
+37 ;
+38 ;If Force new visit, make the visit and exit
+39 IF VSIT(0)["F"
Begin DoDot:1
+40 DO DEFAULTS^VSITDEF
+41 DO ^VSITPUT
End DoDot:1
GOTO QUIT
+42 ;
+43 ;If not forcing new visit try to look up the visit
+44 DO LST^VSITGET("","","",.VSIT,.VSITGET)
+45 ;
+46 IF +$GET(VSITGET)=0
IF VSIT(0)["N"
Begin DoDot:1
+47 DO DEFAULTS^VSITDEF
+48 DO ^VSITPUT
End DoDot:1
GOTO QUIT
+49 IF +$GET(VSITGET)=1
SET VSIT("IEN")=$PIECE(VSITGET(1),"|")_"^"_$PIECE($PIECE(VSITGET(1),"^"),"|",2)
GOTO QUIT
+50 IF +$GET(VSITGET)>1
IF VSIT(0)["I"
SET Y=$$VSIT^VSITASK(VSIT("PAT"),.VSITGET)
IF '+Y
SET Y=1
SET VSIT("IEN")=$PIECE(VSITGET(+Y),"|")_"^"_$PIECE($PIECE(VSITGET(+Y),"^"),"|",2)
GOTO QUIT
+51 IF +$GET(VSITGET)>1
IF VSIT(0)'["I"
SET VSIT("IEN")=$PIECE(VSITGET(1),"|")_"^"_$PIECE($PIECE(VSITGET(1),"^"),"|",2)
GOTO QUIT
+52 SET VSIT("IEN")=-1
+53 ;
QUIT ; - end of job
+1 ;
+2 ; set vsit api
+3 IF +$GET(VSIT("IEN"))=0
SET VSIT("IEN")=-1
+4 IF VSIT("IEN")>0
DO ALL^VSITVAR(+VSIT("IEN"),"B",1)
+5 ;
DONE IF $DATA(^TMP($JOB,"VSIT-ERROR"))
IF $GET(VSIT("IEN"))'>0
IF VSIT(0)["N"!(VSIT(0)["F")
DO SND^VSITBUL
+1 KILL VSITGET
+2 KILL ^TMP("VSITDD",$JOB)
+3 QUIT VSIT("IEN")
+4 ;
ADD ; - add to dependency count
+1 ; called via cross references on pointer files
+2 DO ADD^AUPNVSIT
+3 QUIT
+4 ;
SUB ; - subtract from dependency count
+1 ; called via cross references on pointer files
+2 ;
+3 DO SUB^AUPNVSIT
+4 QUIT
+5 ;
UPD ; Update Visit File
+1 IF $GET(VSIT("IEN"))<1
QUIT
+2 IF '$DATA(^AUPNVSIT(VSIT("IEN"),0))
QUIT
+3 NEW DR,DIE,DA,VSITDR,VSITDATA,VSITFLD
+4 NEW %,%H,%I,X
+5 DO NOW^%DTC
+6 SET VSIT("MDT")=%
+7 DO FLD^VSITFLD
+8 SET DIE=9000010
SET DA=VSIT("IEN")
+9 SET (VSITDR,DR)=""
+10 LOCK +^AUPNVSIT(+VSIT("IEN")):10
+11 FOR
SET VSITDR=$ORDER(VSIT(VSITDR))
IF VSITDR=""
QUIT
IF $GET(^TMP("VSITDD",$JOB,VSITDR))'=""
Begin DoDot:1
+12 ;Field
SET VSITFLD=$PIECE($GET(^TMP("VSITDD",$JOB,VSITDR)),";",2)
+13 ;Data
SET VSITDATA=VSIT(VSITDR)
+14 ;S DR=""_VSITFLD_"////"_VSITDATA_"" D ^DIE S DR="" ;Calls DIE each fld
+15 IF $LENGTH(DR)<245
SET DR=$PIECE($GET(^TMP("VSITDD",$JOB,VSITDR)),";",2)_"////"_VSIT(VSITDR)_";"_DR
+16 IF $LENGTH(DR)>244
SET DR=$EXTRACT(DR,1,$LENGTH(DR)-1)
DO ^DIE
SET DR=$PIECE($GET(^TMP("VSITDD",$JOB,VSITDR)),";",2)_"////"_VSIT(VSITDR)_";"
End DoDot:1
+17 IF $GET(DR)["////"
SET DR=$EXTRACT(DR,1,$LENGTH(DR)-1)
DO ^DIE
+18 ;
+19 ;PX*1*111 - Update NTR file for Head & Neck
+20 Begin DoDot:1
+21 NEW HNCARR,HNCERR
+22 KILL HNCARR,HNCERR
+23 DO GETS^DIQ(9000010,+VSIT("IEN"),80006,"I","HNCARR","HNCERR")
+24 ;No data found
IF $DATA(HNCERR)
QUIT
+25 IF $GET(HNCARR(9000010,(+VSIT("IEN")_","),80006,"I"))'=1
QUIT
+26 ;Answer is 'Y' to HNC question
+27 NEW SDELG0,DGARR,PCEXDFN
+28 SET PCEXDFN=$GET(DFN)
+29 IF PCEXDFN=""
SET PCEXDFN=$GET(PXAA("PATIENT"))
+30 IF PCEXDFN=""
QUIT
+31 SET SDELG0=$$GETCUR^DGNTAPI(PCEXDFN,"DGARR")
+32 SET SDELG0=+$GET(DGARR("STAT"))
+33 ;NTR File does not require editing
IF SDELG0'=3
QUIT
+34 SET SDELG0=$$FILEHNC^DGNTAPI1(PCEXDFN)
End DoDot:1
+35 ;
+36 LOCK -^AUPNVSIT(+VSIT("IEN"))
+37 KILL ^TMP("VSITDD",$JOB)
+38 QUIT
PKG2IEN(PKG) ;Pass in package name space and
+1 ; returns pointer to the package in the Package file #9.4
+2 QUIT $$PKG2IEN^VSIT0($GET(PKG))
+3 ;
PKG(PKG,VALUE) ;-Entry point to add package to multiple in tracking param
+1 ;-PKG=Package Name Space
+2 ;-VALUE=Value on the ON/OFF flag under package multiple
+3 ;--1=ON 0=OFF
+4 QUIT $$PKG^VSIT0($GET(PKG),$GET(VALUE))
+5 ;
PKGON(PKG) ; -- Returns the active flage for the package
+1 ; 1 the package can create visits
+2 ; 0 the package cannot create visits
+3 ; -1 called wrong or could not find package in VT parameters file
+4 QUIT $$PKGON^VSIT0($GET(PKG))
+5 ;
IEN2VID(IEN) ; -- Call with Visit IEN and returns the Visit ID
+1 IF '($DATA(^AUPNVSIT(+IEN,150))#2)
QUIT -1
+2 QUIT $PIECE(^AUPNVSIT(IEN,150),"^",1)
+3 ;
VID2IEN(VID) ; -- Call with Visit's ID and returns the Visit IEN
+1 NEW IEN
+2 SET IEN=$ORDER(^AUPNVSIT("VID",VID,0))
+3 QUIT $SELECT(IEN]"":IEN,1:-1)
+4 ;
LOOKUP(IEN,FMT,WITHIEN) ; -- Lookup a visit and return all of its information
+1 ;DBIA #: 1906
+2 ;Parameters:
+3 ; IEN is the IEN for the Visit OR the Visit's ID
+4 ; FMT is the format that you want the output where
+5 ; I ::= internal format
+6 ; E ::= external format
+7 ; B ::= both internal and external format
+8 ; B is the default if FMT is anything other than "I" or "E"
+9 ; WITHIEN is 0 if you do not want the IEN of the VSIT( as the first
+10 ; subscript and 1 if you do. "1" is the default.
+11 ;
+12 ;Return: -1 if IEN was not a valid IEN or Visit ID
+13 ; otherwise returns IEN
+14 ; VSIT( an array VSIT(Visit IEN,field) or VSIT(field) depending
+15 ; on the value of WITHIEN. The array is all of the fields
+16 ; in the visit file. If B(oth) internal and external format
+17 ; are returned the format is: internal^external.
+18 ; If I(nternal) format is requested only the internal part
+19 ; is returned.
+20 ; If E(xternal) format is requested the format is: ^external
+21 ; External values, if requested, are always returned in the
+22 ; second pieces of the array elements.
+23 ;
+24 IF $GET(IEN)']""
QUIT -1
+25 ;PX*1.0*118
IF +IEN'=IEN
SET IEN=$$VID2IEN(IEN)
+26 IF '($DATA(^AUPNVSIT(+IEN,0))#2)
QUIT -1
+27 SET FMT=$GET(FMT)
+28 SET FMT=$SELECT(FMT["B":"B",FMT["I":"I",FMT["E":"E",1:"B")
+29 SET WITHIEN=$SELECT($GET(WITHIEN)=0:0,1:1)
+30 DO ALL^VSITVAR(IEN,FMT,WITHIEN)
+31 QUIT IEN
+32 ;
SELECTED(DFN,SDT,EDT,HOSLOC,ENCTYPE,NENCTYPE,SERVCAT,NSERVCAT,LASTN) ;
+1 ; -- Returns selected visits depending on screens passed in.
+2 DO VSITAPI^VSITOE($GET(DFN),$GET(SDT),$GET(EDT),$GET(HOSLOC),$GET(ENCTYPE),$GET(NENCTYPE),$GET(SERVCAT),$GET(NSERVCAT),$GET(LASTN))
+3 QUIT
+4 ;
HISTORIC(IEN) ; -- Returns 1 if it is an Historical visit ("E" in #.07)
+1 ; 0 if it is not an Historical visit.
+2 ; -1 if the IEN is bad
+3 QUIT $SELECT('($DATA(^AUPNVSIT(IEN,0))#2):-1,1:$PIECE($GET(^AUPNVSIT(IEN,0)),"^",7)="E")
+4 ;
MODIFIED(IEN) ;Sets the Date Last Modified (.13) field to NOW
+1 ;
+2 NEW VSIT
+3 SET VSIT("IEN")=IEN
+4 DO UPD
+5 QUIT