ABSPECA2 ; IHS/FCS/DRS - Assemble formatted claim ; [ 09/12/2002 9:57 AM ]
;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
;----------------------------------------------------------------------
;----------------------------------------------------------------------
;Put together ascii formatted record via NCPDP Record definition
;
;Input Variables: NODES - (10^20 or 30^40)
; .IEN - Internal Entry Number array
; .ABSP - Formatted Data Array with claim and
; prescription data
; .REC - Formatted Ascii record (result)
;----------------------------------------------------------------------
XLOOP(NODES,IEN,ABSP,REC) ;EP - from ABSPECA1
;Manage local variables
N ORDER,RECMIEN,MDATA,FLDIEN,PMODE,FLAG,NODE,FDATA,FLDNUM,FLDDATA
N INDEX,FLDID
;
;Loop through the NODES defined in NODES variable parsed by U
F INDEX=1:1:$L(NODES,U) D
.S NODE=$P(NODES,U,INDEX)
.Q:NODE=""
.Q:'$D(^ABSPF(9002313.92,IEN(9002313.92),NODE,0))
.;
.S ORDER=""
.F D Q:'ORDER
..S ORDER=$O(^ABSPF(9002313.92,IEN(9002313.92),NODE,"B",ORDER))
..Q:'ORDER
..S RECMIEN=""
..S RECMIEN=$O(^ABSPF(9002313.92,IEN(9002313.92),NODE,"B",ORDER,RECMIEN))
..Q:RECMIEN=""
..S MDATA=$G(^ABSPF(9002313.92,IEN(9002313.92),NODE,RECMIEN,0))
..Q:MDATA=""
..S FLDIEN=$P(MDATA,U,2)
..Q:FLDIEN=""
..S FDATA=$G(^ABSPF(9002313.91,FLDIEN,0))
..Q:FDATA=""
..S FLDNUM=$P(FDATA,U,1)
..S FLDID=$P(FDATA,U,2)
..Q:FLDNUM=""
..S:NODE=10!(NODE=20) FLDDATA=$G(ABSP(9002313.02,IEN(9002313.02),FLDNUM,"I"))
..;I FLDNUM=402 S FLDDATA=$G(ABSP(9002313.0201,1,FLDNUM,"I")) ;for REVERSAL TYPE OF CLAIM. Added by GTI. 06-14-96
..S:NODE=30!(NODE=40) FLDDATA=$G(ABSP(9002313.0201,IEN(9002313.01),FLDNUM,"I"))
..S REC=REC_$S(FLDID="":"",1:$C(28))_FLDDATA
Q
ABSPECA2 ; IHS/FCS/DRS - Assemble formatted claim ; [ 09/12/2002 9:57 AM ]
+1 ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
+2 ;----------------------------------------------------------------------
+3 ;----------------------------------------------------------------------
+4 ;Put together ascii formatted record via NCPDP Record definition
+5 ;
+6 ;Input Variables: NODES - (10^20 or 30^40)
+7 ; .IEN - Internal Entry Number array
+8 ; .ABSP - Formatted Data Array with claim and
+9 ; prescription data
+10 ; .REC - Formatted Ascii record (result)
+11 ;----------------------------------------------------------------------
XLOOP(NODES,IEN,ABSP,REC) ;EP - from ABSPECA1
+1 ;Manage local variables
+2 NEW ORDER,RECMIEN,MDATA,FLDIEN,PMODE,FLAG,NODE,FDATA,FLDNUM,FLDDATA
+3 NEW INDEX,FLDID
+4 ;
+5 ;Loop through the NODES defined in NODES variable parsed by U
+6 FOR INDEX=1:1:$LENGTH(NODES,U)
Begin DoDot:1
+7 SET NODE=$PIECE(NODES,U,INDEX)
+8 IF NODE=""
QUIT
+9 IF '$DATA(^ABSPF(9002313.92,IEN(9002313.92),NODE,0))
QUIT
+10 ;
+11 SET ORDER=""
+12 FOR
Begin DoDot:2
+13 SET ORDER=$ORDER(^ABSPF(9002313.92,IEN(9002313.92),NODE,"B",ORDER))
+14 IF 'ORDER
QUIT
+15 SET RECMIEN=""
+16 SET RECMIEN=$ORDER(^ABSPF(9002313.92,IEN(9002313.92),NODE,"B",ORDER,RECMIEN))
+17 IF RECMIEN=""
QUIT
+18 SET MDATA=$GET(^ABSPF(9002313.92,IEN(9002313.92),NODE,RECMIEN,0))
+19 IF MDATA=""
QUIT
+20 SET FLDIEN=$PIECE(MDATA,U,2)
+21 IF FLDIEN=""
QUIT
+22 SET FDATA=$GET(^ABSPF(9002313.91,FLDIEN,0))
+23 IF FDATA=""
QUIT
+24 SET FLDNUM=$PIECE(FDATA,U,1)
+25 SET FLDID=$PIECE(FDATA,U,2)
+26 IF FLDNUM=""
QUIT
+27 IF NODE=10!(NODE=20)
SET FLDDATA=$GET(ABSP(9002313.02,IEN(9002313.02),FLDNUM,"I"))
+28 ;I FLDNUM=402 S FLDDATA=$G(ABSP(9002313.0201,1,FLDNUM,"I")) ;for REVERSAL TYPE OF CLAIM. Added by GTI. 06-14-96
+29 IF NODE=30!(NODE=40)
SET FLDDATA=$GET(ABSP(9002313.0201,IEN(9002313.01),FLDNUM,"I"))
+30 SET REC=REC_$SELECT(FLDID="":"",1:$CHAR(28))_FLDDATA
End DoDot:2
IF 'ORDER
QUIT
End DoDot:1
+31 QUIT