AQAOUDEL ; IHS/ORDC/LJF - REOPEN AN OCCURRENCE RECORD ;
;;1.01;QAI MANAGEMENT;;OCT 05, 1995
;
;This rtn contains the user interface to reopen closed and deleted
;occurrences.
;
ASK ; >>> ask for occ id or patient name or indicator
I $D(AQAOIFN) L -^AQAOC(AQAOIFN) ;unlock last occ reopened
S AQAOINAC="" W !! K DIC S DIC="^AQAOC(",DIC(0)="AEMQZ"
S DIC("A")="Select OCCURRENCE (ID #, Patient, or Indicator): "
S DIC("S")="D OCCCHK^AQAOSEC I $D(AQAOCHK(""OK"")),($P(^(1),U)'=0)"
D ^DIC G EXIT:$D(DTOUT),EXIT:$D(DUOUT),EXIT:X="",EXIT:Y=-1
S AQAOIFN=+Y,AQAOCID=Y(0,0)
;
; >>> display occurrence
S L="",DIC="^AQAOC(",FLDS="[AQAO OCC SHORT DISPLAY]"
S BY="@NUMBER",(TO,FR)=AQAOIFN,IOP=IO(0) D EN1^DIP ;display occurrence
K DIR S DIR(0)="E"
S DIR("A")="Press RETURN to continue OR '^' to select another occurrence"
D ^DIR
;
;
REOPEN ; >>> reopen occurrence
W ! K DIR S DIR(0)="Y",DIR("B")="NO"
S DIR("A")="Are you SURE you want to REOPEN this Occurrence"
D ^DIR G EXIT:$D(DIRUT),EXIT:Y'=1
L +^AQAOC(AQAOIFN):1 I '$T D G ASK
.W !!,"CANNOT REOPEN; ANOTHER USER IS EDITING THIS OCCURRENCE.",!
L +^AQAGU(0):1 I '$T D G ASK
.W !!,"CANNOT REOPEN OCCURRENCE; AUDIT FILE LOCKED. TRY AGAIN.",!
W !!!?5,"Reactivating Occurrence #",AQAOCID,". . . .",!!
S AQAOUDIT("DA")=AQAOIFN,AQAOUDIT("ACTION")="O"
S AQAOUDIT("COMMENT")="REOPENING A RECORD" D ^AQAOAUD
K DIE S DIE="^AQAOC(",DA=AQAOIFN,DR="[AQAO REOPEN]" D ^DIE
;
EXIT ; >> eoj
I $D(AQAOIFN) L -^AQAOC(AQAOIFN)
D KILL^AQAOUTIL K AQAOINAC Q
AQAOUDEL ; IHS/ORDC/LJF - REOPEN AN OCCURRENCE RECORD ;
+1 ;;1.01;QAI MANAGEMENT;;OCT 05, 1995
+2 ;
+3 ;This rtn contains the user interface to reopen closed and deleted
+4 ;occurrences.
+5 ;
ASK ; >>> ask for occ id or patient name or indicator
+1 ;unlock last occ reopened
IF $DATA(AQAOIFN)
LOCK -^AQAOC(AQAOIFN)
+2 SET AQAOINAC=""
WRITE !!
KILL DIC
SET DIC="^AQAOC("
SET DIC(0)="AEMQZ"
+3 SET DIC("A")="Select OCCURRENCE (ID #, Patient, or Indicator): "
+4 SET DIC("S")="D OCCCHK^AQAOSEC I $D(AQAOCHK(""OK"")),($P(^(1),U)'=0)"
+5 DO ^DIC
IF $DATA(DTOUT)
GOTO EXIT
IF $DATA(DUOUT)
GOTO EXIT
IF X=""
GOTO EXIT
IF Y=-1
GOTO EXIT
+6 SET AQAOIFN=+Y
SET AQAOCID=Y(0,0)
+7 ;
+8 ; >>> display occurrence
+9 SET L=""
SET DIC="^AQAOC("
SET FLDS="[AQAO OCC SHORT DISPLAY]"
+10 ;display occurrence
SET BY="@NUMBER"
SET (TO,FR)=AQAOIFN
SET IOP=IO(0)
DO EN1^DIP
+11 KILL DIR
SET DIR(0)="E"
+12 SET DIR("A")="Press RETURN to continue OR '^' to select another occurrence"
+13 DO ^DIR
+14 ;
+15 ;
REOPEN ; >>> reopen occurrence
+1 WRITE !
KILL DIR
SET DIR(0)="Y"
SET DIR("B")="NO"
+2 SET DIR("A")="Are you SURE you want to REOPEN this Occurrence"
+3 DO ^DIR
IF $DATA(DIRUT)
GOTO EXIT
IF Y'=1
GOTO EXIT
+4 LOCK +^AQAOC(AQAOIFN):1
IF '$TEST
Begin DoDot:1
+5 WRITE !!,"CANNOT REOPEN; ANOTHER USER IS EDITING THIS OCCURRENCE.",!
End DoDot:1
GOTO ASK
+6 LOCK +^AQAGU(0):1
IF '$TEST
Begin DoDot:1
+7 WRITE !!,"CANNOT REOPEN OCCURRENCE; AUDIT FILE LOCKED. TRY AGAIN.",!
End DoDot:1
GOTO ASK
+8 WRITE !!!?5,"Reactivating Occurrence #",AQAOCID,". . . .",!!
+9 SET AQAOUDIT("DA")=AQAOIFN
SET AQAOUDIT("ACTION")="O"
+10 SET AQAOUDIT("COMMENT")="REOPENING A RECORD"
DO ^AQAOAUD
+11 KILL DIE
SET DIE="^AQAOC("
SET DA=AQAOIFN
SET DR="[AQAO REOPEN]"
DO ^DIE
+12 ;
EXIT ; >> eoj
+1 IF $DATA(AQAOIFN)
LOCK -^AQAOC(AQAOIFN)
+2 DO KILL^AQAOUTIL
KILL AQAOINAC
QUIT