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

NURAED2.m

Go to the documentation of this file.
NURAED2 ;HIRMFO/MD,RM,FT-EDIT FOR POSITION ;5/14/01  15:37
 ;;4.0;NURSING SERVICE;**1,33,35**;Apr 25, 1997
VALSEL ; VALIDATE SELECTIONS
 F NUR1=1:1 S NUR2=$P(NURAES,",",NUR1) Q:NUR2=""  S:NUR2="n" NUR2="N" D VAL0 Q:$G(NURSBAD)
 Q
VAL0 ;VALIDATION CONTINUED
 I NUR2="N" S NURSUL("N")="" Q
 I +NUR2>NCNT!(+NUR2<1) S NURSBAD=1 Q
 I NUR2["-",$P(NUR2,"-")'?1.N!($P(NUR2,"-",2)'?1.N0.1"@")!(+$P(NUR2,"-",2)>NCNT)!(+$P(NUR2,"-",2)<1)!(+NUR2>NCNT)!(+NUR2<1) S NURSBAD=1 Q
 I NUR2'["-",NUR2'?1.N0.1"@"!(+NUR2>NCNT)!(+NUR2<1) S NURSBAD=1 Q
 S NUR3=$S(NUR2["-":+$P(NUR2,"-",2),1:+NUR2)
 F NUR10=+NUR2:1:NUR3 S NURSUL(NUR10)=$P(NUR2,NUR3,2)
 Q
VALENT ; VALIDATE THE DATA ENTRY FOR THIS EMPLOYEE BY CALLING EN4^NURSUT2.
 N DA
 S NUR=$O(NUR("SDT","")),DA(1)=$O(NUR("SDT",+NUR,"")),DA=$O(NUR("SDT",+NUR,+DA(1),"")) Q:DA(1)'>0!(DA'>0)
 S NUR(0)=NUR("SDT",+NUR,DA(1),DA) I NUR(0)="" K NUR Q
 D EN4^NURSUT2 S:$G(NURSBAD)&'($P(NURSBAD,U,2)=5) NUROUT=1 W:$G(NURSBAD) !! D EN4^NURSUT3
 Q
VALE0 ; BUILD UP LOCAL NUR ARRAY TO USE IN TMP EN4^NURSUT2 TO
 ; VALIDATE THE ENTRY OF THESE POSITIONS.
 N DA S NUR(1)=$S($P(NURSASS(NURSANM),"^"):$P(NURSASS(NURSANM),"^"),1:9999999-NURSANM),NUR(2)=$S($P(NURSASS(NURSANM),"^",2):$P(NURSASS(NURSANM),"^",2),1:9999999-NURSANM),(DA(1),DA)=0
 S NUR(3)=$S('$D(NURSPOS(NURSANM)):$P(NURSASS(NURSANM),"^",3,14),1:NURSPOS(NURSANM)) I NUR(3)'="" D
 .I $G(NURSPOS(NURSANM))=NUR(3),'(NURSASS(NURSANM)="") D
 ..S NUR(2)=9999999
 ..S NUR(1)=$O(^NURSF(211.8,"AA",+NURSPOS(NURSANM),$P(NURSPOS(NURSANM),U,2),""))
 ..I +NUR(1)'>0 S NUR(1)=$$NEW2118(+NURSPOS(NURSANM),$P(NURSPOS(NURSANM),U,2),$P(NURSPOS(NURSANM),U,5))
 ..Q
 .  S NUR(3)=$P(NUR(3),"^",3,99) D ST1^NURSUT2
 .  Q
 I $D(NURSPOS(NURSANM)),NURSASS(NURSANM)="" D
 . N % S %=NUR("SDT",$P(NUR(3),U),NUR(1),NUR(2))
 . S NUR("SDT",$P(NUR(3),U),NUR(1),NUR(2))=$P(NURSPOS(NURSANM),"^",1,2)_%
 . S %=NUR("VDT",$S($P(NUR(3),U,6):$P(NUR(3),U,6),1:9999999),NUR(1),NUR(2))
 . S NUR("VDT",$S($P(NUR(3),U,6):$P(NUR(3),U,6),1:9999999),NUR(1),NUR(2))=$P(NURSPOS(NURSANM),"^",1,2)_%
 . Q
 Q
EN1 ; USING NURSUL(#) DETERMINE IF EDIT, ADD, DELETE AND SET NURSPOS(#)
 K NURSPOS S NURSUL="" F NURSX=0:0 S NURSUL=$O(NURSUL(NURSUL)) Q:NURSUL=""  D PROC Q:$G(NUROUT)
 Q
PROC ; PROCESS THE NURSUL(#) SELECTION
 I NURSUL="N"&(NURLS="P") D MSG^NURAED1 S MSG=1 Q
 I NURSUL(NURSUL)="@" S NURSPOS(NURSUL)="" Q
 I NURSUL(NURSUL)="",NURSUL'="N" W !!,"EDITING POSITION ",NURSUL,! S NURSOPOS=$P(NURSASS(NURSUL),"^",3,14) D EDTFLD^NURAED5 Q:$G(NUROUT)  S:NURSNPOS'=$P(NURSASS(NURSUL),"^",3,14) NURSPOS(NURSUL)=NURSNPOS Q
 I NURSUL="N" S NURSW1=0 D ADAS
 Q
ADAS ; ADD NEW ASSIGNMENTS
 W !,$C(7),"Would you like to add a new assignment" S %=$S(NURSW1:2,1:1) D YN^DICN S:%=-1 NUROUT=1 Q:$G(NUROUT)!(%=2&'$O(NURSL(0))&($D(NURSNPOS))!(%=2&'$O(NURSL(0))))
 I '% W !?5,$C(7),"ANSWER YES IF YOU WISH TO ADD A NEW ASSIGNMENT, ELSE ANSWER NO." G ADAS
 S NURSW1=1,NCNT=NCNT+1,(NURSASS(NCNT),NURSOPOS)="",$P(NURSOPOS,"^",4)=NID D EDTFLD^NURAED5 I $G(NUROUT) S NCNT=NCNT-1 Q
 S NURSPOS(NCNT)=NURSNPOS
 G ADAS
NEW2118(NURNLOC,NURNCAT,NURNPOS) ; Function that adds a new entry to the
 ; NURS POSITION CONTROL (#211.8) file.
 ; NURNLOC - the .01 value of the entry (i.e., FILE 44 pointer value)
 ; NURNCAT - the service category code (e.g., "R" for registered nurse)
 ; NURNPOS - the ien of the Service Position (File 211.3)
 ; Returns the IEN of the new entry in File 211.8
 N DA,DIC,DIE,DR,NUR,NURARRAY,NURNY,NURSHLIT,X,Y
 S DIC="^NURSF(211.8,",DIC(0)="LZ",X=NURNLOC
 S DIC("DR")=".02///"_NURNCAT
 K DD,DO
 D FILE^DICN
 I Y'>0 Q 0
 S (DA(1),NURNY)=+Y
 S ^NURSF(211.8,NURNY,1,0)="^211.82ID^^" ;occupancy/transferred date
 S:$G(^NURSF(211.8,NURNY,2,0))="" ^(0)="^211.83P^^" ;position budgeted
 S DIC="^NURSF(211.8,NURNY,2,",DIC(0)="L",X=+NURNPOS
 S DIC("DR")=".05///^S X=$$NPRI^NURSBPO(NURNPOS)"
 K DD,DO
 D FILE^DICN
 S NURARRAY(1)=" "
 S NURARRAY(2)="Please use the 'Nursing Location File, Edit' option to add BUDGETED FTEE for"
 S NURARRAY(3)="this SERVICE POSITION."
 S NURARRAY(4)=" "
 D EN^DDIOL(.NURARRAY)
 H 3
 Q NURNY