FBAAFED ;WOIFO/SAB - FPPS DATA EDIT OUTPATIENT/ANCILLARY INVOICE ;5/15/14 12:49
;;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 DIR(0)="NO",DIR("A")="Select Invoice Number"
S DIR("?")="^D HELP^FBAAPIN1"
D ^DIR K DIR I $D(DIRUT)!(Y="") S FBAAOUT=1 Q
I '$D(^FBAAC("C",Y)) W !,$C(7),"Invalid selection.",! G ASKINV
S FBAAIN=Y
;
I $$CKFPPS^FBFHLL(FBAAIN)'=1 D G ASKINV
. W !?5,"Invoice ",FBAAIN," has not been transmitted to FPPS."
;
; Get Lines on Invoice
D MILL^FBAAPET1(FBAAIN,.FBMILL)
;
; Determine Vendor and FPPS CLAIM ID based on first line on invoice
S FBIENS=FBMILL($O(FBMILL(0)))
S FBV=$P(FBIENS,",",3)
S (FBFPPSC,FBFPPSC(0))=$$GET1^DIQ(162.03,FBIENS,50)
;
I FBFPPSC="" D G ASKINV
. W !,$C(7),"Only EDI Claims can be selected!"
;
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 lines
I FBFPPSC'=FBFPPSC(0) D
. ; set invoice changed flag
. S FBINVCHG=1
. ;
. K FBFDA
. ; loop thru lines on invoice
. S FBI=0 F S FBI=$O(FBMILL(FBI)) Q:'FBI D
. . S FBIENS=FBMILL(FBI)
. . ; file data in 162.03 for each line
. . S FBFDA(162.03,FBIENS,50)=$S(FBFPPSC="":"@",1:FBFPPSC)
. . ;
. . ; add record to audit log
. . K FBFDAA
. . S FBFDAA(163.7,"+1,",.01)=FBAAIN ; invoice number
. . S FBFDAA(163.7,"+1,",1)=$$NOW^XLFDT() ; date/time changed
. . S FBFDAA(163.7,"+1,",2)=162.03 ; file #
. . S FBFDAA(163.7,"+1,",3)=FBIENS ; iens
. . S FBFDAA(163.7,"+1,",4)=50 ; field #
. . S FBFDAA(163.7,"+1,",5)=FBFPPSC(0) ; old value
. . S FBFDAA(163.7,"+1,",6)=FBFPPSC ; new value
. . S FBFDAA(163.7,"+1,",7)=DUZ ; user
. . I $D(FBFDAA) D UPDATE^DIE("","FBFDAA") D MSG^DIALOG()
. . ;
. I $D(FBFDA) D FILE^DIE("","FBFDA") D MSG^DIALOG()
;
ASKLINE ; Select Line to Edit
;
ASKPT ; Select Patient
W !
S DIC="^FBAAC(",DIC(0)="AEQM"
D ^DIC K DIC I $D(DTOUT)!$D(DUOUT) G INVEDX
I Y'>0 D G:$D(DIRUT) INVEDX G:'Y ASKPT G INVEDX
. S DIR(0)="Y"
. S DIR("A")="Are you finished entering patients for this invoice"
. D ^DIR K DIR I $D(DIRUT) S FBAAOUT=1
S FBDA(3)=+Y
;
ASKVEN ; Select Vendor
W !
;S DIC(0)="AEQM"
;S DIC="^FBAAC("_FBDA(3)_",1,"
;D ^DIC K DIC I $D(DTOUT)!$D(DUOUT) G INVEDX
;I Y'>0 D G:$D(DIRUT) INVEDX G:'Y ASKVEN G ASKPT
;. S DIR(0)="Y"
;. S DIR("A")="Are you finished entering vendors for this patient"
;. D ^DIR K DIR I $D(DIRUT) S FBAAOUT=1
;S FBDA(2)=+Y
S FBDA(2)=FBV
W !,"Vendor = ",$P($G(^FBAAV(FBV,0)),U)
;
ASKDOS ; Select Date of Service
W !
S DIC(0)="AEQM"
S DIC="^FBAAC("_FBDA(3)_",1,"_FBDA(2)_",1,"
S DIC("A")="Select DATE OF SERVICE: "
D ^DIC K DIC I $D(DTOUT)!$D(DUOUT) G INVEDX
I Y'>0 D G:$D(DIRUT) INVEDX G:'Y ASKDOS G ASKPT
. S DIR(0)="Y"
. S DIR("A")="Are you finished entering dates for this patient"
. D ^DIR K DIR I $D(DIRUT) S FBAAOUT=1
S FBDA(1)=+Y
;
ASKSVC ; Select Service Provided
W !
S DIC(0)="AEQM"
S DIC="^FBAAC("_FBDA(3)_",1,"_FBDA(2)_",1,"_FBDA(1)_",1,"
D ^DIC K DIC I $D(DTOUT)!$D(DUOUT) G INVEDX
I Y'>0 D G:$D(DIRUT) INVEDX G:'Y ASKSVC G ASKDOS
. S DIR(0)="Y"
. S DIR("A")="Are you finished entering services for this date"
. D ^DIR K DIR I $D(DIRUT) S FBAAOUT=1
S FBDA=+Y
;
S FBIENS=FBDA_","_FBDA(1)_","_FBDA(2)_","_FBDA(3)_","
;
; check if line is on invoice
I $$GET1^DIQ(162.03,FBIENS,14)'=FBAAIN D G ASKSVC
. W $C(7),!,"Line is not on invoice ",FBAAIN,"!"
;
; get current value of FPPS LINE ITEM to use as default
S (FBFPPSL(0),FBFPPSL)=$$GET1^DIQ(162.03,FBIENS,51)
;
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.03
. K FBFDA
. S FBFDA(162.03,FBIENS,51)=FBFPPSL
. I $D(FBFDA) D FILE^DIE("","FBFDA") D MSG^DIALOG()
. ;
. ; add record to audit log
. K FBFDA
. S FBFDA(163.7,"+1,",.01)=FBAAIN ; invoice number
. S FBFDA(163.7,"+1,",1)=$$NOW^XLFDT() ; date/time changed
. S FBFDA(163.7,"+1,",2)=162.03 ; file #
. S FBFDA(163.7,"+1,",3)=FBIENS ; iens
. S FBFDA(163.7,"+1,",4)=51 ; 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 ASKSVC
;
INVEDX ; Invoice Edit Exit
; if invoice changed then queue for retransmit to FPPS
I FBINVCHG D FILEQUE^FBFHLL(FBAAIN,3)
Q
;
CLEAN K D,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
K FBAAIN,FBAAOUT,FBDA,FBFDA,FBFDAA,FBIENS,FBFPPSC,FBFPPSL,FBINVCHG
K FBMILL,FBV,FBX
Q
;FBAAFED
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBAAFED 5269 printed Oct 16, 2024@17:56:17 Page 2
FBAAFED ;WOIFO/SAB - FPPS DATA EDIT OUTPATIENT/ANCILLARY INVOICE ;5/15/14 12:49
+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 !
+2 SET DIR(0)="NO"
SET DIR("A")="Select Invoice Number"
+3 SET DIR("?")="^D HELP^FBAAPIN1"
+4 DO ^DIR
KILL DIR
IF $DATA(DIRUT)!(Y="")
SET FBAAOUT=1
QUIT
+5 IF '$DATA(^FBAAC("C",Y))
WRITE !,$CHAR(7),"Invalid selection.",!
GOTO ASKINV
+6 SET FBAAIN=Y
+7 ;
+8 IF $$CKFPPS^FBFHLL(FBAAIN)'=1
Begin DoDot:1
+9 WRITE !?5,"Invoice ",FBAAIN," has not been transmitted to FPPS."
End DoDot:1
GOTO ASKINV
+10 ;
+11 ; Get Lines on Invoice
+12 DO MILL^FBAAPET1(FBAAIN,.FBMILL)
+13 ;
+14 ; Determine Vendor and FPPS CLAIM ID based on first line on invoice
+15 SET FBIENS=FBMILL($ORDER(FBMILL(0)))
+16 SET FBV=$PIECE(FBIENS,",",3)
+17 SET (FBFPPSC,FBFPPSC(0))=$$GET1^DIQ(162.03,FBIENS,50)
+18 ;
+19 IF FBFPPSC=""
Begin DoDot:1
+20 WRITE !,$CHAR(7),"Only EDI Claims can be selected!"
End DoDot:1
GOTO ASKINV
+21 ;
+22 ; initialize invoice changed flag
SET FBINVCHG=0
+23 ;
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 lines
+9 IF FBFPPSC'=FBFPPSC(0)
Begin DoDot:1
+10 ; set invoice changed flag
+11 SET FBINVCHG=1
+12 ;
+13 KILL FBFDA
+14 ; loop thru lines on invoice
+15 SET FBI=0
FOR
SET FBI=$ORDER(FBMILL(FBI))
if 'FBI
QUIT
Begin DoDot:2
+16 SET FBIENS=FBMILL(FBI)
+17 ; file data in 162.03 for each line
+18 SET FBFDA(162.03,FBIENS,50)=$SELECT(FBFPPSC="":"@",1:FBFPPSC)
+19 ;
+20 ; add record to audit log
+21 KILL FBFDAA
+22 ; invoice number
SET FBFDAA(163.7,"+1,",.01)=FBAAIN
+23 ; date/time changed
SET FBFDAA(163.7,"+1,",1)=$$NOW^XLFDT()
+24 ; file #
SET FBFDAA(163.7,"+1,",2)=162.03
+25 ; iens
SET FBFDAA(163.7,"+1,",3)=FBIENS
+26 ; field #
SET FBFDAA(163.7,"+1,",4)=50
+27 ; old value
SET FBFDAA(163.7,"+1,",5)=FBFPPSC(0)
+28 ; new value
SET FBFDAA(163.7,"+1,",6)=FBFPPSC
+29 ; user
SET FBFDAA(163.7,"+1,",7)=DUZ
+30 IF $DATA(FBFDAA)
DO UPDATE^DIE("","FBFDAA")
DO MSG^DIALOG()
+31 ;
End DoDot:2
+32 IF $DATA(FBFDA)
DO FILE^DIE("","FBFDA")
DO MSG^DIALOG()
End DoDot:1
+33 ;
ASKLINE ; Select Line to Edit
+1 ;
ASKPT ; Select Patient
+1 WRITE !
+2 SET DIC="^FBAAC("
SET DIC(0)="AEQM"
+3 DO ^DIC
KILL DIC
IF $DATA(DTOUT)!$DATA(DUOUT)
GOTO INVEDX
+4 IF Y'>0
Begin DoDot:1
+5 SET DIR(0)="Y"
+6 SET DIR("A")="Are you finished entering patients for this invoice"
+7 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET FBAAOUT=1
End DoDot:1
if $DATA(DIRUT)
GOTO INVEDX
if 'Y
GOTO ASKPT
GOTO INVEDX
+8 SET FBDA(3)=+Y
+9 ;
ASKVEN ; Select Vendor
+1 WRITE !
+2 ;S DIC(0)="AEQM"
+3 ;S DIC="^FBAAC("_FBDA(3)_",1,"
+4 ;D ^DIC K DIC I $D(DTOUT)!$D(DUOUT) G INVEDX
+5 ;I Y'>0 D G:$D(DIRUT) INVEDX G:'Y ASKVEN G ASKPT
+6 ;. S DIR(0)="Y"
+7 ;. S DIR("A")="Are you finished entering vendors for this patient"
+8 ;. D ^DIR K DIR I $D(DIRUT) S FBAAOUT=1
+9 ;S FBDA(2)=+Y
+10 SET FBDA(2)=FBV
+11 WRITE !,"Vendor = ",$PIECE($GET(^FBAAV(FBV,0)),U)
+12 ;
ASKDOS ; Select Date of Service
+1 WRITE !
+2 SET DIC(0)="AEQM"
+3 SET DIC="^FBAAC("_FBDA(3)_",1,"_FBDA(2)_",1,"
+4 SET DIC("A")="Select DATE OF SERVICE: "
+5 DO ^DIC
KILL DIC
IF $DATA(DTOUT)!$DATA(DUOUT)
GOTO INVEDX
+6 IF Y'>0
Begin DoDot:1
+7 SET DIR(0)="Y"
+8 SET DIR("A")="Are you finished entering dates for this patient"
+9 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET FBAAOUT=1
End DoDot:1
if $DATA(DIRUT)
GOTO INVEDX
if 'Y
GOTO ASKDOS
GOTO ASKPT
+10 SET FBDA(1)=+Y
+11 ;
ASKSVC ; Select Service Provided
+1 WRITE !
+2 SET DIC(0)="AEQM"
+3 SET DIC="^FBAAC("_FBDA(3)_",1,"_FBDA(2)_",1,"_FBDA(1)_",1,"
+4 DO ^DIC
KILL DIC
IF $DATA(DTOUT)!$DATA(DUOUT)
GOTO INVEDX
+5 IF Y'>0
Begin DoDot:1
+6 SET DIR(0)="Y"
+7 SET DIR("A")="Are you finished entering services for this date"
+8 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET FBAAOUT=1
End DoDot:1
if $DATA(DIRUT)
GOTO INVEDX
if 'Y
GOTO ASKSVC
GOTO ASKDOS
+9 SET FBDA=+Y
+10 ;
+11 SET FBIENS=FBDA_","_FBDA(1)_","_FBDA(2)_","_FBDA(3)_","
+12 ;
+13 ; check if line is on invoice
+14 IF $$GET1^DIQ(162.03,FBIENS,14)'=FBAAIN
Begin DoDot:1
+15 WRITE $CHAR(7),!,"Line is not on invoice ",FBAAIN,"!"
End DoDot:1
GOTO ASKSVC
+16 ;
+17 ; get current value of FPPS LINE ITEM to use as default
+18 SET (FBFPPSL(0),FBFPPSL)=$$GET1^DIQ(162.03,FBIENS,51)
+19 ;
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.03
+12 KILL FBFDA
+13 SET FBFDA(162.03,FBIENS,51)=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)=FBAAIN
+19 ; date/time changed
SET FBFDA(163.7,"+1,",1)=$$NOW^XLFDT()
+20 ; file #
SET FBFDA(163.7,"+1,",2)=162.03
+21 ; iens
SET FBFDA(163.7,"+1,",3)=FBIENS
+22 ; field #
SET FBFDA(163.7,"+1,",4)=51
+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 ASKSVC
+29 ;
INVEDX ; Invoice Edit Exit
+1 ; if invoice changed then queue for retransmit to FPPS
+2 IF FBINVCHG
DO FILEQUE^FBFHLL(FBAAIN,3)
+3 QUIT
+4 ;
CLEAN KILL D,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+1 KILL FBAAIN,FBAAOUT,FBDA,FBFDA,FBFDAA,FBIENS,FBFPPSC,FBFPPSL,FBINVCHG
+2 KILL FBMILL,FBV,FBX
+3 QUIT
+4 ;FBAAFED