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

NURAR1A.m

Go to the documentation of this file.
NURAR1A ;HIRMFO/MD,FT-ACCUMULATES FTEE TOTALS AND RUNS SVC. AMIS 1106b REPORT ;9/18/96  16:57
 ;;4.0;NURSING SERVICE;;Apr 25, 1997
HSKEEP ;
 S X=$G(^DIC(213.9,1,"OFF"))  Q:X=""!(X=1)
 S (NODATSW,NUROUT,NURQUEUE,NURMDSW,NURSW1,NURPAGE)=0
 D EN9^NURSAGSP I NURMDSW W ! S DIC(0)="AEMQZ" D EN8^NURSAGSP G QUIT:NUROUT
 I 'NURMDSW S NDA=1,NURFAC=+$G(^NURSA(213.2,NDA,0)),NURFAC("F")=$$GET1^DIQ(4,+NURFAC,.01,"I") D NEXT
 I NURMDSW,$G(NURFAC)=1 S NDA=0 F  S NDA=$O(^NURSA(213.2,NDA)) Q:NDA'>0  S NURFAC("F")=$$GET1^DIQ(4,+$G(^NURSA(213.2,NDA,0)),.01,"I") D NEXT
 I NURMDSW,$G(NURFAC)=0 S NDA=+Y,NURFAC("F")=$$GET1^DIQ(4,+$G(^NURSA(213.2,NDA,0)),.01,"I") D NEXT
 I $G(NURFACSW)=1 S NURFAC=0 ;switch NURFAC to 0, not all divisions have data
 W !!,?19,"THIS REPORT WILL COMPARE THE BUDGETED FTEE"
 W !,?14,"TOTALS ENTERED IN THE NURS AMIS 1106B FTEE (#213.2) FILE"
 W !,?10,"AGAINST TODAY'S CURRENT FTEE ENTRIES FOR AMIS SEGMENT 202 (1106B)"
 ; QUEUE JOB TO TASKMAN
 W ! S (ZTSAVE("NURSW1"),ZTSAVE("NURPAGE"),ZTSAVE("NURFAC*"))="",ZTRTN="START^NURAR1A" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
 S DA(2)=0 F  S DA(2)=$O(^NURSF(211.8,"C",DA(2))) Q:DA(2)'>0  D
 . S Z=0,Z=$O(^NURSF(210,"B",DA(2),0)) Q:Z=""  D:$P($G(^NURSF(210,Z,0)),U,2)="A"
 . . S DA(1)=0 F  S DA(1)=$O(^NURSF(211.8,"C",DA(2),DA(1))) Q:DA(1)'>0  S DA=0 F  S DA=$O(^NURSF(211.8,"C",DA(2),DA(1),DA)) Q:DA'>0  D
 . . . S DA(4)=$P($G(^NURSF(211.8,DA(1),0)),U) Q:DA(4)'>0  I $D(^NURSF(211.4,"B",DA(4))) S DA(5)=0,DA(5)=$O(^NURSF(211.4,"B",DA(4),0)) I $S('$D(^NURSF(211.4,DA(5),"I")):1,$P(^("I"),U)="A":1,1:0) D
 . . . . W:$E(IOST)="C"&($R(500)) "." S NDATA=$G(^NURSF(211.8,DA(1),1,DA,0)) S NDATA(1)=$S($$EN11^NURSUT3(DA(1))'="":$$EN11^NURSUT3(DA(1)),1:"  BLANK")
 . . . . I $S('+$P(NDATA,U,4):1,+$P(NDATA,U)>DT:1,+$P(NDATA,U,6)&(+$P(NDATA,U,6)<DT):1,1:0) Q
 . . . . I NURMDSW,$G(NURFAC)=0,$G(NDATA(1))'="  BLANK",$G(NDATA(1))'=$G(NURFAC(1)) Q
 . . . . I 'NURMDSW,$G(NDATA(1))'=$G(NURFAC("F")) Q
 . . . . S NFTEE=+$P(NDATA,U,4),NURSCAT=$S($D(^NURSF(211.3,+$P(NDATA,U,3),0)):$P(^(0),U,5),1:""),NAMIS=$S($D(^NURSF(211.3,+$P(NDATA,U,3),0)):+$P(^(0),U,4),1:0)
 . . . . I '+NAMIS,NURSCAT="R",$D(^NURSF(211.3,+$P(NDATA,U,3),0)) W !,"THE AMIS POSITION FIELD FOR THE "_$P(^(0),U)_" ENTRY IN THE NURS SERVICE POSITION FILE,",!,"#211.3 MUST BE FILLED IN TO GENERATE THIS REPORT",! S NUROUT=1 Q
 . . . . S NURSCAT(1)=$S(NURSCAT="R":1,NURSCAT="L":2,NURSCAT="N":3,NURSCAT="C":4,NURSCAT="A":5,1:0)
 . . . . I NURSCAT="R" D
 . . . . . I NDATA(1)'="  BLANK" S NFCNT(NDATA(1),NAMIS)=NFCNT(NDATA(1),NAMIS)+NFTEE
 . . . . . E  S:'$D(NFCNT("  BLANK",NAMIS)) NFCNT("  BLANK",NAMIS)=0 S NFCNT("  BLANK",NAMIS)=NFCNT("  BLANK",NAMIS)+NFTEE
 . . . . . Q
 . . . . I NDATA(1)'="  BLANK",+NURSCAT(1) S NFCNT(NDATA(1),NURSCAT(1))=NFCNT(NDATA(1),NURSCAT(1))+NFTEE
 . . . . I NDATA(1)="  BLANK",+NURSCAT S:'$D(NFCNT("  BLANK",NURSACT(1))) NFCNT("  BLANK",NURSCAT(1))=0 S NFCNT("  BLANK",NURSCAT(1))=NFCNT("  BLANK",NURSCAT(1))+NFTEE
 . . . . Q
 . . . Q
 . . Q
 . Q
 U IO S NY="" F  S NY=$O(NFCNT(NY)) Q:NY=""  D HEADER Q:NUROUT  D  Q:NUROUT
 . S NDA=$P($G(NFCNT(NY,"DATE")),U,2) S NZ=0 F  S NZ=$O(^DD(213.2,NZ)) Q:NZ'>0!NUROUT  S X=$$VFIELD^DILFD(213.2,NZ) I NZ'<1,NZ'>20,X D  Q:NUROUT
 . . I 'NURSW1!($E(IOST)="C"&($Y>(IOSL-5))) D HEADER Q:NUROUT
 . . S ND=$S(NZ<17:0,1:.5),ND(1)=$S(NZ<17:$P($G(^NURSA(213.2,+NDA,ND)),U,NZ+1),1:$P($G(^NURSA(213.2,+NDA,ND)),U,NZ-16)) D FIELD^DID(213.2,NZ,"","LABEL","X"),FIELD^DID(213.2,NZ+20,"","LABEL","Y")
 . . I $D(NFCNT(NY,NZ)) D
 . . . W !,$P(X("LABEL"),"BUDGETED ",2),?24,$P(X("LABEL")," "),?29,$J(ND(1),8,3),?43,$P(Y("LABEL")," "),?48,$J(NFCNT(NY,NZ),8,3)
 . . . W ?65,$J((NFCNT(NY,NZ)-ND(1)),9,3)
 . . . Q
 . . Q
 . Q
QUIT ;
 D CLOSE^NURSUT1,^NURAKILL
 Q
 S NURPAGE=NURPAGE+1,Y=+$G(NFCNT(NY,"DATE")) D:+Y D^DIQ S NURSDATE=Y I $E(IOST)="C"!(NURPAGE>1) W @IOF
 W ! S X="T" D ^%DT D:+Y D^DIQ W ?2,Y,?65,"PAGE: ",NURPAGE
 W ! I NURMDSW W ?$$CNTR^NURSUT2(NY),$S(NY="  BLANK":"NO FACILITY",1:NY)
 W !,?2,"AMIS 10-1106B  (SEGMENT 202) CEILING (FTEE) ENTERED ON "_NURSDATE
 W !,?2,"AND POSITIONS FILLED (FTEE)"
 W !!,"POSITION",?29,"BUDGETED",?50,"ACTUAL",?66,"VARIANCE"
 W !,"--------",?29,"--------",?50,"------",?66,"--------"
 S NURSW1=1
 Q
NEXT ;
 S NODATSW=0
 I '$D(^NURSA(213.2,NDA,0))!('$D(^NURSA(213.2,NDA,1)))!('$D(^NURSA(213.2,NDA,.5))) S NODATSW=1
 I NODATSW=0 S:$P(^NURSA(213.2,NDA,1),U,11)="" NODATSW=1 F NURI=1:1:17 S:$P(^NURSA(213.2,NDA,0),U,NURI)="" NODATSW=1
 I NODATSW=0 F NURI=1:1:4 S:$P(^NURSA(213.2,NDA,.5),U,NURI)="" NODATSW=1
 I NODATSW=1 D  Q
 .W !!,$C(7),"*** YOU ARE MISSING DATA IN THE "_NURFAC("F"),!,"    AMIS 1106B FTEE (213.2) FILE ENTRY.",!,"    CONTACT THE NURSING APPLICATION COORDINATOR.",!
 .S:(NURMDSW&($G(NURFAC)=1)) NURFACSW=1 ;set flag to change NURFAC from 1 to 0
 .Q
 I NURMDSW,'$G(NURFAC),NURFAC("F")'=NURFAC(1) Q
 F NURI=1:1:20 S NFCNT(NURFAC("F"),NURI)=0
 S:'+$G(NFCNT(NURFAC("F"),"DATE")) NFCNT(NURFAC("F"),"DATE")=$P(^NURSA(213.2,NDA,1),U,11)_U_NDA
 S NBUDCK=$P(^NURSA(213.2,NDA,0),U,2)
 S NBUDCK1=0
 F NURI=7:1:17 S NBUDCK1=NBUDCK1+$P(^NURSA(213.2,NDA,0),U,NURI)
 F NURI=1:1:4 S NBUDCK1=NBUDCK1+$P(^NURSA(213.2,NDA,.5),U,NURI)
 I NBUDCK'=NBUDCK1 W !!!,"INCORRECT BUDGET ENTRIES EXIST IN "_NURFAC("F")_":",!,"NUMBER OF RN'S BUDGETED MUST EQUAL SUM OF",!,"CATEGORIES 06 THRU 20 (E.G. CLIN SPECIALIST, RN PRACTITIONER, ETC.",!,"CONTACT NURSING APPLICATION COORDINATOR" Q
 Q