Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FSCRPCWR

FSCRPCWR.m

Go to the documentation of this file.
FSCRPCWR ;SLC/STAFF-NOIS RPC Workload Review ;1/13/98  16:15
 ;;1.1;NOIS;;Sep 06, 1998
 ;
WORK(IN,OUT) ; from FSCRPX (RPCWorkload Review)
 N CALL,COL,COLNUM,DATE,DATE0,DATE1,DATE2,FLDS,FMT,LASTNUM,LISTNUM,LISTFLAG,LNUM,MAX,NODE,NUM,SPEC,STOP,TYPE,WKLD
 S STOP=0,MAX=2000
 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)
 I DATE1>DATE2 S DATE0=DATE2,DATE2=DATE1,DATE1=DATE0
 S FMT="CUSTOM"
 D INFO(.FMT,FLDS,.NODE,.TYPE)
 S ^TMP("FSCRPC",$J,"OUTPUT",2)="0^1^Hours"
 S ^TMP("FSCRPC",$J,"OUTPUT",3)="0^2^Date"
 S ^TMP("FSCRPC",$J,"OUTPUT",4)="0^3^Spec"
 S LASTNUM=4,LISTNUM=0,COLNUM=3
 S COL=0 F  S COL=$O(FMT(COL)) Q:COL<1  D
 .S COLNUM=COLNUM+1
 .S LASTNUM=LASTNUM+1
 .S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)="0^"_COLNUM_U_$P(FMT(COL),U,2)
 I LISTFLAG D
 .S LNUM=0 F  S LNUM=$O(^TMP("FSC CURRENT LIST",$J,LNUM)) Q:LNUM<1  S CALL=+^(LNUM) D  Q:STOP
 ..I $O(^TMP("FSCRPC",$J,"INPUT",1)) D  Q
 ...S NUM=1  F  S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1  S SPEC=+^(NUM) D  Q:STOP
 ....I 'SPEC Q
 ....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
 ..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
 I 'LISTFLAG D
 .I $O(^TMP("FSCRPC",$J,"INPUT",1)) D  Q
 ..S NUM=1 F  S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1  S SPEC=+^(NUM) D  Q:STOP
 ...I 'SPEC Q
 ...S DATE=DATE1 F  S DATE=$O(^FSCD("WKLD","AUD",SPEC,DATE)) Q:DATE<1  Q:DATE>DATE2  D  Q:STOP
 ....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
 .S DATE=DATE1 F  S DATE=$O(^FSCD("WKLD","D",DATE)) Q:DATE<1  Q:DATE>DATE2  D  Q:STOP
 ..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
 S ^TMP("FSCRPC",$J,"OUTPUT",1)=(1+LISTNUM)_";"_(1+COLNUM)
 Q
 ;
SETUP(WKLD,FMT,LASTNUM,LISTNUM) ;
 N CALL,CALLID,COL,DATE,FIELD,HOURS,INVALID,SPEC,ZERO K FIELD
 S ZERO=$G(^FSCD("WKLD",+WKLD,0))
 S CALL=+ZERO,SPEC=+$P(ZERO,U,2),DATE=+$P(ZERO,U,3),HOURS=+$P(ZERO,U,4),INVALID=+$P(ZERO,U,5)
 Q:'CALL  Q:'DATE  Q:'SPEC  Q:'HOURS  Q:INVALID
 S CALLID=$P($G(^FSCD("CALL",CALL,0)),U)
 S DATE=$$FMTE^XLFDT(DATE)
 S SPEC=$P($G(^VA(200,SPEC,0)),U)
 S LISTNUM=LISTNUM+1
 S LASTNUM=LASTNUM+1
 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^0^"_CALLID
 S LASTNUM=LASTNUM+1
 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^1^"_HOURS
 S LASTNUM=LASTNUM+1
 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^2^"_DATE
 S LASTNUM=LASTNUM+1
 S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^3^"_SPEC
 S COL=0 F  S COL=$O(FMT(COL)) Q:COL<1  D
 .I '$L($P(FMT(COL),U,7)) S $P(FMT(COL),U,7)=" "
 .S FIELD($P(FMT(COL),U,7))=""
 D GET^FSCGET("CUSTOM",CALL,.FIELD)
 S COL=0 F  S COL=$O(FMT(COL)) Q:COL<1  D
 .S LASTNUM=LASTNUM+1
 .I $P(FMT(COL),U,7)="SUBJECT" D
 ..S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_FIELD($P(FMT(COL),U,7))
 .E  D
 ..S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_$P(FIELD($P(FMT(COL),U,7)),U,2)
 Q
 ;
INFO(FMT,FLDS,NODE,TYPE) ;
 N CNT,FIELD,FORMAT,NUM,PIECE
 S TYPE="FSC VIEW "
 S NODE=TYPE_FMT
 S NUM=3
 I $E(FLDS)="{" D
 .S FORMAT=+$P(FLDS,"{",2)
 .S CNT=0 F  S CNT=$O(^FSC("FORMAT",FORMAT,2,CNT)) Q:CNT<1  S FIELD=+^(CNT,0) D
 ..S NUM=NUM+1
 ..S FMT(NUM)=$G(^FSC("FLD",FIELD,0))
 E  D
 .F PIECE=1:1 S FIELD=$P(FLDS,";",PIECE) Q:FIELD=""  D
 ..S NUM=NUM+1
 ..S FMT(NUM)=$G(^FSC("FLD",+FIELD,0))
 Q
 ;