Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: NURA9D11

NURA9D11.m

Go to the documentation of this file.
NURA9D11 ;HIRMFO/MD-SORT ROUTINE FOR NS BUDGETED/ACTUAL FTEE BY WARD ;8/23/96  12:05
 ;;4.0;NURSING SERVICE;**3,7,13,22**;Apr 25, 1997
EN1 ; BUILD LOC-SER.CAT.-SPEC. SORT
 S NURNEN=3
 I 'NURHOSP D  G Q
 .; BUILD SORT FROM NURSING "B" XREF
 .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
 ..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
 ...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
 ...Q
 ..Q
 .Q
 D ACSORT,EN4^NURSAUTL:NURSZAP=7
 G Q
EN2 ; SER.CAT-SPEC. SORT
 D ACSORT,EN4^NURSAUTL:NURSZAP=7
Q K D0,DA,NURNEN,NLOCN,NNM,NPRI,NURSCATY,NSPEC,NPODA,NSPOSN,NURSZORT,NPWARD,NURNODE4,NUREQWRD,NURCAT,NURFLAG,NURSCAT
 Q
ACSORT ; BUILD SORT FROM NURSING "AC" & "C" XREF
 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
 .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
 .Q
 Q
SETVAR ; SET SUBSCRIPTS FOR GLOBAL SET
 S NURSZORT=1 D EN3^NURSAUTL:NURSZAP>6,EN2^NURSAUTL:NURSZORT&NURSZAP
 Q:'NURSZORT
 ; SET LOCATION VARIABLE  NLOCN
 I NURNEN=3 D
 .S NLOCN=$S($D(^NURSF(211.8,NURNODE4,0)):$P(^(0),U),1:"")
 .I +NLOCN S NPWARD=NLOCN D EN7^NURSAUTL S NLOCN(1)=$S(NPWARD'="":$E(NPWARD,1,10),1:" BLANK")
 .Q
 ; SET FACILITY VARIABLE NURFAC(2),PRODUCT LINE VARIABLE NURPROG(2), AND
 ; CATEGORY VARIABLE NURSCATY
 D SETPROG^NURAAGS1,SETFAC^NURAAGS1 D:$G(NURNEN)=2 SETPOS^NURAAGS1 D:NURNEN=1!($G(NURNEN)=3) SETCAT^NURAAGS1
 I (NURNEN=1!(NURNEN=3)),$E($G(NURSCATY))="O",$P($G(NURSCATY),"O ",2)="" S NURSCATY="O"
 I NURMDSW,'$G(NURFAC),$G(NURFAC(1))'=$G(NURFAC(2)) Q
 I NURPLSW,'$G(NURPROG),$G(NURPROG(1))'=$G(NURPROG(2)) Q
 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
 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
 I NURNEN=3,$G(NURHOSP)=0,'$D(NURSNLOC(NLOCN(1))) Q
 I NURPLSW S:NURPROG(2)="NURSING" NURPROG(2)=" NURSING"
 I $D(^VA(200,DA(1),0)),$P(^(0),U,1)'="" S NNM=$P(^(0),U,1)
 E  S NNM="  BLANK"
 K NSPEC
 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)
 I '$D(NSPEC) S NSPEC="  BLANK"
 I 'NSP,NSPC'=NSPEC Q
 ; BUILD TMP ARRAY
 W:$E(IOST)="C"&($R(100)) "." S:$G(NURSORT)="" NURSORT=1
 I NURNEN=3 D
 .N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC))
 .I X="" S X=NURSORT,NURSORT=NURSORT+1 S ^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC)=X
 .S ^TMP($J,"L1",X,NNM,NURNODE4,NURNODE5,DA)=""
 .Q
 I NURNEN=1 D
 .N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,DA,NURNODE4))
 .I X="" S X=NURSORT,NURSORT=NURSORT+1 S ^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,DA,NURNODE4)=X
 .S ^TMP($J,"L1",X,NNM,NURNODE5)=""
 .Q
 I NURNEN=2 D
 .N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC,DA,NURNODE4))
 .I X="" S X=NURSORT,NURSORT=NURSORT+1 S ^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC,DA,NURNODE4)=X
 .S ^TMP($J,"L1",X,NNM,NURNODE5)=""
 .Q
 Q
CHK ;
 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)
 Q