FSCRPCEF ;SLC/STAFF-NOIS RPC Edit Fields ;6/13/98 14:46
;;1.1;NOIS;;Sep 06, 1998
;
FIELDS(CALL,FIELDS,EDITED) ; from FSCRPCEB
N CDATE,CSTATUS,DR,KEYWORDS,OK,ONETWO,REOPEN,STATUS,WOLDV,WNEWV,ZERO K WOLDV,WNEWV
S ZERO=^FSCD("CALL",CALL,0),ONETWO=$G(^(120))
S CSTATUS=+$P(ZERO,U,2)
S REOPEN=+$G(FIELDS("REOPEN"))
I 'REOPEN,(CSTATUS=2)!(CSTATUS=99) Q
I REOPEN D
.I CSTATUS=2 Q
.I CSTATUS=99 Q
.S REOPEN=0
I $O(^TMP("FSC WP",$J,"DESC",0)) D
.D REOPEN(CALL,.REOPEN,.EDITED)
.D DESC^FSCRPCNC(CALL)
.S WOLDV("DESC")=1,WNEWV("DESC")=2
.D DESC^FSCAUDIT(CALL,.WOLDV,.WNEWV) ; forces audit update
.S EDITED=1
I $O(^TMP("FSC WP",$J,"NOTE",0)) D
.D REOPEN(CALL,.REOPEN,.EDITED)
.D NOTE^FSCRPCNC(CALL)
.S EDITED=1
S DR=""
I $D(FIELDS("SUBJECT")) D
.S SUBJECT=$G(^FSCD("CALL",CALL,1))
.I FIELDS("SUBJECT")=SUBJECT Q
.S EDITED=1
.I $L(FIELDS("SUBJECT")) S DR=DR_";1///"_FIELDS("SUBJECT") Q
.S DR=DR_";1///@"
I $D(FIELDS("PHONE")) D
.S PHONE=$P(ZERO,U,7)
.I FIELDS("PHONE")=PHONE Q
.S EDITED=1
.I $L(FIELDS("PHONE")) S DR=DR_";2.2///"_FIELDS("PHONE") Q
.S DR=DR_";2.2///@"
I $D(FIELDS("PATCH")) D
.S PATCH=$P(ONETWO,U,14)
.I FIELDS("PATCH")=PATCH Q
.S EDITED=1
.I $L(FIELDS("PATCH")) S DR=DR_";7///"_FIELDS("PATCH") Q
.S DR=DR_";7///@"
I $D(FIELDS("KEYWORDS")) D
.S KEYWORDS=$P($G(^FSCD("CALL",CALL,1.5)),U)
.I FIELDS("KEYWORDS")=KEYWORDS Q
.I $L(FIELDS("KEYWORDS")),KEYWORDS[FIELDS("KEYWORDS") Q
.S EDITED=1
.I '$L(FIELDS("KEYWORDS")) S DR=DR_";1.5///@" Q
.I $L(KEYWORDS),$G(FIELDS("APPENDKEY")) S DR=DR_";1.5///"_$E(KEYWORDS_", "_FIELDS("KEYWORDS"),1,60) Q
.S DR=DR_";1.5///"_FIELDS("KEYWORDS")
I $L(DR)>100 D
.D REOPEN(CALL,.REOPEN,.EDITED)
.D SETUP^FSCRPCEC(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
I $D(FIELDS("MOD")) D
.S MOD=$P(ZERO,U,8)
.I MOD=FIELDS("MOD") Q
.S EDITED=1
.I '$D(FIELDS("DEVSUB")) D
..I $P(ONETWO,U,9)=$P($G(^FSC("MOD",+FIELDS("MOD"),0)),U,8) Q
..S DR=DR_";3.2///@"
.I FIELDS("MOD") S DR=DR_";3///`"_+FIELDS("MOD") Q
.S DR=DR_";3///@"
I $D(FIELDS("IRM")) D
.S IRM=$P(ZERO,U,6)
.I IRM=FIELDS("IRM") Q
.S EDITED=1
.I FIELDS("IRM") S DR=DR_";2.1///`"_+FIELDS("IRM") Q
.S DR=DR_";2.1///@"
I $D(FIELDS("PRI")) D
.S PRI=$P(ZERO,U,10)
.I PRI=FIELDS("PRI") Q
.S EDITED=1
.I FIELDS("PRI") S DR=DR_";6///`"_+FIELDS("PRI") Q
.S DR=DR_";6///@"
I $D(FIELDS("SPEC")) D
.S SPEC=$P(ZERO,U,9)
.I SPEC=FIELDS("SPEC") Q
.S EDITED=1
.I FIELDS("SPEC") S DR=DR_";5///`"_+FIELDS("SPEC") Q
.S DR=DR_";5///@"
I $D(FIELDS("SPECD")) D
.S SPECD=$P(ZERO,U,21)
.I SPECD=FIELDS("SPECD") Q
.S EDITED=1
.I FIELDS("SPECD") S DR=DR_";5.1///`"_+FIELDS("SPECD") Q
.S DR=DR_";5.1///@"
I $D(FIELDS("DEVSUB")) D
.S DEVSUB=$P(ONETWO,U,11)
.I DEVSUB=FIELDS("DEVSUB") Q
.S EDITED=1
.I FIELDS("DEVSUB") S DR=DR_";3.2///`"_+FIELDS("DEVSUB") Q
.S DR=DR_";3.2///@"
I $L(DR) D
.D REOPEN(CALL,.REOPEN,.EDITED)
.D SETUP^FSCRPCEC(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
S STATUS=+$G(FIELDS("STATUS"))
S ZERO=^FSCD("CALL",CALL,0)
S CSTATUS=+$P(ZERO,U,17)
I CSTATUS<2 S CSTATUS=+$P(ZERO,U,2)
I STATUS=CSTATUS Q
I STATUS,(CSTATUS=2)!(CSTATUS=99) D
.D REOPEN(CALL,.REOPEN,.EDITED)
.S ZERO=^FSCD("CALL",CALL,0)
.S CSTATUS=+$P(ZERO,U,17)
.I CSTATUS<2 S CSTATUS=+$P(ZERO,U,2)
I STATUS=CSTATUS Q
I $P($G(^FSC("STATUS",STATUS,0)),U,2)="D",CSTATUS'=3,$P($G(^FSC("STATUS",CSTATUS,0)),U,2)'="D" D
.D STATUS^FSCRPCEC(CALL,3,.EDITED)
I STATUS=2 D I 'OK Q
.S OK=1
.S DR="81///`"_DUZ
.I $G(FIELDS("FUNC")) S DR=DR_";8///`"_+FIELDS("FUNC")
.I $G(FIELDS("TASK")) S DR=DR_";9///`"_+FIELDS("TASK")
.S CDATE=$G(FIELDS("DATEC"))
.I 'CDATE S CDATE=DT
.I CDATE<$P($G(^FSCD("CALL",CALL,120)),U,4) S CDATE=$P($G(^(120)),U,4)\1
.S DR=DR_";82///"_CDATE
.I $L(DR) D I 'OK Q
..N DA,DIE,X,Y
..I $E(DR)=";" S DR=$E(DR,2,245)
..S DA=CALL,DIE="^FSCD(""CALL"","
..L +^FSCD("CALL",DA):30 I '$T S OK=0 Q ; *** needs ok
..D ^DIE
..L -^FSCD("CALL",DA)
..D PICKUP^FSCES(DA)
..S DR=""
.D RES^FSCRPCNC(CALL)
I STATUS D STATUS^FSCRPCEC(CALL,STATUS,.EDITED)
Q
;
REOPEN(CALL,REOPEN,EDITED) ;
I 'REOPEN Q
S REOPEN=0,EDITED=1
S OLDSTAT=+$P(^FSCD("CALL",CALL,0),U,2)
I '(OLDSTAT=2!(OLDSTAT=99)) Q
D STATUS^FSCES(CALL,OLDSTAT,1,1)
D UPDATE^FSCTASK(CALL)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCRPCEF 4330 printed Nov 22, 2024@17:29:18 Page 2
FSCRPCEF ;SLC/STAFF-NOIS RPC Edit Fields ;6/13/98 14:46
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
FIELDS(CALL,FIELDS,EDITED) ; from FSCRPCEB
+1 NEW CDATE,CSTATUS,DR,KEYWORDS,OK,ONETWO,REOPEN,STATUS,WOLDV,WNEWV,ZERO
KILL WOLDV,WNEWV
+2 SET ZERO=^FSCD("CALL",CALL,0)
SET ONETWO=$GET(^(120))
+3 SET CSTATUS=+$PIECE(ZERO,U,2)
+4 SET REOPEN=+$GET(FIELDS("REOPEN"))
+5 IF 'REOPEN
IF (CSTATUS=2)!(CSTATUS=99)
QUIT
+6 IF REOPEN
Begin DoDot:1
+7 IF CSTATUS=2
QUIT
+8 IF CSTATUS=99
QUIT
+9 SET REOPEN=0
End DoDot:1
+10 IF $ORDER(^TMP("FSC WP",$JOB,"DESC",0))
Begin DoDot:1
+11 DO REOPEN(CALL,.REOPEN,.EDITED)
+12 DO DESC^FSCRPCNC(CALL)
+13 SET WOLDV("DESC")=1
SET WNEWV("DESC")=2
+14 ; forces audit update
DO DESC^FSCAUDIT(CALL,.WOLDV,.WNEWV)
+15 SET EDITED=1
End DoDot:1
+16 IF $ORDER(^TMP("FSC WP",$JOB,"NOTE",0))
Begin DoDot:1
+17 DO REOPEN(CALL,.REOPEN,.EDITED)
+18 DO NOTE^FSCRPCNC(CALL)
+19 SET EDITED=1
End DoDot:1
+20 SET DR=""
+21 IF $DATA(FIELDS("SUBJECT"))
Begin DoDot:1
+22 SET SUBJECT=$GET(^FSCD("CALL",CALL,1))
+23 IF FIELDS("SUBJECT")=SUBJECT
QUIT
+24 SET EDITED=1
+25 IF $LENGTH(FIELDS("SUBJECT"))
SET DR=DR_";1///"_FIELDS("SUBJECT")
QUIT
+26 SET DR=DR_";1///@"
End DoDot:1
+27 IF $DATA(FIELDS("PHONE"))
Begin DoDot:1
+28 SET PHONE=$PIECE(ZERO,U,7)
+29 IF FIELDS("PHONE")=PHONE
QUIT
+30 SET EDITED=1
+31 IF $LENGTH(FIELDS("PHONE"))
SET DR=DR_";2.2///"_FIELDS("PHONE")
QUIT
+32 SET DR=DR_";2.2///@"
End DoDot:1
+33 IF $DATA(FIELDS("PATCH"))
Begin DoDot:1
+34 SET PATCH=$PIECE(ONETWO,U,14)
+35 IF FIELDS("PATCH")=PATCH
QUIT
+36 SET EDITED=1
+37 IF $LENGTH(FIELDS("PATCH"))
SET DR=DR_";7///"_FIELDS("PATCH")
QUIT
+38 SET DR=DR_";7///@"
End DoDot:1
+39 IF $DATA(FIELDS("KEYWORDS"))
Begin DoDot:1
+40 SET KEYWORDS=$PIECE($GET(^FSCD("CALL",CALL,1.5)),U)
+41 IF FIELDS("KEYWORDS")=KEYWORDS
QUIT
+42 IF $LENGTH(FIELDS("KEYWORDS"))
IF KEYWORDS[FIELDS("KEYWORDS")
QUIT
+43 SET EDITED=1
+44 IF '$LENGTH(FIELDS("KEYWORDS"))
SET DR=DR_";1.5///@"
QUIT
+45 IF $LENGTH(KEYWORDS)
IF $GET(FIELDS("APPENDKEY"))
SET DR=DR_";1.5///"_$EXTRACT(KEYWORDS_", "_FIELDS("KEYWORDS"),1,60)
QUIT
+46 SET DR=DR_";1.5///"_FIELDS("KEYWORDS")
End DoDot:1
+47 IF $LENGTH(DR)>100
Begin DoDot:1
+48 DO REOPEN(CALL,.REOPEN,.EDITED)
+49 DO SETUP^FSCRPCEC(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
End DoDot:1
+50 IF $DATA(FIELDS("MOD"))
Begin DoDot:1
+51 SET MOD=$PIECE(ZERO,U,8)
+52 IF MOD=FIELDS("MOD")
QUIT
+53 SET EDITED=1
+54 IF '$DATA(FIELDS("DEVSUB"))
Begin DoDot:2
+55 IF $PIECE(ONETWO,U,9)=$PIECE($GET(^FSC("MOD",+FIELDS("MOD"),0)),U,8)
QUIT
+56 SET DR=DR_";3.2///@"
End DoDot:2
+57 IF FIELDS("MOD")
SET DR=DR_";3///`"_+FIELDS("MOD")
QUIT
+58 SET DR=DR_";3///@"
End DoDot:1
+59 IF $DATA(FIELDS("IRM"))
Begin DoDot:1
+60 SET IRM=$PIECE(ZERO,U,6)
+61 IF IRM=FIELDS("IRM")
QUIT
+62 SET EDITED=1
+63 IF FIELDS("IRM")
SET DR=DR_";2.1///`"_+FIELDS("IRM")
QUIT
+64 SET DR=DR_";2.1///@"
End DoDot:1
+65 IF $DATA(FIELDS("PRI"))
Begin DoDot:1
+66 SET PRI=$PIECE(ZERO,U,10)
+67 IF PRI=FIELDS("PRI")
QUIT
+68 SET EDITED=1
+69 IF FIELDS("PRI")
SET DR=DR_";6///`"_+FIELDS("PRI")
QUIT
+70 SET DR=DR_";6///@"
End DoDot:1
+71 IF $DATA(FIELDS("SPEC"))
Begin DoDot:1
+72 SET SPEC=$PIECE(ZERO,U,9)
+73 IF SPEC=FIELDS("SPEC")
QUIT
+74 SET EDITED=1
+75 IF FIELDS("SPEC")
SET DR=DR_";5///`"_+FIELDS("SPEC")
QUIT
+76 SET DR=DR_";5///@"
End DoDot:1
+77 IF $DATA(FIELDS("SPECD"))
Begin DoDot:1
+78 SET SPECD=$PIECE(ZERO,U,21)
+79 IF SPECD=FIELDS("SPECD")
QUIT
+80 SET EDITED=1
+81 IF FIELDS("SPECD")
SET DR=DR_";5.1///`"_+FIELDS("SPECD")
QUIT
+82 SET DR=DR_";5.1///@"
End DoDot:1
+83 IF $DATA(FIELDS("DEVSUB"))
Begin DoDot:1
+84 SET DEVSUB=$PIECE(ONETWO,U,11)
+85 IF DEVSUB=FIELDS("DEVSUB")
QUIT
+86 SET EDITED=1
+87 IF FIELDS("DEVSUB")
SET DR=DR_";3.2///`"_+FIELDS("DEVSUB")
QUIT
+88 SET DR=DR_";3.2///@"
End DoDot:1
+89 IF $LENGTH(DR)
Begin DoDot:1
+90 DO REOPEN(CALL,.REOPEN,.EDITED)
+91 DO SETUP^FSCRPCEC(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
End DoDot:1
+92 SET STATUS=+$GET(FIELDS("STATUS"))
+93 SET ZERO=^FSCD("CALL",CALL,0)
+94 SET CSTATUS=+$PIECE(ZERO,U,17)
+95 IF CSTATUS<2
SET CSTATUS=+$PIECE(ZERO,U,2)
+96 IF STATUS=CSTATUS
QUIT
+97 IF STATUS
IF (CSTATUS=2)!(CSTATUS=99)
Begin DoDot:1
+98 DO REOPEN(CALL,.REOPEN,.EDITED)
+99 SET ZERO=^FSCD("CALL",CALL,0)
+100 SET CSTATUS=+$PIECE(ZERO,U,17)
+101 IF CSTATUS<2
SET CSTATUS=+$PIECE(ZERO,U,2)
End DoDot:1
+102 IF STATUS=CSTATUS
QUIT
+103 IF $PIECE($GET(^FSC("STATUS",STATUS,0)),U,2)="D"
IF CSTATUS'=3
IF $PIECE($GET(^FSC("STATUS",CSTATUS,0)),U,2)'="D"
Begin DoDot:1
+104 DO STATUS^FSCRPCEC(CALL,3,.EDITED)
End DoDot:1
+105 IF STATUS=2
Begin DoDot:1
+106 SET OK=1
+107 SET DR="81///`"_DUZ
+108 IF $GET(FIELDS("FUNC"))
SET DR=DR_";8///`"_+FIELDS("FUNC")
+109 IF $GET(FIELDS("TASK"))
SET DR=DR_";9///`"_+FIELDS("TASK")
+110 SET CDATE=$GET(FIELDS("DATEC"))
+111 IF 'CDATE
SET CDATE=DT
+112 IF CDATE<$PIECE($GET(^FSCD("CALL",CALL,120)),U,4)
SET CDATE=$PIECE($GET(^(120)),U,4)\1
+113 SET DR=DR_";82///"_CDATE
+114 IF $LENGTH(DR)
Begin DoDot:2
+115 NEW DA,DIE,X,Y
+116 IF $EXTRACT(DR)=";"
SET DR=$EXTRACT(DR,2,245)
+117 SET DA=CALL
SET DIE="^FSCD(""CALL"","
+118 ; *** needs ok
LOCK +^FSCD("CALL",DA):30
IF '$TEST
SET OK=0
QUIT
+119 DO ^DIE
+120 LOCK -^FSCD("CALL",DA)
+121 DO PICKUP^FSCES(DA)
+122 SET DR=""
End DoDot:2
IF 'OK
QUIT
+123 DO RES^FSCRPCNC(CALL)
End DoDot:1
IF 'OK
QUIT
+124 IF STATUS
DO STATUS^FSCRPCEC(CALL,STATUS,.EDITED)
+125 QUIT
+126 ;
REOPEN(CALL,REOPEN,EDITED) ;
+1 IF 'REOPEN
QUIT
+2 SET REOPEN=0
SET EDITED=1
+3 SET OLDSTAT=+$PIECE(^FSCD("CALL",CALL,0),U,2)
+4 IF '(OLDSTAT=2!(OLDSTAT=99))
QUIT
+5 DO STATUS^FSCES(CALL,OLDSTAT,1,1)
+6 DO UPDATE^FSCTASK(CALL)
+7 QUIT