source: WorldVistAEHR/trunk/r/NOIS-FSC/FSCNAS.m@ 862

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

initial load of WorldVistAEHR

File size: 4.6 KB
RevLine 
[613]1FSCNAS ;SLC/STAFF NOIS Notification Alert Send ;1/11/98 18:41
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4ALERT(MSG) ; from FSCLMPNN
5 Q:'$D(MSG)
6 N DELIVERY,OK,RECIP,TYPE K ^TMP("FSCCALLS",$J),RECIP S OK=1
7 D
8 .D CALLS(.OK) I 'OK Q
9 .D TYPE(.TYPE,.OK) I 'OK Q
10 .I TYPE="OTHERS" D
11 ..D RECIP(.RECIP,.OK)
12 ..S DELIVERY=""
13 .E D
14 ..S RECIP(DUZ)="" ;$$VALUE^FSCGET(DUZ,7100,2.1)
15 ..D DELIVER(.DELIVERY,.OK)
16 .I 'OK Q
17 .D SEND(MSG,.RECIP,DELIVERY,.OK)
18 I 'OK W !!,"Alert was NOT sent."
19 E W !!,"Alert sent."
20 K ^TMP("FSCCALLS",$J),RECIP H 2
21 Q
22 ;
23CALLS(OK) ;
24 N CALL,CHOICE,DIR,LISTNUM,Y K DIR S OK=1
25 I '+@VALMAR Q
26 S DIR(0)="YAO",DIR("A")="Do you want to include "_$S($D(^TMP("FSC SELECT",$J,"EVALUES")):"this call",1:"calls")_" with the alert? ",DIR("B")="YES"
27 S DIR("?",1)="Enter YES to include calls with alert."
28 S DIR("?",2)="Enter NO to not include calls with the alert."
29 S DIR("?",3)="Enter '^' to exit without making changes or '??' for more help."
30 S DIR("?")="^D HELP^FSCU(.DIR)"
31 S DIR("??")="FSC U1 NOIS"
32 D ^DIR K DIR
33 I $D(DIRUT) S OK=0 Q
34 I Y D I 'OK Q
35 .D
36 ..I $D(^TMP("FSC SELECT",$J,"EVALUES")) S CHOICE=FSCCNT_"-"_FSCCNT Q
37 ..I $D(^TMP("FSC SELECT",$J,"VVALUES")) S CHOICE=^("VVALUES") Q
38 ..S CHOICE="1-"_+@VALMAR
39 .D SELECT^FSCUL(CHOICE,"",CHOICE,"NVALUES",.OK)
40 .I 'OK Q
41 .S LISTNUM=0 F S LISTNUM=$O(^TMP("FSC SELECT",$J,"NVALUES",LISTNUM)) Q:LISTNUM<1 S CALL=$$CALL^FSCLMPE1(LISTNUM),^TMP("FSCCALLS",$J,CALL)=""
42 I $D(DIRUT) S OK=0 Q
43 Q
44TYPE(TYPE,OK) ;
45 N DIR,Y K DIR S OK=1
46 S DIR(0)="SAMO^YOURSELF:YOURSELF;OTHERS:OTHERS",DIR("B")="OTHERS"
47 S DIR("A")="Will alert be sent to (Y)ourself or to (O)thers: "
48 S DIR("?",1)="Enter Y to send alert this alert to yourself at a later date."
49 S DIR("?",2)="Enter O to have alert sent to others immediately."
50 S DIR("?",3)="Note: Alerts sent to others can only be sent immediately."
51 S DIR("?",4)=" Alerts sent to yourself can be scheduled for later delivery."
52 S DIR("?")="^D HELP^FSCU(.DIR)"
53 S DIR("??")="FSC U1 NOIS"
54 D ^DIR K DIR
55 I $D(DIRUT) S OK=0 Q
56 S TYPE=Y
57 Q
58 ;
59RECIP(RECIP,OK) ;
60 N DEL,DIR,DONE,X,Y K DIR,RECIP S OK=1
61 S DIR(0)="FAO^1:32",DIR("A")="Send to: "
62 S DIR("?",1)="Enter the persons to whom you want to send alerts."
63 S DIR("?",2)="You can also enter mail groups."
64 S DIR("?",3)="Enter 'return' or '^' to exit, '??' for more help."
65 S DIR("?")="^D HELP^FSCU(.DIR)"
66 S DIR("??")="FSC U1 NOIS"
67 S DONE=0 F D Q:DONE
68 .D ^DIR
69 .I $D(DIRUT) S DONE=1 Q
70 .I '$L(Y) S DONE=1 Q
71 .S Y=$$UP^XLFSTR(Y)
72 .S DEL=0 I $E(Y)="-" S (X,Y)=$E(Y,2,245),DEL=1
73 .I '$L(Y) W " ??",$C(7) Q
74 .I DEL,'$D(RECIP) W " ??",$C(7) Q
75 .D
76 ..I $E(Y,1,2)="G." D Q
77 ...N DIC K DIC
78 ...S X=$E(Y,3,99),DIC=3.8,DIC(0)="EMQ" D ^DIC K DIC I Y<1 Q
79 ...I 'DEL S RECIP("G."_$P(Y,U,2))="" ;"G."_$P(Y,U,2)
80 ...E D
81 ....I $D(RECIP("G."_$P(Y,U,2))) K RECIP("G."_$P(Y,U,2)) W " Deleted."
82 ....E W " ?? <not previously selected>",$C(7)
83 ..N DIC K DIC
84 ..S X=Y,DIC=200,DIC(0)="EMQ" D ^DIC K DIC I Y<1 Q
85 ..I 'DEL S RECIP(+Y)="" ;$P(Y,U,2)
86 ..E D
87 ...I $D(RECIP(+Y))#2 K RECIP(+Y) W " Deleted."
88 ...E W " ?? <not previously selected>",$C(7)
89 .S DIR("A")="And send to: "
90 K DIR I $D(DTOUT) S OK=0
91 I '$L($O(RECIP(0))) S OK=0
92 Q
93 ;
94DELIVER(DELIVERY,OK) ;
95 N DIR,FUTURE,LIMIT,Y K DIR S OK=1
96 S LIMIT=180,FUTURE=$$FMADD^XLFDT(DT,LIMIT)
97 S DIR(0)="DAO^DT:"_FUTURE_":EX",DIR("A")="Enter delivery date: ",DIR("B")="T"
98 S DIR("?",1)="Enter the delivery date for this alert."
99 S DIR("?",2)="This date can range from TODAY to T+"_LIMIT_" ("_$$FMTE^XLFDT(FUTURE)_")."
100 S DIR("?")="^D HELP^%DTC,HELP^FSCU(.DIR)"
101 S DIR("??")="FSC U1 NOIS"
102 D ^DIR K DIR
103 I $D(DIRUT) S OK=0 Q
104 S DELIVERY=Y
105 Q
106 ;
107SEND(XQAMSG,XQA,DELIVERY,OK) ;
108 N ALERT,CALL,DIR,XQADATA,XQAID,XQAROU,Y K DIR S OK=1
109 I $L(DELIVERY) S XQAMSG=XQAMSG_" from: Yourself, sent: "_$$FMTE^XLFDT(DT)
110 E S XQAMSG=XQAMSG_" from: "_$$VALUE^FSCGET(DUZ,7100,2.1)
111 I DELIVERY=DT S DELIVERY=""
112 S DIR(0)="YAO",DIR("A")="Send this alert? ",DIR("B")="YES"
113 S DIR("?",1)="Enter YES to send this alert."
114 S DIR("?",2)="Enter NO or '^' to exit or '??' for more help."
115 S DIR("?")="^D HELP^FSCU(.DIR)"
116 S DIR("??")="FSC U1 NOIS"
117 D ^DIR K DIR
118 I $D(DIRUT) S OK=0 Q
119 I Y'=1 S OK=0 Q
120 D NEWALERT^FSCNOTS(DUZ,,XQAMSG,.ALERT,DELIVERY)
121 S CALL=0 F S CALL=$O(^TMP("FSCCALLS",$J,CALL)) Q:CALL<1 D NEWSEND(ALERT,CALL)
122 I DELIVERY Q
123 S XQADATA=ALERT,XQAROU="ALERT^FSCNAR",XQAID="FSC-M"
124 D SETUP^XQALERT
125 Q
126 ;
127NEWSEND(ALERT,CALL) ; from FSCRPCN
128 N DA,DIK,NUM
129 S NUM=1+$P(^FSCD("SEND",0),U,3)
130 L +^FSCD("SEND",0):30 I '$T Q ; *** needs ok
131 F Q:'$D(^FSCD("SEND",NUM,0)) S NUM=NUM+1
132 S ^FSCD("SEND",NUM,0)=ALERT_U_CALL
133 S $P(^FSCD("SEND",0),U,3)=NUM,$P(^(0),U,4)=$P(^(0),U,4)+1
134 L -^FSCD("SEND",0)
135 S DIK="^FSCD(""SEND"",",DA=NUM D IX1^DIK
136 Q
Note: See TracBrowser for help on using the repository browser.