IBECEA2 ;ALB/CPM - Cancel/Edit/Add... Edit a Charge ; 15-MAR-93
;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
ONE ; Edit a single charge.
D HDR^IBECEAU("E D I T")
;
; - don't allow edit of CHAMPVA charges
I $P($G(^IB(IBN,1)),"^",5) W !,"Sorry! You cannot edit the CHAMPVA inpatient subsistence charge.",!,"Please cancel this charge and add a new charge." G ONEQ
;
; - perform up-front edits
I 'IBND S IBY="-1^IB021" G ONEQ
S IBPARNT=+$P(IBND,"^",9) I '$D(^IB(IBPARNT,0)) S IBY="-1^IB027" G ONEQ
I $$LAST^IBECEAU(IBPARNT)'=IBN W !,"You can only edit the last transaction for an original charge." G ONEQ
S IBATYP=$G(^IBE(350.1,+$P(IBND,"^",3),0)) I IBATYP="" S IBY="-1^IB022" G ONEQ
S IBSEQNO=$P(IBATYP,"^",5) I 'IBSEQNO S IBY="-1^IB023" G ONEQ
I $P(IBATYP,"^",5)=2 W !,"You cannot edit cancellation transactions... please add a new charge." G ONEQ
I $P(IBND,"^",5)=10 W !,"You cannot edit charges which have been directly cancelled.",!,"Please add a new charge." G ONEQ
;
; - see if charge has been billed or not
S IBH="^1^2^8^9^99^"[("^"_+$P(IBND,"^",5)_"^"),IBXA=$P(IBATYP,"^",11)
S IBIL=$P(IBND,"^",11),IBUNITP=+$P(IBND,"^",6),IBCHGP=+$P(IBND,"^",7)
S IBATYP=+$P($G(^IBE(350.1,+$P(IBND,"^",3),0)),"^",9)
I 'IBH D G:IBY<0 ONEQ
.I 'IBUNITP W !,"This charge has been billed, but there are no units!" S IBY=-1 Q
.I 'IBCHGP W !,"There is no charge amount associated with this action!" S IBY=-1 Q
.I IBIL="" W !,"This charge has been billed, but there is no bill number!" S IBY=-1 Q
I IBH,$P(IBND,"^",5)'=8 W !,"*** Please Note: This charge has not yet been passed to Accounts Receivable ***"
I $P(IBND,"^",5)=8 W !?17,"*** Please Note: This charge is on hold. ***",!?9,"Editing it will cause it to be passed to Accounts Receivable."
;
; - ask user for the cancellation reason
I 'IBH,IBXA'=4 D REAS^IBECEAU2("E") G:IBCRES<0 ONEQ
;
; - ask user for data to be edited
D ^IBECEA21 G:IBY<0 ONEQ
;
; - okay to proceed?
D PROC^IBECEAU4("edit") G:IBY<0 ONEQ S IBUPD=IBND
;
; - build the cancellation transaction
D CANC^IBECEAU4(IBN,IBCRES,0) G:IBY<0 ONEQ
;
; - build the updated transaction
D UPD^IBECEA22 G:IBY<0 ONEQ
;
; - handle updating of clock
I "^1^2^3^"[("^"_IBXA_"^") D CLOCK^IBECEAU(IBDOLA-IBCLDOL,IBCLDAY,IBDAYA-IBCLDAY)
;
ONEQ D ERR^IBECEAU4:IBY<0,PAUSE^IBECEAU
K IBBS,IBCRES,IBDESC,IBIL,IBND,IBARTYP,IBSEQNO,IBTOTL,IBUNIT,IBATYP,IBIDX,IBN,IBY,IBPARNT,IBH,IBXA,IBNOS,IBRTED
K IBAFY,IBCAN,IBCHG,IBCHGP,IBCLDA,IBCLDAY,IBCLDOL,IBCLDOLO,IBCLDT,IBCLST,IBDAYA,IBDAYP,IBDOLA,IBDOLP,IBDT,IBFR,IBFRP,IBI,IBJ,IBLIM,IBMED,IBTO,IBTOP,IBTRAN,IBUNIT,IBUNITP,IBUPD
Q
IBECEA2 ;ALB/CPM - Cancel/Edit/Add... Edit a Charge ; 15-MAR-93
+1 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
ONE ; Edit a single charge.
+1 DO HDR^IBECEAU("E D I T")
+2 ;
+3 ; - don't allow edit of CHAMPVA charges
+4 IF $PIECE($GET(^IB(IBN,1)),"^",5)
WRITE !,"Sorry! You cannot edit the CHAMPVA inpatient subsistence charge.",!,"Please cancel this charge and add a new charge."
GOTO ONEQ
+5 ;
+6 ; - perform up-front edits
+7 IF 'IBND
SET IBY="-1^IB021"
GOTO ONEQ
+8 SET IBPARNT=+$PIECE(IBND,"^",9)
IF '$DATA(^IB(IBPARNT,0))
SET IBY="-1^IB027"
GOTO ONEQ
+9 IF $$LAST^IBECEAU(IBPARNT)'=IBN
WRITE !,"You can only edit the last transaction for an original charge."
GOTO ONEQ
+10 SET IBATYP=$GET(^IBE(350.1,+$PIECE(IBND,"^",3),0))
IF IBATYP=""
SET IBY="-1^IB022"
GOTO ONEQ
+11 SET IBSEQNO=$PIECE(IBATYP,"^",5)
IF 'IBSEQNO
SET IBY="-1^IB023"
GOTO ONEQ
+12 IF $PIECE(IBATYP,"^",5)=2
WRITE !,"You cannot edit cancellation transactions... please add a new charge."
GOTO ONEQ
+13 IF $PIECE(IBND,"^",5)=10
WRITE !,"You cannot edit charges which have been directly cancelled.",!,"Please add a new charge."
GOTO ONEQ
+14 ;
+15 ; - see if charge has been billed or not
+16 SET IBH="^1^2^8^9^99^"[("^"_+$PIECE(IBND,"^",5)_"^")
SET IBXA=$PIECE(IBATYP,"^",11)
+17 SET IBIL=$PIECE(IBND,"^",11)
SET IBUNITP=+$PIECE(IBND,"^",6)
SET IBCHGP=+$PIECE(IBND,"^",7)
+18 SET IBATYP=+$PIECE($GET(^IBE(350.1,+$PIECE(IBND,"^",3),0)),"^",9)
+19 IF 'IBH
Begin DoDot:1
+20 IF 'IBUNITP
WRITE !,"This charge has been billed, but there are no units!"
SET IBY=-1
QUIT
+21 IF 'IBCHGP
WRITE !,"There is no charge amount associated with this action!"
SET IBY=-1
QUIT
+22 IF IBIL=""
WRITE !,"This charge has been billed, but there is no bill number!"
SET IBY=-1
QUIT
End DoDot:1
IF IBY<0
GOTO ONEQ
+23 IF IBH
IF $PIECE(IBND,"^",5)'=8
WRITE !,"*** Please Note: This charge has not yet been passed to Accounts Receivable ***"
+24 IF $PIECE(IBND,"^",5)=8
WRITE !?17,"*** Please Note: This charge is on hold. ***",!?9,"Editing it will cause it to be passed to Accounts Receivable."
+25 ;
+26 ; - ask user for the cancellation reason
+27 IF 'IBH
IF IBXA'=4
DO REAS^IBECEAU2("E")
IF IBCRES<0
GOTO ONEQ
+28 ;
+29 ; - ask user for data to be edited
+30 DO ^IBECEA21
IF IBY<0
GOTO ONEQ
+31 ;
+32 ; - okay to proceed?
+33 DO PROC^IBECEAU4("edit")
IF IBY<0
GOTO ONEQ
SET IBUPD=IBND
+34 ;
+35 ; - build the cancellation transaction
+36 DO CANC^IBECEAU4(IBN,IBCRES,0)
IF IBY<0
GOTO ONEQ
+37 ;
+38 ; - build the updated transaction
+39 DO UPD^IBECEA22
IF IBY<0
GOTO ONEQ
+40 ;
+41 ; - handle updating of clock
+42 IF "^1^2^3^"[("^"_IBXA_"^")
DO CLOCK^IBECEAU(IBDOLA-IBCLDOL,IBCLDAY,IBDAYA-IBCLDAY)
+43 ;
ONEQ IF IBY<0
DO ERR^IBECEAU4
DO PAUSE^IBECEAU
+1 KILL IBBS,IBCRES,IBDESC,IBIL,IBND,IBARTYP,IBSEQNO,IBTOTL,IBUNIT,IBATYP,IBIDX,IBN,IBY,IBPARNT,IBH,IBXA,IBNOS,IBRTED
+2 KILL IBAFY,IBCAN,IBCHG,IBCHGP,IBCLDA,IBCLDAY,IBCLDOL,IBCLDOLO,IBCLDT,IBCLST,IBDAYA,IBDAYP,IBDOLA,IBDOLP,IBDT,IBFR,IBFRP,IBI,IBJ,IBLIM,IBMED,IBTO,IBTOP,IBTRAN,IBUNIT,IBUNITP,IBUPD
+3 QUIT