FSCRPCOC ;SLC/STAFF-NOIS RPC Other Contacts ;6/3/98 11:00
;;1.1;NOIS;;Sep 06, 1998
;
CONTACTS(IN,OUT) ; from FSCRPX (RPCCallContacts)
N CALL,CONTACT,CONTPH,CNT,DEVSP,MOD,NUM,PACK,PACKNAME,PIECE,SITE,SPEC,STINFO,STSITE,UNUM,USER,USERS K USERS
S CALL=+$G(^TMP("FSCRPC",$J,"INPUT",1))
I 'CALL S ^TMP("FSCRPC",$J,"OUTPUT",1)="no information" Q
S NUM=0
S SITE=$P(^FSCD("CALL",CALL,0),U,5),CONTACT=$P(^(0),U,6),CONTPH=$P(^(0),U,7),MOD=$P(^(0),U,8),SPEC=$P(^(0),U,9),DEVSP=$P(^(0),U,21)
I SPEC S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Specialist: "_$$VALUE^FSCGET(SPEC,7100,5)_" "_$$PH(SPEC)
I DEVSP S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Referred Specialist: "_$$VALUE^FSCGET(DEVSP,7100,5.1)_" "_$$PH(DEVSP)
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=""
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Contact: "_$$VALUE^FSCGET(CONTACT,7100,2.1)_" "_CONTPH
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="NOIS contact information for this location: "_$$NOISINFO(SITE)
I 'MOD Q
S PACK=+$P(^FSC("MOD",MOD,0),U,8),PACKNAME=$P($G(^FSC("PACK",PACK,0)),U)
I '$L(PACKNAME) Q
S STSITE=$$STSITE(SITE) I STSITE D
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=""
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="IRM Chief and phone: "_$$IRMINFO(STSITE)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=PACKNAME_" ADPAC and phone: "_$$APINFO(STSITE,PACK)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Information on "_$P(^FSC("SITE",SITE,0),U)_":"
.S STINFO=$G(^NTS(2050,STSITE,1))
.F PIECE=1:1:3 S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=" "_$P(STINFO,U,PIECE)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=", "_$$VALUE^FSCGET($P(STINFO,U,4),2050,7)_" "_$P(STINFO,U,5)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=" FTS #: "_$P(STINFO,U,6)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=" COMM #: "_$P(STINFO,U,7)
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=""
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Those affiliated with "_PACKNAME_":"
D AFFIL(PACK,.USERS)
S CNT=16,USER="" F S USER=$O(USERS(USER)) Q:USER="" D
.S UNUM=0 F S UNUM=$O(USERS(USER,UNUM)) Q:UNUM<1 D
..S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=USER_" "_USERS(USER,UNUM)
..S CNT=CNT+1
Q
;
AFFIL(PACK,USERS) ;
N DUTIES,FUNC,PACKGP,USER,USERNAME K USERS
S PACKGP=+$P(^FSC("PACK",PACK,0),U,2)
S USER=0 F S USER=$O(^FSC("SPEC","AG",PACKGP,USER)) Q:USER<.1 D
.I '$$ACCESS^FSCU(USER,"SPEC") Q
.S USERNAME=$P(^VA(200,USER,0),U)
.I $P($G(^FSC("SPEC",USER,20,+$O(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,3) D
..S DUTIES=$P($G(^FSC("SPEC",USER,20,+$O(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,2)
..S FUNC=$$VALUE^FSCGET($P(^FSC("SPEC",USER,0),U,4),7105.2,4) I $L(FUNC) S FUNC="("_FUNC_")"
..S USERS(USERNAME,USER)=FUNC_" "_DUTIES_" "_$$PH(USER)
S USER=0 F S USER=$O(^FSC("SPEC","AP",PACK,USER)) Q:USER<.1 D
.I '$$ACCESS^FSCU(USER,"SPEC") Q
.S USERNAME=$P(^VA(200,USER,0),U)
.S DUTIES=$P($G(^FSC("SPEC",USER,30,+$O(^FSC("SPEC","AP",PACK,USER,0)),0)),U,2)
.S FUNC=$$VALUE^FSCGET($P(^FSC("SPEC",USER,0),U,4),7105.2,4) I $L(FUNC) S FUNC="("_FUNC_")"
.S USERS(USERNAME,USER)=FUNC_" "_DUTIES_" "_$$PH(USER)
Q
;
NOISINFO(SITE) ; $$(site) -> contact & phone #
N INFO
S INFO=$P($G(^FSC("SITE",SITE,0)),U,6) I 'INFO Q ""
S INFO=$$VALUE^FSCGET(INFO,7100,2.1)
S INFO=INFO_" "_$S($L($P(^FSC("SITE",SITE,0),U,7)):$P(^(0),U,7),1:$P(^(0),U,8))
Q INFO
;
PH(PERSON) ; $$(person) -> phone # from file 200
Q $P($G(^VA(200,PERSON,.13)),U,2)
;
IRMINFO(STSITE) ; $$(site) -> irm chief & phone #
N INFO,IRM
S IRM=$G(^NTS(2050,STSITE,21))
S INFO=$P(IRM,U)_" "_$P(IRM,U,2) I $L(INFO)=2 Q ""
Q INFO
;
APINFO(STSITE,PACK) ; $$(site, pack) -> adpac & phone #
N ADPAC,INFO,STPACK
S STPACK=$$STPACK(PACK) I 'STPACK Q ""
S ADPAC=$G(^NTS(2050,STSITE,8,STPACK,0))
S INFO=$P(ADPAC,U,2)_" "_$P(ADPAC,U,3) I $L(INFO)=2 Q ""
Q INFO
;
STSITE(SITE) ; $$(site) -> site tracking site
N DOMAIN,STSITE
S DOMAIN=+$P(^FSC("SITE",SITE,0),U,14) I 'DOMAIN Q ""
S DOMAIN=$$VALUE^FSCGET(DOMAIN,7105.1,9)
S STSITE=+$O(^NTS(2050,"AE",DOMAIN,0)) I 'STSITE Q ""
Q STSITE
;
STPACK(PACK) ; $$(package) -> site tracking package
N OPACK,STPACK
I '$L(PACK) Q ""
S OPACK=+$P($G(^FSC("PACK",PACK,0)),U,3) I 'OPACK Q ""
S STPACK=+$O(^DIC(120102,"AP",OPACK,0)) I 'STPACK Q ""
Q STPACK
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCRPCOC 4345 printed Dec 13, 2024@02:19:37 Page 2
FSCRPCOC ;SLC/STAFF-NOIS RPC Other Contacts ;6/3/98 11:00
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
CONTACTS(IN,OUT) ; from FSCRPX (RPCCallContacts)
+1 NEW CALL,CONTACT,CONTPH,CNT,DEVSP,MOD,NUM,PACK,PACKNAME,PIECE,SITE,SPEC,STINFO,STSITE,UNUM,USER,USERS
KILL USERS
+2 SET CALL=+$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
+3 IF 'CALL
SET ^TMP("FSCRPC",$JOB,"OUTPUT",1)="no information"
QUIT
+4 SET NUM=0
+5 SET SITE=$PIECE(^FSCD("CALL",CALL,0),U,5)
SET CONTACT=$PIECE(^(0),U,6)
SET CONTPH=$PIECE(^(0),U,7)
SET MOD=$PIECE(^(0),U,8)
SET SPEC=$PIECE(^(0),U,9)
SET DEVSP=$PIECE(^(0),U,21)
+6 IF SPEC
SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)="Specialist: "_$$VALUE^FSCGET(SPEC,7100,5)_" "_$$PH(SPEC)
+7 IF DEVSP
SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)="Referred Specialist: "_$$VALUE^FSCGET(DEVSP,7100,5.1)_" "_$$PH(DEVSP)
+8 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=""
+9 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)="Contact: "_$$VALUE^FSCGET(CONTACT,7100,2.1)_" "_CONTPH
+10 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)="NOIS contact information for this location: "_$$NOISINFO(SITE)
+11 IF 'MOD
QUIT
+12 SET PACK=+$PIECE(^FSC("MOD",MOD,0),U,8)
SET PACKNAME=$PIECE($GET(^FSC("PACK",PACK,0)),U)
+13 IF '$LENGTH(PACKNAME)
QUIT
+14 SET STSITE=$$STSITE(SITE)
IF STSITE
Begin DoDot:1
+15 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=""
+16 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)="IRM Chief and phone: "_$$IRMINFO(STSITE)
+17 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=PACKNAME_" ADPAC and phone: "_$$APINFO(STSITE,PACK)
+18 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)="Information on "_$PIECE(^FSC("SITE",SITE,0),U)_":"
+19 SET STINFO=$GET(^NTS(2050,STSITE,1))
+20 FOR PIECE=1:1:3
SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=" "_$PIECE(STINFO,U,PIECE)
+21 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=", "_$$VALUE^FSCGET($PIECE(STINFO,U,4),2050,7)_" "_$PIECE(STINFO,U,5)
+22 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=" FTS #: "_$PIECE(STINFO,U,6)
+23 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=" COMM #: "_$PIECE(STINFO,U,7)
End DoDot:1
+24 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=""
+25 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)="Those affiliated with "_PACKNAME_":"
+26 DO AFFIL(PACK,.USERS)
+27 SET CNT=16
SET USER=""
FOR
SET USER=$ORDER(USERS(USER))
if USER=""
QUIT
Begin DoDot:1
+28 SET UNUM=0
FOR
SET UNUM=$ORDER(USERS(USER,UNUM))
if UNUM<1
QUIT
Begin DoDot:2
+29 SET NUM=NUM+1
SET ^TMP("FSCRPC",$JOB,"OUTPUT",NUM)=USER_" "_USERS(USER,UNUM)
+30 SET CNT=CNT+1
End DoDot:2
End DoDot:1
+31 QUIT
+32 ;
AFFIL(PACK,USERS) ;
+1 NEW DUTIES,FUNC,PACKGP,USER,USERNAME
KILL USERS
+2 SET PACKGP=+$PIECE(^FSC("PACK",PACK,0),U,2)
+3 SET USER=0
FOR
SET USER=$ORDER(^FSC("SPEC","AG",PACKGP,USER))
if USER<.1
QUIT
Begin DoDot:1
+4 IF '$$ACCESS^FSCU(USER,"SPEC")
QUIT
+5 SET USERNAME=$PIECE(^VA(200,USER,0),U)
+6 IF $PIECE($GET(^FSC("SPEC",USER,20,+$ORDER(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,3)
Begin DoDot:2
+7 SET DUTIES=$PIECE($GET(^FSC("SPEC",USER,20,+$ORDER(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,2)
+8 SET FUNC=$$VALUE^FSCGET($PIECE(^FSC("SPEC",USER,0),U,4),7105.2,4)
IF $LENGTH(FUNC)
SET FUNC="("_FUNC_")"
+9 SET USERS(USERNAME,USER)=FUNC_" "_DUTIES_" "_$$PH(USER)
End DoDot:2
End DoDot:1
+10 SET USER=0
FOR
SET USER=$ORDER(^FSC("SPEC","AP",PACK,USER))
if USER<.1
QUIT
Begin DoDot:1
+11 IF '$$ACCESS^FSCU(USER,"SPEC")
QUIT
+12 SET USERNAME=$PIECE(^VA(200,USER,0),U)
+13 SET DUTIES=$PIECE($GET(^FSC("SPEC",USER,30,+$ORDER(^FSC("SPEC","AP",PACK,USER,0)),0)),U,2)
+14 SET FUNC=$$VALUE^FSCGET($PIECE(^FSC("SPEC",USER,0),U,4),7105.2,4)
IF $LENGTH(FUNC)
SET FUNC="("_FUNC_")"
+15 SET USERS(USERNAME,USER)=FUNC_" "_DUTIES_" "_$$PH(USER)
End DoDot:1
+16 QUIT
+17 ;
NOISINFO(SITE) ; $$(site) -> contact & phone #
+1 NEW INFO
+2 SET INFO=$PIECE($GET(^FSC("SITE",SITE,0)),U,6)
IF 'INFO
QUIT ""
+3 SET INFO=$$VALUE^FSCGET(INFO,7100,2.1)
+4 SET INFO=INFO_" "_$SELECT($LENGTH($PIECE(^FSC("SITE",SITE,0),U,7)):$PIECE(^(0),U,7),1:$PIECE(^(0),U,8))
+5 QUIT INFO
+6 ;
PH(PERSON) ; $$(person) -> phone # from file 200
+1 QUIT $PIECE($GET(^VA(200,PERSON,.13)),U,2)
+2 ;
IRMINFO(STSITE) ; $$(site) -> irm chief & phone #
+1 NEW INFO,IRM
+2 SET IRM=$GET(^NTS(2050,STSITE,21))
+3 SET INFO=$PIECE(IRM,U)_" "_$PIECE(IRM,U,2)
IF $LENGTH(INFO)=2
QUIT ""
+4 QUIT INFO
+5 ;
APINFO(STSITE,PACK) ; $$(site, pack) -> adpac & phone #
+1 NEW ADPAC,INFO,STPACK
+2 SET STPACK=$$STPACK(PACK)
IF 'STPACK
QUIT ""
+3 SET ADPAC=$GET(^NTS(2050,STSITE,8,STPACK,0))
+4 SET INFO=$PIECE(ADPAC,U,2)_" "_$PIECE(ADPAC,U,3)
IF $LENGTH(INFO)=2
QUIT ""
+5 QUIT INFO
+6 ;
STSITE(SITE) ; $$(site) -> site tracking site
+1 NEW DOMAIN,STSITE
+2 SET DOMAIN=+$PIECE(^FSC("SITE",SITE,0),U,14)
IF 'DOMAIN
QUIT ""
+3 SET DOMAIN=$$VALUE^FSCGET(DOMAIN,7105.1,9)
+4 SET STSITE=+$ORDER(^NTS(2050,"AE",DOMAIN,0))
IF 'STSITE
QUIT ""
+5 QUIT STSITE
+6 ;
STPACK(PACK) ; $$(package) -> site tracking package
+1 NEW OPACK,STPACK
+2 IF '$LENGTH(PACK)
QUIT ""
+3 SET OPACK=+$PIECE($GET(^FSC("PACK",PACK,0)),U,3)
IF 'OPACK
QUIT ""
+4 SET STPACK=+$ORDER(^DIC(120102,"AP",OPACK,0))
IF 'STPACK
QUIT ""
+5 QUIT STPACK