PSIVRQ ;BIR/PR,MLM,MV-REPORT DRIVER ; 9/25/08 12:31pm
;;5.0; INPATIENT MEDICATIONS ;**196**;16 DEC 97;Build 13
DTS ;Get start and stop dates for all reports
I '$D(STSRPT),'$D(PSIVRC) S (Y,X2)=$S($D(^PS(50.8,1,.2)):^(.2),1:0) I Y X ^DD("DD") W !!,"The IV BACKGROUND JOB [PSJI BACKGROUND JOB] that compiles IV cost data",!,"was last successfully run on: ",Y
I '$D(STSRPT),'$D(PSIVRC) S X1=DT D ^%DTC I X>1 W !!,$C(7),"**WARNING** that was <",X,"> days ago. PLEASE contact your site manager.",!?12,"Cost data is probably not accurate because of this."
I '$D(STSRPT),$D(^PS(50.8,0)) F Z=0:0 S Z=$O(^PS(50.8,Z)) Q:'Z I $D(^(Z,2)) S DATA=$O(^PS(50.8,Z,2,0)) W !!,$C(7),$C(7),"The oldest cost data for room: ",$P($G(^PS(59.5,Z,0)),U)," goes back to: " S Y=DATA X ^DD("DD") W $S(Y'="":Y,1:"??")
K BRIEF,SMO S %DT="AXE",%DT(0)="-T",%DT("A")="Enter Start Date: " W ! D ^%DT G:Y<0 K S I7=+Y
S %DT("A")="Enter End Date: " W ! D ^%DT G:Y<0 K S I8=+Y
I I8<I7 W !!,$C(7),$C(7),"End date must be GREATER than start date." G DTS
;
Q:$D(STSRPT)
RECOM ;Recompile IV cost data for date range
I $D(PSIVRC) K PSIVRC G ^PSIVREC
;
;
LS ;Ask for long or short report if user is running the drug cost report.
;Set variable BRIEF if a condensed report is requested
K BRIEF,DIR
I $D(PSIVPCR) S DIR(0)="SO^C:Condensed;R:Regular",DIR("A")="(R)egular or (C)ondensed",DIR("B")="Regular",DIR("?")="Enter ""R"" to include drug data, or ""C"" to list only the drug total per provider" D ^DIR K DIR S:X="C" BRIEF=1
G:'$D(PSIVDCR) IV
S DIR(0)="SO^C:Condensed;R:Regular",DIR("A")="(R)egular or (C)ondensed",DIR("B")="Regular",DIR("?")="Enter ""R"" to include ward data, or ""C"" to exclude ward data",DIR("??")="^S HELP=""CON"" D ^PSIVHLP2" D ^DIR K DIR
;PSJ*5*196
I $TR(X,"c","C")["C" S BRIEF=1 K PQ
G:X="^" K
;
IV ;Ask user for IV room to run reports for.
;Only for the drug cost, ward cost, and provider cost reports.
I $D(PSIVPAT)!($D(PSIVAMIS)) G ^PSIVRQ1
S DIR(0)="P0^59.5",DIR("A")="Select IV room",DIR("B")="^ALL",DIR("?")="Enter the name of the IV room, or ^ALL for all IV rooms",DIR("??")="^S HELP=""IVR"" D ^PSIVHLP2" D ^DIR K DIR
G:X="^" K I $P("^ALL",X)="" W $P("^ALL",X,2) S I4=0,I15="ALL IV ROOMS"
E W $P(Y,X,2) S I4=+Y,I15="IV ROOM: "_$P(Y,U,2)
G ^PSIVRQ1
K ;Kill variables
K %DT,%T,BRIEF,D,DATA,DFN,DIC,DIRUT,DUOUT,G,HELP,I1,I10,I11,I2,I3,I4,I5,I6,I7,I8,I9,I15,JJ,LCO,NU,POP,PQ,PSIVDCR,PSIVPAT,PSIVPCR,PSIVPCR
K PSIVRC,PSIVWCR,Q,UCO,X,Y,PQ,SMO,VAERR,Y,Z,ZTSK D ENIVKV^PSGSETU S:$D(ZTQUEUED) ZTREQ="@"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSIVRQ 2550 printed Dec 13, 2024@02:05:01 Page 2
PSIVRQ ;BIR/PR,MLM,MV-REPORT DRIVER ; 9/25/08 12:31pm
+1 ;;5.0; INPATIENT MEDICATIONS ;**196**;16 DEC 97;Build 13
DTS ;Get start and stop dates for all reports
+1 IF '$DATA(STSRPT)
IF '$DATA(PSIVRC)
SET (Y,X2)=$SELECT($DATA(^PS(50.8,1,.2)):^(.2),1:0)
IF Y
XECUTE ^DD("DD")
WRITE !!,"The IV BACKGROUND JOB [PSJI BACKGROUND JOB] that compiles IV cost data",!,"was last successfully run on: ",Y
+2 IF '$DATA(STSRPT)
IF '$DATA(PSIVRC)
SET X1=DT
DO ^%DTC
IF X>1
WRITE !!,$CHAR(7),"**WARNING** that was <",X,"> days ago. PLEASE contact your site manager.",!?12,"Cost data is probably not accurate because of this."
+3 IF '$DATA(STSRPT)
IF $DATA(^PS(50.8,0))
FOR Z=0:0
SET Z=$ORDER(^PS(50.8,Z))
if 'Z
QUIT
IF $DATA(^(Z,2))
SET DATA=$ORDER(^PS(50.8,Z,2,0))
WRITE !!,$CHAR(7),$CHAR(7),"The oldest cost data for room: ",$PIECE($GET(^PS(59.5,Z,0)),U)," goes back to: "
SET Y=DATA
XECUTE ^DD("DD")
WRITE $SELECT(Y'="":Y,1:"??")
+4 KILL BRIEF,SMO
SET %DT="AXE"
SET %DT(0)="-T"
SET %DT("A")="Enter Start Date: "
WRITE !
DO ^%DT
if Y<0
GOTO K
SET I7=+Y
+5 SET %DT("A")="Enter End Date: "
WRITE !
DO ^%DT
if Y<0
GOTO K
SET I8=+Y
+6 IF I8<I7
WRITE !!,$CHAR(7),$CHAR(7),"End date must be GREATER than start date."
GOTO DTS
+7 ;
+8 if $DATA(STSRPT)
QUIT
RECOM ;Recompile IV cost data for date range
+1 IF $DATA(PSIVRC)
KILL PSIVRC
GOTO ^PSIVREC
+2 ;
+3 ;
LS ;Ask for long or short report if user is running the drug cost report.
+1 ;Set variable BRIEF if a condensed report is requested
+2 KILL BRIEF,DIR
+3 IF $DATA(PSIVPCR)
SET DIR(0)="SO^C:Condensed;R:Regular"
SET DIR("A")="(R)egular or (C)ondensed"
SET DIR("B")="Regular"
SET DIR("?")="Enter ""R"" to include drug data, or ""C"" to list only the drug total per provider"
DO ^DIR
KILL DIR
if X="C"
SET BRIEF=1
+4 if '$DATA(PSIVDCR)
GOTO IV
+5 SET DIR(0)="SO^C:Condensed;R:Regular"
SET DIR("A")="(R)egular or (C)ondensed"
SET DIR("B")="Regular"
SET DIR("?")="Enter ""R"" to include ward data, or ""C"" to exclude ward data"
SET DIR("??")="^S HELP=""CON"" D ^PSIVHLP2"
DO ^DIR
KILL DIR
+6 ;PSJ*5*196
+7 IF $TRANSLATE(X,"c","C")["C"
SET BRIEF=1
KILL PQ
+8 if X="^"
GOTO K
+9 ;
IV ;Ask user for IV room to run reports for.
+1 ;Only for the drug cost, ward cost, and provider cost reports.
+2 IF $DATA(PSIVPAT)!($DATA(PSIVAMIS))
GOTO ^PSIVRQ1
+3 SET DIR(0)="P0^59.5"
SET DIR("A")="Select IV room"
SET DIR("B")="^ALL"
SET DIR("?")="Enter the name of the IV room, or ^ALL for all IV rooms"
SET DIR("??")="^S HELP=""IVR"" D ^PSIVHLP2"
DO ^DIR
KILL DIR
+4 if X="^"
GOTO K
IF $PIECE("^ALL",X)=""
WRITE $PIECE("^ALL",X,2)
SET I4=0
SET I15="ALL IV ROOMS"
+5 IF '$TEST
WRITE $PIECE(Y,X,2)
SET I4=+Y
SET I15="IV ROOM: "_$PIECE(Y,U,2)
+6 GOTO ^PSIVRQ1
K ;Kill variables
+1 KILL %DT,%T,BRIEF,D,DATA,DFN,DIC,DIRUT,DUOUT,G,HELP,I1,I10,I11,I2,I3,I4,I5,I6,I7,I8,I9,I15,JJ,LCO,NU,POP,PQ,PSIVDCR,PSIVPAT,PSIVPCR,PSIVPCR
+2 KILL PSIVRC,PSIVWCR,Q,UCO,X,Y,PQ,SMO,VAERR,Y,Z,ZTSK
DO ENIVKV^PSGSETU
if $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 QUIT