source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPI01.m@ 1569

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

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1RMPRPI01 ;HINCIO/ODJ - PIP Report APIs ;9/18/02 15:13
2 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
3 ;
4 Q
5 ;
6 ;***** HBAL - returns a ^TMP array structured as follows:-
7 ; ^TMP($J,N,H,I,D,S,L)=data (^ delimiter)
8 ;
9 ; where N = ^TMP array name (eg. RMPRPI01)
10 ; H = HCPCS code (eg. L5000)
11 ; I = Item number (eg. 1)
12 ; D = full FM date (eg. 3010309.135415)
13 ; S = Source (C - comercial, V - VA)
14 ; L = Location ien (ptr. ^RMPR(661.5,)
15 ;
16 ; data pc 1 = Quantity on hand
17 ; 2 = Value
18 ; 3 = Unit Cost
19 ; 4 = Vendor Desc.
20 ; 5 = HCPCS Item description
21 ; 6 = Location Desc.
22 ; 7 = Re-Order Level
23 ;
24 ; Inputs:
25 ; RMPRNM - Name for ^TMP array
26 ; RMPRSTN - Station number (ptr. ^DIC(4))
27 ; RMPRHCPC - Array of HCPCS codes, or * for all HCPCS.
28 ;
29 ; Outputs:
30 ; RMPRERR - 0 if no errors, +ve int. if errors
31 ; ^TMP - (see above)
32 ;
33HBAL(RMPRNM,RMPRSTN,RMPRHCPC) ;
34 N RMPRERR,RMPRH,RMPR,RMPROLD,RMPREOF,RMPRE,RMPRT,RMPR6E,RMPR11E,RMPR6I
35 N RMPREI,RMPR4
36 S RMPRERR=0
37 I $G(RMPRNM)="" S RMPRNM="RMPRPI01"
38 I $G(RMPRSTN)="" S RMPRERR=1 G HBALX
39 I '$D(RMPRHCPC) S RMPRHCPC="*"
40 K ^TMP($J,RMPRNM)
41 S RMPR("STATION")=RMPRSTN
42 I $G(RMPRHCPC)="*" G HBAL2
43 S RMPRH=""
44HBAL1 S RMPRH=$O(RMPRHCPC(RMPRH))
45 I RMPRH="" G HBALX
46 K RMPR
47 S RMPR("STATION")=RMPRSTN
48 S RMPR("HCPCS")=RMPRH
49HBAL2 S RMPRERR=$$NEXT^RMPRPIXE(.RMPR,"XSHIDS","",1,.RMPROLD,.RMPREOF)
50 I RMPRERR G HBALX
51 I RMPREOF G HBALX
52 I $G(RMPRHCPC)'="*",RMPROLD("HCPCS")'=RMPR("HCPCS") G HBAL1
53 I RMPROLD("STATION")'=RMPR("STATION") G:$G(RMPRHCPC)="*" HBAL2 G HBAL1
54 K RMPRE M RMPRE=RMPR
55 S RMPRERR=$$GET^RMPRPIX7(.RMPRE)
56 I RMPRERR G HBALX
57 K RMPREI S RMPRERR=$$ETOI^RMPRPIX7(.RMPRE,.RMPREI)
58 I RMPRERR G HBALX
59 K RMPR6E
60 S RMPR6E("HCPCS")=RMPR("HCPCS")
61 S RMPR6E("ITEM")=RMPR("ITEM")
62 S RMPR6E("DATE&TIME")=RMPR("DATE&TIME")
63 S RMPRERR=$$GET^RMPRPIX6(.RMPR6E)
64 K RMPR11E
65 S RMPR11E("HCPCS")=RMPR("HCPCS")
66 S RMPR11E("ITEM")=RMPR("ITEM")
67 S RMPR11E("STATION")=RMPR("STATION")
68 S RMPRERR=$$GET^RMPRPIX1(.RMPR11E)
69 I RMPRERR G HBALX
70 K RMPR11I
71 S RMPRERR=$$ETOI^RMPRPIX1(.RMPR11E,.RMPR11I)
72 I RMPRERR G HBALX
73 S RMPRT=""
74 S $P(RMPRT,"^",1)=RMPRE("QUANTITY")
75 S $P(RMPRT,"^",2)=RMPRE("VALUE")
76 I +RMPRE("QUANTITY") D
77 . S $P(RMPRT,"^",3)=$J(RMPRE("VALUE")/RMPRE("QUANTITY"),0,2)
78 . Q
79 S $P(RMPRT,"^",4)=RMPR6E("VENDOR")
80 S $P(RMPRT,"^",5)=RMPR11E("DESCRIPTION")
81 S $P(RMPRT,"^",6)=RMPRE("LOCATION")
82 K RMPR4
83 S RMPR4("IEN")=$O(^RMPR(661.4,"ASLHI",RMPR11I("STATION"),RMPREI("LOCATION"),RMPR11I("HCPCS"),RMPR11I("ITEM"),""))
84 ;next line added
85 G:RMPR4("IEN")="" HBAL2
86 S RMPRERR=$$GET^RMPRPIX4(.RMPR4)
87 S $P(RMPRT,"^",7)=RMPR4("RE-ORDER QTY")
88 S ^TMP($J,RMPRNM,RMPR("HCPCS"),RMPR("ITEM"),RMPR("DATE&TIME"),RMPR11I("SOURCE"),RMPREI("LOCATION"))=RMPRT
89 G HBAL2
90HBALX Q RMPRERR
91 ;
92PROC(RMSUB,RS,RMPRI) ;
93 N RMDAT,RMPRH,RMPR,RMPROLD,RMPREOF,RMPRE,RMPRT,RMPR6E,RMPR11E,RMPR6I
94 N RMST2,RMTY,RM6,RM11,RMIT2,RMII,I,J,K,RMIDES,RMINS,RM11DA
95 I $G(RMPRI)="*" D ALL
96 D HCPC
97 ;
98NOINV ;
99 ;check for other items not currently in the inventory but previously in.
100 S I=""
101 F S I=$O(^RMPR(661.11,"ASHI",RS,I)) Q:I="" F J=0:0 S J=$O(^RMPR(661.11,"ASHI",RS,I,J)) Q:J'>0 D
102 .F K=0:0 S K=$O(^RMPR(661.11,"ASHI",RS,I,J,K)) Q:K'>0 D
103 ..S RM11=$G(^RMPR(661.11,K,0))
104 ..Q:RM11=""
105 ..Q:$D(^TMP($J,"RMTMP",I,J))
106 ..S RMIDES=$P(RM11,U,3)
107 ..Q:($P(RM11,U,9))=1
108 ..;check what location this HCCPS/ITEM belongs to previously.
109 ..F RMII=0:0 S RMII=$O(^RMPR(661.6,"B",I,RMII)) Q:RMII'>0 D
110 ...Q:'$D(^RMPR(661.6,RMII,0))
111 ...S RM6=$G(^RMPR(661.6,RMII,0)),RMIT2=$P(RM6,U,11)
112 ...S RMTY=$P(RM6,U,4),RMST2=$P(RM6,U,13)
113 ...I $G(RMPRI)'="*",'$D(RMPRI(I)) Q
114 ...Q:(RMST2'=RS)!(RMIT2'=J)!(RMTY'=1)
115 ...S ^TMP($J,RMSUB,I,J,1,1)="^^^^"_RMIDES
116 ;EXIT
117 Q
118 ;
119ALL ;process all HCPCS in a station
120 S I=""
121 F S I=$O(^RMPR(661.7,"B",I)) Q:I="" F J=0:0 S J=$O(^RMPR(661.7,"B",I,J)) Q:J'>0 D CRE
122 Q
123HCPC ;process certain HCPCS
124 S I="" F S I=$O(RMPRI(I)) Q:I="" F J=0:0 S J=$O(^RMPR(661.7,"B",I,J)) Q:J'>0 D CRE
125 Q
126 ;
127CRE ;create the tmp global
128 S RMDAT=$G(^RMPR(661.7,J,0))
129 Q:RS'=$P(RMDAT,U,5)
130 S RMUNI=""
131 S RMHC=$P(RMDAT,U,1)
132 S RMDT=$P(RMDAT,U,2)
133 S RMSE=$P(RMDAT,U,3)
134 S RMHI=$P(RMDAT,U,4)
135 S RMST=$P(RMDAT,U,5)
136 S RMLO=$P(RMDAT,U,6)
137 S RMQU=$P(RMDAT,U,7)
138 S RMVA=$P(RMDAT,U,8)
139 S RMUN=$P(RMDAT,U,9)
140 S:$G(RMUN) RMUNI=$$GETUNI^RMPRPIU0(RMUN)
141 S RMUC=RMVA
142 I RMVA,RMQU S RMUC=RMVA/RMQU
143 S RMRO=0
144 S RMSO="**"
145 S (RMVEN,RMLOC,RMIDES)=" "
146 I $G(RMLO),$D(^RMPR(661.5,RMLO,0)) S RMLOC=$P(^RMPR(661.5,RMLO,0),U,1)
147 S RM11=$O(^RMPR(661.11,"ASHI",RS,RMHC,RMHI,0))
148 I $G(RM11),$D(^RMPR(661.11,RM11,0)) S RMSO=$P(^RMPR(661.11,RM11,0),U,5),RMIDES=$P(^RMPR(661.11,RM11,0),U,3)
149 S RM4=$O(^RMPR(661.4,"ASLHI",RS,RMLO,RMHC,RMHI,0))
150 I $G(RM4),$D(^RMPR(661.4,RM4,0)) S RMRO=$P(^RMPR(661.4,RM4,0),U,4)
151 S RMHCIEN=$O(^RMPR(661.1,"B",RMHC,0))
152 I RMHCIEN,$D(^RMPR(661.1,RMHCIEN,0)) S RMHDES=$P(^RMPR(661.1,RMHCIEN,0),U,2)
153 F K=0:0 S K=$O(^RMPR(661.6,"C",RMDT,K)) Q:K'>0 S RM6=$G(^RMPR(661.6,K,0)) D
154 .Q:RMHC'=$P(RM6,U,1)
155 .I (RMHC=$P(RM6,U,1)),(RMSE=$P(RM6,U,3)) S RMV=$P(RM6,U,12)
156 .S:$G(RMV) RMVEN=$$GETVEN^RMPRPIU0(RMV)
157 S RMPRT=RMQU_"^"_RMVA_"^"_RMUC_"^"_RMVEN_"^"_RMIDES_"^"_RMLOC_"^"_RMRO
158 S ^TMP($J,RMSUB,RMHC,RMHI,RMDT,RMLO)=RMPRT_"^"_RMUNI_"^"_RMSO
159 S ^TMP($J,"RMTMP",RMHC,RMHI)=""
160 Q
Note: See TracBrowser for help on using the repository browser.