source: FOIAVistA/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCH410.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 6.1 KB
Line 
1PRCH410 ;WISC/KMB/DXH/DGL - CREATE 2237 FROM PURCHASE CARD ORDER ; 4/4/00 7:56am
2 ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; prcsip is package-wide variable for inv pt that may or may not be
6 ; passed to this routine
7START ;
8 N VV,ST,Y,Z,Z0,Z1,Z2,I,J,CCEN,ESTS,NET,SERV,EMER,COUNT,COUNT1,L,PDUZ,FY,QTR,CP,LOC,ADATE,TDATE,SDATE,LL,PC,PCREF,XDA
9 N SCP,SGRP,COR,VEN,VEND
10 Q:'$D(DA) Q:+DA=0 S XDA=DA
11 S Z0=$G(^PRC(442,XDA,0)),PRC("SITE")=$P(Z0,"-"),CP=$P(Z0,"^",3),SCP=$P(CP," "),PRC("SST")=$P($G(^PRC(442,XDA,23)),"^",7),PCREF=$P(Z0,"^"),PCREF=$P(PCREF,"-",2)
12 S TDATE=$$DATE^PRC0C($P($G(^PRC(442,XDA,1)),"^",15),"I"),PRC("FY")=$E(TDATE,3,4),PRC("QTR")=$P(TDATE,"^",2),(TDATE,SDATE)=$P($$DATE^PRC0C("T","E"),"^",7)
13 S CCEN=$P(Z0,"^",5),ESTS=$P(Z0,"^",13),ADATE=$P(Z0,"^",10)
14 I CCEN'="" S CCEN=$E($P(^PRCD(420.1,CCEN,0),"^"),1,30)
15 S Z1=$G(^PRC(442,XDA,1)),(VV,VEND)=$P(Z1,"^"),SERV=$P(Z1,"^",2),EMER=$P(Z1,"^",17),LOC=$P(Z1,"^",11),PDUZ=DUZ
16 S ST="ST" S:EMER="Y" ST="EM"
17 S PRC("CP")=+SCP
18 I $G(PRCSIP) I '$O(^PRC(420,PRC("SITE"),1,PRC("CP"),7,"B",PRCSIP,0)) K PRCSIP ; Kill inventory point if not match FCP
19 I '$G(PRCSIP) S J=0 F S J=$O(^PRC(442,XDA,2,J)) Q:'J!($G(PRCSIP)) S K=0 F S K=$O(^PRC(442,XDA,2,J,5,0)) Q:'K!($G(PRCSIP)) S PRCSIP=$P($G(^PRC(442,XDA,2,J,5,K,0)),U)
20IP D:'$G(PRCSIP) IP^PRCSUT
21 I '$G(PRCSIP),$O(^PRC(420,PRC("SITE"),1,PRC("CP"),7,0)) D I Y=0 G IP
22 . K DIR S DIR("A")="** WARNING ** No inventory point selected - Continue anyway",DIR("B")="NO",DIR(0)="Y"
23 . S DIR("?",1)="The FCP you entered has Inventory points associated with it, but none have been selected."
24 . S DIR("?")="Press 'Y' to return to the inventory point prompt or 'N' to continue the order without one."
25 . D ^DIR K DIR
26 . I $E(X)="^"!(Y=1) W !,"No inventory point was attached.",! Q
27 . Q
28 S PC=$P($G(^PRC(442,XDA,23)),"^",8)
29 S COUNT=$P($G(^PRC(442,XDA,2,0)),"^",4) I +COUNT'=0 D ITEM
30 S CDA=$P($G(^PRC(442,XDA,23)),"^",23)
31 S:$G(PRCHPC)=3 CDA=$P($G(^PRC(442,XDA,13,0)),U,3)
32 I CDA="" D REC Q:CDA=""
33 S CCDA=CDA
34SET ;set item data and vendor on record
35 L +^PRCS(410,CDA):15 Q:'$T
36 ;
37 I VEND'="",$P($G(^PRC(440,VEND,0)),"^")'="SIMPLIFIED" S ^PRCS(410,CDA,2)=$G(^PRC(440,VEND,0))
38 I $P($G(^PRC(440,+VEND,0)),"^")="SIMPLIFIED" S VEND="SIMPLIFIED" S:$P($G(^PRC(442,XDA,24)),"^",2)'="" VEND=$P($G(^PRC(442,XDA,24)),"^",2) S ^PRCS(410,CDA,2)=VEND
39 S VEN=$P(^PRCS(410,CDA,2),"^")
40 S COR=$P($G(^PRC(442,XDA,23)),"^",12),SGRP=$P($G(^PRC(442,XDA,23)),"^",13)
41 S DA=CDA,DIE="^PRCS(410,",DR="3////4"_";"_"5///"_TDATE_";"_"7////"_SDATE_";"_"15////"_CP_";"_"15.5////"_CCEN_";"_"21////"_TDATE_";"_"12////"_VV D ^DIE
42 S DR="1////O"_";"_"6.3////"_SERV_";"_"7.5////"_ST_";"_"40////"_DUZ_";"_"68////"_DUZ_";"_"8////"_COR D ^DIE
43 S DR="46////^S X=LOC"_";"_"47////"_ADATE_";"_"48.1////"_ESTS_";"_"52///"_XDA_";"_"24///"_PCREF D ^DIE
44 I $G(PRCSIP) S DR="4////^S X=PRCSIP" D ^DIE
45 I PC="" S PC=9999999
46 S DR="451////^S X=PC" D ^DIE
47 I +COUNT'=0 F IT=1:1:COUNT D
48 .S ^PRCS(410,CDA,"IT",IT,0)=BB(IT)
49 .I +COUNT1'=0 F J=1:1:COUNT1 D
50 ..S:$D(BB(IT,J)) ^PRCS(410,CDA,"IT",IT,1,J,0)=BB(IT,J)
51 .I COUNT1="" S ^PRCS(410,CDA,"IT",IT,1,0)="^^1^1^"_TDATE_"^^"
52 .F LL="AB","B" S ^PRCS(410,CDA,"IT",LL,IT,IT)=""
53 .I $P(BB(IT),"^",4)'="" S ^PRCS(410,CDA,"IT","AG",$P(BB(IT),"^",4),IT)=""
54 .S:+COUNT1'=0 ^PRCS(410,CDA,"IT",IT,1,0)="^410.03^"_COUNT1_"^"_COUNT1
55 I $D(VEN) S ^PRCS(410,"E",$E(VEN,1,30),CDA)=""
56 S ^PRCS(410,"AQ",1,CDA)="" S:COUNT'="" ^PRCS(410,CDA,"IT",0)="^410.02AI^"_COUNT_"^"_COUNT
57 I '$G(PRCPROST),$G(RPUSE)'=1,$G(COMMENT)'="delivery",$G(PRCHPC)'="" S DA=CDA,DR=49 D ^DIE
58 L -^PRCS(410,CDA)
59 L +^PRC(442,XDA):15 Q:'$T S $P(^PRC(442,XDA,23),"^",23)=CDA,$P(^PRC(442,XDA,23),"^",13)=$P($G(^PRCS(410,CDA,11)),"^") L -^PRC(442,XDA)
60 S DA=XDA K DIE QUIT
61ITEM ;
62 F IT=1:1:COUNT D
63 .F J=1,2,3,4,5,6,8 S $P(BB(IT),"^",J)=$P($G(^PRC(442,XDA,2,IT,0)),"^",J)
64 .S $P(BB(IT),"^",7)=$P($G(^PRC(442,XDA,2,IT,0)),"^",9)
65 .S COUNT1=$P($G(^PRC(442,XDA,2,IT,1,0)),"^",4) I +COUNT1'=0 F J=1:1:COUNT1 S BB(IT,J)=$G(^PRC(442,XDA,2,IT,1,J,0))
66 QUIT
67REC ;create skeleton 410 record
68 S:$G(XDA)'="" PRC("CP")=$P($G(^PRC(442,XDA,0)),U,3)
69 Q:+$G(PRC("CP"))=0
70 S T(2)="",Z=PRC("SITE")_"-"_PRC("FY")_"-"_PRC("QTR")_"-"_$P(PRC("CP")," ")
71 S PRC("BBFY")=$$BBFY^PRCSUT(PRC("SITE"),PRC("FY"),$P(PRC("CP")," "),1)
72 S X=$P(Z,"-",1,2)_"-"_$P(PRC("CP")," ")
73 D EN1^PRCSUT3 Q:'$D(X) S X1=X D EN2^PRCSUT3 Q:$G(DA)="" Q:'$D(X1) S CDA=DA
74 K X,T(2) QUIT
75ESIG ;put ESIG on record, update due-ins
76 S NET=$P($G(^PRC(442,PODA,0)),"^",15) L +^PRCS(410,DA):15 Q:'$T F I=1,8 S $P(^PRCS(410,DA,4),"^",I)=NET
77 I $D(PRCHDELV) S $P(^PRCS(410,DA,4),"^",3)=NET,$P(^PRCS(410,DA,4),"^",4)=$P(^PRCS(410,DA,1),"^")
78 S:'$D(PRC("CP")) ZIP=$P(^PRC(442,PODA,0),"^",3),PRC("CP")=$P(ZIP," ") Q:PRC("CP")=""
79 S BAL=$P($G(^PRC(420,PRC("SITE"),1,+PRC("CP"),4,PRC("FY"),0)),"^",PRC("QTR")+1)
80 L -^PRCS(410,DA)
81 D ERS410^PRC0G(DA_"^A")
82 S MESSAGE="" D ENCODE^PRCSC1(DA,DUZ,.MESSAGE)
83 S:'$D(PRC("CP")) ZIP=$P(^PRC(442,PODA,0),"^",3),PRC("CP")=$P(ZIP," ") Q:PRC("CP")=""
84 D:'$D(PRC("FY")) FY^PRCH442
85 N KTEMP S KTEMP=X
86 S AA=PRC("SITE")_"^"_+PRC("CP")_"^"_PRC("FY")_"^"_PRC("QTR")_"^"_NET D EBAL^PRCSEZ(AA,"C") D:$G(PRCHDELV)'="" EBAL^PRCSEZ(AA,"O")
87 S X=KTEMP
88 S BAL=$P($G(^PRC(420,PRC("SITE"),1,+PRC("CP"),4,PRC("FY"),0)),"^",PRC("QTR")+1)
89 W !,"Cost of this request: $",$J(X,0,2),!,"Current Control Point Balance: $",$J(BAL,0,2),!
90 S PRCSN=$G(^PRCS(410,DA,0))
91 I $P(PRCSN,U,4)>1 S X=$P(PRCSN,U,1),DIC="^PRC(443,",DIC(0)="L",DLAYGO=443 D ^DIC K DIC,DLAYGO,X
92 I $P(PRCSN,U,4)>1 S X=$O(^PRCD(442.3,"C",60,0)) S $P(^PRC(443,DA,0),U,7)=X,^PRC(443,"AC",X,DA)="",$P(^PRC(443,DA,0),U,11)=$P(PRCSN,U,6)
93 I '$G(PRCHPHAM),$G(PRCHPC)'=1 D EN2^PRCPWI
94 S PRCSINV=$P(^PRCS(410,DA,0),U,6)
95 S DIE="^PRC(443,",DR="9///^S X=1;10///^S X=4;11////^S X=PRCSINV;13///^S X=""E"";3.7///^S X=5730;3.5///^S X=1;2////^S X=DUZ"
96 D ^DIE K DIE,DR
97 S BAL=$P($G(^PRC(420,PRC("SITE"),1,+PRC("CP"),4,PRC("FY"),0)),"^",PRC("QTR")+1)
98 D ES1^PRCHG
99 S PRCHSY(0)=^PRC(443,CDA,0) ;After Signature use 443 entry
100 S PRCHS="",PRCHSY=DA,PRCHSP="" D LST1^PRCHNPO2
101 S BAL=$P($G(^PRC(420,PRC("SITE"),1,+PRC("CP"),4,PRC("FY"),0)),"^",PRC("QTR")+1)
102 S DA=CDA,DIK="^PRC(443," D ^DIK K DIK
103 K BAL,ZIP,PRCSN,X,MESSAGE QUIT
Note: See TracBrowser for help on using the repository browser.