source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPIX5.m@ 1765

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

initial load of FOIAVistA 6/30/08 version

File size: 5.3 KB
Line 
1RMPRPIX5 ;HINCIO/ODJ- PIP LOCATION FILE 661.5 API ;3/8/01
2 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
3 Q
4 ;
5 ;***** CRE - Create a new 661.5 Stock Location record
6 ;
7 ; Inputs:
8 ; RMPR - an array consisting of...
9 ; RMPR("NAME") - Location name (.01 field)
10 ; RMPR("STATION") - Station ien (fld 2 ptr ^DIC(4,)
11 ; RMPR("ADDRESS") - Location address (fld 3, can be null)
12 ; RMPR("STATUS") - A - Active, I - Inactive (fld 4)
13 ; RMPR("STATUS DATE") - Date (Fileman) of any status change
14 ; (fld 5)
15 ; RMPR("USER") - ien of User creating location
16 ; (fld 6, ptr ^VA(200,)
17 ;
18 ; Outputs:
19 ; RMPR("IEN") - the ien of the created 661.5 record
20 ; RMPRCRE - if non 0 there was an error creating the record
21 ;
22CRE(RMPR) ;
23 N RMPRCRE,RMPRFDA,RMPRIEN,RMPRMSG
24 S RMPRCRE=0
25 S RMPRFDA(661.5,"+1,",.01)=RMPR("NAME")
26 S RMPRFDA(661.5,"+1,",2)=RMPR("STATION")
27 S RMPRFDA(661.5,"+1,",3)=RMPR("ADDRESS")
28 S RMPRFDA(661.5,"+1,",4)=RMPR("STATUS")
29 S RMPRFDA(661.5,"+1,",5)=RMPR("STATUS DATE")
30 S RMPRFDA(661.5,"+1,",6)=RMPR("USER")
31 D UPDATE^DIE("S","RMPRFDA","RMPRIEN","RMPRMSG")
32 I $D(RMPRMSG) S RMPRCRE=1 G CREX
33 S RMPR("IEN")=RMPRIEN(1)
34CREX Q RMPRCRE
35 ;
36 ;***** GET - read in a 661.5 Stock Location record
37 ;
38 ; Inputs:
39 ; must pass either...
40 ;
41 ; RMPR("IEN") - the ien (661.5 ptr) of the desired record
42 ;
43 ; or, if the ien is unknown...
44 ;
45 ; RMPR("STATION") - the Station ien (fld 2, ptr ^DIC(4,)
46 ; RMPR("NAME") - the Location name (.01 field)
47 ;
48 ; Outputs:
49 ; RMPR - an array consisting of (all external values)...
50 ; RMPR("IEN") - 661.5 record's ien if none input
51 ; RMPR("NAME") - Location name (.01 field)
52 ; RMPR("STATION") - Station name (fld 2)
53 ; RMPR("ADDRESS") - Location address (fld 3, can be null)
54 ; RMPR("STATUS") - ACTIVE or INACTIVE (fld 4)
55 ; RMPR("STATUS DATE") - Date of any status change
56 ; (fld 5)
57 ; RMPR("USER") - Name of User creating location
58 ; (fld 6)
59 ;
60 ; RMPRRET - 0 if no errors, else non 0
61 ; 1 - RMPR("IEN") and RMPR("STATION") inputs are null
62 ; 2 - RMPR("IEN") and RMPR("NAME") inputs are null
63 ; 3 - no ien for input RMPR("STATION") and RMPR("NAME")
64 ; 4 - error on the Fileman read
65 ;
66GET(RMPR) ;
67 N RMPRRET,RMPRFME,RMPRIEN,RMPRKEY,RMPRERR,RMPROUP
68 S RMPRRET=0
69 I $G(RMPR("IEN"))="" D
70 . I $G(RMPR("STATION"))="" S RMPRRET=1 Q
71 . I $G(RMPR("NAME"))="" S RMPRRET=2 Q
72 . S RMPR("IEN")=$O(^RMPR(661.5,"XSL",RMPR("STATION"),RMPR("NAME"),""))
73 . I RMPR("IEN")="" S RMPRRET=3 Q
74 . Q
75 I RMPRRET G GETX
76 S RMPRIEN=RMPR("IEN")_","
77 D GETS^DIQ(661.5,RMPRIEN,"*","","RMPROUP","RMPRFME")
78 I $D(RMPRFME) S RMPRRET=4 G GETX
79 S RMPR("USER")=RMPROUP(661.5,RMPRIEN,6)
80 S RMPR("STATION")=RMPROUP(661.5,RMPRIEN,2)
81 S RMPR("ADDRESS")=RMPROUP(661.5,RMPRIEN,3)
82 S RMPR("STATUS")=RMPROUP(661.5,RMPRIEN,4)
83 S RMPR("STATUS DATE")=RMPROUP(661.5,RMPRIEN,5)
84 S RMPR("NAME")=RMPROUP(661.5,RMPRIEN,.01)
85GETX Q RMPRRET
86 ;
87 ;***** UPD - Update existing Stock Location rec (661.5)
88 ; Inputs:
89 ; RMPR5("IEN") - mandatory; the ien of the 661.5 rec. to modify
90 ; see subscripts for CRE above for the other elements that can
91 ; be set in the RMPR5 input array. You should only create these
92 ; elements if they differ in value from an existing rec.
93 ; Use only internal values.
94 ;
95 ; Outputs:
96 ; RMPRERR - 0 - no problems
97 ; 1 - FM returned an error from its update
98 ;
99UPD(RMPR5) ;
100 N RMPRFDA,RMPRFME,RMPRERR,X,Y,DA,RMPRI
101 S RMPRERR=0
102 S RMPRI=RMPR5("IEN")_","
103 S:$D(RMPR5("NAME")) RMPRFDA(661.5,RMPRI,.01)=RMPR5("NAME")
104 S:$D(RMPR5("STATION")) RMPRFDA(661.5,RMPRI,2)=RMPR5("STATION")
105 S:$D(RMPR5("ADDRESS")) RMPRFDA(661.5,RMPRI,3)=RMPR5("ADDRESS")
106 S:$D(RMPR5("STATUS")) RMPRFDA(661.5,RMPRI,4)=RMPR5("STATUS")
107 S:$D(RMPR5("STATUS DATE")) RMPRFDA(661.5,RMPRI,5)=RMPR5("STATUS DATE")
108 S:$D(RMPR5("USER")) RMPRFDA(661.5,RMPRI,6)=RMPR5("USER")
109 D:$D(RMPRFDA) FILE^DIE("","RMPRFDA","RMPRFME")
110 I $D(RMPRFME) S RMPRERR=1
111UPDX Q RMPRERR
112 ;
113 ;***** ISACT - Test if Location active or inactive
114 ;
115 ; Inputs:
116 ; RMPR5("IEN") - mandatory: ien of Location rec.
117 ;
118 ; Outputs:
119 ; RMPRACT - 1 if location active, else 0
120 ;
121ISACT(RMPR5) ;
122 N RMPRFDI,RMPRI,RMPRFME,X,Y,DA,RMPRACT
123 S RMPRACT=0
124 S RMPRI=RMPR5("IEN")_","
125 D GETS^DIQ(661.5,RMPRI,"4","I","RMPRFDI","RMPRFME")
126 I $D(RMPRFME) G ISACTX
127 I RMPRFDI(661.5,RMPRI,4,"I")="A" S RMPRACT=1
128ISACTX Q RMPRACT
129 ;
130 ;***** ETOI - Convert external form of 661.5 rec to internal vals.
131 ;
132 ; Inputs:
133 ; RMPR5("IEN") - mandatory; ien of Location rec.
134 ;
135 ; Outputs:
136 ; RMPR5I - output array whose subscripts defined as for CRE above
137 ; RMPRERR - 0 if no problems, +ve if FM returned an error
138 ;
139ETOI(RMPR5,RMPR5I) ;
140 N RMPRI,RMPRFDI,RMPRFME,RMPRERR,X,Y,DA
141 S RMPRERR=0
142 S RMPRI=RMPR5("IEN")_","
143 D GETS^DIQ(661.5,RMPRI,"*","I","RMPRFDI","RMPRFME")
144 I $D(RMPRFME) S RMPRERR=1 G ETOIX
145 S RMPR5I("IEN")=RMPR5("IEN")
146 S RMPR5I("STATION")=RMPRFDI(661.5,RMPRI,2,"I")
147 S RMPR5I("NAME")=RMPRFDI(661.5,RMPRI,.01,"I")
148 S RMPR5I("ADDRESS")=RMPRFDI(661.5,RMPRI,3,"I")
149 S RMPR5I("STATUS")=RMPRFDI(661.5,RMPRI,4,"I")
150 S RMPR5I("STATUS DATE")=RMPRFDI(661.5,RMPRI,5,"I")
151 S RMPR5I("USER")=RMPRFDI(661.5,RMPRI,6,"I")
152ETOIX Q RMPRERR
Note: See TracBrowser for help on using the repository browser.