XUSECAD ;SFISC/SO- TERMINATED USERS AUDIT DISPLAY ;10:59 AM 23 Apr 2004
;;8.0;KERNEL;**332**;Jul 10, 1995
EP1 ;Ask user Beginning and Ending report dates
W !,"Terminated User Audit Report"_$S($D(XUSECU):" Uparrow Delimited",1:"")
N BD,ED
BD ;Get Beginning Date
N DIR,DTOUT,DUOUT,DIRUT
S DIR(0)="DA^2600101:"_DT_":EX"
S DIR("A")="Enter the Beginning Date for report: "
S DIR("?")="^D HELP^%DTC"
S DIR("??")="^D HELP^%DTC"
D ^DIR
I 'Y Q ;User Timed out, '^' out, etc.
S BD=",,"_Y
ED ;Get Ending Date
N DIR,DTOUT,DUOUT,DIRUT
S DIR(0)="DA^2600101:"_DT_":EX"
S DIR("A")="Enter the Ending Date for report: "
S DIR("?")="^D HELP^%DTC"
S DIR("??")="^D HELP^%DTC"
D ^DIR
I 'Y Q ;User Timed out, '^' out, etc.
S ED=",,"_Y
K DIR,DTOUT,DUOUT,DIRUT
I $D(XUSECU) D UPARROW K XUSECU Q
REPORT ;Do the report
N L,DIC,FR,TO,BY,FLDS,DIOBEG,DIOEND
N DIA ;Special New For AUDIT file
S DIOBEG="D BEG^XUSECAD"
S DIOEND="D END^XUSECAD"
S L=0
S DIC="^DIA(200,"
S FR=BD,TO=ED,(BY,FLDS)="[XUSEC TERMINATION REPORT]"
D EN1^DIP
Q
;
QUEUE ;Queued report for last 7 days
S BD=",,"_$$FMADD^XLFDT(DT,-8)
S ED=",,"_$$FMADD^XLFDT(DT,-1)
D REPORT
K BD,ED
Q
BEG ; Initialize
; XUSECF = 0 - User changed
; 1 - Same user
I $G(XUSECO)="" S (XUSECF,XUSECO)=0
Q
END ; Kill variables
K XUSECF,XUSECO
Q
TEST ; Test if user changed
I 'XUSECO S XUSECO=DIPA("NPIEN") Q
I XUSECO=DIPA("NPIEN") S XUSECF=1 Q
S XUSECO=DIPA("NPIEN")
S XUSECF=0 ;User changed
Q
USERH ; Stadic User Information
N IEN,DIERR,Z,ZERR
S IEN=DIPA("NPIEN"),IEN=IEN_"," ; Get IEN in file 200
; Get Name (.01)
; Get SSN (9)
; Get Service/Section (29)
; Get Date Entered (30)
D GETS^DIQ(200,IEN,".01;9;29;30","","Z","ZERR")
W !,"User: "_$G(Z(200,IEN,.01))_" SSN: "_$G(Z(200,IEN,9))
W !,"Date Entered: "_$G(Z(200,IEN,30))_" Service/Section: "_$G(Z(200,IEN,29))
K DIERR,Z,ZERR
D GETS^DIQ(200,IEN,"16*","","Z","ZERR") ;Get Division multiple
I '$D(Z(200.02)) W !?4,"Division: None Listed" Q
S IEN=""
F S IEN=$O(Z(200.02,IEN)) Q:IEN="" W !?4,"Division: "_$G(Z(200.02,IEN,.01))_" Default: "_$S($G(Z(200.02,IEN,1))["Y":"Yes",1:"No")
Q
;
Q
;
TERM S X=$S(DIPA("OVALUE")="<no previous value>":"Terminated",1:"Reactivated")
Q
;
S IEN=$$FIND1^DIC(19,"","X",DIPA("MIEN"),"B","","ZERR")
S IEN=IEN_","
D GETS^DIQ(19,IEN,".01;1","","Z","ZERR")
S X=$G(Z(19,IEN,1))_"["_$G(Z(19,IEN,.01))_"]"
Q
;
UPARROW ; Uparrow delimited report
N L,DIC,FR,TO,BY,FLDS
N DIA ;Special New For AUDIT file
S L=0
S DIC="^DIA(200,"
S FR=BD,TO=ED,BY="[XUSEC TERMINATION REPORT]",FLDS="[XUSEC UPARROW TERM REPORT]"
D EN1^DIP
Q
;
UPRPT ; Build Uparrow report line
N MIEN,NPIEN,DIERR,Z,ZERR
S NPIEN=DIPA("NPIEN"),NPIEN=NPIEN_"," ; Get IEN in file 200
D GETS^DIQ(200,NPIEN,".01;9;29;30","","Z","ZERR") ;Get New Person Info
S MIEN=$$FIND1^DIC(19,"","X",DIPA("MIEN"),"B","","ZERR")
S MIEN=MIEN_","
D GETS^DIQ(19,MIEN,".01;1","","Z","ZERR")
LINE ; Build Report Line
N LN S LN=""
S LN=LN_$G(Z(200,NPIEN,.01))_U_$G(Z(200,NPIEN,9))_U_$G(Z(200,NPIEN,30))_U
S LN=LN_$G(Z(200,NPIEN,29))_U_$$FMTE^XLFDT(DIPA("DTR"),"1P")_U
S LN=LN_$S(DIPA("OVALUE")="<no previous value>":"Terminated",1:"Reactivated")_U
S LN=LN_DIPA("USER")_U_$G(Z(19,MIEN,1))_"["_$G(Z(19,MIEN,.01))_"]"
S X=LN
Q
XUSECAD ;SFISC/SO- TERMINATED USERS AUDIT DISPLAY ;10:59 AM 23 Apr 2004
+1 ;;8.0;KERNEL;**332**;Jul 10, 1995
EP1 ;Ask user Beginning and Ending report dates
+1 WRITE !,"Terminated User Audit Report"_$SELECT($DATA(XUSECU):" Uparrow Delimited",1:"")
+2 NEW BD,ED
BD ;Get Beginning Date
+1 NEW DIR,DTOUT,DUOUT,DIRUT
+2 SET DIR(0)="DA^2600101:"_DT_":EX"
+3 SET DIR("A")="Enter the Beginning Date for report: "
+4 SET DIR("?")="^D HELP^%DTC"
+5 SET DIR("??")="^D HELP^%DTC"
+6 DO ^DIR
+7 ;User Timed out, '^' out, etc.
IF 'Y
QUIT
+8 SET BD=",,"_Y
ED ;Get Ending Date
+1 NEW DIR,DTOUT,DUOUT,DIRUT
+2 SET DIR(0)="DA^2600101:"_DT_":EX"
+3 SET DIR("A")="Enter the Ending Date for report: "
+4 SET DIR("?")="^D HELP^%DTC"
+5 SET DIR("??")="^D HELP^%DTC"
+6 DO ^DIR
+7 ;User Timed out, '^' out, etc.
IF 'Y
QUIT
+8 SET ED=",,"_Y
+9 KILL DIR,DTOUT,DUOUT,DIRUT
+10 IF $DATA(XUSECU)
DO UPARROW
KILL XUSECU
QUIT
REPORT ;Do the report
+1 NEW L,DIC,FR,TO,BY,FLDS,DIOBEG,DIOEND
+2 ;Special New For AUDIT file
NEW DIA
+3 SET DIOBEG="D BEG^XUSECAD"
+4 SET DIOEND="D END^XUSECAD"
+5 SET L=0
+6 SET DIC="^DIA(200,"
+7 SET FR=BD
SET TO=ED
SET (BY,FLDS)="[XUSEC TERMINATION REPORT]"
+8 DO EN1^DIP
+9 QUIT
+10 ;
QUEUE ;Queued report for last 7 days
+1 SET BD=",,"_$$FMADD^XLFDT(DT,-8)
+2 SET ED=",,"_$$FMADD^XLFDT(DT,-1)
+3 DO REPORT
+4 KILL BD,ED
+5 QUIT
BEG ; Initialize
+1 ; XUSECF = 0 - User changed
+2 ; 1 - Same user
+3 IF $GET(XUSECO)=""
SET (XUSECF,XUSECO)=0
+4 QUIT
END ; Kill variables
+1 KILL XUSECF,XUSECO
+2 QUIT
TEST ; Test if user changed
+1 IF 'XUSECO
SET XUSECO=DIPA("NPIEN")
QUIT
+2 IF XUSECO=DIPA("NPIEN")
SET XUSECF=1
QUIT
+3 SET XUSECO=DIPA("NPIEN")
+4 ;User changed
SET XUSECF=0
+5 QUIT
USERH ; Stadic User Information
+1 NEW IEN,DIERR,Z,ZERR
+2 ; Get IEN in file 200
SET IEN=DIPA("NPIEN")
SET IEN=IEN_","
+3 ; Get Name (.01)
+4 ; Get SSN (9)
+5 ; Get Service/Section (29)
+6 ; Get Date Entered (30)
+7 DO GETS^DIQ(200,IEN,".01;9;29;30","","Z","ZERR")
+8 WRITE !,"User: "_$GET(Z(200,IEN,.01))_" SSN: "_$GET(Z(200,IEN,9))
+9 WRITE !,"Date Entered: "_$GET(Z(200,IEN,30))_" Service/Section: "_$GET(Z(200,IEN,29))
+10 KILL DIERR,Z,ZERR
+11 ;Get Division multiple
DO GETS^DIQ(200,IEN,"16*","","Z","ZERR")
+12 IF '$DATA(Z(200.02))
WRITE !?4,"Division: None Listed"
QUIT
+13 SET IEN=""
+14 FOR
SET IEN=$ORDER(Z(200.02,IEN))
IF IEN=""
QUIT
WRITE !?4,"Division: "_$GET(Z(200.02,IEN,.01))_" Default: "_$SELECT($GET(Z(200.02,IEN,1))["Y":"Yes",1:"No")
+15 QUIT
+16 ;
+17 QUIT
+18 ;
TERM SET X=$SELECT(DIPA("OVALUE")="<no previous value>":"Terminated",1:"Reactivated")
+1 QUIT
+2 ;
+1 SET IEN=$$FIND1^DIC(19,"","X",DIPA("MIEN"),"B","","ZERR")
+2 SET IEN=IEN_","
+3 DO GETS^DIQ(19,IEN,".01;1","","Z","ZERR")
+4 SET X=$GET(Z(19,IEN,1))_"["_$GET(Z(19,IEN,.01))_"]"
+5 QUIT
+6 ;
UPARROW ; Uparrow delimited report
+1 NEW L,DIC,FR,TO,BY,FLDS
+2 ;Special New For AUDIT file
NEW DIA
+3 SET L=0
+4 SET DIC="^DIA(200,"
+5 SET FR=BD
SET TO=ED
SET BY="[XUSEC TERMINATION REPORT]"
SET FLDS="[XUSEC UPARROW TERM REPORT]"
+6 DO EN1^DIP
+7 QUIT
+8 ;
UPRPT ; Build Uparrow report line
+1 NEW MIEN,NPIEN,DIERR,Z,ZERR
+2 ; Get IEN in file 200
SET NPIEN=DIPA("NPIEN")
SET NPIEN=NPIEN_","
+3 ;Get New Person Info
DO GETS^DIQ(200,NPIEN,".01;9;29;30","","Z","ZERR")
+4 SET MIEN=$$FIND1^DIC(19,"","X",DIPA("MIEN"),"B","","ZERR")
+5 SET MIEN=MIEN_","
+6 DO GETS^DIQ(19,MIEN,".01;1","","Z","ZERR")
LINE ; Build Report Line
+1 NEW LN
SET LN=""
+2 SET LN=LN_$GET(Z(200,NPIEN,.01))_U_$GET(Z(200,NPIEN,9))_U_$GET(Z(200,NPIEN,30))_U
+3 SET LN=LN_$GET(Z(200,NPIEN,29))_U_$$FMTE^XLFDT(DIPA("DTR"),"1P")_U
+4 SET LN=LN_$SELECT(DIPA("OVALUE")="<no previous value>":"Terminated",1:"Reactivated")_U
+5 SET LN=LN_DIPA("USER")_U_$GET(Z(19,MIEN,1))_"["_$GET(Z(19,MIEN,.01))_"]"
+6 SET X=LN
+7 QUIT