BEXSITE ;IHS/CMI/DAY - BEX - Division and Site Selection ; 05 Oct 2015 11:42 AM
;;1.0;BEX TELEPHONE REFILL SYSTEM;*6*;APR 20, 2015;Build 7
;
Q
;
;Site Notes
;
;PSOSITE is set to the IEN in the OUTPATIENT SITE file
;
;PSOPINST is set to the Related Institution in the
;OUTPATIENT SITE file
;
;PSOINST is needed for BEXRX7 and is set in ^PSOLSET however, the
;value is set to the Station Number, which is set by users or by
;assigned Station Numbers in the 8000 range. Therefore, we must set
;PSOINST ourselves.
;
;
CHANGE ;EP - Display current site and ask user if they want to change
;
;Do not ask if only one Outpatient Site
I $P($G(^PS(59,0)),U,3)=1 Q
;
;If we do not have these variables, we have to ask them first
I '$D(PSOSITE) K PSOPAR
I '$D(PSOPAR) D ^PSOLSET
I '$D(PSOPAR) G CHANGE
;
;We assume from here that we have multiple Outpatient Site entries
;
W !!
F I=1:1:70 W "*"
W !
W "*** O/P Site (Division) is: "
W ?30,$$GET1^DIQ(59,PSOSITE,.01),?67,"***",!
W "*** Related Institution is: "
W ?30,$$GET1^DIQ(4,PSOPINST,.01),?67,"***",!
F I=1:1:70 W "*"
W !
;
K DIR
S DIR(0)="YO"
S DIR("A")="Do you want to change these"
S DIR("B")="N"
D ^DIR
I Y'=1 Q
;
K PSOSITE,PSOPAR,PSOPINST
D ^PSOLSET
I '$D(PSOPAR) G CHANGE
;
W !!
W "The RELATED INSTITUTION is ",$$GET1^DIQ(4,PSOPINST,.01),!
W "and will be used to lookup and display health record numbers.",!
;
;This is borrowed from ASKSITE^XUS1
K DIC
S DIC(0)="AEQM"
S DIC="^VA(200,DUZ,2,"
S DIC("P")="200.02P"
S DIC("A")="Select RELATED INSTITUTION: "
S DIC("B")=PSOPINST
D ^DIC
K DIC
I Y>0 S PSOPINST=+Y,DUZ(2)=+Y
W !!
;
Q
;
;
HOLD ;EP - Store original settings when a user enters BEX processing
;
;We store PSOSITE (the Outpatient Site)
;and PSOPINST (the related institution)
;and DUZ(2)
;
S BEXHOLD("PSOSITE")=$G(PSOSITE)
S BEXHOLD("PSOPINST")=$G(PSOPINST)
S BEXHOLD("DUZ(2)")=$G(DUZ(2))
;
Q
;
;
CHECK() ;EP - Check if user changed their site settings
;
;This is called from the END section of BEXRX7 and
;from the EOJ section of BEXRQUE to see if the user changed
;their Outpatient Site settings
;
;Quit if not a multi-division site
I $P($G(^PS(59,0)),U,3)=1 Q 0
;
I $G(PSOSITE)="" Q 0
I $G(PSOPINST)="" Q 0
I $G(DUZ(2))="" Q 0
;
I $G(PSOSITE)'=$G(BEXHOLD("PSOSITE")) Q 1
I $G(PSOPINST)'=$G(BEXHOLD("PSOPINST")) Q 1
I $G(DUZ(2))'=$G(BEXHOLD("DUZ(2)")) Q 1
;
Q 0
;
;
BEXSITE ;IHS/CMI/DAY - BEX - Division and Site Selection ; 05 Oct 2015 11:42 AM
+1 ;;1.0;BEX TELEPHONE REFILL SYSTEM;*6*;APR 20, 2015;Build 7
+2 ;
+3 QUIT
+4 ;
+5 ;Site Notes
+6 ;
+7 ;PSOSITE is set to the IEN in the OUTPATIENT SITE file
+8 ;
+9 ;PSOPINST is set to the Related Institution in the
+10 ;OUTPATIENT SITE file
+11 ;
+12 ;PSOINST is needed for BEXRX7 and is set in ^PSOLSET however, the
+13 ;value is set to the Station Number, which is set by users or by
+14 ;assigned Station Numbers in the 8000 range. Therefore, we must set
+15 ;PSOINST ourselves.
+16 ;
+17 ;
CHANGE ;EP - Display current site and ask user if they want to change
+1 ;
+2 ;Do not ask if only one Outpatient Site
+3 IF $PIECE($GET(^PS(59,0)),U,3)=1
QUIT
+4 ;
+5 ;If we do not have these variables, we have to ask them first
+6 IF '$DATA(PSOSITE)
KILL PSOPAR
+7 IF '$DATA(PSOPAR)
DO ^PSOLSET
+8 IF '$DATA(PSOPAR)
GOTO CHANGE
+9 ;
+10 ;We assume from here that we have multiple Outpatient Site entries
+11 ;
+12 WRITE !!
+13 FOR I=1:1:70
WRITE "*"
+14 WRITE !
+15 WRITE "*** O/P Site (Division) is: "
+16 WRITE ?30,$$GET1^DIQ(59,PSOSITE,.01),?67,"***",!
+17 WRITE "*** Related Institution is: "
+18 WRITE ?30,$$GET1^DIQ(4,PSOPINST,.01),?67,"***",!
+19 FOR I=1:1:70
WRITE "*"
+20 WRITE !
+21 ;
+22 KILL DIR
+23 SET DIR(0)="YO"
+24 SET DIR("A")="Do you want to change these"
+25 SET DIR("B")="N"
+26 DO ^DIR
+27 IF Y'=1
QUIT
+28 ;
+29 KILL PSOSITE,PSOPAR,PSOPINST
+30 DO ^PSOLSET
+31 IF '$DATA(PSOPAR)
GOTO CHANGE
+32 ;
+33 WRITE !!
+34 WRITE "The RELATED INSTITUTION is ",$$GET1^DIQ(4,PSOPINST,.01),!
+35 WRITE "and will be used to lookup and display health record numbers.",!
+36 ;
+37 ;This is borrowed from ASKSITE^XUS1
+38 KILL DIC
+39 SET DIC(0)="AEQM"
+40 SET DIC="^VA(200,DUZ,2,"
+41 SET DIC("P")="200.02P"
+42 SET DIC("A")="Select RELATED INSTITUTION: "
+43 SET DIC("B")=PSOPINST
+44 DO ^DIC
+45 KILL DIC
+46 IF Y>0
SET PSOPINST=+Y
SET DUZ(2)=+Y
+47 WRITE !!
+48 ;
+49 QUIT
+50 ;
+51 ;
HOLD ;EP - Store original settings when a user enters BEX processing
+1 ;
+2 ;We store PSOSITE (the Outpatient Site)
+3 ;and PSOPINST (the related institution)
+4 ;and DUZ(2)
+5 ;
+6 SET BEXHOLD("PSOSITE")=$GET(PSOSITE)
+7 SET BEXHOLD("PSOPINST")=$GET(PSOPINST)
+8 SET BEXHOLD("DUZ(2)")=$GET(DUZ(2))
+9 ;
+10 QUIT
+11 ;
+12 ;
CHECK() ;EP - Check if user changed their site settings
+1 ;
+2 ;This is called from the END section of BEXRX7 and
+3 ;from the EOJ section of BEXRQUE to see if the user changed
+4 ;their Outpatient Site settings
+5 ;
+6 ;Quit if not a multi-division site
+7 IF $PIECE($GET(^PS(59,0)),U,3)=1
QUIT 0
+8 ;
+9 IF $GET(PSOSITE)=""
QUIT 0
+10 IF $GET(PSOPINST)=""
QUIT 0
+11 IF $GET(DUZ(2))=""
QUIT 0
+12 ;
+13 IF $GET(PSOSITE)'=$GET(BEXHOLD("PSOSITE"))
QUIT 1
+14 IF $GET(PSOPINST)'=$GET(BEXHOLD("PSOPINST"))
QUIT 1
+15 IF $GET(DUZ(2))'=$GET(BEXHOLD("DUZ(2)"))
QUIT 1
+16 ;
+17 QUIT 0
+18 ;
+19 ;