1 | PRCHAMU ;WISC/AKS-Modules helpful in amendments ;8/18/97 9:12
|
---|
2 | ;;5.1;IFCAP;**21**;Oct 20, 2000
|
---|
3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | W !,"Call at the appropriate entry point",$C(7)
|
---|
5 | Q
|
---|
6 | ;
|
---|
7 | GETPO ;get a valid PO
|
---|
8 | ;the variable RETURN is either the PO/REQ# or null if no PO is selected
|
---|
9 | N DIC,D,Y,X,TRANS,PRCHSTAT
|
---|
10 | S DIC="^PRC(442,",DIC(0)="QEAMZ",D="C"
|
---|
11 | S DIC("A")=$S($D(PRCHREQ):"REQUISITION NO.: ",1:"PURCHASE ORDER: ")
|
---|
12 | S DIC("S")="I +$P(^(0),U)=PRC(""SITE"")"_$S($D(PRCHREQ):",$P(^(0),U,2)=8!($P(^(0),U,2)=25)",1:",$P(^(0),U,2)<8!($P(^(0),U,2)=25)!($P(^(0),U,2)=26)")
|
---|
13 | I $G(PRCHAUTH)=1 S DIC("S")="I +$P(^(0),U)=PRC(""SITE""),($P($G(^(23)),U,11)=""P""!($P($G(^(23)),U,11)=""S""))"
|
---|
14 | I $G(PRCHAUTH)=2 S DIC("S")="I +$P(^(0),U)=PRC(""SITE""),$P($G(^(23)),U,11)=""D"""
|
---|
15 | D ^DIC K DIC I Y<0 S OUT=1 Q
|
---|
16 | ;A time-out/up-arrow check before locking the record.
|
---|
17 | I $D(DTOUT)!$D(DUOUT) Q
|
---|
18 | ; Locking the 442 entry i.e. selected by the user to amend.
|
---|
19 | ; This lock is released ONLY at one exit point in EXIT^PRCHMA routine.
|
---|
20 | ;
|
---|
21 | S PRCENTRY=+Y,OUT=0
|
---|
22 | L +^PRC(442,PRCENTRY):1 E W !!,?5," Someone else is already editing this amendment record." S PRCFL=1 Q
|
---|
23 | S X=$S($D(^PRC(442,+Y,7)):$P($G(^PRCD(442.3,+^(7),0)),U,2),1:"")
|
---|
24 | I X="" W !,$C(7),"Invalid Supply Status" Q
|
---|
25 | I X<20 W !,$C(7)," This order is not properly signed yet!!" Q
|
---|
26 | I X=45 W !,$C(7),"This is a cancelled " W:$D(PRCHREQ) "requisition." W:'$D(PRCHREQ) "purchase order." Q
|
---|
27 | I $G(PRCHAUTH)=1 S PCARD=$P($G(^PRC(442,+Y,23)),U,8) D I $G(PRCHFG) K PCARD,PRCHFG Q
|
---|
28 | . I '$D(^PRC(440.5,"C",DUZ,PCARD)) W !,?5,"You are not authorized to amend this purchase card order." S PRCHFG=1
|
---|
29 | K PCARD,PRCHFG
|
---|
30 | I $G(PRCHAUTH)=2 S PRCHAUCP=$P(^PRC(442,+Y,0),U,3) D I $G(PRCHAUFG) K PRCHAUCP,PRCHAUFG Q
|
---|
31 | . I '$D(^PRC(420,PRC("SITE"),1,+PRCHAUCP,1,DUZ)) D S PRCHAUFG=1
|
---|
32 | . . W !!,"You are not an authorized user for "_$P(PRCHAUCP," ",1,2)_" control point.",!
|
---|
33 | K PRCHAUCP,PRCHAUFG
|
---|
34 | I '$D(TRANSCMP) I X=40!(X=41) D Q:$G(TRANS)=1
|
---|
35 | .Q:($P(^PRC(442,+Y,0),"^",2)=2)!($P(^PRC(442,+Y,0),"^",2)=4)
|
---|
36 | .W $C(7),!!,?5,"Purchase orders (Excluding CERTIFIED INVOICE and GUARANTEED DELIVERY)",!,?5,"with a status of 'Transaction Complete' cannot be amended."
|
---|
37 | .S TRANS=1
|
---|
38 | I X=50!(X=51) D Q
|
---|
39 | . W $C(7),!!,?5,"Reconciled Purchase Card orders cannot be amended."
|
---|
40 | I X=28!(X=33) W $C(7),!,"Amendment not allowed until after order has been obligated!!" Q
|
---|
41 | I $D(^PRC(443.6,+Y,0)) S PRCHAM=$O(^PRC(443.6,+Y,6,0)) I PRCHAM="" D Q
|
---|
42 | .W !!?5,"This record is not set-up properly, it is being cleaned-up."
|
---|
43 | .W !?5,"Please RE-START the amendment process.",!
|
---|
44 | .D DEL
|
---|
45 | I $D(^PRC(443.6,+Y,0)) S PRCHAM=$O(^PRC(443.6,+Y,6,0)) Q:PRCHAM'>0 D Q:$D(FIS)
|
---|
46 | .I $P($G(^PRC(443.6,+Y,6,PRCHAM,1)),U,2)]"" D
|
---|
47 | ..W !!,?5,"Pending Amendment: ",PRCHAM," Status: Pending Fiscal Action" S FIS=1
|
---|
48 | D FMS
|
---|
49 | I $G(STATUS)]"" I $E(STATUS,1)="R"!($E(STATUS,1)="E") D K STATUS Q
|
---|
50 | .W !!,?5,"One of the previous documents has been rejected by",!,?5,"FMS or has errored in transmission.",!,?5,"This purchase order cannot be amended at this time."
|
---|
51 | I $D(^PRC(443.6,+Y,0)) I $D(^PRC(443.6,+Y,11)) W !!,"There is a pending Adjustment Voucher against this purchase order" Q
|
---|
52 | I $D(^PRC(443.6,+Y,0)) W $C(7),!!,?5,"*** There is already an amendment pending for this purchase order. ***" S PRCHNEW=111 D Q:%'=1!$D(DEL)
|
---|
53 | .S %=1,%B="",%A=" Would you like to Edit it" D ^PRCFYN W !
|
---|
54 | .I %=2 S %B="",%A=" Would you like to delete it" D ^PRCFYN W ! D
|
---|
55 | ..D:%=1 DEL
|
---|
56 | S PRCHPO=+Y
|
---|
57 | Q
|
---|
58 | AMENDNO ;gets next valid amendment number to create
|
---|
59 | ;
|
---|
60 | N I,%,%A,%B,PRCHEX,PRCHEX1
|
---|
61 | S PRCHAM=1
|
---|
62 | I $D(^PRC(442,PRCHPO,6)) D
|
---|
63 | .S I=0 F S I=$O(^PRC(442,PRCHPO,6,I)) Q:'I S PRCHAM=I+1
|
---|
64 | W !!?5,"Amendment Number: ",PRCHAM
|
---|
65 | I $D(^PRC(443.6,PRCHPO,0)) W ! Q
|
---|
66 | W !!,"...copying Purchase Order into work file...",! D WAIT^DICD W !
|
---|
67 | F I=0,1,7,12,23 S ^PRC(443.6,PRCHPO,I)=$G(^PRC(442,PRCHPO,I))
|
---|
68 | S $P(^PRC(443.6,0),"^",3)=PRCHPO,$P(^(0),"^",4)=$P(^(0),"^",4)+1
|
---|
69 | S PRCHEX=$P(^PRC(443.6,PRCHPO,0),"^"),PRCHEX1=$P(PRCHEX,"-",2)
|
---|
70 | S (^PRC(443.6,"B",PRCHEX,PRCHPO),^PRC(443.6,"E",PRCHEX1,PRCHPO))=""
|
---|
71 | Q
|
---|
72 | ;
|
---|
73 | INFO ; Ask for common information for amendments
|
---|
74 | N DIE,DA,DR,FLGUP
|
---|
75 | S ER=0,FLGUP=0,DIE="^PRC(443.6,",DA=PRCHPO,DR="[PRCHAMEND]"
|
---|
76 | S:$D(PRCHAV) DR="[PRCHAMENDAV]"
|
---|
77 | S:$G(PRCPROST)=90 DR="[PRCHAMENDPRO]"
|
---|
78 | S:$G(PRCPROST)=6 DR="[PRCHAMENDPRO EDIT]"
|
---|
79 | D ^DIE
|
---|
80 | I $D(Y)!'FLGUP S ER=1 Q
|
---|
81 | S DIE="^PRC(443.6,"_PRCHPO_",6,",DA=PRCHAM,DR="15///TODAY+4" D ^DIE
|
---|
82 | I '$D(^PRC(443.6,PRCHPO,6,PRCHAM,1)) D S ER=1 Q
|
---|
83 | .W !,?5,"Can't continue without a Purchasing Agent !"
|
---|
84 | ;S PRCHLC=$P(PRCH(0),U,14)
|
---|
85 | Q
|
---|
86 | ASK ;Ask type amendment
|
---|
87 | N PRCHREPO S PRCHREPO=$O(^PRC(443.6,PRCHPO,6,PRCHAM,3,"AC",32,0)) I PRCHREPO>0 S REPONUM=1 Q
|
---|
88 | S ER=0 W !
|
---|
89 | I '$G(PRCHAUTH) D
|
---|
90 | . S DIC=$S($D(PRCHREQ):"^PRCD(441.6,",1:"^PRCD(442.2,")
|
---|
91 | . S DIC("S")="I Y>19,($P(^(0),U,3)]"""")"
|
---|
92 | . S DIC(0)="MQEAZ" D ^DIC K DIC
|
---|
93 | I $G(PRCHAUTH) D
|
---|
94 | . D:'$D(PRCHREQ) DIRPO^PRCHPCAR D:$D(PRCHREQ) DIRREQ^PRCHPCAR
|
---|
95 | I Y<0 S ER=1 K PRCHVFLG Q
|
---|
96 | I $D(PRCHREQ) D G:ER ASK
|
---|
97 | .I '$D(^PRCD(441.6,+Y,1)) D S ER=1
|
---|
98 | ..W !!?5,"Amendment Lines in 'Type of Requisition Amendment' file are not defined "
|
---|
99 | I '$D(PRCHREQ) D G:ER ASK
|
---|
100 | .I '$D(^PRCD(442.2,+Y,1)) D S ER=1
|
---|
101 | ..W !!?5,"Amendment Lines in 'Type of Amendment' file are not defined "
|
---|
102 | I $P($G(Y(0)),U,3)="" D
|
---|
103 | . S Y(0)=$S($D(PRCHREQ):^PRCD(441.6,Y,0),1:^PRCD(442.2,Y,0))
|
---|
104 | S PRCHAMDA=+Y,ROU=$P(Y(0),U,3),ROU=$TR(ROU,"~","^")
|
---|
105 | S PRCHL1=$P(^PRCD(442.2,+Y,1),U),PRCHL2=$P(^(1),U,2)
|
---|
106 | Q
|
---|
107 | UPDATE ;Update Delivery date, Original Delivery Date, Amendment status and
|
---|
108 | ;Justification.
|
---|
109 | I $G(DELIVER) D
|
---|
110 | .S PRCHDT=$P(^PRC(443.6,PRCHPO,0),U,10)
|
---|
111 | .I $P($G(^PRC(442,PRCHPO,23)),"^",11)'="S" S DIE="^PRC(443.6,",DA=PRCHPO,DR=7 D ^DIE K DIE
|
---|
112 | .I PRCHDT,$P(^PRC(443.6,PRCHPO,0),U,20)="",$P(^(0),U,10)'=PRCHDT S $P(^(0),U,20)=PRCHDT
|
---|
113 | .K PRCHDT
|
---|
114 | S POSTAT=+$G(^PRC(443.6,PRCHPO,7))
|
---|
115 | S AMSTAT=$S(POSTAT=25:26,POSTAT=30:31,POSTAT=40:71,POSTAT=6:83,POSTAT=84:85,POSTAT=86:87,POSTAT=90:91,POSTAT=92:93,POSTAT=94:95,POSTAT=96:97,POSTAT=45:45,1:POSTAT)
|
---|
116 | S AMSTAT=$P(^PRCD(442.3,AMSTAT,0),U)
|
---|
117 | S DIE="^PRC(443.6,PRCHPO,6,",DA(1)=PRCHPO,DA=PRCHAM,DR="9//^S X=AMSTAT;16"
|
---|
118 | N AAREPO S AAREPO=$O(^PRC(443.6,PRCHPO,6,PRCHAM,3,"AC",32,0))
|
---|
119 | I $G(CAN)=1!(AAREPO>0) S DR=16
|
---|
120 | I $G(PRCPROST)=90 S DR="16////Prosthetic order cancelled"
|
---|
121 | I $G(PRCPROST)=6 S DR="16////Prosthetic Cost Changes"
|
---|
122 | D ^DIE K DIE,AMSTAT,POSTAT
|
---|
123 | QUIT
|
---|
124 | FMS ;Checking FMS documents status
|
---|
125 | ;
|
---|
126 | N N,CODE
|
---|
127 | S N=0,STATUS="" F S N=$O(^PRC(442,+Y,10,N)) Q:N'>0 D Q:$E(STATUS,1)="R"!($E(STATUS,1)="E")
|
---|
128 | .I $E(^PRC(442,+Y,10,N,0),1,2)="MO"!($E(^(0),1,2)="SO") D
|
---|
129 | ..S CODE=$P($G(^PRC(442,+Y,10,N,0)),U,4)
|
---|
130 | ..S STATUS=$$STATUS^GECSSGET(CODE)
|
---|
131 | Q
|
---|
132 | DEL ;Delete this amendment
|
---|
133 | N PO,EXPO,EXPO1,N,ZERO,REC,PAT,ITEM
|
---|
134 | S PO=+Y
|
---|
135 | S EXPO=$P(^PRC(443.6,PO,0),U),EXPO1=$P(EXPO,"-",2)
|
---|
136 | S N=0 F S N=$O(^PRC(441.7,"B",EXPO,N)) Q:N'>0 D
|
---|
137 | .S REC=^PRC(441.7,N,0)
|
---|
138 | .S PAT=$P(REC,U)
|
---|
139 | .S ITEM=$P(REC,U,2)
|
---|
140 | .I ITEM>0 K ^PRC(441.7,"AG",PAT,ITEM,N)
|
---|
141 | .K ^PRC(441.7,"B",PAT,N)
|
---|
142 | .K ^PRC(441.7,N,0)
|
---|
143 | .S ZERO=^PRC(441.7,0)
|
---|
144 | .S $P(ZERO,U,4)=$P(ZERO,U,4)-1
|
---|
145 | .S:$P(ZERO,U,4)<1 $P(ZERO,U,4)=""
|
---|
146 | .S ^PRC(441.7,0)=ZERO
|
---|
147 | K ^PRC(443.6,"B",EXPO),^PRC(443.6,"C",PO),^PRC(443.6,"D",PO)
|
---|
148 | K ^PRC(443.6,"E",EXPO1),^PRC(443.6,PO)
|
---|
149 | S ZERO=^PRC(443.6,0)
|
---|
150 | S $P(ZERO,U,4)=$P(ZERO,U,4)-1
|
---|
151 | S:$P(ZERO,U,4)<1 $P(ZERO,U,4)=""
|
---|
152 | S ^PRC(443.6,0)=ZERO
|
---|
153 | S DEL=1
|
---|
154 | QUIT
|
---|
155 | ;
|
---|
156 | MSG ;This subroutine is called by PRCHMA
|
---|
157 | ;Display message for 'Vendor Change'
|
---|
158 | N AA
|
---|
159 | S AA="NOTE: The vendor has been changed."
|
---|
160 | S AA=AA_" Please review LINE ITEM & FPDS information"
|
---|
161 | S AA=AA_" for any necessary changes."
|
---|
162 | D EN^DDIOL(AA) W !
|
---|
163 | QUIT
|
---|
164 | ;
|
---|
165 | MSG1 ;This subroutine is called by PRCHMA
|
---|
166 | ;Source code was changed to 2
|
---|
167 | N AA
|
---|
168 | S AA="NOTE: THE CONTRACT WILL BE REMOVED FROM ALL ITEMS"
|
---|
169 | D EN^DDIOL(AA) W !
|
---|
170 | QUIT
|
---|
171 | ;
|
---|
172 | SOURCE ;This subroutine is called by PRCHMA
|
---|
173 | ;Source code was changed to 2
|
---|
174 | ;Remove contract number from $P2 and AC x-reference.
|
---|
175 | KILL SCE
|
---|
176 | N CONTRACT,ITEM S ITEM=0
|
---|
177 | F S ITEM=$O(^PRC(443.6,PRCHPO,2,ITEM)) Q:'ITEM D
|
---|
178 | . S CONTRACT=$G(^PRC(443.6,PRCHPO,2,ITEM,2))
|
---|
179 | . S CONTRACT=$P(CONTRACT,U,2)
|
---|
180 | . Q:CONTRACT=""
|
---|
181 | . S $P(^PRC(443.6,PRCHPO,2,ITEM,2),U,2)=""
|
---|
182 | . KILL ^PRC(443.6,PRCHPO,2,"AC",CONTRACT,ITEM)
|
---|
183 | ;
|
---|
184 | QUIT
|
---|