BPSRPC03 ;AITC/PD - ECME TAS RPC - Write Back;02/08/2019
;;1.0;E CLAIMS MGMT ENGINE;**27,34**;JUN 2004;Build 11
;;Per VA Directive 6402, this routine should not be modified.
;
Q
;
PUT(RESULT,ARGS) ; RPC: BPS TAS CLAIM WRITE BACK
; Update BPSTL entry successfully written to TAS
;
; Required Input: BPS57 - IEN for BPS LOG OF TRANSACTIONS FILE (#9002313.57)
; BPS57 = ARGS("IEN")
;
; Once a transaction has successfully be written to the TAS database,
; the record id is returned to VistA to update the MCCF EDI TAS PROGRESS
; field in BPS LOG OF TRANSACTIONS file.
;
; MCCF EDI TAS PROGRESS Values:
; '1' FOR READY TO SEND
; '2' FOR SENT
; '3' FOR WRITTEN
;
N BPS57,BPSFLAG,BPSPC,BPSRES,BPSVALUE
K RESULT
;
; BPSRES indicates if the Write Back is successful or not.
; 0=Unsuccessful 1=Successful
S BPSRES=0
S BPS57=ARGS("IEN")
;
; If no Txn IEN was passed in or a Txn IEN that doesn't
; exist in the ^BPSTL file, exit RPC with the RESULT
; JSON indicating Unsuccessful
I BPS57="" G RESULT
I '$D(^BPSTL(BPS57)) G RESULT
;
; --------------------------------------------------------
;
; Initialize fields
;
; CLAIM - Field 3 - Pointer to BPS CLAIMS FILE #9002313.02
S BPSPC=$$GET1^DIQ(9002313.57,BPS57,3,"I")
;
; MCCF EDI TAS PROGRESS - Field 20
S BPSFLAG=$$GET1^DIQ(9002313.57,BPS57,20,"I")
;
; --------------------------------------------------------
;
; The only Txn IENs that should be receiving a write back
; are ones that previously had the MCCF EDI TAS PROGRESS
; flag set with the value 2, meaning "SENT".
I BPSFLAG'=2 G RESULT
;
; --------------------------------------------------------
;
; Update MCCF EDI TAS PROGRESS flag to 3, indicating the record
; was successfully transmitted to TAS.
;
N BPSA,BPSFN,BPSREC
S BPSFN=9002313.57
S BPSREC=BPS57_","
S BPSA(BPSFN,BPSREC,20)=3
D FILE^DIE("","BPSA","")
;
S BPSRES=1
;
RESULT ; setup JSON result
;
S RESULT(1)="[{"_"""ien"""_":"_BPS57_","_"""status"""_":"_BPSRES_"}]"
;
; On rare occasions, the MCCF EDI TAS PROGRESS index gets an extra entry.
; e.g.:
; ^BPSTL("C",1,IEN)=""
; ^BPSTL("C",3,IEN)=""
;
; When this happens, TAS attempts to transmit the transaction over and over.
; The following code checks if the IEN is in the 3 index and also in the 1 or 2 index.
; If so, the MCCF EDI TAS PROGRESS field is reset to 1. This forces the
; transaction to be succesfully transmitted, allowing the index issue to be resolved.
;
I $D(^BPSTL("C",3,BPS57))&(($D(^BPSTL("C",1,BPS57))!($D(^BPSTL("C",2,BPS57))))) D
. N BPSA,BPSFN,BPSREC
. S BPSFN=9002313.57
. S BPSREC=BPS57_","
. S BPSA(BPSFN,BPSREC,20)=1
. D FILE^DIE("","BPSA","")
;
Q
;
; ========================================================
;
CLOSE(BPS02) ; Entry point when a claim is closed
;
; Changes to BPS Claims File (9002313.02) field 901 (CLOSED)
; will trigger this code to execute. This code will loop
; through associated BPS LOG OF TRANSACTIONS entries and
; update field 20 (MCCF EDI TAS PROGRESS). Field 20 only
; needs to be updated if the transaction was previously
; successfully transmitted to TAS. This is indicated by
; a value of 3.
;
I BPS02="" Q
;
; Get IEN for associated BPS TRANSACTION file (#9002313.59)
S BPS59=$$GET1^DIQ(9002313.02,BPS02,.08,"I")
I BPS59="" Q
;
; Loop through BPS LOG OF TRANSACTIONS file (#9002313.57)
; using the IEN from #9002313.59.
S BPS57=0
F S BPS57=$O(^BPSTL("B",BPS59,BPS57)) Q:'BPS57 D
. S BPSFLAG=$$GET1^DIQ(9002313.57,BPS57,20,"I")
. ;
. ; QUIT if MCCF EDI TAS PROGRESS field does not exist
. I BPSFLAG="" Q
. ;
. ; QUIT if MCCF EDI TAS PROGRESS field is not 3.
. I BPSFLAG'=3 Q
. ;
. ; Setting field 20 to 1 will place the IEN back in the
. ; queue to be transmitted to TAS again.
. N BPSA,BPSFN,BPSREC
. S BPSFN=9002313.57
. S BPSREC=BPS57_","
. S BPSA(BPSFN,BPSREC,20)=1
. D FILE^DIE("","BPSA","")
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSRPC03 4043 printed Nov 22, 2024@17:02:48 Page 2
BPSRPC03 ;AITC/PD - ECME TAS RPC - Write Back;02/08/2019
+1 ;;1.0;E CLAIMS MGMT ENGINE;**27,34**;JUN 2004;Build 11
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
PUT(RESULT,ARGS) ; RPC: BPS TAS CLAIM WRITE BACK
+1 ; Update BPSTL entry successfully written to TAS
+2 ;
+3 ; Required Input: BPS57 - IEN for BPS LOG OF TRANSACTIONS FILE (#9002313.57)
+4 ; BPS57 = ARGS("IEN")
+5 ;
+6 ; Once a transaction has successfully be written to the TAS database,
+7 ; the record id is returned to VistA to update the MCCF EDI TAS PROGRESS
+8 ; field in BPS LOG OF TRANSACTIONS file.
+9 ;
+10 ; MCCF EDI TAS PROGRESS Values:
+11 ; '1' FOR READY TO SEND
+12 ; '2' FOR SENT
+13 ; '3' FOR WRITTEN
+14 ;
+15 NEW BPS57,BPSFLAG,BPSPC,BPSRES,BPSVALUE
+16 KILL RESULT
+17 ;
+18 ; BPSRES indicates if the Write Back is successful or not.
+19 ; 0=Unsuccessful 1=Successful
+20 SET BPSRES=0
+21 SET BPS57=ARGS("IEN")
+22 ;
+23 ; If no Txn IEN was passed in or a Txn IEN that doesn't
+24 ; exist in the ^BPSTL file, exit RPC with the RESULT
+25 ; JSON indicating Unsuccessful
+26 IF BPS57=""
GOTO RESULT
+27 IF '$DATA(^BPSTL(BPS57))
GOTO RESULT
+28 ;
+29 ; --------------------------------------------------------
+30 ;
+31 ; Initialize fields
+32 ;
+33 ; CLAIM - Field 3 - Pointer to BPS CLAIMS FILE #9002313.02
+34 SET BPSPC=$$GET1^DIQ(9002313.57,BPS57,3,"I")
+35 ;
+36 ; MCCF EDI TAS PROGRESS - Field 20
+37 SET BPSFLAG=$$GET1^DIQ(9002313.57,BPS57,20,"I")
+38 ;
+39 ; --------------------------------------------------------
+40 ;
+41 ; The only Txn IENs that should be receiving a write back
+42 ; are ones that previously had the MCCF EDI TAS PROGRESS
+43 ; flag set with the value 2, meaning "SENT".
+44 IF BPSFLAG'=2
GOTO RESULT
+45 ;
+46 ; --------------------------------------------------------
+47 ;
+48 ; Update MCCF EDI TAS PROGRESS flag to 3, indicating the record
+49 ; was successfully transmitted to TAS.
+50 ;
+51 NEW BPSA,BPSFN,BPSREC
+52 SET BPSFN=9002313.57
+53 SET BPSREC=BPS57_","
+54 SET BPSA(BPSFN,BPSREC,20)=3
+55 DO FILE^DIE("","BPSA","")
+56 ;
+57 SET BPSRES=1
+58 ;
RESULT ; setup JSON result
+1 ;
+2 SET RESULT(1)="[{"_"""ien"""_":"_BPS57_","_"""status"""_":"_BPSRES_"}]"
+3 ;
+4 ; On rare occasions, the MCCF EDI TAS PROGRESS index gets an extra entry.
+5 ; e.g.:
+6 ; ^BPSTL("C",1,IEN)=""
+7 ; ^BPSTL("C",3,IEN)=""
+8 ;
+9 ; When this happens, TAS attempts to transmit the transaction over and over.
+10 ; The following code checks if the IEN is in the 3 index and also in the 1 or 2 index.
+11 ; If so, the MCCF EDI TAS PROGRESS field is reset to 1. This forces the
+12 ; transaction to be succesfully transmitted, allowing the index issue to be resolved.
+13 ;
+14 IF $DATA(^BPSTL("C",3,BPS57))&(($DATA(^BPSTL("C",1,BPS57))!($DATA(^BPSTL("C",2,BPS57)))))
Begin DoDot:1
+15 NEW BPSA,BPSFN,BPSREC
+16 SET BPSFN=9002313.57
+17 SET BPSREC=BPS57_","
+18 SET BPSA(BPSFN,BPSREC,20)=1
+19 DO FILE^DIE("","BPSA","")
End DoDot:1
+20 ;
+21 QUIT
+22 ;
+23 ; ========================================================
+24 ;
CLOSE(BPS02) ; Entry point when a claim is closed
+1 ;
+2 ; Changes to BPS Claims File (9002313.02) field 901 (CLOSED)
+3 ; will trigger this code to execute. This code will loop
+4 ; through associated BPS LOG OF TRANSACTIONS entries and
+5 ; update field 20 (MCCF EDI TAS PROGRESS). Field 20 only
+6 ; needs to be updated if the transaction was previously
+7 ; successfully transmitted to TAS. This is indicated by
+8 ; a value of 3.
+9 ;
+10 IF BPS02=""
QUIT
+11 ;
+12 ; Get IEN for associated BPS TRANSACTION file (#9002313.59)
+13 SET BPS59=$$GET1^DIQ(9002313.02,BPS02,.08,"I")
+14 IF BPS59=""
QUIT
+15 ;
+16 ; Loop through BPS LOG OF TRANSACTIONS file (#9002313.57)
+17 ; using the IEN from #9002313.59.
+18 SET BPS57=0
+19 FOR
SET BPS57=$ORDER(^BPSTL("B",BPS59,BPS57))
if 'BPS57
QUIT
Begin DoDot:1
+20 SET BPSFLAG=$$GET1^DIQ(9002313.57,BPS57,20,"I")
+21 ;
+22 ; QUIT if MCCF EDI TAS PROGRESS field does not exist
+23 IF BPSFLAG=""
QUIT
+24 ;
+25 ; QUIT if MCCF EDI TAS PROGRESS field is not 3.
+26 IF BPSFLAG'=3
QUIT
+27 ;
+28 ; Setting field 20 to 1 will place the IEN back in the
+29 ; queue to be transmitted to TAS again.
+30 NEW BPSA,BPSFN,BPSREC
+31 SET BPSFN=9002313.57
+32 SET BPSREC=BPS57_","
+33 SET BPSA(BPSFN,BPSREC,20)=1
+34 DO FILE^DIE("","BPSA","")
End DoDot:1
+35 ;
+36 QUIT