ABME8AMT ; IHS/ASDST/DMJ - 837 AMT Segment
;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
;Transaction Set Header
;
; IHS/SD/SDR - v2.5 p8 - IM13487/IM14092
; Modified to print payments
;
EP(X) ;EP HERE
; x=entity identifier
S ABMEIC=X
K ABMREC("AMT"),ABMR("AMT")
S ABME("RTYPE")="AMT"
D LOOP
K ABME,ABM,ABMEIC
Q
LOOP ;LOOP HERE
F I=10:10:40 D
.D @I
.I $D(^ABMEXLM("AA",+$G(ABMP("INS")),+$G(ABMP("EXP")),ABME("RTYPE"),I)) D @(^(I))
.I $G(ABMREC("AMT"))'="" S ABMREC("AMT")=ABMREC("AMT")_"*"
.S ABMREC("AMT")=$G(ABMREC("AMT"))_ABMR("AMT",I)
Q
10 ;segment
S ABMR("AMT",10)="AMT"
Q
20 ;AMT01 - Amount Qualifier Code
S ABMR("AMT",20)=ABMEIC
Q
30 ;AMT02 - Monetary Amount
; prior payment - actual
I ABMEIC="C4"!(ABMEIC="D") D
.D PAYED^ABMERUTL
.S ABMR("AMT",30)=$G(ABMP("PAYED",+$G(ABMP("INS",ABMPST)))) ;pymt for that insurer
;
; payer estimated amount
I ABMEIC="C5" D
.D PAYED^ABMERUTL
.S ABMR("AMT",30)=$P(ABMB2,U)
.S ABMR("AMT",30)=ABMR("AMT",30)-$G(ABMP("PAYED"))
.S ABMR("AMT",30)=ABMR("AMT",30)-$P(ABMB9,"^",9)
;
; patient paid amount
I ABMEIC="F5" D
.S ABMR("AMT",30)=$P(ABMB9,"^",9)
;
I ABMEIC="F2" D
.S ABMR("AMT",30)=ABMF2AMT
;
;start new code abm*2.6*3 HEAT7574
I ABMEIC="B6" D
.S ABMR("AMT",30)=ABMB6AMT
;end new code HEAT7574
;
S ABMR("AMT",30)=$FN(ABMR("AMT",30),"-")
S ABMR("AMT",30)=$J(ABMR("AMT",30),0,2)
;
Q
40 ;AMT03 - Credit/Debit Flag Code-not used
S ABMR("AMT",40)=""
Q
ABME8AMT ; IHS/ASDST/DMJ - 837 AMT Segment
+1 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
+2 ;Transaction Set Header
+3 ;
+4 ; IHS/SD/SDR - v2.5 p8 - IM13487/IM14092
+5 ; Modified to print payments
+6 ;
EP(X) ;EP HERE
+1 ; x=entity identifier
+2 SET ABMEIC=X
+3 KILL ABMREC("AMT"),ABMR("AMT")
+4 SET ABME("RTYPE")="AMT"
+5 DO LOOP
+6 KILL ABME,ABM,ABMEIC
+7 QUIT
LOOP ;LOOP HERE
+1 FOR I=10:10:40
Begin DoDot:1
+2 DO @I
+3 IF $DATA(^ABMEXLM("AA",+$GET(ABMP("INS")),+$GET(ABMP("EXP")),ABME("RTYPE"),I))
DO @(^(I))
+4 IF $GET(ABMREC("AMT"))'=""
SET ABMREC("AMT")=ABMREC("AMT")_"*"
+5 SET ABMREC("AMT")=$GET(ABMREC("AMT"))_ABMR("AMT",I)
End DoDot:1
+6 QUIT
10 ;segment
+1 SET ABMR("AMT",10)="AMT"
+2 QUIT
20 ;AMT01 - Amount Qualifier Code
+1 SET ABMR("AMT",20)=ABMEIC
+2 QUIT
30 ;AMT02 - Monetary Amount
+1 ; prior payment - actual
+2 IF ABMEIC="C4"!(ABMEIC="D")
Begin DoDot:1
+3 DO PAYED^ABMERUTL
+4 ;pymt for that insurer
SET ABMR("AMT",30)=$GET(ABMP("PAYED",+$GET(ABMP("INS",ABMPST))))
End DoDot:1
+5 ;
+6 ; payer estimated amount
+7 IF ABMEIC="C5"
Begin DoDot:1
+8 DO PAYED^ABMERUTL
+9 SET ABMR("AMT",30)=$PIECE(ABMB2,U)
+10 SET ABMR("AMT",30)=ABMR("AMT",30)-$GET(ABMP("PAYED"))
+11 SET ABMR("AMT",30)=ABMR("AMT",30)-$PIECE(ABMB9,"^",9)
End DoDot:1
+12 ;
+13 ; patient paid amount
+14 IF ABMEIC="F5"
Begin DoDot:1
+15 SET ABMR("AMT",30)=$PIECE(ABMB9,"^",9)
End DoDot:1
+16 ;
+17 IF ABMEIC="F2"
Begin DoDot:1
+18 SET ABMR("AMT",30)=ABMF2AMT
End DoDot:1
+19 ;
+20 ;start new code abm*2.6*3 HEAT7574
+21 IF ABMEIC="B6"
Begin DoDot:1
+22 SET ABMR("AMT",30)=ABMB6AMT
End DoDot:1
+23 ;end new code HEAT7574
+24 ;
+25 SET ABMR("AMT",30)=$FNUMBER(ABMR("AMT",30),"-")
+26 SET ABMR("AMT",30)=$JUSTIFY(ABMR("AMT",30),0,2)
+27 ;
+28 QUIT
40 ;AMT03 - Credit/Debit Flag Code-not used
+1 SET ABMR("AMT",40)=""
+2 QUIT