ABMDBCNT ; IHS/ASDST/DMJ - Set Array for Bills to Print ;
;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
;Original;TMD
;
;IHS/ASDS/SDH - 03/07/2001 - V2.4 Patch 9 - NOIS XJG-0201-160063
; Modified to allow the exclusion parameter of Provider to work
; properly.
;
; *********************************************************************
;
GBILL ;
S ABMP("BDFN")="" ; Initialize IEN to 3P BILL
S ABM("C")=0 ; Initialize counter
W !!,"Establishing Bills to be Exported for the Parameters Specified..."
; Loop thru claims with approved bill status ("xref")
F S ABMP("BDFN")=$O(^ABMDBILL(DUZ(2),"AC","A",ABMP("BDFN"))) Q:'ABMP("BDFN")!(ABM("C")=250) D
. ; Quit if mode of export does not match
. Q:$P($G(^ABMDBILL(DUZ(2),ABMP("BDFN"),0)),U,6)'=ABM("FORM")
. S ABMLOC=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,3) ; Visit for bill
. ; Quit if location does not match
. I $D(ABMY("LOC")),ABMLOC'=ABMY("LOC") Q
. S ABMPAT=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,5) ; Patient IEN
. ; Quit if patient does not match
. I $D(ABMY("PAT")),ABMPAT'=ABMY("PAT") Q
. S ABMTYP=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),2),U,2) ; Insurer Type
. ; Quit if insurer type does not match
. I $D(ABMY("TYP")),ABMY("TYP")'[ABMTYP Q
. S ABMINS=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,8) ; Active Insurer
. ; Quit if insurer does not match
. I $D(ABMY("INS")),ABMINS'=ABMY("INS") Q
. S ABMAPPR=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),1),U,4) ; Appr. Official
. ; Quit if approving official does not match
. I $D(ABMY("APPR")),ABMAPPR'=ABMY("APPR") Q
. S ABMDT=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),1),U,5) ; Date approved
. I $D(ABMY("PRV")),'$D(^ABMDBILL(DUZ(2),ABMP("BDFN"),41,"B",ABMY("PRV"))) Q
. ; Quit if date approved does not fall within specified range
. I $G(ABMY("DT"))="A",ABMDT<ABMY("DT",1)!(ABMDT>(ABMY("DT",2)+.9)) Q
. S ABMBTYP=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,7) ; Visit type
. S ABMADM0=$G(^ABMDBILL(DUZ(2),ABMP("BDFN"),6))
. S ABMDT2=$P(ABMADM0,U) ; Admission date
. ; Quit if visit type is 111 and (no admit date or date not w/i range)
. I $G(ABMY("DT"))="V",ABMBTYP=111 Q:'ABMADM0 Q:ABMDT2<ABMY("DT",1)!(ABMDT2>ABMY("DT",2))
. S ABMDT3=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),7),U) ; Service date from
. ; Quit if visit type is 111 and (no date from or date not w/i range)
. I $G(ABMY("DT"))="V",ABMBTYP'=111 Q:ABMDT3<ABMY("DT",1)!(ABMDT3>ABMY("DT",2))
. ; ABMY(active insurer,IEN to 3P BILL)=""
. S ABMY($P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,8),ABMP("BDFN"))=""
. S ABM("C")=ABM("C")+1 ; increment counter
. K ABMLOC,ABMPAT,ABMTYP,ABMINS,ABMAPPR,ABMDT,ABMDT2,ABMDT3,ABMBTYP,ABMADM0
Q
ABMDBCNT ; IHS/ASDST/DMJ - Set Array for Bills to Print ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
+2 ;Original;TMD
+3 ;
+4 ;IHS/ASDS/SDH - 03/07/2001 - V2.4 Patch 9 - NOIS XJG-0201-160063
+5 ; Modified to allow the exclusion parameter of Provider to work
+6 ; properly.
+7 ;
+8 ; *********************************************************************
+9 ;
GBILL ;
+1 ; Initialize IEN to 3P BILL
SET ABMP("BDFN")=""
+2 ; Initialize counter
SET ABM("C")=0
+3 WRITE !!,"Establishing Bills to be Exported for the Parameters Specified..."
+4 ; Loop thru claims with approved bill status ("xref")
+5 FOR
SET ABMP("BDFN")=$ORDER(^ABMDBILL(DUZ(2),"AC","A",ABMP("BDFN")))
IF 'ABMP("BDFN")!(ABM("C")=250)
QUIT
Begin DoDot:1
+6 ; Quit if mode of export does not match
+7 IF $PIECE($GET(^ABMDBILL(DUZ(2),ABMP("BDFN"),0)),U,6)'=ABM("FORM")
QUIT
+8 ; Visit for bill
SET ABMLOC=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,3)
+9 ; Quit if location does not match
+10 IF $DATA(ABMY("LOC"))
IF ABMLOC'=ABMY("LOC")
QUIT
+11 ; Patient IEN
SET ABMPAT=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,5)
+12 ; Quit if patient does not match
+13 IF $DATA(ABMY("PAT"))
IF ABMPAT'=ABMY("PAT")
QUIT
+14 ; Insurer Type
SET ABMTYP=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),2),U,2)
+15 ; Quit if insurer type does not match
+16 IF $DATA(ABMY("TYP"))
IF ABMY("TYP")'[ABMTYP
QUIT
+17 ; Active Insurer
SET ABMINS=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,8)
+18 ; Quit if insurer does not match
+19 IF $DATA(ABMY("INS"))
IF ABMINS'=ABMY("INS")
QUIT
+20 ; Appr. Official
SET ABMAPPR=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),1),U,4)
+21 ; Quit if approving official does not match
+22 IF $DATA(ABMY("APPR"))
IF ABMAPPR'=ABMY("APPR")
QUIT
+23 ; Date approved
SET ABMDT=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),1),U,5)
+24 IF $DATA(ABMY("PRV"))
IF '$DATA(^ABMDBILL(DUZ(2),ABMP("BDFN"),41,"B",ABMY("PRV")))
QUIT
+25 ; Quit if date approved does not fall within specified range
+26 IF $GET(ABMY("DT"))="A"
IF ABMDT<ABMY("DT",1)!(ABMDT>(ABMY("DT",2)+.9))
QUIT
+27 ; Visit type
SET ABMBTYP=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,7)
+28 SET ABMADM0=$GET(^ABMDBILL(DUZ(2),ABMP("BDFN"),6))
+29 ; Admission date
SET ABMDT2=$PIECE(ABMADM0,U)
+30 ; Quit if visit type is 111 and (no admit date or date not w/i range)
+31 IF $GET(ABMY("DT"))="V"
IF ABMBTYP=111
IF 'ABMADM0
QUIT
IF ABMDT2<ABMY("DT",1)!(ABMDT2>ABMY("DT",2))
QUIT
+32 ; Service date from
SET ABMDT3=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),7),U)
+33 ; Quit if visit type is 111 and (no date from or date not w/i range)
+34 IF $GET(ABMY("DT"))="V"
IF ABMBTYP'=111
IF ABMDT3<ABMY("DT",1)!(ABMDT3>ABMY("DT",2))
QUIT
+35 ; ABMY(active insurer,IEN to 3P BILL)=""
+36 SET ABMY($PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,8),ABMP("BDFN"))=""
+37 ; increment counter
SET ABM("C")=ABM("C")+1
+38 KILL ABMLOC,ABMPAT,ABMTYP,ABMINS,ABMAPPR,ABMDT,ABMDT2,ABMDT3,ABMBTYP,ABMADM0
End DoDot:1
+39 QUIT