PSORRP ;AITC/BWF - Remote RX report ;8/15/16 5:44pm
;;7.0;OUTPATIENT PHARMACY;**454,643**;DEC 1997;Build 35
;
EN ; -- main entry point for PSO LM REMOTE RX REPORT
N PSOREPORT
D EN^VALM("PSO LM REMOTE RX REPORT")
Q
;
HDR ; -- header code
S VALMHDR(1)=$P("Prescriptions dispensed for other Host Pharmacies^Our prescriptions, filled by other facilities as the Dispensing Pharmacy^All OneVA Pharmacy Prescription Activity","^",PSOREPORT)
Q
;
INIT ; -- init variables and list array
;F LINE=1:1:30 D SET^VALM10(LINE,LINE_" Line number "_LINE)
;S VALMCNT=30
N SBY,DONE,QUIT,SDATE,EDATE,DFN,SITEIEN,DISP,DIR,Y,%DT,DIC,DFN,SITEIEN,DISP
S VALMCNT=0
;S DIR(0)="S^1:Prescriptions dispensed for other Host Pharmacies;2:Our prescriptions, filled by other facilities as the Dispensing Pharmacy;3:All OneVA Pharmacy Prescription Activity"
;S DIR("A")="Select item" D ^DIR S PSOREPORT=Y
S DIR(0)="N^1:3:0"
S DIR("A",1)=""
S DIR("A",2)=" 1. Prescriptions dispensed for other Host Pharmacies"
S DIR("A",3)=" 2. Our prescriptions, filled by other facilities as the Dispensing Pharmacy"
S DIR("A",4)=" 3. All OneVA Pharmacy Prescription Activity"
S DIR("A",5)=""
S DIR("A")=" Select item"
S DIR("?")="Answer with 1, 2, or 3."
S DIR("?",1)=""
S DIR("?",2)="Selecting 1 will display the list of prescriptions that our local facility has"
S DIR("?",3)="dispensed on behalf of other host Pharmacy locations as part of the OneVA"
S DIR("?",4)="Pharmacy program. Selecting 2 will display the list of prescriptions other VA"
S DIR("?",5)="Pharmacy locations have filled as a dispensing site for a prescription that"
S DIR("?",6)="originated from our location. Selecting 3 will list all prescriptions that"
S DIR("?",7)="either we have filled for other Pharmacy locations as the dispensing site or"
S DIR("?",8)="other Pharmacy locations have filled on our behalf."
S DIR("?",9)=""
;S DIR("??")="^D EXTHLP^PSORRP"
;
;
D ^DIR S PSOREPORT=Y
;
I Y="^" S VALMQUIT="" Q
S DISP=Y
W " ",$S(DISP=1:"Prescriptions dispensed for other Host Pharmacies",DISP=2:"Our prescriptions, filled by other facilities as the Dispensing Pharmacy",DISP=3:"All OneVA Pharmacy Prescription Activity",1:"")
;
S DISP=$S(DISP=1:"RF^PR",DISP=2:"OR^OP",1:"RF^PR^OR^OP")
K DIR
S DIR(0)="S^D:DATE RANGE;P:PATIENT;S:SITE"
S DIR("A")="Search by"
S DIR("?")="specific patient or S for a report for a specific VA Pharmacy."
S DIR("?",1)="Answer with D for report within a specific date range or P for a report for a"
;
D ^DIR
I Y="^" S VALMQUIT="" Q
S SBY=Y
; if date range
S QUIT=0
I SBY="D" D G:QUIT INIT
.S DONE=0
.F D Q:DONE!(QUIT)
..S %DT="AQEP",%DT("A")="Enter start date: ",%DT("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,-30),1) D ^%DT
..I Y<0 S QUIT=1 Q
..I Y S SDATE=Y,DONE=1
. Q:QUIT
.S DONE=0
.F D Q:DONE!(QUIT)
..S %DT="AQEP",%DT("A")="Enter end date: ",%DT("B")=$$FMTE^XLFDT(DT,1) D ^%DT
..I Y<0 S QUIT=1 Q
..I Y S EDATE=Y,DONE=1
. Q:QUIT
.D DTRNG(SDATE,EDATE,DISP)
I SBY="P" D G:QUIT INIT
.S DIC="^DPT(",DIC(0)="QEAMZ" D ^DIC I Y<0 S QUIT=1 Q
.S DFN=+Y
.D PAT(DFN,DISP)
I SBY="S" D G:QUIT INIT
.S DIC="^DIC(4,",DIC(0)="QEAMZ" D ^DIC I Y<0 S QUIT=1 Q
.S SITEIEN=+Y
.D SITE(SITEIEN,DISP)
I 'VALMCNT,SBY="D" K DIR S DIR(0)="FO",DIR("A")="Nothing to list for this date range. Press return to continue" D ^DIR S VALMQUIT=1
I 'VALMCNT,SBY="P" K DIR S DIR(0)="FO",DIR("A")="Nothing to list for this patient. Press return to continue" D ^DIR S VALMQUIT=1
I 'VALMCNT,SBY="S" K DIR S DIR(0)="FO",DIR("A")="Nothing to list for this site. Press return to continue" D ^DIR S VALMQUIT=1
Q
INITQ ;
Q
;
HELP ; -- help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ; -- exit code
D CLEAN^VALM10
K VALMQUIT,VALMLST,VALMHDR,VALMAR,VALMBG,VALMCNT
Q
;
EXPND ; -- expand code
Q
;
DTRNG(BEG,END,FLTR) ;
N IEN,LINE,TCOST,TYPE
S (LINE,TCOST)=0
S BEG=BEG-.01,END=END_.2359
F S BEG=$O(^PSRXR(52.09,"B",BEG)) Q:'BEG!(BEG>END) D
.S IEN=0 F S IEN=$O(^PSRXR(52.09,"B",BEG,IEN)) Q:'IEN D
..S TYPE=$$GET1^DIQ(52.09,IEN,.05,"I") I FLTR'[TYPE Q
..S TCOST=$G(TCOST)+$J($$GET1^DIQ(52.09,IEN,1.2,"I"),0,2)
..S LINE=LINE+1 D BLDLINE(IEN,.LINE)
S LINE=LINE+1 D SET^VALM10(LINE,"")
S LINE=LINE+1 D SET^VALM10(LINE,"Total Cost for items in this report: $"_$J(TCOST,0,2))
Q
PAT(DFN,FLTR) ;
N IEN,LINE,TCOST,TYPE
S (LINE,TCOST)=0
S IEN=0 F S IEN=$O(^PSRXR(52.09,"C",DFN,IEN)) Q:'IEN D
.S TYPE=$$GET1^DIQ(52.09,IEN,.05,"I") I FLTR'[TYPE Q
.S TCOST=$G(TCOST)+$J($$GET1^DIQ(52.09,IEN,1.2,"I"),0,2)
.S LINE=LINE+1 D BLDLINE(IEN,.LINE)
S LINE=LINE+1 D SET^VALM10(LINE,"")
S LINE=LINE+1 D SET^VALM10(LINE,"Total Cost for items in this report: $"_$J(TCOST,0,2))
Q
SITE(SITEIEN,FLTR) ;
N IEN,LINE,TCOST,TYPE
S (LINE,TCOST)=0
S IEN=0 F S IEN=$O(^PSRXR(52.09,"E",SITEIEN,IEN)) Q:'IEN D
.S TYPE=$$GET1^DIQ(52.09,IEN,.05,"I") I FLTR'[TYPE Q
.S TCOST=$G(TCOST)+$J($$GET1^DIQ(52.09,IEN,1.2,"I"),0,2)
.S LINE=LINE+1 D BLDLINE(IEN,.LINE)
S LINE=LINE+1 D SET^VALM10(LINE,"")
S LINE=LINE+1 D SET^VALM10(LINE,"Total Cost for items in this report: $"_$J(TCOST,0,2))
Q
BLDLINE(IEN,LINE) ;
N DATE,PAT,DRUG,SITE,TYPE,QTY,DSUPP,F,IENS,DATA,IENS,LINEVAR
S IENS=IEN_","
S F=52.09
D GETS^DIQ(F,IENS,"**","IE","DATA")
S LINEVAR=""
S DATE=$P(DATA(F,IENS,.01,"E"),U)
S PAT=$G(DATA(F,IENS,.02,"E"))
S SITE=$G(DATA(F,IENS,.04,"E"))
S TYPE=$G(DATA(F,IENS,.05,"I"))
S QTY=$G(DATA(F,IENS,.07,"E"))
S DSUPP=$G(DATA(F,IENS,.08,"E"))
S DRUG=$G(DATA(F,IENS,1,"E"))
S LINEVAR=$$SETFLD^VALM1($J(LINE,2),LINEVAR,"LINENO")
S LINEVAR=$$SETFLD^VALM1(DATE,LINEVAR,"DATE")
S LINEVAR=$$SETFLD^VALM1(PAT,LINEVAR,"PATIENT")
;S LINEVAR=$$SETFLD^VALM1(SITE,LINEVAR,"SITE")
S LINEVAR=$$SETFLD^VALM1(DRUG,LINEVAR,"DRUG")
S LINEVAR=$$SETFLD^VALM1(TYPE,LINEVAR,"TYPE")
S LINEVAR=$$SETFLD^VALM1(QTY,LINEVAR,"QTY")
S LINEVAR=$$SETFLD^VALM1(DSUPP,LINEVAR,"DSUPP")
D SET^VALM10(LINE,LINEVAR,IEN)
S VALMCNT=$G(VALMCNT)+1
Q
SEL ;
N DIR,ITEM,IEN,IENS,DATA,CNT,F,ARY,SITELBL,PSOPRRF,PSOPRRT,PSOPRRS
S ARY=$NA(^TMP("PSORRD",$J))
K @ARY
S CNT=1
S F=52.09
I $P(XQORNOD(0),"=",2) S Y=+$P(XQORNOD(0),"=",2)
I '$P(XQORNOD(0),"=",2) D Q:'Y
.;S DIR(0)="N^"_VALMBG_":"_VALMLST_":0" D ^DIR Q:'Y
. S DIR(0)="N^"_1_":"_VALMCNT_":0" D ^DIR Q:'Y
S ITEM=Y,IEN=$O(@VALMAR@("IDX",ITEM,0))
Q:'IEN
S IENS=IEN_","
D GETS^DIQ(F,IENS,"**","IE","DATA")
S PSOPRRT=$G(DATA(F,IENS,.05,"I"))
S PSOPRRF=$S($E(PSOPRRT)="O":1,1:0)
I PSOPRRF S PSOPRRS=$S($E(PSOPRRT,2)="R":1,1:0)
; set up data
S @ARY@(CNT,0)="Request Date/Time: "_$G(DATA(F,IENS,.01,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Patient: "_$G(DATA(F,IENS,.02,"E")),CNT=CNT+1
S @ARY@(CNT,0)="RX #: "_$G(DATA(F,IENS,.03,"I")),CNT=CNT+1
S SITELBL=$S(PSOPRRF:"Rx Dispensed by Site: ",1:"Rx Hosted at Site: ")
S @ARY@(CNT,0)=SITELBL_$G(DATA(F,IENS,.04,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Request Type: "_$G(DATA(F,IENS,.05,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Requesting Pharmacist: "_$S('PSOPRRF:$G(DATA(F,IENS,.06,"E")),1:$G(DATA(F,IENS,.061,"E"))),CNT=CNT+1
S @ARY@(CNT,0)="Quantity: "_$G(DATA(F,IENS,.07,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Days Supply: "_$G(DATA(F,IENS,.08,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Dispensed Date: "_$G(DATA(F,IENS,.1,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Drug Name at Host site: "_$G(DATA(F,IENS,1,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Local (matched) drug: "_$G(DATA(F,IENS,1.1,"E"))_$S(PSOPRRF:"",1:" ("_$G(DATA(F,IENS,1.1,"I"))_")") S CNT=CNT+1
S @ARY@(CNT,0)="Cost of Local Refill/Partial: $"_$J($G(DATA(F,IENS,1.2,"E")),0,2),CNT=CNT+1
S @ARY@(CNT,0)="Remote Filling Person: "_$G(DATA(F,IENS,.061,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Remote Checking Pharmacist: "_$G(DATA(F,IENS,.062,"E")),CNT=CNT+1
I PSOPRRF S @ARY@(CNT,0)="Host "_$S(PSOPRRS:"Refill",1:"Partial")_" IEN: "_$S(PSOPRRS:" ",1:"")_$G(DATA(F,IENS,$S(PSOPRRS:.063,1:.064),"E")),CNT=CNT+1
S @ARY@(CNT,0)="OPAI Message ID: "_$G(DATA(F,IENS,4,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Disp ADD Name: "_$G(DATA(F,IENS,4.2,"E")),CNT=CNT+1
S @ARY@(CNT,0)="Disp ADD DNS: "_$G(DATA(F,IENS,4.3,"E"))
S PSORCNT=CNT
D ^PSORRD
K @ARY,PSORCNT
S VALMBCK="R"
Q
;
EXTHLP ;
W !,"Selecting 1 will display the list of prescriptions that our local facility has"
W !,"dispensed on behalf of other host Pharmacy locations as part of the OneVA"
W !,"Pharmacy program. Selecting 2 will display the list of prescriptions other VA"
W !,"Pharmacy locations have filled as a dispensing site for a prescription that"
W !,"originated from our location. Selecting 3 will list all prescriptions that"
W !,"either we have filled for other Pharmacy locations as the dispensing site or"
W !,"other Pharmacy locations have filled on our behalf."
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSORRP 9131 printed Dec 13, 2024@02:34:18 Page 2
PSORRP ;AITC/BWF - Remote RX report ;8/15/16 5:44pm
+1 ;;7.0;OUTPATIENT PHARMACY;**454,643**;DEC 1997;Build 35
+2 ;
EN ; -- main entry point for PSO LM REMOTE RX REPORT
+1 NEW PSOREPORT
+2 DO EN^VALM("PSO LM REMOTE RX REPORT")
+3 QUIT
+4 ;
HDR ; -- header code
+1 SET VALMHDR(1)=$PIECE("Prescriptions dispensed for other Host Pharmacies^Our prescriptions, filled by other facilities as the Dispensing Pharmacy^All OneVA Pharmacy Prescription Activity","^",PSOREPORT)
+2 QUIT
+3 ;
INIT ; -- init variables and list array
+1 ;F LINE=1:1:30 D SET^VALM10(LINE,LINE_" Line number "_LINE)
+2 ;S VALMCNT=30
+3 NEW SBY,DONE,QUIT,SDATE,EDATE,DFN,SITEIEN,DISP,DIR,Y,%DT,DIC,DFN,SITEIEN,DISP
+4 SET VALMCNT=0
+5 ;S DIR(0)="S^1:Prescriptions dispensed for other Host Pharmacies;2:Our prescriptions, filled by other facilities as the Dispensing Pharmacy;3:All OneVA Pharmacy Prescription Activity"
+6 ;S DIR("A")="Select item" D ^DIR S PSOREPORT=Y
+7 SET DIR(0)="N^1:3:0"
+8 SET DIR("A",1)=""
+9 SET DIR("A",2)=" 1. Prescriptions dispensed for other Host Pharmacies"
+10 SET DIR("A",3)=" 2. Our prescriptions, filled by other facilities as the Dispensing Pharmacy"
+11 SET DIR("A",4)=" 3. All OneVA Pharmacy Prescription Activity"
+12 SET DIR("A",5)=""
+13 SET DIR("A")=" Select item"
+14 SET DIR("?")="Answer with 1, 2, or 3."
+15 SET DIR("?",1)=""
+16 SET DIR("?",2)="Selecting 1 will display the list of prescriptions that our local facility has"
+17 SET DIR("?",3)="dispensed on behalf of other host Pharmacy locations as part of the OneVA"
+18 SET DIR("?",4)="Pharmacy program. Selecting 2 will display the list of prescriptions other VA"
+19 SET DIR("?",5)="Pharmacy locations have filled as a dispensing site for a prescription that"
+20 SET DIR("?",6)="originated from our location. Selecting 3 will list all prescriptions that"
+21 SET DIR("?",7)="either we have filled for other Pharmacy locations as the dispensing site or"
+22 SET DIR("?",8)="other Pharmacy locations have filled on our behalf."
+23 SET DIR("?",9)=""
+24 ;S DIR("??")="^D EXTHLP^PSORRP"
+25 ;
+26 ;
+27 DO ^DIR
SET PSOREPORT=Y
+28 ;
+29 IF Y="^"
SET VALMQUIT=""
QUIT
+30 SET DISP=Y
+31 WRITE " ",$SELECT(DISP=1:"Prescriptions dispensed for other Host Pharmacies",DISP=2:"Our prescriptions, filled by other facilities as the Dispensing Pharmacy",DISP=3:"All OneVA Pharmacy Prescription Activity",1:"")
+32 ;
+33 SET DISP=$SELECT(DISP=1:"RF^PR",DISP=2:"OR^OP",1:"RF^PR^OR^OP")
+34 KILL DIR
+35 SET DIR(0)="S^D:DATE RANGE;P:PATIENT;S:SITE"
+36 SET DIR("A")="Search by"
+37 SET DIR("?")="specific patient or S for a report for a specific VA Pharmacy."
+38 SET DIR("?",1)="Answer with D for report within a specific date range or P for a report for a"
+39 ;
+40 DO ^DIR
+41 IF Y="^"
SET VALMQUIT=""
QUIT
+42 SET SBY=Y
+43 ; if date range
+44 SET QUIT=0
+45 IF SBY="D"
Begin DoDot:1
+46 SET DONE=0
+47 FOR
Begin DoDot:2
+48 SET %DT="AQEP"
SET %DT("A")="Enter start date: "
SET %DT("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,-30),1)
DO ^%DT
+49 IF Y<0
SET QUIT=1
QUIT
+50 IF Y
SET SDATE=Y
SET DONE=1
End DoDot:2
if DONE!(QUIT)
QUIT
+51 if QUIT
QUIT
+52 SET DONE=0
+53 FOR
Begin DoDot:2
+54 SET %DT="AQEP"
SET %DT("A")="Enter end date: "
SET %DT("B")=$$FMTE^XLFDT(DT,1)
DO ^%DT
+55 IF Y<0
SET QUIT=1
QUIT
+56 IF Y
SET EDATE=Y
SET DONE=1
End DoDot:2
if DONE!(QUIT)
QUIT
+57 if QUIT
QUIT
+58 DO DTRNG(SDATE,EDATE,DISP)
End DoDot:1
if QUIT
GOTO INIT
+59 IF SBY="P"
Begin DoDot:1
+60 SET DIC="^DPT("
SET DIC(0)="QEAMZ"
DO ^DIC
IF Y<0
SET QUIT=1
QUIT
+61 SET DFN=+Y
+62 DO PAT(DFN,DISP)
End DoDot:1
if QUIT
GOTO INIT
+63 IF SBY="S"
Begin DoDot:1
+64 SET DIC="^DIC(4,"
SET DIC(0)="QEAMZ"
DO ^DIC
IF Y<0
SET QUIT=1
QUIT
+65 SET SITEIEN=+Y
+66 DO SITE(SITEIEN,DISP)
End DoDot:1
if QUIT
GOTO INIT
+67 IF 'VALMCNT
IF SBY="D"
KILL DIR
SET DIR(0)="FO"
SET DIR("A")="Nothing to list for this date range. Press return to continue"
DO ^DIR
SET VALMQUIT=1
+68 IF 'VALMCNT
IF SBY="P"
KILL DIR
SET DIR(0)="FO"
SET DIR("A")="Nothing to list for this patient. Press return to continue"
DO ^DIR
SET VALMQUIT=1
+69 IF 'VALMCNT
IF SBY="S"
KILL DIR
SET DIR(0)="FO"
SET DIR("A")="Nothing to list for this site. Press return to continue"
DO ^DIR
SET VALMQUIT=1
+70 QUIT
INITQ ;
+1 QUIT
+2 ;
HELP ; -- help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ; -- exit code
+1 DO CLEAN^VALM10
+2 KILL VALMQUIT,VALMLST,VALMHDR,VALMAR,VALMBG,VALMCNT
+3 QUIT
+4 ;
EXPND ; -- expand code
+1 QUIT
+2 ;
DTRNG(BEG,END,FLTR) ;
+1 NEW IEN,LINE,TCOST,TYPE
+2 SET (LINE,TCOST)=0
+3 SET BEG=BEG-.01
SET END=END_.2359
+4 FOR
SET BEG=$ORDER(^PSRXR(52.09,"B",BEG))
if 'BEG!(BEG>END)
QUIT
Begin DoDot:1
+5 SET IEN=0
FOR
SET IEN=$ORDER(^PSRXR(52.09,"B",BEG,IEN))
if 'IEN
QUIT
Begin DoDot:2
+6 SET TYPE=$$GET1^DIQ(52.09,IEN,.05,"I")
IF FLTR'[TYPE
QUIT
+7 SET TCOST=$GET(TCOST)+$JUSTIFY($$GET1^DIQ(52.09,IEN,1.2,"I"),0,2)
+8 SET LINE=LINE+1
DO BLDLINE(IEN,.LINE)
End DoDot:2
End DoDot:1
+9 SET LINE=LINE+1
DO SET^VALM10(LINE,"")
+10 SET LINE=LINE+1
DO SET^VALM10(LINE,"Total Cost for items in this report: $"_$JUSTIFY(TCOST,0,2))
+11 QUIT
PAT(DFN,FLTR) ;
+1 NEW IEN,LINE,TCOST,TYPE
+2 SET (LINE,TCOST)=0
+3 SET IEN=0
FOR
SET IEN=$ORDER(^PSRXR(52.09,"C",DFN,IEN))
if 'IEN
QUIT
Begin DoDot:1
+4 SET TYPE=$$GET1^DIQ(52.09,IEN,.05,"I")
IF FLTR'[TYPE
QUIT
+5 SET TCOST=$GET(TCOST)+$JUSTIFY($$GET1^DIQ(52.09,IEN,1.2,"I"),0,2)
+6 SET LINE=LINE+1
DO BLDLINE(IEN,.LINE)
End DoDot:1
+7 SET LINE=LINE+1
DO SET^VALM10(LINE,"")
+8 SET LINE=LINE+1
DO SET^VALM10(LINE,"Total Cost for items in this report: $"_$JUSTIFY(TCOST,0,2))
+9 QUIT
SITE(SITEIEN,FLTR) ;
+1 NEW IEN,LINE,TCOST,TYPE
+2 SET (LINE,TCOST)=0
+3 SET IEN=0
FOR
SET IEN=$ORDER(^PSRXR(52.09,"E",SITEIEN,IEN))
if 'IEN
QUIT
Begin DoDot:1
+4 SET TYPE=$$GET1^DIQ(52.09,IEN,.05,"I")
IF FLTR'[TYPE
QUIT
+5 SET TCOST=$GET(TCOST)+$JUSTIFY($$GET1^DIQ(52.09,IEN,1.2,"I"),0,2)
+6 SET LINE=LINE+1
DO BLDLINE(IEN,.LINE)
End DoDot:1
+7 SET LINE=LINE+1
DO SET^VALM10(LINE,"")
+8 SET LINE=LINE+1
DO SET^VALM10(LINE,"Total Cost for items in this report: $"_$JUSTIFY(TCOST,0,2))
+9 QUIT
BLDLINE(IEN,LINE) ;
+1 NEW DATE,PAT,DRUG,SITE,TYPE,QTY,DSUPP,F,IENS,DATA,IENS,LINEVAR
+2 SET IENS=IEN_","
+3 SET F=52.09
+4 DO GETS^DIQ(F,IENS,"**","IE","DATA")
+5 SET LINEVAR=""
+6 SET DATE=$PIECE(DATA(F,IENS,.01,"E"),U)
+7 SET PAT=$GET(DATA(F,IENS,.02,"E"))
+8 SET SITE=$GET(DATA(F,IENS,.04,"E"))
+9 SET TYPE=$GET(DATA(F,IENS,.05,"I"))
+10 SET QTY=$GET(DATA(F,IENS,.07,"E"))
+11 SET DSUPP=$GET(DATA(F,IENS,.08,"E"))
+12 SET DRUG=$GET(DATA(F,IENS,1,"E"))
+13 SET LINEVAR=$$SETFLD^VALM1($JUSTIFY(LINE,2),LINEVAR,"LINENO")
+14 SET LINEVAR=$$SETFLD^VALM1(DATE,LINEVAR,"DATE")
+15 SET LINEVAR=$$SETFLD^VALM1(PAT,LINEVAR,"PATIENT")
+16 ;S LINEVAR=$$SETFLD^VALM1(SITE,LINEVAR,"SITE")
+17 SET LINEVAR=$$SETFLD^VALM1(DRUG,LINEVAR,"DRUG")
+18 SET LINEVAR=$$SETFLD^VALM1(TYPE,LINEVAR,"TYPE")
+19 SET LINEVAR=$$SETFLD^VALM1(QTY,LINEVAR,"QTY")
+20 SET LINEVAR=$$SETFLD^VALM1(DSUPP,LINEVAR,"DSUPP")
+21 DO SET^VALM10(LINE,LINEVAR,IEN)
+22 SET VALMCNT=$GET(VALMCNT)+1
+23 QUIT
SEL ;
+1 NEW DIR,ITEM,IEN,IENS,DATA,CNT,F,ARY,SITELBL,PSOPRRF,PSOPRRT,PSOPRRS
+2 SET ARY=$NAME(^TMP("PSORRD",$JOB))
+3 KILL @ARY
+4 SET CNT=1
+5 SET F=52.09
+6 IF $PIECE(XQORNOD(0),"=",2)
SET Y=+$PIECE(XQORNOD(0),"=",2)
+7 IF '$PIECE(XQORNOD(0),"=",2)
Begin DoDot:1
+8 ;S DIR(0)="N^"_VALMBG_":"_VALMLST_":0" D ^DIR Q:'Y
+9 SET DIR(0)="N^"_1_":"_VALMCNT_":0"
DO ^DIR
if 'Y
QUIT
End DoDot:1
if 'Y
QUIT
+10 SET ITEM=Y
SET IEN=$ORDER(@VALMAR@("IDX",ITEM,0))
+11 if 'IEN
QUIT
+12 SET IENS=IEN_","
+13 DO GETS^DIQ(F,IENS,"**","IE","DATA")
+14 SET PSOPRRT=$GET(DATA(F,IENS,.05,"I"))
+15 SET PSOPRRF=$SELECT($EXTRACT(PSOPRRT)="O":1,1:0)
+16 IF PSOPRRF
SET PSOPRRS=$SELECT($EXTRACT(PSOPRRT,2)="R":1,1:0)
+17 ; set up data
+18 SET @ARY@(CNT,0)="Request Date/Time: "_$GET(DATA(F,IENS,.01,"E"))
SET CNT=CNT+1
+19 SET @ARY@(CNT,0)="Patient: "_$GET(DATA(F,IENS,.02,"E"))
SET CNT=CNT+1
+20 SET @ARY@(CNT,0)="RX #: "_$GET(DATA(F,IENS,.03,"I"))
SET CNT=CNT+1
+21 SET SITELBL=$SELECT(PSOPRRF:"Rx Dispensed by Site: ",1:"Rx Hosted at Site: ")
+22 SET @ARY@(CNT,0)=SITELBL_$GET(DATA(F,IENS,.04,"E"))
SET CNT=CNT+1
+23 SET @ARY@(CNT,0)="Request Type: "_$GET(DATA(F,IENS,.05,"E"))
SET CNT=CNT+1
+24 SET @ARY@(CNT,0)="Requesting Pharmacist: "_$SELECT('PSOPRRF:$GET(DATA(F,IENS,.06,"E")),1:$GET(DATA(F,IENS,.061,"E")))
SET CNT=CNT+1
+25 SET @ARY@(CNT,0)="Quantity: "_$GET(DATA(F,IENS,.07,"E"))
SET CNT=CNT+1
+26 SET @ARY@(CNT,0)="Days Supply: "_$GET(DATA(F,IENS,.08,"E"))
SET CNT=CNT+1
+27 SET @ARY@(CNT,0)="Dispensed Date: "_$GET(DATA(F,IENS,.1,"E"))
SET CNT=CNT+1
+28 SET @ARY@(CNT,0)="Drug Name at Host site: "_$GET(DATA(F,IENS,1,"E"))
SET CNT=CNT+1
+29 SET @ARY@(CNT,0)="Local (matched) drug: "_$GET(DATA(F,IENS,1.1,"E"))_$SELECT(PSOPRRF:"",1:" ("_$GET(DATA(F,IENS,1.1,"I"))_")")
SET CNT=CNT+1
+30 SET @ARY@(CNT,0)="Cost of Local Refill/Partial: $"_$JUSTIFY($GET(DATA(F,IENS,1.2,"E")),0,2)
SET CNT=CNT+1
+31 SET @ARY@(CNT,0)="Remote Filling Person: "_$GET(DATA(F,IENS,.061,"E"))
SET CNT=CNT+1
+32 SET @ARY@(CNT,0)="Remote Checking Pharmacist: "_$GET(DATA(F,IENS,.062,"E"))
SET CNT=CNT+1
+33 IF PSOPRRF
SET @ARY@(CNT,0)="Host "_$SELECT(PSOPRRS:"Refill",1:"Partial")_" IEN: "_$SELECT(PSOPRRS:" ",1:"")_$GET(DATA(F,IENS,$SELECT(PSOPRRS:.063,1:.064),"E"))
SET CNT=CNT+1
+34 SET @ARY@(CNT,0)="OPAI Message ID: "_$GET(DATA(F,IENS,4,"E"))
SET CNT=CNT+1
+35 SET @ARY@(CNT,0)="Disp ADD Name: "_$GET(DATA(F,IENS,4.2,"E"))
SET CNT=CNT+1
+36 SET @ARY@(CNT,0)="Disp ADD DNS: "_$GET(DATA(F,IENS,4.3,"E"))
+37 SET PSORCNT=CNT
+38 DO ^PSORRD
+39 KILL @ARY,PSORCNT
+40 SET VALMBCK="R"
+41 QUIT
+42 ;
EXTHLP ;
+1 WRITE !,"Selecting 1 will display the list of prescriptions that our local facility has"
+2 WRITE !,"dispensed on behalf of other host Pharmacy locations as part of the OneVA"
+3 WRITE !,"Pharmacy program. Selecting 2 will display the list of prescriptions other VA"
+4 WRITE !,"Pharmacy locations have filled as a dispensing site for a prescription that"
+5 WRITE !,"originated from our location. Selecting 3 will list all prescriptions that"
+6 WRITE !,"either we have filled for other Pharmacy locations as the dispensing site or"
+7 WRITE !,"other Pharmacy locations have filled on our behalf."
+8 QUIT