source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENPLS.m@ 1720

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

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1ENPLS ;WISC/SAB-SELECT PROJECTS ;8/17/95
2 ;;7.0;ENGINEERING;**23**;Aug 17, 1993
3EN(ENTY,ENLK) ; Entry Point
4 ; input variables
5 ; (optional) ENTY - type of projects (F,A,R)
6 ; (optional) ENLK - true if selected projects should be locked
7 ; output variables
8 ; ^TMP($J,"L")=project count^current year of FYFP if ENTY="F"
9 ; ^TMP($J,"L",project number)=ien
10 ;
11 N ENC,ENDA,ENFY,ENPN,ENSEL,ENSN
12 K ^TMP($J,"L")
13 I "^F^A^R^"'[(U_$G(ENTY)_U) S ENTY="",ENSEL=1
14 S ENLK=$G(ENLK)
15 I ENTY]"" D G:$D(DIRUT) EXIT S ENSEL=Y
16 . S DIR("A")="Choose method of project selection"
17 . S DIR(0)="S^1:INDIVIDUAL PROJECTS"
18 . S:ENTY="F" DIR(0)=DIR(0)_";2:FROM LIST OF FYFP PROJECTS RETURNED TO SITE"
19 . S:ENTY="F" DIR(0)=DIR(0)_";3:ALL PROJECTS IN FIVE YEAR FACILITY PLAN"
20 . S:ENTY="A" DIR(0)=DIR(0)_";2:FROM LIST OF PROJECT APPLICATIONS RETURNED TO SITE"
21 . S:ENTY="A" DIR(0)=DIR(0)_";3:SELECTED PROJECTS FROM PROGRAM-YEAR LIST"
22 . S:ENTY="R" DIR(0)=DIR(0)_";2:ALL PROJECTS WITH MONTHLY UPDATES = YES"
23 . D ^DIR K DIR
24 ; need year for FYFP
25 I ENTY="F" D G:$D(DIRUT) EXIT
26 . S DIR(0)="N^1993:2099:0",DIR("A")="Budget Year of 5-Yr Plan"
27 . S DIR("?")="Enter the 4-digit Budget Year of the Plan"
28 . S DIR("B")=$E(17000000+DT,1,4)+$S($E(DT,4,7)>0600:2,1:1)
29 . D ^DIR K DIR Q:$D(DIRUT)
30 . S ENFY=Y-1
31 I ENSEL=1 D I $D(DTOUT)!$D(DUOUT) D:ENLK UNLOCK K ^TMP($J,"L") G EXIT
32 . ; individual projects chosen
33 . S ENC=0
34 . S DIC=6925,DIC(0)="AQEM",DIC("A")="Select PROJECT NUMBER: "
35 . F D ^DIC Q:Y'>0 S ENDA=+Y D
36 . . S ENPN=$P($G(^ENG("PROJ",ENDA,0)),U) Q:ENPN']""
37 . . I ENLK L +^ENG("PROJ",ENDA):10 I '$T W !,"Another user is editing this project. Can't select.",$C(7) Q
38 . . S ^TMP($J,"L",ENPN)=+Y,ENC=ENC+1
39 . K DIC
40 . S:ENC ^TMP($J,"L")=ENC_$S(ENTY="F":U_ENFY,1:"")
41 I ENTY="F",ENSEL=2 D RET,LOCK:ENLK ; returned FYFP projects
42 I ENTY="F",ENSEL=3 D G:$D(DIRUT)!$D(DTOUT)!$D(DUOUT) EXIT D:ENLK LOCK
43 . ; FYFP projects chosen
44 . S DIC="^DIC(4,",DIC(0)="AEMQ",DIC("B")=$P($G(^DIC(6910,1,0)),U,2)
45 . D ^DIC K DIC I Y<1!$D(DTOUT)!$D(DUOUT) Q
46 . S ENSN=$E($$GET1^DIQ(4,+Y_",",99),1,3)
47 . D FYFP^ENPLS1(ENSN,ENFY)
48 I ENTY="A",ENSEL=2 D RET,LOCK:ENLK ; returned project applications
49 I ENTY="A",ENSEL=3 D PYLIST^ENPLS2,LOCK:ENLK ; program,year project list
50 I ENTY="R",ENSEL=2 D D LOCK:ENLK
51 . ; monthly updates chosen
52 . S (ENC,ENDA)=0 F S ENDA=$O(^ENG("PROJ",ENDA)) Q:'ENDA D
53 . . S ENPN=$$GET1^DIQ(6925,ENDA_",",.01) Q:ENPN=""
54 . . I $$GET1^DIQ(6925,ENDA_",",2.5)="YES" S ^TMP($J,"L",ENPN)=ENDA,ENC=ENC+1
55 . S:ENC ^TMP($J,"L")=ENC
56 I '$D(^TMP($J,"L")) W !,"No projects selected!",$C(7) G EXIT
57EXIT ; Exit
58 K DIC,DIR,DIRUT,DTOUT,DUOUT,DIROUT,X,Y
59 Q
60RET ; Select from Returned projects
61 N ENACL,ENC,ENDA,ENFLD,ENI,ENJ,ENK,ENPN,ENPR,ENY,ENY0
62 K ^TMP($J,"R")
63 S ENFLD=$S(ENTY="F":181.1,ENTY="A":251,1:"")
64 ; find,sort returned projects
65 S ENDA=0
66 F S ENDA=$O(^ENG("PROJ",ENDA)) Q:'ENDA D
67 . Q:$$GET1^DIQ(6925,ENDA_",",ENFLD)'="RETURNED TO SITE"
68 . S ENY0=$G(^ENG("PROJ",ENDA,0)) Q:$P(ENY0,U)=""!($P(ENY0,U,6)="")
69 . S ^TMP($J,"R",$P(ENY0,U,6),$P(ENY0,U))=$P(ENY0,U)_U_$P(ENY0,U,6)_U_$P(ENY0,U,3)_U_ENDA
70 I '$D(^TMP($J,"R")) W !!,"No 'Returned' Projects Found!",! G RETEX
71 S ENI=0,ENPR=""
72 F S ENPR=$O(^TMP($J,"R",ENPR)) Q:ENPR="" S ENPN="" F S ENPN=$O(^TMP($J,"R",ENPR,ENPN)) Q:ENPN="" S ENI=ENI+1,^TMP($J,"SCR",ENI)=^(ENPN)
73 S:ENTY="F" ^TMP($J,"SCR")=ENI_U_"RETURNED Five Year Plan Projects"
74 S:ENTY="A" ^TMP($J,"SCR")=ENI_U_"RETURNED Project Applications"
75 S ^TMP($J,"SCR",0)="5;11;PROJECT #^19;7;PROGRAM^29;50;TITLE"
76 D ^ENPLS2
77 ; save selected projects (if any)
78 S ENC=0,ENJ="" F S ENJ=$O(ENACL(ENJ)) Q:ENJ="" D
79 . F ENK=1:1 S ENI=$P(ENACL(ENJ),",",ENK) Q:ENI="" D
80 . . S ENY=^TMP($J,"SCR",ENI),^TMP($J,"L",$P(ENY,U))=$P(ENY,U,4),ENC=ENC+1
81 S:ENC ^TMP($J,"L")=ENC_$S(ENTY="F":U_ENFY,1:"")
82RETEX ; exit
83 K ^TMP($J,"R"),^TMP($J,"SCR")
84 Q
85LOCK ; Lock List
86 N ENDA,ENDEL,ENPN
87 S ENDEL=0
88 S ENPN="" F S ENPN=$O(^TMP($J,"L",ENPN)) Q:ENPN="" D
89 . S ENDA=$P(^TMP($J,"L",ENPN),U)
90 . L +^ENG("PROJ",ENDA):10 I '$T S ENDEL=1 W !,"Project ",ENPN," is currently being edited!"
91 I ENDEL D UNLOCK K ^TMP($J,"L")
92 Q
93UNLOCK ; Unlock List
94 N ENDA,ENPN
95 S ENPN="" F S ENPN=$O(^TMP($J,"L",ENPN)) Q:ENPN="" D
96 . S ENDA=$P(^TMP($J,"L",ENPN),U)
97 . L -^ENG("PROJ",ENDA)
98 Q
99 ;ENPLS
Note: See TracBrowser for help on using the repository browser.