source: WorldVistAEHR/trunk/r/NOIS-FSC/FSCRPCWR.m@ 1259

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

initial load of WorldVistAEHR

File size: 3.5 KB
RevLine 
[613]1FSCRPCWR ;SLC/STAFF-NOIS RPC Workload Review ;1/13/98 16:15
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4WORK(IN,OUT) ; from FSCRPX (RPCWorkload Review)
5 N CALL,COL,COLNUM,DATE,DATE0,DATE1,DATE2,FLDS,FMT,LASTNUM,LISTNUM,LISTFLAG,LNUM,MAX,NODE,NUM,SPEC,STOP,TYPE,WKLD
6 S STOP=0,MAX=2000
7 S LISTFLAG=+$G(^TMP("FSCRPC",$J,"INPUT",1)),DATE1=$P($G(^(1)),U,2),DATE2=$P($G(^(1)),U,3),FLDS=$P($G(^(1)),U,4)
8 I DATE1>DATE2 S DATE0=DATE2,DATE2=DATE1,DATE1=DATE0
9 S FMT="CUSTOM"
10 D INFO(.FMT,FLDS,.NODE,.TYPE)
11 S ^TMP("FSCRPC",$J,"OUTPUT",2)="0^1^Hours"
12 S ^TMP("FSCRPC",$J,"OUTPUT",3)="0^2^Date"
13 S ^TMP("FSCRPC",$J,"OUTPUT",4)="0^3^Spec"
14 S LASTNUM=4,LISTNUM=0,COLNUM=3
15 S COL=0 F S COL=$O(FMT(COL)) Q:COL<1 D
16 .S COLNUM=COLNUM+1
17 .S LASTNUM=LASTNUM+1
18 .S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)="0^"_COLNUM_U_$P(FMT(COL),U,2)
19 I LISTFLAG D
20 .S LNUM=0 F S LNUM=$O(^TMP("FSC CURRENT LIST",$J,LNUM)) Q:LNUM<1 S CALL=+^(LNUM) D Q:STOP
21 ..I $O(^TMP("FSCRPC",$J,"INPUT",1)) D Q
22 ...S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S SPEC=+^(NUM) D Q:STOP
23 ....I 'SPEC Q
24 ....S DATE=0 F S DATE=$O(^FSCD("WKLD","AK",CALL,SPEC,DATE)) Q:DATE<1 S WKLD=^(DATE) D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
25 ..S WKLD=0 F S WKLD=$O(^FSCD("WKLD","B",CALL,WKLD)) Q:WKLD<1 D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
26 I 'LISTFLAG D
27 .I $O(^TMP("FSCRPC",$J,"INPUT",1)) D Q
28 ..S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S SPEC=+^(NUM) D Q:STOP
29 ...I 'SPEC Q
30 ...S DATE=DATE1 F S DATE=$O(^FSCD("WKLD","AUD",SPEC,DATE)) Q:DATE<1 Q:DATE>DATE2 D Q:STOP
31 ....S WKLD=0 F S WKLD=$O(^FSCD("WKLD","AUD",SPEC,DATE,WKLD)) Q:WKLD<1 D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
32 .S DATE=DATE1 F S DATE=$O(^FSCD("WKLD","D",DATE)) Q:DATE<1 Q:DATE>DATE2 D Q:STOP
33 ..S WKLD=0 F S WKLD=$O(^FSCD("WKLD","D",DATE,WKLD)) Q:WKLD<1 D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
34 S ^TMP("FSCRPC",$J,"OUTPUT",1)=(1+LISTNUM)_";"_(1+COLNUM)
35 Q
36 ;
37SETUP(WKLD,FMT,LASTNUM,LISTNUM) ;
38 N CALL,CALLID,COL,DATE,FIELD,HOURS,INVALID,SPEC,ZERO K FIELD
39 S ZERO=$G(^FSCD("WKLD",+WKLD,0))
40 S CALL=+ZERO,SPEC=+$P(ZERO,U,2),DATE=+$P(ZERO,U,3),HOURS=+$P(ZERO,U,4),INVALID=+$P(ZERO,U,5)
41 Q:'CALL Q:'DATE Q:'SPEC Q:'HOURS Q:INVALID
42 S CALLID=$P($G(^FSCD("CALL",CALL,0)),U)
43 S DATE=$$FMTE^XLFDT(DATE)
44 S SPEC=$P($G(^VA(200,SPEC,0)),U)
45 S LISTNUM=LISTNUM+1
46 S LASTNUM=LASTNUM+1
47 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^0^"_CALLID
48 S LASTNUM=LASTNUM+1
49 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^1^"_HOURS
50 S LASTNUM=LASTNUM+1
51 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^2^"_DATE
52 S LASTNUM=LASTNUM+1
53 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^3^"_SPEC
54 S COL=0 F S COL=$O(FMT(COL)) Q:COL<1 D
55 .I '$L($P(FMT(COL),U,7)) S $P(FMT(COL),U,7)=" "
56 .S FIELD($P(FMT(COL),U,7))=""
57 D GET^FSCGET("CUSTOM",CALL,.FIELD)
58 S COL=0 F S COL=$O(FMT(COL)) Q:COL<1 D
59 .S LASTNUM=LASTNUM+1
60 .I $P(FMT(COL),U,7)="SUBJECT" D
61 ..S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_FIELD($P(FMT(COL),U,7))
62 .E D
63 ..S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_$P(FIELD($P(FMT(COL),U,7)),U,2)
64 Q
65 ;
66INFO(FMT,FLDS,NODE,TYPE) ;
67 N CNT,FIELD,FORMAT,NUM,PIECE
68 S TYPE="FSC VIEW "
69 S NODE=TYPE_FMT
70 S NUM=3
71 I $E(FLDS)="{" D
72 .S FORMAT=+$P(FLDS,"{",2)
73 .S CNT=0 F S CNT=$O(^FSC("FORMAT",FORMAT,2,CNT)) Q:CNT<1 S FIELD=+^(CNT,0) D
74 ..S NUM=NUM+1
75 ..S FMT(NUM)=$G(^FSC("FLD",FIELD,0))
76 E D
77 .F PIECE=1:1 S FIELD=$P(FLDS,";",PIECE) Q:FIELD="" D
78 ..S NUM=NUM+1
79 ..S FMT(NUM)=$G(^FSC("FLD",+FIELD,0))
80 Q
81 ;
Note: See TracBrowser for help on using the repository browser.