TIUELST ; SLC/JER - Review Filer Events ;9/24/03
;;1.0;TEXT INTEGRATION UTILITIES;**81,113**;Jun 20, 1997
EN ; Invoke List Manager
D EN^VALM("TIU REVIEW FILING EVENTS")
S VALMBCK="Q"
Q
MAKELIST ; Build review screen list
; For Types 1;FILING ERRORS and
; 2;MISSING FIELD ERRORS,
;status is 0;UNRESOLVED or
; 1;RESOLVED or
; 2;UNRESOLVED/RESOLVED.
; For Types 0;SUCCESSFUL FILING EVENTS and
; 3;FILING EVENTS,
;status is "".
N TIUI,TIUTMP,TYPE,STATUS,TIUK
DIVISION ; Select Division(s)
D SELDIV^TIULA
I SELDIV'>0 S VALMQUIT=1 Q
I $D(TIUDI) D
. S TIUK=0 F S TIUK=$O(TIUDI(TIUK)) Q:'TIUK D
. . S TIUDI("ENTRIES")=$G(TIUDI("ENTRIES"))_TIUK_";"
E D
. S TIUDI("ENTRIES")="ALL DIVISIONS"
S TYPE=$$SELTYPE("FILING ERRORS")
I +TYPE=1 S STATUS=$$SELRES("UNRESOLVED") ; 1: Filing errors
I +TYPE=2 S STATUS=$$SELRES("UNRESOLVED") ; 2: Missing Field errors
I +TYPE=0 S STATUS="" ; 0: Successful filing events
I +TYPE=3 S STATUS="" ; 3: All filing events
I '$D(STATUS) S STATUS=""
I +$G(DIRUT) S VALMQUIT=1 Q
S TIUEDT=$$EDATE^TIULA("Event","T-30")
I TIUEDT'>0 S VALMQUIT=1 Q
S TIULDT=$$LDATE^TIULA("Event")
I TIULDT'>0 S VALMQUIT=1 Q
; If TIUEDT is NOT earlier than TIULDT, then swap
I TIUEDT>TIULDT S TIUTMP=TIUEDT,TIUEDT=TIULDT,TIULDT=TIUTMP
W !,"Searching for the events."
D BUILD(TYPE,STATUS,TIUEDT,TIULDT,.TIUDI)
K TIUDI,SELDIV
Q
SELTYPE(DFLT) ; Select Event Type
N PRMT,READTYPE,X,Y
S PRMT="Select Event Type: "
S READTYPE="SMA^F:Filing Errors;M:Missing Field Errors;S:Successes;A:All Events"
S Y=$P($$READ^TIUU(READTYPE,PRMT,DFLT),U)
S Y=$S(Y="S":"0;SUCCESSFUL FILING EVENTS",Y="F":"1;FILING ERRORS",Y="M":"2;MISSING FIELD ERRORS",1:"3;FILING EVENTS")
Q Y
SELRES(DFLT) ; Select Resolution status
N PRMT,READTYPE,X,Y
S PRMT="Select Resolution Status: "
S READTYPE="SAM^U:Unresolved Errors;R:Resolved Errors;B:Both Unresolved and Resolved"
S Y=$P($$READ^TIUU(READTYPE,PRMT,DFLT),U)
S Y=$S(Y="U":"0;UNRESOLVED",Y="R":"1;RESOLVED",1:"2;UNRESOLVED/RESOLVED")
Q Y
;
BUILD(TIUTYP,STATUS,EARLY,LATE,DIVIFNS) ; Build List
N TIUCNT,TIUI,TIUJ,TIUK,TIUP,TIUPICK,TIUREC,TIUSTAT,XREF
S VALMCNT=0
K ^TMP("TIUERR",$J),^TMP("TIUERRIDX",$J)
S TIUPICK=+$O(^ORD(101,"B","TIU ACTION SELECT LIST ELEMENT",0))
I '$D(TIUPRM0)!'$D(TIUPRM0) D SETPARM^TIULE
; For type 3 ALL events, get types 0 for SUCCESSFUL, 1 for FILING ERROR,
;& 2 for MISSING FIELD ERROR. For other types, just get that type:
F TYPE=$S(+TIUTYP=3:0,1:+TIUTYP):1:$S(+TIUTYP=3:2,1:+TIUTYP) D
. S TIUI=0 F S TIUI=$O(^TIU(8925.4,"D",TYPE,TIUI)) Q:+TIUI'>0 D
. . I +$G(^TIU(8925.4,+TIUI,0))'<EARLY,(+$G(^(0))'>LATE) D
. . . ; If status is UNRESOLVED or RESOLVED, get only matching status;
. . . I STATUS'="",+STATUS'=2 Q:+STATUS'=$P($G(^TIU(8925.4,+TIUI,0)),U,6)
. . . I +$G(DIVIFNS("ENTRIES")),'$$ININST(+TIUI,.DIVIFNS) Q
. . . N DIC,DIQ,DA,DR,TIUERR,EDT,RDT,DTYPE,EDESC,USER,ETYPE,INST,INSTA,TIUSTN
. . . S DIQ="TIUERR",DIC=8925.4,DIQ(0)="IE",DA=TIUI
. . . S DR=".01:.09" D EN^DIQ1
. . . S USER=$$NAME^TIULS(TIUERR(8925.4,DA,.02,"E"),"LAST, FIRST")
. . . S EDT=$$DATE^TIULS(TIUERR(8925.4,DA,.01,"I"),"MM/DD/YY HR:MIN")
. . . S RDT=$$DATE^TIULS(TIUERR(8925.4,DA,.07,"I"),"MM/DD/YY HR:MIN")
. . . S DTYPE=TIUERR(8925.4,DA,.03,"E")
. . . S ETYPE=TIUERR(8925.4,DA,.08,"E"),EDESC=TIUERR(8925.4,DA,.04,"E")
. . . S INSTA="",INST=TIUERR(8925.4,DA,.09,"I")
. . . I INST D
. . . . S TIUSTN=$$NS^XUAF4(INST)
. . . . I $P(TIUSTN,U,2)]"" S INSTA=$P(TIUSTN,U,2)
. . . S INSTA=$E(INSTA,1,8)
. . . S TIUCNT=+$G(TIUCNT)+1
. . . S TIUREC=$$SETFLD^VALM1(TIUCNT,"","NUMBER")
. . . S TIUREC=$$SETFLD^VALM1(DTYPE,TIUREC,"DOCUMENT TYPE")
. . . S TIUREC=$$SETFLD^VALM1(ETYPE,TIUREC,"EVENT TYPE")
. . . S TIUREC=$$SETFLD^VALM1(EDT,TIUREC,"EVENT DATE/TIME")
. . . S TIUREC=$$SETFLD^VALM1(RDT,TIUREC,"RESOL DATE/TIME")
. . . S TIUREC=$$SETFLD^VALM1(USER,TIUREC,"USER NAME")
. . . S TIUREC=$$SETFLD^VALM1(INSTA,TIUREC,"DIVISION")
. . . S VALMCNT=+$G(VALMCNT)+1
. . . S ^TMP("TIUERR",$J,VALMCNT,0)=TIUREC
. . . S ^TMP("TIUERR",$J,"IDX",VALMCNT,TIUCNT)=""
. . . S ^TMP("TIUERR",$J,"PICK",TIUCNT,VALMCNT)=""
. . . D FLDCTRL^VALM10(VALMCNT,"NUMBER",IOINHI,IOINORM)
. . . S VALMCNT=+$G(VALMCNT)+1 W:VALMCNT#5'>0 "."
. . . S ^TMP("TIUERR",$J,VALMCNT,0)=$$SETFLD^VALM1(EDESC,"","DESCRIPTION")
. . . S ^TMP("TIUERR",$J,"IDX",VALMCNT,TIUCNT)=""
. . . S ^TMP("TIUERR",$J,"PICK",TIUCNT,VALMCNT)=""
. . . S ^TMP("TIUERRIDX",$J,TIUCNT)=VALMCNT_U_TIUI_U_$P(^TIU(8925.4,+TIUI,0),U,5)
;
S ^TMP("TIUERR",$J,0)=+$G(TIUCNT)_U_TIUTYP_U_STATUS
S ^TMP("TIUERR",$J,"#")=TIUPICK_"^1:"_+$G(TIUCNT)
M ^TMP("TIUERR",$J,"DIV")=DIVIFNS
I $D(VALMHDR)>9 D HDR
I +$G(TIUCNT)'>0 D
. S ^TMP("TIUERR",$J,1,0)="",VALMCNT=2
. I +TIUTYP=1!(+TIUTYP=2) S STATUS=$$LOWER^TIULS($P(STATUS,";",2)),STATUS=STATUS_" "
. S ^TMP("TIUERR",$J,2,0)="No "_STATUS_$$LOWER^TIULS($P(TIUTYP,";",2))_" found within date/time range"
Q
ININST(TIUI,TIUDI) ; Evaluates whether a TIU UPLOAD LOG record
; is among the selected division(s)
; Input -- TIUI TIU UPLOAD LOG file (#8925.4) IEN
; -- TIUDI( i.e. TIUDI(file #40.8 IEN)=Institution file
; pointer for file #40.8 entry
; Output - TIUY 0= record not in selected division
; 1= record in selected division
N TIUIFP,TIUJ,TIUINST,TIUY S TIUY=0
S TIUINST=+$P($G(^TIU(8925.4,+TIUI,0)),U,9)
S TIUJ=0 F S TIUJ=$O(TIUDI(TIUJ)) Q:'TIUJ!TIUY D
. S TIUIFP=$G(TIUDI(TIUJ))
. I TIUIFP=TIUINST S TIUY=1
Q TIUY
HDR ; Initialize header for review screen
N BY,TIUX,SCREEN,STATUS,TITLE
S TIUX=$G(^TMP("TIUERR",$J,0))
;TIU*1*81 status = 3rd, not 2nd piece of TIUX; hdr wrote UNRESOLVED instead of SUCCESSFUL
S TYPE=$P(TIUX,U,2),STATUS=$P(TIUX,U,3)
I +TYPE=0 S TITLE=$P(TYPE,";",2)
I +TYPE=1!(+TYPE=2) D
. S TITLE=$P(STATUS,";",2)
. S TITLE=TITLE_" "_$P(TYPE,";",2)
I +TYPE=3 S TITLE="ALL FILING EVENTS"
I '$D(TITLE) S TITLE=""
I +TIUEDT>1 S TITLE=TITLE_" from "_$$DATE^TIULS(TIUEDT,"MM/DD/YY")_" to "_$$DATE^TIULS(TIULDT,"MM/DD/YY")
S VALMHDR(1)=$$CENTER^TIULS(TITLE)
Q
CLEAN ; Clean up your mess!
K ^TMP("TIUERR",$J),^TMP("TIUERRIDX",$J) D CLEAN^VALM10
K VALMY
Q
TIUELST ; SLC/JER - Review Filer Events ;9/24/03
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**81,113**;Jun 20, 1997
EN ; Invoke List Manager
+1 DO EN^VALM("TIU REVIEW FILING EVENTS")
+2 SET VALMBCK="Q"
+3 QUIT
MAKELIST ; Build review screen list
+1 ; For Types 1;FILING ERRORS and
+2 ; 2;MISSING FIELD ERRORS,
+3 ;status is 0;UNRESOLVED or
+4 ; 1;RESOLVED or
+5 ; 2;UNRESOLVED/RESOLVED.
+6 ; For Types 0;SUCCESSFUL FILING EVENTS and
+7 ; 3;FILING EVENTS,
+8 ;status is "".
+9 NEW TIUI,TIUTMP,TYPE,STATUS,TIUK
DIVISION ; Select Division(s)
+1 DO SELDIV^TIULA
+2 IF SELDIV'>0
SET VALMQUIT=1
QUIT
+3 IF $DATA(TIUDI)
Begin DoDot:1
+4 SET TIUK=0
FOR
SET TIUK=$ORDER(TIUDI(TIUK))
IF 'TIUK
QUIT
Begin DoDot:2
+5 SET TIUDI("ENTRIES")=$GET(TIUDI("ENTRIES"))_TIUK_";"
End DoDot:2
End DoDot:1
+6 IF '$TEST
Begin DoDot:1
+7 SET TIUDI("ENTRIES")="ALL DIVISIONS"
End DoDot:1
+8 SET TYPE=$$SELTYPE("FILING ERRORS")
+9 ; 1: Filing errors
IF +TYPE=1
SET STATUS=$$SELRES("UNRESOLVED")
+10 ; 2: Missing Field errors
IF +TYPE=2
SET STATUS=$$SELRES("UNRESOLVED")
+11 ; 0: Successful filing events
IF +TYPE=0
SET STATUS=""
+12 ; 3: All filing events
IF +TYPE=3
SET STATUS=""
+13 IF '$DATA(STATUS)
SET STATUS=""
+14 IF +$GET(DIRUT)
SET VALMQUIT=1
QUIT
+15 SET TIUEDT=$$EDATE^TIULA("Event","T-30")
+16 IF TIUEDT'>0
SET VALMQUIT=1
QUIT
+17 SET TIULDT=$$LDATE^TIULA("Event")
+18 IF TIULDT'>0
SET VALMQUIT=1
QUIT
+19 ; If TIUEDT is NOT earlier than TIULDT, then swap
+20 IF TIUEDT>TIULDT
SET TIUTMP=TIUEDT
SET TIUEDT=TIULDT
SET TIULDT=TIUTMP
+21 WRITE !,"Searching for the events."
+22 DO BUILD(TYPE,STATUS,TIUEDT,TIULDT,.TIUDI)
+23 KILL TIUDI,SELDIV
+24 QUIT
SELTYPE(DFLT) ; Select Event Type
+1 NEW PRMT,READTYPE,X,Y
+2 SET PRMT="Select Event Type: "
+3 SET READTYPE="SMA^F:Filing Errors;M:Missing Field Errors;S:Successes;A:All Events"
+4 SET Y=$PIECE($$READ^TIUU(READTYPE,PRMT,DFLT),U)
+5 SET Y=$SELECT(Y="S":"0;SUCCESSFUL FILING EVENTS",Y="F":"1;FILING ERRORS",Y="M":"2;MISSING FIELD ERRORS",1:"3;FILING EVENTS")
+6 QUIT Y
SELRES(DFLT) ; Select Resolution status
+1 NEW PRMT,READTYPE,X,Y
+2 SET PRMT="Select Resolution Status: "
+3 SET READTYPE="SAM^U:Unresolved Errors;R:Resolved Errors;B:Both Unresolved and Resolved"
+4 SET Y=$PIECE($$READ^TIUU(READTYPE,PRMT,DFLT),U)
+5 SET Y=$SELECT(Y="U":"0;UNRESOLVED",Y="R":"1;RESOLVED",1:"2;UNRESOLVED/RESOLVED")
+6 QUIT Y
+7 ;
BUILD(TIUTYP,STATUS,EARLY,LATE,DIVIFNS) ; Build List
+1 NEW TIUCNT,TIUI,TIUJ,TIUK,TIUP,TIUPICK,TIUREC,TIUSTAT,XREF
+2 SET VALMCNT=0
+3 KILL ^TMP("TIUERR",$JOB),^TMP("TIUERRIDX",$JOB)
+4 SET TIUPICK=+$ORDER(^ORD(101,"B","TIU ACTION SELECT LIST ELEMENT",0))
+5 IF '$DATA(TIUPRM0)!'$DATA(TIUPRM0)
DO SETPARM^TIULE
+6 ; For type 3 ALL events, get types 0 for SUCCESSFUL, 1 for FILING ERROR,
+7 ;& 2 for MISSING FIELD ERROR. For other types, just get that type:
+8 FOR TYPE=$SELECT(+TIUTYP=3:0,1:+TIUTYP):1:$SELECT(+TIUTYP=3:2,1:+TIUTYP)
Begin DoDot:1
+9 SET TIUI=0
FOR
SET TIUI=$ORDER(^TIU(8925.4,"D",TYPE,TIUI))
IF +TIUI'>0
QUIT
Begin DoDot:2
+10 IF +$GET(^TIU(8925.4,+TIUI,0))'<EARLY
IF (+$GET(^(0))'>LATE)
Begin DoDot:3
+11 ; If status is UNRESOLVED or RESOLVED, get only matching status;
+12 IF STATUS'=""
IF +STATUS'=2
IF +STATUS'=$PIECE($GET(^TIU(8925.4,+TIUI,0)),U,6)
QUIT
+13 IF +$GET(DIVIFNS("ENTRIES"))
IF '$$ININST(+TIUI,.DIVIFNS)
QUIT
+14 NEW DIC,DIQ,DA,DR,TIUERR,EDT,RDT,DTYPE,EDESC,USER,ETYPE,INST,INSTA,TIUSTN
+15 SET DIQ="TIUERR"
SET DIC=8925.4
SET DIQ(0)="IE"
SET DA=TIUI
+16 SET DR=".01:.09"
DO EN^DIQ1
+17 SET USER=$$NAME^TIULS(TIUERR(8925.4,DA,.02,"E"),"LAST, FIRST")
+18 SET EDT=$$DATE^TIULS(TIUERR(8925.4,DA,.01,"I"),"MM/DD/YY HR:MIN")
+19 SET RDT=$$DATE^TIULS(TIUERR(8925.4,DA,.07,"I"),"MM/DD/YY HR:MIN")
+20 SET DTYPE=TIUERR(8925.4,DA,.03,"E")
+21 SET ETYPE=TIUERR(8925.4,DA,.08,"E")
SET EDESC=TIUERR(8925.4,DA,.04,"E")
+22 SET INSTA=""
SET INST=TIUERR(8925.4,DA,.09,"I")
+23 IF INST
Begin DoDot:4
+24 SET TIUSTN=$$NS^XUAF4(INST)
+25 IF $PIECE(TIUSTN,U,2)]""
SET INSTA=$PIECE(TIUSTN,U,2)
End DoDot:4
+26 SET INSTA=$EXTRACT(INSTA,1,8)
+27 SET TIUCNT=+$GET(TIUCNT)+1
+28 SET TIUREC=$$SETFLD^VALM1(TIUCNT,"","NUMBER")
+29 SET TIUREC=$$SETFLD^VALM1(DTYPE,TIUREC,"DOCUMENT TYPE")
+30 SET TIUREC=$$SETFLD^VALM1(ETYPE,TIUREC,"EVENT TYPE")
+31 SET TIUREC=$$SETFLD^VALM1(EDT,TIUREC,"EVENT DATE/TIME")
+32 SET TIUREC=$$SETFLD^VALM1(RDT,TIUREC,"RESOL DATE/TIME")
+33 SET TIUREC=$$SETFLD^VALM1(USER,TIUREC,"USER NAME")
+34 SET TIUREC=$$SETFLD^VALM1(INSTA,TIUREC,"DIVISION")
+35 SET VALMCNT=+$GET(VALMCNT)+1
+36 SET ^TMP("TIUERR",$JOB,VALMCNT,0)=TIUREC
+37 SET ^TMP("TIUERR",$JOB,"IDX",VALMCNT,TIUCNT)=""
+38 SET ^TMP("TIUERR",$JOB,"PICK",TIUCNT,VALMCNT)=""
+39 DO FLDCTRL^VALM10(VALMCNT,"NUMBER",IOINHI,IOINORM)
+40 SET VALMCNT=+$GET(VALMCNT)+1
IF VALMCNT#5'>0
WRITE "."
+41 SET ^TMP("TIUERR",$JOB,VALMCNT,0)=$$SETFLD^VALM1(EDESC,"","DESCRIPTION")
+42 SET ^TMP("TIUERR",$JOB,"IDX",VALMCNT,TIUCNT)=""
+43 SET ^TMP("TIUERR",$JOB,"PICK",TIUCNT,VALMCNT)=""
+44 SET ^TMP("TIUERRIDX",$JOB,TIUCNT)=VALMCNT_U_TIUI_U_$PIECE(^TIU(8925.4,+TIUI,0),U,5)
End DoDot:3
End DoDot:2
End DoDot:1
+45 ;
+46 SET ^TMP("TIUERR",$JOB,0)=+$GET(TIUCNT)_U_TIUTYP_U_STATUS
+47 SET ^TMP("TIUERR",$JOB,"#")=TIUPICK_"^1:"_+$GET(TIUCNT)
+48 MERGE ^TMP("TIUERR",$JOB,"DIV")=DIVIFNS
+49 IF $DATA(VALMHDR)>9
DO HDR
+50 IF +$GET(TIUCNT)'>0
Begin DoDot:1
+51 SET ^TMP("TIUERR",$JOB,1,0)=""
SET VALMCNT=2
+52 IF +TIUTYP=1!(+TIUTYP=2)
SET STATUS=$$LOWER^TIULS($PIECE(STATUS,";",2))
SET STATUS=STATUS_" "
+53 SET ^TMP("TIUERR",$JOB,2,0)="No "_STATUS_$$LOWER^TIULS($PIECE(TIUTYP,";",2))_" found within date/time range"
End DoDot:1
+54 QUIT
ININST(TIUI,TIUDI) ; Evaluates whether a TIU UPLOAD LOG record
+1 ; is among the selected division(s)
+2 ; Input -- TIUI TIU UPLOAD LOG file (#8925.4) IEN
+3 ; -- TIUDI( i.e. TIUDI(file #40.8 IEN)=Institution file
+4 ; pointer for file #40.8 entry
+5 ; Output - TIUY 0= record not in selected division
+6 ; 1= record in selected division
+7 NEW TIUIFP,TIUJ,TIUINST,TIUY
SET TIUY=0
+8 SET TIUINST=+$PIECE($GET(^TIU(8925.4,+TIUI,0)),U,9)
+9 SET TIUJ=0
FOR
SET TIUJ=$ORDER(TIUDI(TIUJ))
IF 'TIUJ!TIUY
QUIT
Begin DoDot:1
+10 SET TIUIFP=$GET(TIUDI(TIUJ))
+11 IF TIUIFP=TIUINST
SET TIUY=1
End DoDot:1
+12 QUIT TIUY
HDR ; Initialize header for review screen
+1 NEW BY,TIUX,SCREEN,STATUS,TITLE
+2 SET TIUX=$GET(^TMP("TIUERR",$JOB,0))
+3 ;TIU*1*81 status = 3rd, not 2nd piece of TIUX; hdr wrote UNRESOLVED instead of SUCCESSFUL
+4 SET TYPE=$PIECE(TIUX,U,2)
SET STATUS=$PIECE(TIUX,U,3)
+5 IF +TYPE=0
SET TITLE=$PIECE(TYPE,";",2)
+6 IF +TYPE=1!(+TYPE=2)
Begin DoDot:1
+7 SET TITLE=$PIECE(STATUS,";",2)
+8 SET TITLE=TITLE_" "_$PIECE(TYPE,";",2)
End DoDot:1
+9 IF +TYPE=3
SET TITLE="ALL FILING EVENTS"
+10 IF '$DATA(TITLE)
SET TITLE=""
+11 IF +TIUEDT>1
SET TITLE=TITLE_" from "_$$DATE^TIULS(TIUEDT,"MM/DD/YY")_" to "_$$DATE^TIULS(TIULDT,"MM/DD/YY")
+12 SET VALMHDR(1)=$$CENTER^TIULS(TITLE)
+13 QUIT
CLEAN ; Clean up your mess!
+1 KILL ^TMP("TIUERR",$JOB),^TMP("TIUERRIDX",$JOB)
DO CLEAN^VALM10
+2 KILL VALMY
+3 QUIT