source: WorldVistAEHR/trunk/r/FEE_BASIS-FB/FBAAUTL7.m@ 642

Last change on this file since 642 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1FBAAUTL7 ;AISC/CMR,dmk,WCIOFO/SAB-UTILITY ROUTINE ;5/27/1999
2 ;;3.5;FEE BASIS;**4**;JAN 30, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5SCPT ;set "AE" x-ref when SERVICE PROVIDED field is added or modified
6 ; called by .01 field of SERVICE PROVIDED multiple in file 162
7 ; input
8 ; X = new value of SERVICE PROVIDED (internal)
9 ; DA = IEN of entry in SERVICE PROVIDED multiple
10 ; DA(1) = IEN of entry in INITIAL TREATMENT DATE multiple
11 ; DA(2) = IEN of entry in VENDOR multiple
12 ; DA(3) = IEN of PATIENT in file #162
13 ;
14 Q:'$G(X)
15 N FBAADT,Y
16 ; obtain current value of INITIAL TREATMENT DATE field from global
17 S FBAADT=$P(^FBAAC(DA(3),1,DA(2),1,DA(1),0),U)
18 ; build sorted list of CPT modifers from the CPT MODIFIER multiple
19 S Y=$$MODL^FBAAUTL4("^FBAAC("_DA(3)_",1,"_DA(2)_",1,"_DA(1)_",1,"_DA_",""M"")")
20 ; set node in "AE" x-ref
21 S ^FBAAC("AE",DA(3),DA(2),FBAADT,X_$S(Y]"":"-"_Y,1:""),DA)=""
22 Q
23 ;
24KCPT ;kill "AE" x-ref when SERVICE PROVIDED field is deleted or modified
25 ; called by .01 field of SERVICE PROVIDED multiple in file 162
26 ; input
27 ; X = old value of SERVICE PROVIDED (internal)
28 ; DA = IEN of entry in SERVICE PROVIDED multiple
29 ; DA(1) = IEN of entry in INITIAL TREATMENT DATE multiple
30 ; DA(2) = IEN of entry in VENDOR multiple
31 ; DA(3) = IEN of PATIENT in file #162
32 ;
33 Q:'$G(X)
34 N CPTM,FBAADT,Y
35 ; obtain current value of INITIAL TREATMENT DATE field from global
36 S FBAADT=$P(^FBAAC(DA(3),1,DA(2),1,DA(1),0),U)
37 ; kill all nodes in x-ref for this SERVICE PROVIDED entry (DA)
38 ; Note: Deleting an entry in the SERVICE PROVIDED multiple will
39 ; cause the x-ref kill logic of the CPT MODIFIER sub-multiple to be
40 ; executed for each modifer before any global updates take place.
41 ; Therefore, there can be several nodes to delete by the time the
42 ; SERVICE PROVIDED field kill logic is run since each CPT MODIFIER
43 ; kill logic will have set a node for any remaining modifiers.
44 S CPTM=""
45 F S CPTM=$O(^FBAAC("AE",DA(3),DA(2),FBAADT,CPTM)) Q:CPTM="" D
46 . I $D(^FBAAC("AE",DA(3),DA(2),FBAADT,CPTM,DA)) K ^(DA)
47 Q
48 ;
49SMOD ;set "AE" x-ref when CPT MODIFIER is added or modified
50 ; called by .01 field of CPT MODIFIER multiple in file 162
51 ; input
52 ; X = new value of CPT MODIFIER (internal)
53 ; DA = IEN of entry in CPT MODIFIER multiple
54 ; DA(1) = IEN of entry in SERVICE PROVIDED multiple
55 ; DA(2) = IEN of entry in INITIAL TREATMENT DATE multiple
56 ; DA(3) = IEN of entry in VENDOR multiple
57 ; DA(4) = IEN of PATIENT in file #162
58 ;
59 Q:'$G(X)
60 N FBAADT,FBAACP,FBMODA,Y
61 ; obtain current value of INITIAL TREATMENT DATE field
62 S FBAADT=$P(^FBAAC(DA(4),1,DA(3),1,DA(2),0),U)
63 ; obtain current value of SERVICE PROVIDED field
64 S FBAACP=$P($G(^FBAAC(DA(4),1,DA(3),1,DA(2),1,DA(1),0)),U)
65 ; obtain array of modifiers in global for CPT MODIFIER multiple
66 D MODDATA^FBAAUTL4(DA(4),DA(3),DA(2),DA(1))
67 ;
68 ; when a new/changed modifier is entered, the x-ref that previously
69 ; existed will need to be deleted.
70 ; remove node associated with new/changed modifier from array
71 K FBMODA(DA)
72 ; build sorted list of modifiers without the new/changed modifier
73 S Y=$$MODL^FBAAUTL4("FBMODA")
74 ; kill existing x-ref node (if any) for the service
75 K:$D(^FBAAC("AE",DA(4),DA(3),FBAADT,FBAACP_$S(Y]"":"-"_Y,1:""),DA(1))) ^(DA(1))
76 ;
77 ; now create a node in the x-ref for the new/changed value
78 ; add new/changed modifier to modifier array
79 S FBMODA(DA)=X
80 ; build sorted list of all modifiers
81 S Y=$$MODL^FBAAUTL4("FBMODA")
82 ; set x-ref node
83 S ^FBAAC("AE",DA(4),DA(3),FBAADT,FBAACP_"-"_Y,DA(1))=""
84 Q
85 ;
86KMOD ;kill "AE" x-ref when CPT MODIFIER is deleted or modified
87 ; called by .01 field of CPT MODIFIER multiple in file 162
88 ; input
89 ; X = old value of CPT MODIFIER (internal)
90 ; DA = IEN of entry in CPT MODIFIER multiple
91 ; DA(1) = IEN of entry in SERVICE PROVIDED multiple
92 ; DA(2) = IEN of entry in INITIAL TREATMENT DATE multiple
93 ; DA(3) = IEN of entry in VENDOR multiple
94 ; DA(4) = IEN of PATIENT in file #162
95 ;
96 Q:'$G(X)
97 N FBAADT,FBAACP,FBMODA,Y
98 ; obtain current value of INITIAL TREATMENT DATE field
99 S FBAADT=$P(^FBAAC(DA(4),1,DA(3),1,DA(2),0),U)
100 ; obtain current value of SERVICE PROVIDED field
101 S FBAACP=$P($G(^FBAAC(DA(4),1,DA(3),1,DA(2),1,DA(1),0)),U)
102 ; obtain array of modifiers in global for CPT MODIFIER multiple
103 D MODDATA^FBAAUTL4(DA(4),DA(3),DA(2),DA(1))
104 ;
105 ; if a CPT modifier was deleted or changed then we need to delete
106 ; the x-ref for the old value
107 ; overwrite node in array for the deleted/changed CPT modifier since
108 ; the global may have already been updated
109 S FBMODA(DA)=X
110 ; build sorted list of CPT modifiers
111 S Y=$$MODL^FBAAUTL4("FBMODA")
112 ; kill existing x-ref node
113 K:$D(^FBAAC("AE",DA(4),DA(3),FBAADT,FBAACP_$S(Y]"":"-"_Y,1:""),DA(1))) ^(DA(1))
114 ;
115 ; if a CPT modifier was deleted then we need to set a x-ref node for
116 ; procedure and any remaining modifiers. Note that during a change
117 ; the set logic is run after the kill logic and it will delete the
118 ; x-ref node created here before setting a node for the new value.
119 ; remove deleted/changed modifier from array
120 K FBMODA(DA)
121 ; build sorted list of remaining modifiers
122 S Y=$$MODL^FBAAUTL4("FBMODA")
123 ; set x-ref node
124 S ^FBAAC("AE",DA(4),DA(3),FBAADT,FBAACP_$S(Y]"":"-"_Y,1:""),DA(1))=""
125 Q
126 ;
127 ;FBAAUTL7
Note: See TracBrowser for help on using the repository browser.