ECDEAL2 ;ALB/MRY - Remove DSS UNITS from terminated users; 03 JUL 2009
;;2.0; EVENT CAPTURE ;**100**;8 May 96;Build 21
Q
USER ;
N ECDUZ,X,CNT,DSSU,DSSUN S (CNT,ECDUZ)=0
K ^TMP($J,"ECDEAL2"),^TMP("ECDEAL2",$J)
F S ECDUZ=$O(^VA(200,ECDUZ)) Q:'ECDUZ D
. S X=$$ACTIVE^XUSER(ECDUZ) I +X Q
. I $P(X,"^",2)'="TERMINATED" Q
. I '$O(^VA(200,ECDUZ,"EC",0)) Q
. S CNT=CNT+1,DSSU=0
. F S DSSU=$O(^VA(200,ECDUZ,"EC",DSSU)) Q:'DSSU D
. . S DSSUN=$$GET1^DIQ(724,+DSSU,.01)
. . S ^TMP($J,"ECDEAL2",DSSUN,$P(^VA(200,ECDUZ,0),"^"),ECDUZ)=""
. S DA(1)=ECDUZ,DA=0 F I=0:0 S DA=$O(^VA(200,DA(1),"EC",DA)) Q:'DA S DIK="^VA(200,"_DA(1)_",""EC""," D ^DIK
. K DA,DIK
I CNT=0 K ^TMP($J,"ECDEAL2"),^TMP("ECDEAL2",$J) Q
;
MSG ;generate message to ECXMGR mailgroup
N X,XMDUZ,XMTEXT,XMSUB,XMY,LINECT,DSSUN,EC200
S XMDUZ="EVENT CAPTURE",XMSUB="Removed Terminated Users from DSS UNIT Access"
S XMTEXT="^TMP(""ECDEAL2"",$J,",XMY(DUZ)="",XMY("G.ECMGR")=""
S ^TMP("ECDEAL2",$J,1)="Event Capture - Terminated Users removed from DSS UNITS"
S ^TMP("ECDEAL2",$J,2)=""
S ^TMP("ECDEAL2",$J,3)="Total number of Terminated users: "_CNT
S ^TMP("ECDEAL2",$J,4)=""
S ^TMP("ECDEAL2",$J,5)="DSS UNITS NAME of Terminated User Removed from DSS UNIT"
S ^TMP("ECDEAL2",$J,6)="-----------------------------------------------------------------"
S LINECT=6
S DSSUN="",CNT=0
F S DSSUN=$O(^TMP($J,"ECDEAL2",DSSUN)) Q:DSSUN="" D
. S SPACES="",SPACESN=0
. S ^TMP("ECDEAL2",$J,LINECT+1)=DSSUN
. S SPACESN=20-(+$L(DSSUN)) F I=1:1:SPACESN S SPACES=SPACES_" "
. S LINECT=LINECT+1
. S CNT=0,EC200=""
. F S EC200=$O(^TMP($J,"ECDEAL2",DSSUN,EC200)) Q:EC200="" D
. . S CNT=CNT+1
. . I CNT=1 S ^TMP("ECDEAL2",$J,LINECT)=^TMP("ECDEAL2",$J,LINECT)_SPACES_EC200
. . I CNT>1 S ^TMP("ECDEAL2",$J,LINECT+1)=" "_EC200
. . S LINECT=LINECT+1,CNT=CNT+1
. S ^TMP("ECDEAL2",$J,LINECT+1)=" ",LINECT=LINECT+1
I CNT=0 S ^TMP("ECDEAL2",$J,LINECT+1)="No terminated users to display."
D ^XMD K ^TMP("ECDEAL2",$J),^TMP($J,"ECDEAL2"),XMY
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECDEAL2 2077 printed Nov 22, 2024@17:07:13 Page 2
ECDEAL2 ;ALB/MRY - Remove DSS UNITS from terminated users; 03 JUL 2009
+1 ;;2.0; EVENT CAPTURE ;**100**;8 May 96;Build 21
+2 QUIT
USER ;
+1 NEW ECDUZ,X,CNT,DSSU,DSSUN
SET (CNT,ECDUZ)=0
+2 KILL ^TMP($JOB,"ECDEAL2"),^TMP("ECDEAL2",$JOB)
+3 FOR
SET ECDUZ=$ORDER(^VA(200,ECDUZ))
if 'ECDUZ
QUIT
Begin DoDot:1
+4 SET X=$$ACTIVE^XUSER(ECDUZ)
IF +X
QUIT
+5 IF $PIECE(X,"^",2)'="TERMINATED"
QUIT
+6 IF '$ORDER(^VA(200,ECDUZ,"EC",0))
QUIT
+7 SET CNT=CNT+1
SET DSSU=0
+8 FOR
SET DSSU=$ORDER(^VA(200,ECDUZ,"EC",DSSU))
if 'DSSU
QUIT
Begin DoDot:2
+9 SET DSSUN=$$GET1^DIQ(724,+DSSU,.01)
+10 SET ^TMP($JOB,"ECDEAL2",DSSUN,$PIECE(^VA(200,ECDUZ,0),"^"),ECDUZ)=""
End DoDot:2
+11 SET DA(1)=ECDUZ
SET DA=0
FOR I=0:0
SET DA=$ORDER(^VA(200,DA(1),"EC",DA))
if 'DA
QUIT
SET DIK="^VA(200,"_DA(1)_",""EC"","
DO ^DIK
+12 KILL DA,DIK
End DoDot:1
+13 IF CNT=0
KILL ^TMP($JOB,"ECDEAL2"),^TMP("ECDEAL2",$JOB)
QUIT
+14 ;
MSG ;generate message to ECXMGR mailgroup
+1 NEW X,XMDUZ,XMTEXT,XMSUB,XMY,LINECT,DSSUN,EC200
+2 SET XMDUZ="EVENT CAPTURE"
SET XMSUB="Removed Terminated Users from DSS UNIT Access"
+3 SET XMTEXT="^TMP(""ECDEAL2"",$J,"
SET XMY(DUZ)=""
SET XMY("G.ECMGR")=""
+4 SET ^TMP("ECDEAL2",$JOB,1)="Event Capture - Terminated Users removed from DSS UNITS"
+5 SET ^TMP("ECDEAL2",$JOB,2)=""
+6 SET ^TMP("ECDEAL2",$JOB,3)="Total number of Terminated users: "_CNT
+7 SET ^TMP("ECDEAL2",$JOB,4)=""
+8 SET ^TMP("ECDEAL2",$JOB,5)="DSS UNITS NAME of Terminated User Removed from DSS UNIT"
+9 SET ^TMP("ECDEAL2",$JOB,6)="-----------------------------------------------------------------"
+10 SET LINECT=6
+11 SET DSSUN=""
SET CNT=0
+12 FOR
SET DSSUN=$ORDER(^TMP($JOB,"ECDEAL2",DSSUN))
if DSSUN=""
QUIT
Begin DoDot:1
+13 SET SPACES=""
SET SPACESN=0
+14 SET ^TMP("ECDEAL2",$JOB,LINECT+1)=DSSUN
+15 SET SPACESN=20-(+$LENGTH(DSSUN))
FOR I=1:1:SPACESN
SET SPACES=SPACES_" "
+16 SET LINECT=LINECT+1
+17 SET CNT=0
SET EC200=""
+18 FOR
SET EC200=$ORDER(^TMP($JOB,"ECDEAL2",DSSUN,EC200))
if EC200=""
QUIT
Begin DoDot:2
+19 SET CNT=CNT+1
+20 IF CNT=1
SET ^TMP("ECDEAL2",$JOB,LINECT)=^TMP("ECDEAL2",$JOB,LINECT)_SPACES_EC200
+21 IF CNT>1
SET ^TMP("ECDEAL2",$JOB,LINECT+1)=" "_EC200
+22 SET LINECT=LINECT+1
SET CNT=CNT+1
End DoDot:2
+23 SET ^TMP("ECDEAL2",$JOB,LINECT+1)=" "
SET LINECT=LINECT+1
End DoDot:1
+24 IF CNT=0
SET ^TMP("ECDEAL2",$JOB,LINECT+1)="No terminated users to display."
+25 DO ^XMD
KILL ^TMP("ECDEAL2",$JOB),^TMP($JOB,"ECDEAL2"),XMY
+26 QUIT