ABME5DTP ; IHS/ASDST/DMJ - 837 DTP Segment
;;2.6;IHS Third Party Billing System;**6**;NOV 12, 2009
;Transaction Set Header
;
EP(X,Y,Z,ZZ) ;EP
; x=entity identifier
;y=format
;z=fileman date
;zz=fileman date to
S ABMEIC=X
S ABMFMT=Y
S ABMFDT=$G(Z)
S ABMTDT=$G(ZZ)
K ABMREC("DTP"),ABMR("DTP")
S ABME("RTYPE")="DTP"
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("DTP"))'="" S ABMREC("DTP")=ABMREC("DTP")_"*"
.S ABMREC("DTP")=$G(ABMREC("DTP"))_ABMR("DTP",I)
Q
10 ;segment
S ABMR("DTP",10)="DTP"
Q
20 ;DTP01 - Transaction Set Identifier Code
S ABMR("DTP",20)=ABMEIC
Q
30 ;DTP02 - Date Time Period Format Qualifier
S ABMR("DTP",30)=ABMFMT
Q
40 ;DTP03 - Date Time Period
I ABMFMT="D8" D
.S ABMR("DTP",40)=$$Y2KD2^ABMDUTL(ABMFDT)
I ABMFMT="RD8" D
.S ABMR("DTP",40)=$$Y2KD2^ABMDUTL(ABMFDT)_"-"_$$Y2KD2^ABMDUTL(ABMTDT)
I ABMFMT="DT" D
.S ABMTM=$E($P(ABMFDT,".",2),1,4)
.I $L(ABMTM)<2 S ABMTM="0"_ABMTM
.S ABMR("DTP",40)=$$Y2KD2^ABMDUTL(ABMFDT)_ABMTM
.S ABMR("DTP",40)=$$FMT^ABMERUTL(ABMR("DTP",40),"12N")
I ABMFMT="TM" D
.I $L(ABMFDT,".")=2 S ABMFDT=$P(ABMFDT,".",2)
.S ABMR("DTP",40)=$$FMT^ABMERUTL(ABMFDT,"4N")
Q
ABME5DTP ; IHS/ASDST/DMJ - 837 DTP Segment
+1 ;;2.6;IHS Third Party Billing System;**6**;NOV 12, 2009
+2 ;Transaction Set Header
+3 ;
EP(X,Y,Z,ZZ) ;EP
+1 ; x=entity identifier
+2 ;y=format
+3 ;z=fileman date
+4 ;zz=fileman date to
+5 SET ABMEIC=X
+6 SET ABMFMT=Y
+7 SET ABMFDT=$GET(Z)
+8 SET ABMTDT=$GET(ZZ)
+9 KILL ABMREC("DTP"),ABMR("DTP")
+10 SET ABME("RTYPE")="DTP"
+11 DO LOOP
+12 KILL ABME,ABM,ABMEIC
+13 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("DTP"))'=""
SET ABMREC("DTP")=ABMREC("DTP")_"*"
+5 SET ABMREC("DTP")=$GET(ABMREC("DTP"))_ABMR("DTP",I)
End DoDot:1
+6 QUIT
10 ;segment
+1 SET ABMR("DTP",10)="DTP"
+2 QUIT
20 ;DTP01 - Transaction Set Identifier Code
+1 SET ABMR("DTP",20)=ABMEIC
+2 QUIT
30 ;DTP02 - Date Time Period Format Qualifier
+1 SET ABMR("DTP",30)=ABMFMT
+2 QUIT
40 ;DTP03 - Date Time Period
+1 IF ABMFMT="D8"
Begin DoDot:1
+2 SET ABMR("DTP",40)=$$Y2KD2^ABMDUTL(ABMFDT)
End DoDot:1
+3 IF ABMFMT="RD8"
Begin DoDot:1
+4 SET ABMR("DTP",40)=$$Y2KD2^ABMDUTL(ABMFDT)_"-"_$$Y2KD2^ABMDUTL(ABMTDT)
End DoDot:1
+5 IF ABMFMT="DT"
Begin DoDot:1
+6 SET ABMTM=$EXTRACT($PIECE(ABMFDT,".",2),1,4)
+7 IF $LENGTH(ABMTM)<2
SET ABMTM="0"_ABMTM
+8 SET ABMR("DTP",40)=$$Y2KD2^ABMDUTL(ABMFDT)_ABMTM
+9 SET ABMR("DTP",40)=$$FMT^ABMERUTL(ABMR("DTP",40),"12N")
End DoDot:1
+10 IF ABMFMT="TM"
Begin DoDot:1
+11 IF $LENGTH(ABMFDT,".")=2
SET ABMFDT=$PIECE(ABMFDT,".",2)
+12 SET ABMR("DTP",40)=$$FMT^ABMERUTL(ABMFDT,"4N")
End DoDot:1
+13 QUIT