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