ORWDBA5 ; SLC/GSS Billing Awareness ;12/9/04  12:02
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195**;Dec 17, 1997
 ;
 ; ORWDBA5 contains code for the testing, enabling and disabling the
 ; Billing Awareness Master Switch which is tested by the GUI in order
 ; to know what to present to the user.  Note also the BA by User
 ; switch which is coded in ORWDBA6, ORWDBA8, and ORWDBA10. 
 ;
BAMSTR ;Billing Awareness Master Switch via Parameter Setting
 N DIR,ENT,ORERR,INST,OPT,PAR
 D VARSET
 I $G(PAR)="" D  Q
 . S ORERR="99;Clinical Indicator Data Capture Master Switch parameter not defined"
 . D ORERR
 D OPT
 Q
 ;
VARSET ;Set variables - used by tags BAMSTR and CHKPS1
 ; ENT=Entity, INST=Instance, PAR=Parameter
 S ENT="SYS",INST=1
 S PAR=$O(^XTV(8989.51,"B","OR BILLING AWARENESS STATUS",0))
 Q
 ;
OPT ;Functionality control
 D HDR
 I OPT="D" D DISABLE G OPT
 I OPT="E" D ENABLE G OPT
 Q
 ;
ORERR ;Error trap message - pass error in via ORERR w/ 2nd piece being ER text
 S DIR(0)="F"
 S DIR("A")="Enter '^' to exit"
 S DIR("A",1)="ERROR:",DIR("A",2)=$P(ORERR,U,2)
 D ^DIR K DIR
 Q
 ;
ENABLE ;Enable Billing Awareness Master Switch
 N DIR,Y
 ; Check and see if CIDC ancillary package installed
 S Y=$D(^XPD(9.7,"B","PX CLINICAL INDICATOR DATA CAPTURE 1.0"))
 I 'Y S ORERR="^The package 'PX CLINICAL INDICATOR DATA CAPTURE 1.0' must first be installed" D ORERR Q
 W !!,"You have selected to ENABLE Clinical Indicators Data Capture Functionality!",!
 S DIR(0)="Y"
 S DIR("A")="Are you sure you want to ENABLE Clinical Indicators Data Capture Functionality"
 S DIR("B")="N"
 S DIR("?")="To exit ENABLE enter '^'."
 S DIR("?",1)="To confirm ENABLING Clinical Indicators Data Capture Functionality enter 'Y' for Yes."
 S DIR("?",2)="To abort ENABLING enter 'N' for NO."
 D ^DIR K DIR
 I Y=0 K OPT Q
 D CHG^XPAR(ENT,PAR,INST,1,.ORERR)
 I $G(ORERR) D ORERR Q
 Q
 ;
DISABLE ;Disable Billing Awareness Functionality
 N DIR
 W !!,"You have selected to DISABLE Clinical Indicators Data Capture Functionality!",!
 S DIR(0)="Y"
 S DIR("A")="Are you sure you want to DISABLE Clinical Indicators Data Capture Functionality"
 S DIR("B")="N"
 S DIR("?")="To exit DISABLE enter '^'."
 S DIR("?",1)="To confirm DISABLING Clinical Indicators Data Capture Functionality enter 'Y' for Yes."
 S DIR("?",2)="To abort DISABLING enter 'N' for NO."
 D ^DIR K DIR
 I Y=0 K OPT Q
 D CHG^XPAR(ENT,PAR,INST,0,.ORERR)
 I $G(ORERR) D ORERR Q
 Q
 ;
HDR ;Screen Header, Switch Status, and Options
 N DIR
 D:'$D(IO)!('$D(IOF)) HOME^%ZIS
 W @IOF,"Enable/Disable Clinical Indicators Data Capture Master Switch"
 W !!,"Clinical Indicators Data Capture Master Switch is now *> ",$S($$CHKPS=0:"OFF",1:"ON")," <*"
 S DIR("?")="Enter Q to Quit"
 I $$CHKPS D
 . S DIR(0)="SX^D:Disable Clinical Indicators Data Capture Functionality;Q:Quit"
 . S DIR("?",1)="Enter D to disable capture of Clinical Indicators"
 E  D
 . S DIR(0)="SX^E:Enable Clinical Indicators Capture Functionality;Q:Quit"
 . S DIR("?",2)="Enter E to enable the capture of Clinical Indicator data"
 S DIR("A")="Selection"
 D ^DIR K DIR S OPT=Y
 Q
 ;
CHKPS() ;Check master switch parameter status
 ; Returns 0 if switch is OFF or 1 if ON 
 ; If master switch not previously defined then defines it as 0
 ; For use via List Mgr (thus error messages)
 N ORERR,VAL
 I $G(PAR)="" D  Q
 . S ORERR="99;Clinical Indicator Data Capture Master Switch parameter not defined"
 . D ORERR
 S VAL=$$GET^XPAR(ENT,PAR,INST)
 I VAL="" D ADD^XPAR(ENT,PAR,INST,0) S VAL=$$GET^XPAR(ENT,PAR,INST,.ORERR)
 I $G(ORERR) D ORERR Q ""
 Q VAL
 ;
CHKPS1() ;Check master switch parameter status
 ; Used by RPC and BA status check in ORWDBA1 (BASTATUS & BASTAT)
 N ENT,ORERR,INST,PAR,VAL
 D VARSET
 ; Return BA Master Switch is off if parameter is not defined/set-up
 I $G(PAR)="" Q 0
 S VAL=$$GET^XPAR(ENT,PAR,INST)
 I VAL="" D ADD^XPAR(ENT,PAR,INST,0) S VAL=$$GET^XPAR(ENT,PAR,INST,.ORERR)
 ; If there's an error then return BA Master Switch is off
 I $G(ORERR) Q 0
 Q VAL
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWDBA5   4074     printed  Sep 23, 2025@20:11:41                                                                                                                                                                                                     Page 2
ORWDBA5   ; SLC/GSS Billing Awareness ;12/9/04  12:02
 +1       ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195**;Dec 17, 1997
 +2       ;
 +3       ; ORWDBA5 contains code for the testing, enabling and disabling the
 +4       ; Billing Awareness Master Switch which is tested by the GUI in order
 +5       ; to know what to present to the user.  Note also the BA by User
 +6       ; switch which is coded in ORWDBA6, ORWDBA8, and ORWDBA10. 
 +7       ;
BAMSTR    ;Billing Awareness Master Switch via Parameter Setting
 +1        NEW DIR,ENT,ORERR,INST,OPT,PAR
 +2        DO VARSET
 +3        IF $GET(PAR)=""
               Begin DoDot:1
 +4                SET ORERR="99;Clinical Indicator Data Capture Master Switch parameter not defined"
 +5                DO ORERR
               End DoDot:1
               QUIT 
 +6        DO OPT
 +7        QUIT 
 +8       ;
VARSET    ;Set variables - used by tags BAMSTR and CHKPS1
 +1       ; ENT=Entity, INST=Instance, PAR=Parameter
 +2        SET ENT="SYS"
           SET INST=1
 +3        SET PAR=$ORDER(^XTV(8989.51,"B","OR BILLING AWARENESS STATUS",0))
 +4        QUIT 
 +5       ;
OPT       ;Functionality control
 +1        DO HDR
 +2        IF OPT="D"
               DO DISABLE
               GOTO OPT
 +3        IF OPT="E"
               DO ENABLE
               GOTO OPT
 +4        QUIT 
 +5       ;
ORERR     ;Error trap message - pass error in via ORERR w/ 2nd piece being ER text
 +1        SET DIR(0)="F"
 +2        SET DIR("A")="Enter '^' to exit"
 +3        SET DIR("A",1)="ERROR:"
           SET DIR("A",2)=$PIECE(ORERR,U,2)
 +4        DO ^DIR
           KILL DIR
 +5        QUIT 
 +6       ;
ENABLE    ;Enable Billing Awareness Master Switch
 +1        NEW DIR,Y
 +2       ; Check and see if CIDC ancillary package installed
 +3        SET Y=$DATA(^XPD(9.7,"B","PX CLINICAL INDICATOR DATA CAPTURE 1.0"))
 +4        IF 'Y
               SET ORERR="^The package 'PX CLINICAL INDICATOR DATA CAPTURE 1.0' must first be installed"
               DO ORERR
               QUIT 
 +5        WRITE !!,"You have selected to ENABLE Clinical Indicators Data Capture Functionality!",!
 +6        SET DIR(0)="Y"
 +7        SET DIR("A")="Are you sure you want to ENABLE Clinical Indicators Data Capture Functionality"
 +8        SET DIR("B")="N"
 +9        SET DIR("?")="To exit ENABLE enter '^'."
 +10       SET DIR("?",1)="To confirm ENABLING Clinical Indicators Data Capture Functionality enter 'Y' for Yes."
 +11       SET DIR("?",2)="To abort ENABLING enter 'N' for NO."
 +12       DO ^DIR
           KILL DIR
 +13       IF Y=0
               KILL OPT
               QUIT 
 +14       DO CHG^XPAR(ENT,PAR,INST,1,.ORERR)
 +15       IF $GET(ORERR)
               DO ORERR
               QUIT 
 +16       QUIT 
 +17      ;
DISABLE   ;Disable Billing Awareness Functionality
 +1        NEW DIR
 +2        WRITE !!,"You have selected to DISABLE Clinical Indicators Data Capture Functionality!",!
 +3        SET DIR(0)="Y"
 +4        SET DIR("A")="Are you sure you want to DISABLE Clinical Indicators Data Capture Functionality"
 +5        SET DIR("B")="N"
 +6        SET DIR("?")="To exit DISABLE enter '^'."
 +7        SET DIR("?",1)="To confirm DISABLING Clinical Indicators Data Capture Functionality enter 'Y' for Yes."
 +8        SET DIR("?",2)="To abort DISABLING enter 'N' for NO."
 +9        DO ^DIR
           KILL DIR
 +10       IF Y=0
               KILL OPT
               QUIT 
 +11       DO CHG^XPAR(ENT,PAR,INST,0,.ORERR)
 +12       IF $GET(ORERR)
               DO ORERR
               QUIT 
 +13       QUIT 
 +14      ;
HDR       ;Screen Header, Switch Status, and Options
 +1        NEW DIR
 +2        if '$DATA(IO)!('$DATA(IOF))
               DO HOME^%ZIS
 +3        WRITE @IOF,"Enable/Disable Clinical Indicators Data Capture Master Switch"
 +4        WRITE !!,"Clinical Indicators Data Capture Master Switch is now *> ",$SELECT($$CHKPS=0:"OFF",1:"ON")," <*"
 +5        SET DIR("?")="Enter Q to Quit"
 +6        IF $$CHKPS
               Begin DoDot:1
 +7                SET DIR(0)="SX^D:Disable Clinical Indicators Data Capture Functionality;Q:Quit"
 +8                SET DIR("?",1)="Enter D to disable capture of Clinical Indicators"
               End DoDot:1
 +9       IF '$TEST
               Begin DoDot:1
 +10               SET DIR(0)="SX^E:Enable Clinical Indicators Capture Functionality;Q:Quit"
 +11               SET DIR("?",2)="Enter E to enable the capture of Clinical Indicator data"
               End DoDot:1
 +12       SET DIR("A")="Selection"
 +13       DO ^DIR
           KILL DIR
           SET OPT=Y
 +14       QUIT 
 +15      ;
CHKPS()   ;Check master switch parameter status
 +1       ; Returns 0 if switch is OFF or 1 if ON 
 +2       ; If master switch not previously defined then defines it as 0
 +3       ; For use via List Mgr (thus error messages)
 +4        NEW ORERR,VAL
 +5        IF $GET(PAR)=""
               Begin DoDot:1
 +6                SET ORERR="99;Clinical Indicator Data Capture Master Switch parameter not defined"
 +7                DO ORERR
               End DoDot:1
               QUIT 
 +8        SET VAL=$$GET^XPAR(ENT,PAR,INST)
 +9        IF VAL=""
               DO ADD^XPAR(ENT,PAR,INST,0)
               SET VAL=$$GET^XPAR(ENT,PAR,INST,.ORERR)
 +10       IF $GET(ORERR)
               DO ORERR
               QUIT ""
 +11       QUIT VAL
 +12      ;
CHKPS1()  ;Check master switch parameter status
 +1       ; Used by RPC and BA status check in ORWDBA1 (BASTATUS & BASTAT)
 +2        NEW ENT,ORERR,INST,PAR,VAL
 +3        DO VARSET
 +4       ; Return BA Master Switch is off if parameter is not defined/set-up
 +5        IF $GET(PAR)=""
               QUIT 0
 +6        SET VAL=$$GET^XPAR(ENT,PAR,INST)
 +7        IF VAL=""
               DO ADD^XPAR(ENT,PAR,INST,0)
               SET VAL=$$GET^XPAR(ENT,PAR,INST,.ORERR)
 +8       ; If there's an error then return BA Master Switch is off
 +9        IF $GET(ORERR)
               QUIT 0
 +10       QUIT VAL