PSOATRP ;BIR/SJA - INTERNET REFILL REPORT ;05/29/07 12:36pm
;;7.0;OUTPATIENT PHARMACY;**264**;DEC 1997;Build 19
;
N PSODS,PSOED,PSOEDX,PSODIV,PSOREP,PSORST,PSORMZ,PSOSD,PSOSDX,PSOSITE,RDATE,X,Y
S PSORMZ=0 D NOW^%DTC S Y=% X ^DD("DD") S RDATE=Y
;
D SEL^PSOREJU1("DIVISION","^PS(59,",.PSODIV) I $G(PSODIV)="^" D MESS Q
I $G(PSODIV)="ALL" S PSOSITE=0 F S PSOSITE=$O(^PS(59,PSOSITE)) Q:'PSOSITE D
.I '$P($G(^PS(59,PSOSITE,"I")),"^")!(DT<$P($G(^("I")),"^")) S PSODIV(PSOSITE)=""
;
K DIR W ! S DIR(0)="DAO^:DT:APEX",DIR("A")="Beginning Date: ",DIR("?")=" ",DIR("?",1)="Enter the date to begin searching.",DIR("?",2)="A future date cannot be entered." D ^DIR K DIR
I 'Y!($D(DTOUT))!($D(DUOUT)) D MESS Q
S PSOSD=Y D DD^%DT S PSOSDX=Y
;
W ! K DIR S DIR(0)="DAO^:DT:APEX",DIR("A")="Ending Date: ",DIR("?")=" ",DIR("?",1)="Enter the ending date of the search.",DIR("?",2)="This date cannot be a future date." D ^DIR K DIR
I 'Y!($D(DTOUT))!($D(DUOUT)) D MESS Q
S PSOED=Y D DD^%DT S PSOEDX=Y
;
W ! K DIR S DIR(0)="S^P:Patient;D:Date;R:Result;",DIR("B")="R"
S DIR("A")="Sort by Patient/Date/Result (P/D/R)",DIR("?")="Enter 'P' to sort by Patient, 'D' to sort by date, or 'R' to sort by result." D ^DIR K DIR
I $D(DTOUT)!$D(DUOUT) D MESS Q
S PSOREP=Y
;
W ! K DIR S DIR(0)="S^D:Detail;S:Summary;",DIR("B")="S"
S DIR("A")="Print Detail/Summary report (D/S)",DIR("?")="Enter 'D' to print detail report or 'S' for summary report" D ^DIR K DIR
I $D(DTOUT)!$D(DUOUT) D MESS Q
S PSODS=Y
;
SKIPC ;
I PSODS="S" G SEL
W ! K DIR S DIR("A")="Do you want this report to print in 80 or 132 column format: "
S DIR("B")="80",DIR(0)="SAM^1:132;8:80" D ^DIR K DIR I Y["^"!($D(DIRUT)) D MESS Q
W ! S PSORMZ=$S(Y=1:1,1:0)
;
SEL D @$S(PSOREP="D":"^PSOATRD",PSOREP="R":"^PSOATRR",1:"^PSOATRPP")
;
END K X,Y,PSOSDX,PSOSD,PSOSITE,PSORST,PSOREP,PSODIV,PSOEDX,PSOED,PSODS,DIRUT,DTOUT,DUOUT
Q
MESS W !!,"Nothing queued to print.",!
Q
DIV(RX,DV) ; Check if the Division for the Prescription/Fill was selected by the user
I $G(PSODIV)="ALL" Q 1
I $D(PSODIV(DV)) Q 1
Q 0
PSOATRP ;BIR/SJA - INTERNET REFILL REPORT ;05/29/07 12:36pm
+1 ;;7.0;OUTPATIENT PHARMACY;**264**;DEC 1997;Build 19
+2 ;
+3 NEW PSODS,PSOED,PSOEDX,PSODIV,PSOREP,PSORST,PSORMZ,PSOSD,PSOSDX,PSOSITE,RDATE,X,Y
+4 SET PSORMZ=0
DO NOW^%DTC
SET Y=%
XECUTE ^DD("DD")
SET RDATE=Y
+5 ;
+6 DO SEL^PSOREJU1("DIVISION","^PS(59,",.PSODIV)
IF $GET(PSODIV)="^"
DO MESS
QUIT
+7 IF $GET(PSODIV)="ALL"
SET PSOSITE=0
FOR
SET PSOSITE=$ORDER(^PS(59,PSOSITE))
IF 'PSOSITE
QUIT
Begin DoDot:1
+8 IF '$PIECE($GET(^PS(59,PSOSITE,"I")),"^")!(DT<$PIECE($GET(^("I")),"^"))
SET PSODIV(PSOSITE)=""
End DoDot:1
+9 ;
+10 KILL DIR
WRITE !
SET DIR(0)="DAO^:DT:APEX"
SET DIR("A")="Beginning Date: "
SET DIR("?")=" "
SET DIR("?",1)="Enter the date to begin searching."
SET DIR("?",2)="A future date cannot be entered."
DO ^DIR
KILL DIR
+11 IF 'Y!($DATA(DTOUT))!($DATA(DUOUT))
DO MESS
QUIT
+12 SET PSOSD=Y
DO DD^%DT
SET PSOSDX=Y
+13 ;
+14 WRITE !
KILL DIR
SET DIR(0)="DAO^:DT:APEX"
SET DIR("A")="Ending Date: "
SET DIR("?")=" "
SET DIR("?",1)="Enter the ending date of the search."
SET DIR("?",2)="This date cannot be a future date."
DO ^DIR
KILL DIR
+15 IF 'Y!($DATA(DTOUT))!($DATA(DUOUT))
DO MESS
QUIT
+16 SET PSOED=Y
DO DD^%DT
SET PSOEDX=Y
+17 ;
+18 WRITE !
KILL DIR
SET DIR(0)="S^P:Patient;D:Date;R:Result;"
SET DIR("B")="R"
+19 SET DIR("A")="Sort by Patient/Date/Result (P/D/R)"
SET DIR("?")="Enter 'P' to sort by Patient, 'D' to sort by date, or 'R' to sort by result."
DO ^DIR
KILL DIR
+20 IF $DATA(DTOUT)!$DATA(DUOUT)
DO MESS
QUIT
+21 SET PSOREP=Y
+22 ;
+23 WRITE !
KILL DIR
SET DIR(0)="S^D:Detail;S:Summary;"
SET DIR("B")="S"
+24 SET DIR("A")="Print Detail/Summary report (D/S)"
SET DIR("?")="Enter 'D' to print detail report or 'S' for summary report"
DO ^DIR
KILL DIR
+25 IF $DATA(DTOUT)!$DATA(DUOUT)
DO MESS
QUIT
+26 SET PSODS=Y
+27 ;
SKIPC ;
+1 IF PSODS="S"
GOTO SEL
+2 WRITE !
KILL DIR
SET DIR("A")="Do you want this report to print in 80 or 132 column format: "
+3 SET DIR("B")="80"
SET DIR(0)="SAM^1:132;8:80"
DO ^DIR
KILL DIR
IF Y["^"!($DATA(DIRUT))
DO MESS
QUIT
+4 WRITE !
SET PSORMZ=$SELECT(Y=1:1,1:0)
+5 ;
SEL DO @$SELECT(PSOREP="D":"^PSOATRD",PSOREP="R":"^PSOATRR",1:"^PSOATRPP")
+1 ;
END KILL X,Y,PSOSDX,PSOSD,PSOSITE,PSORST,PSOREP,PSODIV,PSOEDX,PSOED,PSODS,DIRUT,DTOUT,DUOUT
+1 QUIT
MESS WRITE !!,"Nothing queued to print.",!
+1 QUIT
DIV(RX,DV) ; Check if the Division for the Prescription/Fill was selected by the user
+1 IF $GET(PSODIV)="ALL"
QUIT 1
+2 IF $DATA(PSODIV(DV))
QUIT 1
+3 QUIT 0