FBRXFED ;WOIFO/SAB - FPPS DATA EDIT PHARMACY INVOICE ;5/16/14 15:15
;;3.5;FEE BASIS;**61,154**;JAN 30, 1995;Build 12
;;Per VA Directive 6402, this routine should not be modified.
;
S FBAAOUT=0
F D INVED Q:FBAAOUT
D CLEAN
Q
;
INVED ; Invoice Edit
;
ASKINV ; Select Invoice to Edit
W ! S DIC="^FBAA(162.1,",DIC(0)="AEQM",DIC("A")="Select Invoice #: "
; screen on invoices with completed status and EDI
S DIC("S")="I $P(^(0),U,5)=4&($P(^(0),U,13)]"""")"
D ^DIC K DIC I Y'>0 S FBAAOUT=1 Q
S FBDA=+Y
;
I $$CKFPPS^FBFHLL(FBDA)'=1 D G ASKINV
. W !?5,"Invoice ",FBDA," has not been transmitted to FPPS."
;
; save FPPS Claim ID data prior to edit session
S (FBFPPSC,FBFPPSC(0))=$P($G(^FBAA(162.1,FBDA,0)),U,13)
S FBINVCHG=0 ; initialize invoice changed flag
;
EDITFC ; edit FPPS CLAIM ID
S FBX=$$FPPSC^FBUTL5(1,FBFPPSC)
I FBX=-1 S FBAAOUT=1 G INVEDX
; need to verify if following restriction is appropriate
I FBX="" D G EDITFC
. W !,$C(7),"Can not change EDI from YES to NO on invoice that has been sent to FPPS!"
S FBFPPSC=FBX
;
; if FPPS CLAIM ID changed, then update file, audit log, and Rx's
I FBFPPSC'=FBFPPSC(0) D
. ; set invoice changed flag
. S FBINVCHG=1
. ;
. ; file data in 162.1
. K FBFDA
. S FBFDA(162.1,FBDA_",",13)=$S(FBFPPSC="":"@",1:FBFPPSC)
. I $D(FBFDA) D FILE^DIE("","FBFDA") D MSG^DIALOG()
. ;
. ; add record to audit log
. K FBFDA
. S FBFDA(163.7,"+1,",.01)=FBDA ; invoice number
. S FBFDA(163.7,"+1,",1)=$$NOW^XLFDT() ; date/time changed
. S FBFDA(163.7,"+1,",2)=162.1 ; file #
. S FBFDA(163.7,"+1,",3)=FBDA_"," ; iens
. S FBFDA(163.7,"+1,",4)=13 ; field #
. S FBFDA(163.7,"+1,",5)=FBFPPSC(0) ; old value
. S FBFDA(163.7,"+1,",6)=FBFPPSC ; new value
. S FBFDA(163.7,"+1,",7)=DUZ ; user
. I $D(FBFDA) D UPDATE^DIE("","FBFDA") D MSG^DIALOG()
. ;
. ; update Rx's (would only apply if EDI status can change)
. D CKINVEDI^FBAAEPI1(FBFPPSC(0),FBFPPSC,FBDA)
;
ASKRX ; Select Prescription to Edit
W !
S DIC="^FBAA(162.1,"_FBDA_",""RX"",",DIC(0)="AEQM"
S DIC("W")="W ?30,""DATE RX FILLED: "",$E($P(^(0),U,3),4,5)_""/""_$E($P(^(0),U,3),6,7)_""/""_$E($P(^(0),U,3),2,3)"
D ^DIC I $D(DUOUT) S FBAAOUT=1 G INVEDX
I Y'>0 D G:$D(DIRUT)!(Y=1) INVEDX G ASKRX
. S DIR(0)="Y"
. S DIR("A")="Are you finished editing prescriptions on invoice "_FBDA
. D ^DIR K DIR I $D(DIRUT) S FBAAOUT=1
S FBRXDA=+Y
;
; get current value of FPPS LINE ITEM to use as default
S (FBFPPSL(0),FBFPPSL)=$P($G(^FBAA(162.1,FBDA,"RX",FBRXDA,3)),U)
;
EDITFL ; edit FPPS Line Item
S FBX=$$FPPSL^FBUTL5(FBFPPSL)
I FBX=-1 S FBAAOUT=1 G INVEDX
; need to verify if following restriction is appropriate
S FBFPPSL=FBX
;
; if FPPS LINE ITEM changed, then update file and audit log
I FBFPPSL'=FBFPPSL(0) D
. ; set invoice changed flag
. S FBINVCHG=1
. ;
. ; file data in 162.11
. K FBFDA
. S FBFDA(162.11,FBRXDA_","_FBDA_",",36)=FBFPPSL
. I $D(FBFDA) D FILE^DIE("","FBFDA") D MSG^DIALOG()
. ;
. ; add record to audit log
. K FBFDA
. S FBFDA(163.7,"+1,",.01)=FBDA ; invoice number
. S FBFDA(163.7,"+1,",1)=$$NOW^XLFDT() ; date/time changed
. S FBFDA(163.7,"+1,",2)=162.11 ; file #
. S FBFDA(163.7,"+1,",3)=FBRXDA_","_FBDA_"," ; iens
. S FBFDA(163.7,"+1,",4)=36 ; field #
. S FBFDA(163.7,"+1,",5)=FBFPPSL(0) ; old value
. S FBFDA(163.7,"+1,",6)=FBFPPSL ; new value
. S FBFDA(163.7,"+1,",7)=DUZ ; user
. I $D(FBFDA) D UPDATE^DIE("","FBFDA") D MSG^DIALOG()
;
G ASKRX
;
INVEDX ; Invoice Edit Exit
; if invoice changed then queue for retransmit to FPPS
I FBINVCHG D FILEQUE^FBFHLL(FBDA,5)
Q
;
CLEAN K DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
K FBAAOUT,FBDA,FBFDA,FBFPPSC,FBFPPSL,FBINVCHG,FBRXDA,FBX
Q
;FBRXFED
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBRXFED 3776 printed Nov 22, 2024@17:10:04 Page 2
FBRXFED ;WOIFO/SAB - FPPS DATA EDIT PHARMACY INVOICE ;5/16/14 15:15
+1 ;;3.5;FEE BASIS;**61,154**;JAN 30, 1995;Build 12
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 SET FBAAOUT=0
+5 FOR
DO INVED
if FBAAOUT
QUIT
+6 DO CLEAN
+7 QUIT
+8 ;
INVED ; Invoice Edit
+1 ;
ASKINV ; Select Invoice to Edit
+1 WRITE !
SET DIC="^FBAA(162.1,"
SET DIC(0)="AEQM"
SET DIC("A")="Select Invoice #: "
+2 ; screen on invoices with completed status and EDI
+3 SET DIC("S")="I $P(^(0),U,5)=4&($P(^(0),U,13)]"""")"
+4 DO ^DIC
KILL DIC
IF Y'>0
SET FBAAOUT=1
QUIT
+5 SET FBDA=+Y
+6 ;
+7 IF $$CKFPPS^FBFHLL(FBDA)'=1
Begin DoDot:1
+8 WRITE !?5,"Invoice ",FBDA," has not been transmitted to FPPS."
End DoDot:1
GOTO ASKINV
+9 ;
+10 ; save FPPS Claim ID data prior to edit session
+11 SET (FBFPPSC,FBFPPSC(0))=$PIECE($GET(^FBAA(162.1,FBDA,0)),U,13)
+12 ; initialize invoice changed flag
SET FBINVCHG=0
+13 ;
EDITFC ; edit FPPS CLAIM ID
+1 SET FBX=$$FPPSC^FBUTL5(1,FBFPPSC)
+2 IF FBX=-1
SET FBAAOUT=1
GOTO INVEDX
+3 ; need to verify if following restriction is appropriate
+4 IF FBX=""
Begin DoDot:1
+5 WRITE !,$CHAR(7),"Can not change EDI from YES to NO on invoice that has been sent to FPPS!"
End DoDot:1
GOTO EDITFC
+6 SET FBFPPSC=FBX
+7 ;
+8 ; if FPPS CLAIM ID changed, then update file, audit log, and Rx's
+9 IF FBFPPSC'=FBFPPSC(0)
Begin DoDot:1
+10 ; set invoice changed flag
+11 SET FBINVCHG=1
+12 ;
+13 ; file data in 162.1
+14 KILL FBFDA
+15 SET FBFDA(162.1,FBDA_",",13)=$SELECT(FBFPPSC="":"@",1:FBFPPSC)
+16 IF $DATA(FBFDA)
DO FILE^DIE("","FBFDA")
DO MSG^DIALOG()
+17 ;
+18 ; add record to audit log
+19 KILL FBFDA
+20 ; invoice number
SET FBFDA(163.7,"+1,",.01)=FBDA
+21 ; date/time changed
SET FBFDA(163.7,"+1,",1)=$$NOW^XLFDT()
+22 ; file #
SET FBFDA(163.7,"+1,",2)=162.1
+23 ; iens
SET FBFDA(163.7,"+1,",3)=FBDA_","
+24 ; field #
SET FBFDA(163.7,"+1,",4)=13
+25 ; old value
SET FBFDA(163.7,"+1,",5)=FBFPPSC(0)
+26 ; new value
SET FBFDA(163.7,"+1,",6)=FBFPPSC
+27 ; user
SET FBFDA(163.7,"+1,",7)=DUZ
+28 IF $DATA(FBFDA)
DO UPDATE^DIE("","FBFDA")
DO MSG^DIALOG()
+29 ;
+30 ; update Rx's (would only apply if EDI status can change)
+31 DO CKINVEDI^FBAAEPI1(FBFPPSC(0),FBFPPSC,FBDA)
End DoDot:1
+32 ;
ASKRX ; Select Prescription to Edit
+1 WRITE !
+2 SET DIC="^FBAA(162.1,"_FBDA_",""RX"","
SET DIC(0)="AEQM"
+3 SET DIC("W")="W ?30,""DATE RX FILLED: "",$E($P(^(0),U,3),4,5)_""/""_$E($P(^(0),U,3),6,7)_""/""_$E($P(^(0),U,3),2,3)"
+4 DO ^DIC
IF $DATA(DUOUT)
SET FBAAOUT=1
GOTO INVEDX
+5 IF Y'>0
Begin DoDot:1
+6 SET DIR(0)="Y"
+7 SET DIR("A")="Are you finished editing prescriptions on invoice "_FBDA
+8 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET FBAAOUT=1
End DoDot:1
if $DATA(DIRUT)!(Y=1)
GOTO INVEDX
GOTO ASKRX
+9 SET FBRXDA=+Y
+10 ;
+11 ; get current value of FPPS LINE ITEM to use as default
+12 SET (FBFPPSL(0),FBFPPSL)=$PIECE($GET(^FBAA(162.1,FBDA,"RX",FBRXDA,3)),U)
+13 ;
EDITFL ; edit FPPS Line Item
+1 SET FBX=$$FPPSL^FBUTL5(FBFPPSL)
+2 IF FBX=-1
SET FBAAOUT=1
GOTO INVEDX
+3 ; need to verify if following restriction is appropriate
+4 SET FBFPPSL=FBX
+5 ;
+6 ; if FPPS LINE ITEM changed, then update file and audit log
+7 IF FBFPPSL'=FBFPPSL(0)
Begin DoDot:1
+8 ; set invoice changed flag
+9 SET FBINVCHG=1
+10 ;
+11 ; file data in 162.11
+12 KILL FBFDA
+13 SET FBFDA(162.11,FBRXDA_","_FBDA_",",36)=FBFPPSL
+14 IF $DATA(FBFDA)
DO FILE^DIE("","FBFDA")
DO MSG^DIALOG()
+15 ;
+16 ; add record to audit log
+17 KILL FBFDA
+18 ; invoice number
SET FBFDA(163.7,"+1,",.01)=FBDA
+19 ; date/time changed
SET FBFDA(163.7,"+1,",1)=$$NOW^XLFDT()
+20 ; file #
SET FBFDA(163.7,"+1,",2)=162.11
+21 ; iens
SET FBFDA(163.7,"+1,",3)=FBRXDA_","_FBDA_","
+22 ; field #
SET FBFDA(163.7,"+1,",4)=36
+23 ; old value
SET FBFDA(163.7,"+1,",5)=FBFPPSL(0)
+24 ; new value
SET FBFDA(163.7,"+1,",6)=FBFPPSL
+25 ; user
SET FBFDA(163.7,"+1,",7)=DUZ
+26 IF $DATA(FBFDA)
DO UPDATE^DIE("","FBFDA")
DO MSG^DIALOG()
End DoDot:1
+27 ;
+28 GOTO ASKRX
+29 ;
INVEDX ; Invoice Edit Exit
+1 ; if invoice changed then queue for retransmit to FPPS
+2 IF FBINVCHG
DO FILEQUE^FBFHLL(FBDA,5)
+3 QUIT
+4 ;
CLEAN KILL DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+1 KILL FBAAOUT,FBDA,FBFDA,FBFPPSC,FBFPPSL,FBINVCHG,FBRXDA,FBX
+2 QUIT
+3 ;FBRXFED