Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: TIUELST

TIUELST.m

Go to the documentation of this file.
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