ORWDBA18 ; SLC/GDU - Billing Awareness - Phase I [10/18/04 10:30]
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195**;Dec 17, 1997
 ;
 ;Enable Billing Awareness By User Parameter Module
 ;ORWDBA18 - Assign the parameter utilities
 ;
SETUP ;Run temp global kill, build assigned list, build unassigned list
 D KTG,LISTA,LISTU Q
 ;
KTG ;Kill the temp globals used by this program
 K ^TMP("ORPAL",$J),^TMP("ORPUL",$J) Q
LISTA ;Build a list of providers with the parameter already assigned to them.
 N ORERR,PIV,NAME,X
 S (ORERR,X)="",U="^"
 D ENVAL^XPAR("^TMP(""ORPAL"",$J,""A"")","OR BILLING AWARENESS BY USER",1,.ORERR,1)
 Q:^TMP("ORPAL",$J,"A")=0
 F  S X=$O(^TMP("ORPAL",$J,"A",X)) Q:X=""  D
 . S IEN=$P(X,";"),PIV=^TMP("ORPAL",$J,"A",X,1)
 . S NAME=$$GET1^DIQ(200,IEN,.01)
 . S ^TMP("ORPAL",$J,"B",IEN)=NAME_U_PIV
 Q
LISTU ;Build a list of providers who have not been assigned the parameter
 N CNT,IEN,PRVKEY,NAME
 S (NAME,IEN,PRVKEY)="",(CNT,^TMP("ORPUL",$J,"A"))=0
 F  S NAME=$O(^VA(200,"B",NAME)) Q:NAME=""  D
 . S IEN=$QS($Q(^VA(200,"B",NAME)),4)
 . S PRVKEY=$$PRVKEY^ORWDBA1(IEN)  ;Check for provider key
 . I PRVKEY=0 Q  ;If not a provider quit
 . I $D(^TMP("ORPAL",$J,"B",IEN))=1 Q  ;If already assigned quit
 . ;Build ^TMP("ORPUL"
 . S CNT=CNT+1,^TMP("ORPUL",$J,"A")=CNT
 . S ^TMP("ORPUL",$J,"B",CNT)=NAME_U_IEN
 . S ^TMP("ORPUL",$J,"C",NAME)=CNT
 Q
ALERT ;Alert the user, all providers have been assigned the parameter
 ;Kill temp globals and quit
 N DIR
 D SCRHDR S DIR(0)="E"
 W !!,$P($T(ALLPA),";",2),!!
 D ^DIR K DIR
 D KTG Q
 ;
DISPRV ;Displays the providers in the unassigned list for user selection
 ;PRVNAME is set to null in ORWDBA8 and is reset based on user selection
 ;Selection of Q for quit, timeout, and up arrow will set PRVNAME to Q
 ;Selection of provider will set PRVNAME to the selected provider's name
 ;Prepare for display of providers
 ;N CNT,DIR,DTOUT,DUOUT,FST,HC,U,X,Y
 S FST=1,U="^"
DPO ;Display process starts here
 D SCRHDR
 S (X,Y)="",CNT=0,HC=1,DIR(0)=$P($T(SOOPT),";",3)
 F X=FST:1:10+(FST-1) Q:$D(^TMP("ORPUL",$J,"B",X))=0  D
 . S CNT=CNT+1 S:CNT>10 CNT=1
 . S DIR(0)=DIR(0)_CNT_":"_$P(^TMP("ORPUL",$J,"B",X),U)_";"
 S:CNT=10 DIR(0)=DIR(0)_";"_$P($T(D0N),";",3)
 S:FST>10 DIR(0)=DIR(0)_";"_$P($T(D0P),";",3)
 S DIR(0)=DIR(0)_";"_$P($TEXT(D0Q),";",3)
 S DIR("A")=$P($T(DA),";",3)
 S DIR("?",HC)=$P($T(DH),";",3)
 S:CNT=10 HC=HC+1,DIR("?",HC)=$P($T(DHN),";",3)
 S:FST>10 HC=HC+1,DIR("?",HC)=$P($T(DHP),";",3)
 S DIR("?")=$P($T(DHQ),";",3)
 D ^DIR K DIR
 I Y="Q"!(Y="")!($D(DTOUT))!($D(DUOUT)) S PRVNAME="Q" Q
 I Y="N"!(Y="P") S FST=$S(Y="N":FST+10,1:FST-10) G DPO
 S PRVNAME=Y(0) Q
CONMAS ;Confirm the mass assignment of the parameter
 ;MRC is set to null and ORWDBA8 and reset based on user selection here
 ;DIR array is set to values based on user selection in ORWDBA8
 ;Selection of NO, timeout, and up arrow will set MRC=0
 ;Selection of YES will set MRC=1
 S Y="" D SCRHDR,^DIR K DIR I Y="NO"!($D(DTOUT))!($D(DUOUT)) S MRC=0 Q
 S MRC=1 Q
MASASN ;Mass Assignment of the parameter
 ;SEL is set in ORWDBA8 by user selection.
 ;SEL="E", the parameter is set to 1 to enable Billing Data Capture
 ;SEL="D", the parameter is set to 0 to disable Billing Data Capture
 N DIR,ENT,ORERR,INST,PAR,U,VAL,X
 S (ENT,X)="",U="^",INST=1,VAL=$S(SEL="E":1,1:0)
 S PAR=$QS($Q(^XTV(8989.1,"B","OR BILLING AWARENESS BY USER")),4)
 D SCRHDR W !!
 F X=1:1:^TMP("ORPUL",$J,"A") D
 . W "."
 . S ENT=$P(^TMP("ORPUL",$J,"B",X),U,2)_";VA(200,"
 . D ADD^XPAR(ENT,PAR,INST,VAL,.ORERR)
 S DIR(0)="E",DIR("A")=$S(SEL="E":$P($T(MEC),";",3),1:$P($T(MDC),";",3))
 D ^DIR K DIR Q
SCRHDR ;Screen Header
 W:$D(IOF) @IOF
 W !,$P($T(SH),";",3),!
 W:SEL="" $P($T(SHA),";",3)
 W:SEL="E" $P($T(SHAE),";",3)
 W:SEL="D" $P($T(SHAD),";",3)
 W:SEL="I" $P($T(SHAI),";",3)
 Q
 ;;Text for user messages, selection options, user help
ALLPA ;;All providers have been assigned the parameter.
SOOPT ;;SO^
SXOPT ;;SX^
SH ;;Enable Clinical Indicator Data Capture By Provider Parameter Management
SHA ;;Assign Parameter To Provider Option
SHAE ;;Assign/Enable Parameter For All Providers Option
SHAD ;;Assign/Disable Parameter For All Providers Option
SHAI ;;Assign and Enable/Disable Parameter By Individual Provider Option
MMPA ;;All providers have the Enable CIDC By User parameter assigned.
DH ;;Select the provider who the parameter will be assigned to.
DHN ;;Enter N to get the next 10 providers in the list.
DHP ;;Enter P to get the previous 10 providers in the list.
DHQ ;;Enter Q to quit and return to previous menu.
D0N ;;N:Next 10 providers
D0P ;;P:Previous 10 providers
D0Q ;;Q:Quit
DA ;;Select the provider to assign the parameter
MEP ;;Now assigning and enabling the Clinical Indicatr Data Capture parameter
MEC ;;Assignment and enable Clinical Indicator Data Capture complete
MDP ;;Now assigning and disabling the Clinical Indicator Data Capture parameter
MDC ;;Assignment and disable Clinical Indicator Data Capture complete
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWDBA18   5039     printed  Sep 23, 2025@20:11:37                                                                                                                                                                                                    Page 2
ORWDBA18  ; SLC/GDU - Billing Awareness - Phase I [10/18/04 10:30]
 +1       ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195**;Dec 17, 1997
 +2       ;
 +3       ;Enable Billing Awareness By User Parameter Module
 +4       ;ORWDBA18 - Assign the parameter utilities
 +5       ;
SETUP     ;Run temp global kill, build assigned list, build unassigned list
 +1        DO KTG
           DO LISTA
           DO LISTU
           QUIT 
 +2       ;
KTG       ;Kill the temp globals used by this program
 +1        KILL ^TMP("ORPAL",$JOB),^TMP("ORPUL",$JOB)
           QUIT 
LISTA     ;Build a list of providers with the parameter already assigned to them.
 +1        NEW ORERR,PIV,NAME,X
 +2        SET (ORERR,X)=""
           SET U="^"
 +3        DO ENVAL^XPAR("^TMP(""ORPAL"",$J,""A"")","OR BILLING AWARENESS BY USER",1,.ORERR,1)
 +4        if ^TMP("ORPAL",$JOB,"A")=0
               QUIT 
 +5        FOR 
               SET X=$ORDER(^TMP("ORPAL",$JOB,"A",X))
               if X=""
                   QUIT 
               Begin DoDot:1
 +6                SET IEN=$PIECE(X,";")
                   SET PIV=^TMP("ORPAL",$JOB,"A",X,1)
 +7                SET NAME=$$GET1^DIQ(200,IEN,.01)
 +8                SET ^TMP("ORPAL",$JOB,"B",IEN)=NAME_U_PIV
               End DoDot:1
 +9        QUIT 
LISTU     ;Build a list of providers who have not been assigned the parameter
 +1        NEW CNT,IEN,PRVKEY,NAME
 +2        SET (NAME,IEN,PRVKEY)=""
           SET (CNT,^TMP("ORPUL",$JOB,"A"))=0
 +3        FOR 
               SET NAME=$ORDER(^VA(200,"B",NAME))
               if NAME=""
                   QUIT 
               Begin DoDot:1
 +4                SET IEN=$QSUBSCRIPT($QUERY(^VA(200,"B",NAME)),4)
 +5       ;Check for provider key
                   SET PRVKEY=$$PRVKEY^ORWDBA1(IEN)
 +6       ;If not a provider quit
                   IF PRVKEY=0
                       QUIT 
 +7       ;If already assigned quit
                   IF $DATA(^TMP("ORPAL",$JOB,"B",IEN))=1
                       QUIT 
 +8       ;Build ^TMP("ORPUL"
 +9                SET CNT=CNT+1
                   SET ^TMP("ORPUL",$JOB,"A")=CNT
 +10               SET ^TMP("ORPUL",$JOB,"B",CNT)=NAME_U_IEN
 +11               SET ^TMP("ORPUL",$JOB,"C",NAME)=CNT
               End DoDot:1
 +12       QUIT 
ALERT     ;Alert the user, all providers have been assigned the parameter
 +1       ;Kill temp globals and quit
 +2        NEW DIR
 +3        DO SCRHDR
           SET DIR(0)="E"
 +4        WRITE !!,$PIECE($TEXT(ALLPA),";",2),!!
 +5        DO ^DIR
           KILL DIR
 +6        DO KTG
           QUIT 
 +7       ;
DISPRV    ;Displays the providers in the unassigned list for user selection
 +1       ;PRVNAME is set to null in ORWDBA8 and is reset based on user selection
 +2       ;Selection of Q for quit, timeout, and up arrow will set PRVNAME to Q
 +3       ;Selection of provider will set PRVNAME to the selected provider's name
 +4       ;Prepare for display of providers
 +5       ;N CNT,DIR,DTOUT,DUOUT,FST,HC,U,X,Y
 +6        SET FST=1
           SET U="^"
DPO       ;Display process starts here
 +1        DO SCRHDR
 +2        SET (X,Y)=""
           SET CNT=0
           SET HC=1
           SET DIR(0)=$PIECE($TEXT(SOOPT),";",3)
 +3        FOR X=FST:1:10+(FST-1)
               if $DATA(^TMP("ORPUL",$JOB,"B",X))=0
                   QUIT 
               Begin DoDot:1
 +4                SET CNT=CNT+1
                   if CNT>10
                       SET CNT=1
 +5                SET DIR(0)=DIR(0)_CNT_":"_$PIECE(^TMP("ORPUL",$JOB,"B",X),U)_";"
               End DoDot:1
 +6        if CNT=10
               SET DIR(0)=DIR(0)_";"_$PIECE($TEXT(D0N),";",3)
 +7        if FST>10
               SET DIR(0)=DIR(0)_";"_$PIECE($TEXT(D0P),";",3)
 +8        SET DIR(0)=DIR(0)_";"_$PIECE($TEXT(D0Q),";",3)
 +9        SET DIR("A")=$PIECE($TEXT(DA),";",3)
 +10       SET DIR("?",HC)=$PIECE($TEXT(DH),";",3)
 +11       if CNT=10
               SET HC=HC+1
               SET DIR("?",HC)=$PIECE($TEXT(DHN),";",3)
 +12       if FST>10
               SET HC=HC+1
               SET DIR("?",HC)=$PIECE($TEXT(DHP),";",3)
 +13       SET DIR("?")=$PIECE($TEXT(DHQ),";",3)
 +14       DO ^DIR
           KILL DIR
 +15       IF Y="Q"!(Y="")!($DATA(DTOUT))!($DATA(DUOUT))
               SET PRVNAME="Q"
               QUIT 
 +16       IF Y="N"!(Y="P")
               SET FST=$SELECT(Y="N":FST+10,1:FST-10)
               GOTO DPO
 +17       SET PRVNAME=Y(0)
           QUIT 
CONMAS    ;Confirm the mass assignment of the parameter
 +1       ;MRC is set to null and ORWDBA8 and reset based on user selection here
 +2       ;DIR array is set to values based on user selection in ORWDBA8
 +3       ;Selection of NO, timeout, and up arrow will set MRC=0
 +4       ;Selection of YES will set MRC=1
 +5        SET Y=""
           DO SCRHDR
           DO ^DIR
           KILL DIR
           IF Y="NO"!($DATA(DTOUT))!($DATA(DUOUT))
               SET MRC=0
               QUIT 
 +6        SET MRC=1
           QUIT 
MASASN    ;Mass Assignment of the parameter
 +1       ;SEL is set in ORWDBA8 by user selection.
 +2       ;SEL="E", the parameter is set to 1 to enable Billing Data Capture
 +3       ;SEL="D", the parameter is set to 0 to disable Billing Data Capture
 +4        NEW DIR,ENT,ORERR,INST,PAR,U,VAL,X
 +5        SET (ENT,X)=""
           SET U="^"
           SET INST=1
           SET VAL=$SELECT(SEL="E":1,1:0)
 +6        SET PAR=$QSUBSCRIPT($QUERY(^XTV(8989.1,"B","OR BILLING AWARENESS BY USER")),4)
 +7        DO SCRHDR
           WRITE !!
 +8        FOR X=1:1:^TMP("ORPUL",$JOB,"A")
               Begin DoDot:1
 +9                WRITE "."
 +10               SET ENT=$PIECE(^TMP("ORPUL",$JOB,"B",X),U,2)_";VA(200,"
 +11               DO ADD^XPAR(ENT,PAR,INST,VAL,.ORERR)
               End DoDot:1
 +12       SET DIR(0)="E"
           SET DIR("A")=$SELECT(SEL="E":$PIECE($TEXT(MEC),";",3),1:$PIECE($TEXT(MDC),";",3))
 +13       DO ^DIR
           KILL DIR
           QUIT 
SCRHDR    ;Screen Header
 +1        if $DATA(IOF)
               WRITE @IOF
 +2        WRITE !,$PIECE($TEXT(SH),";",3),!
 +3        if SEL=""
               WRITE $PIECE($TEXT(SHA),";",3)
 +4        if SEL="E"
               WRITE $PIECE($TEXT(SHAE),";",3)
 +5        if SEL="D"
               WRITE $PIECE($TEXT(SHAD),";",3)
 +6        if SEL="I"
               WRITE $PIECE($TEXT(SHAI),";",3)
 +7        QUIT 
 +8       ;;Text for user messages, selection options, user help
ALLPA     ;;All providers have been assigned the parameter.
SOOPT     ;;SO^
SXOPT     ;;SX^
SH        ;;Enable Clinical Indicator Data Capture By Provider Parameter Management
SHA       ;;Assign Parameter To Provider Option
SHAE      ;;Assign/Enable Parameter For All Providers Option
SHAD      ;;Assign/Disable Parameter For All Providers Option
SHAI      ;;Assign and Enable/Disable Parameter By Individual Provider Option
MMPA      ;;All providers have the Enable CIDC By User parameter assigned.
DH        ;;Select the provider who the parameter will be assigned to.
DHN       ;;Enter N to get the next 10 providers in the list.
DHP       ;;Enter P to get the previous 10 providers in the list.
DHQ       ;;Enter Q to quit and return to previous menu.
D0N       ;;N:Next 10 providers
D0P       ;;P:Previous 10 providers
D0Q       ;;Q:Quit
DA        ;;Select the provider to assign the parameter
MEP       ;;Now assigning and enabling the Clinical Indicatr Data Capture parameter
MEC       ;;Assignment and enable Clinical Indicator Data Capture complete
MDP       ;;Now assigning and disabling the Clinical Indicator Data Capture parameter
MDC       ;;Assignment and disable Clinical Indicator Data Capture complete