IBCNAU1 ;ALB/KML/AWC - USER EDIT REPORT (REPORT FILTER SELECTION) ;6-APRIL-2015
 ;;2.0;INTEGRATED BILLING;**528,664,668,737**;21-MAR-94;Build 19
 ;;Per VA Directive 6402, this routine should not be modified.
 ;
 ;IB*737/CKB - references to 'eIV Payer' should be changed to 'Payer' in order
 ; to include 'IIU Payers'
 Q
 ;
SELR() ;EP - Select Report Type
 ; IB*2.0*664 - Added function
 ; Prompt user to select report for User edits to Insurance Company/Group Plan or Payers or BOTH 
 ; Input: None
 ; Returns: 1 - Insurance Company/Group Plan
 ; 2 - Payers
 ; 3 - Both Insurance Company/Group Plan and Payers
 ; -1 - No selection made
 ;
 N DIR,DIROUT,DIRUT,DTOUT,IBV0
 W !!,"Select one of the following:"
 S DIR(0)="SA^1:INSURANCE COMPANY/GROUP PLAN;2:PAYERS;3:BOTH"
 S DIR("A")=" Select 1 or 2 or 3: "
 S DIR("A",1)=" 1. User Edits for Insurance Company/Group Plan"
 S DIR("A",2)=" 2. User Edits for Payers"
 S DIR("A",3)=" 3. BOTH"
 S DIR("?",1)=" 1 - Only report on user edits to Insurance Company/Group Plan"
 S DIR("?",2)=" 2 - Only report on user edits to Payers"
 S DIR("?")=" 3 - Report on user edits to both Insurance Company/Group Plan and Payers"
 S DIR("B")=1
 D ^DIR
 I Y<0!$D(DIRUT) Q -1
 S IBV0=$S(Y=2:2,Y=3:3,1:1)
SELRQ Q IBV0
 ;
SELI() ; Prompt user to select all or subset of insurance companies 
 ; Count ins. companies with plans
 ;
 N IBV1,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 W !!,"Insurance Company Selection:"
 S DIR(0)="SA^1:Report all Insurance Companies;2:Report Insurance Companies that are selected"
 S DIR("A",1)="1. Report User Edits for all "_$P(^DIC(36,0),U,4)_" Insurance Companies"
 S DIR("A",2)="2. Report User Edits for selected Insurance Companies"
 S DIR("A")="     ENTER 1 or 2:  "
 S DIR("?",1)="Enter '1' if edits from all Insurance Companies are to be reported."
 S DIR("?")="Enter '2' if you want to select the Insurance Company(s) to be reported."
 D ^DIR I Y<0!$D(DIRUT) S IBV1=-1 G SELIQ
 S IBV1=(+Y=1)
SELIQ Q IBV1
 ;
SELP(ALLINS,PLANS) ; Prompt user if Group Plans is to be on the report
 ; input/output - PLANS passed by reference. Returned with 1 or 0
 ;   function output returns 1 or 0 in IBV2
 ;
 W !!,"Group Plan Selection:"
 N IBV2,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)="YA"
 S DIR("A")="Do you want to report any edits made to Group Plans (Y/N)? "
 ;D ^DIR I Y<0!$D(DIRUT) S IBV2=-1 G SELPQ
 ;/vd - IB*2.0*664 - Replaced the above line with the following line.
 D ^DIR I $D(DIRUT) S IBV2=-1 G SELPQ
 ; user does not want to report Group Plan edits
 I 'Y S (PLANS,IBV2)=+Y G SELPQ
 ;
 ; -- if report all insurance companies - quit and report to include group plans or not
 I ALLINS S IBV2=(+Y=1),PLANS=1 Q IBV2
 ;
 ; if group plan edits are to be reported, user needs to choose between all group plans or some group plans
 S DIR(0)="SA^1:Report all Group Insurance Plans;2:Report Group Insurance Plans that are selected"
 S DIR("A",1)="1. Report User Edits for all Group Insurance Plans"
 S DIR("A",2)="2. Report User Edits for selected Group Insurance Plans"
 S DIR("A")="     ENTER 1 or 2:  "
 S DIR("?")="Enter '1' if edits from all Group Insurance Plans are to be reported. Enter '2' if edits from selected Group Insurance Plans are to be reported."
 ;
 D ^DIR I Y<0!$D(DIRUT) S IBV2=-1 G SELPQ
 S IBV2=(+Y=1),PLANS=1
SELPQ Q IBV2
 ;
 ;/vd-IB*2*664 - Added the following module of code.
SELPY() ; Prompt user if Payer(s) are to be on the report
 ; function output returns 1 or 0 in IBV5
 ;
 W !!,"Payer Selection:" ;IB*737/CKB
 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,IBV5,X,Y ;
 ; if payer edits are to be reported, user needs to choose between all payers or some payers
 S DIR(0)="SA^1:Report all Payers;2:Report Payers that are selected"
 S DIR("A",1)="1. Report User Edits for all Payers"
 S DIR("A",2)="2. Report User Edits for selected Payers"
 S DIR("A")=" ENTER 1 or 2: "
 S DIR("?")="Enter '1' if edits from all Payers are to be reported. Enter '2' if edits from selected Payers are to be reported."
 ;
 D ^DIR I Y<0!$D(DIRUT) S IBV5=-1 G SELPYQ
 S IBV5=(+Y=1)
SELPYQ Q IBV5
 ;
 ;/vd-IB*2*664 - Added the following module of code.
GPYR(ALLPYRS) ; Select the Payers to be reported on.
 ; -- allow user to select payers
 K ^TMP("IBPYR",$J)
 I ALLPYRS=1 D GPYRALL Q
 N IBPAYER,IBPYR,IBTXT
 ;IB*737/TAZ - Removed parameter for "~NO PAYER"
 ;D PAYER^IBCNINSL("",1,.IBPAYER) ;IB*737/CKB
 D PAYER^IBCNINSL("",.IBPAYER) ;IB*737/CKB
 S IBPYR=""
 F  S IBPYR=$O(IBPAYER(IBPYR)) Q:IBPYR=""  S IBTXT=$E(IBPAYER(IBPYR),1,25) D
 . I IBTXT]"" S ^TMP("IBPYR",$J,IBTXT,IBPYR)=""
 Q
 ;
 ;/vd-IB*2*664 - Added the following module of code.
GPYRALL ; User wants to see all PAYERS that have received edits
 N PYRIEN,PYRNAM,PYRTXT
 K ^TMP("IBPYR",$J)
 S PYRNAM="" F  S PYRNAM=$O(^IBE(365.12,"B",PYRNAM)) Q:PYRNAM=""  D
 . S PYRIEN=0 F  S PYRIEN=$O(^IBE(365.12,"B",PYRNAM,PYRIEN)) Q:'PYRIEN  D
 . . ;IB*668/TAZ - Changed Payer Application from IIV to EIV
 . . ;IB*737/CKB - Not an eIV or IIU Payer...Only want eIV Payers.
 . . I '+$$PYRAPP^IBCNEUT5("EIV",PYRIEN)&'+$$PYRAPP^IBCNEUT5("IIU",PYRIEN) Q
 . . S ^TMP("IBPYR",$J,PYRNAM,PYRIEN)=""
 Q
 ;
SELU() ; prompt user to select user id
 W !!,"User Selection:"
 N DIR,IBV3,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)="SA^1:All Users;2:Specified Users"
 S DIR("A",1)="1. All User IDs"
 S DIR("A",2)="2. Select One or Multiple User IDs"
 S DIR("A")="     ENTER 1 or 2:  "
 S DIR("?")="Enter '1' if edits from all users are to be report. Enter '2' if edits from selected users are to be reported."
 D ^DIR I Y<0!$D(DIRUT) S IBV3=-1 G SELUQ
 S IBV3=(+Y=1)
SELUQ Q IBV3
 ;
GETTYP() ; Get display/output type
 ; RETURNS  : Output destination (0=Display; 1=MS Excel)
 ; LOCAL VARIABLES :
 ; DIR,DUOUT - Standard FileMan variables
 ; Y         - User input
 N DIR,DUOUT,DIRUT,Y
 W !
 S DIR(0)="Y"
 S DIR("A")="Export to Microsoft Excel (Y/N): "
 S DIR("B")="NO"
 D ^DIR K DIR
 I $D(DUOUT)!$D(DIRUT) S Y=-1
 Q Y
 ;
OK(QUIT) ; -- ask okay
 N DIR,Y,X
 W !
 S DIR(0)="Y",DIR("A")="         ...OK",DIR("B")="YES" D ^DIR
 I $D(DUOUT)!$D(DIRUT) S QUIT=1
 Q Y
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCNAU1   6178     printed  Sep 23, 2025@19:49:55                                                                                                                                                                                                     Page 2
IBCNAU1   ;ALB/KML/AWC - USER EDIT REPORT (REPORT FILTER SELECTION) ;6-APRIL-2015
 +1       ;;2.0;INTEGRATED BILLING;**528,664,668,737**;21-MAR-94;Build 19
 +2       ;;Per VA Directive 6402, this routine should not be modified.
 +3       ;
 +4       ;IB*737/CKB - references to 'eIV Payer' should be changed to 'Payer' in order
 +5       ; to include 'IIU Payers'
 +6        QUIT 
 +7       ;
SELR()    ;EP - Select Report Type
 +1       ; IB*2.0*664 - Added function
 +2       ; Prompt user to select report for User edits to Insurance Company/Group Plan or Payers or BOTH 
 +3       ; Input: None
 +4       ; Returns: 1 - Insurance Company/Group Plan
 +5       ; 2 - Payers
 +6       ; 3 - Both Insurance Company/Group Plan and Payers
 +7       ; -1 - No selection made
 +8       ;
 +9        NEW DIR,DIROUT,DIRUT,DTOUT,IBV0
 +10       WRITE !!,"Select one of the following:"
 +11       SET DIR(0)="SA^1:INSURANCE COMPANY/GROUP PLAN;2:PAYERS;3:BOTH"
 +12       SET DIR("A")=" Select 1 or 2 or 3: "
 +13       SET DIR("A",1)=" 1. User Edits for Insurance Company/Group Plan"
 +14       SET DIR("A",2)=" 2. User Edits for Payers"
 +15       SET DIR("A",3)=" 3. BOTH"
 +16       SET DIR("?",1)=" 1 - Only report on user edits to Insurance Company/Group Plan"
 +17       SET DIR("?",2)=" 2 - Only report on user edits to Payers"
 +18       SET DIR("?")=" 3 - Report on user edits to both Insurance Company/Group Plan and Payers"
 +19       SET DIR("B")=1
 +20       DO ^DIR
 +21       IF Y<0!$DATA(DIRUT)
               QUIT -1
 +22       SET IBV0=$SELECT(Y=2:2,Y=3:3,1:1)
SELRQ      QUIT IBV0
 +1       ;
SELI()    ; Prompt user to select all or subset of insurance companies 
 +1       ; Count ins. companies with plans
 +2       ;
 +3        NEW IBV1,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 +4        WRITE !!,"Insurance Company Selection:"
 +5        SET DIR(0)="SA^1:Report all Insurance Companies;2:Report Insurance Companies that are selected"
 +6        SET DIR("A",1)="1. Report User Edits for all "_$PIECE(^DIC(36,0),U,4)_" Insurance Companies"
 +7        SET DIR("A",2)="2. Report User Edits for selected Insurance Companies"
 +8        SET DIR("A")="     ENTER 1 or 2:  "
 +9        SET DIR("?",1)="Enter '1' if edits from all Insurance Companies are to be reported."
 +10       SET DIR("?")="Enter '2' if you want to select the Insurance Company(s) to be reported."
 +11       DO ^DIR
           IF Y<0!$DATA(DIRUT)
               SET IBV1=-1
               GOTO SELIQ
 +12       SET IBV1=(+Y=1)
SELIQ      QUIT IBV1
 +1       ;
SELP(ALLINS,PLANS) ; Prompt user if Group Plans is to be on the report
 +1       ; input/output - PLANS passed by reference. Returned with 1 or 0
 +2       ;   function output returns 1 or 0 in IBV2
 +3       ;
 +4        WRITE !!,"Group Plan Selection:"
 +5        NEW IBV2,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 +6        SET DIR(0)="YA"
 +7        SET DIR("A")="Do you want to report any edits made to Group Plans (Y/N)? "
 +8       ;D ^DIR I Y<0!$D(DIRUT) S IBV2=-1 G SELPQ
 +9       ;/vd - IB*2.0*664 - Replaced the above line with the following line.
 +10       DO ^DIR
           IF $DATA(DIRUT)
               SET IBV2=-1
               GOTO SELPQ
 +11      ; user does not want to report Group Plan edits
 +12       IF 'Y
               SET (PLANS,IBV2)=+Y
               GOTO SELPQ
 +13      ;
 +14      ; -- if report all insurance companies - quit and report to include group plans or not
 +15       IF ALLINS
               SET IBV2=(+Y=1)
               SET PLANS=1
               QUIT IBV2
 +16      ;
 +17      ; if group plan edits are to be reported, user needs to choose between all group plans or some group plans
 +18       SET DIR(0)="SA^1:Report all Group Insurance Plans;2:Report Group Insurance Plans that are selected"
 +19       SET DIR("A",1)="1. Report User Edits for all Group Insurance Plans"
 +20       SET DIR("A",2)="2. Report User Edits for selected Group Insurance Plans"
 +21       SET DIR("A")="     ENTER 1 or 2:  "
 +22       SET DIR("?")="Enter '1' if edits from all Group Insurance Plans are to be reported. Enter '2' if edits from selected Group Insurance Plans are to be reported."
 +23      ;
 +24       DO ^DIR
           IF Y<0!$DATA(DIRUT)
               SET IBV2=-1
               GOTO SELPQ
 +25       SET IBV2=(+Y=1)
           SET PLANS=1
SELPQ      QUIT IBV2
 +1       ;
 +2       ;/vd-IB*2*664 - Added the following module of code.
SELPY()   ; Prompt user if Payer(s) are to be on the report
 +1       ; function output returns 1 or 0 in IBV5
 +2       ;
 +3       ;IB*737/CKB
           WRITE !!,"Payer Selection:"
 +4       ;
           NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,IBV5,X,Y
 +5       ; if payer edits are to be reported, user needs to choose between all payers or some payers
 +6        SET DIR(0)="SA^1:Report all Payers;2:Report Payers that are selected"
 +7        SET DIR("A",1)="1. Report User Edits for all Payers"
 +8        SET DIR("A",2)="2. Report User Edits for selected Payers"
 +9        SET DIR("A")=" ENTER 1 or 2: "
 +10       SET DIR("?")="Enter '1' if edits from all Payers are to be reported. Enter '2' if edits from selected Payers are to be reported."
 +11      ;
 +12       DO ^DIR
           IF Y<0!$DATA(DIRUT)
               SET IBV5=-1
               GOTO SELPYQ
 +13       SET IBV5=(+Y=1)
SELPYQ     QUIT IBV5
 +1       ;
 +2       ;/vd-IB*2*664 - Added the following module of code.
GPYR(ALLPYRS) ; Select the Payers to be reported on.
 +1       ; -- allow user to select payers
 +2        KILL ^TMP("IBPYR",$JOB)
 +3        IF ALLPYRS=1
               DO GPYRALL
               QUIT 
 +4        NEW IBPAYER,IBPYR,IBTXT
 +5       ;IB*737/TAZ - Removed parameter for "~NO PAYER"
 +6       ;D PAYER^IBCNINSL("",1,.IBPAYER) ;IB*737/CKB
 +7       ;IB*737/CKB
           DO PAYER^IBCNINSL("",.IBPAYER)
 +8        SET IBPYR=""
 +9        FOR 
               SET IBPYR=$ORDER(IBPAYER(IBPYR))
               if IBPYR=""
                   QUIT 
               SET IBTXT=$EXTRACT(IBPAYER(IBPYR),1,25)
               Begin DoDot:1
 +10               IF IBTXT]""
                       SET ^TMP("IBPYR",$JOB,IBTXT,IBPYR)=""
               End DoDot:1
 +11       QUIT 
 +12      ;
 +13      ;/vd-IB*2*664 - Added the following module of code.
GPYRALL   ; User wants to see all PAYERS that have received edits
 +1        NEW PYRIEN,PYRNAM,PYRTXT
 +2        KILL ^TMP("IBPYR",$JOB)
 +3        SET PYRNAM=""
           FOR 
               SET PYRNAM=$ORDER(^IBE(365.12,"B",PYRNAM))
               if PYRNAM=""
                   QUIT 
               Begin DoDot:1
 +4                SET PYRIEN=0
                   FOR 
                       SET PYRIEN=$ORDER(^IBE(365.12,"B",PYRNAM,PYRIEN))
                       if 'PYRIEN
                           QUIT 
                       Begin DoDot:2
 +5       ;IB*668/TAZ - Changed Payer Application from IIV to EIV
 +6       ;IB*737/CKB - Not an eIV or IIU Payer...Only want eIV Payers.
 +7                        IF '+$$PYRAPP^IBCNEUT5("EIV",PYRIEN)&'+$$PYRAPP^IBCNEUT5("IIU",PYRIEN)
                               QUIT 
 +8                        SET ^TMP("IBPYR",$JOB,PYRNAM,PYRIEN)=""
                       End DoDot:2
               End DoDot:1
 +9        QUIT 
 +10      ;
SELU()    ; prompt user to select user id
 +1        WRITE !!,"User Selection:"
 +2        NEW DIR,IBV3,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 +3        SET DIR(0)="SA^1:All Users;2:Specified Users"
 +4        SET DIR("A",1)="1. All User IDs"
 +5        SET DIR("A",2)="2. Select One or Multiple User IDs"
 +6        SET DIR("A")="     ENTER 1 or 2:  "
 +7        SET DIR("?")="Enter '1' if edits from all users are to be report. Enter '2' if edits from selected users are to be reported."
 +8        DO ^DIR
           IF Y<0!$DATA(DIRUT)
               SET IBV3=-1
               GOTO SELUQ
 +9        SET IBV3=(+Y=1)
SELUQ      QUIT IBV3
 +1       ;
GETTYP()  ; Get display/output type
 +1       ; RETURNS  : Output destination (0=Display; 1=MS Excel)
 +2       ; LOCAL VARIABLES :
 +3       ; DIR,DUOUT - Standard FileMan variables
 +4       ; Y         - User input
 +5        NEW DIR,DUOUT,DIRUT,Y
 +6        WRITE !
 +7        SET DIR(0)="Y"
 +8        SET DIR("A")="Export to Microsoft Excel (Y/N): "
 +9        SET DIR("B")="NO"
 +10       DO ^DIR
           KILL DIR
 +11       IF $DATA(DUOUT)!$DATA(DIRUT)
               SET Y=-1
 +12       QUIT Y
 +13      ;
OK(QUIT)  ; -- ask okay
 +1        NEW DIR,Y,X
 +2        WRITE !
 +3        SET DIR(0)="Y"
           SET DIR("A")="         ...OK"
           SET DIR("B")="YES"
           DO ^DIR
 +4        IF $DATA(DUOUT)!$DATA(DIRUT)
               SET QUIT=1
 +5        QUIT Y