source: FOIAVistA/trunk/r/NURSING_SERVICE-NUR/NURA9D11.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1NURA9D11 ;HIRMFO/MD-SORT ROUTINE FOR NS BUDGETED/ACTUAL FTEE BY WARD ;8/23/96 12:05
2 ;;4.0;NURSING SERVICE;**3,7,13,22**;Apr 25, 1997
3EN1 ; BUILD LOC-SER.CAT.-SPEC. SORT
4 S NURNEN=3
5 I 'NURHOSP D G Q
6 .; BUILD SORT FROM NURSING "B" XREF
7 .S NURSZ="" F S NURSZ=$O(NURSNLOC(NURSZ)) Q:NURSZ="" S NURSIEN=0 F S NURSIEN=$O(NURSNLOC(NURSZ,NURSIEN)) Q:NURSIEN'>0 S NUREQWRD=+$G(NURSNLOC(NURSZ,NURSIEN)) D:+NUREQWRD
8 ..S NURNODE4=0 F S NURNODE4=$O(^NURSF(211.8,"B",NUREQWRD,NURNODE4)) Q:NURNODE4'>0 S NURNODE5=0 F S NURNODE5=$O(^NURSF(211.8,NURNODE4,1,NURNODE5)) Q:NURNODE5'>0 D CHK D:'SW
9 ...S DA(1)=$S($D(^NURSF(211.8,NURNODE4,1,NURNODE5,0)):$P(^(0),U,2),1:""),DA=$O(^NURSF(210,"B",DA(1),0)) I (+DA>0),'$D(^NURSF(210,"AC","R",+DA)) D CHKPOS^NURAAGS1 D:+NURNEN(1) SETVAR
10 ...Q
11 ..Q
12 .Q
13 D ACSORT,EN4^NURSAUTL:NURSZAP=7
14 G Q
15EN2 ; SER.CAT-SPEC. SORT
16 D ACSORT,EN4^NURSAUTL:NURSZAP=7
17Q K D0,DA,NURNEN,NLOCN,NNM,NPRI,NURSCATY,NSPEC,NPODA,NSPOSN,NURSZORT,NPWARD,NURNODE4,NUREQWRD,NURCAT,NURFLAG,NURSCAT
18 Q
19ACSORT ; BUILD SORT FROM NURSING "AC" & "C" XREF
20 S Z(1)="" F I=0:0 S Z(1)=$O(^NURSF(210,"AC",Z(1))) Q:Z(1)=""!(Z(1)="R") F DA=0:0 S DA=$O(^NURSF(210,"AC",Z(1),DA)) Q:DA'>0 I $D(^NURSF(210,DA,0)),+^(0) S DA(1)=+^(0) D
21 .F NURNODE4=0:0 S NURNODE4=$O(^NURSF(211.8,"C",DA(1),NURNODE4)) Q:NURNODE4'>0 D CHK I 'SW F NURNODE5=0:0 S NURNODE5=$O(^NURSF(211.8,"C",DA(1),NURNODE4,NURNODE5)) Q:NURNODE5'>0 D CHKPOS^NURAAGS1 D:+NURNEN(1) SETVAR
22 .Q
23 Q
24SETVAR ; SET SUBSCRIPTS FOR GLOBAL SET
25 S NURSZORT=1 D EN3^NURSAUTL:NURSZAP>6,EN2^NURSAUTL:NURSZORT&NURSZAP
26 Q:'NURSZORT
27 ; SET LOCATION VARIABLE NLOCN
28 I NURNEN=3 D
29 .S NLOCN=$S($D(^NURSF(211.8,NURNODE4,0)):$P(^(0),U),1:"")
30 .I +NLOCN S NPWARD=NLOCN D EN7^NURSAUTL S NLOCN(1)=$S(NPWARD'="":$E(NPWARD,1,10),1:" BLANK")
31 .Q
32 ; SET FACILITY VARIABLE NURFAC(2),PRODUCT LINE VARIABLE NURPROG(2), AND
33 ; CATEGORY VARIABLE NURSCATY
34 D SETPROG^NURAAGS1,SETFAC^NURAAGS1 D:$G(NURNEN)=2 SETPOS^NURAAGS1 D:NURNEN=1!($G(NURNEN)=3) SETCAT^NURAAGS1
35 I (NURNEN=1!(NURNEN=3)),$E($G(NURSCATY))="O",$P($G(NURSCATY),"O ",2)="" S NURSCATY="O"
36 I NURMDSW,'$G(NURFAC),$G(NURFAC(1))'=$G(NURFAC(2)) Q
37 I NURPLSW,'$G(NURPROG),$G(NURPROG(1))'=$G(NURPROG(2)) Q
38 I $G(NURNEN)=1!($G(NURNEN)=3),$S($E(NURSCATY)'="O":'$D(^TMP("NURSCAT",$J,NURSCATY)),$P($G(NURSCATY),"O ",2)'="":'$D(^TMP("NURSCAT",$J,$E(NURSCATY,3,99))),$P($G(NURSCATY),"O ",2)="":'$D(^TMP("NURSCAT",$J,"O")),1:0) Q
39 I NURNEN=2 S NPODA=$O(^NURSF(211.3,"B",NSPOSN,"")) Q:NPODA=""!'$D(^NURSF(211.3,+NPODA,0)) I $G(NURSER)=0,$G(NPOS),$G(NPOS)'=NPODA Q
40 I NURNEN=3,$G(NURHOSP)=0,'$D(NURSNLOC(NLOCN(1))) Q
41 I NURPLSW S:NURPROG(2)="NURSING" NURPROG(2)=" NURSING"
42 I $D(^VA(200,DA(1),0)),$P(^(0),U,1)'="" S NNM=$P(^(0),U,1)
43 E S NNM=" BLANK"
44 K NSPEC
45 Q:$S('$D(^NURSF(211.8,NURNODE4,1,NURNODE5,0)):1,NURSZAP<7:0,$D(NURSZLO($O(^NURSF(211.4,"B",+$P(^NURSF(211.8,NURNODE4,0),U),"")))):0,1:1) I $D(^NURSF(211.8,NURNODE4,1,NURNODE5,0)),$P(^(0),U,4)'="" S NSPEC=$P(^(0),U,4)
46 I '$D(NSPEC) S NSPEC=" BLANK"
47 I 'NSP,NSPC'=NSPEC Q
48 ; BUILD TMP ARRAY
49 W:$E(IOST)="C"&($R(100)) "." S:$G(NURSORT)="" NURSORT=1
50 I NURNEN=3 D
51 .N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC))
52 .I X="" S X=NURSORT,NURSORT=NURSORT+1 S ^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC)=X
53 .S ^TMP($J,"L1",X,NNM,NURNODE4,NURNODE5,DA)=""
54 .Q
55 I NURNEN=1 D
56 .N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,DA,NURNODE4))
57 .I X="" S X=NURSORT,NURSORT=NURSORT+1 S ^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,DA,NURNODE4)=X
58 .S ^TMP($J,"L1",X,NNM,NURNODE5)=""
59 .Q
60 I NURNEN=2 D
61 .N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC,DA,NURNODE4))
62 .I X="" S X=NURSORT,NURSORT=NURSORT+1 S ^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC,DA,NURNODE4)=X
63 .S ^TMP($J,"L1",X,NNM,NURNODE5)=""
64 .Q
65 Q
66CHK ;
67 S Z=0,Z=+$O(^NURSF(211.4,"B",+$G(^NURSF(211.8,NURNODE4,0)),0)) S SW=$S('$G(Z):1,$P($G(^NURSF(211.4,Z,"I")),U)="I":1,1:0)
68 Q
Note: See TracBrowser for help on using the repository browser.