source: FOIAVistA/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCSUT1.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: 5.3 KB
Line 
1PRCSUT1 ;SF-ISC/LJP/KSS/KMB/DGL-CONTROL POINT UTILITY ROUTINE ;8/25/00 16:45
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;find #requests to approve/process, ACTION FOR 'PRCSCP OFFICIAL' OPTION.
5 N PRC,PRCSAMT,PRCSCT,PRCSDA,PRCSI,PRCSJ,PRCSK,PRCSKS,PRCSVAR
6 ; APPREQ=1 if user entered from approve requests procedure [PRCSAPP]
7 Q:'$D(DUZ) S (PRC("CP"),PRC("SITE"))=0,U="^"
8 ;
9 F PRCSI=0:0 D Q:PRC("SITE")'>0 ; for each station the user accesses
10 . S PRC("SITE")=$O(^PRC(420,"A",DUZ,PRC("SITE")))
11 . Q:PRC("SITE")'>0
12 . ;
13 . F PRCSJ=0:0 D Q:PRC("CP")'>0 ; and for each CP at that station
14 . . S PRC("CP")=$O(^PRC(420,"A",DUZ,PRC("SITE"),+PRC("CP")))
15 . . Q:PRC("CP")'>0
16 . . I $D(^PRC(420,"A",DUZ,PRC("SITE"),+PRC("CP"),1)) D
17 . . . ;
18 . . . ; if the user is an official for that station and CP
19 . . . S (PRCSAMT,PRCSCT)=0 ; $value,counter
20 . . . S PRCSVAR=PRC("SITE")_"-"_+PRC("CP")
21 . . . S PRCSKS=PRCSVAR_"-"_0 ; station-CP-counter
22 . . . ;
23 . . . F PRCSK=0:0 D Q:PRCSK=1 ; find all txns to be approved
24 . . . . S PRCSKS=$O(^PRCS(410,"F",PRCSVAR_"-"_$P(PRCSKS,"-",3)))
25 . . . . I $P(PRCSVAR,"-",1,2)'=$P(PRCSKS,"-",1,2)!(PRCSKS="") S PRCSK=1 Q
26 . . . . S PRCSDA=$O(^PRCS(410,"F",PRCSKS,0)) ; get ien
27 . . . . Q:PRCSDA'>0
28 . . . . I $$MAINT(PRCSKS,PRCSDA)=1 Q ; pointer values are wrong
29 . . . . S PRCSCT=PRCSCT+1
30 . . . . I $D(^PRCS(410,PRCSDA,4))
31 . . . . I S PRCSAMT=PRCSAMT+$S($P(^PRCS(410,PRCSDA,4),U):$P(^PRCS(410,PRCSDA,4),U),$P(^PRCS(410,PRCSDA,0),U,2)="A"&($P(^PRCS(410,PRCSDA,0),U,4)=1):$P(^PRCS(410,PRCSDA,4),U,6),1:0)
32 . . . ;
33 . . . Q:'PRCSCT ; no txns awaiting approval
34 . . . I $D(APPREQ) S CPCK(PRC("CP"))="" Q
35 . . . W !,"You have "_PRCSCT_" request(s) to approve in station "_PRC("SITE")_", CP ",PRC("CP"),?60,"$: "_$J(PRCSAMT,9,2)
36 . . . Q
37 . . . ;
38 . . Q:$D(APPREQ)
39 . . ; if user is a clerk for this site and CP check processing queue
40 . . I $D(^PRC(420,"A",DUZ,PRC("SITE"),+PRC("CP"),2)) D CHECK^PRCSRDIS
41 ;
42 Q
43MAINT(TN,DA) ; returns 1 if 'F' subscripts inconsistent with master file data
44 ; TN = Transaction name, DA = ien
45 ; kills x-refs that are not correct
46 N X,Y,U
47 S Y=0 ; flag=0 if maintenance not required
48 S U="^"
49 I '$D(^PRCS(410,DA,0)) S Y=1 G MAINTQ ; shouldn't the xrefs be killed?
50 ; if document is signed by an aproving official, kill xrefs
51 I $D(^PRCS(410,DA,7)),$P(^PRCS(410,DA,7),U,6)]"" S Y=1 D KXREF G MAINTQ
52 ; if document is not ready for approval, kill x-refs
53 I $S('$D(^PRCS(410,DA,11)):1,'$P(^PRCS(410,DA,11),U,3):1,1:0)
54 I S Y=1 D KXREF G MAINTQ
55 S X=$P($P(^PRCS(410,DA,0),U),"-",4,5)
56 ; if the CP or counter in 'F' differs from txn name at ien in 410 file
57 I +$P(X,"-")'=$P(TN,"-",2)!($P(X,"-",2)'=$P(TN,"-",3))
58 I S Y=1
59 I K ^PRCS(410,"F",TN,DA)
60 I K ^PRCS(410,"F1",$P(TN,"-",3)_"-"_$P(TN,"-",1,2),DA)
61MAINTQ Q Y
62KXREF ;KILL F,F1 AND AQ CROSS REFERENCES
63 K ^PRCS(410,"F",PRC("SITE")_"-"_+PRC("CP")_"-"_$P($P(^PRCS(410,DA,0),U),"-",5),DA)
64 K ^PRCS(410,"F1",$P($P(^PRCS(410,DA,0),U),"-",5)_"-"_PRC("SITE")_"-"_+PRC("CP"),DA)
65 K ^PRCS(410,"AQ",1,DA)
66 Q
67 ;
68K ;
69 S X=+T2_"-"_+$P(T2,"-",4)_"-"_$P(T2,"-",5)
70 K ^PRCS(410,"F",X,DA)
71 S X=$P(X,"-",3)_"-"_$P(X,"-",1,2)
72 K ^PRCS(410,"F1",X,DA)
73 Q
74 ;
75CPF(PRCIPFLG) ; Entry point for Inv. Pt. selection
76CP ;CONTROL POINT SCREEN FROM MENU
77 I '$G(PRCIPFLG) N:'$D(PRCIPFLG) PRCIPFLG S PRCIPFLG=0
78 K PRCSIP ; inventory distribution point variable
79 S DIC="^PRC(420,"_PRC("SITE")_",1,"
80 S DIC(0)="AEMNQZ"
81 S DIC("A")="Select CONTROL POINT: "
82 I $D(PRC("CP")) S DIC("B")=$S($D(^PRC(420,"A",DUZ,PRC("SITE"),+PRC("CP"),PRCSC)):PRC("CP"),1:"")
83 S DIC("S")="I '$P(^(0),U,19),$S($D(^PRC(420,""A"",DUZ,PRC(""SITE""),+Y,PRCSC)):1,"
84 I PRCSC=1 S DIC("S")=DIC("S")_"$O(^PRC(420,""A"",DUZ,PRC(""SITE""),+Y,0))=(PRCSC+1):1,1:0)"
85 I PRCSC=2 S DIC("S")=DIC("S")_"$D(^PRC(420,""A"",DUZ,PRC(""SITE""),+Y,PRCSC)):1,1:0)"
86 I PRCSC=3 S DIC("S")=DIC("S")_"$P(^PRC(420,PRC(""SITE""),1,+Y,0),U,9)=""Y""!($O(^PRC(420,""A"",DUZ,PRC(""SITE""),+Y,0))>0):1,1:0)"
87 I PRCSC=4 K DIC("S")
88 S D="B^C" D MIX^DIC1 K DIC("A"),DIC("B"),DIC("S")
89 Q:Y<0
90 S PRC("CP")=$P(Y(0),U)
91 I PRCIPFLG=1 D IP^PRCSUT
92 Q
93PRT ;REQUESTS TO BE APPROVED LIST
94 D EN3^PRCSUT
95 G W2^PRCSEB:'$D(PRC("SITE"))
96 G END:Y<0
97 S L=0,DIC="^PRCS(410,"
98 S FLDS="[PRCS REQUESTS FOR APPROVAL]"
99 S BY="'55"
100 S (FR,TO)=""
101 S DIS(0)="I $D(^PRCS(410,D0,0)),$P($G(^PRCS(410,D0,0)),""-"")=PRC(""SITE""),$P(^(0),""-"",4)=$P(PRC(""CP""),"" ""),$P($G(^PRCS(410,D0,1)),U,2)="""""
102 D EN1^DIP
103 R !,"Press return to continue or uparrow to exit: ",X:DTIME,!
104 Q:('$T)!(X'="")
105 G PRT
106END Q
107RL ;RENUMBER LINE ITEMS
108 K I
109 I $D(^PRCS(410,DA,"IT",0)) K ^("AB"),^("B") S Z=0 F I=1:1 S Z=$O(^PRCS(410,DA,"IT",Z)) Q:Z'>0 S L=^(Z,0) S ^(0)=I_U_$P(^(0),U,2,99) S ^PRCS(410,DA,"IT","B",I,Z)="",^PRCS(410,DA,"IT","AB",I,Z)=""
110 S I=$S($D(I):I-1,1:0)
111 S ^PRCS(410,DA,10)=$S($D(^PRCS(410,DA,10)):I_U_$P(^(10),U,2,99),1:I)
112 K I,L,Z
113 Q
114RLR ;RENUMBER LINE ITEMS IN REP ITEM LIST FILE
115 K I,L
116 Q:'$D(^PRCS(410.3,D0,1,0))
117 K ^("AC"),^("B")
118 S (PRCSCS,Z)=0
119 F I=1:1 S Z=$O(^PRCS(410.3,D0,1,Z)) Q:Z'>0 S L(I)=^(Z,0) K ^PRCS(410.3,D0,1,Z,0)
120 K Z
121 S I=0
122 F J=1:1 S I=$O(L(I)) Q:I'>0 S Z=L(I),^PRCS(410.3,D0,1,J,0)=+Z_U_$P(Z,U,2,99) S PRCSCS=PRCSCS+($P(Z,U,2)*$P(Z,U,4)),^PRCS(410.3,D0,1,"AC",$P(Z,U,3),I)="",^PRCS(410.3,D0,1,"B",+Z,I)=""
123 S $P(^PRCS(410.3,D0,1,0),U,3,4)=(J-1)_U_(J-1),$P(^PRCS(410.3,D0,0),U,2)=PRCSCS
124 K I,L,PRCSCS,Z
125 Q
Note: See TracBrowser for help on using the repository browser.