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

FSCRPCNC.m

Go to the documentation of this file.
FSCRPCNC ;SLC/STAFF-NOIS RPC New Call ;9/6/98  22:02
 ;;1.1;NOIS;;Sep 06, 1998
 ;
NEW(IN,OUT) ; from FSCRPX (RPCNewCall)
 N CALLID,CALL,DATEO,FIELDS,OK,SITE K FIELDS
 K ^TMP("FSC WP",$J)
 D PROCESS(.FIELDS)
 S SITE=+$G(FIELDS("SITE"))
 S DATEO=+$G(FIELDS("DATEO"))
 Q:'SITE  Q:'DATEO
 D NEWCALL(SITE,DATEO,.CALLID,.CALL,.OK)
 I 'OK Q
 D FIELDS(CALL,.FIELDS)
 S ^TMP("FSCRPC",$J,"OUTPUT",1)=+CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
 K ^TMP("FSC WP",$J)
 Q
 ;
NEWCALL(SITE,RDATE,CALLID,CALL,OK) ;
 N DIC,DLAYGO,DR,EPTYPE,ISC,SITE0,X,Y K DIC
 S OK=0
 S SITE0=^FSC("SITE",SITE,0)
 D CALLNUM^FSCUC(SITE0,RDATE,.CALLID,.OK)
 I 'OK Q
 S OK=0
 S DIC=7100,DIC(0)="XL",DLAYGO=7100,X=CALLID
 D ^DIC K DIC,DLAYGO
 I Y<1 Q
 I $$ACCESS^FSCU(DUZ,"SPEC") S EPTYPE=$O(^FSC("EPTYPE","B","SPECIALIST",0))
 E  S EPTYPE=$O(^FSC("EPTYPE","B","NON-SPECIALIST",0))
 S CALL=+Y,OK=1
 S DR="2///`"_SITE_";10///"_RDATE_";120///NOW;5.2///`"_DUZ_";5.3///"_EPTYPE_";101///`"_CALL
 S ISC=+$P($G(^FSC("SITE",SITE,0)),U,11) I ISC S DR=DR_";2.3///`"_ISC
 D SETUP(CALL,"^FSCD(""CALL"",",.DR)
 D MRE^FSCMR(DUZ,CALL)
 Q
 ;
FIELDS(CALL,FIELDS) ;
 N DR,STATUS
 D DESC(CALL)
 D NOTE(CALL)
 S DR=""
 I $L($G(FIELDS("SUBJECT"))) S DR=DR_";1///"_$$FIX^FSCRPCEC(FIELDS("SUBJECT"))
 I $L($G(FIELDS("PHONE"))) S DR=DR_";2.2///"_$$FIX^FSCRPCEC(FIELDS("PHONE"))
 I $L($G(FIELDS("PATCH"))) S DR=DR_";7///"_$$FIX^FSCRPCEC(FIELDS("PATCH"))
 I $L($G(FIELDS("KEYWORDS"))) S DR=DR_";1.5///"_$$FIX^FSCRPCEC(FIELDS("KEYWORDS"))
 I $L(DR)>100 D SETUP(CALL,"^FSCD(""CALL"",",.DR)
 I $G(FIELDS("MOD")) S DR=DR_";3///`"_+FIELDS("MOD")
 I $G(FIELDS("IRM")) S DR=DR_";2.1///`"_+FIELDS("IRM")
 I $G(FIELDS("PRI")) S DR=DR_";6///`"_+FIELDS("PRI")
 I $G(FIELDS("SPEC")) S DR=DR_";5///`"_+FIELDS("SPEC")
 I $G(FIELDS("SPECD")) S DR=DR_";5.1///`"_+FIELDS("SPECD")
 I $G(FIELDS("DEVSUB")) S DR=DR_";3.2///`"_+FIELDS("DEVSUB")
 D SETUP(CALL,"^FSCD(""CALL"",",.DR)
 S STATUS=+$G(FIELDS("STATUS"))
 I STATUS=2 D
 .S DR="81///`"_DUZ
 .I $G(FIELDS("FUNC")) S DR=DR_";8///`"_+FIELDS("FUNC")
 .I $G(FIELDS("TASK")) S DR=DR_";9///`"_+FIELDS("TASK")
 .I $L($G(FIELDS("DATEC"))) S DR=DR_";82///"_FIELDS("DATEC")
 .D SETUP(CALL,"^FSCD(""CALL"",",.DR)
 .D RES(CALL)
 D STATUS(CALL,STATUS)
 Q
 ;
SETUP(DA,DIE,DR) ;
 N X,Y
 I '$L(DR) Q
 I $E(DR)=";" S DR=$E(DR,2,245)
 L +^FSCD("CALL",DA):30 I '$T Q  ; *** needs ok
 D ^DIE
 L -^FSCD("CALL",DA)
 D PICKUP^FSCES(DA)
 S DR=""
 Q
 ;
STATUS(CALL,STATUS) ;
 I STATUS=1 D
 .D STATUS^FSCES(CALL,"",1)
 .D UPDATE^FSCTASK(CALL)
 E  I STATUS=3 D
 .D STATUS^FSCES(CALL,"",1)
 .D UPDATE^FSCTASK(CALL)
 .D STATUS^FSCES(CALL,1,3)
 .D UPDATE^FSCTASK(CALL)
 E  I STATUS=2 D
 .D STATUS^FSCES(CALL,"",1)
 .D UPDATE^FSCTASK(CALL)
 .D STATUS^FSCES(CALL,1,2)
 .D UPDATE^FSCTASK(CALL)
 Q
 ;
RES(CALL) ; from FSCRPCEC, FSCRPCEF
 N CNT,LINE,LINECNT
 I '$O(^TMP("FSC WP",$J,"RES",0)) Q
 S (LINECNT,CNT)=0 F  S CNT=$O(^TMP("FSC WP",$J,"RES",CNT)) Q:CNT<1  S LINE=^(CNT) D
 .S LINECNT=LINECNT+1
 .S ^FSCD("CALL",CALL,80,LINECNT,0)=LINE
 S ^FSCD("CALL",CALL,80,0)="^^"_LINECNT_U_LINECNT_U_DT_U
 Q
 ;
DESC(CALL) ; from FSCRPCEC, FSCRPCEF
 N CNT,LINE,LINECNT
 I '$O(^TMP("FSC WP",$J,"DESC",0)) Q
 K ^FSCD("CALL",CALL,30)
 S (LINECNT,CNT)=0 F  S CNT=$O(^TMP("FSC WP",$J,"DESC",CNT)) Q:CNT<1  S LINE=^(CNT) D
 .S LINECNT=LINECNT+1
 .S ^FSCD("CALL",CALL,30,LINECNT,0)=LINE
 S ^FSCD("CALL",CALL,30,0)="^^"_LINECNT_U_LINECNT_U_DT_U
 Q
 ;
NOTE(CALL) ; from FSCRPCEC, FSCRPCEF
 N CNT,LINE,NUM
 I '$O(^TMP("FSC WP",$J,"NOTE",0)) Q
 S NUM=$P(^FSCD("CALL",CALL,120),U,7)+1,$P(^(120),U,7)=NUM
 S LINE="("_NUM_") "_$$FMTE^XLFDT($$NOW^XLFDT)
 S LINE=$$SETSTR^VALM1($$VALUE^FSCGET(DUZ,7107.1,1),LINE,35,$L(LINE))
 L +^FSCD("CALL",CALL,50):30 I '$T Q  ; *** needs ok
 I '$D(^FSCD("CALL",CALL,50,0)) S ^(0)="^^0^0^"_DT_U
 S CNT=1+$O(^FSCD("CALL",CALL,50,"A"),-1)
 S $P(^FSCD("CALL",CALL,120),U,6)=CNT
 S ^FSCD("CALL",CALL,50,CNT,0)=LINE
 S LINE=0 F  S LINE=$O(^TMP("FSC WP",$J,"NOTE",LINE)) Q:LINE<1  S CNT=CNT+1,^FSCD("CALL",CALL,50,CNT,0)=^(LINE)
 S CNT=CNT+1,^FSCD("CALL",CALL,50,CNT,0)=""
 S $P(^FSCD("CALL",CALL,50,0),U,3,4)=CNT_U_CNT
 L -^FSCD("CALL",CALL,50)
 Q
 ;
PROCESS(FIELDS) ; from FSCRPCEB, FSCRPCEC, FSCRPCEN, FSCRPCWP, FSCRPCWS
 N CNT,LINE
 S CNT=0 F  S CNT=$O(^TMP("FSCRPC",$J,"INPUT",CNT)) Q:CNT<1  S LINE=^(CNT) D  Q:CNT<1
 .I '$L(LINE) Q
 .I $E(LINE)'="{" S FIELDS($P(LINE,U))=$P(LINE,U,2,99) Q
 .I LINE="{DESC}" D WP("DESC",.CNT) Q
 .I LINE="{NOTE}" D WP("NOTE",.CNT) Q
 .I LINE="{RES}" D WP("RES",.CNT) Q
 .I LINE="{PNOTE}" D WP("PNOTE",.CNT) Q
 Q
 ;
WP(NODE,CNT) ;
 N LINE,LINECNT
 S LINECNT=0
 F  S CNT=$O(^TMP("FSCRPC",$J,"INPUT",CNT)) Q:CNT<1  S LINE=^(CNT) Q:LINE="{{{}}}"  D
 .S LINECNT=LINECNT+1
 .S ^TMP("FSC WP",$J,NODE,LINECNT)=LINE
 Q