DG53351 ;ALB/JAN - Post-Install to clean Enrollment Status ; 6-22-2001
;;5.3;Registration;**351,1015**;June 22, 2001;Build 21
;
; This routine is a post-installation for patch DG*5.3*351
;
; The clean up is required as there are a number of multiple entries
; in the "AENRC" cross-reference of the PATIENT file (#2). When
; appropriate, this field will be populated via a trigger on ENROLLMENT
; STATUS field (#.04) of the PATIENT ENROLLMENT file (#27.11).
;
; ^XTMP("DG-DTC") track number of records processed.
; ^XTMP("DG-AENRC") contains multiple entries in "AENRC" x-reference
;
POST ;
; Post-install set up checkpoint and tracking global...
K ^XTMP("DG-DTC"),^XTMP("DG-AENRC")
N %,I,X,X1,X2
I $D(XPDNM) D
. ; checkpoints
.I $$VERCP^XPDUTL("STATUS")'>0 D
..S %=$$NEWCP^XPDUTL("STATUS","",0)
.I $$VERCP^XPDUTL("DGDFN")'>0 D
..S %=$$NEWCP^XPDUTL("DGDFN","",0)
;
; initialize tracking global (see text above for description)...
F I="DTC","AENRC" D
.I $D(^XTMP("DG-"_I)) Q
.S X1=DT,X2=30 D C^%DTC
.S ^XTMP("DG-"_I,0)=X_U_$$DT^XLFDT_"^DG*5.3*351 POST INSTALL "_$S(I="DTC":"record count",I="AENRC":"records corrected",1:"filing errors")
I '$D(XPDNM) S ^XTMP("DG-DTC",1)=0
;
EN ; begin processing...
N %
; check status and if root checkpoint has not completed start clean up
I $D(XPDNM) S %=$$VERCP^XPDUTL("STATUS") I '$D(^XTMP("DG-DTC",1)) S ^XTMP("DG-DTC",1)=0
I $G(%)="" S %=0
I %=0 D EN1
Q
;
EN1 ; begin cleanup
D DGLOOP
; send mailman message to users with results
D MAIL^DG53351M
I $D(XPDNM) S %=$$COMCP^XPDUTL("STATUS"),%=$$COMCP^XPDUTL("DGDFN")
D BMES^XPDUTL(" >> cleanup process completed "_$$FMTE^XLFDT($$NOW^XLFDT))
K ^XTMP("DG-DTC"),^XTMP("DG-AENRC")
Q
;
DGLOOP ;
; write message to installation device and to INSTALL file (#9.7)
D BMES^XPDUTL("POST INSTALLATION PROCESSING")
D MES^XPDUTL("----------------------------")
D MES^XPDUTL("Once the post-install is completed, a mail message will")
D MES^XPDUTL("be sent that will report the number of multiple entries")
D MES^XPDUTL("of enrollment status that were cleaned up.")
D BMES^XPDUTL("Beginning clean-up process "_$$FMTE^XLFDT($$NOW^XLFDT))
;
; process control body
N DGDFN,IEN,STATUS,DGSTATUS
;
; start loop "AENRC" x-ref in PATIENT file to search for multiple
; entries of current enrollment status.
I '$D(XPDNM) S STATUS=0
I $D(XPDNM) S STATUS=$$PARCP^XPDUTL("STATUS"),DGDFN=$$PARCP^XPDUTL("DGDFN")
; loop "AENRC" x-ref and check for multiple entries
N DGPAT,DGSSN,DGENR
F S STATUS=$O(^DPT("AENRC",STATUS)) Q:'STATUS D
.S DGDFN=0 F S DGDFN=$O(^DPT("AENRC",STATUS,DGDFN)) Q:'DGDFN D
..S DGSTATUS=$$STATUS^DGENA(DGDFN)
..I $G(DGSTATUS)="",$D(^DPT("AENRC",STATUS,DGDFN)) D
...S DGENR="NULL VALUE IN FILE #27.11" D KILL1
..I +$G(DGSTATUS),STATUS'=DGSTATUS,$D(^DPT("AENRC",DGSTATUS,DGDFN)) D
...S DGENR=$P($G(^DGEN(27.15,STATUS,0)),U) D KILL1
...S ^DPT("AENRC",DGSTATUS,DGDFN)=""
..I $D(XDPNM) S %=$$UPCP^XPDUTL("DGDFN")
.I $D(XPDNM) S %=$$UPCP^XPDUTL("STATUS")
Q
KILL1 ; Cleanup those entries in "AENRC" x-ref in the PATIENT file that have
; multiple entries
S DGPAT=$P($G(^DPT(DGDFN,0)),U),DGSSN=$E($P($G(^DPT(DGDFN,0)),U,9),6,9)
S ^XTMP("DG-AENRC",DGDFN,STATUS)=DGPAT_"^"_DGSSN_"^"_DGENR
S ^XTMP("DG-DTC",1)=$G(^XTMP("DG-DTC",1))+1
D KILL1^DGENDD(DGDFN)
Q
DG53351 ;ALB/JAN - Post-Install to clean Enrollment Status ; 6-22-2001
+1 ;;5.3;Registration;**351,1015**;June 22, 2001;Build 21
+2 ;
+3 ; This routine is a post-installation for patch DG*5.3*351
+4 ;
+5 ; The clean up is required as there are a number of multiple entries
+6 ; in the "AENRC" cross-reference of the PATIENT file (#2). When
+7 ; appropriate, this field will be populated via a trigger on ENROLLMENT
+8 ; STATUS field (#.04) of the PATIENT ENROLLMENT file (#27.11).
+9 ;
+10 ; ^XTMP("DG-DTC") track number of records processed.
+11 ; ^XTMP("DG-AENRC") contains multiple entries in "AENRC" x-reference
+12 ;
POST ;
+1 ; Post-install set up checkpoint and tracking global...
+2 KILL ^XTMP("DG-DTC"),^XTMP("DG-AENRC")
+3 NEW %,I,X,X1,X2
+4 IF $DATA(XPDNM)
Begin DoDot:1
+5 ; checkpoints
+6 IF $$VERCP^XPDUTL("STATUS")'>0
Begin DoDot:2
+7 SET %=$$NEWCP^XPDUTL("STATUS","",0)
End DoDot:2
+8 IF $$VERCP^XPDUTL("DGDFN")'>0
Begin DoDot:2
+9 SET %=$$NEWCP^XPDUTL("DGDFN","",0)
End DoDot:2
End DoDot:1
+10 ;
+11 ; initialize tracking global (see text above for description)...
+12 FOR I="DTC","AENRC"
Begin DoDot:1
+13 IF $DATA(^XTMP("DG-"_I))
QUIT
+14 SET X1=DT
SET X2=30
DO C^%DTC
+15 SET ^XTMP("DG-"_I,0)=X_U_$$DT^XLFDT_"^DG*5.3*351 POST INSTALL "_$S(I="DTC":"record count",I="AENRC":"records corrected",1:"filing errors")
End DoDot:1
+16 IF '$DATA(XPDNM)
SET ^XTMP("DG-DTC",1)=0
+17 ;
EN ; begin processing...
+1 NEW %
+2 ; check status and if root checkpoint has not completed start clean up
+3 IF $DATA(XPDNM)
SET %=$$VERCP^XPDUTL("STATUS")
IF '$DATA(^XTMP("DG-DTC",1))
SET ^XTMP("DG-DTC",1)=0
+4 IF $GET(%)=""
SET %=0
+5 IF %=0
DO EN1
+6 QUIT
+7 ;
EN1 ; begin cleanup
+1 DO DGLOOP
+2 ; send mailman message to users with results
+3 DO MAIL^DG53351M
+4 IF $DATA(XPDNM)
SET %=$$COMCP^XPDUTL("STATUS")
SET %=$$COMCP^XPDUTL("DGDFN")
+5 DO BMES^XPDUTL(" >> cleanup process completed "_$$FMTE^XLFDT($$NOW^XLFDT))
+6 KILL ^XTMP("DG-DTC"),^XTMP("DG-AENRC")
+7 QUIT
+8 ;
DGLOOP ;
+1 ; write message to installation device and to INSTALL file (#9.7)
+2 DO BMES^XPDUTL("POST INSTALLATION PROCESSING")
+3 DO MES^XPDUTL("----------------------------")
+4 DO MES^XPDUTL("Once the post-install is completed, a mail message will")
+5 DO MES^XPDUTL("be sent that will report the number of multiple entries")
+6 DO MES^XPDUTL("of enrollment status that were cleaned up.")
+7 DO BMES^XPDUTL("Beginning clean-up process "_$$FMTE^XLFDT($$NOW^XLFDT))
+8 ;
+9 ; process control body
+10 NEW DGDFN,IEN,STATUS,DGSTATUS
+11 ;
+12 ; start loop "AENRC" x-ref in PATIENT file to search for multiple
+13 ; entries of current enrollment status.
+14 IF '$DATA(XPDNM)
SET STATUS=0
+15 IF $DATA(XPDNM)
SET STATUS=$$PARCP^XPDUTL("STATUS")
SET DGDFN=$$PARCP^XPDUTL("DGDFN")
+16 ; loop "AENRC" x-ref and check for multiple entries
+17 NEW DGPAT,DGSSN,DGENR
+18 FOR
SET STATUS=$ORDER(^DPT("AENRC",STATUS))
IF 'STATUS
QUIT
Begin DoDot:1
+19 SET DGDFN=0
FOR
SET DGDFN=$ORDER(^DPT("AENRC",STATUS,DGDFN))
IF 'DGDFN
QUIT
Begin DoDot:2
+20 SET DGSTATUS=$$STATUS^DGENA(DGDFN)
+21 IF $GET(DGSTATUS)=""
IF $DATA(^DPT("AENRC",STATUS,DGDFN))
Begin DoDot:3
+22 SET DGENR="NULL VALUE IN FILE #27.11"
DO KILL1
End DoDot:3
+23 IF +$GET(DGSTATUS)
IF STATUS'=DGSTATUS
IF $DATA(^DPT("AENRC",DGSTATUS,DGDFN))
Begin DoDot:3
+24 SET DGENR=$PIECE($GET(^DGEN(27.15,STATUS,0)),U)
DO KILL1
+25 SET ^DPT("AENRC",DGSTATUS,DGDFN)=""
End DoDot:3
+26 IF $DATA(XDPNM)
SET %=$$UPCP^XPDUTL("DGDFN")
End DoDot:2
+27 IF $DATA(XPDNM)
SET %=$$UPCP^XPDUTL("STATUS")
End DoDot:1
+28 QUIT
KILL1 ; Cleanup those entries in "AENRC" x-ref in the PATIENT file that have
+1 ; multiple entries
+2 SET DGPAT=$PIECE($GET(^DPT(DGDFN,0)),U)
SET DGSSN=$EXTRACT($PIECE($GET(^DPT(DGDFN,0)),U,9),6,9)
+3 SET ^XTMP("DG-AENRC",DGDFN,STATUS)=DGPAT_"^"_DGSSN_"^"_DGENR
+4 SET ^XTMP("DG-DTC",1)=$GET(^XTMP("DG-DTC",1))+1
+5 DO KILL1^DGENDD(DGDFN)
+6 QUIT