| 1 | BPSRPT0 ;BHAM ISC/BEE - ECME REPORTS ;14-FEB-05
 | 
|---|
| 2 |  ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45
 | 
|---|
| 3 |  ;;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  Q
 | 
|---|
| 6 |  ;
 | 
|---|
| 7 |  ; Front End for ECME Reports
 | 
|---|
| 8 |  ; 
 | 
|---|
| 9 |  ; Input variable: BPRTYPE -> 1 = Payable Claims
 | 
|---|
| 10 |  ;                          2 = Rejected Claims
 | 
|---|
| 11 |  ;                          3 = Claims Submitted, Not Yet Released
 | 
|---|
| 12 |  ;                          4 = Reversed Claims
 | 
|---|
| 13 |  ;                          5 = Recent Transactions
 | 
|---|
| 14 |  ;                          6 = Totals By Date
 | 
|---|
| 15 |  ;                          7 = Closed Claims
 | 
|---|
| 16 |  ;                          
 | 
|---|
| 17 |  ; Passed variables - The following local variables are passed around the BPSRPT* routines
 | 
|---|
| 18 |  ;                    and are not passed as parameters but are assumed to be defined:
 | 
|---|
| 19 |  ;                    BPACREJ,BPAUTREV,BPBEGDT,BPBLINE,BPCCRSN,BPDRGCL,BPDRUG,BPENDDT,BPEXCEL,
 | 
|---|
| 20 |  ;                    BPINSINF,BPGRPLN,BPMWC,BPNOW,BPPAGE,BPPHARM,BPQ,BPQSTDRG,
 | 
|---|
| 21 |  ;                    BPRLNRL,BPRTBCK,BPSDATA,BPSUMDET,BPRTYPE
 | 
|---|
| 22 |  ;                          
 | 
|---|
| 23 | EN(BPRTYPE) N %,BPACREJ,BPAUTREV,BPBEGDT,BPCCRSN,BPDRGCL,BPDRUG,BPENDDT,BPEXCEL,BPNOW,BPPHARM,BPINSINF,BPMWC,BPQ,BPQSTDRG
 | 
|---|
| 24 |  N BPREJCD,BPRLNRL,BPRPTNAM,BPRTBCK,BPSCR,BPSUMDET,CODE,POS,STAT,X,Y
 | 
|---|
| 25 |  ;
 | 
|---|
| 26 |  ;Verify that a valid report has been requested
 | 
|---|
| 27 |  I ",1,2,3,4,5,6,7,"'[(","_$G(BPRTYPE)_",") W "<Invalid Menu Definition - Report Undefined>" H 3 Q
 | 
|---|
| 28 |  S BPRPTNAM=$S(BPRTYPE=1:"PAYABLE CLAIMS",BPRTYPE=2:"REJECTED CLAIMS",BPRTYPE=3:"SUBMIT,NOT RELEASED CLAIMS",BPRTYPE=4:"REVERSED CLAIMS",BPRTYPE=5:"RECENT TRANSACTIONS",BPRTYPE=6:"TOTALS",BPRTYPE=7:"CLOSED CLAIMS",1:"")
 | 
|---|
| 29 |  ;
 | 
|---|
| 30 |  ;Get current Date/Time
 | 
|---|
| 31 |  D NOW^%DTC S Y=% D DD^%DT S BPNOW=Y
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 |  ;Prompt for ECME Pharmacy Division(s) (No Default)
 | 
|---|
| 34 |  ;Sets up BPPHARM variable and array, BPPHARM =0 ALL or BPPHARM=1,BPPHARM(ptr) for list
 | 
|---|
| 35 |  S X=$$SELPHARM^BPSRPT3() I X="^" G EXIT
 | 
|---|
| 36 |  ;
 | 
|---|
| 37 |  ;Prompt to Display Summary or Detail Format (Default to Detail)
 | 
|---|
| 38 |  ;Returns 1 for Summary, 0 for Detail
 | 
|---|
| 39 |  S BPSUMDET=$$SELSMDET^BPSRPT3(2) I BPSUMDET="^" G EXIT
 | 
|---|
| 40 |  ;
 | 
|---|
| 41 |  ;Prompt to Display Single Insurance or All (Default to ALL)
 | 
|---|
| 42 |  ;Returns Insurance Company Name (from #36) or 0 for All
 | 
|---|
| 43 |  S BPINSINF=$$SELINSIN^BPSRPT3(0) I BPINSINF="^" G EXIT
 | 
|---|
| 44 |  ;
 | 
|---|
| 45 |  ;Prompt to Display (C)MOP or (M)ail or (W)indow or (A)LL (Default to ALL)
 | 
|---|
| 46 |  ;Returns (A-ALL,M-Mail,W-Window,C-CMOP)
 | 
|---|
| 47 |  S BPMWC=$$SELMWC^BPSRPT3("A") I BPMWC="^" G EXIT
 | 
|---|
| 48 |  ;
 | 
|---|
| 49 |  ;Prompt to Display (R)ealTime Fills or (B)ackbills or (A)LL (Default to ALL)
 | 
|---|
| 50 |  ;Returns (1-ALL,2-RealTime Fills,3-Backbills)
 | 
|---|
| 51 |  S BPRTBCK=$$SELRTBCK^BPSRPT3(1) I BPRTBCK="^" G EXIT
 | 
|---|
| 52 |  ;
 | 
|---|
| 53 |  ;Prompt to Display Specific (D)rug or Drug (C)lass or (A)ll (Default to ALL)
 | 
|---|
| 54 |  ;Returns (1-ALL,2-Drug,3-Drug Class)
 | 
|---|
| 55 |  S BPQSTDRG=$$SELDRGAL^BPSRPT3(1) I BPQSTDRG="^" Q
 | 
|---|
| 56 |  ;
 | 
|---|
| 57 |  ;Prompt to Select Drug (No Default)
 | 
|---|
| 58 |  S BPDRUG=0 I BPQSTDRG=2 S BPDRUG=$$SELDRG^BPSRPT3() I BPDRUG="^" G EXIT
 | 
|---|
| 59 |  ;
 | 
|---|
| 60 |  ;Prompt to Select Drug Class (No Default)
 | 
|---|
| 61 |  S BPDRGCL=0 I BPQSTDRG=3 S BPDRGCL=$$SELDRGCL^BPSRPT3() I BPDRGCL="^" G EXIT
 | 
|---|
| 62 |  ;
 | 
|---|
| 63 |  ;Report Specific Prompts
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 |  ;Prompt to select Date Range
 | 
|---|
| 66 |  ;Returns (Start Date^End Date)
 | 
|---|
| 67 |  I (",1,2,3,4,5,6,7,")[BPRTYPE S BPBEGDT=$$SELDATE^BPSRPT3(BPRTYPE) D  I BPBEGDT="^" G EXIT
 | 
|---|
| 68 |  .I BPBEGDT="^" Q
 | 
|---|
| 69 |  .S BPENDDT=$P(BPBEGDT,U,2)
 | 
|---|
| 70 |  .S BPBEGDT=$P(BPBEGDT,U)
 | 
|---|
| 71 |  ;
 | 
|---|
| 72 |  ;Prompt to Include (R)ELEASED or (N)OT RELEASED or (A)LL (Default to RELEASED)
 | 
|---|
| 73 |  ;Returns (1-ALL,2-RELEASED,3-NOT RELEASED)
 | 
|---|
| 74 |  S BPRLNRL=$S(BPRTYPE=3:3,1:1) I (",1,2,4,6,7,")[BPRTYPE S BPRLNRL=$$SELRLNRL^BPSRPT4(2) I BPRLNRL="^" G EXIT
 | 
|---|
| 75 |  ;
 | 
|---|
| 76 |  ;Prompt to Include (S)pecific Reject Code or (A)LL (Default to ALL)
 | 
|---|
| 77 |  ;Returns (0-ALL,ptr-Pointer to Selected Reject Code in #9002313.93)
 | 
|---|
| 78 |  S BPREJCD=0 I (",2,")[BPRTYPE S BPREJCD=$$SELREJCD^BPSRPT4(0) I BPREJCD="^" G EXIT
 | 
|---|
| 79 |  ;
 | 
|---|
| 80 |  ;Prompt to Include Auto(R)eversed or (A)LL (Default to ALL)
 | 
|---|
| 81 |  ;Returns (0-All,1-AutoReversed)
 | 
|---|
| 82 |  S BPAUTREV=0 I (",4,")[BPRTYPE S BPAUTREV=$$SELAUREV^BPSRPT4(0) I BPAUTREV="^" G EXIT
 | 
|---|
| 83 |  ;
 | 
|---|
| 84 |  ;Prompt to Include A(C)cepted or (R)ejected or (A)LL (Default to REJECTED)
 | 
|---|
| 85 |  ;Returns (0-All,1-Rejected,2-Accepted)
 | 
|---|
| 86 |  S BPACREJ=0 I (",4,")[BPRTYPE S BPACREJ=$$SELACREJ^BPSRPT4(1) I BPACREJ="^" G EXIT
 | 
|---|
| 87 |  ;
 | 
|---|
| 88 |  ;Prompt to Include (S)pecific Close Claim Reason or (A)ll (Default to All)
 | 
|---|
| 89 |  ;Returns (0-All,ptr-Pointer to #356.8)
 | 
|---|
| 90 |  S BPCCRSN=0 I (",7,")[BPRTYPE S BPCCRSN=$$SELCCRSN^BPSRPT4(0) I BPCCRSN="^" G EXIT
 | 
|---|
| 91 |  ;
 | 
|---|
| 92 |  ;Prompt for Excel Capture (Detail Only)
 | 
|---|
| 93 |  S BPEXCEL=0 I 'BPSUMDET S BPEXCEL=$$SELEXCEL^BPSRPT4() I BPEXCEL="^" G EXIT
 | 
|---|
| 94 |  ;
 | 
|---|
| 95 |  ;Prompt for the Device
 | 
|---|
| 96 |  I 'BPEXCEL D
 | 
|---|
| 97 |  .W !!,"WARNING - THIS REPORT REQUIRES THAT A DEVICE WITH 132 COLUMN WIDTH BE USED."
 | 
|---|
| 98 |  .W !,"IT WILL NOT DISPLAY CORRECTLY USING 80 COLUMN WIDTH DEVICES",!
 | 
|---|
| 99 |  S BPQ=0 D DEVICE(BPRPTNAM) Q:BPQ
 | 
|---|
| 100 |  ;
 | 
|---|
| 101 |  ;Compile and Run the Report
 | 
|---|
| 102 |  D RUN(BPEXCEL,BPRPTNAM,BPSUMDET)
 | 
|---|
| 103 |  I 'BPQ D PAUSE2^BPSRPT1
 | 
|---|
| 104 |  ;
 | 
|---|
| 105 | EXIT Q
 | 
|---|
| 106 |  ;
 | 
|---|
| 107 |  ;Compile and Run the Report
 | 
|---|
| 108 |  ;
 | 
|---|
| 109 | RUN(BPEXCEL,BPRPTNAM,BPSUMDET) N BPPAGE,BPTMP
 | 
|---|
| 110 |  S BPTMP=$NA(^TMP($J,"BPSRPT"))
 | 
|---|
| 111 |  K @BPTMP
 | 
|---|
| 112 |  S BPPAGE=0
 | 
|---|
| 113 |  W:BPSCR&'BPEXCEL !,"Please wait...",!
 | 
|---|
| 114 |  ;
 | 
|---|
| 115 |  ;Compile the report
 | 
|---|
| 116 |  Q:$$COLLECT^BPSRPT1(BPTMP)=-1
 | 
|---|
| 117 |  U IO
 | 
|---|
| 118 |  ;
 | 
|---|
| 119 |  ;Display the report
 | 
|---|
| 120 |  D REPORT^BPSRPT5(BPTMP,BPEXCEL,BPSCR,BPRPTNAM,BPSUMDET,BPPAGE)
 | 
|---|
| 121 |  I 'BPSCR W !,@IOF
 | 
|---|
| 122 |  K @BPTMP
 | 
|---|
| 123 |  I $D(ZTQUEUED) S ZTREQ="@" Q
 | 
|---|
| 124 |  D ^%ZISC
 | 
|---|
| 125 |  Q
 | 
|---|
| 126 |  ;
 | 
|---|
| 127 |  ;Prompt For the Device
 | 
|---|
| 128 |  ;
 | 
|---|
| 129 |  ; Returns Device variables and BPSCR
 | 
|---|
| 130 |  ;
 | 
|---|
| 131 | DEVICE(BPRPTNAM) N %ZIS,ZTSK,ZTRTN,ZTIO,ZTDESC,ZTSAVE,POP
 | 
|---|
| 132 |  S %ZIS="QM"
 | 
|---|
| 133 |  D ^%ZIS
 | 
|---|
| 134 |  I POP S BPQ=1
 | 
|---|
| 135 |  ;
 | 
|---|
| 136 |  ;Check for exit
 | 
|---|
| 137 |  I $G(BPQ) G XDEV
 | 
|---|
| 138 |  ;
 | 
|---|
| 139 |  S BPSCR=$S($E($G(IOST),1,2)="C-":1,1:0)
 | 
|---|
| 140 |  I $D(IO("Q")) D  S BPQ=1
 | 
|---|
| 141 |  . S ZTRTN="RUN^BPSRPT0(BPEXCEL,BPRPTNAM,BPSUMDET)"
 | 
|---|
| 142 |  . S ZTIO=ION
 | 
|---|
| 143 |  . S ZTSAVE("*")=""
 | 
|---|
| 144 |  . S ZTDESC="BPS REPORT: "_BPRPTNAM
 | 
|---|
| 145 |  . D ^%ZTLOAD
 | 
|---|
| 146 |  . W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
 | 
|---|
| 147 |  . D HOME^%ZIS
 | 
|---|
| 148 |  U IO
 | 
|---|
| 149 | XDEV Q
 | 
|---|