ABMUEAPI ; IHS/SD/SDR - 3PB/UFMS API
;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
;
; New routine - v2.5 p12 SDD item 4.5
; Checks entries in exclusion table (9002274.44)
; BILL tag will return YES/NO if bill should be included or not
;
BILL(ABMDUZ,ABMBIEN) ;PEP - Checks if bill should be send to UFMS based on
; exclusion table entries
; ABMDUZ = DUZ(2) for 3P Bill file
; ABMBIEN = 3P IEN
;
; Returns:
; -1 - Lookup of bill fails
; 0 - NO
; 1 - YES
N ABMBVLOC,ABMDADT,ABMBCLN,ABMIIEN,ABMBITYP
N ABMEDM,ABMTEFDT,ABMTENDT,ABMTCLN,ABMTITYP,ABMTCLN
S ABMINC=1 ;default to yes
;get Bill info
I +$G(ABMBIEN)=0 S ABMINC="-1" Q ABMINC ;quit w/fail if no bill found
I +$G(ABMDUZ)=0 S ABMINC="-1" Q ABMINC ;quit w/fail if no DUZ(2) sent
I $G(^ABMDBILL(ABMDUZ,ABMBIEN,0))="" S ABMINC="-1" Q ABMINC
S ABMBVLOC=$P($G(^ABMDBILL(ABMDUZ,ABMBIEN,0)),U,3)
S ABMBADT=$P($G(^ABMDBILL(ABMDUZ,ABMBIEN,1)),U,5)
S ABMBCLN=$P($G(^ABMDBILL(ABMDUZ,ABMBIEN,0)),U,10)
S ABMIIEN=$P($G(^ABMDBILL(ABMDUZ,ABMBIEN,0)),U,8)
S ABMBITYP=$P($G(^AUTNINS(ABMIIEN,2)),U)
;get table info and compare
I '$D(^ABMUXCLD(ABMBVLOC)) Q ABMINC ;quit if no entries for location
S ABMEDM=0
F S ABMEDM=$O(^ABMUXCLD(ABMBVLOC,1,ABMEDM)) Q:+ABMEDM=0 D
.S ABMTEFDT=$P($G(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U) ;effective date
.S ABMTENDT=$P($G(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U,2) ;end date
.I (ABMBADT>ABMTEFDT) D
..I ABMTENDT=""!(ABMTENDT'=""&((ABMBADT<ABMTENDT))) D ;bill approved during table entry dates
...S ABMTCLN=$P($G(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U,3) ;clinic
...S ABMTITYP=$P($G(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U,4) ;insurer type
...I ABMTCLN'="",(ABMTITYP'=""),(ABMTCLN=ABMBCLN),(ABMBITYP=ABMTITYP) S ABMINC=0
...I ABMTCLN'="",(ABMTITYP=""),(ABMTCLN=ABMBCLN) S ABMINC=0
...I ABMTCLN="",(ABMTITYP'=""),(ABMTITYP=ABMBITYP) S ABMINC=0
;
Q ABMINC
;
TRANSMIT(ABMDUZ,ABMBDFN) ;PEP - Checks if bill has previously been transmitted
; to UFMS
; ABMDUZ = DUZ(2) for 3P Bill file
; BDFN = 3P IEN
;
; Returns:
; -1 - Lookup of bill fails
; 0 - NO - has not been sent
; # - YES - has been sent (returns invoice number it was sent with
;
S ABMINC=0 ;default to no
;get Bill info
I +$G(ABMBDFN)=0 S ABMINC="-1" Q ABMINC ;quit w/fail if no bill found
I '$D(^ABMDBILL(ABMDUZ,ABMBDFN,69,0)) Q ABMINC ;NO entry in 69 multiple
S ABMXMIT=9999999999
F S ABMXMIT=$O(^ABMDBILL(ABMDUZ,ABMBDFN,69,ABMXMIT),-1) Q:+ABMXMIT=0 D Q:(+ABMINC'=0)
.I +$P($G(^ABMDBILL(ABMDUZ,ABMBDFN,69,ABMXMIT,0)),U,3)=0 D
..S ABMINC=$P($G(^ABMDBILL(ABMDUZ,ABMBDFN,69,ABMXMIT,0)),U,2)
Q ABMINC
APPRDTTM(ABMDUZ2,ABMBIEN) ;PEP - returns bill date/time approved field
; 9002274.4, .15
Q $P($G(^ABMDBILL(ABMDUZ2,ABMBIEN,1)),U,5)
ABMUEAPI ; IHS/SD/SDR - 3PB/UFMS API
+1 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
+2 ;
+3 ; New routine - v2.5 p12 SDD item 4.5
+4 ; Checks entries in exclusion table (9002274.44)
+5 ; BILL tag will return YES/NO if bill should be included or not
+6 ;
BILL(ABMDUZ,ABMBIEN) ;PEP - Checks if bill should be send to UFMS based on
+1 ; exclusion table entries
+2 ; ABMDUZ = DUZ(2) for 3P Bill file
+3 ; ABMBIEN = 3P IEN
+4 ;
+5 ; Returns:
+6 ; -1 - Lookup of bill fails
+7 ; 0 - NO
+8 ; 1 - YES
+9 NEW ABMBVLOC,ABMDADT,ABMBCLN,ABMIIEN,ABMBITYP
+10 NEW ABMEDM,ABMTEFDT,ABMTENDT,ABMTCLN,ABMTITYP,ABMTCLN
+11 ;default to yes
SET ABMINC=1
+12 ;get Bill info
+13 ;quit w/fail if no bill found
IF +$GET(ABMBIEN)=0
SET ABMINC="-1"
QUIT ABMINC
+14 ;quit w/fail if no DUZ(2) sent
IF +$GET(ABMDUZ)=0
SET ABMINC="-1"
QUIT ABMINC
+15 IF $GET(^ABMDBILL(ABMDUZ,ABMBIEN,0))=""
SET ABMINC="-1"
QUIT ABMINC
+16 SET ABMBVLOC=$PIECE($GET(^ABMDBILL(ABMDUZ,ABMBIEN,0)),U,3)
+17 SET ABMBADT=$PIECE($GET(^ABMDBILL(ABMDUZ,ABMBIEN,1)),U,5)
+18 SET ABMBCLN=$PIECE($GET(^ABMDBILL(ABMDUZ,ABMBIEN,0)),U,10)
+19 SET ABMIIEN=$PIECE($GET(^ABMDBILL(ABMDUZ,ABMBIEN,0)),U,8)
+20 SET ABMBITYP=$PIECE($GET(^AUTNINS(ABMIIEN,2)),U)
+21 ;get table info and compare
+22 ;quit if no entries for location
IF '$DATA(^ABMUXCLD(ABMBVLOC))
QUIT ABMINC
+23 SET ABMEDM=0
+24 FOR
SET ABMEDM=$ORDER(^ABMUXCLD(ABMBVLOC,1,ABMEDM))
IF +ABMEDM=0
QUIT
Begin DoDot:1
+25 ;effective date
SET ABMTEFDT=$PIECE($GET(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U)
+26 ;end date
SET ABMTENDT=$PIECE($GET(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U,2)
+27 IF (ABMBADT>ABMTEFDT)
Begin DoDot:2
+28 ;bill approved during table entry dates
IF ABMTENDT=""!(ABMTENDT'=""&((ABMBADT<ABMTENDT)))
Begin DoDot:3
+29 ;clinic
SET ABMTCLN=$PIECE($GET(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U,3)
+30 ;insurer type
SET ABMTITYP=$PIECE($GET(^ABMUXCLD(ABMBVLOC,1,ABMEDM,0)),U,4)
+31 IF ABMTCLN'=""
IF (ABMTITYP'="")
IF (ABMTCLN=ABMBCLN)
IF (ABMBITYP=ABMTITYP)
SET ABMINC=0
+32 IF ABMTCLN'=""
IF (ABMTITYP="")
IF (ABMTCLN=ABMBCLN)
SET ABMINC=0
+33 IF ABMTCLN=""
IF (ABMTITYP'="")
IF (ABMTITYP=ABMBITYP)
SET ABMINC=0
End DoDot:3
End DoDot:2
End DoDot:1
+34 ;
+35 QUIT ABMINC
+36 ;
TRANSMIT(ABMDUZ,ABMBDFN) ;PEP - Checks if bill has previously been transmitted
+1 ; to UFMS
+2 ; ABMDUZ = DUZ(2) for 3P Bill file
+3 ; BDFN = 3P IEN
+4 ;
+5 ; Returns:
+6 ; -1 - Lookup of bill fails
+7 ; 0 - NO - has not been sent
+8 ; # - YES - has been sent (returns invoice number it was sent with
+9 ;
+10 ;default to no
SET ABMINC=0
+11 ;get Bill info
+12 ;quit w/fail if no bill found
IF +$GET(ABMBDFN)=0
SET ABMINC="-1"
QUIT ABMINC
+13 ;NO entry in 69 multiple
IF '$DATA(^ABMDBILL(ABMDUZ,ABMBDFN,69,0))
QUIT ABMINC
+14 SET ABMXMIT=9999999999
+15 FOR
SET ABMXMIT=$ORDER(^ABMDBILL(ABMDUZ,ABMBDFN,69,ABMXMIT),-1)
IF +ABMXMIT=0
QUIT
Begin DoDot:1
+16 IF +$PIECE($GET(^ABMDBILL(ABMDUZ,ABMBDFN,69,ABMXMIT,0)),U,3)=0
Begin DoDot:2
+17 SET ABMINC=$PIECE($GET(^ABMDBILL(ABMDUZ,ABMBDFN,69,ABMXMIT,0)),U,2)
End DoDot:2
End DoDot:1
IF (+ABMINC'=0)
QUIT
+18 QUIT ABMINC
APPRDTTM(ABMDUZ2,ABMBIEN) ;PEP - returns bill date/time approved field
+1 ; 9002274.4, .15
+2 QUIT $PIECE($GET(^ABMDBILL(ABMDUZ2,ABMBIEN,1)),U,5)