Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BPSSCRCV

BPSSCRCV.m

Go to the documentation of this file.
  1. BPSSCRCV ;BHAM ISC/SS - ECME SCREEN CHANGE VIEW ;05-APR-05
  1. ;;1.0;E CLAIMS MGMT ENGINE;**1,5,7,11,14,20,22,23**;JUN 2004;Build 44
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;USER SCREEN
  1. Q
  1. ;****
  1. ;This software is using PARAMETER TOOLS (see XT*7.3*26) to store user's settings:
  1. ;PARAMETER DEFINITION NAME="BPS USRSCR" (file #8989.51, IA# 2263)
  1. ;ENTITY is "USR" , i.e. IEN in ^VA(200 -- see definition for "BPS USRSCR"
  1. ;INSTANCEs are as follows:
  1. ;1.01 ONE/ALL USERS --'U' ONE USER, 'A' ALL; Display claims for ONE or ALL users
  1. ;1.02 ONE/ALL PATIENTS --'P' FOR ONE PATIENT; 'A' FOR ALL; Display claims for ONE/ALL PATIENTS
  1. ;1.03 ONE/ALL RX --'R' FOR ONE RX; 'A' FOR ALL; Display claims for ONE or ALL RX
  1. ;1.031 DATE RANGE/TIMEFRAME -- 'D' FOR DATE RANGE; 'T' FOR TIMEFRAME;
  1. ;1.032 ACTIVITY BEGINNING DATE - Beginning Date of the Date Range
  1. ;1.033 ACTIVITY ENDING DATE - Ending Date of the Date Range
  1. ;1.04 HOURS/DAYS -- 'D' FOR DAYS; 'H' FOR HOURS; Use HOURS or DAYS to specify timeframe
  1. ;1.05 TIMEFRAME -- NUMBER Depends on the value of the field "USR SCR HOURS/DAYS" this field will
  1. ;store the default number of HOURS from NOW or DAYS from TODAY to select claims to display
  1. ;1.06 REJECTED/PAYABLE --'R' FOR REJECTS; 'P' FOR PAYABLES; 'U' FOR UNSTRANDED; 'A' FOR ALL; Display Rejects or Payables or Unstranded or ALL claims
  1. ;1.07 RELEASED/NOT RELEASED --'R' FOR RELEASED; 'N' FOR NON-RELEASED; 'A' FOR ALL; Display Released Rxs or Non-Released Rxs or ALL
  1. ;1.08 CMOP/MAIL/WINDOW --'C' FOR CMOP; 'M' FOR MAIL;'W' FOR WINDOW;'A' FOR ALL; Display CMOP or Mail or Window or ALL Rxs
  1. ;1.09 REALTIME/BACKBILL --'R' FOR REALTIME; 'B' FOR BACKBILLS; 'P' FOR PRO Option; 'S' FOR ECME User Screen Resubmits;
  1. ; 'A' FOR ALL; Display RealTime, Backbills, PRO Option, Resubmission, or ALL
  1. ;1.1 REJECT CODE/ALL --'R' FOR REJECT CODE; 'A' FOR ALL; Display Specific Reject Code or ALL Reject
  1. ;Codes 0 means ALL Reject Codes otherwise - Reject Code value
  1. ;1.11 SPECIFIC/ALL INSURANCES --'I' FOR SPECIFIC INSURANCE(S);'A' FOR ALL; Display Specific Insurance Company(s) or All null - ALL otherwise - pointer to INSURANCE COMPANY file #36
  1. ;1.12 SORT LIST --'T' FOR TRANSACTION DATE;'D' FOR DIVISION; 'I' FOR INSURANCE; 'C' FOR REJECT CODE;
  1. ;'P' FOR PATIENT NAME -- 'N' FOR DRUG NAME; 'B' FOR BILL TYPE (BB/P2/RT/RS); 'L' FOR FILL LOCATION;
  1. ;'R' FOR RELEASED/NON-RELEASED -- 'A' FOR ACTIVE/DISCONTINUED; the field used to sort claims in the list
  1. ;1.13 ALL ECME PHARMACY DIVISIONS --'D' FOR DIVISION; 'A' FOR ALL;
  1. ;1.14 SELECTED INSURANCE -- Single, or multiple, insurance(s) to select claims for the User Screen, to store INSURANCE COMPANY pointer (#36)
  1. ;1.15 SELECTED REJECTED CODE --POINTER TO BPS NCPDP REJECT CODES FILE (#9002313.93) Reject code selected by the user to filter claims.
  1. ;1.16 SELECTED USER -- POINTER TO NEW PERSON FILE (#200) Selected user for the user screen
  1. ;1.17 SELECTED PATIENT -- POINTER TO PATIENT FILE (#2) Selected patient for the User Screen
  1. ;1.18 SELECTED RX -- POINTER TO PRESCRIPTION FILE (#52) Selected RX
  1. ;1.19 NON-BILLABLE TRI/CVA ENTRIES OPEN/CLOSED/ALL -- 'O' Open; 'C' Closed; 'A' All
  1. ;2 ECME PHARMACY DIVISION -- the list of POINTERs TO BPS PHARMACIES FILE (#9002313.56) separated by ";"
  1. ;should start and end with ";", example: ";4;5;"
  1. ;2.01 ELIGIBILITY TYPE --'V' FOR VETERAN;'T' FOR TRICARE;'C' FOR CHAMPVA;'A' FOR ALL; Display claims for specific Eligibility Type or ALL (BNT BPS*1.0*7)
  1. ;2.02 OPEN/CLOSED/ALL --'O' OPEN CLAIMS;'C' CLOSED CLAIMS;'A' FOR ALL; Display Open, Closed, or ALL claims (BNT BPS*1.0*7)
  1. ;2.03 SUBMISSION TYPE --'B' BILLING REQUESTS;'R' REVERSALS;'A' FOR ALL; Display specific submission type claims or ALL (BNT BPS*1.0*7)
  1. ;2.04 INSURANCES -- List of POINTERs to the INSURANCE COMPANY FILE (#36) separated by ";"
  1. ;should start and end with ";", example: ";4;5;"
  1. ;NOTE: use D ^XPAREDIT to add/edit values
  1. ;
  1. ;*****
  1. ;
  1. CV ;
  1. N BPSRESCV,BPSTMPCV,DIR,Y
  1. D FULL^VALM1
  1. W @IOF
  1. S BPSTMPCV=$G(BPARR("TEMPCV")) ; Define Temp View Flag before BPARR is killed
  1. K BPARR
  1. I +$G(DUZ)=0 D ERRMSG^BPSSCRCV("Unknown User") Q
  1. N BPDUZ7
  1. S BPDUZ7=+DUZ
  1. ;always get current profile from the file
  1. D READPROF^BPSSCRSL(.BPARR,BPDUZ7)
  1. ; BPARR("1.13") is the parameter for Pharmacy Division.
  1. ; If BPARR("1.13") is defined, the user has a preferred view defined.
  1. I ($G(BPSTMPCV)=1)&($G(BPARR("1.13"))'="") D
  1. . S DIR(0)="Y"
  1. . S DIR("A")="Restore your Preferred View and exit Change View (Y/N)"
  1. . D ^DIR
  1. . S BPSRESCV=Y
  1. I $G(BPSRESCV)=1 G CV1 ; User replied YES - restore to preferred view.
  1. D SAVEVIEW^BPSSCR01(.BPARR)
  1. ;edit current profile
  1. D EDITPROF(.BPARR,.BPDUZ7)
  1. ;ask user if need to save everything in USR PROFILE file
  1. ;(except SORT LIST field)
  1. N BPSRT S BPSRT=BPARR(1.12)
  1. K BPARR(1.12)
  1. D ENDEDIT^BPSSCRSL(.BPARR,+BPDUZ7)
  1. S BPARR(1.12)=BPSRT
  1. CV1 ;
  1. D SAVEVIEW^BPSSCR01(.BPARR)
  1. S VALMBG=1
  1. D REDRAW^BPSSCRUD("Updating screen...")
  1. Q
  1. ;edit user profile for CHANGE VIEW
  1. EDITPROF(BPARR,BPDUZ7) ;
  1. I +$G(DUZ)=0 D ERRMSG("Unknown User") Q
  1. N BP1,BPACT,BPTF,BPQ,BPINP
  1. N BPRET
  1. N DIR,DR,DIE,DA
  1. N BPS106,BPS106STR,BPS108,BPS108STR,BPS109,BPS109STR,BPS115,BPS115AR,BPS115NM,BPS115X
  1. N BPS116,BPS116AR,BPS116NM,BPS116X,BPS117,BPS117AR,BPS117NM,BPS117X,BPS118,BPS118AR,BPS118X
  1. N BPS201,BPS201STR,BPSCNT,BPSDRUG,BPSERR,BPSRXD,BPSRXN,BPSSEL,BPSX,BPSDAYS,BPSTMPDT
  1. ;get ONE/ALL USERS?
  1. ;EDITFLD(FILENO,FLDNO,RECIEN,CODESET,PRMTMSG,DFLTCODE) ;
  1. ;
  1. BPS113 ; FIELD 1.13 - Division
  1. S BPRET=$$DS^BPSSCRDS(.BPARR,+BPDUZ7) ;get divisions
  1. Q:BPRET=-2 ;quit due to timeout or ^
  1. ; If (D)ivision option was selected but no Divisons entered, set BPARR(1.13)to "A"
  1. ; and re-prompt current question.
  1. I ($G(BPARR(1.13))="D")&(($G(BPARR("DIVS"))="")!($G(BPARR("DIVS"))=";")) S BPARR(1.13)="A" G BPS113
  1. ;
  1. I $$BPS201^BPSSCRV1(.BPARR)=0 Q
  1. I $$BPS101^BPSSCRV1(.BPARR)=0 Q
  1. I $$BPS102^BPSSCRV1(.BPARR)=0 Q
  1. I BPARR(1.02)="A" S BPSTMPDT="" D DTERNG ; If ALL patients, verify date range is not over 180 days
  1. I $$BPS103^BPSSCRV1(.BPARR)=0 Q
  1. ;
  1. DATETIME ; Display by Date Range or Timeframe
  1. ; Prompt the user to select Display Activity Date Range or Timeframe.
  1. S BPINP=$$ACTTYP()
  1. Q:BPINP=-1 ;quit due to timeout or ^
  1. ;
  1. S BPACT=BPINP
  1. S BPQ=0
  1. ;
  1. S BPSDAYS=180
  1. I BPARR(1.02)="P" S BPSDAYS=366
  1. ;
  1. ; If Date Range was selected, prompt for Activity Beginning and Ending Date.
  1. I BPACT="D" D
  1. . ; Clear out Timeframe parameters.
  1. . S (BPARR(1.04),BPARR(1.05))=""
  1. . ;
  1. . S BPINP=$$BEGDATE()
  1. . I BPINP=-1 S BPQ=-1 Q
  1. . S BPINP=$$ENDDATE()
  1. . I BPINP=-1 S BPQ=-1 Q
  1. ;
  1. I BPQ=-1 D G DATETIME ; Date Range selected, but no dates entered
  1. . W !!,"Beginning and Ending Dates are required for Date Range"
  1. . ; Don't allow user to exit out without making valid selections.
  1. . ; If user selects Date Range but no valid dates default to Timeframe and 7 days.
  1. . S BPARR(1.031)="T",BPARR(1.04)="D",BPARR(1.05)=7
  1. ;
  1. ; If Timeframe was selected, prompt for Days or Hours and Activity Timeframe Value.
  1. I BPACT="T" D
  1. . ; Clear out Date Range Parameters.
  1. . S (BPARR(1.032),BPARR(1.033))=""
  1. . ;
  1. . S BPINP=$$EDITFLD(1.04,+BPDUZ7,"S^D:DAYS;H:HOURS","Activity Timeframe (H)ours or (D)ays","DAYS",.BPARR)
  1. . I BPINP=-1 S BPQ=-1 Q
  1. . S BPTF=$P(BPINP,U,2)
  1. . S BPINP=$$EDITFLD(1.05,+BPDUZ7,"N^1:"_BPSDAYS_":0","Activity Timeframe Value",$S(BPTF="H":24,1:7),.BPARR)
  1. . I BPINP=-1 S BPQ=-1 Q
  1. Q:BPQ=-1 ;quit due to timeout or ^
  1. ;
  1. Q:$$EDITFLD(2.02,+BPDUZ7,"S^O:OPEN CLAIMS;C:CLOSED CLAIMS;A:ALL","Select Open/Closed or All Claims","O",.BPARR)=-1
  1. Q:$$EDITFLD(1.19,+BPDUZ7,"S^O:Open Non-Billable Entries;C:Closed Non-Billable Entries;A:ALL","Display (O)pen or (C)losed or (A)ll Non-Billable Entries","A",.BPARR)=-1
  1. Q:$$EDITFLD(2.03,+BPDUZ7,"S^B:BILLING REQUESTS;R:REVERSALS;A:ALL","Select Submission Type","A",.BPARR)=-1
  1. I $$BPS106^BPSSCRV2(.BPARR)=0 Q
  1. Q:$$EDITFLD(1.07,+BPDUZ7,"S^R:RELEASED;N:NON-RELEASED;A:ALL","Display (R)eleased Rxs or (N)on-Released Rxs or (A)LL","RELEASED",.BPARR)=-1
  1. I $$BPS108^BPSSCRV2(.BPARR)=0 Q
  1. I $$BPS109^BPSSCRV2(.BPARR)=0 Q
  1. I $$BPS110^BPSSCRV2(.BPARR)=0 Q
  1. ;
  1. Q:$$INSURSEL^BPSSCRCU(.BPARR,+BPDUZ7)=-1
  1. Q
  1. ;
  1. ERRMSG(BPMSG) ;
  1. W !,"***",BPMSG,"***",!
  1. D PAUSE^VALM1
  1. Q
  1. ;/**
  1. ;FLDNO - PARAMETERS INSTANCE
  1. ;RECIEN - User DUZ
  1. ;DIR0 - like DIR(0) node for ^DIR - i.e. field type, etc
  1. ;PRMTMSG - user prompt
  1. ;DFLTVAL - pass the default value for the case if there is no value in database
  1. ;BPARRAY - array to store and change values in profile
  1. ;returns:
  1. ;as return value:
  1. ; "1^value" - if selected
  1. ; "-1" if timeout or uparrow
  1. ;via BPARRAY
  1. ; BPARRAY(filedno)=value
  1. EDITFLD(FLDNO,RECIEN,DIR0,PRMTMSG,DFLTVAL,BPARRAY) ;*/
  1. N DIR,RETV,RETARR
  1. N RECIENS,FDA,LCK,ERRARR
  1. S RETV=$$GETPARAM^BPSSCRSL(FLDNO,RECIEN)
  1. I FLDNO=1.17 S RETV=$P($G(^DPT(+RETV,0)),U)
  1. ;Use the External Code from File #9002313.93 as the default value to display to user.
  1. I FLDNO=1.15 S RETV=$P($G(^BPSF(9002313.93,+RETV,0)),U)
  1. ;if data then use it, otherwise use data from parameter
  1. I $L($G(RETV))>0&($G(BPSERR)'=1) S DFLTVAL=RETV E S DFLTVAL=$G(DFLTVAL)
  1. ;prompt the user
  1. S RETV=$$PROMPT(DIR0,PRMTMSG,DFLTVAL)
  1. Q:RETV<0 -1
  1. ;save it in the database
  1. S BPARRAY(FLDNO)=RETV
  1. Q "1^"_RETV
  1. ;
  1. ;
  1. FILEIT(FILENO,FLDNO,RECIEN,NEWVAL) ;
  1. N RECIENS
  1. S RECIENS=RECIEN_","
  1. S FDA(FILENO,RECIENS,FLDNO)=NEWVAL
  1. L +^BPS(FILENO,RECIEN,1):10 S LCK=$T I 'LCK Q "0^"_NEWVAL_"^LOCKED" ;quit
  1. D FILE^DIE("","FDA","ERRARR")
  1. I LCK L -^BPS(FILENO,RECIEN,1)
  1. I $D(ERRARR) Q "0^"_NEWVAL_"^"_ERRARR("DIERR",1,"TEXT",1)
  1. Q "1^"_NEWVAL
  1. ;
  1. ;prompts for selection
  1. ;returns selection
  1. ;OR -1 when timeout and uparrow
  1. PROMPT(ZERONODE,PRMTMSG,DFLTVAL) ;
  1. N Y,DUOUT,DTOUT,BPQUIT,DIROUT
  1. S BPQUIT=0
  1. I $E(ZERONODE,1,1)="P" D
  1. . N DIC
  1. . S DIC="^"_$P(ZERONODE,U,2)
  1. . S DIC(0)="AEMNQ"
  1. . S:$L($G(DFLTVAL))>0 DIC("B")=DFLTVAL
  1. . S DIC("A")=PRMTMSG_": "
  1. . D ^DIC
  1. . I (Y=-1)!$D(DUOUT)!$D(DTOUT) S BPQUIT=1
  1. E D
  1. . N DIR
  1. . S DIR(0)=ZERONODE
  1. . S DIR("A")=PRMTMSG
  1. . S:$L($G(DFLTVAL))>0 DIR("B")=DFLTVAL
  1. . ;
  1. . ; display some extra text for FLDNO=1.19 (BPS*1*20)
  1. . I $G(FLDNO)=1.19 D
  1. .. S DIR("A",1)=" Please note this question only applies to"
  1. .. S DIR("A",2)=" TRICARE or CHAMPVA Non-Billable Entries."
  1. .. S DIR("A",3)=" "
  1. .. Q
  1. . ;
  1. . D ^DIR
  1. . I (Y=-1)!$D(DIROUT)!$D(DUOUT)!$D(DTOUT) S BPQUIT=1
  1. I BPQUIT=1 Q -1
  1. Q $P(Y,U)
  1. ;
  1. GETFLD(FILENO,FLDNO,RECIEN) ;
  1. N RETV,RETARR
  1. N RECIENS
  1. S RECIENS=RECIEN_","
  1. ; first try to get the value from file
  1. D GETS^DIQ(FILENO,RECIENS,FLDNO,"E","RETARR")
  1. S RETV=$G(RETARR(FILENO,RECIENS,FLDNO,"E"))
  1. Q $G(RETV)
  1. ;
  1. ;save all profile array to file
  1. ;BPARRAY - arrays with pointers to 9002313.56
  1. ;BPDUZ7 - DUZ
  1. FILEALL(BPARRAY,BPDUZ7) ;
  1. ;BPS*14 - RRA changed API, because previously it was re-writing Division
  1. ;and Insurance parameter regardless if it was modified and had a value
  1. ;ticket 337299
  1. N BPFLD,BP2
  1. S BPFLD=0
  1. F S BPFLD=$O(BPARRAY(BPFLD)) Q:$G(BPFLD)="" D
  1. . I BPFLD="DIVS" I $$SAVEPAR^BPSSCRSL(2,BPDUZ7,$G(BPARRAY("DIVS")))
  1. . I BPFLD="INS" I $$SAVEPAR^BPSSCRSL(2.04,BPDUZ7,$G(BPARRAY("INS")))
  1. . Q:+BPFLD=0 I $$SAVEPAR^BPSSCRSL(BPFLD,+BPDUZ7,$G(BPARRAY(BPFLD)))
  1. Q
  1. ;
  1. ACTTYP() ; Prompt the user to select Display Activity Date Range or Timeframe.
  1. ; The user is required to select D or T and there is no default value.
  1. ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,RETV,X,Y
  1. S RETV=$$GETPARAM^BPSSCRSL(1.031,+BPDUZ7)
  1. S DIR(0)="S^D:Date Range;T:Timeframe"
  1. S DIR("A")="Display Activity (D)ate Range or (T)imeframe"
  1. S DIR("B")="T"
  1. I RETV'="" S DIR("B")=RETV
  1. S DIR("?",1)="Date Range will allow a user to specify an activity beginning and ending date."
  1. S DIR("?")="Timeframe will allow a user to specify the activity by days or hours."
  1. D ^DIR
  1. ;
  1. ;quit due to timeout or ^
  1. I $D(DIRUT) Q -1
  1. ;
  1. S BPARR(1.031)=Y
  1. Q BPARR(1.031)
  1. ;
  1. BEGDATE() ; Enter Activity Beginning Date when Date Range is selected
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,RETV,X,Y
  1. S RETV=$$GETPARAM^BPSSCRSL(1.032,+BPDUZ7)
  1. I $G(BPSTMPDT)=1 S RETV="T-7"
  1. BEGDATE1 ;
  1. S DIR(0)="D"
  1. S DIR("A")="Activity Beginning Date"
  1. I RETV'="" S DIR("B")=$$FMTE^XLFDT(RETV,"D")
  1. S DIR("?")="Enter a date which is less than or equal to "_$$FMTE^XLFDT($$NOW^XLFDT(),"D")
  1. D ^DIR
  1. ;
  1. ;quit due to timeout or ^
  1. I $D(DIRUT) Q -1
  1. ;
  1. I Y>$$NOW^XLFDT() W !,"Enter a date less than or equal to "_$$FMTE^XLFDT($$NOW^XLFDT(),"D"),! G BEGDATE1
  1. ;
  1. W " (",Y(0),")"
  1. S BPARR(1.032)=Y
  1. Q BPARR(1.032)
  1. ;
  1. ENDDATE() ; Enter Activity Ending Date when Date Range is selected
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,RETV,X,Y
  1. S RETV=$$GETPARAM^BPSSCRSL(1.033,+BPDUZ7)
  1. I $G(BPSTMPDT)=1 S RETV="T"
  1. ENDDATE1 ;
  1. S DIR(0)="D"
  1. S DIR("A")="Activity Ending Date"
  1. I RETV'="" S DIR("B")=$$FMTE^XLFDT(RETV,"D")
  1. S DIR("?")="Enter a date which is no more than "_BPSDAYS_" days after the Beginning Date."
  1. D ^DIR
  1. ;
  1. ;quit due to timeout or ^
  1. I $D(DIRUT) Q -1
  1. ;
  1. I Y<BPARR(1.032) W !!,"Ending Date precedes Beginning Date.",! G ENDDATE1
  1. ;
  1. I $$FMDIFF^XLFDT(Y,BPARR(1.032))>BPSDAYS D G ENDDATE1
  1. . W !!,"Date range exceeds "_BPSDAYS_" day limit. Select an Ending Date no more"
  1. . W !,"than "_BPSDAYS_" days after the Beginning Date.",!
  1. ;
  1. W " (",Y(0),")"
  1. S BPARR(1.033)=Y
  1. Q BPARR(1.033)
  1. ;
  1. DTERNG ; Date Range Check
  1. ; If ALL patients selected, verify the user preferred time frame
  1. ; is not outside of the allowable range. If time frame is outside
  1. ; of the allowable range, update range to the past 7 days.
  1. N BPS1031,BPS1032,BPS1033,BPS104,BPS105,BPSDAYS
  1. S BPS1031=$$GETPARAM^BPSSCRSL(1.031,+BPDUZ7)
  1. S BPS1032=$$GETPARAM^BPSSCRSL(1.032,+BPDUZ7)
  1. S BPS1033=$$GETPARAM^BPSSCRSL(1.033,+BPDUZ7)
  1. S BPS104=$$GETPARAM^BPSSCRSL(1.04,+BPDUZ7)
  1. S BPS105=$$GETPARAM^BPSSCRSL(1.05,+BPDUZ7)
  1. I ((BPS1031="T")&(BPS105>180))!((BPS1031="D")&($$FMDIFF^XLFDT(BPS1033,BPS1032)>180)) D
  1. . S BPARR(1.031)="T"
  1. . S BPARR(1.032)=""
  1. . S BPARR(1.033)=""
  1. . S BPARR(1.04)="D"
  1. . S BPARR(1.05)=7
  1. . I BPS1031="T" S BPSDAYS=BPS105
  1. . I BPS1031="D" S BPSDAYS=$$FMDIFF^XLFDT(BPS1033,BPS1032)
  1. . W !!,"Date range exceeds 180 day limit which is not allowed when all patients"
  1. . W !,"are selected. The window of time has changed from "_BPSDAYS_" days to the"
  1. . W !,"last 7 days."
  1. . S BPSTMPDT=1
  1. Q