source: WorldVistAEHR/trunk/r/EQUIPMENT_TURN_IN_REQUEST-PRCN/PRCNRNK.m@ 1800

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

initial load of WorldVistAEHR

File size: 1.9 KB
Line 
1PRCNRNK ;SSI/ALA-Rank Requests for Committee ;[ 07/19/96 10:43 AM ]
2 ;;1.0;Equipment/Turn-In Request;;Sep 13, 1996
3SELECT ; Select a transaction
4 W @IOF S DIC("S")="I $P(^(0),U,7)=10!($P(^(0),U,7)=31)",DIC="^PRCN(413,"
5 S DIC(0)="AEQZ" D ^DIC K DIC("S") G EXIT:Y<0
6 S IN=+Y,PRCNUSR=8 D SETUP^PRCNPRNT Q:$D(EDIT)
7 K DUOUT S DR="[PRCNRNK]",DIE="^PRCN(413,",DA=IN D ^DIE
8 G SELECT
9EXIT K DIC,DIE,DA,IN,PRCNUSR,PRCC,OLDRANK,LPRI,PRCNDEF,EDIT,OLD,RANKMAX
10 K DR,C,D,D0
11 Q
12RANKMAX ; Calculate maximum equipment committee rank
13 S OLDRANK=$P($G(^PRCN(413,IN,6)),U,3),(RANKMAX,I)=0
14 F S I=$O(^PRCN(413,"E",I)) Q:'I S RANKMAX=I
15 S RANKMAX=RANKMAX+1
16 Q
17EN ;Check on entered priority
18 K:+X'=X!(X>999)!(X<1)!(X?.E1"."1N.N) X
19 I $G(X)="" Q
20 ; Check if priority X already exists for this service
21 Q:'$D(^PRCN(413,"E",X))
22 Q:$D(^PRCN(413,"E",X,DA))
23 NEW I
24 I $D(^PRCN(413,"E",X)) S START=X D DOWN S DA=ORGDA
25 K START,ORGDA
26 Q
27DOWN ; Insert this transaction & shift others one priority #
28 S LPRI=RANKMAX S ORGDA=DA NEW DA S DA=ORGDA
29 S ^PRCN(413,"E",START,ORGDA)=""
30 S NXPR=START D GETDA
31 I OTHDA'="",OTHDA'=DA S NXPR=START D GETPR
32 K OTHDA,DA,NXPR,START,OLDA
33 Q
34DRANK ; Display ranks. Called as special help for rank fld.
35 W !!,"Ranking list:" S I=0,PRCNCT=0
36 F S I=$O(^PRCN(413,"E",I)) Q:'+I D Q:$G(PRCC)'=""
37 . S J=$O(^PRCN(413,"E",I,"")),PRCNCT=PRCNCT+1
38 . I PRCNCT>20 D CHKPG Q:$G(PRCC)'=""
39 . W !,I,?8,$P(^PRCN(413,J,0),U),?28,$P(^PRCN(413,J,0),U,18)
40 K I,J,PRCC,PRCNCT
41 Q
42CHKPG ; If printing to screen & it is full, clear screen
43 W !,"Hit RETURN to continue or '^' to quit. "
44 R PRCC:DTIME S:'$T PRCC=U I PRCC'?1"^".E K PRCC Q
45 S PRCNCT=0
46 Q
47GETPR S NXPR=$O(^PRCN(413,"E",NXPR))
48 I NXPR'=(START+1) S NXPR=START+1 D SETDA Q
49 I NXPR=(START+1) D SETDA S START=NXPR,DA=OTHDA D GETDA G GETPR
50 Q
51SETDA S $P(^PRCN(413,OTHDA,6),U,3)=NXPR,^PRCN(413,"E",NXPR,OTHDA)=""
52 K ^PRCN(413,"E",START,OTHDA)
53 Q
54GETDA S OLDA="" F S OLDA=$O(^PRCN(413,"E",NXPR,OLDA)) Q:OLDA="" S:OLDA'=DA OTHDA=OLDA
55 Q
Note: See TracBrowser for help on using the repository browser.