SCDXFU13 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;14-JUL-97
;;5.3;Scheduling;**128**;AUG 13, 1993
;
HST4XMIT(XMITPTR,ARRAY,FORMAT) ;Return transmission/acknowledgement history
; for entry in Transmitted Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file (#409.73)
; ARRAY - Output array (full global reference)
; - Defaults to ^TMP("SCDXFU13",$J,"HST4XMIT")
; FORMAT - Flag denoting subscript for ARRAY
; 0 = Subscript ARRAY by pointer to file (Default)
; 1 = Subscript ARRAY by transmission date
; 2 = Subscript ARRAY by acknowledgement date
;Output : X - Number of times entry was transmitted
; Format 0: ARRAY(HistPtr) = XmitDT ^ AckDT ^ Code ^ Late
; Format 1: ARRAY(XmitDT) = HistPtr ^ AckDT ^ Code ^ Late
; ARRAY(0 , HistPtr) = HistPtr ^ AckDT ^ Code ^ Late
; Used when XmitDT not on file
; Format 2: ARRAY(AckDT) = XmitDT ^ HistPtr ^ Code ^ Late
; ARRAY(0 , HistPtr) = XmitDT ^ HistPtr ^ Code ^ Late
; Used when AckDT not on file
; HistPtr = Pointer to ACRP Transmission History file
; XmitDT = Date/time of transmission (FileMan)
; AckDT = Date/time of acknowledgement (FileMan)
; Code = Acknowledgement code received
; A = Accepted R = Rejected E = Error
; Late = Transmission occur after workload close-out
; 0 = No 1 = Yes -1 = Error
;Notes : It is the responsibility of the calling procedure to
; initialize (i.e. KILL) the output array
; : Zero (0) is used when a transmission date is not on file
; : Zero (0) is used when an acknowledgement date is not on file
; : NULL is used when an acknowledgement code is not on file
; : Determinating if transmission occured after close-out is
; based on the currently stored workload close-out dates
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) 0
S ARRAY=$G(ARRAY)
S:(ARRAY="") ARRAY=$NA(^TMP("SCDXFU13",$J,"HST4XMIT"))
S FORMAT=+$G(FORMAT)
S:((FORMAT<0)!(FORMAT>2)) FORMAT=0
;Declare variables
N HISTPTR,XMITDATE,ACKDATE,ACKCODE,COUNT,NODE,LATE
;Find/count entries in history file
S COUNT=0
S HISTPTR=0
F S HISTPTR=+$O(^SD(409.77,"B",XMITPTR,HISTPTR)) Q:('HISTPTR) D
.;Bad x-ref entry (ignore)
.Q:('$D(^SD(409.77,HISTPTR,0)))
.;Increment counter
.S COUNT=COUNT+1
.;Get transmission date
.S XMITDATE=+$G(^SD(409.77,HISTPTR,1))
.;Get node containing acknowledgement data
.S NODE=$G(^SD(409.77,HISTPTR,2))
.;Get ack date
.S ACKDATE=+$P(NODE,"^",1)
.;Get ack code
.S ACKCODE=$P(NODE,"^",2)
.;Determine if transmitted after close-out
.S LATE=+$$LATE^SCDXFU11(HISTPTR)
.;Put into output array
.I (FORMAT=1) D Q
..S NODE=HISTPTR_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
..I ('XMITDATE) S @ARRAY@(0,HISTPTR)=NODE Q
..S @ARRAY@(XMITDATE)=NODE
.I (FORMAT=2) D Q
..S NODE=XMITDATE_"^"_HISTPTR_"^"_ACKCODE_"^"_LATE
..I ('ACKDATE) S @ARRAY@(0,HISTPTR)=NODE Q
..S @ARRAY@(ACKDATE)=NODE
.S @ARRAY@(HISTPTR)=XMITDATE_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
;Done
Q COUNT
;
HST4VID(VSITID,ARRAY,FORMAT) ;Return transmission/acknowledgement history
; for Unique Visit ID (field #20 of Outpatient Encounter file)
;
;Input : VSITID - Unique Visit ID
; ARRAY - Output array (full global reference)
; - Defaults to ^TMP("SCDXFU13",$J,"HST4VID")
; FORMAT - Flag denoting subscript for ARRAY
; 0 = Subscript ARRAY by pointer to file (Default)
; 1 = Subscript ARRAY by transmission date
; 2 = Subscript ARRAY by acknowledgement date
;Output : X - Number of Unique Visit ID was transmitted
; Format 0: ARRAY(HistPtr) = XmitDT ^ AckDT ^ Code ^ Late
; Format 1: ARRAY(XmitDT) = HistPtr ^ AckDT ^ Code ^ Late
; ARRAY(0 , HistPtr) = HistPtr ^ AckDT ^ Code ^ Late
; Used when XmitDT not on file
; Format 2: ARRAY(AckDT) = XmitDT ^ HistPtr ^ Code ^ Late
; ARRAY(0 , HistPtr) = XmitDT ^ HistPtr ^ Code ^ Late
; Used when AckDT not on file
; HistPtr = Pointer to ACRP Transmission History file
; XmitDT = Date/time of transmission (FileMan)
; AckDT = Date/time of acknowledgement (FileMan)
; Code = Acknowledgement code received
; A = Accepted R = Rejected E = Error
; Late = Transmission occur after workload close-out
; 0 = No 1 = Yes
;Notes : It is the responsibility of the calling procedure to
; initialize (i.e. KILL) the output array
; : Zero (0) is used when a transmission date is not on file
; : Zero (0) is used when an acknowledgement date is not on file
; : NULL is used when an acknowledgement code is not on file
; : Determinating if transmission occured after close-out is
; based on the currently stored workload close-out dates
;
;Check input
S VSITID=$G(VSITID)
Q:(VSITID="") 0
S ARRAY=$G(ARRAY)
S:(ARRAY="") ARRAY=$NA(^TMP("SCDXFU13",$J,"HST4VID"))
S FORMAT=+$G(FORMAT)
S:((FORMAT<0)!(FORMAT>2)) FORMAT=0
;Declare variables
N HISTPTR,XMITDATE,ACKDATE,ACKCODE,COUNT,NODE,LATE
;Find/count entries in history file
S COUNT=0
S HISTPTR=0
F S HISTPTR=+$O(^SD(409.77,"AVID",VSITID,HISTPTR)) Q:('HISTPTR) D
.;Bad x-ref entry (ignore)
.Q:('$D(^SD(409.77,HISTPTR,0)))
.;Increment counter
.S COUNT=COUNT+1
.;Get transmission date
.S XMITDATE=+$G(^SD(409.77,HISTPTR,1))
.;Get node containing acknowledgement data
.S NODE=$G(^SD(409.77,HISTPTR,2))
.;Get ack date
.S ACKDATE=$P(NODE,"^",1)
.;Get ack code
.S ACKCODE=$P(NODE,"^",2)
.;Determine if transmitted after close-out
.S LATE=+$$LATE^SCDXFU11(HISTPTR)
.;Put into output array
.I (FORMAT=1) D Q
..S NODE=HISTPTR_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
..I ('XMITDATE) S @ARRAY@(0,HISTPTR)=NODE Q
..S @ARRAY@(XMITDATE)=NODE
.I (FORMAT=2) D Q
..S NODE=XMITDATE_"^"_HISTPTR_"^"_ACKCODE_"^"_LATE
..I ('ACKDATE) S @ARRAY@(0,HISTPTR)=NODE Q
..S @ARRAY@(ACKDATE)=NODE
.S @ARRAY@(HISTPTR)=XMITDATE_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
;Done
Q COUNT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCDXFU13 6601 printed Oct 16, 2024@18:39:51 Page 2
SCDXFU13 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;14-JUL-97
+1 ;;5.3;Scheduling;**128**;AUG 13, 1993
+2 ;
HST4XMIT(XMITPTR,ARRAY,FORMAT) ;Return transmission/acknowledgement history
+1 ; for entry in Transmitted Outpatient Encounter file (#409.73)
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file (#409.73)
+5 ; ARRAY - Output array (full global reference)
+6 ; - Defaults to ^TMP("SCDXFU13",$J,"HST4XMIT")
+7 ; FORMAT - Flag denoting subscript for ARRAY
+8 ; 0 = Subscript ARRAY by pointer to file (Default)
+9 ; 1 = Subscript ARRAY by transmission date
+10 ; 2 = Subscript ARRAY by acknowledgement date
+11 ;Output : X - Number of times entry was transmitted
+12 ; Format 0: ARRAY(HistPtr) = XmitDT ^ AckDT ^ Code ^ Late
+13 ; Format 1: ARRAY(XmitDT) = HistPtr ^ AckDT ^ Code ^ Late
+14 ; ARRAY(0 , HistPtr) = HistPtr ^ AckDT ^ Code ^ Late
+15 ; Used when XmitDT not on file
+16 ; Format 2: ARRAY(AckDT) = XmitDT ^ HistPtr ^ Code ^ Late
+17 ; ARRAY(0 , HistPtr) = XmitDT ^ HistPtr ^ Code ^ Late
+18 ; Used when AckDT not on file
+19 ; HistPtr = Pointer to ACRP Transmission History file
+20 ; XmitDT = Date/time of transmission (FileMan)
+21 ; AckDT = Date/time of acknowledgement (FileMan)
+22 ; Code = Acknowledgement code received
+23 ; A = Accepted R = Rejected E = Error
+24 ; Late = Transmission occur after workload close-out
+25 ; 0 = No 1 = Yes -1 = Error
+26 ;Notes : It is the responsibility of the calling procedure to
+27 ; initialize (i.e. KILL) the output array
+28 ; : Zero (0) is used when a transmission date is not on file
+29 ; : Zero (0) is used when an acknowledgement date is not on file
+30 ; : NULL is used when an acknowledgement code is not on file
+31 ; : Determinating if transmission occured after close-out is
+32 ; based on the currently stored workload close-out dates
+33 ;
+34 ;Check input
+35 SET XMITPTR=+$GET(XMITPTR)
+36 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT 0
+37 SET ARRAY=$GET(ARRAY)
+38 if (ARRAY="")
SET ARRAY=$NAME(^TMP("SCDXFU13",$JOB,"HST4XMIT"))
+39 SET FORMAT=+$GET(FORMAT)
+40 if ((FORMAT<0)!(FORMAT>2))
SET FORMAT=0
+41 ;Declare variables
+42 NEW HISTPTR,XMITDATE,ACKDATE,ACKCODE,COUNT,NODE,LATE
+43 ;Find/count entries in history file
+44 SET COUNT=0
+45 SET HISTPTR=0
+46 FOR
SET HISTPTR=+$ORDER(^SD(409.77,"B",XMITPTR,HISTPTR))
if ('HISTPTR)
QUIT
Begin DoDot:1
+47 ;Bad x-ref entry (ignore)
+48 if ('$DATA(^SD(409.77,HISTPTR,0)))
QUIT
+49 ;Increment counter
+50 SET COUNT=COUNT+1
+51 ;Get transmission date
+52 SET XMITDATE=+$GET(^SD(409.77,HISTPTR,1))
+53 ;Get node containing acknowledgement data
+54 SET NODE=$GET(^SD(409.77,HISTPTR,2))
+55 ;Get ack date
+56 SET ACKDATE=+$PIECE(NODE,"^",1)
+57 ;Get ack code
+58 SET ACKCODE=$PIECE(NODE,"^",2)
+59 ;Determine if transmitted after close-out
+60 SET LATE=+$$LATE^SCDXFU11(HISTPTR)
+61 ;Put into output array
+62 IF (FORMAT=1)
Begin DoDot:2
+63 SET NODE=HISTPTR_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
+64 IF ('XMITDATE)
SET @ARRAY@(0,HISTPTR)=NODE
QUIT
+65 SET @ARRAY@(XMITDATE)=NODE
End DoDot:2
QUIT
+66 IF (FORMAT=2)
Begin DoDot:2
+67 SET NODE=XMITDATE_"^"_HISTPTR_"^"_ACKCODE_"^"_LATE
+68 IF ('ACKDATE)
SET @ARRAY@(0,HISTPTR)=NODE
QUIT
+69 SET @ARRAY@(ACKDATE)=NODE
End DoDot:2
QUIT
+70 SET @ARRAY@(HISTPTR)=XMITDATE_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
End DoDot:1
+71 ;Done
+72 QUIT COUNT
+73 ;
HST4VID(VSITID,ARRAY,FORMAT) ;Return transmission/acknowledgement history
+1 ; for Unique Visit ID (field #20 of Outpatient Encounter file)
+2 ;
+3 ;Input : VSITID - Unique Visit ID
+4 ; ARRAY - Output array (full global reference)
+5 ; - Defaults to ^TMP("SCDXFU13",$J,"HST4VID")
+6 ; FORMAT - Flag denoting subscript for ARRAY
+7 ; 0 = Subscript ARRAY by pointer to file (Default)
+8 ; 1 = Subscript ARRAY by transmission date
+9 ; 2 = Subscript ARRAY by acknowledgement date
+10 ;Output : X - Number of Unique Visit ID was transmitted
+11 ; Format 0: ARRAY(HistPtr) = XmitDT ^ AckDT ^ Code ^ Late
+12 ; Format 1: ARRAY(XmitDT) = HistPtr ^ AckDT ^ Code ^ Late
+13 ; ARRAY(0 , HistPtr) = HistPtr ^ AckDT ^ Code ^ Late
+14 ; Used when XmitDT not on file
+15 ; Format 2: ARRAY(AckDT) = XmitDT ^ HistPtr ^ Code ^ Late
+16 ; ARRAY(0 , HistPtr) = XmitDT ^ HistPtr ^ Code ^ Late
+17 ; Used when AckDT not on file
+18 ; HistPtr = Pointer to ACRP Transmission History file
+19 ; XmitDT = Date/time of transmission (FileMan)
+20 ; AckDT = Date/time of acknowledgement (FileMan)
+21 ; Code = Acknowledgement code received
+22 ; A = Accepted R = Rejected E = Error
+23 ; Late = Transmission occur after workload close-out
+24 ; 0 = No 1 = Yes
+25 ;Notes : It is the responsibility of the calling procedure to
+26 ; initialize (i.e. KILL) the output array
+27 ; : Zero (0) is used when a transmission date is not on file
+28 ; : Zero (0) is used when an acknowledgement date is not on file
+29 ; : NULL is used when an acknowledgement code is not on file
+30 ; : Determinating if transmission occured after close-out is
+31 ; based on the currently stored workload close-out dates
+32 ;
+33 ;Check input
+34 SET VSITID=$GET(VSITID)
+35 if (VSITID="")
QUIT 0
+36 SET ARRAY=$GET(ARRAY)
+37 if (ARRAY="")
SET ARRAY=$NAME(^TMP("SCDXFU13",$JOB,"HST4VID"))
+38 SET FORMAT=+$GET(FORMAT)
+39 if ((FORMAT<0)!(FORMAT>2))
SET FORMAT=0
+40 ;Declare variables
+41 NEW HISTPTR,XMITDATE,ACKDATE,ACKCODE,COUNT,NODE,LATE
+42 ;Find/count entries in history file
+43 SET COUNT=0
+44 SET HISTPTR=0
+45 FOR
SET HISTPTR=+$ORDER(^SD(409.77,"AVID",VSITID,HISTPTR))
if ('HISTPTR)
QUIT
Begin DoDot:1
+46 ;Bad x-ref entry (ignore)
+47 if ('$DATA(^SD(409.77,HISTPTR,0)))
QUIT
+48 ;Increment counter
+49 SET COUNT=COUNT+1
+50 ;Get transmission date
+51 SET XMITDATE=+$GET(^SD(409.77,HISTPTR,1))
+52 ;Get node containing acknowledgement data
+53 SET NODE=$GET(^SD(409.77,HISTPTR,2))
+54 ;Get ack date
+55 SET ACKDATE=$PIECE(NODE,"^",1)
+56 ;Get ack code
+57 SET ACKCODE=$PIECE(NODE,"^",2)
+58 ;Determine if transmitted after close-out
+59 SET LATE=+$$LATE^SCDXFU11(HISTPTR)
+60 ;Put into output array
+61 IF (FORMAT=1)
Begin DoDot:2
+62 SET NODE=HISTPTR_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
+63 IF ('XMITDATE)
SET @ARRAY@(0,HISTPTR)=NODE
QUIT
+64 SET @ARRAY@(XMITDATE)=NODE
End DoDot:2
QUIT
+65 IF (FORMAT=2)
Begin DoDot:2
+66 SET NODE=XMITDATE_"^"_HISTPTR_"^"_ACKCODE_"^"_LATE
+67 IF ('ACKDATE)
SET @ARRAY@(0,HISTPTR)=NODE
QUIT
+68 SET @ARRAY@(ACKDATE)=NODE
End DoDot:2
QUIT
+69 SET @ARRAY@(HISTPTR)=XMITDATE_"^"_ACKDATE_"^"_ACKCODE_"^"_LATE
End DoDot:1
+70 ;Done
+71 QUIT COUNT