ORPRS02 ; slc/dcm - Jurasic Prints ;11/18/96 20:20
;;3.0;ORDER ENTRY/RESULTS REPORTING;**11,69,99,121,189**;Dec 17, 1997
DAY ; Process 24-hr Order Summary
N I,ORATTEND,ORTIT,ORPRES,ORSHORT,ORDG,ORGRP,ORSEL,ORSEQ
S OREND=0,ORTIT="DAILY ORDER SUMMARY",ORPRES=1,ORSHORT=$$SHORT
S ORDG=1,ORGRP("NAM")="ALL",ORGRP("ROOT")=1
D WRT
Q
RANGE ; Order Summary for Date/time Range
N I,ORATTEND,ORTIT,ORPRES,ORSHORT,ORDG,ORGRP,ORSEL,ORSEQ
S OREND=0,ORTIT="ORDER SUMMARY",ORPRES=1,ORSHORT=$$SHORT
S ORDG=1,ORGRP("NAM")="ALL",ORGRP("ROOT")=1
D WRT
Q
CUSTOM ; Customized Order Summary
N I,ORATTEND,ORTIT,ORSHORT,ORGRP,ORSEL,ORSEQ
S OREND=0,ORSHORT=$$SHORT
S ORGRP("NAM")=^ORD(100.98,ORDG,0),ORGRP("ROOT")=ORBUF,ORGRP("NAM")=$S($L($P(ORGRP("NAM"),"^",3)):$P(ORGRP("NAM"),"^",3),1:$E($P(ORGRP("NAM"),"^"),1,5))
S ORTIT=$P(ORPRES,";",2)_" for "_ORGRP("NAM")_" SERVICES"
D WRT
Q
CHART ; Set up call to print chart copy for patient
N OREND,OREARLY,ORLATE,DFN
S OREARLY=+$G(ORSSTRT),ORLATE=+$G(ORSSTOP)
S DFN=+ORVP D PATIENT^ORPRS06(DFN,OREARLY,ORLATE,IO,21,+$G(ORL))
Q
WORK ;Set up call for Work Copy patient summary
N OREND,OREARLY,ORLATE,DFN
S OREARLY=+$G(ORSSTRT),ORLATE=+$G(ORSSTOP)
S DFN=+ORVP D WORK^ORPRS06(DFN,OREARLY,ORLATE,IO)
Q
CONT ; Print Report
N ZTRTN,ZTDESC
S ZTRTN="WRT^ORPRS02",ZTDESC=ORTIT
D @ZTRTN
Q
WRT ;Entry point for Batch Processing
;Setup display group list, patient list, and process reports
N %,%H,%I,DFN,DX,DY,I,II,J,K,ODATE,ORAGE,ORDAD,ORDOB,ORFLAG,ORI,ORIFN
N ORL,ORLIST,ORLST,ORMD,ORNP,ORODT,ORPD,ORPNM,ORPV,ORREQ,ORSEX
N ORSSN,ORSTOP,ORSTRT,ORSTS,ORASTS,ORTERM,ORTM,ORTS,ORTX,ORUSER,ORWARD
N ORSLTR,ORAW,VA,VAROOT,X,X0,X1,X3,Y,Z
S ORAW=$S(+$$GET^XPAR("SYS","OR ORDER SUMMARY CONTEXT",1,"I"):"AW",1:"")
U IO
D EN^ORQ1(ORVP,ORDG,+ORPRES,0,+ORSSTRT,+ORSSTOP,0,1,ORAW,1)
N ORPI,ORPA,ORPN,X,ORPIFN
S ORPI=0 F S ORPI=$O(^TMP("ORR",$J,ORLIST,ORPI)) Q:'ORPI D
. S ORPIFN=+^TMP("ORR",$J,ORLIST,ORPI),ORPA=$P(^(ORPI),";",2)
. I $D(^OR(100,ORPIFN,8,ORPA,0)) S X=^(0),ORPN=$P(X,"^",12)
. I $G(ORPN),$D(^ORD(100.02,ORPN,1)),'$P(^(1),"^",3) K ^TMP("ORR",$J,ORLIST,ORPI)
I $$GET^XPAR("ALL","ORPF SUMMARY SORT FORWARD",1,"I") D SORT
D @$S(ORSHORT:"EN^ORPRS04",1:"EN^ORPRS03")
K ^TMP("ORR",$J,ORLIST)
I $D(ZTQUEUED) S ZTREQ="@"
Q
SHORT() ; Check whether user prefers condensed or expanded printout
Q +$$GET^XPAR("ALL","ORPF CONDENSED ORDER SUMMARY",1,"I")
;
SORT ;Re sort ^TMP("ORR",$J in inverse order
Q:'$D(^TMP("ORR",$J,ORLIST))
K ^TMP("ORRF",$J)
N I,C
S C=0,I=9999999
F S I=$O(^TMP("ORR",$J,ORLIST,I),-1) Q:I<1 S C=C+1,^TMP("ORRF",$J,C)=^(I)
K ^TMP("ORR",$J,ORLIST)
M ^TMP("ORR",$J,ORLIST)=^TMP("ORRF",$J)
K ^TMP("ORRF",$J)
Q
ORPRS02 ; slc/dcm - Jurasic Prints ;11/18/96 20:20
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**11,69,99,121,189**;Dec 17, 1997
DAY ; Process 24-hr Order Summary
+1 NEW I,ORATTEND,ORTIT,ORPRES,ORSHORT,ORDG,ORGRP,ORSEL,ORSEQ
+2 SET OREND=0
SET ORTIT="DAILY ORDER SUMMARY"
SET ORPRES=1
SET ORSHORT=$$SHORT
+3 SET ORDG=1
SET ORGRP("NAM")="ALL"
SET ORGRP("ROOT")=1
+4 DO WRT
+5 QUIT
RANGE ; Order Summary for Date/time Range
+1 NEW I,ORATTEND,ORTIT,ORPRES,ORSHORT,ORDG,ORGRP,ORSEL,ORSEQ
+2 SET OREND=0
SET ORTIT="ORDER SUMMARY"
SET ORPRES=1
SET ORSHORT=$$SHORT
+3 SET ORDG=1
SET ORGRP("NAM")="ALL"
SET ORGRP("ROOT")=1
+4 DO WRT
+5 QUIT
CUSTOM ; Customized Order Summary
+1 NEW I,ORATTEND,ORTIT,ORSHORT,ORGRP,ORSEL,ORSEQ
+2 SET OREND=0
SET ORSHORT=$$SHORT
+3 SET ORGRP("NAM")=^ORD(100.98,ORDG,0)
SET ORGRP("ROOT")=ORBUF
SET ORGRP("NAM")=$SELECT($LENGTH($PIECE(ORGRP("NAM"),"^",3)):$PIECE(ORGRP("NAM"),"^",3),1:$EXTRACT($PIECE(ORGRP("NAM"),"^"),1,5))
+4 SET ORTIT=$PIECE(ORPRES,";",2)_" for "_ORGRP("NAM")_" SERVICES"
+5 DO WRT
+6 QUIT
CHART ; Set up call to print chart copy for patient
+1 NEW OREND,OREARLY,ORLATE,DFN
+2 SET OREARLY=+$GET(ORSSTRT)
SET ORLATE=+$GET(ORSSTOP)
+3 SET DFN=+ORVP
DO PATIENT^ORPRS06(DFN,OREARLY,ORLATE,IO,21,+$GET(ORL))
+4 QUIT
WORK ;Set up call for Work Copy patient summary
+1 NEW OREND,OREARLY,ORLATE,DFN
+2 SET OREARLY=+$GET(ORSSTRT)
SET ORLATE=+$GET(ORSSTOP)
+3 SET DFN=+ORVP
DO WORK^ORPRS06(DFN,OREARLY,ORLATE,IO)
+4 QUIT
CONT ; Print Report
+1 NEW ZTRTN,ZTDESC
+2 SET ZTRTN="WRT^ORPRS02"
SET ZTDESC=ORTIT
+3 DO @ZTRTN
+4 QUIT
WRT ;Entry point for Batch Processing
+1 ;Setup display group list, patient list, and process reports
+2 NEW %,%H,%I,DFN,DX,DY,I,II,J,K,ODATE,ORAGE,ORDAD,ORDOB,ORFLAG,ORI,ORIFN
+3 NEW ORL,ORLIST,ORLST,ORMD,ORNP,ORODT,ORPD,ORPNM,ORPV,ORREQ,ORSEX
+4 NEW ORSSN,ORSTOP,ORSTRT,ORSTS,ORASTS,ORTERM,ORTM,ORTS,ORTX,ORUSER,ORWARD
+5 NEW ORSLTR,ORAW,VA,VAROOT,X,X0,X1,X3,Y,Z
+6 SET ORAW=$SELECT(+$$GET^XPAR("SYS","OR ORDER SUMMARY CONTEXT",1,"I"):"AW",1:"")
+7 USE IO
+8 DO EN^ORQ1(ORVP,ORDG,+ORPRES,0,+ORSSTRT,+ORSSTOP,0,1,ORAW,1)
+9 NEW ORPI,ORPA,ORPN,X,ORPIFN
+10 SET ORPI=0
FOR
SET ORPI=$ORDER(^TMP("ORR",$JOB,ORLIST,ORPI))
IF 'ORPI
QUIT
Begin DoDot:1
+11 SET ORPIFN=+^TMP("ORR",$JOB,ORLIST,ORPI)
SET ORPA=$PIECE(^(ORPI),";",2)
+12 IF $DATA(^OR(100,ORPIFN,8,ORPA,0))
SET X=^(0)
SET ORPN=$PIECE(X,"^",12)
+13 IF $GET(ORPN)
IF $DATA(^ORD(100.02,ORPN,1))
IF '$PIECE(^(1),"^",3)
KILL ^TMP("ORR",$JOB,ORLIST,ORPI)
End DoDot:1
+14 IF $$GET^XPAR("ALL","ORPF SUMMARY SORT FORWARD",1,"I")
DO SORT
+15 DO @$SELECT(ORSHORT:"EN^ORPRS04",1:"EN^ORPRS03")
+16 KILL ^TMP("ORR",$JOB,ORLIST)
+17 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+18 QUIT
SHORT() ; Check whether user prefers condensed or expanded printout
+1 QUIT +$$GET^XPAR("ALL","ORPF CONDENSED ORDER SUMMARY",1,"I")
+2 ;
SORT ;Re sort ^TMP("ORR",$J in inverse order
+1 IF '$DATA(^TMP("ORR",$JOB,ORLIST))
QUIT
+2 KILL ^TMP("ORRF",$JOB)
+3 NEW I,C
+4 SET C=0
SET I=9999999
+5 FOR
SET I=$ORDER(^TMP("ORR",$JOB,ORLIST,I),-1)
IF I<1
QUIT
SET C=C+1
SET ^TMP("ORRF",$JOB,C)=^(I)
+6 KILL ^TMP("ORR",$JOB,ORLIST)
+7 MERGE ^TMP("ORR",$JOB,ORLIST)=^TMP("ORRF",$JOB)
+8 KILL ^TMP("ORRF",$JOB)
+9 QUIT