IVMLERR1 ;ALB/RMO,ERC - IVM Transmission Error Processing - Build List area; 15-SEP-1997 ; 2/20/08 11:10am
;;2.0;INCOME VERIFICATION MATCH;**9,121**; 21-OCT-94;Build 45
;
EN(IVMARY,IVMBEG,IVMEND,IVMEPSTA,IVMSRTBY,IVMCNT) ;Entry point to build list area for IVM transmission errors
;The following variables are 'system wide variables' in the
;IVM Transmission Error Processing List Manager application:
; Input -- IVMARY Global array subscript
; IVMBEG Begin date
; IVMEND End date
; IVMEPSTA Error processing statuses
; 1 - New
; 2 - Checked
; 1^2 - Both
; IVMSRTBY Sort by criteria
; P - patient name
; D - date/time ack received
; E - error message
; O - error message of 'Person Not Found' only
; Output -- IVMCNT Number of lines in the list
D WAIT^DICD
;
;Get IVM transmission log errors
D GET(IVMARY,IVMBEG,IVMEND,IVMEPSTA,IVMSRTBY)
;
;Build list area for for IVM transmission log errors
D BLD(IVMSRTBY,.IVMCNT)
;
;Print message if no IVM transmission log errors meet selection criteria
I 'IVMCNT D
. D SET(IVMARY,1,"",1,60,0,,,.IVMCNT)
. D SET(IVMARY,2,"No 'Transmission Errors' meet the selection criteria.",4,60,0,,,.IVMCNT)
Q
;
GET(IVMARY,IVMBEG,IVMEND,IVMEPSTA,IVMSRTBY) ;Get IVM transmission log errors
; Input -- IVMARY Global array subscript
; IVMBEG Begin date
; IVMEND End date
; IVMEPSTA Error processing statuses
; IVMSRTBY Sort by criteria
; Output -- IVM Transmission log error list sorted by patient name
; ^TMP("IVMERRSRT",$J,<sort by>,<patient name>,<trans log IEN>)
; or date/time ack received
; ^TMP("IVMERRSRT",$J,<sort by>,<date/time ack received>,<trans log IEN>)
; or by error message (added with IVM*2*121)
; ^TMP("IVMERRSRT",$J,<sort by>,<error message>,<trans log IEN>)
N IVMDFN,IVMDTR,IVMTLIEN,PCE,STA
;
;Loop through IVM transmission log for selected date range
F IVMDTR=IVMBEG:0 S IVMDTR=$O(^IVM(301.6,"AEPS",IVMDTR)) Q:'IVMDTR!($P(IVMDTR,".")>IVMEND) D
. ;Loop through selected error processing statuses
. F PCE=1:1 S STA=$P(IVMEPSTA,U,PCE) Q:STA="" D
. . ;Loop through patients
. . S IVMDFN=0
. . F S IVMDFN=$O(^IVM(301.6,"AEPS",IVMDTR,STA,IVMDFN)) Q:'IVMDFN D
. . . ;Loop though internal entry numbers
. . . S IVMTLIEN=0
. . . F S IVMTLIEN=$O(^IVM(301.6,"AEPS",IVMDTR,STA,IVMDFN,IVMTLIEN)) Q:'IVMTLIEN D SORT(IVMSRTBY,IVMDTR,IVMDFN,IVMTLIEN)
Q
;
SORT(IVMSRTBY,IVMDTR,IVMDFN,IVMTLIEN) ;Set array based on sort criteria for IVM transmission log error list display
; Input -- IVMSRTBY Sort by criteria
; IVMDTR IVM transmission log date/time ack received
; IVMDFN IVM patient IEN
; IVMTLIEN IVM transmission log IEN
; Output -- None
N IVMTLOG
I $G(IVMSRTBY)']"" S IVMSRTBY="P"
I IVMSRTBY="P" D ;patient name
. I $$GET^IVMTLOG(IVMTLIEN,.IVMTLOG) D
. . S ^TMP("IVMERRSRT",$J,IVMSRTBY,$S($P($G(^DPT(+IVMTLOG("DFN"),0)),U)'="":$P(^(0),U),1:"UNKNOWN"),IVMTLIEN)=""
I IVMSRTBY="D" D ;default date/time ack received
. S ^TMP("IVMERRSRT",$J,IVMSRTBY,IVMDTR,IVMTLIEN)=""
I IVMSRTBY="E"!(IVMSRTBY="O") D ;added with IVM*2*121
. N IVMQ
. S IVMQ=0
. I $$GET^IVMTLOG(IVMTLIEN,.IVMTLOG) D
. . I IVMSRTBY="O" D
. . . I $$UPPER^DGUTL($G(IVMTLOG("ERROR")))'["PERSON NOT FOUND" S IVMQ=1
. . Q:IVMQ=1
. . S ^TMP("IVMERRSRT",$J,IVMSRTBY,$S($G(IVMTLOG("ERROR"))]"":IVMTLOG("ERROR"),1:"UNKNOWN"),IVMTLIEN)=""
Q
;
BLD(IVMSRTBY,IVMCNT) ;Build list area for for IVM transmission log errors
; Input -- IVMSRTBY Sort by criteria
; P - patient name
; D - date/time ack received
; E - error message
; O - error message of 'Person Not Found' only
; Output -- IVMCNT Number of lines in the list
N DFN,IVMCOL,IVMSUB,IVMTEXT,IVMTLIEN,IVMTLOG,IVMWID,X,VA
;
;Initialize variables
S (IVMLINE,IVMNUM)=0
S X=VALMDDF("NUMBER"),IVMCOL("NUM")=$P(X,U,2),IVMWID("NUM")=$P(X,U,3)
S X=VALMDDF("RETRANSMIT"),IVMCOL("RET")=$P(X,U,2),IVMWID("RET")=$P(X,U,3)
S X=VALMDDF("PATIENT"),IVMCOL("PAT")=$P(X,U,2),IVMWID("PAT")=$P(X,U,3)
S X=VALMDDF("PTID"),IVMCOL("PTID")=$P(X,U,2),IVMWID("PTID")=$P(X,U,3)
S X=VALMDDF("DATE/TIME"),IVMCOL("DTR")=$P(X,U,2),IVMWID("DTR")=$P(X,U,3)
S X=VALMDDF("STATUS"),IVMCOL("STA")=$P(X,U,2),IVMWID("STA")=$P(X,U,3)
;
;Loop through by patient name,error message or date/time ack received
S IVMSUB=$S(IVMSRTBY="D":0,1:"")
F S IVMSUB=$O(^TMP("IVMERRSRT",$J,IVMSRTBY,IVMSUB)) Q:IVMSUB="" D
. ;Loop through IVM transmission log IEN(s)
. S IVMTLIEN=0
. F S IVMTLIEN=$O(^TMP("IVMERRSRT",$J,IVMSRTBY,IVMSUB,IVMTLIEN)) Q:'IVMTLIEN D
. . W:'(IVMLINE#50) "."
. . ;Get information for IVM transmission log entry
. . I $$GET^IVMTLOG(IVMTLIEN,.IVMTLOG) D
. . . ;Increment selection number
. . . S IVMNUM=IVMNUM+1
. . . ;Increment line counter
. . . S IVMLINE=IVMLINE+1
. . . ;Set selection number in display array
. . . D SET(IVMARY,IVMLINE,IVMNUM,IVMCOL("NUM"),IVMWID("NUM"),IVMNUM,IVMTLIEN,IVMTLOG("PAT"),.IVMCNT)
. . . ;Set retransmit flag in display array
. . . S IVMTEXT=$S('$G(IVMTLOG("PAT")):" ",'$$STATUS^IVMPLOG(IVMTLOG("PAT")):"*",1:" ")
. . . D SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("RET"),IVMWID("RET"),IVMNUM,,,.IVMCNT)
. . . ;Set patient name in display array
. . . S IVMTEXT=$$LOWER^VALM1($S($G(IVMTLOG("PAT")):$$EXT^IVMTLOG("PAT",IVMTLOG("PAT")),1:"UNKNOWN"))
. . . D SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("PAT"),IVMWID("PAT"),IVMNUM,,,.IVMCNT)
. . . ;Set patient id in display array
. . . S DFN=+IVMTLOG("DFN") D PID^VADPT
. . . D SET(IVMARY,IVMLINE,VA("BID"),IVMCOL("PTID"),IVMWID("PTID"),IVMNUM,,,.IVMCNT)
. . . ;Set date/time ack received in display array
. . . S IVMTEXT=$$LOWER^VALM1($S($G(IVMTLOG("DT/TM ACK")):$$EXT^IVMTLOG("DT/TM ACK",IVMTLOG("DT/TM ACK")),1:"UNKNOWN"))
. . . D SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("DTR"),IVMWID("DTR"),IVMNUM,,,.IVMCNT)
. . . ;Set error processing status in display array
. . . S IVMTEXT=$$LOWER^VALM1($S($G(IVMTLOG("ERROR STATUS")):$$EXT^IVMTLOG("ERROR STATUS",IVMTLOG("ERROR STATUS")),1:"UNKNOWN"))
. . . D SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("STA"),IVMWID("STA"),IVMNUM,,,.IVMCNT)
. . . ;Increment line counter
. . . S IVMLINE=IVMLINE+1
. . . ;Set error message in display array
. . . S IVMTEXT="Error: "_$S($G(IVMTLOG("ERROR"))'="":$$EXT^IVMTLOG("ERROR",IVMTLOG("ERROR")),1:"UNKNOWN")
. . . K X S $P(X," ",160)=""
. . . S IVMTEXT=$E(IVMTEXT_X,1,160)
. . . D SET(IVMARY,IVMLINE,IVMTEXT,3,$L(IVMTEXT),IVMNUM,,,.IVMCNT)
Q
;
SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL,IVMWID,IVMNUM,IVMTLIEN,IVMDFN,IVMCNT) ;Set display array
; Input -- IVMARY Global array subscript
; IVMLINE Line number
; IVMTEXT Text
; IVMCOL Column to start at
; IVMWID Column or text width
; IVMNUM Selection number
; IVMTLIEN IVM transmission log IEN
; IVMDFN IVM patient IEN
; Output -- IVMCNT Number of lines in the list
N X
S:IVMLINE>IVMCNT IVMCNT=IVMLINE
S X=$S($D(^TMP(IVMARY,$J,IVMLINE,0)):^(0),1:"")
S ^TMP(IVMARY,$J,IVMLINE,0)=$$SETSTR^VALM1(IVMTEXT,X,IVMCOL,IVMWID)
S ^TMP(IVMARY,$J,"IDX",IVMLINE,IVMNUM)=""
;
;Set special index used in retransmitting patient
I $G(IVMTLIEN),$G(IVMDFN) D
. S ^TMP(IVMARY_"IDX",$J,IVMNUM)=IVMLINE_U_IVMTLIEN
. S ^TMP(IVMARY_"IDX",$J,"PT",IVMDFN,IVMLINE)=IVMTLIEN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIVMLERR1 7758 printed Nov 22, 2024@17:12:04 Page 2
IVMLERR1 ;ALB/RMO,ERC - IVM Transmission Error Processing - Build List area; 15-SEP-1997 ; 2/20/08 11:10am
+1 ;;2.0;INCOME VERIFICATION MATCH;**9,121**; 21-OCT-94;Build 45
+2 ;
EN(IVMARY,IVMBEG,IVMEND,IVMEPSTA,IVMSRTBY,IVMCNT) ;Entry point to build list area for IVM transmission errors
+1 ;The following variables are 'system wide variables' in the
+2 ;IVM Transmission Error Processing List Manager application:
+3 ; Input -- IVMARY Global array subscript
+4 ; IVMBEG Begin date
+5 ; IVMEND End date
+6 ; IVMEPSTA Error processing statuses
+7 ; 1 - New
+8 ; 2 - Checked
+9 ; 1^2 - Both
+10 ; IVMSRTBY Sort by criteria
+11 ; P - patient name
+12 ; D - date/time ack received
+13 ; E - error message
+14 ; O - error message of 'Person Not Found' only
+15 ; Output -- IVMCNT Number of lines in the list
+16 DO WAIT^DICD
+17 ;
+18 ;Get IVM transmission log errors
+19 DO GET(IVMARY,IVMBEG,IVMEND,IVMEPSTA,IVMSRTBY)
+20 ;
+21 ;Build list area for for IVM transmission log errors
+22 DO BLD(IVMSRTBY,.IVMCNT)
+23 ;
+24 ;Print message if no IVM transmission log errors meet selection criteria
+25 IF 'IVMCNT
Begin DoDot:1
+26 DO SET(IVMARY,1,"",1,60,0,,,.IVMCNT)
+27 DO SET(IVMARY,2,"No 'Transmission Errors' meet the selection criteria.",4,60,0,,,.IVMCNT)
End DoDot:1
+28 QUIT
+29 ;
GET(IVMARY,IVMBEG,IVMEND,IVMEPSTA,IVMSRTBY) ;Get IVM transmission log errors
+1 ; Input -- IVMARY Global array subscript
+2 ; IVMBEG Begin date
+3 ; IVMEND End date
+4 ; IVMEPSTA Error processing statuses
+5 ; IVMSRTBY Sort by criteria
+6 ; Output -- IVM Transmission log error list sorted by patient name
+7 ; ^TMP("IVMERRSRT",$J,<sort by>,<patient name>,<trans log IEN>)
+8 ; or date/time ack received
+9 ; ^TMP("IVMERRSRT",$J,<sort by>,<date/time ack received>,<trans log IEN>)
+10 ; or by error message (added with IVM*2*121)
+11 ; ^TMP("IVMERRSRT",$J,<sort by>,<error message>,<trans log IEN>)
+12 NEW IVMDFN,IVMDTR,IVMTLIEN,PCE,STA
+13 ;
+14 ;Loop through IVM transmission log for selected date range
+15 FOR IVMDTR=IVMBEG:0
SET IVMDTR=$ORDER(^IVM(301.6,"AEPS",IVMDTR))
if 'IVMDTR!($PIECE(IVMDTR,".")>IVMEND)
QUIT
Begin DoDot:1
+16 ;Loop through selected error processing statuses
+17 FOR PCE=1:1
SET STA=$PIECE(IVMEPSTA,U,PCE)
if STA=""
QUIT
Begin DoDot:2
+18 ;Loop through patients
+19 SET IVMDFN=0
+20 FOR
SET IVMDFN=$ORDER(^IVM(301.6,"AEPS",IVMDTR,STA,IVMDFN))
if 'IVMDFN
QUIT
Begin DoDot:3
+21 ;Loop though internal entry numbers
+22 SET IVMTLIEN=0
+23 FOR
SET IVMTLIEN=$ORDER(^IVM(301.6,"AEPS",IVMDTR,STA,IVMDFN,IVMTLIEN))
if 'IVMTLIEN
QUIT
DO SORT(IVMSRTBY,IVMDTR,IVMDFN,IVMTLIEN)
End DoDot:3
End DoDot:2
End DoDot:1
+24 QUIT
+25 ;
SORT(IVMSRTBY,IVMDTR,IVMDFN,IVMTLIEN) ;Set array based on sort criteria for IVM transmission log error list display
+1 ; Input -- IVMSRTBY Sort by criteria
+2 ; IVMDTR IVM transmission log date/time ack received
+3 ; IVMDFN IVM patient IEN
+4 ; IVMTLIEN IVM transmission log IEN
+5 ; Output -- None
+6 NEW IVMTLOG
+7 IF $GET(IVMSRTBY)']""
SET IVMSRTBY="P"
+8 ;patient name
IF IVMSRTBY="P"
Begin DoDot:1
+9 IF $$GET^IVMTLOG(IVMTLIEN,.IVMTLOG)
Begin DoDot:2
+10 SET ^TMP("IVMERRSRT",$JOB,IVMSRTBY,$SELECT($PIECE($GET(^DPT(+IVMTLOG("DFN"),0)),U)'="":$PIECE(^(0),U),1:"UNKNOWN"),IVMTLIEN)=""
End DoDot:2
End DoDot:1
+11 ;default date/time ack received
IF IVMSRTBY="D"
Begin DoDot:1
+12 SET ^TMP("IVMERRSRT",$JOB,IVMSRTBY,IVMDTR,IVMTLIEN)=""
End DoDot:1
+13 ;added with IVM*2*121
IF IVMSRTBY="E"!(IVMSRTBY="O")
Begin DoDot:1
+14 NEW IVMQ
+15 SET IVMQ=0
+16 IF $$GET^IVMTLOG(IVMTLIEN,.IVMTLOG)
Begin DoDot:2
+17 IF IVMSRTBY="O"
Begin DoDot:3
+18 IF $$UPPER^DGUTL($GET(IVMTLOG("ERROR")))'["PERSON NOT FOUND"
SET IVMQ=1
End DoDot:3
+19 if IVMQ=1
QUIT
+20 SET ^TMP("IVMERRSRT",$JOB,IVMSRTBY,$SELECT($GET(IVMTLOG("ERROR"))]"":IVMTLOG("ERROR"),1:"UNKNOWN"),IVMTLIEN)=""
End DoDot:2
End DoDot:1
+21 QUIT
+22 ;
BLD(IVMSRTBY,IVMCNT) ;Build list area for for IVM transmission log errors
+1 ; Input -- IVMSRTBY Sort by criteria
+2 ; P - patient name
+3 ; D - date/time ack received
+4 ; E - error message
+5 ; O - error message of 'Person Not Found' only
+6 ; Output -- IVMCNT Number of lines in the list
+7 NEW DFN,IVMCOL,IVMSUB,IVMTEXT,IVMTLIEN,IVMTLOG,IVMWID,X,VA
+8 ;
+9 ;Initialize variables
+10 SET (IVMLINE,IVMNUM)=0
+11 SET X=VALMDDF("NUMBER")
SET IVMCOL("NUM")=$PIECE(X,U,2)
SET IVMWID("NUM")=$PIECE(X,U,3)
+12 SET X=VALMDDF("RETRANSMIT")
SET IVMCOL("RET")=$PIECE(X,U,2)
SET IVMWID("RET")=$PIECE(X,U,3)
+13 SET X=VALMDDF("PATIENT")
SET IVMCOL("PAT")=$PIECE(X,U,2)
SET IVMWID("PAT")=$PIECE(X,U,3)
+14 SET X=VALMDDF("PTID")
SET IVMCOL("PTID")=$PIECE(X,U,2)
SET IVMWID("PTID")=$PIECE(X,U,3)
+15 SET X=VALMDDF("DATE/TIME")
SET IVMCOL("DTR")=$PIECE(X,U,2)
SET IVMWID("DTR")=$PIECE(X,U,3)
+16 SET X=VALMDDF("STATUS")
SET IVMCOL("STA")=$PIECE(X,U,2)
SET IVMWID("STA")=$PIECE(X,U,3)
+17 ;
+18 ;Loop through by patient name,error message or date/time ack received
+19 SET IVMSUB=$SELECT(IVMSRTBY="D":0,1:"")
+20 FOR
SET IVMSUB=$ORDER(^TMP("IVMERRSRT",$JOB,IVMSRTBY,IVMSUB))
if IVMSUB=""
QUIT
Begin DoDot:1
+21 ;Loop through IVM transmission log IEN(s)
+22 SET IVMTLIEN=0
+23 FOR
SET IVMTLIEN=$ORDER(^TMP("IVMERRSRT",$JOB,IVMSRTBY,IVMSUB,IVMTLIEN))
if 'IVMTLIEN
QUIT
Begin DoDot:2
+24 if '(IVMLINE#50)
WRITE "."
+25 ;Get information for IVM transmission log entry
+26 IF $$GET^IVMTLOG(IVMTLIEN,.IVMTLOG)
Begin DoDot:3
+27 ;Increment selection number
+28 SET IVMNUM=IVMNUM+1
+29 ;Increment line counter
+30 SET IVMLINE=IVMLINE+1
+31 ;Set selection number in display array
+32 DO SET(IVMARY,IVMLINE,IVMNUM,IVMCOL("NUM"),IVMWID("NUM"),IVMNUM,IVMTLIEN,IVMTLOG("PAT"),.IVMCNT)
+33 ;Set retransmit flag in display array
+34 SET IVMTEXT=$SELECT('$GET(IVMTLOG("PAT")):" ",'$$STATUS^IVMPLOG(IVMTLOG("PAT")):"*",1:" ")
+35 DO SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("RET"),IVMWID("RET"),IVMNUM,,,.IVMCNT)
+36 ;Set patient name in display array
+37 SET IVMTEXT=$$LOWER^VALM1($SELECT($GET(IVMTLOG("PAT")):$$EXT^IVMTLOG("PAT",IVMTLOG("PAT")),1:"UNKNOWN"))
+38 DO SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("PAT"),IVMWID("PAT"),IVMNUM,,,.IVMCNT)
+39 ;Set patient id in display array
+40 SET DFN=+IVMTLOG("DFN")
DO PID^VADPT
+41 DO SET(IVMARY,IVMLINE,VA("BID"),IVMCOL("PTID"),IVMWID("PTID"),IVMNUM,,,.IVMCNT)
+42 ;Set date/time ack received in display array
+43 SET IVMTEXT=$$LOWER^VALM1($SELECT($GET(IVMTLOG("DT/TM ACK")):$$EXT^IVMTLOG("DT/TM ACK",IVMTLOG("DT/TM ACK")),1:"UNKNOWN"))
+44 DO SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("DTR"),IVMWID("DTR"),IVMNUM,,,.IVMCNT)
+45 ;Set error processing status in display array
+46 SET IVMTEXT=$$LOWER^VALM1($SELECT($GET(IVMTLOG("ERROR STATUS")):$$EXT^IVMTLOG("ERROR STATUS",IVMTLOG("ERROR STATUS")),1:"UNKNOWN"))
+47 DO SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL("STA"),IVMWID("STA"),IVMNUM,,,.IVMCNT)
+48 ;Increment line counter
+49 SET IVMLINE=IVMLINE+1
+50 ;Set error message in display array
+51 SET IVMTEXT="Error: "_$SELECT($GET(IVMTLOG("ERROR"))'="":$$EXT^IVMTLOG("ERROR",IVMTLOG("ERROR")),1:"UNKNOWN")
+52 KILL X
SET $PIECE(X," ",160)=""
+53 SET IVMTEXT=$EXTRACT(IVMTEXT_X,1,160)
+54 DO SET(IVMARY,IVMLINE,IVMTEXT,3,$LENGTH(IVMTEXT),IVMNUM,,,.IVMCNT)
End DoDot:3
End DoDot:2
End DoDot:1
+55 QUIT
+56 ;
SET(IVMARY,IVMLINE,IVMTEXT,IVMCOL,IVMWID,IVMNUM,IVMTLIEN,IVMDFN,IVMCNT) ;Set display array
+1 ; Input -- IVMARY Global array subscript
+2 ; IVMLINE Line number
+3 ; IVMTEXT Text
+4 ; IVMCOL Column to start at
+5 ; IVMWID Column or text width
+6 ; IVMNUM Selection number
+7 ; IVMTLIEN IVM transmission log IEN
+8 ; IVMDFN IVM patient IEN
+9 ; Output -- IVMCNT Number of lines in the list
+10 NEW X
+11 if IVMLINE>IVMCNT
SET IVMCNT=IVMLINE
+12 SET X=$SELECT($DATA(^TMP(IVMARY,$JOB,IVMLINE,0)):^(0),1:"")
+13 SET ^TMP(IVMARY,$JOB,IVMLINE,0)=$$SETSTR^VALM1(IVMTEXT,X,IVMCOL,IVMWID)
+14 SET ^TMP(IVMARY,$JOB,"IDX",IVMLINE,IVMNUM)=""
+15 ;
+16 ;Set special index used in retransmitting patient
+17 IF $GET(IVMTLIEN)
IF $GET(IVMDFN)
Begin DoDot:1
+18 SET ^TMP(IVMARY_"IDX",$JOB,IVMNUM)=IVMLINE_U_IVMTLIEN
+19 SET ^TMP(IVMARY_"IDX",$JOB,"PT",IVMDFN,IVMLINE)=IVMTLIEN
End DoDot:1
+20 QUIT