XUMVIDTA ;MVI/CKN - MVI New Person Data Analysis ;8/20/19 11:03
;;8.0;KERNEL;**705,711,710**;Jul 10, 1995;Build 2
Q
EP(RETURN,SEL,ACTSEL) ;
;RPC - XUS MVI NEW PERSON DATA
;This RPC is called by MPI to get data analysis report from
;NEW PERSON file (#200) for active VistA sites
;Input:
; SEL (Required) - 1 : All - Active New Person and Non Active New Person
; 2 : Active New Person
; 3 : Non Active New Person
; ACTSEL (Optional for Non Active) - 1 : All
; 1 : All
; 2 : Active records having a SecID value
; 3 : Active records having an Email value
; 4 : Active records having a NT USERNAME value
;Output:
; RETURN - Total Count^Total Non Active^Total Active^Total SECID^Total Email
; ^Total NT User^Total Visitors
;
N XUDUZ,U,TOTVIS,TOTCNT,NONACT,ACT,TOTNACT,TOTACT,TOTSECID,TOTEMAIL,TOTNTUSR,ARR
S (TOTCNT,TOTNACT,TOTACT,TOTSECID,TOTEMAIL,TOTNTUSR,TOTVIS)=0
S U="^"
S XUDUZ=.9 F S XUDUZ=$O(^VA(200,XUDUZ)) Q:+XUDUZ=0 D
.K ARR
.S TOTCNT=TOTCNT+1
.D GET(XUDUZ,.ARR)
.I $G(ARR("VISITOR"))=1 S TOTVIS=TOTVIS+1 ; Visitor records ;**710 - STORY_952862 (dri) remove QUIT to stop filtering, allow person to also be counted as active
.;Inactive New Person
.I SEL=3 D Q
..S NONACT=$$NONACT(.ARR)
..I NONACT S TOTNACT=TOTNACT+1
.;Active New Person
.I SEL=2 D Q
..S ACT=$$ACT(.ARR) I 'ACT Q
..S TOTACT=TOTACT+1
..D GETACT(ACTSEL,.ARR)
.;All Active and Inactive New Person
.I SEL=1 D
..S NONACT=$$NONACT(.ARR) I NONACT S TOTNACT=TOTNACT+1 Q
..I '$$ACT(.ARR) Q
..S TOTACT=TOTACT+1
..D GETACT(ACTSEL,.ARR)
;
;RETURN - Total Count^Total Non Active^Total Active^Total SECID^Total Email
; ^Total NT User^Total Visitors
S RETURN=TOTCNT_U_TOTNACT_U_TOTACT_U_TOTSECID_U_TOTEMAIL_U_TOTNTUSR_U_TOTVIS
Q
GET(XUDUZ,ARR) ;
;Get all necessary fields from New Person file (#200)
N NPDATA
S DR="201;205.1;205.5;501.1;7;9.2",DIC=200,DA=XUDUZ,DIQ="NPDATA",DIQ(0)="I" D EN^DIQ1
S ARR("PRIMOPT")=$G(NPDATA(200,XUDUZ,201,"I"))
S ARR("SECID")=$G(NPDATA(200,XUDUZ,205.1,"I"))
S ARR("EMAIL")=$G(NPDATA(200,XUDUZ,205.5,"I"))
S ARR("NTUSR")=$G(NPDATA(200,XUDUZ,501.1,"I"))
S ARR("DISUSR")=$G(NPDATA(200,XUDUZ,7,"I"))
S ARR("TERMDT")=$G(NPDATA(200,XUDUZ,9.2,"I"))
I $O(^VA(200,XUDUZ,8910,0)) S ARR("VSTDATA")=1
I $G(ARR("VSTDATA")),$G(ARR("PRIMOPT"))'="" S ARR("VISITOR")=1
K DIC,DA,DR,DIQ
Q
NONACT(ARR) ;
;Inactive Person - Disuser=Y and/or Termination date is not a future date
I $G(ARR("DISUSR"))=1!(($G(ARR("TERMDT"))'="")&($G(ARR("TERMDT"))'>DT)) Q 1
Q 0
ACT(ARR) ;
;Active Person - not Disuser=Y and/or no Termination date.
;**711 Story 977780 (ckn) - Add check for primary option assigned.
I $G(ARR("DISUSR"))'=1,($G(ARR("TERMDT"))=""!($G(ARR("TERMDT"))>DT)),($G(ARR("PRIMOPT"))'="") Q 1
Q 0
GETACT(ACTSEL,ARR) ;
;Aggregate total Active records has a SECID value
I ACTSEL=2,$G(ARR("SECID"))'="" S TOTSECID=TOTSECID+1 Q
;Agreegate total Active records has an Email value
I ACTSEL=3,$G(ARR("EMAIL"))'="" S TOTEMAIL=TOTEMAIL+1 Q
;Aggregate total Active records has a NT UserName value
I ACTSEL=4,$G(ARR("NTUSR"))'="" S TOTNTUSR=TOTNTUSR+1 Q
;Aggregate all - SECID, AUPDN and NT UserName
I ACTSEL=1 D
.I $G(ARR("SECID"))'="" S TOTSECID=TOTSECID+1
.I $G(ARR("EMAIL"))'="" S TOTEMAIL=TOTEMAIL+1
.I $G(ARR("NTUSR"))'="" S TOTNTUSR=TOTNTUSR+1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUMVIDTA 3516 printed Dec 13, 2024@02:11:16 Page 2
XUMVIDTA ;MVI/CKN - MVI New Person Data Analysis ;8/20/19 11:03
+1 ;;8.0;KERNEL;**705,711,710**;Jul 10, 1995;Build 2
+2 QUIT
EP(RETURN,SEL,ACTSEL) ;
+1 ;RPC - XUS MVI NEW PERSON DATA
+2 ;This RPC is called by MPI to get data analysis report from
+3 ;NEW PERSON file (#200) for active VistA sites
+4 ;Input:
+5 ; SEL (Required) - 1 : All - Active New Person and Non Active New Person
+6 ; 2 : Active New Person
+7 ; 3 : Non Active New Person
+8 ; ACTSEL (Optional for Non Active) - 1 : All
+9 ; 1 : All
+10 ; 2 : Active records having a SecID value
+11 ; 3 : Active records having an Email value
+12 ; 4 : Active records having a NT USERNAME value
+13 ;Output:
+14 ; RETURN - Total Count^Total Non Active^Total Active^Total SECID^Total Email
+15 ; ^Total NT User^Total Visitors
+16 ;
+17 NEW XUDUZ,U,TOTVIS,TOTCNT,NONACT,ACT,TOTNACT,TOTACT,TOTSECID,TOTEMAIL,TOTNTUSR,ARR
+18 SET (TOTCNT,TOTNACT,TOTACT,TOTSECID,TOTEMAIL,TOTNTUSR,TOTVIS)=0
+19 SET U="^"
+20 SET XUDUZ=.9
FOR
SET XUDUZ=$ORDER(^VA(200,XUDUZ))
if +XUDUZ=0
QUIT
Begin DoDot:1
+21 KILL ARR
+22 SET TOTCNT=TOTCNT+1
+23 DO GET(XUDUZ,.ARR)
+24 ; Visitor records ;**710 - STORY_952862 (dri) remove QUIT to stop filtering, allow person to also be counted as active
IF $GET(ARR("VISITOR"))=1
SET TOTVIS=TOTVIS+1
+25 ;Inactive New Person
+26 IF SEL=3
Begin DoDot:2
+27 SET NONACT=$$NONACT(.ARR)
+28 IF NONACT
SET TOTNACT=TOTNACT+1
End DoDot:2
QUIT
+29 ;Active New Person
+30 IF SEL=2
Begin DoDot:2
+31 SET ACT=$$ACT(.ARR)
IF 'ACT
QUIT
+32 SET TOTACT=TOTACT+1
+33 DO GETACT(ACTSEL,.ARR)
End DoDot:2
QUIT
+34 ;All Active and Inactive New Person
+35 IF SEL=1
Begin DoDot:2
+36 SET NONACT=$$NONACT(.ARR)
IF NONACT
SET TOTNACT=TOTNACT+1
QUIT
+37 IF '$$ACT(.ARR)
QUIT
+38 SET TOTACT=TOTACT+1
+39 DO GETACT(ACTSEL,.ARR)
End DoDot:2
End DoDot:1
+40 ;
+41 ;RETURN - Total Count^Total Non Active^Total Active^Total SECID^Total Email
+42 ; ^Total NT User^Total Visitors
+43 SET RETURN=TOTCNT_U_TOTNACT_U_TOTACT_U_TOTSECID_U_TOTEMAIL_U_TOTNTUSR_U_TOTVIS
+44 QUIT
GET(XUDUZ,ARR) ;
+1 ;Get all necessary fields from New Person file (#200)
+2 NEW NPDATA
+3 SET DR="201;205.1;205.5;501.1;7;9.2"
SET DIC=200
SET DA=XUDUZ
SET DIQ="NPDATA"
SET DIQ(0)="I"
DO EN^DIQ1
+4 SET ARR("PRIMOPT")=$GET(NPDATA(200,XUDUZ,201,"I"))
+5 SET ARR("SECID")=$GET(NPDATA(200,XUDUZ,205.1,"I"))
+6 SET ARR("EMAIL")=$GET(NPDATA(200,XUDUZ,205.5,"I"))
+7 SET ARR("NTUSR")=$GET(NPDATA(200,XUDUZ,501.1,"I"))
+8 SET ARR("DISUSR")=$GET(NPDATA(200,XUDUZ,7,"I"))
+9 SET ARR("TERMDT")=$GET(NPDATA(200,XUDUZ,9.2,"I"))
+10 IF $ORDER(^VA(200,XUDUZ,8910,0))
SET ARR("VSTDATA")=1
+11 IF $GET(ARR("VSTDATA"))
IF $GET(ARR("PRIMOPT"))'=""
SET ARR("VISITOR")=1
+12 KILL DIC,DA,DR,DIQ
+13 QUIT
NONACT(ARR) ;
+1 ;Inactive Person - Disuser=Y and/or Termination date is not a future date
+2 IF $GET(ARR("DISUSR"))=1!(($GET(ARR("TERMDT"))'="")&($GET(ARR("TERMDT"))'>DT))
QUIT 1
+3 QUIT 0
ACT(ARR) ;
+1 ;Active Person - not Disuser=Y and/or no Termination date.
+2 ;**711 Story 977780 (ckn) - Add check for primary option assigned.
+3 IF $GET(ARR("DISUSR"))'=1
IF ($GET(ARR("TERMDT"))=""!($GET(ARR("TERMDT"))>DT))
IF ($GET(ARR("PRIMOPT"))'="")
QUIT 1
+4 QUIT 0
GETACT(ACTSEL,ARR) ;
+1 ;Aggregate total Active records has a SECID value
+2 IF ACTSEL=2
IF $GET(ARR("SECID"))'=""
SET TOTSECID=TOTSECID+1
QUIT
+3 ;Agreegate total Active records has an Email value
+4 IF ACTSEL=3
IF $GET(ARR("EMAIL"))'=""
SET TOTEMAIL=TOTEMAIL+1
QUIT
+5 ;Aggregate total Active records has a NT UserName value
+6 IF ACTSEL=4
IF $GET(ARR("NTUSR"))'=""
SET TOTNTUSR=TOTNTUSR+1
QUIT
+7 ;Aggregate all - SECID, AUPDN and NT UserName
+8 IF ACTSEL=1
Begin DoDot:1
+9 IF $GET(ARR("SECID"))'=""
SET TOTSECID=TOTSECID+1
+10 IF $GET(ARR("EMAIL"))'=""
SET TOTEMAIL=TOTEMAIL+1
+11 IF $GET(ARR("NTUSR"))'=""
SET TOTNTUSR=TOTNTUSR+1
End DoDot:1
+12 QUIT