source: WorldVistAEHR/trunk/r/NOIS-FSC/FSCRPCEB.m@ 1774

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1FSCRPCEB ;SLC/STAFF-NOIS RPC Edit Batch ;9/6/98 21:55
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4BATCH(IN,OUT) ; from FSCRPX (RPCEditBatch)
5 N CALL,EDITDATA,EDITED,FIELDS,NUM,PDATA K FIELDS
6 K ^TMP("FSC BATCH CALLS",$J),^TMP("FSC WP",$J)
7 D CALLS
8 D PROCESS^FSCRPCNC(.FIELDS)
9 S EDITDATA=$$EDITDATA(.FIELDS)
10 S PDATA=$$PDATA(.FIELDS)
11 I $L($G(FIELDS("SUBJECT"))) S FIELDS("SUBJECT")=$$FIX^FSCRPCEC(FIELDS("SUBJECT"))
12 I $L($G(FIELDS("PHONE"))) S FIELDS("PHONE")=$$FIX^FSCRPCEC(FIELDS("PHONE"))
13 I $L($G(FIELDS("PATCH"))) S FIELDS("PATCH")=$$FIX^FSCRPCEC(FIELDS("PATCH"))
14 I $L($G(FIELDS("KEYWORDS"))) S FIELDS("KEYWORDS")=$$FIX^FSCRPCEC(FIELDS("KEYWORDS"))
15 I $L($G(FIELDS("WEB"))) S FIELDS("WEB")=$$FIX^FSCRPCEC(FIELDS("WEB"))
16 I $L($G(FIELDS("PLONG"))) S FIELDS("PLONG")=$$FIX^FSCRPCEC(FIELDS("PLONG"))
17 I $L($G(FIELDS("PSHORT"))) S FIELDS("PSHORT")=$$FIX^FSCRPCEC(FIELDS("PSHORT"))
18 I $L($G(FIELDS("PNUM"))) S FIELDS("PNUM")=+FIELDS("PNUM")
19 I $L($G(FIELDS("HRS"))) S FIELDS("HRS")=+FIELDS("HRS")
20 S NUM=0 F S NUM=$O(^TMP("FSC BATCH CALLS",$J,NUM)) Q:NUM<1 S CALL=+^(NUM) D
21 .I '$D(^FSCD("CALL",CALL,0)) Q
22 .S EDITED=0
23 .I EDITDATA D FIELDS^FSCRPCEF(CALL,.FIELDS,.EDITED)
24 .I $D(FIELDS("WEB")) D WEB(CALL,FIELDS("WEB"),.EDITED)
25 .I EDITED D UPDATE^FSCAUDIT(CALL)
26 .I PDATA D PFIELDS(CALL,.FIELDS,.EDITED)
27 .I EDITED D MRE^FSCMR(DUZ,CALL)
28 .I $D(FIELDS("HRS")) D WKLD(CALL,.FIELDS)
29 .S ^TMP("FSC CURRENT LIST",$J,+$G(^TMP("FSC CURRENT LIST",$J,"C",CALL)))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
30 K ^TMP("FSC BATCH CALLS",$J),^TMP("FSC WP",$J)
31 Q
32 ;
33CALLS ;
34 N CALL,DONE,LINE,NUM
35 S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) I LINE="{CALLS}" D Q
36 .K ^TMP("FSCRPC",$J,"INPUT",NUM)
37 .F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) S DONE=0 D I DONE Q
38 ..K ^TMP("FSCRPC",$J,"INPUT",NUM)
39 ..I LINE="{{{}}}" S DONE=1 Q
40 ..S ^TMP("FSC BATCH CALLS",$J,NUM)=LINE
41 Q
42 ;
43EDITDATA(FIELDS) ; $$(fields) -> 1 if used to edit call's fields, else 0
44 N OK,FNAME
45 S OK=0
46 F FNAME="STATUS","SUBJECT","PHONE","PATCH","KEYWORDS","MOD","IRM","PRI","SPEC","SPECD","DEVSUB" I $D(FIELDS(FNAME)) S OK=1 Q
47 I 'OK F FNAME="DESC","NOTE","RES" I $O(^TMP("FSC WP",$J,FNAME,0)) S OK=1 Q
48 Q OK
49 ;
50PDATA(FIELDS) ; $$(fields) -> 1 if edit personal fields, else 0
51 N OK,FNAME
52 S OK=0
53 F FNAME="PSHORT","PLONG","PNUM","PNOTE" I $D(FIELDS(FNAME)) S OK=1 Q
54 Q OK
55 ;
56WEB(CALL,VALUE,EDITED) ; from FSCRPCWS
57 N DA,DIE,DR,NEWV,OLDV,URL,X,Y K NEWV,OLDV
58 S URL=$P($G(^FSCD("CALL",CALL,1.7)),U)
59 I URL=VALUE Q
60 S EDITED=1
61 S OLDV("WEB")=U_URL
62 S DA=CALL,DIE="^FSCD(""CALL"","
63 I $L(VALUE) S DR="1.7///"_VALUE
64 E S DR="1.7///@"
65 D ^DIE
66 S NEWV("WEB")=U_$P($G(^FSCD("CALL",CALL,1.7)),U)
67 D AUDIT^FSCAUDIT(CALL,.OLDV,.NEWV)
68 K NEWV,OLDV
69 Q
70 ;
71PFIELDS(CALL,FIELDS,EDITED) ;
72 N CNT,DA,DIE,DIK,DR,LINE,NUM,OK,X,Y
73 S EDITED=1
74 S DA=+$G(^FSCD("CALL USER","AUC",DUZ,CALL))
75 I DA D
76 .S DR=""
77 .I $D(FIELDS("PSHORT")) D
78 ..I $L(FIELDS("PSHORT")) S DR=DR_";2///"_FIELDS("PSHORT") Q
79 ..S DR=DR_";2///@"
80 .I $D(FIELDS("PNUM")) D
81 ..I $L(FIELDS("PNUM")) S DR=DR_";3///"_FIELDS("PNUM") Q
82 ..S DR=DR_";3///@"
83 .I $D(FIELDS("PLONG")) D
84 ..I $L(FIELDS("PLONG")) S DR=DR_";4///"_FIELDS("PLONG") Q
85 ..S DR=DR_";4///@"
86 .I '$L(DR) Q
87 .I $E(DR)=";" S DR=$E(DR,2,255)
88 .S DIE="^FSCD(""CALL USER"","
89 .D ^DIE
90 E D
91 .L +^FSCD("CALL USER",0):5 I '$T Q
92 .S DA=1+$P(^FSCD("CALL USER",0),U,3)
93 .F Q:'$D(^FSCD("CALL USER",DA,0)) S DA=DA+1
94 .S $P(^FSCD("CALL USER",0),U,3)=DA,$P(^(0),U,4)=$P(^(0),U,4)+1
95 .S ^FSCD("CALL USER",DA,0)=CALL_U_DUZ_U_$G(FIELDS("PSHORT"))_U_$G(FIELDS("PNUM"))
96 .I $L($G(FIELDS("PLONG"))) S ^FSCD("CALL USER",DA,1)=FIELDS("PLONG")
97 .L -^FSCD("CALL USER",0)
98 .S DIK="^FSCD(""CALL USER"","
99 .D IX1^DIK
100 I $G(FIELDS("PNOTE"))=0 K ^FSCD("CALL USER",DA,2)
101 I $O(^TMP("FSC WP",$J,"PNOTE",0)) D
102 .I $G(FIELDS("PNOTE"))=2 K ^FSCD("CALL USER",DA,2)
103 .S CNT=+$P($G(^FSCD("CALL USER",DA,2,0)),U,3)
104 .S NUM=0 F S NUM=$O(^TMP("FSC WP",$J,"PNOTE",NUM)) Q:NUM<1 S LINE=^(NUM) D
105 ..S CNT=CNT+1
106 ..S ^FSCD("CALL USER",DA,2,CNT,0)=LINE
107 .I CNT S ^FSCD("CALL USER",DA,2,0)="^^"_CNT_U_CNT_U_DT_U
108 S OK=1 D
109 .Q:$L($P(^FSCD("CALL USER",DA,0),U,3)) Q:$L($P(^(0),U,4)) Q:$L($G(^(1))) Q:$O(^(2,0))
110 .S OK=0
111 I 'OK D DEL^FSCUCD("^FSCD(""CALL USER"",",DA)
112 Q
113 ;
114WKLD(CALL,FIELDS) ;
115 N DATE,DCLOSE,DOPEN,HRS,USER
116 S USER=DUZ
117 S DATE=$G(FIELDS("DATEW")) I 'DATE Q
118 S HRS=+$G(FIELDS("HRS")) I 'HRS Q
119 S DOPEN=$P($G(^FSCD("CALL",+CALL,0)),U,3),DCLOSE=$P($G(^(0)),U,4)
120 I 'DOPEN Q
121 I DCLOSE,DATE>$$FMADD^XLFDT(DCLOSE,+$P($G(^FSC("PARAM",1,0)),U,10)) Q
122 I DATE<DOPEN S DATE=DOPEN
123 I DCLOSE,DATE>DCLOSE S DATE=DCLOSE
124 D UPDATE^FSCEWKLD(CALL,HRS,DATE,USER)
125 Q
Note: See TracBrowser for help on using the repository browser.