[613] | 1 | BPSOSIZ ;BHAM ISC/FCS/DRS/DLF - Filing BPS Transaction ;06/01/2004
|
---|
| 2 | ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45
|
---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified.
|
---|
| 4 | ;
|
---|
| 5 | Q
|
---|
| 6 | ;
|
---|
| 7 | ; EN - Create and/or update BPS Transaction
|
---|
| 8 | ; Input
|
---|
| 9 | ; IEN59 - BPS Transaction number
|
---|
| 10 | ; MOREDATA - Array of data created by BPSNCPD*
|
---|
| 11 | EN(IEN59,MOREDATA) ;EP - BPSOSRB
|
---|
| 12 | ;
|
---|
| 13 | ; Initialize variables
|
---|
| 14 | N RX,RXR,EXISTS,ERROR,X
|
---|
| 15 | S ERROR=0,RX=$P(IEN59,"."),RXR=+$E($P(IEN59,".",2),1,4)
|
---|
| 16 | ;
|
---|
| 17 | ;
|
---|
| 18 | D LOG^BPSOSL(IEN59,$T(+0)_"-Building Transaction")
|
---|
| 19 | ;
|
---|
| 20 | ; Lock the transaction
|
---|
| 21 | I '$$LOCK59(IEN59) D ERROR(IEN59,"Could not lock the transaction") Q
|
---|
| 22 | ;
|
---|
| 23 | ; Check for claims that should not be resubmitted
|
---|
| 24 | S X=$$RXPAID^BPSOSIY(IEN59)
|
---|
| 25 | I X D ERROR(IEN59,"RXPAID^BPSOSIY returned "_X) Q
|
---|
| 26 | ;
|
---|
| 27 | ; Make sure that the record is not already IN PROGRESS
|
---|
| 28 | S X=+$$STATUS59^BPSOSRX(IEN59)
|
---|
| 29 | I X'=0,X'=99 D ERROR(IEN59,"STATUS is "_X) Q
|
---|
| 30 | ;
|
---|
| 31 | ; Check if the BPS Transaction exists
|
---|
| 32 | S EXISTS=$$EXIST59(IEN59)
|
---|
| 33 | ;
|
---|
| 34 | ; If the record exists, delete all but the essential fields
|
---|
| 35 | I EXISTS D CLEAR59(IEN59)
|
---|
| 36 | ;
|
---|
| 37 | ; If the record does not exist, create new record and validate the IEN
|
---|
| 38 | I 'EXISTS S X=$$NEW59(IEN59) I X'=IEN59 D ERROR(IEN59,"NEW59 returned "_X) Q
|
---|
| 39 | ;
|
---|
| 40 | ; Update the fields. If error is returned, log to the BPS Transaction, which
|
---|
| 41 | ; we know exists at this point
|
---|
| 42 | S ERROR=$$INIT^BPSOSIY(IEN59)
|
---|
| 43 | I ERROR D ERROR^BPSOSU($T(+0),IEN59,ERROR,"BPS Transaction not updated"),UNLOCK59(IEN59) Q
|
---|
| 44 | ;
|
---|
| 45 | ; Validate the transaction
|
---|
| 46 | D ONE59^BPSOSQA(IEN59)
|
---|
| 47 | ;
|
---|
| 48 | ; Unlock the transaction
|
---|
| 49 | D UNLOCK59(IEN59)
|
---|
| 50 | Q
|
---|
| 51 | ;
|
---|
| 52 | ; LOCK59 - Lock Transaction
|
---|
| 53 | LOCK59(IEN59) ;
|
---|
| 54 | L +^BPST(IEN59):5
|
---|
| 55 | Q $T
|
---|
| 56 | ;
|
---|
| 57 | ; UNLOCK59 - Unlock record
|
---|
| 58 | UNLOCK59(IEN59) ;
|
---|
| 59 | L -^BPST(IEN59)
|
---|
| 60 | Q
|
---|
| 61 | ;
|
---|
| 62 | ; EXISTS - See if the BPS Transaction already exists
|
---|
| 63 | EXIST59(IEN59) ;
|
---|
| 64 | N X
|
---|
| 65 | S X=$$FIND1^DIC(9002313.59,,"QX","`"_IEN59)
|
---|
| 66 | Q $S(X>0:X,X=0:0)
|
---|
| 67 | ;
|
---|
| 68 | ; NEW59 - Create a new BPS Transaction record
|
---|
| 69 | NEW59(IEN59) ;
|
---|
| 70 | ; Initialize variables
|
---|
| 71 | N FDA,IEN,MSG,FN
|
---|
| 72 | ;
|
---|
| 73 | ; The .01 node and IEN should be the transaction number
|
---|
| 74 | S FN=9002313.59
|
---|
| 75 | S (IEN(1),FDA(FN,"+1,",.01))=IEN59
|
---|
| 76 | ;
|
---|
| 77 | ; Create the new BPS Transaction record
|
---|
| 78 | D UPDATE^DIE("","FDA","IEN","MSG")
|
---|
| 79 | I $D(MSG) Q 0
|
---|
| 80 | Q IEN(1)
|
---|
| 81 | ;
|
---|
| 82 | ; CLEAR59 - If it exists, clear out the old values
|
---|
| 83 | CLEAR59(IEN59) ;
|
---|
| 84 | ; Deletes all values except for fields:
|
---|
| 85 | ; Entry # (.01)
|
---|
| 86 | ; Resubmit after reversal (1.12)
|
---|
| 87 | ; Result Text (202)
|
---|
| 88 | ; Comments (111 multiple)
|
---|
| 89 | ; If reverse/resubmit, then also do not clear fields:
|
---|
| 90 | ; Status (1)
|
---|
| 91 | ; Submit Date/Time (6)
|
---|
| 92 | ; Last Update (7)
|
---|
| 93 | ; Start Date (15)
|
---|
| 94 | ;
|
---|
| 95 | ; Initialize variables
|
---|
| 96 | N FN,FDA,MSG,FIELD,SKIP,ENTRY
|
---|
| 97 | S FN=9002313.59
|
---|
| 98 | ;
|
---|
| 99 | ; Set up fields that we do not want to delete
|
---|
| 100 | S SKIP(1.12)="",SKIP(202)=""
|
---|
| 101 | I $G(MOREDATA("REVERSE THEN RESUBMIT"))=1 S SKIP(1)="",SKIP(6)="",SKIP(7)="",SKIP(15)=""
|
---|
| 102 | ;
|
---|
| 103 | ; Start with field .01 so it will not be deleted
|
---|
| 104 | ; Place 'non-skip' fields in FDA to be deleted
|
---|
| 105 | S FIELD=.01
|
---|
| 106 | F S FIELD=$O(^DD(FN,FIELD)) Q:'FIELD I '$D(SKIP(FIELD)) S FDA(FN,IEN59_",",FIELD)=""
|
---|
| 107 | ;
|
---|
| 108 | ; Delete Insurance multiple
|
---|
| 109 | S FN=9002313.59902,ENTRY=0
|
---|
| 110 | F S ENTRY=$O(^BPST(IEN59,10,ENTRY)) Q:ENTRY="B"!(ENTRY="") D
|
---|
| 111 | . S FDA(FN,ENTRY_","_IEN59_",",.01)=""
|
---|
| 112 | ;
|
---|
| 113 | ; Delete DUR multiple
|
---|
| 114 | S FN=9002313.5913,ENTRY=0
|
---|
| 115 | F S ENTRY=$O(^BPST(IEN59,13,ENTRY)) Q:+ENTRY=0 D
|
---|
| 116 | . S FDA(FN,ENTRY_","_IEN59_",",.01)=""
|
---|
| 117 | ;
|
---|
| 118 | ; Fileman call to do the delete
|
---|
| 119 | D FILE^DIE("","FDA","MSG")
|
---|
| 120 | ;
|
---|
| 121 | ; Update Result Text File with 'PREVIOUSLY['
|
---|
| 122 | D PREVISLY(IEN59) ; for result text field 202
|
---|
| 123 | Q
|
---|
| 124 | ;
|
---|
| 125 | ; PREVISLY - Add semicolon in between the result text
|
---|
| 126 | PREVISLY(IEN59) ;EP - BPSOSRB, BPSOSU
|
---|
| 127 | N X
|
---|
| 128 | S X=$$GET1^DIQ(9002313.59,IEN59,202)
|
---|
| 129 | I X="" Q
|
---|
| 130 | S X=$E(";"_X,1,200)
|
---|
| 131 | N FN,FDA,MSG
|
---|
| 132 | S FDA(9002313.59,IEN59_",",202)=X
|
---|
| 133 | D FILE^DIE("","FDA","MSG")
|
---|
| 134 | Q
|
---|
| 135 | ;
|
---|
| 136 | ; ERROR - Log an error to the log
|
---|
| 137 | ERROR(IEN59,MSG) ;
|
---|
| 138 | N RX,RXR
|
---|
| 139 | S RX=$P(IEN59,"."),RXR=+$E($P(IEN59,".",2),1,4)
|
---|
| 140 | D LOG^BPSOSL(IEN59,$T(+0)_"-Skipping: "_$G(MSG))
|
---|
| 141 | K ^XTMP("BPSOSRX",RX,RXR)
|
---|
| 142 | D UNLOCK59(IEN59)
|
---|
| 143 | Q
|
---|