ABMAROL1 ; IHS/ASDST/DMJ - A/R ROLL OVER ;
;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
START(X,Y,Z,ZZ) ;EP - FROM A/R
;X:BILL INTERNAL ENTRY NUMBER^VISIT LOCATION, Y:TOTAL PAYMENT AMT
;Z = Bill Name (passed by 1.1, but not 1.0)
;ZZ = Msg from A/R (not used by
; This rtn is called from A/R ^BARROLL. The purpose is to file
;payment information into the Payment multiple of 3P BILL.
;After filing this data, the bill is marked as completed.
;Variables are then set in preparation of calling the Eligibility
;Checker. This is done to find other billable sources that have
;not yet been billed in relation to this claim. If other billable
;sources exist and the user holds the 3PB key, they are asked if
;the calim should be re-opened for future billing. Otherwise the
;claim is automatically reopened.
S ABMP("BDFN")=+X ; 3P Bill File IEN
S ABMP("BILL")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",1),ABM("AMT")=Y
D FILE
D SET
D REST
Q
REST ;DO REST
S ABMP("CDFN")=+ABMP("BILL")
I '$D(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)) W !,"CLAIM #",ABMP("CDFN")," HAS BEEN CANCELLED.",! Q
N I S I=0,DA=0 F S I=$O(^ABMDBILL(DUZ(2),ABMP("BDFN"),13,I)) Q:'I D
.I $P(^ABMDBILL(DUZ(2),ABMP("BDFN"),13,I,0),"^",3)="I",$P(^(0),"^",1)=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",8) S DA=I
I DA S DA(1)=ABMP("CDFN"),DIE="^ABMDCLM(DUZ(2),"_DA(1)_",13,",DR=".03////C" D ^DIE K DR
I +ABMP("BILL")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U) Q
I $P(^ABMDCLM(DUZ(2),ABMP("CDFN"),0),"^",4)="E" D Q
.W !,"Claim is already in edit status.",!
UNBILL ;LOOK FOR UNBILLED SOURCES
W !!,"CHECKING FOR UNBILLED SOURCES.",!
S (ABM("HIT"),ABM("CNT"))=0
D ELG^ABMDLCK("",.ABML,ABMP("PDFN"),ABMP("VDT"))
N I S I=0 F S I=$O(ABML(I)) Q:'I D
.N J S J=0 F S J=$O(ABML(I,J)) Q:'J D
..S ABM("PRI")=I,ABM("INS")=J
..D ADDCHK^ABMDE2E
S ABM="" F ABM("I")=1:1 S ABM=$O(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,"C",ABM)) Q:'ABM D
.S ABM("X")=$O(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,"C",ABM,0))
.I "PIFL"[$P(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("X"),0),U,3) D
..S ABM("INSCO")=$P(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("X"),0),"^",1)
..Q:$P($G(^AUTNINS(ABM("INSCO"),2)),U)="I" Q:$P($G(^(1)),U,7)=4
..W:ABM("CNT") ! S ABM("CNT")=ABM("CNT")+1
..W ?18,"[",ABM("CNT"),"] ",$P(^AUTNINS(ABM("INSCO"),0),U) S ABM(ABM("CNT"))=ABM("X")
I ABM("CNT")=0 D K ABM,ABMP Q
.D CCLM
.W "NONE",!!,"Since there are no unbilled sources no further billing is possible."
S ABM("HIT")=ABM(1)
S Y=1
I $D(^XUSEC("ABMDZ EDIT CLAIM AND EXPORT",DUZ)) D
.W ! S DIR(0)="Y",DIR("A")="Re-open claim for further billing? (Y/N)" D ^DIR K DIR Q:$D(DIRUT)
I Y'=1 D CCLM K ABM,ABMP Q
S DIE="^ABMDBILL(DUZ(2),",DA=ABMP("BDFN"),DR=".24////"_Y D ^DIE
D OCLM
S DA(1)=ABMP("CDFN"),DIE="^ABMDCLM(DUZ(2),"_DA(1)_",13,",DA=ABM("HIT"),DR=".03////I" D ^DIE
K ABM,ABMP
Q
ADD ;ADD BILL NOT IN BILL FILE
;MAYBE WILL DO LATER
Q
FILE ;FILE PAYMENT INFORMATION
S:'$D(^ABMDBILL(DUZ(2),ABMP("BDFN"),3)) ^(3,0)="^9002274.403D^^"
S DA(1)=ABMP("BDFN")
S X="T"
S DIC="^ABMDBILL(DUZ(2),DA(1),3,",DIC(0)="LE"
S DIC("DR")=".02///"_ABM("AMT")
D ^DIC Q:Y<0
D CBIL
Q
SET ;SET UP NEEDED VARIABLES
S ABMP("PDFN")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",5),ABMP("INS")=$P(^(0),"^",8)
S ABMP("VDT")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),7),"^",1)
Q
OCLM S DA=ABMP("CDFN"),DIE="^ABMDCLM(DUZ(2),",DR=".04////E;.08////"_$P(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("HIT"),0),"^",1) D ^DIE
W !!,"Claim Number: ",+ABMP("BILL")," is now Open for Editing!",!
Q
CCLM S DA=ABMP("CDFN"),DIE="^ABMDCLM(DUZ(2),",DR=".04////C" D ^DIE
Q
CBIL ;EP for Closing Bill
S DIE="^ABMDBILL(DUZ(2),",DA=ABMP("BDFN"),DR=".04////C;.17///@" D ^DIE K DR
Q
;
OBIL S DIE="^ABMDBILL(DUZ(2),",DA=ABMP("BDFN"),DR=".04////P" D ^DIE K DR
Q
ABMAROL1 ; IHS/ASDST/DMJ - A/R ROLL OVER ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
START(X,Y,Z,ZZ) ;EP - FROM A/R
+1 ;X:BILL INTERNAL ENTRY NUMBER^VISIT LOCATION, Y:TOTAL PAYMENT AMT
+2 ;Z = Bill Name (passed by 1.1, but not 1.0)
+3 ;ZZ = Msg from A/R (not used by
+4 ; This rtn is called from A/R ^BARROLL. The purpose is to file
+5 ;payment information into the Payment multiple of 3P BILL.
+6 ;After filing this data, the bill is marked as completed.
+7 ;Variables are then set in preparation of calling the Eligibility
+8 ;Checker. This is done to find other billable sources that have
+9 ;not yet been billed in relation to this claim. If other billable
+10 ;sources exist and the user holds the 3PB key, they are asked if
+11 ;the calim should be re-opened for future billing. Otherwise the
+12 ;claim is automatically reopened.
+13 ; 3P Bill File IEN
SET ABMP("BDFN")=+X
+14 SET ABMP("BILL")=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",1)
SET ABM("AMT")=Y
+15 DO FILE
+16 DO SET
+17 DO REST
+18 QUIT
REST ;DO REST
+1 SET ABMP("CDFN")=+ABMP("BILL")
+2 IF '$DATA(^ABMDCLM(DUZ(2),ABMP("CDFN"),0))
WRITE !,"CLAIM #",ABMP("CDFN")," HAS BEEN CANCELLED.",!
QUIT
+3 NEW I
SET I=0
SET DA=0
FOR
SET I=$ORDER(^ABMDBILL(DUZ(2),ABMP("BDFN"),13,I))
IF 'I
QUIT
Begin DoDot:1
+4 IF $PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),13,I,0),"^",3)="I"
IF $PIECE(^(0),"^",1)=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",8)
SET DA=I
End DoDot:1
+5 IF DA
SET DA(1)=ABMP("CDFN")
SET DIE="^ABMDCLM(DUZ(2),"_DA(1)_",13,"
SET DR=".03////C"
DO ^DIE
KILL DR
+6 IF +ABMP("BILL")=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U)
QUIT
+7 IF $PIECE(^ABMDCLM(DUZ(2),ABMP("CDFN"),0),"^",4)="E"
Begin DoDot:1
+8 WRITE !,"Claim is already in edit status.",!
End DoDot:1
QUIT
UNBILL ;LOOK FOR UNBILLED SOURCES
+1 WRITE !!,"CHECKING FOR UNBILLED SOURCES.",!
+2 SET (ABM("HIT"),ABM("CNT"))=0
+3 DO ELG^ABMDLCK("",.ABML,ABMP("PDFN"),ABMP("VDT"))
+4 NEW I
SET I=0
FOR
SET I=$ORDER(ABML(I))
IF 'I
QUIT
Begin DoDot:1
+5 NEW J
SET J=0
FOR
SET J=$ORDER(ABML(I,J))
IF 'J
QUIT
Begin DoDot:2
+6 SET ABM("PRI")=I
SET ABM("INS")=J
+7 DO ADDCHK^ABMDE2E
End DoDot:2
End DoDot:1
+8 SET ABM=""
FOR ABM("I")=1:1
SET ABM=$ORDER(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,"C",ABM))
IF 'ABM
QUIT
Begin DoDot:1
+9 SET ABM("X")=$ORDER(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,"C",ABM,0))
+10 IF "PIFL"[$PIECE(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("X"),0),U,3)
Begin DoDot:2
+11 SET ABM("INSCO")=$PIECE(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("X"),0),"^",1)
+12 IF $PIECE($GET(^AUTNINS(ABM("INSCO"),2)),U)="I"
QUIT
IF $PIECE($GET(^(1)),U,7)=4
QUIT
+13 IF ABM("CNT")
WRITE !
SET ABM("CNT")=ABM("CNT")+1
+14 WRITE ?18,"[",ABM("CNT"),"] ",$PIECE(^AUTNINS(ABM("INSCO"),0),U)
SET ABM(ABM("CNT"))=ABM("X")
End DoDot:2
End DoDot:1
+15 IF ABM("CNT")=0
Begin DoDot:1
+16 DO CCLM
+17 WRITE "NONE",!!,"Since there are no unbilled sources no further billing is possible."
End DoDot:1
KILL ABM,ABMP
QUIT
+18 SET ABM("HIT")=ABM(1)
+19 SET Y=1
+20 IF $DATA(^XUSEC("ABMDZ EDIT CLAIM AND EXPORT",DUZ))
Begin DoDot:1
+21 WRITE !
SET DIR(0)="Y"
SET DIR("A")="Re-open claim for further billing? (Y/N)"
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
QUIT
End DoDot:1
+22 IF Y'=1
DO CCLM
KILL ABM,ABMP
QUIT
+23 SET DIE="^ABMDBILL(DUZ(2),"
SET DA=ABMP("BDFN")
SET DR=".24////"_Y
DO ^DIE
+24 DO OCLM
+25 SET DA(1)=ABMP("CDFN")
SET DIE="^ABMDCLM(DUZ(2),"_DA(1)_",13,"
SET DA=ABM("HIT")
SET DR=".03////I"
DO ^DIE
+26 KILL ABM,ABMP
+27 QUIT
ADD ;ADD BILL NOT IN BILL FILE
+1 ;MAYBE WILL DO LATER
+2 QUIT
FILE ;FILE PAYMENT INFORMATION
+1 IF '$DATA(^ABMDBILL(DUZ(2),ABMP("BDFN"),3))
SET ^(3,0)="^9002274.403D^^"
+2 SET DA(1)=ABMP("BDFN")
+3 SET X="T"
+4 SET DIC="^ABMDBILL(DUZ(2),DA(1),3,"
SET DIC(0)="LE"
+5 SET DIC("DR")=".02///"_ABM("AMT")
+6 DO ^DIC
IF Y<0
QUIT
+7 DO CBIL
+8 QUIT
SET ;SET UP NEEDED VARIABLES
+1 SET ABMP("PDFN")=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",5)
SET ABMP("INS")=$PIECE(^(0),"^",8)
+2 SET ABMP("VDT")=$PIECE(^ABMDBILL(DUZ(2),ABMP("BDFN"),7),"^",1)
+3 QUIT
OCLM SET DA=ABMP("CDFN")
SET DIE="^ABMDCLM(DUZ(2),"
SET DR=".04////E;.08////"_$PIECE(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("HIT"),0),"^",1)
DO ^DIE
+1 WRITE !!,"Claim Number: ",+ABMP("BILL")," is now Open for Editing!",!
+2 QUIT
CCLM SET DA=ABMP("CDFN")
SET DIE="^ABMDCLM(DUZ(2),"
SET DR=".04////C"
DO ^DIE
+1 QUIT
CBIL ;EP for Closing Bill
+1 SET DIE="^ABMDBILL(DUZ(2),"
SET DA=ABMP("BDFN")
SET DR=".04////C;.17///@"
DO ^DIE
KILL DR
+2 QUIT
+3 ;
OBIL SET DIE="^ABMDBILL(DUZ(2),"
SET DA=ABMP("BDFN")
SET DR=".04////P"
DO ^DIE
KILL DR
+1 QUIT