BPSACR ;AITC/PD - Auto Close Reject Code Enter/Edit ;11/12/2024
;;1.0;E CLAIMS MGMT ENGINE;**39**;JUN 2004;Build 14
;;Per VA Directive 6402, this routine should not be modified.
;;
;
EN ; Main entry point for BPS AUTO CLOSE REJECTS
;
N BPSDUZ
;
; User must hold BPS SUPERVISOR key to use this option.
;
I '$D(^XUSEC("BPS SUPERVISOR",DUZ)) D Q
. W !,$C(7),"Requires the BPS SUPERVISOR key"
;
D EN^VALM("BPS AUTO CLOSE REJECTS")
;
Q
;
HDR ; Header
;
S VALMHDR(1)=""
S VALMHDR(2)="Reject Codes - Auto Close Claims"
Q
;
INIT ; Initialize
;
; Populate the list view with entries from the BPS AUTO CLOSE REJECT CODES
; file (#9002313.94). The "C" index of ^BPSACR sorts the reject codes in
; ascending order by the external value of the reject code. Codes will
; display in the list view in ascending order.
;
; Capture DUZ(0) to ensure it is set correctly upon exiting option.
S BPSDUZ=DUZ(0)
; Set DUZ(0)=@ to allow supervisor to perform deletions of file entries.
S DUZ(0)="@"
;
N ACRIEN,LINE,REJCD,REJCDE,REJIEN,RNB,STR,STR1,THRS
;
K ^TMP("BPSACR",$J)
S VALMCNT=1
;
S LINE=0
S REJCD=""
F S REJCD=$O(^BPSACR("C",REJCD)) Q:REJCD="" D
. S REJIEN=$O(^BPSACR("C",REJCD,""))
. S ACRIEN=$O(^BPSACR("C",REJCD,REJIEN,""))
. S REJCDE=$$GET1^DIQ(9002313.93,REJIEN,.02)
. I $L(REJCDE)>61 S REJCDE=$E(REJCDE,1,58)_"..."
. S RNB=$$GET1^DIQ(9002313.94,ACRIEN,.02)
. I $L(RNB)>63 S RNB=$E(RNB,1,60)_"..."
. S THRS=$$GET1^DIQ(9002313.94,ACRIEN,.03)
. S STR="",STR1=""
. S $E(STR,2)=$J(REJCD,4)
. S $E(STR,8)=$E(REJCDE,1,61)
. S $E(STR,71)="$"_$J(THRS,8)
. S $E(STR1,12)="RNB: "_$E(RNB,1,63)
. D LINE(STR)
. D LINE(STR1)
Q
;
LINE(STR) ; Set Line into List View
;
S LINE=LINE+1
D SET^VALM10(LINE,STR)
S VALMCNT=LINE
Q
;
HELP ; Help code
;
S X="?" D DISP^XQORM1 W !!
K X
;
Q
;
EC ; EC Action
;
; Edit Auto Close Reject
; Allow user to enter a new Auto Close Reject code or edit an existing.
; The specific entry will be locked to prevent another user from editing
; the same code at the same time.
;
N ACIEN,BPSFDA,DA,DAX,DAX1,DIE,DIC,DR,DTOUT,DUOUT,IEN,INCOMPLETE,QUIT,REJCDX,REJCIEN,REJCTXT,REJEXT,REJIEN
;
D FULL^VALM1
;
; Display informational message to user upon initially executing the action.
;
W !
W !,"When a pharmacist ignores a reject defined as an auto close reject and the"
W !,"specified parameter criteria is met, the system will automatically close the"
W !,"claim with the specified Claims Tracking Non-Billable Reason."
W !
W !,"The auto close functionality does not apply for claims with coordination "
W !,"of benefits."
W !
W !,"The auto close functionality does not apply for claims with more than one"
W !,"reject code."
;
EC1 ; Reentry point when entering multiple reject codes
;
; EC1 is a reentry point to allow user to enter multiple reject codes without the
; informational message displaying each time.
;
; Initial Auto Close Claim Reject Code prompt. This lookup uses the BPS NCPDP
; REJECT CODES file (#9002313.93).
;
W !
N DIC
S DIC="^BPSF(9002313.93,"
S DIC(0)="AEMNQ"
S DIC("A")="Auto Close Claim Reject Code: "
S DIC("S")="I ($P(^(0),U)'=""eC""),($P(^(0),U)'=""eT"")"
D ^DIC
;
; User entered ^ or timed out. Return to list view display.
;
I (Y=-1)!$D(DUOUT)!$D(DTOUT) S VALMBCK="R",DUZ(0)=BPSDUZ D INIT Q
;
; REJIEN = IEN from #9002313.93
; REJEXT = External value of the reject code
;
S REJIEN=$P(Y,"^")
S REJEXT=$P(Y,"^",2)
;
K X,DIC,Y
;
; Using the external value of the reject code, and the "B" index, determine if
; the reject code exists in the BPS AUTO CLOSE REJECTS file. If the reject code;
; does not exist, create a new entry in the file and set DOLLAR THRESHOLD to 0.
; For newly added reject codes, RNB PTR will not be defined at this point.
;
; Display a message to the user indicating if the reject code is new, and being added,
; or existing, and being edited.
;
S ADD=0
I '$D(^BPSACR("B",REJIEN)) D
. W !!,"You are entering a new Auto Close Claim Reject Code - "_REJEXT,!
. S ADD=1
. ;
. ; Create a new entry in file 90023123.94, setting the External Reject Code
. ; entered by the user, and default the dollar threshold to 0.
. ;
. S BPSFDA(9002313.94,"+1,",.01)=REJIEN
. S BPSFDA(9002313.94,"+1,",.03)=100
. D UPDATE^DIE(,"BPSFDA")
E W !!,"You are editing an existing Auto Close Claim Reject Code - "_REJEXT,!
;
EC2 ;
;
; EC2 is reentry point if a specific reject code does not have all required
; values set.
;
; Edit REJECT CODE (#.01), RNB (#.02), and THRESHOLD (#.03)
;
S IEN=$O(^BPSACR("B",REJIEN,""))
S DA=IEN
S DIE=9002313.94
S DR=".01Auto Close Claim Reject Code"
S DR=DR_";.02Claims Tracking Non-Billable Reason"
S DR=DR_";.03Dollar Threshold"
;
; Check if selected reject code is currently being edited by another user.
; If so, display a message to the user. User will be returned to initial
; prompt to select another Auto Close Claim Reject Code.
;
L +^BPSACR(IEN):0 I $T D ^DIE L -^BPSACR(IEN)
I '$T D Q
. W !?5,"*** Another user is editing this entry. ***"
. S VALMBCK="R"
. D WAIT^VALM1
. D INIT
;
; All entries must include AUTO CLOSE REJECT CODE (field #.01) and
; RNB PTR (field #.02). DOLLAR THRESHOLD (field #.03) will initially
; default to 0. The system will not allow this field to be deleted.
; At a minimum, the value must be 0. The range is 0-99999.
;
; The following check ensures fields .01 and .02 are defined. If not,
; the user will be prompted to input a value for each field.
;
; INCOMPLETE = 0 indicates the entry has both values defined. If
; either value is not defined, INCOMPLETE will be set to 1.
;
; QUIT is used in case user enters ^ to exit. If the reject code
; being edited is complete, and the system detects the user entered ^
; at any of the prompts, the user will be returned to the list view.
; $D(Y) indicates user entered ^ during call to ^DIE.
;
S INCOMPLETE=0,QUIT=0
I $D(Y) D
. I $$GET1^DIQ(9002313.94,IEN,.01)="" S INCOMPLETE=1
. I $$GET1^DIQ(9002313.94,IEN,.02)="" S INCOMPLETE=1
. I INCOMPLETE=0 S QUIT=1
;
I INCOMPLETE=1 S DR=".01///@" D ^DIE
;
; Make sure "C" index is in sync with "B" index.
;
S REJCIEN=""
F S REJCIEN=$O(^BPSACR("C",REJCIEN)) Q:REJCIEN="" D
. S REJCTXT=$O(^BPSACR("C",REJCIEN,""))
. I '$D(^BPSACR("B",REJCTXT)) K ^BPSACR("C",REJCIEN)
;
; Loop through entries and make sure there are no duplicates
S REJIEN=""
F S REJIEN=$O(^BPSACR("B",REJIEN)) Q:REJIEN="" D
. S ACIEN=""
. S CNT=""
. F S ACIEN=$O(^BPSACR("B",REJIEN,ACIEN),-1) Q:ACIEN="" D
. . S CNT=CNT+1
. . I CNT>1 D
. . . S DA=ACIEN
. . . S DIE=9002313.94
. . . S DR=".01///@"
. . . D ^DIE
;
; User entered ^ at one of the prompts and the entry is complete. Return user
; to list view.
;
I QUIT S VALMBCK="R",DUZ(0)=BPSDUZ D INIT Q
;
; At this point, adding/editing of the reject code is complete. Go to entry point
; EC1 to prompt user for another reject code to add or edit without having the
; initial informational message display.
;
G EC1
;
Q
;
EXIT ; Exit Option
;
; Reesatablish scrolling mode and delete the temporary global used by the list
; view before exiting option.
;
D FULL^VALM1
K ^TMP("BPSACR",$J)
S DUZ(0)=BPSDUZ
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSACR 7503 printed Aug 26, 2025@22:06:33 Page 2
BPSACR ;AITC/PD - Auto Close Reject Code Enter/Edit ;11/12/2024
+1 ;;1.0;E CLAIMS MGMT ENGINE;**39**;JUN 2004;Build 14
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;;
+4 ;
EN ; Main entry point for BPS AUTO CLOSE REJECTS
+1 ;
+2 NEW BPSDUZ
+3 ;
+4 ; User must hold BPS SUPERVISOR key to use this option.
+5 ;
+6 IF '$DATA(^XUSEC("BPS SUPERVISOR",DUZ))
Begin DoDot:1
+7 WRITE !,$CHAR(7),"Requires the BPS SUPERVISOR key"
End DoDot:1
QUIT
+8 ;
+9 DO EN^VALM("BPS AUTO CLOSE REJECTS")
+10 ;
+11 QUIT
+12 ;
HDR ; Header
+1 ;
+2 SET VALMHDR(1)=""
+3 SET VALMHDR(2)="Reject Codes - Auto Close Claims"
+4 QUIT
+5 ;
INIT ; Initialize
+1 ;
+2 ; Populate the list view with entries from the BPS AUTO CLOSE REJECT CODES
+3 ; file (#9002313.94). The "C" index of ^BPSACR sorts the reject codes in
+4 ; ascending order by the external value of the reject code. Codes will
+5 ; display in the list view in ascending order.
+6 ;
+7 ; Capture DUZ(0) to ensure it is set correctly upon exiting option.
+8 SET BPSDUZ=DUZ(0)
+9 ; Set DUZ(0)=@ to allow supervisor to perform deletions of file entries.
+10 SET DUZ(0)="@"
+11 ;
+12 NEW ACRIEN,LINE,REJCD,REJCDE,REJIEN,RNB,STR,STR1,THRS
+13 ;
+14 KILL ^TMP("BPSACR",$JOB)
+15 SET VALMCNT=1
+16 ;
+17 SET LINE=0
+18 SET REJCD=""
+19 FOR
SET REJCD=$ORDER(^BPSACR("C",REJCD))
if REJCD=""
QUIT
Begin DoDot:1
+20 SET REJIEN=$ORDER(^BPSACR("C",REJCD,""))
+21 SET ACRIEN=$ORDER(^BPSACR("C",REJCD,REJIEN,""))
+22 SET REJCDE=$$GET1^DIQ(9002313.93,REJIEN,.02)
+23 IF $LENGTH(REJCDE)>61
SET REJCDE=$EXTRACT(REJCDE,1,58)_"..."
+24 SET RNB=$$GET1^DIQ(9002313.94,ACRIEN,.02)
+25 IF $LENGTH(RNB)>63
SET RNB=$EXTRACT(RNB,1,60)_"..."
+26 SET THRS=$$GET1^DIQ(9002313.94,ACRIEN,.03)
+27 SET STR=""
SET STR1=""
+28 SET $EXTRACT(STR,2)=$JUSTIFY(REJCD,4)
+29 SET $EXTRACT(STR,8)=$EXTRACT(REJCDE,1,61)
+30 SET $EXTRACT(STR,71)="$"_$JUSTIFY(THRS,8)
+31 SET $EXTRACT(STR1,12)="RNB: "_$EXTRACT(RNB,1,63)
+32 DO LINE(STR)
+33 DO LINE(STR1)
End DoDot:1
+34 QUIT
+35 ;
LINE(STR) ; Set Line into List View
+1 ;
+2 SET LINE=LINE+1
+3 DO SET^VALM10(LINE,STR)
+4 SET VALMCNT=LINE
+5 QUIT
+6 ;
HELP ; Help code
+1 ;
+2 SET X="?"
DO DISP^XQORM1
WRITE !!
+3 KILL X
+4 ;
+5 QUIT
+6 ;
EC ; EC Action
+1 ;
+2 ; Edit Auto Close Reject
+3 ; Allow user to enter a new Auto Close Reject code or edit an existing.
+4 ; The specific entry will be locked to prevent another user from editing
+5 ; the same code at the same time.
+6 ;
+7 NEW ACIEN,BPSFDA,DA,DAX,DAX1,DIE,DIC,DR,DTOUT,DUOUT,IEN,INCOMPLETE,QUIT,REJCDX,REJCIEN,REJCTXT,REJEXT,REJIEN
+8 ;
+9 DO FULL^VALM1
+10 ;
+11 ; Display informational message to user upon initially executing the action.
+12 ;
+13 WRITE !
+14 WRITE !,"When a pharmacist ignores a reject defined as an auto close reject and the"
+15 WRITE !,"specified parameter criteria is met, the system will automatically close the"
+16 WRITE !,"claim with the specified Claims Tracking Non-Billable Reason."
+17 WRITE !
+18 WRITE !,"The auto close functionality does not apply for claims with coordination "
+19 WRITE !,"of benefits."
+20 WRITE !
+21 WRITE !,"The auto close functionality does not apply for claims with more than one"
+22 WRITE !,"reject code."
+23 ;
EC1 ; Reentry point when entering multiple reject codes
+1 ;
+2 ; EC1 is a reentry point to allow user to enter multiple reject codes without the
+3 ; informational message displaying each time.
+4 ;
+5 ; Initial Auto Close Claim Reject Code prompt. This lookup uses the BPS NCPDP
+6 ; REJECT CODES file (#9002313.93).
+7 ;
+8 WRITE !
+9 NEW DIC
+10 SET DIC="^BPSF(9002313.93,"
+11 SET DIC(0)="AEMNQ"
+12 SET DIC("A")="Auto Close Claim Reject Code: "
+13 SET DIC("S")="I ($P(^(0),U)'=""eC""),($P(^(0),U)'=""eT"")"
+14 DO ^DIC
+15 ;
+16 ; User entered ^ or timed out. Return to list view display.
+17 ;
+18 IF (Y=-1)!$DATA(DUOUT)!$DATA(DTOUT)
SET VALMBCK="R"
SET DUZ(0)=BPSDUZ
DO INIT
QUIT
+19 ;
+20 ; REJIEN = IEN from #9002313.93
+21 ; REJEXT = External value of the reject code
+22 ;
+23 SET REJIEN=$PIECE(Y,"^")
+24 SET REJEXT=$PIECE(Y,"^",2)
+25 ;
+26 KILL X,DIC,Y
+27 ;
+28 ; Using the external value of the reject code, and the "B" index, determine if
+29 ; the reject code exists in the BPS AUTO CLOSE REJECTS file. If the reject code;
+30 ; does not exist, create a new entry in the file and set DOLLAR THRESHOLD to 0.
+31 ; For newly added reject codes, RNB PTR will not be defined at this point.
+32 ;
+33 ; Display a message to the user indicating if the reject code is new, and being added,
+34 ; or existing, and being edited.
+35 ;
+36 SET ADD=0
+37 IF '$DATA(^BPSACR("B",REJIEN))
Begin DoDot:1
+38 WRITE !!,"You are entering a new Auto Close Claim Reject Code - "_REJEXT,!
+39 SET ADD=1
+40 ;
+41 ; Create a new entry in file 90023123.94, setting the External Reject Code
+42 ; entered by the user, and default the dollar threshold to 0.
+43 ;
+44 SET BPSFDA(9002313.94,"+1,",.01)=REJIEN
+45 SET BPSFDA(9002313.94,"+1,",.03)=100
+46 DO UPDATE^DIE(,"BPSFDA")
End DoDot:1
+47 IF '$TEST
WRITE !!,"You are editing an existing Auto Close Claim Reject Code - "_REJEXT,!
+48 ;
EC2 ;
+1 ;
+2 ; EC2 is reentry point if a specific reject code does not have all required
+3 ; values set.
+4 ;
+5 ; Edit REJECT CODE (#.01), RNB (#.02), and THRESHOLD (#.03)
+6 ;
+7 SET IEN=$ORDER(^BPSACR("B",REJIEN,""))
+8 SET DA=IEN
+9 SET DIE=9002313.94
+10 SET DR=".01Auto Close Claim Reject Code"
+11 SET DR=DR_";.02Claims Tracking Non-Billable Reason"
+12 SET DR=DR_";.03Dollar Threshold"
+13 ;
+14 ; Check if selected reject code is currently being edited by another user.
+15 ; If so, display a message to the user. User will be returned to initial
+16 ; prompt to select another Auto Close Claim Reject Code.
+17 ;
+18 LOCK +^BPSACR(IEN):0
IF $TEST
DO ^DIE
LOCK -^BPSACR(IEN)
+19 IF '$TEST
Begin DoDot:1
+20 WRITE !?5,"*** Another user is editing this entry. ***"
+21 SET VALMBCK="R"
+22 DO WAIT^VALM1
+23 DO INIT
End DoDot:1
QUIT
+24 ;
+25 ; All entries must include AUTO CLOSE REJECT CODE (field #.01) and
+26 ; RNB PTR (field #.02). DOLLAR THRESHOLD (field #.03) will initially
+27 ; default to 0. The system will not allow this field to be deleted.
+28 ; At a minimum, the value must be 0. The range is 0-99999.
+29 ;
+30 ; The following check ensures fields .01 and .02 are defined. If not,
+31 ; the user will be prompted to input a value for each field.
+32 ;
+33 ; INCOMPLETE = 0 indicates the entry has both values defined. If
+34 ; either value is not defined, INCOMPLETE will be set to 1.
+35 ;
+36 ; QUIT is used in case user enters ^ to exit. If the reject code
+37 ; being edited is complete, and the system detects the user entered ^
+38 ; at any of the prompts, the user will be returned to the list view.
+39 ; $D(Y) indicates user entered ^ during call to ^DIE.
+40 ;
+41 SET INCOMPLETE=0
SET QUIT=0
+42 IF $DATA(Y)
Begin DoDot:1
+43 IF $$GET1^DIQ(9002313.94,IEN,.01)=""
SET INCOMPLETE=1
+44 IF $$GET1^DIQ(9002313.94,IEN,.02)=""
SET INCOMPLETE=1
+45 IF INCOMPLETE=0
SET QUIT=1
End DoDot:1
+46 ;
+47 IF INCOMPLETE=1
SET DR=".01///@"
DO ^DIE
+48 ;
+49 ; Make sure "C" index is in sync with "B" index.
+50 ;
+51 SET REJCIEN=""
+52 FOR
SET REJCIEN=$ORDER(^BPSACR("C",REJCIEN))
if REJCIEN=""
QUIT
Begin DoDot:1
+53 SET REJCTXT=$ORDER(^BPSACR("C",REJCIEN,""))
+54 IF '$DATA(^BPSACR("B",REJCTXT))
KILL ^BPSACR("C",REJCIEN)
End DoDot:1
+55 ;
+56 ; Loop through entries and make sure there are no duplicates
+57 SET REJIEN=""
+58 FOR
SET REJIEN=$ORDER(^BPSACR("B",REJIEN))
if REJIEN=""
QUIT
Begin DoDot:1
+59 SET ACIEN=""
+60 SET CNT=""
+61 FOR
SET ACIEN=$ORDER(^BPSACR("B",REJIEN,ACIEN),-1)
if ACIEN=""
QUIT
Begin DoDot:2
+62 SET CNT=CNT+1
+63 IF CNT>1
Begin DoDot:3
+64 SET DA=ACIEN
+65 SET DIE=9002313.94
+66 SET DR=".01///@"
+67 DO ^DIE
End DoDot:3
End DoDot:2
End DoDot:1
+68 ;
+69 ; User entered ^ at one of the prompts and the entry is complete. Return user
+70 ; to list view.
+71 ;
+72 IF QUIT
SET VALMBCK="R"
SET DUZ(0)=BPSDUZ
DO INIT
QUIT
+73 ;
+74 ; At this point, adding/editing of the reject code is complete. Go to entry point
+75 ; EC1 to prompt user for another reject code to add or edit without having the
+76 ; initial informational message display.
+77 ;
+78 GOTO EC1
+79 ;
+80 QUIT
+81 ;
EXIT ; Exit Option
+1 ;
+2 ; Reesatablish scrolling mode and delete the temporary global used by the list
+3 ; view before exiting option.
+4 ;
+5 DO FULL^VALM1
+6 KILL ^TMP("BPSACR",$JOB)
+7 SET DUZ(0)=BPSDUZ
+8 ;
+9 QUIT