source: FOIAVistA/trunk/r/NURSING_SERVICE-NUR/NURAED2.m@ 1757

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1NURAED2 ;HIRMFO/MD,RM,FT-EDIT FOR POSITION ;5/14/01 15:37
2 ;;4.0;NURSING SERVICE;**1,33,35**;Apr 25, 1997
3VALSEL ; VALIDATE SELECTIONS
4 F NUR1=1:1 S NUR2=$P(NURAES,",",NUR1) Q:NUR2="" S:NUR2="n" NUR2="N" D VAL0 Q:$G(NURSBAD)
5 Q
6VAL0 ;VALIDATION CONTINUED
7 I NUR2="N" S NURSUL("N")="" Q
8 I +NUR2>NCNT!(+NUR2<1) S NURSBAD=1 Q
9 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
10 I NUR2'["-",NUR2'?1.N0.1"@"!(+NUR2>NCNT)!(+NUR2<1) S NURSBAD=1 Q
11 S NUR3=$S(NUR2["-":+$P(NUR2,"-",2),1:+NUR2)
12 F NUR10=+NUR2:1:NUR3 S NURSUL(NUR10)=$P(NUR2,NUR3,2)
13 Q
14VALENT ; VALIDATE THE DATA ENTRY FOR THIS EMPLOYEE BY CALLING EN4^NURSUT2.
15 N DA
16 S NUR=$O(NUR("SDT","")),DA(1)=$O(NUR("SDT",+NUR,"")),DA=$O(NUR("SDT",+NUR,+DA(1),"")) Q:DA(1)'>0!(DA'>0)
17 S NUR(0)=NUR("SDT",+NUR,DA(1),DA) I NUR(0)="" K NUR Q
18 D EN4^NURSUT2 S:$G(NURSBAD)&'($P(NURSBAD,U,2)=5) NUROUT=1 W:$G(NURSBAD) !! D EN4^NURSUT3
19 Q
20VALE0 ; BUILD UP LOCAL NUR ARRAY TO USE IN TMP EN4^NURSUT2 TO
21 ; VALIDATE THE ENTRY OF THESE POSITIONS.
22 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
23 S NUR(3)=$S('$D(NURSPOS(NURSANM)):$P(NURSASS(NURSANM),"^",3,14),1:NURSPOS(NURSANM)) I NUR(3)'="" D
24 .I $G(NURSPOS(NURSANM))=NUR(3),'(NURSASS(NURSANM)="") D
25 ..S NUR(2)=9999999
26 ..S NUR(1)=$O(^NURSF(211.8,"AA",+NURSPOS(NURSANM),$P(NURSPOS(NURSANM),U,2),""))
27 ..I +NUR(1)'>0 S NUR(1)=$$NEW2118(+NURSPOS(NURSANM),$P(NURSPOS(NURSANM),U,2),$P(NURSPOS(NURSANM),U,5))
28 ..Q
29 . S NUR(3)=$P(NUR(3),"^",3,99) D ST1^NURSUT2
30 . Q
31 I $D(NURSPOS(NURSANM)),NURSASS(NURSANM)="" D
32 . N % S %=NUR("SDT",$P(NUR(3),U),NUR(1),NUR(2))
33 . S NUR("SDT",$P(NUR(3),U),NUR(1),NUR(2))=$P(NURSPOS(NURSANM),"^",1,2)_%
34 . S %=NUR("VDT",$S($P(NUR(3),U,6):$P(NUR(3),U,6),1:9999999),NUR(1),NUR(2))
35 . 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)_%
36 . Q
37 Q
38EN1 ; USING NURSUL(#) DETERMINE IF EDIT, ADD, DELETE AND SET NURSPOS(#)
39 K NURSPOS S NURSUL="" F NURSX=0:0 S NURSUL=$O(NURSUL(NURSUL)) Q:NURSUL="" D PROC Q:$G(NUROUT)
40 Q
41PROC ; PROCESS THE NURSUL(#) SELECTION
42 I NURSUL="N"&(NURLS="P") D MSG^NURAED1 S MSG=1 Q
43 I NURSUL(NURSUL)="@" S NURSPOS(NURSUL)="" Q
44 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
45 I NURSUL="N" S NURSW1=0 D ADAS
46 Q
47ADAS ; ADD NEW ASSIGNMENTS
48 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))))
49 I '% W !?5,$C(7),"ANSWER YES IF YOU WISH TO ADD A NEW ASSIGNMENT, ELSE ANSWER NO." G ADAS
50 S NURSW1=1,NCNT=NCNT+1,(NURSASS(NCNT),NURSOPOS)="",$P(NURSOPOS,"^",4)=NID D EDTFLD^NURAED5 I $G(NUROUT) S NCNT=NCNT-1 Q
51 S NURSPOS(NCNT)=NURSNPOS
52 G ADAS
53NEW2118(NURNLOC,NURNCAT,NURNPOS) ; Function that adds a new entry to the
54 ; NURS POSITION CONTROL (#211.8) file.
55 ; NURNLOC - the .01 value of the entry (i.e., FILE 44 pointer value)
56 ; NURNCAT - the service category code (e.g., "R" for registered nurse)
57 ; NURNPOS - the ien of the Service Position (File 211.3)
58 ; Returns the IEN of the new entry in File 211.8
59 N DA,DIC,DIE,DR,NUR,NURARRAY,NURNY,NURSHLIT,X,Y
60 S DIC="^NURSF(211.8,",DIC(0)="LZ",X=NURNLOC
61 S DIC("DR")=".02///"_NURNCAT
62 K DD,DO
63 D FILE^DICN
64 I Y'>0 Q 0
65 S (DA(1),NURNY)=+Y
66 S ^NURSF(211.8,NURNY,1,0)="^211.82ID^^" ;occupancy/transferred date
67 S:$G(^NURSF(211.8,NURNY,2,0))="" ^(0)="^211.83P^^" ;position budgeted
68 S DIC="^NURSF(211.8,NURNY,2,",DIC(0)="L",X=+NURNPOS
69 S DIC("DR")=".05///^S X=$$NPRI^NURSBPO(NURNPOS)"
70 K DD,DO
71 D FILE^DICN
72 S NURARRAY(1)=" "
73 S NURARRAY(2)="Please use the 'Nursing Location File, Edit' option to add BUDGETED FTEE for"
74 S NURARRAY(3)="this SERVICE POSITION."
75 S NURARRAY(4)=" "
76 D EN^DDIOL(.NURARRAY)
77 H 3
78 Q NURNY
Note: See TracBrowser for help on using the repository browser.