FBCHDIN ;AISC/DMK - DELETE INPATIENT INVOICE ;12/12/14 14:37
;;3.5;FEE BASIS;**132,154**;JAN 30, 1995;Build 12
;;Per VA Directive 6402, this routine should not be modified.
;
BAT ;ask batch Number
;cannot delete an invoice from a batch that has a status of
;supervisor closed, reviewed after pricer, transmitted or vouchered.
;A clerk may delete an invoice in a batch
;they own if the status is open, closed, forwarded to pricer or
;assigned price.
;
D HOME^%ZIS
W ! S DIC="^FBAA(161.7,",DIC(0)="AEQMZ"
S DIC("S")=$S($D(^XUSEC("FBAA LEVEL 2",DUZ)):"I ""TFV""'[$G(^(""ST""))",1:"I $P(^(0),U,5)=DUZ&(""TFVRS""'[($G(^(""ST""))))")_"&($P(^(0),U,3)=""B9"")"
D ^DIC K DIC G:Y<1 END
L +^FBAA(161.7,+Y):$G(DILOCKTM,3)
I '$T W !,"Another user is editing this batch. Try again later." G BAT
S FBBAT=+Y,FBBAT(0)=Y(0)
;
INV ;get invoice user wants to delete in batch selected
W ! S DIC="^FBAAI(",DIC(0)="AEQZ",DIC("S")="I $D(^FBAAI(""AC"",FBBAT,X))"
S DIC("A")="Select Invoice to delete: " D ^DIC K DIC I X=""!(X="^") L -^FBAA(161.7,FBBAT) G BAT
S FBDINV=Y,FBDINV(0)=Y(0),FBI=+Y,FBLISTC=0 D START^FBCHDI
;
; enforce separation of duties
S FBDFN=$P(FBDINV(0),U,4)
S FB7078I=$P(FBDINV(0),U,5)
S FTP=$S(FB7078I]"":$O(^FBAAA("AG",FB7078I,FBDFN,0)),1:"")
I FBDFN,FTP,'$$UOKPAY^FBUTL9(FBDFN,FTP) D L -^FBAA(161.7,FBBAT) G BAT
. W !,"You cannot process a payment associated with authorization ",FBDFN,"-",FTP
. W !,"due to separation of duties."
;
W ! S DIR(0)="Y",DIR("B")="No",DIR("A")="Sure you want to delete this invoice" D ^DIR K DIR G END:$D(DIRUT) I 'Y L -^FBAA(161.7,FBBAT) G BAT
;
S DA=+FBDINV,DIK="^FBAAI(" W !?5,".... deleting!",!
D ^DIK K DIK
;
;reset batch dollar amount, total payment items and invoice count
D CNTTOT^FBAARB(FBBAT)
S $P(FBBAT(0),"^",9)=+FBTOTAL
S $P(FBBAT(0),"^",10)=+FBLCNT
S $P(FBBAT(0),"^",11)=+FBLCNT
S:$P(FBBAT(0),"^",10)'>0 $P(FBBAT(0),"^",18)=""
S $P(^FBAA(161.7,FBBAT,0),"^",9,11)=$P(FBBAT(0),"^",9,11),$P(^FBAA(161.7,FBBAT,0),"^",18)=$P(FBBAT(0),"^",18)
END I $G(FBBAT) L -^FBAA(161.7,FBBAT)
K DA,FBBAT,FBLISTC,FBDINV,FBAAOUT,FBDX,FBDX1,FBPAT,FBPROC,FBVEN,X,Y,Q
K FB7078I,FBDFN,FTP,DTOUT,DUOUT,DIRUT,DIROUT,FBI,FBLCNT,FBTOTAL
D END^FBCHDI Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBCHDIN 2258 printed Nov 22, 2024@17:07:50 Page 2
FBCHDIN ;AISC/DMK - DELETE INPATIENT INVOICE ;12/12/14 14:37
+1 ;;3.5;FEE BASIS;**132,154**;JAN 30, 1995;Build 12
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
BAT ;ask batch Number
+1 ;cannot delete an invoice from a batch that has a status of
+2 ;supervisor closed, reviewed after pricer, transmitted or vouchered.
+3 ;A clerk may delete an invoice in a batch
+4 ;they own if the status is open, closed, forwarded to pricer or
+5 ;assigned price.
+6 ;
+7 DO HOME^%ZIS
+8 WRITE !
SET DIC="^FBAA(161.7,"
SET DIC(0)="AEQMZ"
+9 SET DIC("S")=$SELECT($DATA(^XUSEC("FBAA LEVEL 2",DUZ)):"I ""TFV""'[$G(^(""ST""))",1:"I $P(^(0),U,5)=DUZ&(""TFVRS""'[($G(^(""ST""))))")_"&($P(^(0),U,3)=""B9"")"
+10 DO ^DIC
KILL DIC
if Y<1
GOTO END
+11 LOCK +^FBAA(161.7,+Y):$GET(DILOCKTM,3)
+12 IF '$TEST
WRITE !,"Another user is editing this batch. Try again later."
GOTO BAT
+13 SET FBBAT=+Y
SET FBBAT(0)=Y(0)
+14 ;
INV ;get invoice user wants to delete in batch selected
+1 WRITE !
SET DIC="^FBAAI("
SET DIC(0)="AEQZ"
SET DIC("S")="I $D(^FBAAI(""AC"",FBBAT,X))"
+2 SET DIC("A")="Select Invoice to delete: "
DO ^DIC
KILL DIC
IF X=""!(X="^")
LOCK -^FBAA(161.7,FBBAT)
GOTO BAT
+3 SET FBDINV=Y
SET FBDINV(0)=Y(0)
SET FBI=+Y
SET FBLISTC=0
DO START^FBCHDI
+4 ;
+5 ; enforce separation of duties
+6 SET FBDFN=$PIECE(FBDINV(0),U,4)
+7 SET FB7078I=$PIECE(FBDINV(0),U,5)
+8 SET FTP=$SELECT(FB7078I]"":$ORDER(^FBAAA("AG",FB7078I,FBDFN,0)),1:"")
+9 IF FBDFN
IF FTP
IF '$$UOKPAY^FBUTL9(FBDFN,FTP)
Begin DoDot:1
+10 WRITE !,"You cannot process a payment associated with authorization ",FBDFN,"-",FTP
+11 WRITE !,"due to separation of duties."
End DoDot:1
LOCK -^FBAA(161.7,FBBAT)
GOTO BAT
+12 ;
+13 WRITE !
SET DIR(0)="Y"
SET DIR("B")="No"
SET DIR("A")="Sure you want to delete this invoice"
DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO END
IF 'Y
LOCK -^FBAA(161.7,FBBAT)
GOTO BAT
+14 ;
+15 SET DA=+FBDINV
SET DIK="^FBAAI("
WRITE !?5,".... deleting!",!
+16 DO ^DIK
KILL DIK
+17 ;
+18 ;reset batch dollar amount, total payment items and invoice count
+19 DO CNTTOT^FBAARB(FBBAT)
+20 SET $PIECE(FBBAT(0),"^",9)=+FBTOTAL
+21 SET $PIECE(FBBAT(0),"^",10)=+FBLCNT
+22 SET $PIECE(FBBAT(0),"^",11)=+FBLCNT
+23 if $PIECE(FBBAT(0),"^",10)'>0
SET $PIECE(FBBAT(0),"^",18)=""
+24 SET $PIECE(^FBAA(161.7,FBBAT,0),"^",9,11)=$PIECE(FBBAT(0),"^",9,11)
SET $PIECE(^FBAA(161.7,FBBAT,0),"^",18)=$PIECE(FBBAT(0),"^",18)
END IF $GET(FBBAT)
LOCK -^FBAA(161.7,FBBAT)
+1 KILL DA,FBBAT,FBLISTC,FBDINV,FBAAOUT,FBDX,FBDX1,FBPAT,FBPROC,FBVEN,X,Y,Q
+2 KILL FB7078I,FBDFN,FTP,DTOUT,DUOUT,DIRUT,DIROUT,FBI,FBLCNT,FBTOTAL
+3 DO END^FBCHDI
QUIT