source: WorldVistAEHR/trunk/r/NOIS-FSC/FSCLP.m@ 1716

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1FSCLP ;SLC/STAFF-NOIS List Process ;1/13/98 13:18
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4UPDATE(CALL,LIST) ; from FSCLMPD, FSCTASKA, FSCTASKU
5 I $G(LIST),$P($G(^FSC("LIST",LIST,0)),U,3)'="A" Q
6 I $G(LIST),$G(CALL) D PROCESS(LIST,CALL) Q
7 I '$G(LIST),$G(CALL) D CALL(CALL) Q
8 I $G(LIST),'$G(CALL) D LIST(LIST) Q
9 I '$G(LIST),'$G(CALL) D Q
10 .N DAYDATE,DOW,REBUILD
11 .S DOW=$$DOW^XLFDT(DT)
12 .S DAYDATE=+$E(DT,6,7)
13 .S LIST=0 F S LIST=$O(^FSC("LIST","AU","A",LIST)) Q:LIST<1 D
14 ..S REBUILD=$P($G(^FSC("LIST",LIST,0)),U,10)
15 ..I REBUILD="NEVER" Q
16 ..I REBUILD="DAILY" D LIST(LIST) Q
17 ..I REBUILD="WEEKLY",DOW="Saturday" D LIST(LIST) Q
18 ..I REBUILD="",DOW="Saturday" D LIST(LIST) Q
19 ..I REBUILD="MONTHLY",DOW="Saturday",DAYDATE<8 D LIST(LIST) Q
20 Q
21 ;
22CALL(CALLNUM) ;
23 N ADD,EVAL,EXP,LEVEL,LIST,LNUM,NUM,Q,VALUE,X K Q,VALUE,X
24 D GET^FSCGET("ALL",CALLNUM,.VALUE)
25 S LIST=0 F S LIST=$O(^FSC("LIST","AU","A",LIST)) Q:LIST<1 D
26 .L +^XTMP("FSC LIST DEF",LIST):20 I '$T Q
27 .I '$D(^XTMP("FSC LIST DEF",LIST,"XOP")) K ^XTMP("FSC LIST DEF",LIST)
28 .I '$D(^XTMP("FSC LIST DEF",LIST)) D BUILD^FSCLDU(LIST)
29 .S NUM=0 F S NUM=$O(^XTMP("FSC LIST DEF",LIST,"Q",NUM)) Q:NUM<1 S EXP=^(NUM) S Q(NUM)=0 I @EXP S Q(NUM)=1
30 .S LEVEL=0 F S LEVEL=$O(^XTMP("FSC LIST DEF",LIST,"X",LEVEL)) Q:LEVEL<1 S EXP=$P(^(LEVEL),U,2) S X(LEVEL)=0 I @EXP S X(LEVEL)=1
31 .S EVAL=^XTMP("FSC LIST DEF",LIST,"XOP")
32 .L -^XTMP("FSC LIST DEF",LIST)
33 .I @EVAL D Q
34 ..S ADD=0 D ADD^FSCLMPS(CALLNUM,LIST,.OK) I OK S ADD=1
35 ..D NOTIFY(CALLNUM,LIST,ADD)
36 .S LNUM=+$O(^FSCD("LISTS","ALC",LIST,CALLNUM,0)) I LNUM D DELETE^FSCLMPS(LNUM)
37 Q
38 ;
39LIST(LIST) ;
40 N ADD,CALL,CNT,CRITERIA,LNUM,LSTART,LSTOP,OPNUM K CRITERIA,^TMP("FSC LIST",$J)
41 S LSTART=$$NOW^XLFDT
42 D TMP(LIST)
43 S (CNT,OPNUM)=0 F S OPNUM=$O(^TMP("FSC LIST DEF",$J,LIST,"CRITERIA",OPNUM)) Q:OPNUM<1 D
44 .K CRITERIA M CRITERIA=^TMP("FSC LIST DEF",$J,LIST,"CRITERIA",OPNUM)
45 .D QUERY^FSCQR("",.CNT,.CRITERIA)
46 K ^TMP("FSC LIST DEF",$J)
47 S CALL=0 F S CALL=$O(^FSCD("LISTS","ALC",LIST,CALL)) Q:CALL<1 D
48 .I '$D(^TMP("FSC LIST",$J,CALL)) S LNUM=+$O(^FSCD("LISTS","ALC",LIST,CALL,0)) D:LNUM DELETE^FSCLMPS(LNUM) Q
49 .K ^TMP("FSC LIST",$J,CALL)
50 S CALL=0 F S CALL=$O(^TMP("FSC LIST",$J,CALL)) Q:CALL<1 D
51 .S ADD=0 D ADD^FSCLMPS(CALL,LIST,.OK) I OK S ADD=1
52 .D NOTIFY(CALL,LIST,ADD)
53 S LSTOP=$$NOW^XLFDT
54 S $P(^FSC("LIST",LIST,0),U,11)=$$FMDIFF^XLFDT(LSTOP,LSTART,2)
55 Q
56 ;
57PROCESS(LISTNUM,CALLNUM) ;
58 I '$D(^FSC("LIST",LISTNUM)) Q
59 D TMP(LISTNUM)
60 N ADD,EVAL,EXP,FIELD,LEVEL,LNUM,NUM,Q,VALUE,X K Q,VALUE,X
61 S FIELD=0 F S FIELD=$O(^TMP("FSC LIST DEF",$J,LISTNUM,"VAR",FIELD)) Q:FIELD<1 S VALUE(^(FIELD))=""
62 D GET^FSCGET("CUSTOM",CALLNUM,.VALUE)
63 S NUM=0 F S NUM=$O(^TMP("FSC LIST DEF",$J,LISTNUM,"Q",NUM)) Q:NUM<1 S EXP=^(NUM) S Q(NUM)=0 I @EXP S Q(NUM)=1
64 S LEVEL=0 F S LEVEL=$O(^TMP("FSC LIST DEF",$J,LISTNUM,"X",LEVEL)) Q:LEVEL<1 S EXP=$P(^(LEVEL),U,2) S X(LEVEL)=0 I @EXP S X(LEVEL)=1
65 S EVAL=^TMP("FSC LIST DEF",$J,LISTNUM,"XOP")
66 K ^TMP("FSC LIST DEF",$J)
67 I @EVAL D Q
68 .S ADD=0 D ADD^FSCLMPS(CALLNUM,LISTNUM,.OK) I OK S ADD=1
69 .D NOTIFY(CALLNUM,LISTNUM,ADD)
70 S LNUM=+$O(^FSCD("LISTS","ALC",LISTNUM,CALLNUM,0)) I LNUM D DELETE^FSCLMPS(LNUM)
71 Q
72 ;
73NOTIFY(CALL,LIST,ADD) ;
74 I '$L($P(^FSC("LIST",LIST,0),U,6)) Q
75 I $D(^FSCD("NOTIFY","ACLIST",CALL,LIST)) Q
76 I 'ADD,$P(^FSC("LIST",LIST,0),U,7)="ADDED" Q
77 D SETUP^FSCNOT(CALL,LIST)
78 Q
79 ;
80MANUAL(LIST) ; from FSCLML, FSCLMPQU, FSCRPCA, FSCRPCL
81 N CNT,OPNUM,CRITERIA K CRITERIA,^TMP("FSC LIST",$J)
82 D TMP(LIST)
83 S (CNT,OPNUM)=0 F S OPNUM=$O(^TMP("FSC LIST DEF",$J,LIST,"CRITERIA",OPNUM)) Q:OPNUM<1 D
84 .K CRITERIA M CRITERIA=^TMP("FSC LIST DEF",$J,LIST,"CRITERIA",OPNUM)
85 .D QUERY^FSCQR("",.CNT,.CRITERIA)
86 K ^TMP("FSC LIST DEF",$J)
87 Q
88 ;
89TMP(LIST) ; builds ^TMP("FSC LIST DEF",$J,LIST) from ^XTMP
90 K ^TMP("FSC LIST DEF",$J,LIST)
91 L +^XTMP("FSC LIST DEF",LIST):20 I '$T Q
92 I '$D(^XTMP("FSC LIST DEF",LIST,"XOP")) K ^XTMP("FSC LIST DEF",LIST)
93 I '$D(^XTMP("FSC LIST DEF",LIST)) D BUILD^FSCLDU(LIST)
94 M ^TMP("FSC LIST DEF",$J,LIST)=^XTMP("FSC LIST DEF",LIST)
95 L -^XTMP("FSC LIST DEF",LIST)
96 Q
Note: See TracBrowser for help on using the repository browser.