source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHNPOA.m@ 810

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

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1PRCHNPOA ;WISC/RL/DXH - CHANGE TRANS. NUMBER FOR PCO INITIATED 2237 ;8.2.99
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ; This code is called after a user electronically signs a purchase
5 ; card order. If the FCP on the 2237 does not match the one in the
6 ; the transaction number for the 2237 entry, this code will change
7 ; the existing transaction number for the 2237. To do this, a new
8 ; ien is created and populated with info from the existing transaction,
9 ; then canceled. The original transaction is updated with the new
10 ; transaction number.
11 ; (This code is a simplified of ANTN^PRCSUT2, which is called by the
12 ; IFCAP option "Change Existing Transaction Number"
13 ;
14 ;Inputs: param PCODA is the IEN of the Purchase Card Order in 442 file.
15 ;Return Values: none
16 ;Globals modified: ^PRCS(410 (if necessary)
17 ;
18CHECKFCP(PCODA) ;Check FCP in 2237 entry of the 410 file to see if it matches Trans #
19 ;
20 N CURFCP,ODA,OTNUM,OCP
21 S ODA=+$P($G(^PRC(442,PCODA,23)),U,23) ; ODA is the IEN for the old 410 entry
22 S OTNUM=$P($G(^PRCS(410,ODA,0)),U,1) ; OTNUM is transaction # for old 410 entry
23 S OCP=+$P(OTNUM,"-",4) ; OCP is the original FCP for trans.
24 S CURFCP=$P($G(^PRCS(410,ODA,3)),U,1) ; CURFCP is the current (valid) FCP for trans.
25 I (+CURFCP'=+OCP) D MODTXN
26 Q
27 ;
28MODTXN ;Modify the transaction number for the 2237 entry in the 410 file
29 N %,%Y,D,DA,DIC,DIE,DR,I,J,L,ONODE0,N,PNW,PRCS,PRCSAPP,PRCSDIC,PRCSIP
30 N PRCSL,PRCSY,T,T0,T1,T2,T4,T5,TX1,X,X1,Y,Z0
31 L +^PRCS(410,ODA):1
32 I $T=0 W !,"File being accessed...please change the transaction number later" G EXIT
33 S ONODE0=^PRCS(410,ODA,0) ; node 0 string of txn to be replaced
34 S T2=OTNUM ;T2 is needed in PRCSUT call later
35 S T5=$P(ONODE0,"^",10) ; substation
36 S T4=$P(ONODE0,"^",2) ; txn type of transaction to be replaced
37 S PRC("SITE")=$P(OTNUM,"-"),PRC("FY")=$P(OTNUM,"-",2)
38 S PRC("QTR")=$P(OTNUM,"-",3),PRC("CP")=CURFCP
39 S PRC("BBFY")=$$BBFY^PRCSUT(PRC("SITE"),PRC("FY"),+PRC("CP"),1)
40 S X=PRC("SITE")_"-"_PRC("FY")_"-" S:(+CURFCP<100) X=X_"0" S X=X_+CURFCP
41 S Z=PRC("SITE")_"-"_PRC("FY")_"-"_PRC("QTR")_"-"
42 S:(+CURFCP<100) Z=Z_"0" S Z=Z_+CURFCP
43 D EN1^PRCSUT3 ; generate new name for txn and put in X
44 D IP^PRCSUT ; get prcsip (prc*5*197)
45 G:'$G(X) EXIT
46 S TX1=X,(DIC,DIE)="^PRCS(410,"
47CK K DA
48 S DLAYGO=410,DIC="^PRCS(410,",DIC(0)="LXZ"
49 D ^DIC
50 K DLAYGO
51 G:Y'>0 EXIT
52 S DA=+Y
53 L +^PRCS(410,DA):1 ; Lock new ien
54 I '$T W !," Cannot create new number...please try again later." G EXIT
55 ;
56 ; swap transaction xrefs between iens (kill old, then set reversed)
57 ; (nodes 'B','B2','B3','AE')
58 K ^PRCS(410,"B",TX1,DA)
59 K ^PRCS(410,"B2",$P(TX1,"-",5),DA)
60 K ^PRCS(410,"B3",$P(TX1,"-",2)_"-"_$P(TX1,"-",5),DA)
61 K ^PRCS(410,"AE",$P(TX1,"-",1,4),DA)
62 K ^PRCS(410,"B",OTNUM,ODA)
63 K ^PRCS(410,"B2",$P(OTNUM,"-",5),ODA)
64 K ^PRCS(410,"B3",$P(OTNUM,"-",2)_"-"_$P(OTNUM,"-",5),ODA)
65 K ^PRCS(410,"AE",$P(OTNUM,"-",1,4),ODA)
66 S ^PRCS(410,"B",OTNUM,DA)=""
67 S ^PRCS(410,"B2",$P(OTNUM,"-",5),DA)=""
68 S ^PRCS(410,"B3",$P(OTNUM,"-",2)_"-"_$P(OTNUM,"-",5),DA)=""
69 S ^PRCS(410,"AE",$P(OTNUM,"-",1,4),DA)=""
70 S ^PRCS(410,"B",TX1,ODA)=""
71 S ^PRCS(410,"B2",$P(TX1,"-",5),ODA)=""
72 S ^PRCS(410,"B3",$P(TX1,"-",2)_"-"_$P(TX1,"-",5),ODA)=""
73 S ^PRCS(410,"AE",$P(TX1,"-",1,4),ODA)=""
74 ;
75CK1 ; set old txn name into new ien, new txn nam into old (original) ien
76 ;
77 S $P(^PRCS(410,DA,0),"^")=OTNUM
78 S $P(^PRCS(410,ODA,0),"^")=TX1
79 S PRC("OCP")=$P(^PRCS(410,ODA,3),U)
80 ; cancel txn at new ien; force old site & CP info into new ien
81 S DIE="^PRCS(410,",DR=".5///"_+OTNUM_";S X=X;15///"_$$EXPANDCP(+OTNUM,OCP)
82 S DR=DR_";60///Transaction "_OTNUM_" replaced by trans. "_TX1
83 S DR=DR_";450///C" ;put cancel flag in Running Bal status
84 D ^DIE
85 I T5'="" S $P(^PRCS(410,DA,0),U,10)=T5 ; save substation in new ien
86 S $P(^PRCS(410,DA,0),U,2)="CA" ; cancel txn at new ien
87 D ERS410^PRC0G(DA_"^C")
88 D W5^PRCSEB ; kill flags & x-refs indicating cancel txn is ready to approve
89 L -^PRCS(410,DA) ; release new ien
90 I $D(^PRC(443,ODA,0)) S DA=ODA,DIK="^PRC(443," D ^DIK K DA,DIK
91EN S PNW=ODA,PNW(1)=TX1
92 N A,B
93 S A=TX1 D RBQTR ; returns B for DR string (RB Qrtr date)
94 S DA=PNW,DR=B_$S(+OTNUM:"1///"_T4,1:"")_$S(PRC("SITE")'=+OTNUM:";S X=X;.5///"_PRC("SITE"),1:"")_$S(PRC("CP")'=CURFCP:";S X=X;15///"_PRC("CP"),1:"")_$S($D(PRCSIP):";4////"_PRCSIP,1:"")
95 D ^DIE
96 S PRC("ACC")=$$ACC^PRC0C(PRC("SITE"),PRC("CP")_"^"_PRC("FY")_"^"_PRC("BBFY"))
97 S PRCSAPP=$P(PRC("ACC"),"^",11)
98 S $P(^PRCS(410,DA,3),"^")=PRC("CP")
99 S $P(^PRCS(410,DA,3),"^",2)=PRCSAPP
100 S $P(^PRCS(410,DA,3),"^",12)=$P(PRC("ACC"),"^",3)
101 S $P(^PRCS(410,DA,3),"^",11)=$P($$DATE^PRC0C(PRC("BBFY"),"E"),"^",7)
102 N MYY S MYY="" D EN2B^PRCSUT3 ; save substation & process with status of entered
103 D K^PRCSUT1 ; kill 'F', 'F1', x-refs
104 S (DA,PRCS,PRCSY)=PNW
105EN1 K PRCSQ
106 L -^PRCS(410,ODA)
107 G EXIT
108EXIT I $D(ODA) L -^PRCS(410,ODA)
109 K PRC("ACC"),PRC("OCP")
110 Q
111 ;
112RBQTR N C,D S B="",B=$S(B="":$P(A,"-",2)_"^F",1:+$$DATE^PRC0C(B,"I"))
113 S C=$$QTRDT^PRC0G($P(A,"-",1)_"^"_$P(A,"-",4)_"^"_B)
114 S D=$$QTRDATE^PRC0D($P(A,"-",2),$P(A,"-",3)),D=$P(D,"^",7)
115 S B=$S(D<$P(C,"^",3):$P(C,"^",3),$P(C,"^",2)<D:$P(C,"^",2),1:D)
116 S B="449////"_B_";"
117 QUIT
118 ;
119EXPANDCP(STA,CP) ;RETURN FULL CP NAME BASED ON CP NUMBER AND STATION #
120 N Z
121 S Z=$P($G(^PRC(420,STA,1,+CP,0)),"^",1)
122 I (Z="") S Z=CP
123 Q Z
Note: See TracBrowser for help on using the repository browser.