| 1 | BPSRPT3 ;BHAM ISC/BEE - ECME REPORTS ;14-FEB-05
 | 
|---|
| 2 |  ;;1.0;E CLAIMS MGMT ENGINE;**1,3,5**;JUN 2004;Build 45
 | 
|---|
| 3 |  ;;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  Q
 | 
|---|
| 6 |  ;
 | 
|---|
| 7 |  ; Select the ECME Pharmacy or Pharmacies
 | 
|---|
| 8 |  ; 
 | 
|---|
| 9 |  ; Input Variable -> none
 | 
|---|
| 10 |  ; Return Value ->   "" = Valid Entry or Entries Selected
 | 
|---|
| 11 |  ;                                        ^ = Exit
 | 
|---|
| 12 |  ;                                       
 | 
|---|
| 13 |  ; Output Variable -> BPPHARM = 1 One or More Pharmacies Selected
 | 
|---|
| 14 |  ;                          = 0 User Entered 'ALL'
 | 
|---|
| 15 |  ;                            
 | 
|---|
| 16 |  ; If BPPHARM = 1 then the BPPHARM array will be defined where:
 | 
|---|
| 17 |  ;    BPPHARM(ptr) = ptr ^ BPS PHARMACY NAME and
 | 
|---|
| 18 |  ;    ptr = Internal Pointer to BPS PHARMACIES file (#9002313.56)
 | 
|---|
| 19 |  ;                    
 | 
|---|
| 20 | SELPHARM() N DIC,DIR,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 |  ;Reset BPPHARM array
 | 
|---|
| 23 |  K BPPHARM
 | 
|---|
| 24 |  ;
 | 
|---|
| 25 |  ;First see if they want to enter individual divisions or ALL
 | 
|---|
| 26 |  S DIR(0)="S^D:DIVISION;A:ALL"
 | 
|---|
| 27 |  S DIR("A")="Select Certain Pharmacy (D)ivisions or (A)LL"
 | 
|---|
| 28 |  S DIR("L",1)="Select one of the following:"
 | 
|---|
| 29 |  S DIR("L",2)=""
 | 
|---|
| 30 |  S DIR("L",3)="     D         DIVISION"
 | 
|---|
| 31 |  S DIR("L",4)="     A         ALL"
 | 
|---|
| 32 |  D ^DIR K DIR
 | 
|---|
| 33 |  ;
 | 
|---|
| 34 |  ;Check for "^" or timeout, otherwise define BPPHARM
 | 
|---|
| 35 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
 | 
|---|
| 36 |  E  S BPPHARM=$S(Y="A":0,1:1)
 | 
|---|
| 37 |  ;
 | 
|---|
| 38 |  ;If division selected, ask prompt
 | 
|---|
| 39 |  I $G(BPPHARM)=1 F  D  Q:Y="^"!(Y="") 
 | 
|---|
| 40 |  .;
 | 
|---|
| 41 |  .;Prompt for entry
 | 
|---|
| 42 |  .K X S DIC(0)="QEAM",DIC=9002313.56,DIC("A")="Select ECME Pharmacy Division(s): "
 | 
|---|
| 43 |  .W ! D ^DIC
 | 
|---|
| 44 |  .;
 | 
|---|
| 45 |  .;Check for "^" or timeout 
 | 
|---|
| 46 |  .I ($G(DUOUT)=1)!($G(DTOUT)=1) K BPPHARM S Y="^" Q
 | 
|---|
| 47 |  .;
 | 
|---|
| 48 |  .;Check for blank entry, quit if no previous selections
 | 
|---|
| 49 |  .I $G(X)="" S Y=$S($D(BPPHARM)>9:"",1:"^") K:Y="^" BPPHARM Q
 | 
|---|
| 50 |  .;
 | 
|---|
| 51 |  .;Handle Deletes
 | 
|---|
| 52 |  .I $D(BPPHARM(+Y)) D  Q:Y="^"  I 1
 | 
|---|
| 53 |  ..N P
 | 
|---|
| 54 |  ..S P=Y  ;Save Original Value
 | 
|---|
| 55 |  ..S DIR(0)="S^Y:YES;N:NO",DIR("A")="Delete "_$P(P,U,2)_" from your list?"
 | 
|---|
| 56 |  ..S DIR("B")="NO" D ^DIR
 | 
|---|
| 57 |  ..I ($G(DUOUT)=1)!($G(DTOUT)=1) K BPPHARM S Y="^" Q
 | 
|---|
| 58 |  ..I Y="Y" K BPPHARM(+P),BPPHARM("B",$P(P,U,2),+P)
 | 
|---|
| 59 |  ..S Y=P  ;Restore Original Value
 | 
|---|
| 60 |  ..K P
 | 
|---|
| 61 |  .E  D
 | 
|---|
| 62 |  ..;Define new entries in BPPHARM array
 | 
|---|
| 63 |  ..S BPPHARM(+Y)=Y
 | 
|---|
| 64 |  ..S BPPHARM("B",$P(Y,U,2),+Y)=""
 | 
|---|
| 65 |  .;
 | 
|---|
| 66 |  .;Display a list of selected divisions
 | 
|---|
| 67 |  .I $D(BPPHARM)>9 D
 | 
|---|
| 68 |  ..N X
 | 
|---|
| 69 |  ..W !,?2,"Selected:"
 | 
|---|
| 70 |  ..S X="" F  S X=$O(BPPHARM("B",X)) Q:X=""  W !,?10,X
 | 
|---|
| 71 |  ..K X
 | 
|---|
| 72 |  .Q
 | 
|---|
| 73 |  ;
 | 
|---|
| 74 |  K BPPHARM("B")
 | 
|---|
| 75 |  Q Y
 | 
|---|
| 76 |  ;
 | 
|---|
| 77 |  ; Display (S)ummary or (D)etail Format
 | 
|---|
| 78 |  ; 
 | 
|---|
| 79 |  ; Input Variable -> DFLT = 1 Summary
 | 
|---|
| 80 |  ;                          2 Detail
 | 
|---|
| 81 |  ;                          
 | 
|---|
| 82 |  ; Return Value ->   1 = Summary
 | 
|---|
| 83 |  ;                   0 = Detail
 | 
|---|
| 84 |  ;                   ^ = Exit
 | 
|---|
| 85 |  ;
 | 
|---|
| 86 | SELSMDET(DFLT) N DIR,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 87 |  S DFLT=$S($G(DFLT)=1:"Summary",$G(DFLT)=0:"Detail",1:"Detail")
 | 
|---|
| 88 |  S DIR(0)="S^S:Summary;D:Detail",DIR("A")="Display (S)ummary or (D)etail Format",DIR("B")=DFLT
 | 
|---|
| 89 |  D ^DIR
 | 
|---|
| 90 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
 | 
|---|
| 91 |  S Y=$S(Y="S":1,Y="D":0,1:Y)
 | 
|---|
| 92 |  Q Y
 | 
|---|
| 93 |  ;
 | 
|---|
| 94 |  ; Select to Display Single (I)nsurance Company or (A)ll
 | 
|---|
| 95 |  ;
 | 
|---|
| 96 |  ; Input Variable -> DFLT = 1 Single Insurance
 | 
|---|
| 97 |  ;                          0 All Insurance
 | 
|---|
| 98 |  ;                          
 | 
|---|
| 99 |  ; Return Value ->   ptr to #36^Insurance Company Name
 | 
|---|
| 100 |  ;                     0 = All Insurances
 | 
|---|
| 101 |  ;                     ^ = Exit
 | 
|---|
| 102 |  ;
 | 
|---|
| 103 | SELINSIN(DFLT) N DIC,DIR,DIRUT,DUOUT,INS,X,Y
 | 
|---|
| 104 |  ;
 | 
|---|
| 105 |  S DFLT=$S($G(DFLT)=1:"Single Insurance",1:"ALL")
 | 
|---|
| 106 |  S DIR(0)="S^I:Single Insurance;A:ALL"
 | 
|---|
| 107 |  S DIR("A")="Display Single (I)nsurance Company or (A)LL",DIR("B")=DFLT
 | 
|---|
| 108 |  D ^DIR
 | 
|---|
| 109 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
 | 
|---|
| 110 |  S INS=$S(Y="I":1,Y="A":0,1:Y)
 | 
|---|
| 111 |  ;
 | 
|---|
| 112 |  ;Check for "^" or timeout, otherwise define INS
 | 
|---|
| 113 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S (INS,Y)="^"
 | 
|---|
| 114 |  ;
 | 
|---|
| 115 |  ;If single insurance selected, ask prompt
 | 
|---|
| 116 |  I $G(INS)=1 D
 | 
|---|
| 117 |  .;
 | 
|---|
| 118 |  .;Prompt for entry
 | 
|---|
| 119 |  .W ! S Y=$$SELINS^BPSRPT6()
 | 
|---|
| 120 |  .;
 | 
|---|
| 121 |  .;Check for "^", timeout, or blank entry
 | 
|---|
| 122 |  .I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S (INS,Y)="^" Q
 | 
|---|
| 123 |  .;
 | 
|---|
| 124 |  .;If valid entry, setup INS
 | 
|---|
| 125 |  .I Y'="^" S INS=Y
 | 
|---|
| 126 |  ;
 | 
|---|
| 127 |  Q INS
 | 
|---|
| 128 |  ;
 | 
|---|
| 129 |  ; Display (C)MOP or (M)ail or (W)indow or (A)ll
 | 
|---|
| 130 |  ; 
 | 
|---|
| 131 |  ;    Input Variable -> DFLT = C CMOP
 | 
|---|
| 132 |  ;                             W Window
 | 
|---|
| 133 |  ;                             M Mail
 | 
|---|
| 134 |  ;                             A All
 | 
|---|
| 135 |  ;                          
 | 
|---|
| 136 |  ;    Return Value ->   C = CMOP
 | 
|---|
| 137 |  ;                      W = Window
 | 
|---|
| 138 |  ;                      M = Mail
 | 
|---|
| 139 |  ;                      A = All
 | 
|---|
| 140 |  ;                      ^ = Exit
 | 
|---|
| 141 |  ; 
 | 
|---|
| 142 | SELMWC(DFLT) N DIR,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 143 |  S DFLT=$S($G(DFLT)="C":"CMOP",$G(DFLT)="W":"Window",$G(DFLT)="M":"Mail",1:"ALL")
 | 
|---|
| 144 |  S DIR(0)="S^C:CMOP;M:Mail;W:Window;A:ALL"
 | 
|---|
| 145 |  S DIR("A")="Display (C)MOP or (M)ail or (W)indow or (A)LL",DIR("B")=DFLT
 | 
|---|
| 146 |  D ^DIR
 | 
|---|
| 147 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
 | 
|---|
| 148 |  Q Y
 | 
|---|
| 149 |  ;
 | 
|---|
| 150 |  ; Display (R)ealTime Fills or (B)ackbills or (A)LL
 | 
|---|
| 151 |  ;
 | 
|---|
| 152 |  ;    Input Variable -> DFLT = 3 Backbill
 | 
|---|
| 153 |  ;                             2 Real Time Fills
 | 
|---|
| 154 |  ;                             1 ALL
 | 
|---|
| 155 |  ;                          
 | 
|---|
| 156 |  ;    Return Value ->   3 = Backbill (manually)
 | 
|---|
| 157 |  ;                      2 = Real Time Fills (automatically during FINISH)
 | 
|---|
| 158 |  ;                      1 = ALL
 | 
|---|
| 159 |  ;                      ^ = Exit
 | 
|---|
| 160 |  ;
 | 
|---|
| 161 | SELRTBCK(DFLT) N DIR,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 162 |  S DFLT=$S($G(DFLT)=2:"Real Time",$G(DFLT)=3:"Backbill",1:"ALL")
 | 
|---|
| 163 |  S DIR(0)="S^R:Real Time Fills;B:Backbill;A:ALL"
 | 
|---|
| 164 |  S DIR("A")="Display (R)ealTime Fills or (B)ackbills or (A)LL",DIR("B")=DFLT
 | 
|---|
| 165 |  D ^DIR
 | 
|---|
| 166 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
 | 
|---|
| 167 |  S Y=$S(Y="A":1,Y="R":2,Y="B":3,1:Y)
 | 
|---|
| 168 |  Q Y
 | 
|---|
| 169 |  ;
 | 
|---|
| 170 |  ; Display Specific (D)rug or Drug (C)lass
 | 
|---|
| 171 |  ; 
 | 
|---|
| 172 |  ;    Input Variable -> DFLT = 3 Drug Class
 | 
|---|
| 173 |  ;                             2 Drug
 | 
|---|
| 174 |  ;                             1 ALL
 | 
|---|
| 175 |  ;                          
 | 
|---|
| 176 |  ;     Return Value ->   3 = Drug Class
 | 
|---|
| 177 |  ;                       2 = Drug
 | 
|---|
| 178 |  ;                       1 = ALL
 | 
|---|
| 179 |  ;                       ^ = Exit
 | 
|---|
| 180 |  ;                       
 | 
|---|
| 181 | SELDRGAL(DFLT) N DIR,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 182 |  S DFLT=$S($G(DFLT)=2:"Drug",$G(DFLT)=3:"Drug Class",1:"ALL")
 | 
|---|
| 183 |  S DIR(0)="S^D:Drug;C:Drug Class;A:ALL"
 | 
|---|
| 184 |  S DIR("A")="Display Specific (D)rug or Drug (C)lass or (A)LL",DIR("B")=DFLT
 | 
|---|
| 185 |  D ^DIR
 | 
|---|
| 186 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
 | 
|---|
| 187 |  S Y=$S(Y="A":1,Y="D":2,Y="C":3,1:Y)
 | 
|---|
| 188 |  Q Y
 | 
|---|
| 189 |  ;
 | 
|---|
| 190 |  ; Select Drug
 | 
|---|
| 191 |  ; 
 | 
|---|
| 192 |  ; Input Variable -> none
 | 
|---|
| 193 |  ; 
 | 
|---|
| 194 |  ; Return Value -> ptr = pointer to DRUG file (#50)
 | 
|---|
| 195 |  ;                   ^ = Exit
 | 
|---|
| 196 |  ;                   
 | 
|---|
| 197 | SELDRG() N DIC,DIRUT,DUOUT,X,Y
 | 
|---|
| 198 |  ;
 | 
|---|
| 199 |  ;Prompt for entry
 | 
|---|
| 200 |  W ! D SELDRG^BPSRPT6
 | 
|---|
| 201 |  ;
 | 
|---|
| 202 |  ;Check for "^", timeout, or blank entry
 | 
|---|
| 203 |  I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
 | 
|---|
| 204 |  ;
 | 
|---|
| 205 |  ;Check for Valid Entry
 | 
|---|
| 206 |  I +Y>0 S Y=+Y
 | 
|---|
| 207 |  ;
 | 
|---|
| 208 |  Q Y
 | 
|---|
| 209 |  ;
 | 
|---|
| 210 |  ; Select Drug Class
 | 
|---|
| 211 |  ; 
 | 
|---|
| 212 |  ; Input Variable -> none
 | 
|---|
| 213 |  ; 
 | 
|---|
| 214 |  ; Return Value -> ptr = pointer to VA DRUG CLASS file (#50.605)
 | 
|---|
| 215 |  ;                   ^ = Exit
 | 
|---|
| 216 |  ;
 | 
|---|
| 217 | SELDRGCL() N DIC,DIRUT,DUOUT,Y
 | 
|---|
| 218 |  ;
 | 
|---|
| 219 |  ;Prompt for entry
 | 
|---|
| 220 |  W ! D SELDRGC^BPSRPT6
 | 
|---|
| 221 |  ;
 | 
|---|
| 222 |  ;Check for "^", timeout, or blank entry
 | 
|---|
| 223 |  I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(Y)="") S Y="^"
 | 
|---|
| 224 |  ;
 | 
|---|
| 225 |  Q Y
 | 
|---|
| 226 |  ;
 | 
|---|
| 227 |  ; Enter Date Range
 | 
|---|
| 228 |  ;
 | 
|---|
| 229 |  ; Input Variable -> TYPE = 7 CLOSE REPORT
 | 
|---|
| 230 |  ;                          1-6 OTHER REPORTS
 | 
|---|
| 231 |  ;
 | 
|---|
| 232 |  ; Return Value -> P1^P2
 | 
|---|
| 233 |  ; 
 | 
|---|
| 234 |  ;           where P1 = From Date
 | 
|---|
| 235 |  ;                    = ^ Exit
 | 
|---|
| 236 |  ;                 P2 = To Date
 | 
|---|
| 237 |  ;                    = blank for Exit
 | 
|---|
| 238 |  ;                 
 | 
|---|
| 239 | SELDATE(TYPE) N BPSIBDT,DIR,DIRUT,DTOUT,DUOUT,VAL,X,Y
 | 
|---|
| 240 |  S TYPE=$S($G(TYPE)=7:"CLOSE",1:"TRANSACTION")
 | 
|---|
| 241 | SELDATE1 S VAL="",DIR(0)="DA^:DT:EX",DIR("A")="START WITH "_TYPE_" DATE: ",DIR("B")="T-1"
 | 
|---|
| 242 |  W ! D ^DIR
 | 
|---|
| 243 |  ;
 | 
|---|
| 244 |  ;Check for "^", timeout, or blank entry
 | 
|---|
| 245 |  I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S VAL="^"
 | 
|---|
| 246 |  ;
 | 
|---|
| 247 |  I VAL="" D
 | 
|---|
| 248 |  .S $P(VAL,U)=Y
 | 
|---|
| 249 |  .S DIR(0)="DA^"_VAL_":DT:EX",DIR("A")="  GO TO "_TYPE_" DATE: ",DIR("B")="T"
 | 
|---|
| 250 |  .D ^DIR
 | 
|---|
| 251 |  .;
 | 
|---|
| 252 |  .;Check for "^", timeout, or blank entry
 | 
|---|
| 253 |  .I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S VAL="^" Q
 | 
|---|
| 254 |  .;
 | 
|---|
| 255 |  .;Define Entry
 | 
|---|
| 256 |  .S $P(VAL,U,2)=Y
 | 
|---|
| 257 |  ;
 | 
|---|
| 258 |  Q VAL
 | 
|---|