source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCST12.m@ 1608

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

initial load of WorldVistAEHR

File size: 8.1 KB
Line 
1PRCST12 ; ;10/27/00
2 D DE G BEGIN
3DE S DIE="^PRCS(410,D0,""IT"",",DIC=DIE,DP=410.02,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^PRCS(410,D0,"IT",DA,""))=""
4 I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(3)=% S %=$P(%Z,U,2) S:%]"" DE(12)=%,DE(19)=% S %=$P(%Z,U,3) S:%]"" DE(20)=% S %=$P(%Z,U,4) S:%]"" DE(10)=%,DE(16)=% S %=$P(%Z,U,5) S:%]"" DE(6)=% S %=$P(%Z,U,6) S:%]"" DE(21)=%
5 I S %=$P(%Z,U,7) S:%]"" DE(22)=%
6 K %Z Q
7 ;
8W W !?DL+DL-2,DLB_": "
9 Q
10O D W W Y W:$X>45 !?9
11 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
12 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W " (No Editing)" Q
13TR R X:DTIME E S (DTOUT,X)=U W $C(7)
14 Q
15A K DQ(DQ) S DQ=DQ+1
16B G @DQ
17RE G PR:$D(DE(DQ)) D W,TR
18N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
19RD G QS:X?."?" I X["^" D D G ^DIE17
20 I X="@" D D G Z^DIE2
21 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
22T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I W:'$D(DB(DQ)) " "_% G V
23 K DDER G X
24P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
25 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
26 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
27V D @("X"_DQ) K YS
28Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
29X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
30 S X="?BAD"
31QS S DZ=X D D,QQ^DIEQ G B
32D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
33Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
34PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
35R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
36 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
37 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
38RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
39I I DV'["I",DV'["#" G RD
40 D E^DIE0 G RD:$D(X),PR
41 Q
42SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
43 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
44 D ^DIR I 'DDER S %=Y(0),X=Y
45 Q
46SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
47 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
48 E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
49 Q
50NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
51KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
52BEGIN S DNM="PRCST12",DQ=1
531 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=1 D X1 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
54X1 I '$D(PRCSTDT) S PRCSTDT=$S($D(^PRCS(410,DA(1),1)):$P(^(1),U,4),1:"")
55 Q
562 S DQ=3 ;@1
573 S DW="0;1",DV="MRNJ3,0",DU="",DLB="LINE ITEM NUMBER",DIFLD=.01
58 S DE(DW)="C3^PRCST12"
59 S Y="1"
60 G Y
61C3 G C3S:$D(DE(3))[0 K DB
62 S X=DE(3),DIC=DIE
63 K ^PRCS(410,DA(1),"IT","B",$E(X,1,30),DA)
64 S X=DE(3),DIC=DIE
65 K ^PRCS(410,DA(1),"IT","AB",$E(X,1,30),DA)
66C3S S X="" Q:DG(DQ)=X K DB
67 S X=DG(DQ),DIC=DIE
68 S ^PRCS(410,DA(1),"IT","B",$E(X,1,30),DA)=""
69 S X=DG(DQ),DIC=DIE
70 S ^PRCS(410,DA(1),"IT","AB",$E(X,1,30),DA)=""
71 Q
72X3 K:+X'=X!(X>999)!(X<1)!(X?.E1"."1N.N) X
73 Q
74 ;
754 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
76X4 I $D(^PRCS(410,DA(1),3)),$P(^(3),"^",4),$D(^(2)),$P(^(2),"^",1)'="" S PRCSV=$P(^(3),"^",4)
77 Q
785 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
79X5 I '$D(PRCSV) S Y=1
80 Q
816 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW="0;5",DV="FX",DU="",DLB="ITEM MASTER FILE NO.",DIFLD=5
82 S DE(DW)="C6^PRCST12"
83 G RE
84C6 G C6S:$D(DE(6))[0 K DB
85 S X=DE(6),DIC=DIE
86 K ^PRCS(410,DA(1),"IT","AG",$E(X,1,30),DA)
87C6S S X="" Q:DG(DQ)=X K DB
88 S X=DG(DQ),DIC=DIE
89 S ^PRCS(410,DA(1),"IT","AG",$E(X,1,30),DA)=""
90 Q
91X6 K:X[""""!($A(X)=45) X I $D(X) D ITEM^PRCSES1
92 I $D(X),X'?.ANP K X
93 Q
94 ;
957 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
96X7 K PRCSSUB I X="" S Y=1
97 Q
988 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
99X8 S PRCSSUB=$S($D(^PRCD(420.1,+$S($D(^PRCS(410,DA(1),3)):$P(^(3),U,3),1:""),1,+$S($D(^PRC(441,+$S($D(^PRCS(410,DA(1),"IT",DA,0)):$P(^(0),U,5),1:""),0)):$P(^(0),U,10),1:""),0)):$P(^(0),U),1:"")
100 Q
1019 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=9 D X9 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
102X9 S X=$P($G(^PRCS(410,DA(1),3)),U,3) I X]"" S X=$$GETBOCNT^PRCSECP(PRC("SITE"),+PRC("CP"),+X) I (+X=1) S $P(^PRCS(410,DA(1),"IT",DA,0),U,4)=$P(X,U,2),Y="@44" W !,"BOC: ",$P(X,U,2)
103 Q
10410 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW="0;4",DV="RFX",DU="",DLB="BOC",DIFLD=4
105 S DE(DW)="C10^PRCST12"
106 G RE
107C10 G C10S:$D(DE(10))[0 K DB
108 S X=DE(10),DIC=DIE
109 K ^PRCS(410,"AD",$E(X,1,30),DA(1))
110C10S S X="" Q:DG(DQ)=X K DB
111 S X=DG(DQ),DIC=DIE
112 S ^PRCS(410,"AD",$E(X,1,30),DA(1))=""
113 Q
114X10 K:X[""""!($A(X)=45) X I $D(X) D SUB^PRCSES
115 I $D(X),X'?.ANP K X
116 Q
117 ;
11811 S DQ=12 ;@44
11912 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW="0;2",DV="RNJ9,2",DU="",DLB="QUANTITY",DIFLD=2
120 S DE(DW)="C12^PRCST12"
121 G RE
122C12 G C12S:$D(DE(12))[0 K DB
123 S X=DE(12),DIC=DIE
124 X "S E=0,E(1)="""" S:'$D(^PRCS(410,DA(1),4)) ^(4)="""" F E(0)=1:1 S E=$O(^PRCS(410,DA(1),""IT"",E)) S:E?1N.N&(E'=DA) E(1)=E(1)+($P(^(E,0),U,2)*$P(^(0),U,7)) I E'?1N.N X ^DD(410.02,2,1,1,1.4) K E Q"
125C12S S X="" Q:DG(DQ)=X K DB
126 S X=DG(DQ),DIC=DIE
127 X "S E=0,E(1)="""" S:'$D(^PRCS(410,DA(1),4)) ^(4)="""" F E(0)=1:1 S E=$O(^PRCS(410,DA(1),""IT"",E)) S:E?1N.N E(1)=E(1)+($P(^(E,0),U,2)*$P(^(0),U,7)) I E'?1N.N X ^DD(410.02,2,1,1,1.4) K E Q"
128 Q
129X12 K:+X'=X!(X>999999)!(X<.01)!(X?.E1"."3N.N) X
130 Q
131 ;
13213 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
133X13 S Y="@4"
134 Q
13514 D:$D(DG)>9 F^DIE17,DE S DQ=14,D=0 K DE(1) ;1
136 S Y="DESCRIPTION^W^^0;1^Q",DG="1",DC="^410.03" D DIEN^DIWE K DE(1) G A
137 ;
13815 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=15 D X15 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
139X15 S X=$P($G(^PRCS(410,DA(1),3)),U,3) I X]"" S X=$$GETBOCNT^PRCSECP(PRC("SITE"),+PRC("CP"),+X) I (+X=1) S $P(^PRCS(410,DA(1),"IT",DA,0),U,4)=$P(X,U,2),Y="@444" W !,"BOC: ",$P(X,U,2)
140 Q
14116 S DW="0;4",DV="RFX",DU="",DLB="BOC",DIFLD=4
142 S DE(DW)="C16^PRCST12"
143 G RE
144C16 G C16S:$D(DE(16))[0 K DB
145 S X=DE(16),DIC=DIE
146 K ^PRCS(410,"AD",$E(X,1,30),DA(1))
147C16S S X="" Q:DG(DQ)=X K DB
148 S X=DG(DQ),DIC=DIE
149 S ^PRCS(410,"AD",$E(X,1,30),DA(1))=""
150 Q
151X16 K:X[""""!($A(X)=45) X I $D(X) D SUB^PRCSES
152 I $D(X),X'?.ANP K X
153 Q
154 ;
15517 S DQ=18 ;@444
15618 S DQ=19 ;@2
15719 D:$D(DG)>9 F^DIE17,DE S DQ=19,DW="0;2",DV="RNJ9,2",DU="",DLB="QUANTITY",DIFLD=2
158 S DE(DW)="C19^PRCST12"
159 G RE
160C19 G C19S:$D(DE(19))[0 K DB
161 S X=DE(19),DIC=DIE
162 X "S E=0,E(1)="""" S:'$D(^PRCS(410,DA(1),4)) ^(4)="""" F E(0)=1:1 S E=$O(^PRCS(410,DA(1),""IT"",E)) S:E?1N.N&(E'=DA) E(1)=E(1)+($P(^(E,0),U,2)*$P(^(0),U,7)) I E'?1N.N X ^DD(410.02,2,1,1,1.4) K E Q"
163C19S S X="" Q:DG(DQ)=X K DB
164 D ^PRCST14
165 Q
166X19 K:+X'=X!(X>999999)!(X<.01)!(X?.E1"."3N.N) X
167 Q
168 ;
16920 D:$D(DG)>9 F^DIE17,DE S DQ=20,DW="0;3",DV="RP420.5'",DU="",DLB="UNIT OF PURCHASE",DIFLD=3
170 S DU="PRCD(420.5,"
171 G RE
172X20 Q
17321 S DW="0;6",DV="FX",DU="",DLB="STOCK NUMBER",DIFLD=6
174 G RE
175X21 K:$L(X)>24!($L(X)<1)!(X'?.ANP) X
176 I $D(X),X'?.ANP K X
177 Q
178 ;
17922 S DW="0;7",DV="RNJ10,2X",DU="",DLB="EST. ITEM (UNIT) COST",DIFLD=7
180 S DE(DW)="C22^PRCST12"
181 G RE
182C22 G C22S:$D(DE(22))[0 K DB
183 D ^PRCST15
184C22S S X="" Q:DG(DQ)=X K DB
185 D ^PRCST16
186 Q
187X22 S:X["$" X=$P(X,"$",2) Q:X?1"N/C" K:+X'=X&(X'?.N1"."2N)!(X>9999999)!(X<0) X I $D(X) S:X=0 X="N/C"
188 Q
189 ;
19023 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=23 D X23 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
191X23 K PRCSV
192 Q
19324 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=24 G A
19425 S DQ=26 ;@4
19526 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=26 D X26 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
196X26 I $D(^PRC(411,PRC("SITE"),0)),$P(^(0),U,18)'="Y" S Y="@5"
197 Q
19827 D:$D(DG)>9 F^DIE17 G ^PRCST17
Note: See TracBrowser for help on using the repository browser.