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

FSCRPCEB.m

Go to the documentation of this file.
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