ABME5AMT ; IHS/ASDST/DMJ - 837 AMT Segment
;;2.6;IHS Third Party Billing System;**6,8**;NOV 12, 2009
;Transaction Set Header
;
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="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" S ABMR("AMT",30)=$P(ABMB7,"^",23)
;
I ABMEIC="F2" D
.S ABMR("AMT",30)=ABMF2AMT
;
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
ABME5AMT ; IHS/ASDST/DMJ - 837 AMT Segment
+1 ;;2.6;IHS Third Party Billing System;**6,8**;NOV 12, 2009
+2 ;Transaction Set Header
+3 ;
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="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"
SET ABMR("AMT",30)=$PIECE(ABMB7,"^",23)
+15 ;
+16 IF ABMEIC="F2"
Begin DoDot:1
+17 SET ABMR("AMT",30)=ABMF2AMT
End DoDot:1
+18 ;
+19 SET ABMR("AMT",30)=$FNUMBER(ABMR("AMT",30),"-")
+20 SET ABMR("AMT",30)=$JUSTIFY(ABMR("AMT",30),0,2)
+21 ;
+22 QUIT
40 ;AMT03 - Credit/Debit Flag Code-not used
+1 SET ABMR("AMT",40)=""
+2 QUIT