ORPRS07 ; slc/dcm - Managing multiple reportz ;6/10/97 15:43
;;3.0;ORDER ENTRY/RESULTS REPORTING;**281**;Dec 17, 1997;Build 14
EN ;Entry point
N ORVP
D MAIN("")
Q
MAIN(ORVP) ; Controls branching
N DFN,DIC,GMTYP,I,ORANSI,ORDG,OREND,ORH,ORH2,ORPRES,ORSCPAT,ORSDG
N ORSHORT,ORSRI,ORSRPT,ORSSTOP,ORSSTRT,ORTIT,ORWHL,VAROOT,XQORSPEW,X,Y
N ORAGE,ORATTEND,ORDOB,ORL,ORNP,ORPD,ORPNM,ORPV,ORSEX,ORSSN,ORTS,ORWARD
N ORSDG,ORURMBD,ORX,ORCONT,OROPREF
I '+$G(ORVP) D P^ORPRS01 Q:$D(ORSCPAT)'>9
S ORANSI=0,XQORFLG("SH")=1
S (ORANSI,OREND,X)=0
I +$G(ORSCPAT)=1,+$G(ORSCPAT(1)) S ORVP=+$G(ORSCPAT(1))_";DPT(",Y=+ORVP D HOMO^ORUDPA
S DIC=101 S X="ORS REPORT MENU" D EN^XQOR
K VA200,VAERR,VAIN,VADM
Q
EXIT ; Queue output
N DUOUT,ORSRI,ORSRPT,ZTDESC,ZTRTN,ZTSAVE S OREND=+$G(OREND)
S ORSRI=0 F S ORSRI=$O(Y(ORSRI)) Q:ORSRI'>0 S ORSRPT=ORSRI,ORSRPT(ORSRI)=Y(ORSRI)
I $S($D(XQORPOP):1,$G(OREND)=1:1,$D(DUOUT):1,$D(DIROUT):1,'$D(ORSRPT):1,'$D(ORSCPAT)&'+$G(ORVP):1,1:0) Q
S (ZTSAVE("OR*"),ZTSAVE("GM*"),ZTSAVE("LR*"))="",IO("Q")=1
S ZTRTN="OUTPUT^ORPRS07",ZTDESC="Results Reporting" W ! D DEVICE
Q
OUTPUT ; Loops through ORSRPT( and queues each report
N DIROUT,DIRUT,ORH,ORH2,ORMETHOD,ORSEND,ORSHORT,ORSI,ORSJ,ORSRI,ORTIT,ORWHL,X
N XQORNOD,XQORSPEW,XY,ORSLTR,ORSPNM,ORDG,ORION S ORION=$G(ION)
I +$G(ORVP) D REPORT(ORVP) K OROLOC,ORSSTOP,ORSSTRT,VAROOT,VA,X1 Q
S ORSI=0 F S ORSI=$O(ORSCPAT(ORSI)) Q:ORSI'>0!($G(DIROUT))!($$S^%ZTLOAD) S:'$O(ORSCPAT(ORSI)) ORSEND=1 D
. S ORVP=+ORSCPAT(ORSI)_";DPT(",ORSPNM=$P(ORSCPAT(ORSI),U,2)
. D REPORT(ORVP)
K ORNO,ORSPG
Q
REPORT(ORVP) ; Loops through ORSRPT( and prints all reports for ea patient
N ORSJ,ORSSTFLG,XQORNOD
U IO
S ORSJ=0 F S ORSJ=$O(ORSRPT(ORSJ)) Q:ORSJ'>0!+$G(DIROUT)!$G(OREND) D
. S XQORNOD=$P(ORSRPT(ORSJ),U,2)_";ORD(101,",ORMETHOD=$G(^ORD(101,+XQORNOD,101.05,20,1))
. I $D(ORSSTRT)>9,+XQORNOD S ORSSTRT=+$G(ORSSTRT(+XQORNOD)),ORH=$P($G(ORSSTRT(+XQORNOD)),U,2)
. I $D(ORSSTOP)>9,+XQORNOD S ORSSTOP=+$G(ORSSTOP(+XQORNOD)),ORH2=$P($G(ORSSTOP(+XQORNOD)),U,2)
. I $D(ORSDG(+XQORNOD)) S ORDG=$G(ORSDG(+XQORNOD))
. I $L(ORMETHOD) X ORMETHOD I $G(ION)'=ORION S IOP=ORION D ^%ZIS
. I +$G(ORSSTFLG) D STOP^ORPRS01 S ORSSTFLG=0
Q
DEVICE ; Device Handling/Output control
N IO,IOP,%ZIS
S %ZIS="Q",%ZIS("B")="HOME" D ^%ZIS Q:POP
I +$G(ORSRPT)>1,(IO'=IO(0)),'$D(IO("Q")) W !,"Printing of multiple reports requires queueing.",!
D @$S(+$G(ORSRPT)>1&(IO'=IO(0)):"QUE",$D(IO("Q")):"QUE",1:"NOQUE")
Q
QUE ; Set ZT parameters and tasks ZTRTN
N ZTIO K IO("Q")
S ZTIO=ION
D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued!",1:"Request Cancelled!")
K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE D ^%ZISC
Q
NOQUE ; Calls ZTRTN in interactive mode
I IO'=IO(0) U IO
D @ZTRTN
D ^%ZISC
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORPRS07 2799 printed Oct 16, 2024@18:33:29 Page 2
ORPRS07 ; slc/dcm - Managing multiple reportz ;6/10/97 15:43
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**281**;Dec 17, 1997;Build 14
EN ;Entry point
+1 NEW ORVP
+2 DO MAIN("")
+3 QUIT
MAIN(ORVP) ; Controls branching
+1 NEW DFN,DIC,GMTYP,I,ORANSI,ORDG,OREND,ORH,ORH2,ORPRES,ORSCPAT,ORSDG
+2 NEW ORSHORT,ORSRI,ORSRPT,ORSSTOP,ORSSTRT,ORTIT,ORWHL,VAROOT,XQORSPEW,X,Y
+3 NEW ORAGE,ORATTEND,ORDOB,ORL,ORNP,ORPD,ORPNM,ORPV,ORSEX,ORSSN,ORTS,ORWARD
+4 NEW ORSDG,ORURMBD,ORX,ORCONT,OROPREF
+5 IF '+$GET(ORVP)
DO P^ORPRS01
if $DATA(ORSCPAT)'>9
QUIT
+6 SET ORANSI=0
SET XQORFLG("SH")=1
+7 SET (ORANSI,OREND,X)=0
+8 IF +$GET(ORSCPAT)=1
IF +$GET(ORSCPAT(1))
SET ORVP=+$GET(ORSCPAT(1))_";DPT("
SET Y=+ORVP
DO HOMO^ORUDPA
+9 SET DIC=101
SET X="ORS REPORT MENU"
DO EN^XQOR
+10 KILL VA200,VAERR,VAIN,VADM
+11 QUIT
EXIT ; Queue output
+1 NEW DUOUT,ORSRI,ORSRPT,ZTDESC,ZTRTN,ZTSAVE
SET OREND=+$GET(OREND)
+2 SET ORSRI=0
FOR
SET ORSRI=$ORDER(Y(ORSRI))
if ORSRI'>0
QUIT
SET ORSRPT=ORSRI
SET ORSRPT(ORSRI)=Y(ORSRI)
+3 IF $SELECT($DATA(XQORPOP):1,$GET(OREND)=1:1,$DATA(DUOUT):1,$DATA(DIROUT):1,'$DATA(ORSRPT):1,'$DATA(ORSCPAT)&'+$GET(ORVP):1,1:0)
QUIT
+4 SET (ZTSAVE("OR*"),ZTSAVE("GM*"),ZTSAVE("LR*"))=""
SET IO("Q")=1
+5 SET ZTRTN="OUTPUT^ORPRS07"
SET ZTDESC="Results Reporting"
WRITE !
DO DEVICE
+6 QUIT
OUTPUT ; Loops through ORSRPT( and queues each report
+1 NEW DIROUT,DIRUT,ORH,ORH2,ORMETHOD,ORSEND,ORSHORT,ORSI,ORSJ,ORSRI,ORTIT,ORWHL,X
+2 NEW XQORNOD,XQORSPEW,XY,ORSLTR,ORSPNM,ORDG,ORION
SET ORION=$GET(ION)
+3 IF +$GET(ORVP)
DO REPORT(ORVP)
KILL OROLOC,ORSSTOP,ORSSTRT,VAROOT,VA,X1
QUIT
+4 SET ORSI=0
FOR
SET ORSI=$ORDER(ORSCPAT(ORSI))
if ORSI'>0!($GET(DIROUT))!($$S^%ZTLOAD)
QUIT
if '$ORDER(ORSCPAT(ORSI))
SET ORSEND=1
Begin DoDot:1
+5 SET ORVP=+ORSCPAT(ORSI)_";DPT("
SET ORSPNM=$PIECE(ORSCPAT(ORSI),U,2)
+6 DO REPORT(ORVP)
End DoDot:1
+7 KILL ORNO,ORSPG
+8 QUIT
REPORT(ORVP) ; Loops through ORSRPT( and prints all reports for ea patient
+1 NEW ORSJ,ORSSTFLG,XQORNOD
+2 USE IO
+3 SET ORSJ=0
FOR
SET ORSJ=$ORDER(ORSRPT(ORSJ))
if ORSJ'>0!+$GET(DIROUT)!$GET(OREND)
QUIT
Begin DoDot:1
+4 SET XQORNOD=$PIECE(ORSRPT(ORSJ),U,2)_";ORD(101,"
SET ORMETHOD=$GET(^ORD(101,+XQORNOD,101.05,20,1))
+5 IF $DATA(ORSSTRT)>9
IF +XQORNOD
SET ORSSTRT=+$GET(ORSSTRT(+XQORNOD))
SET ORH=$PIECE($GET(ORSSTRT(+XQORNOD)),U,2)
+6 IF $DATA(ORSSTOP)>9
IF +XQORNOD
SET ORSSTOP=+$GET(ORSSTOP(+XQORNOD))
SET ORH2=$PIECE($GET(ORSSTOP(+XQORNOD)),U,2)
+7 IF $DATA(ORSDG(+XQORNOD))
SET ORDG=$GET(ORSDG(+XQORNOD))
+8 IF $LENGTH(ORMETHOD)
XECUTE ORMETHOD
IF $GET(ION)'=ORION
SET IOP=ORION
DO ^%ZIS
+9 IF +$GET(ORSSTFLG)
DO STOP^ORPRS01
SET ORSSTFLG=0
End DoDot:1
+10 QUIT
DEVICE ; Device Handling/Output control
+1 NEW IO,IOP,%ZIS
+2 SET %ZIS="Q"
SET %ZIS("B")="HOME"
DO ^%ZIS
if POP
QUIT
+3 IF +$GET(ORSRPT)>1
IF (IO'=IO(0))
IF '$DATA(IO("Q"))
WRITE !,"Printing of multiple reports requires queueing.",!
+4 DO @$SELECT(+$GET(ORSRPT)>1&(IO'=IO(0)):"QUE",$DATA(IO("Q")):"QUE",1:"NOQUE")
+5 QUIT
QUE ; Set ZT parameters and tasks ZTRTN
+1 NEW ZTIO
KILL IO("Q")
+2 SET ZTIO=ION
+3 DO ^%ZTLOAD
WRITE !,$SELECT($DATA(ZTSK):"Request Queued!",1:"Request Cancelled!")
+4 KILL ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
DO ^%ZISC
+5 QUIT
NOQUE ; Calls ZTRTN in interactive mode
+1 IF IO'=IO(0)
USE IO
+2 DO @ZTRTN
+3 DO ^%ZISC
+4 QUIT