source: FOIAVistA/tag/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHL4.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 7.0 KB
Line 
1PRCHL4 ;VACO/HNC/VAC - REMOTE PROCEDURE, LIST LOGISTICS DATA FILE 442 ; 4/17/07 3:47pm
2 ;;5.1;IFCAP;**103**;Oct 20, 2000;Build 25
3 ;Per VHA Directive 2004-038, this routine should not be modified
4 ;DBIA# 4345 giving permission to reference Prosthetics data
5 ;hnc - Aug 21, 2006 add item detail to main grid
6 ;VAC - Set limit on 80 po line items
7 ;
8 ;RESULTS passed to broker in ^TMP($J,
9 ;delimited by ^
10 ;piece 1 = .1 date; display 2
11 ;piece 2 = 91 cost; display 5
12 ;piece 3 = 19 agent assigned PO; display 9
13 ;piece 4 = primary 2237; display 15
14 ;piece 5 = 93 liq amount; display 17
15 ;piece 6 = FOB; display 13
16 ;piece 7 = 1.4 Appropriation; display 14
17 ;piece 8 = 2 cost center; display 8
18 ;piece 9 = 5 vendor; display 12
19 ;piece 10 = 15 number of line items on po; display 11
20 ;piece 11 = station, derived from PO Number; display 1
21 ;piece 12 = 6.4 IEN 442; display 18
22 ;piece 13 = .02 method; display 4
23 ;piece 14 = .01 purchase order number; display 3
24 ;piece 15 = .5 Status; display 6
25 ;piece 16 = 1 FCP; display 7
26 ;piece 17 =5.4 Ship To; display 10
27 ;piece 18 =61 purchase card holder; display 16
28 ;piece 19 = Optional Flex Field
29 ;piece 20 = Optional Flex Field
30 ;piece 21 = Optional Flex Field
31EN(RESULT,DATE1,DATE2,FLEXF,FLEX2,FLEX3) ;broker entry point
32 ;
33 K ^TMP($J)
34 I '$D(DATE1)!('$D(DATE2)) G EXIT
35 S DATE=DATE1-1
36 F S DATE=$O(^PRC(442,"AB",DATE)) Q:(DATE="")!($P(DATE,".",1)>DATE2) D
37 .S RMPRB=0
38 .F S RMPRB=$O(^PRC(442,"AB",DATE,RMPRB)) Q:RMPRB="" D
39 ..D DATA
40 S RESULT=$NA(^TMP($J))
41 K DATE,DFN,HDES,LINE,PHCPCS,RMPRB,RMPRFLD,TYPE,PRCHLB
42 Q
43 ;
44DATA ;
45 S PRCHLB=RMPRB
46 I (FLEXF'="")&(FLEXF'="ITM") S RMPRFLD=".1;91;19;.5;2;20;15;.02;.01;7.2;93;1.4;6.4;5.4;1;61;5;.07;"_FLEXF
47 I (FLEXF="")!(FLEXF="ITM") S RMPRFLD=".1;91;19;.5;2;20;15;.02;.01;7.2;93;1.4;6.4;5.4;1;61;5;.07"
48 I (FLEX2'="")&(FLEX2'="ITM") S RMPRFLD=RMPRFLD_";"_FLEX2
49 I (FLEX3'="")&(FLEX3'="ITM") S RMPRFLD=RMPRFLD_";"_FLEX3
50 D GETS^DIQ(442,PRCHLB,RMPRFLD,"","RMXM")
51 ;flat data
52 S $P(^TMP($J,PRCHLB),U,1)=$G(RMXM(442,PRCHLB_",",.1))
53 S $P(^TMP($J,PRCHLB),U,2)=$G(RMXM(442,PRCHLB_",",91))
54 S $P(^TMP($J,PRCHLB),U,3)=$G(RMXM(442,PRCHLB_",",19))
55 S $P(^TMP($J,PRCHLB),U,4)=$G(RMXM(442,PRCHLB_",",.07))
56 S $P(^TMP($J,PRCHLB),U,5)=$G(RMXM(442,PRCHLB_",",93))
57 S $P(^TMP($J,PRCHLB),U,6)=PRCHLB
58 S $P(^TMP($J,PRCHLB),U,7)=$G(RMXM(442,PRCHLB_",",1.4))
59 S $P(^TMP($J,PRCHLB),U,8)=$G(RMXM(442,PRCHLB_",",2))
60 S $P(^TMP($J,PRCHLB),U,9)=$G(RMXM(442,PRCHLB_",",5))
61 S $P(^TMP($J,PRCHLB),U,10)=$G(RMXM(442,PRCHLB_",",15))
62 S $P(^TMP($J,PRCHLB),U,11)=$P($G(RMXM(442,PRCHLB_",",.01)),"-",1)
63 S $P(^TMP($J,PRCHLB),U,12)=$G(RMXM(442,PRCHLB_",",6.4))
64 S $P(^TMP($J,PRCHLB),U,13)=$G(RMXM(442,PRCHLB_",",.02))
65 S $P(^TMP($J,PRCHLB),U,14)=$G(RMXM(442,PRCHLB_",",.01))
66 S $P(^TMP($J,PRCHLB),U,15)=$G(RMXM(442,PRCHLB_",",.5))
67 S $P(^TMP($J,PRCHLB),U,16)=$G(RMXM(442,PRCHLB_",",1))
68 S $P(^TMP($J,PRCHLB),U,17)=$G(RMXM(442,PRCHLB_",",5.4))
69 S $P(^TMP($J,PRCHLB),U,18)=$G(RMXM(442,PRCHLB_",",61))
70 ;
71 I FLEXF'="" S $P(^TMP($J,PRCHLB),U,19)=$G(RMXM(442,PRCHLB_",",FLEXF))
72 I FLEXF="" S $P(^TMP($J,PRCHLB),U,19)=""
73 I FLEX2'="" S $P(^TMP($J,PRCHLB),U,20)=$G(RMXM(442,PRCHLB_",",FLEX2))
74 I FLEX2="" S $P(^TMP($J,PRCHLB),U,20)=""
75 I FLEX3'="" S $P(^TMP($J,PRCHLB),U,21)=$G(RMXM(442,PRCHLB_",",FLEX3))
76 I FLEX3="" S $P(^TMP($J,PRCHLB),U,21)=""
77 ;
78 I (FLEXF="ITM")!(FLEX2="ITM")!(FLEX3="ITM") D ITMDET
79 K RMXM,PRCHLB
80 Q
81ITMDET ;item detail
82 I PRCHLB="" Q
83 S CNT=0
84 ;First check number of line items on PO, stop if more than 80
85 I $P(^TMP($J,PRCHLB),U,10)>80 S $P(^TMP($J,PRCHLB,1),U,10)="<** More than 80 Line Items **>" Q
86 D GETS^DIQ(442,PRCHLB,"40*;.01","EN","ITM")
87 S PRCHPO=$G(ITM("442",PRCHLB_",",".01","E"))
88 S PRCHIEN=""
89 I PRCHPO'="" S PRCHIEN=$O(^RMPR(664,"G",$P(PRCHPO,"-",2),PRCHIEN))
90 I PRCHIEN'="" D GETS^DIQ(664,PRCHIEN,"2*;11;12","EN","PITMSTR")
91 I $D(PITMSTR) D
92 .;Prosthetic item
93 .S PRCHB="" F S PRCHB=$O(PITMSTR(664.02,PRCHB)) Q:'PRCHB D
94 . .S QTY=$G(PITMSTR(664.02,PRCHB,3,"E"))
95 . .S UOP=$G(PITMSTR(664.02,PRCHB,4,"E"))
96 . .S CBOA=$G(PITMSTR(664.02,PRCHB,13,"E"))
97 . .S ITMD=$G(PITMSTR(664.02,PRCHB,1,"E"))
98 . .S AUC=$G(PITMSTR(664.02,PRCHB,6,"E"))
99 . .I AUC="" S AUC=$G(PITMSTR(664.02,PRCHB,2,"E"))
100 . .S HCPCS=$G(PITMSTR(664.02,PRCHB,16,"E"))
101 . .S VSN=$G(PITMSTR(664.02,PRCHB,15.4,"E"))
102 . .S TCST=QTY*AUC
103 . .S CNT=CNT+1
104 . .S $P(^TMP($J,PRCHLB,CNT),U,1)=$G(RMXM(442,PRCHLB_",",.1))
105 . .S $P(^TMP($J,PRCHLB,CNT),U,2)=TCST
106 . .S $P(^TMP($J,PRCHLB,CNT),U,8)=CBOA
107 . .S $P(^TMP($J,PRCHLB,CNT),U,7)=VSN
108 . .S $P(^TMP($J,PRCHLB,CNT),U,11)=$P($G(RMXM(442,PRCHLB_",",.01)),"-",1)
109 . .I HCPCS'="" S $P(^TMP($J,PRCHLB,CNT),U,13)="HCPCS: "_HCPCS
110 . .S $P(^TMP($J,PRCHLB,CNT),U,14)=$G(RMXM(442,PRCHLB_",",.01))_"-P "_CNT
111 . .I FLEXF="ITM" S $P(^TMP($J,PRCHLB,CNT),U,19)=$TR(ITMD,","," ")
112 . .I FLEX2="ITM" S $P(^TMP($J,PRCHLB,CNT),U,20)=$TR(ITMD,","," ")
113 . .I FLEX3="ITM" S $P(^TMP($J,PRCHLB,CNT),U,21)=$TR(ITMD,","," ")
114 .;prosthetic shipping
115 . S SHIP="",SHIPF=""
116 . S SHIP=$G(PITMSTR(664,PRCHIEN_",",11,"E"))
117 . S SHIPF=$G(PITMSTR(664,PRCHIEN_",",12,"E"))
118 . I SHIPF'="" S SHIP=SHIPF
119 . I SHIP'="" D
120 . .S CNT=CNT+1
121 . .S $P(^TMP($J,PRCHLB,CNT),U,2)=SHIP
122 . .S $P(^TMP($J,PRCHLB,CNT),U,1)=$G(RMXM(442,PRCHLB_",",.1))
123 . .S $P(^TMP($J,PRCHLB,CNT),U,11)=$P($G(RMXM(442,PRCHLB_",",.01)),"-",1)
124 . .S $P(^TMP($J,PRCHLB,CNT),U,14)=$G(RMXM(442,PRCHLB_",",.01))_"-P "_CNT
125 . .I FLEXF="ITM" S $P(^TMP($J,PRCHLB,CNT),U,19)="Shipping"
126 . .I FLEX2="ITM" S $P(^TMP($J,PRCHLB,CNT),U,20)="Shipping"
127 . .I FLEX3="ITM" S $P(^TMP($J,PRCHLB,CNT),U,21)="Shipping"
128 .;IFCAP item
129 S B="" F S B=$O(ITM(442.01,B)) Q:'B D
130 . S IFITM=$G(ITM(442.01,B,1.5,"E"))
131 . D GETS^DIQ(441,IFITM,".01;.05;51","E","ITMSTR")
132 . S ITMD=$G(ITMSTR(441,IFITM_",",.05,"E"))
133 . S IFITM1=$G(ITMSTR(441,IFITM_",",.01,"E"))
134 . S NIF=$G(ITMSTR(441,IFITM_",",51,"E"))
135 . S LICNT=$P(B,",",1)
136 . S QTY=$G(ITM(442.01,B,2,"E"))
137 . S UOP=$G(ITM(442.01,B,3,"E"))
138 . S BOC=$G(ITM(442.01,B,3.5,"E"))
139 . S CBOA=$G(ITM(442.01,B,4,"E"))
140 . S AUC=$TR($G(ITM(442.01,B,5,"E")),"$","")
141 . S FSC=$G(ITM(442.01,B,8,"E"))
142 . S VSN=$G(ITM(442.01,B,9,"E"))
143 . S UCF=$G(ITM(442.01,B,9.7,"E"))
144 . S TCST=$G(ITM(442.01,B,15,"E"))
145 . S ITMDD=$G(ITM(442.01,B,1,1))
146 . I ITMD'="" S ITMD=ITMD_" "
147 . S ITMD=ITMD_"1st Line: "_ITMDD
148 . K ITMDD
149 . S CNT=CNT+1
150 . ;S ^TMP($J,PRCHLB,CNT)="I "_LICNT_U_IFITM1_U_QTY_U_UOP_U_BOC_U_CBOA_U_AUC_U_FSC_U_VSN_U_UCF_U_TCST_U_NIF_U_ITMD
151 .S $P(^TMP($J,PRCHLB,CNT),U,2)=TCST
152 .I FLEXF="ITM" S $P(^TMP($J,PRCHLB,CNT),U,19)=$TR(ITMD,","," ")
153 .I FLEX2="ITM" S $P(^TMP($J,PRCHLB,CNT),U,20)=$TR(ITMD,","," ")
154 .I FLEX3="ITM" S $P(^TMP($J,PRCHLB,CNT),U,21)=$TR(ITMD,","," ")
155 .S $P(^TMP($J,PRCHLB,CNT),U,1)=$G(RMXM(442,PRCHLB_",",.1))
156 .S $P(^TMP($J,PRCHLB,CNT),U,8)=BOC
157 .S $P(^TMP($J,PRCHLB,CNT),U,9)=VSN
158 .S $P(^TMP($J,PRCHLB,CNT),U,11)=$P($G(RMXM(442,PRCHLB_",",.01)),"-",1)
159 .I NIF'="" S IFITM1=IFITM1_" NIF: "_NIF
160 .I IFITM1'="" S $P(^TMP($J,PRCHLB,CNT),U,13)="Item Master: "_IFITM1
161 .S $P(^TMP($J,PRCHLB,CNT),U,14)=$G(RMXM(442,PRCHLB_",",.01))_"-I "_LICNT
162 K PRCHLB,CNT,ITM,ITMSTR,IFITM,ITMD,IFITM1,LICNT,QTY,UOP,BOC,CBOA,AUC,FSC,VSN,UCF,TCST,NIF,B,PRCHPO,PITMSTR,PRCHB,PRCHIEN,HCPCS,SHIP,SHIPF
163 Q
164EXIT ;
165 Q
166 ;END
Note: See TracBrowser for help on using the repository browser.