APSPSWKL ; IHS/MSC/PLS - PHARMACY STAFF WORKLOAD REPORT ;11-Jul-2012 17:31;PLS
;;7.0;IHS PHARMACY MODIFICATIONS;**1013,1015**;Sep 23, 2004;Build 62
;
EN ;EP
N AOSOQ,APSPBDF,APSPEDF,APSPDIV,APSPNUM,APSPUSR,APSPNAME,APSPCNT
N APSPTOT,APSPTYP,APSPCLAS,APSPBD,APSPED,APSPDARY,APSPQ,QFLG
K ^TMP("APSPW",$J)
S APSPDIV="",APSPQ=0,APSPCNT=0,APSPTYP=0,APSPUSR=""
S APSPTOT=0_U_0_U_0 ;Total new orders ^ total refills ^ grand total
W @IOF
W !!,"Pharmacy Staff Workload Report"
D ASKDATES^APSPUTIL(.APSPBD,.APSPED,.APSPQ,DT,DT)
Q:APSPQ
S APSPBDF=$P($TR($$FMTE^XLFDT(APSPBD,"5Z"),"@"," "),":",1,2)
S APSPEDF=$P($TR($$FMTE^XLFDT(APSPED,"5Z"),"@"," "),":",1,2)
S APSPBD=APSPBD-.01,APSPED=APSPED+.99
S APSPDIV=$$DIR^APSPUTIL("Y","Would you like all pharmacy divisions","Yes",,.APSPQ)
Q:APSPQ
I APSPDIV D
.S APSPDIV="*"
E D Q:APSPQ
.S APSPDIV=$$GETIEN^APSPUTIL(59,"Select Pharmacy Division: ",.APSPQ)
Q:APSPQ
S APSPNUM=$$DIR^APSPUTIL("S^I:Individual Pharmacy user;A:All Pharmacy users","Lookup Individual User or List ALL Users? ","A",,.APSPQ)
I APSPNUM="A" S APSPDARY="*"
I APSPNUM="I" D
.F D Q:QFLG
..S APSPUSR=$$GETIEN1^APSPUTIL(200,"Select Pharmacy User: ",-1,"B")
..I APSPUSR<1 S QFLG=1 Q
..S APSPCLAS=$$GET1^DIQ(200,APSPUSR,53.5)
..S APSPNAME=$$GET1^DIQ(200,APSPUSR,.01)
..I APSPCLAS="PHARMACIST"!(APSPCLAS="PHARMACY TECHNICIAN")!(APSPCLAS="PHARMCY PRACTITIONER")!(APSPCLAS="CLINICAL PHARMACY SPECIALIST") D
...S APSPDARY(APSPUSR)=APSPNAME
...S APSPCNT=APSPCNT+1
..E D
...W !,APSPNAME_" is not a pharmacy user."
..S QFLG='$$DIRYN^APSPUTIL("Want to Select Another User","No","Enter a 'Y' or 'YES' to include more pharmacy users in your search",.APSPQ)
..S:'QFLG QFLG=APSPQ
Q:APSPQ
D DEV
Q
DEV ;
N XBRP,XBNS
S XBRP="OUT^APSPSWKL"
S XBNS="APS*"
D ^XBDBQUE
Q
OUT ;EP
U IO
K ^TMP($J)
D FIND(APSPBD,APSPED,"AD") ; Regular and Refill
D PRINT
K ^TMP("APSPW",$J)
Q
;
FIND(SDT,EDT,XREF) ;EP
N RXIEN,ACTIEN,RTSDT,FILLDT,A0,FDTLP,IEN,PHARM
S FDTLP=SDT-.01
F S FDTLP=$O(^PSRX(XREF,FDTLP)) Q:'FDTLP!(FDTLP>EDT) D
.S RXIEN=0
.F S RXIEN=$O(^PSRX(XREF,FDTLP,RXIEN)) Q:'RXIEN D
..Q:'$P(^PSRX(RXIEN,0),U,6) ; Prescription must have a drug
..Q:$$GET1^DIQ(52,RXIEN,100,"I")=13 ; Quit if Deleted status
..;Removed check for POE Patch 1015
..;Q:$$GET1^DIQ(52,RXIEN,111,"I")'=1 ; Quit if not POE entered RX
..S IEN="" F S IEN=$O(^PSRX(XREF,FDTLP,RXIEN,IEN)) Q:IEN="" D
...Q:'IEN&($$GET1^DIQ(52,RXIEN,32.1,"I")) ; Quit if original fill and a return to stock date exists
...Q:'$$DIVVRY(RXIEN,APSPDIV,XREF,IEN) ;check division
...Q:'$$DSPRDT(RXIEN,XREF,IEN) ;check for release date
...I IEN=0 D NEW(RXIEN,IEN)
...I IEN>0 D REFILL(RXIEN,IEN)
Q
;
NEW(RXIEN,IEN) ;Find new prescriptions
N PHARM
S PHARM=$P($G(^PSRX(RXIEN,2)),U,3)
I APSPNUM="A" D SETNEW(PHARM)
I APSPNUM="I" D
.I $D(APSPDARY(PHARM)) D SETNEW(PHARM)
Q
SETNEW(PHARM) ;Set the pharmacist data
N PHARNAME,GT,RT,NT,NP,RP,TP,DATA
I +PHARM>0 S PHARNAME=$$GET1^DIQ(200,PHARM,.01)
E S PHARNAME="UNKNOWN"
I $D(^TMP("APSPW",$J,PHARNAME)) D
.S DATA=$G(^TMP("APSPW",$J,PHARNAME))
.S NP=$P(DATA,U,1),RP=$P(DATA,U,2),TP=$P(DATA,U,3)
.S NP=NP+1,TP=TP+1
.S ^TMP("APSPW",$J,PHARNAME)=NP_U_RP_U_TP
I '$D(^TMP("APSPW",$J,PHARNAME)) D
.S ^TMP("APSPW",$J,PHARNAME)=1_U_0_U_1
S NT=$P(APSPTOT,U,1),RT=$P(APSPTOT,U,2),GT=$P(APSPTOT,U,3)
S NT=NT+1,GT=GT+1
S APSPTOT=NT_U_RT_U_GT
Q
REFILL(RXIEN,IEN) ;Find refills
N PHARM
S PHARM=$P($G(^PSRX(RXIEN,1,IEN,0)),U,5)
I APSPNUM="A" D SETRFILL(PHARM)
I APSPNUM="I" D
.I $D(APSPDARY(PHARM)) D SETRFILL(PHARM)
Q
SETRFILL(PHARM) ;Set provider data
N PHARNAME,GT,RT,NT,NP,RP,TP,DATA
I +PHARM>0 S PHARNAME=$$GET1^DIQ(200,PHARM,.01)
E S PHARNAME="UNKNOWN"
I $D(^TMP("APSPW",$J,PHARNAME)) D
.S DATA=$G(^TMP("APSPW",$J,PHARNAME))
.S NP=$P(DATA,U,1),RP=$P(DATA,U,2),TP=$P(DATA,U,3)
.S RP=RP+1,TP=TP+1
.S ^TMP("APSPW",$J,PHARNAME)=NP_U_RP_U_TP
I '$D(^TMP("APSPW",$J,PHARNAME)) D
.S ^TMP("APSPW",$J,PHARNAME)=0_U_1_U_1
S NT=$P(APSPTOT,U,1),RT=$P(APSPTOT,U,2),GT=$P(APSPTOT,U,3)
S RT=RT+1,GT=GT+1
S APSPTOT=NT_U_RT_U_GT
Q
; Return boolean flag indicating valid pharmacy division
DIVVRY(RX,DIV,TYP,SIEN) ;EP
Q:DIV="*" 1
Q $S($G(SIEN):DIV=+$P($G(^PSRX(RX,$S(TYP="ADP":"P",1:1),SIEN,0)),U,9),1:DIV=+$P(^PSRX(RX,2),U,9))
; Return release date for dispense
DSPRDT(RX,TYP,SIEN) ;EP
Q $S($G(SIEN):+$P($G(^PSRX(RX,$S(TYP="ADP":"P",1:1),SIEN,0)),U,$S(TYP="ADP":19,1:18)),1:+$P(^PSRX(RX,2),U,13))
PRINT ;Print out the report
N PHARM,TOT,NUMBERS,%NEW,%RFILL
I APSPNUM="I" D PRT1
I APSPNUM="A" D PRT2
Q
PRT1 ;Print individual providers
N PHARM,NUMBERS
D HDR1
S PHARM="" F S PHARM=$O(^TMP("APSPW",$J,PHARM)) Q:PHARM="" D
.S NUMBERS=$G(^TMP("APSPW",$J,PHARM))
.W !,PHARM,?30,$P(NUMBERS,U,1),?40,$P(NUMBERS,U,2),?50,$P(NUMBERS,U,3)
.I $Y+4>IOSL,IOST["C-" D PAUS Q:APSPQ D HDR1
.Q:APSPQ=1
W !!,?50,"Total New RX: "_$P(APSPTOT,U,1)
W !,?50,"Total Refills: "_$P(APSPTOT,U,2)
W !,?50,"GRAND TOTAL: "_$P(APSPTOT,U,3)
Q
PRT2 ;Print all providers
N PHARM,NUMBERS,NNUM,RNUM,TOT,NTOT,RTOT
D HDR2
S PHARM="" F S PHARM=$O(^TMP("APSPW",$J,PHARM)) Q:PHARM="" D
.S NUMBERS=$G(^TMP("APSPW",$J,PHARM))
.S NNUM=$P(NUMBERS,U,1),RNUM=$P(NUMBERS,U,2),TOT=$P(NUMBERS,U,3)
.S NTOT=$P(APSPTOT,U,1),RTOT=$P(APSPTOT,U,2)
.I NTOT=0 S %NEW=0
.E S %NEW=$$ROUND((NNUM/NTOT),3)*100
.I RTOT=0 S %RFILL=0
.E S %RFILL=$$ROUND((RNUM/RTOT),3)*100
.W !,PHARM,?30,NNUM,?40,%NEW,?50,RNUM,?60,%RFILL,?70,TOT
.I $Y+4>IOSL,IOST["C-" D PAUS Q:APSPQ D HDR2
.Q:APSPQ=1
W !!,?50,"Total New RX: "_$P(APSPTOT,U,1)
W !,?50,"Total Refills: "_$P(APSPTOT,U,2)
W !,?50,"GRAND TOTAL: "_$P(APSPTOT,U,3)
Q
PAUS ;
N DTOUT,DUOUT,DIR
S DIR("?")="Enter '^' to Halt or Press Return to continue"
S DIR(0)="FO",DIR("A")="Press Return to continue or '^' to Halt"
D ^DIR
I $D(DUOUT) S APSPQ=1
Q
HDR1 ; Header for individual users
N LIN
I IOST["C-" W @IOF
W !,"Pharmacist Workload Report: Individual Users"
W !,"Pharmacy User",?30,"New",?40,"Refills",?50,"Total"
W ! F LIN=1:1:72 W "-"
W !
Q
HDR2 ; Hader for all users
N LIN
I IOST["C-" W @IOF
W !,"Pharmacist Workload Report: All Users"
W !,"Pharmacy User",?30,"New",?40,"% total",?50,"Refills",?60,"% total",?70,"Total"
W ! F LIN=1:1:72 W "-"
W !
Q
ROUND(VAL,SD) ;
Q:VAL'=+VAL!($G(SD)=0) VAL
Q +$J(VAL,0,$S($D(SD):SD,VAL<1:2,VAL<10:2,1:2))
APSPSWKL ; IHS/MSC/PLS - PHARMACY STAFF WORKLOAD REPORT ;11-Jul-2012 17:31;PLS
+1 ;;7.0;IHS PHARMACY MODIFICATIONS;**1013,1015**;Sep 23, 2004;Build 62
+2 ;
EN ;EP
+1 NEW AOSOQ,APSPBDF,APSPEDF,APSPDIV,APSPNUM,APSPUSR,APSPNAME,APSPCNT
+2 NEW APSPTOT,APSPTYP,APSPCLAS,APSPBD,APSPED,APSPDARY,APSPQ,QFLG
+3 KILL ^TMP("APSPW",$JOB)
+4 SET APSPDIV=""
SET APSPQ=0
SET APSPCNT=0
SET APSPTYP=0
SET APSPUSR=""
+5 ;Total new orders ^ total refills ^ grand total
SET APSPTOT=0_U_0_U_0
+6 WRITE @IOF
+7 WRITE !!,"Pharmacy Staff Workload Report"
+8 DO ASKDATES^APSPUTIL(.APSPBD,.APSPED,.APSPQ,DT,DT)
+9 IF APSPQ
QUIT
+10 SET APSPBDF=$PIECE($TRANSLATE($$FMTE^XLFDT(APSPBD,"5Z"),"@"," "),":",1,2)
+11 SET APSPEDF=$PIECE($TRANSLATE($$FMTE^XLFDT(APSPED,"5Z"),"@"," "),":",1,2)
+12 SET APSPBD=APSPBD-.01
SET APSPED=APSPED+.99
+13 SET APSPDIV=$$DIR^APSPUTIL("Y","Would you like all pharmacy divisions","Yes",,.APSPQ)
+14 IF APSPQ
QUIT
+15 IF APSPDIV
Begin DoDot:1
+16 SET APSPDIV="*"
End DoDot:1
+17 IF '$TEST
Begin DoDot:1
+18 SET APSPDIV=$$GETIEN^APSPUTIL(59,"Select Pharmacy Division: ",.APSPQ)
End DoDot:1
IF APSPQ
QUIT
+19 IF APSPQ
QUIT
+20 SET APSPNUM=$$DIR^APSPUTIL("S^I:Individual Pharmacy user;A:All Pharmacy users","Lookup Individual User or List ALL Users? ","A",,.APSPQ)
+21 IF APSPNUM="A"
SET APSPDARY="*"
+22 IF APSPNUM="I"
Begin DoDot:1
+23 FOR
Begin DoDot:2
+24 SET APSPUSR=$$GETIEN1^APSPUTIL(200,"Select Pharmacy User: ",-1,"B")
+25 IF APSPUSR<1
SET QFLG=1
QUIT
+26 SET APSPCLAS=$$GET1^DIQ(200,APSPUSR,53.5)
+27 SET APSPNAME=$$GET1^DIQ(200,APSPUSR,.01)
+28 IF APSPCLAS="PHARMACIST"!(APSPCLAS="PHARMACY TECHNICIAN")!(APSPCLAS="PHARMCY PRACTITIONER")!(APSPCLAS="CLINICAL PHARMACY SPECIALIST")
Begin DoDot:3
+29 SET APSPDARY(APSPUSR)=APSPNAME
+30 SET APSPCNT=APSPCNT+1
End DoDot:3
+31 IF '$TEST
Begin DoDot:3
+32 WRITE !,APSPNAME_" is not a pharmacy user."
End DoDot:3
+33 SET QFLG='$$DIRYN^APSPUTIL("Want to Select Another User","No","Enter a 'Y' or 'YES' to include more pharmacy users in your search",.APSPQ)
+34 IF 'QFLG
SET QFLG=APSPQ
End DoDot:2
IF QFLG
QUIT
End DoDot:1
+35 IF APSPQ
QUIT
+36 DO DEV
+37 QUIT
DEV ;
+1 NEW XBRP,XBNS
+2 SET XBRP="OUT^APSPSWKL"
+3 SET XBNS="APS*"
+4 DO ^XBDBQUE
+5 QUIT
OUT ;EP
+1 USE IO
+2 KILL ^TMP($JOB)
+3 ; Regular and Refill
DO FIND(APSPBD,APSPED,"AD")
+4 DO PRINT
+5 KILL ^TMP("APSPW",$JOB)
+6 QUIT
+7 ;
FIND(SDT,EDT,XREF) ;EP
+1 NEW RXIEN,ACTIEN,RTSDT,FILLDT,A0,FDTLP,IEN,PHARM
+2 SET FDTLP=SDT-.01
+3 FOR
SET FDTLP=$ORDER(^PSRX(XREF,FDTLP))
IF 'FDTLP!(FDTLP>EDT)
QUIT
Begin DoDot:1
+4 SET RXIEN=0
+5 FOR
SET RXIEN=$ORDER(^PSRX(XREF,FDTLP,RXIEN))
IF 'RXIEN
QUIT
Begin DoDot:2
+6 ; Prescription must have a drug
IF '$PIECE(^PSRX(RXIEN,0),U,6)
QUIT
+7 ; Quit if Deleted status
IF $$GET1^DIQ(52,RXIEN,100,"I")=13
QUIT
+8 ;Removed check for POE Patch 1015
+9 ;Q:$$GET1^DIQ(52,RXIEN,111,"I")'=1 ; Quit if not POE entered RX
+10 SET IEN=""
FOR
SET IEN=$ORDER(^PSRX(XREF,FDTLP,RXIEN,IEN))
IF IEN=""
QUIT
Begin DoDot:3
+11 ; Quit if original fill and a return to stock date exists
IF 'IEN&($$GET1^DIQ(52,RXIEN,32.1,"I"))
QUIT
+12 ;check division
IF '$$DIVVRY(RXIEN,APSPDIV,XREF,IEN)
QUIT
+13 ;check for release date
IF '$$DSPRDT(RXIEN,XREF,IEN)
QUIT
+14 IF IEN=0
DO NEW(RXIEN,IEN)
+15 IF IEN>0
DO REFILL(RXIEN,IEN)
End DoDot:3
End DoDot:2
End DoDot:1
+16 QUIT
+17 ;
NEW(RXIEN,IEN) ;Find new prescriptions
+1 NEW PHARM
+2 SET PHARM=$PIECE($GET(^PSRX(RXIEN,2)),U,3)
+3 IF APSPNUM="A"
DO SETNEW(PHARM)
+4 IF APSPNUM="I"
Begin DoDot:1
+5 IF $DATA(APSPDARY(PHARM))
DO SETNEW(PHARM)
End DoDot:1
+6 QUIT
SETNEW(PHARM) ;Set the pharmacist data
+1 NEW PHARNAME,GT,RT,NT,NP,RP,TP,DATA
+2 IF +PHARM>0
SET PHARNAME=$$GET1^DIQ(200,PHARM,.01)
+3 IF '$TEST
SET PHARNAME="UNKNOWN"
+4 IF $DATA(^TMP("APSPW",$JOB,PHARNAME))
Begin DoDot:1
+5 SET DATA=$GET(^TMP("APSPW",$JOB,PHARNAME))
+6 SET NP=$PIECE(DATA,U,1)
SET RP=$PIECE(DATA,U,2)
SET TP=$PIECE(DATA,U,3)
+7 SET NP=NP+1
SET TP=TP+1
+8 SET ^TMP("APSPW",$JOB,PHARNAME)=NP_U_RP_U_TP
End DoDot:1
+9 IF '$DATA(^TMP("APSPW",$JOB,PHARNAME))
Begin DoDot:1
+10 SET ^TMP("APSPW",$JOB,PHARNAME)=1_U_0_U_1
End DoDot:1
+11 SET NT=$PIECE(APSPTOT,U,1)
SET RT=$PIECE(APSPTOT,U,2)
SET GT=$PIECE(APSPTOT,U,3)
+12 SET NT=NT+1
SET GT=GT+1
+13 SET APSPTOT=NT_U_RT_U_GT
+14 QUIT
REFILL(RXIEN,IEN) ;Find refills
+1 NEW PHARM
+2 SET PHARM=$PIECE($GET(^PSRX(RXIEN,1,IEN,0)),U,5)
+3 IF APSPNUM="A"
DO SETRFILL(PHARM)
+4 IF APSPNUM="I"
Begin DoDot:1
+5 IF $DATA(APSPDARY(PHARM))
DO SETRFILL(PHARM)
End DoDot:1
+6 QUIT
SETRFILL(PHARM) ;Set provider data
+1 NEW PHARNAME,GT,RT,NT,NP,RP,TP,DATA
+2 IF +PHARM>0
SET PHARNAME=$$GET1^DIQ(200,PHARM,.01)
+3 IF '$TEST
SET PHARNAME="UNKNOWN"
+4 IF $DATA(^TMP("APSPW",$JOB,PHARNAME))
Begin DoDot:1
+5 SET DATA=$GET(^TMP("APSPW",$JOB,PHARNAME))
+6 SET NP=$PIECE(DATA,U,1)
SET RP=$PIECE(DATA,U,2)
SET TP=$PIECE(DATA,U,3)
+7 SET RP=RP+1
SET TP=TP+1
+8 SET ^TMP("APSPW",$JOB,PHARNAME)=NP_U_RP_U_TP
End DoDot:1
+9 IF '$DATA(^TMP("APSPW",$JOB,PHARNAME))
Begin DoDot:1
+10 SET ^TMP("APSPW",$JOB,PHARNAME)=0_U_1_U_1
End DoDot:1
+11 SET NT=$PIECE(APSPTOT,U,1)
SET RT=$PIECE(APSPTOT,U,2)
SET GT=$PIECE(APSPTOT,U,3)
+12 SET RT=RT+1
SET GT=GT+1
+13 SET APSPTOT=NT_U_RT_U_GT
+14 QUIT
+15 ; Return boolean flag indicating valid pharmacy division
DIVVRY(RX,DIV,TYP,SIEN) ;EP
+1 IF DIV="*"
QUIT 1
+2 QUIT $SELECT($GET(SIEN):DIV=+$PIECE($GET(^PSRX(RX,$SELECT(TYP="ADP":"P",1:1),SIEN,0)),U,9),1:DIV=+$PIECE(^PSRX(RX,2),U,9))
+3 ; Return release date for dispense
DSPRDT(RX,TYP,SIEN) ;EP
+1 QUIT $SELECT($GET(SIEN):+$PIECE($GET(^PSRX(RX,$SELECT(TYP="ADP":"P",1:1),SIEN,0)),U,$SELECT(TYP="ADP":19,1:18)),1:+$PIECE(^PSRX(RX,2),U,13))
PRINT ;Print out the report
+1 NEW PHARM,TOT,NUMBERS,%NEW,%RFILL
+2 IF APSPNUM="I"
DO PRT1
+3 IF APSPNUM="A"
DO PRT2
+4 QUIT
PRT1 ;Print individual providers
+1 NEW PHARM,NUMBERS
+2 DO HDR1
+3 SET PHARM=""
FOR
SET PHARM=$ORDER(^TMP("APSPW",$JOB,PHARM))
IF PHARM=""
QUIT
Begin DoDot:1
+4 SET NUMBERS=$GET(^TMP("APSPW",$JOB,PHARM))
+5 WRITE !,PHARM,?30,$PIECE(NUMBERS,U,1),?40,$PIECE(NUMBERS,U,2),?50,$PIECE(NUMBERS,U,3)
+6 IF $Y+4>IOSL
IF IOST["C-"
DO PAUS
IF APSPQ
QUIT
DO HDR1
+7 IF APSPQ=1
QUIT
End DoDot:1
+8 WRITE !!,?50,"Total New RX: "_$PIECE(APSPTOT,U,1)
+9 WRITE !,?50,"Total Refills: "_$PIECE(APSPTOT,U,2)
+10 WRITE !,?50,"GRAND TOTAL: "_$PIECE(APSPTOT,U,3)
+11 QUIT
PRT2 ;Print all providers
+1 NEW PHARM,NUMBERS,NNUM,RNUM,TOT,NTOT,RTOT
+2 DO HDR2
+3 SET PHARM=""
FOR
SET PHARM=$ORDER(^TMP("APSPW",$JOB,PHARM))
IF PHARM=""
QUIT
Begin DoDot:1
+4 SET NUMBERS=$GET(^TMP("APSPW",$JOB,PHARM))
+5 SET NNUM=$PIECE(NUMBERS,U,1)
SET RNUM=$PIECE(NUMBERS,U,2)
SET TOT=$PIECE(NUMBERS,U,3)
+6 SET NTOT=$PIECE(APSPTOT,U,1)
SET RTOT=$PIECE(APSPTOT,U,2)
+7 IF NTOT=0
SET %NEW=0
+8 IF '$TEST
SET %NEW=$$ROUND((NNUM/NTOT),3)*100
+9 IF RTOT=0
SET %RFILL=0
+10 IF '$TEST
SET %RFILL=$$ROUND((RNUM/RTOT),3)*100
+11 WRITE !,PHARM,?30,NNUM,?40,%NEW,?50,RNUM,?60,%RFILL,?70,TOT
+12 IF $Y+4>IOSL
IF IOST["C-"
DO PAUS
IF APSPQ
QUIT
DO HDR2
+13 IF APSPQ=1
QUIT
End DoDot:1
+14 WRITE !!,?50,"Total New RX: "_$PIECE(APSPTOT,U,1)
+15 WRITE !,?50,"Total Refills: "_$PIECE(APSPTOT,U,2)
+16 WRITE !,?50,"GRAND TOTAL: "_$PIECE(APSPTOT,U,3)
+17 QUIT
PAUS ;
+1 NEW DTOUT,DUOUT,DIR
+2 SET DIR("?")="Enter '^' to Halt or Press Return to continue"
+3 SET DIR(0)="FO"
SET DIR("A")="Press Return to continue or '^' to Halt"
+4 DO ^DIR
+5 IF $DATA(DUOUT)
SET APSPQ=1
+6 QUIT
HDR1 ; Header for individual users
+1 NEW LIN
+2 IF IOST["C-"
WRITE @IOF
+3 WRITE !,"Pharmacist Workload Report: Individual Users"
+4 WRITE !,"Pharmacy User",?30,"New",?40,"Refills",?50,"Total"
+5 WRITE !
FOR LIN=1:1:72
WRITE "-"
+6 WRITE !
+7 QUIT
HDR2 ; Hader for all users
+1 NEW LIN
+2 IF IOST["C-"
WRITE @IOF
+3 WRITE !,"Pharmacist Workload Report: All Users"
+4 WRITE !,"Pharmacy User",?30,"New",?40,"% total",?50,"Refills",?60,"% total",?70,"Total"
+5 WRITE !
FOR LIN=1:1:72
WRITE "-"
+6 WRITE !
+7 QUIT
ROUND(VAL,SD) ;
+1 IF VAL'=+VAL!($GET(SD)=0)
QUIT VAL
+2 QUIT +$JUSTIFY(VAL,0,$SELECT($DATA(SD):SD,VAL<1:2,VAL<10:2,1:2))