IVMPTRN6 ;ALB/CPM - UPDATE BILLING TRANSMISSION FILE ; 13-JUN-94
;;Version 2.0 ; INCOME VERIFICATION MATCH ;; 21-OCT-94
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
UPDATE ; Roll through billing activity and update file #301.61 if necessary
; Input: the array ^TMP("IVMPTRN5",$J), which is built in
; the routine IVMPTRN5 and fully described in the
; routine IBAMTV4.
;
S IVMREF="" F S IVMREF=$O(^TMP("IVMPTRN5",$J,IVMREF)) Q:IVMREF="" S IVMSTR=$G(^(IVMREF)) I IVMSTR D
.;
.; - if an uncancelled bill is not recorded, add it
.S IVMTDA=$O(^IVM(301.61,"B",IVMREF,0)) I 'IVMTDA D Q
..Q:$P(IVMSTR,"^",10)
..S IVMTDA=$$ADD^IVMUFNC3(IVMREF) Q:'IVMTDA
..D NOW^%DTC S $P(^IVM(301.61,IVMTDA,0),"^",2,11)=$P(IVMSTR,"^",1,10),$P(^(1),"^",3,4)=%_"^"_DUZ
..S DA=IVMTDA,DIK="^IVM(301.61," D IX1^DIK
..;
..; - trigger transmission
..I $P(IVMSTR,"^",3)>1,$P(IVMSTR,"^",11) Q ; bill is on hold
..D TRANS(IVMTDA,1)
.;
.; - see if a transmission is not required
.S IVMQ=0,IVMTN=$G(^IVM(301.61,IVMTDA,0)) Q:'IVMTN
.I $P(IVMTN,"^",14) D Q:IVMQ
..I $P(IVMTN,"^",10)!$P(IVMTN,"^",11) S IVMQ=1 Q
..I $P(IVMTN,"^",4)>1,'$P(IVMSTR,"^",10),$P(IVMTN,"^",8)=$P(IVMSTR,"^",7) S IVMQ=1 Q
.;
.; - if a billed charge was cancelled, zero out amt and queue trans.
.I $P(IVMTN,"^",13),$P(IVMSTR,"^",10) D Q
..S DA=IVMTDA,DIE="^IVM(301.61,",DR=".08////0;.11////1" D ^DIE K DA,DR,DIE
..D TRANS(IVMTDA,1)
.;
.; - if a held charge
.I '$P(IVMTN,"^",13) D Q:IVMQ
..;
..; - is still on hold, quit
..I $P(IVMSTR,"^",11) S IVMQ=1 Q
..;
..; - was cancelled, delete record
..I $P(IVMSTR,"^",10) S DA=IVMTDA,DIK="^IVM(301.61," D ^DIK K DA,DIK S IVMQ=1
.;
.; - is no longer on hold, update record and queue transmission
.I '$P(IVMTN,"^",13),'$P(IVMSTR,"^",11) D
..S DR=".05////"_$P(IVMSTR,"^",4)_";.06////"_$P(IVMSTR,"^",5)_";.07////"_$P(IVMSTR,"^",6)_";.08////"_$P(IVMSTR,"^",7)
..S DA=IVMTDA,DIE="^IVM(301.61," D ^DIE K DA,DR,DIE
..D TRANS(IVMTDA,1)
.;
.; - if amts billed/collected, or status changes, update and queue
.I +$P(IVMTN,"^",8)=+$P(IVMSTR,"^",7),+$P(IVMTN,"^",11)=+$P(IVMSTR,"^",10) D Q:IVMQ
..I $P(IVMTN,"^",4)>1 S IVMQ=1 Q
..I +$P(IVMTN,"^",9)=+$P(IVMSTR,"^",8),+$P(IVMTN,"^",10)=+$P(IVMSTR,"^",9) S IVMQ=1 Q
.;
.S DR=".05////"_$P(IVMSTR,"^",4)_";.06////"_$P(IVMSTR,"^",5)_";.08////"_$P(IVMSTR,"^",7)
.I $P(IVMTN,"^",4)=1 S DR=DR_$S($P(IVMSTR,"^",8):";.09////"_$P(IVMSTR,"^",8),1:"")_$S($P(IVMSTR,"^",9):";.1////"_$P(IVMSTR,"^",9),1:"")
.I $P(IVMSTR,"^",10) S DR=DR_";.11////1"
.S DA=IVMTDA,DIE="^IVM(301.61," D ^DIE K DA,DR,DIE
.D TRANS(IVMTDA,1)
;
K IVMREF,IVMSTR,IVMTDA,IVMQ,IVMTN,^TMP("IVMPTRN5",$J)
Q
;
;
TRANS(DA,IVMF) ; Set bill to be transmitted
; Input: DA -- Pointer to transmission record in #301.61
; IVMF -- Flag to queue transmission [1=Yes, 0=No]
I '$G(DA) G TRANSQ
N DR,DIE
S DIE="^IVM(301.61,",DR=".12////"_+$G(IVMF)_";1.03///NOW;1.04////"_DUZ D ^DIE
TRANSQ Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIVMPTRN6 3050 printed Oct 16, 2024@18:03:12 Page 2
IVMPTRN6 ;ALB/CPM - UPDATE BILLING TRANSMISSION FILE ; 13-JUN-94
+1 ;;Version 2.0 ; INCOME VERIFICATION MATCH ;; 21-OCT-94
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
UPDATE ; Roll through billing activity and update file #301.61 if necessary
+1 ; Input: the array ^TMP("IVMPTRN5",$J), which is built in
+2 ; the routine IVMPTRN5 and fully described in the
+3 ; routine IBAMTV4.
+4 ;
+5 SET IVMREF=""
FOR
SET IVMREF=$ORDER(^TMP("IVMPTRN5",$JOB,IVMREF))
if IVMREF=""
QUIT
SET IVMSTR=$GET(^(IVMREF))
IF IVMSTR
Begin DoDot:1
+6 ;
+7 ; - if an uncancelled bill is not recorded, add it
+8 SET IVMTDA=$ORDER(^IVM(301.61,"B",IVMREF,0))
IF 'IVMTDA
Begin DoDot:2
+9 if $PIECE(IVMSTR,"^",10)
QUIT
+10 SET IVMTDA=$$ADD^IVMUFNC3(IVMREF)
if 'IVMTDA
QUIT
+11 DO NOW^%DTC
SET $PIECE(^IVM(301.61,IVMTDA,0),"^",2,11)=$PIECE(IVMSTR,"^",1,10)
SET $PIECE(^(1),"^",3,4)=%_"^"_DUZ
+12 SET DA=IVMTDA
SET DIK="^IVM(301.61,"
DO IX1^DIK
+13 ;
+14 ; - trigger transmission
+15 ; bill is on hold
IF $PIECE(IVMSTR,"^",3)>1
IF $PIECE(IVMSTR,"^",11)
QUIT
+16 DO TRANS(IVMTDA,1)
End DoDot:2
QUIT
+17 ;
+18 ; - see if a transmission is not required
+19 SET IVMQ=0
SET IVMTN=$GET(^IVM(301.61,IVMTDA,0))
if 'IVMTN
QUIT
+20 IF $PIECE(IVMTN,"^",14)
Begin DoDot:2
+21 IF $PIECE(IVMTN,"^",10)!$PIECE(IVMTN,"^",11)
SET IVMQ=1
QUIT
+22 IF $PIECE(IVMTN,"^",4)>1
IF '$PIECE(IVMSTR,"^",10)
IF $PIECE(IVMTN,"^",8)=$PIECE(IVMSTR,"^",7)
SET IVMQ=1
QUIT
End DoDot:2
if IVMQ
QUIT
+23 ;
+24 ; - if a billed charge was cancelled, zero out amt and queue trans.
+25 IF $PIECE(IVMTN,"^",13)
IF $PIECE(IVMSTR,"^",10)
Begin DoDot:2
+26 SET DA=IVMTDA
SET DIE="^IVM(301.61,"
SET DR=".08////0;.11////1"
DO ^DIE
KILL DA,DR,DIE
+27 DO TRANS(IVMTDA,1)
End DoDot:2
QUIT
+28 ;
+29 ; - if a held charge
+30 IF '$PIECE(IVMTN,"^",13)
Begin DoDot:2
+31 ;
+32 ; - is still on hold, quit
+33 IF $PIECE(IVMSTR,"^",11)
SET IVMQ=1
QUIT
+34 ;
+35 ; - was cancelled, delete record
+36 IF $PIECE(IVMSTR,"^",10)
SET DA=IVMTDA
SET DIK="^IVM(301.61,"
DO ^DIK
KILL DA,DIK
SET IVMQ=1
End DoDot:2
if IVMQ
QUIT
+37 ;
+38 ; - is no longer on hold, update record and queue transmission
+39 IF '$PIECE(IVMTN,"^",13)
IF '$PIECE(IVMSTR,"^",11)
Begin DoDot:2
+40 SET DR=".05////"_$PIECE(IVMSTR,"^",4)_";.06////"_$PIECE(IVMSTR,"^",5)_";.07////"_$PIECE(IVMSTR,"^",6)_";.08////"_$PIECE(IVMSTR,"^",7)
+41 SET DA=IVMTDA
SET DIE="^IVM(301.61,"
DO ^DIE
KILL DA,DR,DIE
+42 DO TRANS(IVMTDA,1)
End DoDot:2
+43 ;
+44 ; - if amts billed/collected, or status changes, update and queue
+45 IF +$PIECE(IVMTN,"^",8)=+$PIECE(IVMSTR,"^",7)
IF +$PIECE(IVMTN,"^",11)=+$PIECE(IVMSTR,"^",10)
Begin DoDot:2
+46 IF $PIECE(IVMTN,"^",4)>1
SET IVMQ=1
QUIT
+47 IF +$PIECE(IVMTN,"^",9)=+$PIECE(IVMSTR,"^",8)
IF +$PIECE(IVMTN,"^",10)=+$PIECE(IVMSTR,"^",9)
SET IVMQ=1
QUIT
End DoDot:2
if IVMQ
QUIT
+48 ;
+49 SET DR=".05////"_$PIECE(IVMSTR,"^",4)_";.06////"_$PIECE(IVMSTR,"^",5)_";.08////"_$PIECE(IVMSTR,"^",7)
+50 IF $PIECE(IVMTN,"^",4)=1
SET DR=DR_$SELECT($PIECE(IVMSTR,"^",8):";.09////"_$PIECE(IVMSTR,"^",8),1:"")_$SELECT($PIECE(IVMSTR,"^",9):";.1////"_$PIECE(IVMSTR,"^",9),1:"")
+51 IF $PIECE(IVMSTR,"^",10)
SET DR=DR_";.11////1"
+52 SET DA=IVMTDA
SET DIE="^IVM(301.61,"
DO ^DIE
KILL DA,DR,DIE
+53 DO TRANS(IVMTDA,1)
End DoDot:1
+54 ;
+55 KILL IVMREF,IVMSTR,IVMTDA,IVMQ,IVMTN,^TMP("IVMPTRN5",$JOB)
+56 QUIT
+57 ;
+58 ;
TRANS(DA,IVMF) ; Set bill to be transmitted
+1 ; Input: DA -- Pointer to transmission record in #301.61
+2 ; IVMF -- Flag to queue transmission [1=Yes, 0=No]
+3 IF '$GET(DA)
GOTO TRANSQ
+4 NEW DR,DIE
+5 SET DIE="^IVM(301.61,"
SET DR=".12////"_+$GET(IVMF)_";1.03///NOW;1.04////"_DUZ
DO ^DIE
TRANSQ QUIT