FSCRPCEB ;SLC/STAFF-NOIS RPC Edit Batch ;9/6/98 21:55
;;1.1;NOIS;;Sep 06, 1998
;
BATCH(IN,OUT) ; from FSCRPX (RPCEditBatch)
N CALL,EDITDATA,EDITED,FIELDS,NUM,PDATA K FIELDS
K ^TMP("FSC BATCH CALLS",$J),^TMP("FSC WP",$J)
D CALLS
D PROCESS^FSCRPCNC(.FIELDS)
S EDITDATA=$$EDITDATA(.FIELDS)
S PDATA=$$PDATA(.FIELDS)
I $L($G(FIELDS("SUBJECT"))) S FIELDS("SUBJECT")=$$FIX^FSCRPCEC(FIELDS("SUBJECT"))
I $L($G(FIELDS("PHONE"))) S FIELDS("PHONE")=$$FIX^FSCRPCEC(FIELDS("PHONE"))
I $L($G(FIELDS("PATCH"))) S FIELDS("PATCH")=$$FIX^FSCRPCEC(FIELDS("PATCH"))
I $L($G(FIELDS("KEYWORDS"))) S FIELDS("KEYWORDS")=$$FIX^FSCRPCEC(FIELDS("KEYWORDS"))
I $L($G(FIELDS("WEB"))) S FIELDS("WEB")=$$FIX^FSCRPCEC(FIELDS("WEB"))
I $L($G(FIELDS("PLONG"))) S FIELDS("PLONG")=$$FIX^FSCRPCEC(FIELDS("PLONG"))
I $L($G(FIELDS("PSHORT"))) S FIELDS("PSHORT")=$$FIX^FSCRPCEC(FIELDS("PSHORT"))
I $L($G(FIELDS("PNUM"))) S FIELDS("PNUM")=+FIELDS("PNUM")
I $L($G(FIELDS("HRS"))) S FIELDS("HRS")=+FIELDS("HRS")
S NUM=0 F S NUM=$O(^TMP("FSC BATCH CALLS",$J,NUM)) Q:NUM<1 S CALL=+^(NUM) D
.I '$D(^FSCD("CALL",CALL,0)) Q
.S EDITED=0
.I EDITDATA D FIELDS^FSCRPCEF(CALL,.FIELDS,.EDITED)
.I $D(FIELDS("WEB")) D WEB(CALL,FIELDS("WEB"),.EDITED)
.I EDITED D UPDATE^FSCAUDIT(CALL)
.I PDATA D PFIELDS(CALL,.FIELDS,.EDITED)
.I EDITED D MRE^FSCMR(DUZ,CALL)
.I $D(FIELDS("HRS")) D WKLD(CALL,.FIELDS)
.S ^TMP("FSC CURRENT LIST",$J,+$G(^TMP("FSC CURRENT LIST",$J,"C",CALL)))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
K ^TMP("FSC BATCH CALLS",$J),^TMP("FSC WP",$J)
Q
;
CALLS ;
N CALL,DONE,LINE,NUM
S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) I LINE="{CALLS}" D Q
.K ^TMP("FSCRPC",$J,"INPUT",NUM)
.F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) S DONE=0 D I DONE Q
..K ^TMP("FSCRPC",$J,"INPUT",NUM)
..I LINE="{{{}}}" S DONE=1 Q
..S ^TMP("FSC BATCH CALLS",$J,NUM)=LINE
Q
;
EDITDATA(FIELDS) ; $$(fields) -> 1 if used to edit call's fields, else 0
N OK,FNAME
S OK=0
F FNAME="STATUS","SUBJECT","PHONE","PATCH","KEYWORDS","MOD","IRM","PRI","SPEC","SPECD","DEVSUB" I $D(FIELDS(FNAME)) S OK=1 Q
I 'OK F FNAME="DESC","NOTE","RES" I $O(^TMP("FSC WP",$J,FNAME,0)) S OK=1 Q
Q OK
;
PDATA(FIELDS) ; $$(fields) -> 1 if edit personal fields, else 0
N OK,FNAME
S OK=0
F FNAME="PSHORT","PLONG","PNUM","PNOTE" I $D(FIELDS(FNAME)) S OK=1 Q
Q OK
;
WEB(CALL,VALUE,EDITED) ; from FSCRPCWS
N DA,DIE,DR,NEWV,OLDV,URL,X,Y K NEWV,OLDV
S URL=$P($G(^FSCD("CALL",CALL,1.7)),U)
I URL=VALUE Q
S EDITED=1
S OLDV("WEB")=U_URL
S DA=CALL,DIE="^FSCD(""CALL"","
I $L(VALUE) S DR="1.7///"_VALUE
E S DR="1.7///@"
D ^DIE
S NEWV("WEB")=U_$P($G(^FSCD("CALL",CALL,1.7)),U)
D AUDIT^FSCAUDIT(CALL,.OLDV,.NEWV)
K NEWV,OLDV
Q
;
PFIELDS(CALL,FIELDS,EDITED) ;
N CNT,DA,DIE,DIK,DR,LINE,NUM,OK,X,Y
S EDITED=1
S DA=+$G(^FSCD("CALL USER","AUC",DUZ,CALL))
I DA D
.S DR=""
.I $D(FIELDS("PSHORT")) D
..I $L(FIELDS("PSHORT")) S DR=DR_";2///"_FIELDS("PSHORT") Q
..S DR=DR_";2///@"
.I $D(FIELDS("PNUM")) D
..I $L(FIELDS("PNUM")) S DR=DR_";3///"_FIELDS("PNUM") Q
..S DR=DR_";3///@"
.I $D(FIELDS("PLONG")) D
..I $L(FIELDS("PLONG")) S DR=DR_";4///"_FIELDS("PLONG") Q
..S DR=DR_";4///@"
.I '$L(DR) Q
.I $E(DR)=";" S DR=$E(DR,2,255)
.S DIE="^FSCD(""CALL USER"","
.D ^DIE
E D
.L +^FSCD("CALL USER",0):5 I '$T Q
.S DA=1+$P(^FSCD("CALL USER",0),U,3)
.F Q:'$D(^FSCD("CALL USER",DA,0)) S DA=DA+1
.S $P(^FSCD("CALL USER",0),U,3)=DA,$P(^(0),U,4)=$P(^(0),U,4)+1
.S ^FSCD("CALL USER",DA,0)=CALL_U_DUZ_U_$G(FIELDS("PSHORT"))_U_$G(FIELDS("PNUM"))
.I $L($G(FIELDS("PLONG"))) S ^FSCD("CALL USER",DA,1)=FIELDS("PLONG")
.L -^FSCD("CALL USER",0)
.S DIK="^FSCD(""CALL USER"","
.D IX1^DIK
I $G(FIELDS("PNOTE"))=0 K ^FSCD("CALL USER",DA,2)
I $O(^TMP("FSC WP",$J,"PNOTE",0)) D
.I $G(FIELDS("PNOTE"))=2 K ^FSCD("CALL USER",DA,2)
.S CNT=+$P($G(^FSCD("CALL USER",DA,2,0)),U,3)
.S NUM=0 F S NUM=$O(^TMP("FSC WP",$J,"PNOTE",NUM)) Q:NUM<1 S LINE=^(NUM) D
..S CNT=CNT+1
..S ^FSCD("CALL USER",DA,2,CNT,0)=LINE
.I CNT S ^FSCD("CALL USER",DA,2,0)="^^"_CNT_U_CNT_U_DT_U
S OK=1 D
.Q:$L($P(^FSCD("CALL USER",DA,0),U,3)) Q:$L($P(^(0),U,4)) Q:$L($G(^(1))) Q:$O(^(2,0))
.S OK=0
I 'OK D DEL^FSCUCD("^FSCD(""CALL USER"",",DA)
Q
;
WKLD(CALL,FIELDS) ;
N DATE,DCLOSE,DOPEN,HRS,USER
S USER=DUZ
S DATE=$G(FIELDS("DATEW")) I 'DATE Q
S HRS=+$G(FIELDS("HRS")) I 'HRS Q
S DOPEN=$P($G(^FSCD("CALL",+CALL,0)),U,3),DCLOSE=$P($G(^(0)),U,4)
I 'DOPEN Q
I DCLOSE,DATE>$$FMADD^XLFDT(DCLOSE,+$P($G(^FSC("PARAM",1,0)),U,10)) Q
I DATE<DOPEN S DATE=DOPEN
I DCLOSE,DATE>DCLOSE S DATE=DCLOSE
D UPDATE^FSCEWKLD(CALL,HRS,DATE,USER)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCRPCEB 4744 printed Nov 22, 2024@17:29:16 Page 2
FSCRPCEB ;SLC/STAFF-NOIS RPC Edit Batch ;9/6/98 21:55
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
BATCH(IN,OUT) ; from FSCRPX (RPCEditBatch)
+1 NEW CALL,EDITDATA,EDITED,FIELDS,NUM,PDATA
KILL FIELDS
+2 KILL ^TMP("FSC BATCH CALLS",$JOB),^TMP("FSC WP",$JOB)
+3 DO CALLS
+4 DO PROCESS^FSCRPCNC(.FIELDS)
+5 SET EDITDATA=$$EDITDATA(.FIELDS)
+6 SET PDATA=$$PDATA(.FIELDS)
+7 IF $LENGTH($GET(FIELDS("SUBJECT")))
SET FIELDS("SUBJECT")=$$FIX^FSCRPCEC(FIELDS("SUBJECT"))
+8 IF $LENGTH($GET(FIELDS("PHONE")))
SET FIELDS("PHONE")=$$FIX^FSCRPCEC(FIELDS("PHONE"))
+9 IF $LENGTH($GET(FIELDS("PATCH")))
SET FIELDS("PATCH")=$$FIX^FSCRPCEC(FIELDS("PATCH"))
+10 IF $LENGTH($GET(FIELDS("KEYWORDS")))
SET FIELDS("KEYWORDS")=$$FIX^FSCRPCEC(FIELDS("KEYWORDS"))
+11 IF $LENGTH($GET(FIELDS("WEB")))
SET FIELDS("WEB")=$$FIX^FSCRPCEC(FIELDS("WEB"))
+12 IF $LENGTH($GET(FIELDS("PLONG")))
SET FIELDS("PLONG")=$$FIX^FSCRPCEC(FIELDS("PLONG"))
+13 IF $LENGTH($GET(FIELDS("PSHORT")))
SET FIELDS("PSHORT")=$$FIX^FSCRPCEC(FIELDS("PSHORT"))
+14 IF $LENGTH($GET(FIELDS("PNUM")))
SET FIELDS("PNUM")=+FIELDS("PNUM")
+15 IF $LENGTH($GET(FIELDS("HRS")))
SET FIELDS("HRS")=+FIELDS("HRS")
+16 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSC BATCH CALLS",$JOB,NUM))
if NUM<1
QUIT
SET CALL=+^(NUM)
Begin DoDot:1
+17 IF '$DATA(^FSCD("CALL",CALL,0))
QUIT
+18 SET EDITED=0
+19 IF EDITDATA
DO FIELDS^FSCRPCEF(CALL,.FIELDS,.EDITED)
+20 IF $DATA(FIELDS("WEB"))
DO WEB(CALL,FIELDS("WEB"),.EDITED)
+21 IF EDITED
DO UPDATE^FSCAUDIT(CALL)
+22 IF PDATA
DO PFIELDS(CALL,.FIELDS,.EDITED)
+23 IF EDITED
DO MRE^FSCMR(DUZ,CALL)
+24 IF $DATA(FIELDS("HRS"))
DO WKLD(CALL,.FIELDS)
+25 SET ^TMP("FSC CURRENT LIST",$JOB,+$GET(^TMP("FSC CURRENT LIST",$JOB,"C",CALL)))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
End DoDot:1
+26 KILL ^TMP("FSC BATCH CALLS",$JOB),^TMP("FSC WP",$JOB)
+27 QUIT
+28 ;
CALLS ;
+1 NEW CALL,DONE,LINE,NUM
+2 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
IF LINE="{CALLS}"
Begin DoDot:1
+3 KILL ^TMP("FSCRPC",$JOB,"INPUT",NUM)
+4 FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
SET DONE=0
Begin DoDot:2
+5 KILL ^TMP("FSCRPC",$JOB,"INPUT",NUM)
+6 IF LINE="{{{}}}"
SET DONE=1
QUIT
+7 SET ^TMP("FSC BATCH CALLS",$JOB,NUM)=LINE
End DoDot:2
IF DONE
QUIT
End DoDot:1
QUIT
+8 QUIT
+9 ;
EDITDATA(FIELDS) ; $$(fields) -> 1 if used to edit call's fields, else 0
+1 NEW OK,FNAME
+2 SET OK=0
+3 FOR FNAME="STATUS","SUBJECT","PHONE","PATCH","KEYWORDS","MOD","IRM","PRI","SPEC","SPECD","DEVSUB"
IF $DATA(FIELDS(FNAME))
SET OK=1
QUIT
+4 IF 'OK
FOR FNAME="DESC","NOTE","RES"
IF $ORDER(^TMP("FSC WP",$JOB,FNAME,0))
SET OK=1
QUIT
+5 QUIT OK
+6 ;
PDATA(FIELDS) ; $$(fields) -> 1 if edit personal fields, else 0
+1 NEW OK,FNAME
+2 SET OK=0
+3 FOR FNAME="PSHORT","PLONG","PNUM","PNOTE"
IF $DATA(FIELDS(FNAME))
SET OK=1
QUIT
+4 QUIT OK
+5 ;
WEB(CALL,VALUE,EDITED) ; from FSCRPCWS
+1 NEW DA,DIE,DR,NEWV,OLDV,URL,X,Y
KILL NEWV,OLDV
+2 SET URL=$PIECE($GET(^FSCD("CALL",CALL,1.7)),U)
+3 IF URL=VALUE
QUIT
+4 SET EDITED=1
+5 SET OLDV("WEB")=U_URL
+6 SET DA=CALL
SET DIE="^FSCD(""CALL"","
+7 IF $LENGTH(VALUE)
SET DR="1.7///"_VALUE
+8 IF '$TEST
SET DR="1.7///@"
+9 DO ^DIE
+10 SET NEWV("WEB")=U_$PIECE($GET(^FSCD("CALL",CALL,1.7)),U)
+11 DO AUDIT^FSCAUDIT(CALL,.OLDV,.NEWV)
+12 KILL NEWV,OLDV
+13 QUIT
+14 ;
PFIELDS(CALL,FIELDS,EDITED) ;
+1 NEW CNT,DA,DIE,DIK,DR,LINE,NUM,OK,X,Y
+2 SET EDITED=1
+3 SET DA=+$GET(^FSCD("CALL USER","AUC",DUZ,CALL))
+4 IF DA
Begin DoDot:1
+5 SET DR=""
+6 IF $DATA(FIELDS("PSHORT"))
Begin DoDot:2
+7 IF $LENGTH(FIELDS("PSHORT"))
SET DR=DR_";2///"_FIELDS("PSHORT")
QUIT
+8 SET DR=DR_";2///@"
End DoDot:2
+9 IF $DATA(FIELDS("PNUM"))
Begin DoDot:2
+10 IF $LENGTH(FIELDS("PNUM"))
SET DR=DR_";3///"_FIELDS("PNUM")
QUIT
+11 SET DR=DR_";3///@"
End DoDot:2
+12 IF $DATA(FIELDS("PLONG"))
Begin DoDot:2
+13 IF $LENGTH(FIELDS("PLONG"))
SET DR=DR_";4///"_FIELDS("PLONG")
QUIT
+14 SET DR=DR_";4///@"
End DoDot:2
+15 IF '$LENGTH(DR)
QUIT
+16 IF $EXTRACT(DR)=";"
SET DR=$EXTRACT(DR,2,255)
+17 SET DIE="^FSCD(""CALL USER"","
+18 DO ^DIE
End DoDot:1
+19 IF '$TEST
Begin DoDot:1
+20 LOCK +^FSCD("CALL USER",0):5
IF '$TEST
QUIT
+21 SET DA=1+$PIECE(^FSCD("CALL USER",0),U,3)
+22 FOR
if '$DATA(^FSCD("CALL USER",DA,0))
QUIT
SET DA=DA+1
+23 SET $PIECE(^FSCD("CALL USER",0),U,3)=DA
SET $PIECE(^(0),U,4)=$PIECE(^(0),U,4)+1
+24 SET ^FSCD("CALL USER",DA,0)=CALL_U_DUZ_U_$GET(FIELDS("PSHORT"))_U_$GET(FIELDS("PNUM"))
+25 IF $LENGTH($GET(FIELDS("PLONG")))
SET ^FSCD("CALL USER",DA,1)=FIELDS("PLONG")
+26 LOCK -^FSCD("CALL USER",0)
+27 SET DIK="^FSCD(""CALL USER"","
+28 DO IX1^DIK
End DoDot:1
+29 IF $GET(FIELDS("PNOTE"))=0
KILL ^FSCD("CALL USER",DA,2)
+30 IF $ORDER(^TMP("FSC WP",$JOB,"PNOTE",0))
Begin DoDot:1
+31 IF $GET(FIELDS("PNOTE"))=2
KILL ^FSCD("CALL USER",DA,2)
+32 SET CNT=+$PIECE($GET(^FSCD("CALL USER",DA,2,0)),U,3)
+33 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSC WP",$JOB,"PNOTE",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
Begin DoDot:2
+34 SET CNT=CNT+1
+35 SET ^FSCD("CALL USER",DA,2,CNT,0)=LINE
End DoDot:2
+36 IF CNT
SET ^FSCD("CALL USER",DA,2,0)="^^"_CNT_U_CNT_U_DT_U
End DoDot:1
+37 SET OK=1
Begin DoDot:1
+38 if $LENGTH($PIECE(^FSCD("CALL USER",DA,0),U,3))
QUIT
if $LENGTH($PIECE(^(0),U,4))
QUIT
if $LENGTH($GET(^(1)))
QUIT
if $ORDER(^(2,0))
QUIT
+39 SET OK=0
End DoDot:1
+40 IF 'OK
DO DEL^FSCUCD("^FSCD(""CALL USER"",",DA)
+41 QUIT
+42 ;
WKLD(CALL,FIELDS) ;
+1 NEW DATE,DCLOSE,DOPEN,HRS,USER
+2 SET USER=DUZ
+3 SET DATE=$GET(FIELDS("DATEW"))
IF 'DATE
QUIT
+4 SET HRS=+$GET(FIELDS("HRS"))
IF 'HRS
QUIT
+5 SET DOPEN=$PIECE($GET(^FSCD("CALL",+CALL,0)),U,3)
SET DCLOSE=$PIECE($GET(^(0)),U,4)
+6 IF 'DOPEN
QUIT
+7 IF DCLOSE
IF DATE>$$FMADD^XLFDT(DCLOSE,+$PIECE($GET(^FSC("PARAM",1,0)),U,10))
QUIT
+8 IF DATE<DOPEN
SET DATE=DOPEN
+9 IF DCLOSE
IF DATE>DCLOSE
SET DATE=DCLOSE
+10 DO UPDATE^FSCEWKLD(CALL,HRS,DATE,USER)
+11 QUIT