BTIUEDIT ; IHS/ITSC/LJF - Enter/Edit a Document, patient/visit known ;
;;1.0;TEXT INTEGRATION UTILITIES;;NOV 04, 2004
; Moved LOADDFLT, BOIL, CANXEC, REPLACE, INSMULT to TIUEDI4
; Moved DIE, TEXTEDIT from TIUEDIT to TIUEDI4
; Separated out modules SETTL, GETVST, ASKOK
; Moved SETTL, GETVST, ASKOK from TIUEDIT to TIUEDI4
; Changed call to GETREC^TIUEDI1 to call GETRECNW^TIUEDI3
;
;IHS/ITSC/LJF 07/02/2003
; COPY OF TIUEDIT to be used by other packages to enter documents
; assumes DFN and VISIT already set
;
;Changes made to original VA code:
; -- added BTIUDFN parameter and removed code to ask for patient
; -- added BTIUVSIT parameter and removed code to ask for visit
; -- added BTIUASKV parameter and added call to edit visit
; -- create v note entry & clean up of variable TIUTITLE
; -- allow editing of all past documents not just progress notes
;
MAIN(TIUCLASS,SUCCESS,BTIUDFN,TIUTITLE,EVNTFLAG,NOSAVE,TIUNDA,TIUSNGL,TIUCHNG,BTIUASKV,BTIUVSIT) ;PEP; Create new document(s)
;
; -- ASKVST - if set to 1, ask to edit visit;IHS/ITSC/LJF 07/02/2003
;
; May branch off to edit existing docmt instead of creating new one.
; Call with: [TIUCLASS] --> pointer to file (8925) corresponding to
; the class (e.g., Progress Notes=3)
; from which to select a title
; [by ref] [SUCCESS] --> Boolean flag returned as IFN when a
; record is created, or 0 when record
; creation fails
; [DFN] --> IEN in patient file (#2)
; [TIUTITLE] --> Pointer or NAME or PTR^NAME of the
; TITLE from file 8925.1 to be used as
; the default.
; [EVNTFLAG] --> Boolean flag for visit prompt (0 to
; prompt, 1 to force event type visit)
; [NOSAVE] --> Boolean flag to suppress saving the data
; (e.g., when testing new Boilerplates
; using DDEF action TRY, etc.).
; [by ref] [TIUNDA] --> array of form: TIUNDA(IFN)="".
; Used in SHOW NOTES ACROSS PATIENTS.
; See TIURC, which sets TIUONCE.
; Also used in TIUEDIM, for mult pts.
; [TIUSNGL] --> Boolean flag to create only ONE note
; regardless of multiple pt preference.
; [by ref] [TIUCHNG] --> If received, passes back TIUCHNG array,
; which collects info across records about
; actions taken. Used in feedback
; msgs to user.
; Other variables:
; sets [TIUTYP] --> array with form similar to that of XQORNOD:
; TIUTYP = title IFN
; TIUTYP(1) = 1^title IFN^title name,
; where 1 for us is just a positive #
; sets [TIUBY] --> used in some input templates to BYpass fields.
; Called by:
; Outpt Pharmacy, Consults, ...
N TIUASK,TIUOUT,TIUREL,TIUCHK,TIUDA,TIUEDIT,TIUY,TIUTYP,TIUDPRM
N TIUDFLT,TIUPREF,TIULMETH,TIUVMETH,DIRUT,DUOUT,DTOUT,TIUPRM0
N TIUPRM1,TIUPRM3,TIUENTRY,TIUEXIT,TIUBY,TIUPNAME,TIUST
S EVNTFLAG=+$G(EVNTFLAG,0)
; --Get user's division parameters, preferences: --
I '$D(TIUPRM0) D SETPARM^TIULE
S TIUPREF=$$PERSPRF^TIULE(DUZ)
; -- multiple pts; not in OERR, not TRYing DDEF, not single docmt: --
;I $P(TIUPREF,U,6)="M",(+$G(ORVP)'>0),(+$G(NOSAVE)'>0),'+$G(TIUSNGL) D MAIN^TIUEDIM(TIUCLASS,.TIUOUT,.TIUNDA,.TIUCHNG) Q ;original VA
; -- Loop: Create docmt --
;F D Q:+$G(ORVP)!+$G(TIUOUT)!+$G(NOSAVE)!+$G(TIUSNGL) ;original VA - commented out and raised next x lines to top level
N TIU,TIUCMMTX,TIUBY,TIUEDIT,TIUNEW,TIUTYP,VADM,VAIN,CANEDIT
; -- User specifies basic info for new docmt --
; -- Get patient --
;I +$G(ORVP) S DFN=+$G(ORVP) ;original VA
;I +$G(DFN)'>0 D I +DFN'>0 S TIUOUT=1 Q ;original VA
;. S DFN=+$$PATIENT^TIULA ;original VA
I '$G(BTIUDFN) S TIUOUT=1 Q ;added line
S DFN=+BTIUDFN ;added line
; -- [For progress notes, show available notes]: --
S TIUCLASS=$G(TIUCLASS,38)
;
;IHS/ITSC/LJF 02/26/2003 okay to edit all documents, not just progress notes
;I TIUCLASS=3,$S(+$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST"):0,1:1),(+$G(NOSAVE)'>0) D EXSTNOTE^TIUEDI2(DFN) D:$G(VALMAR)="^TMP(""OR"",$J,""CURRENT"")" FULL^VALM1
I $S(+$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST"):0,1:1),(+$G(NOSAVE)'>0) D EXSTNOTE^TIUEDI2(DFN) D:$G(VALMAR)="^TMP(""OR"",$J,""CURRENT"")" FULL^VALM1
;
I +$G(DIROUT)!+$G(DUOUT)!+$G(DTOUT) S TIUOUT=1 Q
; -- Set title array TIUTYP (use TIUTITLE or ask user) --
D SETTL^TIUEDI4(.TIUTYP,TIUCLASS,$G(TIUTITLE)) I +$G(TIUTYP)'>0 S TIUOUT=1 Q
; -- Get doc parameters for title, X entry action --
D DOCPRM^TIULC1(TIUTYP,.TIUDPRM)
S TIUENTRY=$$GETENTRY^TIUEDI2(+TIUTYP)
I $L(TIUENTRY) X TIUENTRY
Q:+$G(TIUOUT) ; If ENTRY ACTION sets TIUOUT=1 Abort entry
; -- Set visit array TIU --
;
;D GETVST^TIUEDI4(DFN,TIUTYP,.TIU,EVNTFLAG) ;original VA
I $G(BTIUVSIT) D ;added line
. S TIUVSTR=$P(^AUPNVSIT(BTIUVSIT,0),U,22)_";"_+^(0)_";"_$P(^(0),U,7) ;added line
. D PATVADPT^TIULV(.TIU,DFN,$$PMV^BTIUU1(+BTIUVSIT,DFN),TIUVSTR) ;added line
;
I '$D(TIU("VSTR")) K DFN,TIUTYP Q
; -- Ask OK --
D ASKOK^TIUEDI4(TIUTYP,.TIU,.TIUBY,.TIUASK) I '$D(TIU("VSTR")) K DFN,TIUTYP Q
I $G(BTIUASKV)=1 D VEDIT^BTIUED("NO") ;added line - ask user to edit visit
;
; -- If user OK'd basic info, go on to get text, etc.: --
I $D(TIU),+$G(TIUASK) D
. ; -- Get record DA --
. ; DA is either: new stub record, ready for edit, or
. ; existing record, for edit, or
. ; existing record, for addendum
. N DA
. S DA=$$GETRECNW^TIUEDI3(DFN,.TIU,TIUTYP(1),.TIUNEW,.TIUDPRM,1,DUZ,.CANEDIT)
. I +DA'>0 W !,"Unable to enter/edit." Q
. ; -- [Addend DA and Quit] --
. ; If record not new & user can't edit it, let user
. ; write addendum and quit:
. I 'TIUNEW,'CANEDIT D Q
. . D ADDENDUM^TIUADD(DA,"",.TIUCHNG,1)
. N TIUQUIT,TIUADD,TIUTDA
. ; -- Edit new or existing DA --
. D DIE^TIUEDI4(DA,.TIUQUIT)
. Q:+$G(TIUQUIT)=2 ; DA doesn't exist (e.g. uparrowed w/ bad record)
. I $$EMPTYDOC^TIULF(DA) D DELETE(DA,0) S:$G(VALMAR)="^TMP(""TIUVIEW"",$J)" VALMBCK="Q" S:'+$G(TIUNEW) TIUCHNG("DELETE")=1 H:'+$G(TIUNEW) 2 Q
. Q:+$G(TIUQUIT)
. S:+DA SUCCESS=+DA
. I +$G(TIUONCE) S TIUNDA(+$G(DA))="" ; See TIURC, Across Patients
. ; -- Misc after-edit-stuff for DA --
. ; -- Mark to ask workload at signature;
. ; (STOP for Stop codes for stand-alone visits): --
. I +$G(TIU("STOP")),(+$P($G(TIUDPRM(0)),U,14)'=1) D DEFER^TIUVSIT(DA,TIU("STOP")) I 1 ;piece 14 = suppress DX/CPT on entry
. E D QUE^TIUPXAP1 ; Post workload now in background
. ;
. D VNOTE^BTIUPCC(DA,+TIU("VISIT"),DFN,"ADD") ;added line to update VNote file
. ;
. S TIUCMMTX=$$COMMIT^TIULC1(+$P(TIUTYP(1),U,2))
. I TIUCMMTX]"" X TIUCMMTX
. D RELEASE^TIUT(DA)
. D VERIFY^TIUT(DA)
. ; -- Get signature for DA
. D EDSIG^TIURS(DA)
. ; - execute EXIT ACTION -
. S TIUEXIT=$$GETEXIT^TIUEDI2(+$P(TIUTYP(1),U,2))
. I $L(TIUEXIT) S TIUTDA=DA X TIUEXIT S DA=TIUTDA
. ; -- [Prompt to add ID stub] --
. ; I +$P($G(TIUDPRM(0)),U,20) D ADDSTUB^TIUGEDIT(DA)
. ; -- [Prompt to print DA] --
. I +$P($G(TIUDPRM(0)),U,8) D PRINT^TIUEPRNT(DA)
;K DFN ; Free patient ;commented out - calling routine may need DFN set
K TIUTITLE ;added line - clean up variable for next note
S TIUPNAME=$$PNAME^TIULC1(TIUCLASS)
I $$UP^XLFSTR($E(TIUPNAME,$L(TIUPNAME)))="S" S TIUPNAME=$E(TIUPNAME,1,$L(TIUPNAME)-1)
; -- [loop again] --
;I '+$G(NOSAVE),'+$G(ORVP),'+$G(TIUSNGL) W !!,"You may enter another ",TIUPNAME,". Press RETURN to exit.",! ;original VA
Q
;
DELETE(TIUDA,PROMPT,MSG,HUSH) ; Delete record
N DIDEL,DIE,DR,TIUD0,TIUVSIT,TIUVKILL,TIUDELX,TIUTYPE
S TIUD0=$G(^TIU(8925,+TIUDA,0)),TIUVSIT=$P(TIUD0,U,3),TIUTYPE=+TIUD0
I +$G(PROMPT),'+$$READ^TIUU("YO",MSG,"NO") W !,"Nothing Deleted." Q
K ^TIU(8925,"ASAVE",DUZ,TIUDA)
D DELIRT^TIUDIRT(TIUDA)
; If a DELETE Action exists for the document definition, execute it
S TIUDELX=$$DELETE^TIULC1(TIUTYPE)
I TIUDELX]"" X TIUDELX
S DA=TIUDA,(DIDEL,DIE)=8925,DR=".01///@"
D ^DIE W:'+$G(HUSH) !,"<NOTHING ENTERED. "
I '+$G(HUSH) W:+TIUD0 $$PNAME^TIULC1(+TIUD0)," DELETED>"
D DELCOMP^TIUEDI1(TIUDA),DELAUDIT^TIUEDI1(TIUDA)
K ^TIU(8925,"ASAVE",DUZ,TIUDA) ; Remove Save Flag
D ALERTDEL^TIUALRT(TIUDA),ADDENDEL^TIUALRT(TIUDA)
; I +TIUVSIT S TIUVKILL=$$DELVFILE^PXAPI("ALL",TIUVSIT,"","TEXT INTEGRATION UTILITIES")
Q
;
BTIUEDIT ; IHS/ITSC/LJF - Enter/Edit a Document, patient/visit known ;
+1 ;;1.0;TEXT INTEGRATION UTILITIES;;NOV 04, 2004
+2 ; Moved LOADDFLT, BOIL, CANXEC, REPLACE, INSMULT to TIUEDI4
+3 ; Moved DIE, TEXTEDIT from TIUEDIT to TIUEDI4
+4 ; Separated out modules SETTL, GETVST, ASKOK
+5 ; Moved SETTL, GETVST, ASKOK from TIUEDIT to TIUEDI4
+6 ; Changed call to GETREC^TIUEDI1 to call GETRECNW^TIUEDI3
+7 ;
+8 ;IHS/ITSC/LJF 07/02/2003
+9 ; COPY OF TIUEDIT to be used by other packages to enter documents
+10 ; assumes DFN and VISIT already set
+11 ;
+12 ;Changes made to original VA code:
+13 ; -- added BTIUDFN parameter and removed code to ask for patient
+14 ; -- added BTIUVSIT parameter and removed code to ask for visit
+15 ; -- added BTIUASKV parameter and added call to edit visit
+16 ; -- create v note entry & clean up of variable TIUTITLE
+17 ; -- allow editing of all past documents not just progress notes
+18 ;
MAIN(TIUCLASS,SUCCESS,BTIUDFN,TIUTITLE,EVNTFLAG,NOSAVE,TIUNDA,TIUSNGL,TIUCHNG,BTIUASKV,BTIUVSIT) ;PEP; Create new document(s)
+1 ;
+2 ; -- ASKVST - if set to 1, ask to edit visit;IHS/ITSC/LJF 07/02/2003
+3 ;
+4 ; May branch off to edit existing docmt instead of creating new one.
+5 ; Call with: [TIUCLASS] --> pointer to file (8925) corresponding to
+6 ; the class (e.g., Progress Notes=3)
+7 ; from which to select a title
+8 ; [by ref] [SUCCESS] --> Boolean flag returned as IFN when a
+9 ; record is created, or 0 when record
+10 ; creation fails
+11 ; [DFN] --> IEN in patient file (#2)
+12 ; [TIUTITLE] --> Pointer or NAME or PTR^NAME of the
+13 ; TITLE from file 8925.1 to be used as
+14 ; the default.
+15 ; [EVNTFLAG] --> Boolean flag for visit prompt (0 to
+16 ; prompt, 1 to force event type visit)
+17 ; [NOSAVE] --> Boolean flag to suppress saving the data
+18 ; (e.g., when testing new Boilerplates
+19 ; using DDEF action TRY, etc.).
+20 ; [by ref] [TIUNDA] --> array of form: TIUNDA(IFN)="".
+21 ; Used in SHOW NOTES ACROSS PATIENTS.
+22 ; See TIURC, which sets TIUONCE.
+23 ; Also used in TIUEDIM, for mult pts.
+24 ; [TIUSNGL] --> Boolean flag to create only ONE note
+25 ; regardless of multiple pt preference.
+26 ; [by ref] [TIUCHNG] --> If received, passes back TIUCHNG array,
+27 ; which collects info across records about
+28 ; actions taken. Used in feedback
+29 ; msgs to user.
+30 ; Other variables:
+31 ; sets [TIUTYP] --> array with form similar to that of XQORNOD:
+32 ; TIUTYP = title IFN
+33 ; TIUTYP(1) = 1^title IFN^title name,
+34 ; where 1 for us is just a positive #
+35 ; sets [TIUBY] --> used in some input templates to BYpass fields.
+36 ; Called by:
+37 ; Outpt Pharmacy, Consults, ...
+38 NEW TIUASK,TIUOUT,TIUREL,TIUCHK,TIUDA,TIUEDIT,TIUY,TIUTYP,TIUDPRM
+39 NEW TIUDFLT,TIUPREF,TIULMETH,TIUVMETH,DIRUT,DUOUT,DTOUT,TIUPRM0
+40 NEW TIUPRM1,TIUPRM3,TIUENTRY,TIUEXIT,TIUBY,TIUPNAME,TIUST
+41 SET EVNTFLAG=+$GET(EVNTFLAG,0)
+42 ; --Get user's division parameters, preferences: --
+43 IF '$DATA(TIUPRM0)
DO SETPARM^TIULE
+44 SET TIUPREF=$$PERSPRF^TIULE(DUZ)
+45 ; -- multiple pts; not in OERR, not TRYing DDEF, not single docmt: --
+46 ;I $P(TIUPREF,U,6)="M",(+$G(ORVP)'>0),(+$G(NOSAVE)'>0),'+$G(TIUSNGL) D MAIN^TIUEDIM(TIUCLASS,.TIUOUT,.TIUNDA,.TIUCHNG) Q ;original VA
+47 ; -- Loop: Create docmt --
+48 ;F D Q:+$G(ORVP)!+$G(TIUOUT)!+$G(NOSAVE)!+$G(TIUSNGL) ;original VA - commented out and raised next x lines to top level
+49 NEW TIU,TIUCMMTX,TIUBY,TIUEDIT,TIUNEW,TIUTYP,VADM,VAIN,CANEDIT
+50 ; -- User specifies basic info for new docmt --
+51 ; -- Get patient --
+52 ;I +$G(ORVP) S DFN=+$G(ORVP) ;original VA
+53 ;I +$G(DFN)'>0 D I +DFN'>0 S TIUOUT=1 Q ;original VA
+54 ;. S DFN=+$$PATIENT^TIULA ;original VA
+55 ;added line
IF '$GET(BTIUDFN)
SET TIUOUT=1
QUIT
+56 ;added line
SET DFN=+BTIUDFN
+57 ; -- [For progress notes, show available notes]: --
+58 SET TIUCLASS=$GET(TIUCLASS,38)
+59 ;
+60 ;IHS/ITSC/LJF 02/26/2003 okay to edit all documents, not just progress notes
+61 ;I TIUCLASS=3,$S(+$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST"):0,1:1),(+$G(NOSAVE)'>0) D EXSTNOTE^TIUEDI2(DFN) D:$G(VALMAR)="^TMP(""OR"",$J,""CURRENT"")" FULL^VALM1
+62 IF $SELECT(+$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST"):0,1:1)
IF (+$GET(NOSAVE)'>0)
DO EXSTNOTE^TIUEDI2(DFN)
IF $GET(VALMAR)="^TMP(""OR"",$J,""CURRENT"")"
DO FULL^VALM1
+63 ;
+64 IF +$GET(DIROUT)!+$GET(DUOUT)!+$GET(DTOUT)
SET TIUOUT=1
QUIT
+65 ; -- Set title array TIUTYP (use TIUTITLE or ask user) --
+66 DO SETTL^TIUEDI4(.TIUTYP,TIUCLASS,$GET(TIUTITLE))
IF +$GET(TIUTYP)'>0
SET TIUOUT=1
QUIT
+67 ; -- Get doc parameters for title, X entry action --
+68 DO DOCPRM^TIULC1(TIUTYP,.TIUDPRM)
+69 SET TIUENTRY=$$GETENTRY^TIUEDI2(+TIUTYP)
+70 IF $LENGTH(TIUENTRY)
XECUTE TIUENTRY
+71 ; If ENTRY ACTION sets TIUOUT=1 Abort entry
IF +$GET(TIUOUT)
QUIT
+72 ; -- Set visit array TIU --
+73 ;
+74 ;D GETVST^TIUEDI4(DFN,TIUTYP,.TIU,EVNTFLAG) ;original VA
+75 ;added line
IF $GET(BTIUVSIT)
Begin DoDot:1
+76 ;added line
SET TIUVSTR=$PIECE(^AUPNVSIT(BTIUVSIT,0),U,22)_";"_+^(0)_";"_$PIECE(^(0),U,7)
+77 ;added line
DO PATVADPT^TIULV(.TIU,DFN,$$PMV^BTIUU1(+BTIUVSIT,DFN),TIUVSTR)
End DoDot:1
+78 ;
+79 IF '$DATA(TIU("VSTR"))
KILL DFN,TIUTYP
QUIT
+80 ; -- Ask OK --
+81 DO ASKOK^TIUEDI4(TIUTYP,.TIU,.TIUBY,.TIUASK)
IF '$DATA(TIU("VSTR"))
KILL DFN,TIUTYP
QUIT
+82 ;added line - ask user to edit visit
IF $GET(BTIUASKV)=1
DO VEDIT^BTIUED("NO")
+83 ;
+84 ; -- If user OK'd basic info, go on to get text, etc.: --
+85 IF $DATA(TIU)
IF +$GET(TIUASK)
Begin DoDot:1
+86 ; -- Get record DA --
+87 ; DA is either: new stub record, ready for edit, or
+88 ; existing record, for edit, or
+89 ; existing record, for addendum
+90 NEW DA
+91 SET DA=$$GETRECNW^TIUEDI3(DFN,.TIU,TIUTYP(1),.TIUNEW,.TIUDPRM,1,DUZ,.CANEDIT)
+92 IF +DA'>0
WRITE !,"Unable to enter/edit."
QUIT
+93 ; -- [Addend DA and Quit] --
+94 ; If record not new & user can't edit it, let user
+95 ; write addendum and quit:
+96 IF 'TIUNEW
IF 'CANEDIT
Begin DoDot:2
+97 DO ADDENDUM^TIUADD(DA,"",.TIUCHNG,1)
End DoDot:2
QUIT
+98 NEW TIUQUIT,TIUADD,TIUTDA
+99 ; -- Edit new or existing DA --
+100 DO DIE^TIUEDI4(DA,.TIUQUIT)
+101 ; DA doesn't exist (e.g. uparrowed w/ bad record)
IF +$GET(TIUQUIT)=2
QUIT
+102 IF $$EMPTYDOC^TIULF(DA)
DO DELETE(DA,0)
IF $GET(VALMAR)="^TMP(""TIUVIEW"",$J)"
SET VALMBCK="Q"
IF '+$GET(TIUNEW)
SET TIUCHNG("DELETE")=1
IF '+$GET(TIUNEW)
HANG 2
QUIT
+103 IF +$GET(TIUQUIT)
QUIT
+104 IF +DA
SET SUCCESS=+DA
+105 ; See TIURC, Across Patients
IF +$GET(TIUONCE)
SET TIUNDA(+$GET(DA))=""
+106 ; -- Misc after-edit-stuff for DA --
+107 ; -- Mark to ask workload at signature;
+108 ; (STOP for Stop codes for stand-alone visits): --
+109 ;piece 14 = suppress DX/CPT on entry
IF +$GET(TIU("STOP"))
IF (+$PIECE($GET(TIUDPRM(0)),U,14)'=1)
DO DEFER^TIUVSIT(DA,TIU("STOP"))
IF 1
+110 ; Post workload now in background
IF '$TEST
DO QUE^TIUPXAP1
+111 ;
+112 ;added line to update VNote file
DO VNOTE^BTIUPCC(DA,+TIU("VISIT"),DFN,"ADD")
+113 ;
+114 SET TIUCMMTX=$$COMMIT^TIULC1(+$PIECE(TIUTYP(1),U,2))
+115 IF TIUCMMTX]""
XECUTE TIUCMMTX
+116 DO RELEASE^TIUT(DA)
+117 DO VERIFY^TIUT(DA)
+118 ; -- Get signature for DA
+119 DO EDSIG^TIURS(DA)
+120 ; - execute EXIT ACTION -
+121 SET TIUEXIT=$$GETEXIT^TIUEDI2(+$PIECE(TIUTYP(1),U,2))
+122 IF $LENGTH(TIUEXIT)
SET TIUTDA=DA
XECUTE TIUEXIT
SET DA=TIUTDA
+123 ; -- [Prompt to add ID stub] --
+124 ; I +$P($G(TIUDPRM(0)),U,20) D ADDSTUB^TIUGEDIT(DA)
+125 ; -- [Prompt to print DA] --
+126 IF +$PIECE($GET(TIUDPRM(0)),U,8)
DO PRINT^TIUEPRNT(DA)
End DoDot:1
+127 ;K DFN ; Free patient ;commented out - calling routine may need DFN set
+128 ;added line - clean up variable for next note
KILL TIUTITLE
+129 SET TIUPNAME=$$PNAME^TIULC1(TIUCLASS)
+130 IF $$UP^XLFSTR($EXTRACT(TIUPNAME,$LENGTH(TIUPNAME)))="S"
SET TIUPNAME=$EXTRACT(TIUPNAME,1,$LENGTH(TIUPNAME)-1)
+131 ; -- [loop again] --
+132 ;I '+$G(NOSAVE),'+$G(ORVP),'+$G(TIUSNGL) W !!,"You may enter another ",TIUPNAME,". Press RETURN to exit.",! ;original VA
+133 QUIT
+134 ;
DELETE(TIUDA,PROMPT,MSG,HUSH) ; Delete record
+1 NEW DIDEL,DIE,DR,TIUD0,TIUVSIT,TIUVKILL,TIUDELX,TIUTYPE
+2 SET TIUD0=$GET(^TIU(8925,+TIUDA,0))
SET TIUVSIT=$PIECE(TIUD0,U,3)
SET TIUTYPE=+TIUD0
+3 IF +$GET(PROMPT)
IF '+$$READ^TIUU("YO",MSG,"NO")
WRITE !,"Nothing Deleted."
QUIT
+4 KILL ^TIU(8925,"ASAVE",DUZ,TIUDA)
+5 DO DELIRT^TIUDIRT(TIUDA)
+6 ; If a DELETE Action exists for the document definition, execute it
+7 SET TIUDELX=$$DELETE^TIULC1(TIUTYPE)
+8 IF TIUDELX]""
XECUTE TIUDELX
+9 SET DA=TIUDA
SET (DIDEL,DIE)=8925
SET DR=".01///@"
+10 DO ^DIE
IF '+$GET(HUSH)
WRITE !,"<NOTHING ENTERED. "
+11 IF '+$GET(HUSH)
IF +TIUD0
WRITE $$PNAME^TIULC1(+TIUD0)," DELETED>"
+12 DO DELCOMP^TIUEDI1(TIUDA)
DO DELAUDIT^TIUEDI1(TIUDA)
+13 ; Remove Save Flag
KILL ^TIU(8925,"ASAVE",DUZ,TIUDA)
+14 DO ALERTDEL^TIUALRT(TIUDA)
DO ADDENDEL^TIUALRT(TIUDA)
+15 ; I +TIUVSIT S TIUVKILL=$$DELVFILE^PXAPI("ALL",TIUVSIT,"","TEXT INTEGRATION UTILITIES")
+16 QUIT
+17 ;