BPSSCRCU ;BHAM ISC/SS - ECME SCREEN CONTINUOUS UPDATE AND CHANGE VIEW ;05-APR-05
 ;;1.0;E CLAIMS MGMT ENGINE;**1,5,7,24**;JUN 2004;Build 43
 ;;Per VA Directive 6402, this routine should not be modified.
 Q
 ;
CU ;
 N BPKEY,BPTIME,X,Y
 S BPTIME=15 ;update every 15 seconds
 D RE^VALM4
 W "Press ""Q"" to quit."
 F  D  S BPKEY=$$READ^XGF(1,BPTIME) Q:(BPKEY="Q")!(BPKEY="q")
 . D UD^BPSSCRUD
 . D RE^VALM4
 . N %
 . D NOW^%DTC S Y=% X ^DD("DD")
 . W "The screen has been updated on "_Y_". Press ""Q"" to quit."
 Q
 ;
 ; Select Insurance using IB API - IA 4721
 ; Input:  BPARR passed by ref to store user selection
 ;         BPDUZ - User DUZ
 ; Output: RETV = -1 if timeout or user enters "^"
 ;         BPARR(1.11)="I" for individual insurance or "A" for all
 ;         BPARR("INS")=semi-colon list of IENs from file 36 if individual insurances selected
 ; Example output: BPARR(1.11)="I" BPARR("INS")=";7;499;200;"
INSURSEL(BPARR,BPDUZ) ;
 N RETV,BPQ,BPINP,BPINSARR,Y,BPCNT
 S (BPARR(1.11),BPARR(2.04),BPARR("INS"))=""
 S (BPINS,BPCNT)=0
 S RETV=$$EDITFLD^BPSSCRCV(1.11,+BPDUZ,"S^I:SPECIFIC INSURANCE(S);A:ALL","Select Certain (I)NSURANCE or (A)LL","ALL",.BPARR)
 ; Quit if timeout or ^ entered
 Q:RETV<0 +RETV
 ; Quit if ALL selected
 Q:$P(RETV,U,2)="A" +RETV
 ; Get selected insurances from parameters and display them
 I $$GETINS(BPDUZ,.BPINSARR) D DISPINS(.BPINSARR)
SELINS1 ;
 ; Select specific Insurances to add to BPARR("INS") array
 S BPQ=0 F  D  Q:BPQ'=0
 . S BPINP=$$SELINSUR^IBNCPDPI("Select INSURANCE","")
 . S:+BPINP=-1 BPQ=-1 I BPQ=-1 Q
 . ;
 . ; Handle deletes
 . I $D(BPINSARR(+BPINP)) D  Q
 . . W !
 . . S Y=$$PROMPT^BPSSCRCV("S^Y:YES;N:NO","Delete "_$P(BPINP,U,2)_" from your list?","NO")
 . . I Y="Y" K BPINSARR(+BPINP),BPINSARR("B",$P(BPINP,U,2),+BPINP)
 . . ; Display a list of selected Insurance Companies
 . . D DISPINS(.BPINSARR)
 . ; Save selection in Insurance Company array
 . S BPINSARR(+BPINP)=BPINP,BPINSARR("B",$P(BPINP,U,2),+BPINP)=""
 . ; Display a list of selected Insurance Companies
 . D DISPINS(.BPINSARR)
 ;
 ;If the user entered "^" Quit returning "^"
 I BPQ=-1,X="^" Q "^"
 ;
 ; Save selected Insurances in BPARR("INS") to be saved in instance 1.14 when filed.
 S BPARR("INS")=""
 F BPCNT=1:1 S BPINS=$O(BPINSARR(BPINS)) Q:+BPINS=0  D
 . S BPARR("INS")=$G(BPARR("INS"))_";"_BPINS
 S (BPARR("INS"),BPARR(2.04))=$G(BPARR("INS"))_";"
 Q +RETV
 ;
 ;Reads insurance selection from the USER PROFILE file
 ;Input: BPDUZ7 - DUZ
 ;       BPINSUR by ref - array to return insurances saved in 2.04 Parameter : BPINSUR(IEN of file 36)
 ;Return value:
 ; 0 nothing saved
 ; n number of IENs of #36 selected by the user and stored in BPINSUR
 ;Returned by reference:
 ; BPINSUR - array with IENs to file #36
GETINS(BPDUZ7,BPINSUR) ;
 N BPINS,BPCNT
 S BPARRAY("INS")=$$GETPARAM^BPSSCRSL("2.04",BPDUZ7)
 F BPCNT=1:1:20 S BPINS=$P($G(BPARRAY("INS")),";",BPCNT+1) Q:+BPINS=0  D
 . S BPINSUR(BPINS)=BPINS,BPINSUR("B",$$INSNM^IBNCPDPI(BPINS),BPINS)=""
 Q BPCNT-1
 ;
 ;Display selected Insurances
 ;Input: BPINSARR = Array of insurances to display
 ; BPINSARR("B",INSURANCE COMPANY NAME)
DISPINS(BPINSARR) ;
 I $D(BPINSARR)>9 D
 . N X
 . W !,?2,"Selected:"
 . S X="" F  S X=$O(BPINSARR("B",X)) Q:X=""  W ?12,X,!
 . K X
 Q
 ;
 ;Check if PLAN ID for selected BP59 matches selected insurances
 ;Input: BPPLAN = Insurance company IEN from PLAN ID field in BPS TRANSACTION file
 ;       BPINS = Semi-colon separated list of insurances selected by the user.
 ;               See INSURSEL
 ;Output: 1 = Yes a match was found
 ;        0 = No match found
CHKINS(BPPLAN,BPINS) ;
 N BPIN,BPRETV
 S BPRETV=0
 F I=2:1 S BPIN=$P($G(BPINS),";",I) Q:BPIN=""  D  Q:BPRETV
 . S BPRETV=$S(BPIN=BPPLAN:1,1:0)
 Q BPRETV
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSSCRCU   3825     printed  Sep 23, 2025@19:29:21                                                                                                                                                                                                    Page 2
BPSSCRCU  ;BHAM ISC/SS - ECME SCREEN CONTINUOUS UPDATE AND CHANGE VIEW ;05-APR-05
 +1       ;;1.0;E CLAIMS MGMT ENGINE;**1,5,7,24**;JUN 2004;Build 43
 +2       ;;Per VA Directive 6402, this routine should not be modified.
 +3        QUIT 
 +4       ;
CU        ;
 +1        NEW BPKEY,BPTIME,X,Y
 +2       ;update every 15 seconds
           SET BPTIME=15
 +3        DO RE^VALM4
 +4        WRITE "Press ""Q"" to quit."
 +5        FOR 
               Begin DoDot:1
 +6                DO UD^BPSSCRUD
 +7                DO RE^VALM4
 +8                NEW %
 +9                DO NOW^%DTC
                   SET Y=%
                   XECUTE ^DD("DD")
 +10               WRITE "The screen has been updated on "_Y_". Press ""Q"" to quit."
               End DoDot:1
               SET BPKEY=$$READ^XGF(1,BPTIME)
               if (BPKEY="Q")!(BPKEY="q")
                   QUIT 
 +11       QUIT 
 +12      ;
 +13      ; Select Insurance using IB API - IA 4721
 +14      ; Input:  BPARR passed by ref to store user selection
 +15      ;         BPDUZ - User DUZ
 +16      ; Output: RETV = -1 if timeout or user enters "^"
 +17      ;         BPARR(1.11)="I" for individual insurance or "A" for all
 +18      ;         BPARR("INS")=semi-colon list of IENs from file 36 if individual insurances selected
 +19      ; Example output: BPARR(1.11)="I" BPARR("INS")=";7;499;200;"
INSURSEL(BPARR,BPDUZ) ;
 +1        NEW RETV,BPQ,BPINP,BPINSARR,Y,BPCNT
 +2        SET (BPARR(1.11),BPARR(2.04),BPARR("INS"))=""
 +3        SET (BPINS,BPCNT)=0
 +4        SET RETV=$$EDITFLD^BPSSCRCV(1.11,+BPDUZ,"S^I:SPECIFIC INSURANCE(S);A:ALL","Select Certain (I)NSURANCE or (A)LL","ALL",.BPARR)
 +5       ; Quit if timeout or ^ entered
 +6        if RETV<0
               QUIT +RETV
 +7       ; Quit if ALL selected
 +8        if $PIECE(RETV,U,2)="A"
               QUIT +RETV
 +9       ; Get selected insurances from parameters and display them
 +10       IF $$GETINS(BPDUZ,.BPINSARR)
               DO DISPINS(.BPINSARR)
SELINS1   ;
 +1       ; Select specific Insurances to add to BPARR("INS") array
 +2        SET BPQ=0
           FOR 
               Begin DoDot:1
 +3                SET BPINP=$$SELINSUR^IBNCPDPI("Select INSURANCE","")
 +4                if +BPINP=-1
                       SET BPQ=-1
                   IF BPQ=-1
                       QUIT 
 +5       ;
 +6       ; Handle deletes
 +7                IF $DATA(BPINSARR(+BPINP))
                       Begin DoDot:2
 +8                        WRITE !
 +9                        SET Y=$$PROMPT^BPSSCRCV("S^Y:YES;N:NO","Delete "_$PIECE(BPINP,U,2)_" from your list?","NO")
 +10                       IF Y="Y"
                               KILL BPINSARR(+BPINP),BPINSARR("B",$PIECE(BPINP,U,2),+BPINP)
 +11      ; Display a list of selected Insurance Companies
 +12                       DO DISPINS(.BPINSARR)
                       End DoDot:2
                       QUIT 
 +13      ; Save selection in Insurance Company array
 +14               SET BPINSARR(+BPINP)=BPINP
                   SET BPINSARR("B",$PIECE(BPINP,U,2),+BPINP)=""
 +15      ; Display a list of selected Insurance Companies
 +16               DO DISPINS(.BPINSARR)
               End DoDot:1
               if BPQ'=0
                   QUIT 
 +17      ;
 +18      ;If the user entered "^" Quit returning "^"
 +19       IF BPQ=-1
               IF X="^"
                   QUIT "^"
 +20      ;
 +21      ; Save selected Insurances in BPARR("INS") to be saved in instance 1.14 when filed.
 +22       SET BPARR("INS")=""
 +23       FOR BPCNT=1:1
               SET BPINS=$ORDER(BPINSARR(BPINS))
               if +BPINS=0
                   QUIT 
               Begin DoDot:1
 +24               SET BPARR("INS")=$GET(BPARR("INS"))_";"_BPINS
               End DoDot:1
 +25       SET (BPARR("INS"),BPARR(2.04))=$GET(BPARR("INS"))_";"
 +26       QUIT +RETV
 +27      ;
 +28      ;Reads insurance selection from the USER PROFILE file
 +29      ;Input: BPDUZ7 - DUZ
 +30      ;       BPINSUR by ref - array to return insurances saved in 2.04 Parameter : BPINSUR(IEN of file 36)
 +31      ;Return value:
 +32      ; 0 nothing saved
 +33      ; n number of IENs of #36 selected by the user and stored in BPINSUR
 +34      ;Returned by reference:
 +35      ; BPINSUR - array with IENs to file #36
GETINS(BPDUZ7,BPINSUR) ;
 +1        NEW BPINS,BPCNT
 +2        SET BPARRAY("INS")=$$GETPARAM^BPSSCRSL("2.04",BPDUZ7)
 +3        FOR BPCNT=1:1:20
               SET BPINS=$PIECE($GET(BPARRAY("INS")),";",BPCNT+1)
               if +BPINS=0
                   QUIT 
               Begin DoDot:1
 +4                SET BPINSUR(BPINS)=BPINS
                   SET BPINSUR("B",$$INSNM^IBNCPDPI(BPINS),BPINS)=""
               End DoDot:1
 +5        QUIT BPCNT-1
 +6       ;
 +7       ;Display selected Insurances
 +8       ;Input: BPINSARR = Array of insurances to display
 +9       ; BPINSARR("B",INSURANCE COMPANY NAME)
DISPINS(BPINSARR) ;
 +1        IF $DATA(BPINSARR)>9
               Begin DoDot:1
 +2                NEW X
 +3                WRITE !,?2,"Selected:"
 +4                SET X=""
                   FOR 
                       SET X=$ORDER(BPINSARR("B",X))
                       if X=""
                           QUIT 
                       WRITE ?12,X,!
 +5                KILL X
               End DoDot:1
 +6        QUIT 
 +7       ;
 +8       ;Check if PLAN ID for selected BP59 matches selected insurances
 +9       ;Input: BPPLAN = Insurance company IEN from PLAN ID field in BPS TRANSACTION file
 +10      ;       BPINS = Semi-colon separated list of insurances selected by the user.
 +11      ;               See INSURSEL
 +12      ;Output: 1 = Yes a match was found
 +13      ;        0 = No match found
CHKINS(BPPLAN,BPINS) ;
 +1        NEW BPIN,BPRETV
 +2        SET BPRETV=0
 +3        FOR I=2:1
               SET BPIN=$PIECE($GET(BPINS),";",I)
               if BPIN=""
                   QUIT 
               Begin DoDot:1
 +4                SET BPRETV=$SELECT(BPIN=BPPLAN:1,1:0)
               End DoDot:1
               if BPRETV
                   QUIT 
 +5        QUIT BPRETV
 +6       ;