ORPRS10 ; slc/dcm - Summary time, when the livin is easy... ;10/19/98 13:50
;;3.0;ORDER ENTRY/RESULTS REPORTING;**23,37,11,69,121**;Dec 17, 1997
DAY ;PROCESS 24-HR ORDER SUMMARY
S OREND=0,ORTIT="DAILY ORDER SUMMARY",ORPRES=1
D:$D(ORSCPAT)'>9 P^ORPRS01
G:OREND END
D DAY^ORPRS01()
G:OREND END
D CONT(ORTIT)
Q
RANGE ;PROCESS START THRU STOP DATE/TIME RANGE
S OREND=0,ORTIT="ORDER SUMMARY",ORPRES=1
D:$D(ORSCPAT)'>9 P^ORPRS01
G:OREND END
D RANGE^ORPRS01()
G:OREND END
D CONT("Order summary for date range")
Q
GENERIC ;PROCESS WITH PROMPTS FOR ALL REPORT VARIABLES
S OREND=0
D:$D(ORSCPAT)'>9 P^ORPRS01
G:OREND!'$D(ORSCPAT) END
D PRES^ORPRS09
G:OREND END
D SERV^ORPRS09
G:OREND END
D RANGE^ORPRS01()
G:OREND END
S ORTIT=$P(ORPRES,";",2)_" for "_ORGRP("NAM")_" SERVICES"
D CONT(ORTIT)
Q
CONT(DESC) ;
D QUE^ORUTL1("EN1^ORPRS10",$G(DESC))
Q
EN1 ;Entry point for Batch Processing
;Setup display group list, patient list, and process reports
N ORDG,ORGRP,ORSEL,ORSEQ,ORLIST,ORAW
U IO
S ORDG=1,ORGRP("NAM")="ALL",ORGRP("ROOT")=1,ORSEL="BILD",ORSEQ=0,ORPRES=1
S ORAW=$S(+$$GET^XPAR("SYS","OR ORDER SUMMARY CONTEXT",1,"I"):"AW",1:"")
I $E(IOST)'="C",$L($G(ORSWDN)) S ORSLTR=$E(ORSWDN,1,(IOM\15)) D ^ORSLTR
I ORSHORT D PTOP^ORPRS05(0,ORTIT,ORSHORT,ORSSTRT,ORSSTOP)
S (NEXTP,OREND)=0
F S NEXTP=$O(ORSCPAT(NEXTP)) Q:NEXTP=""!(OREND=1) D
. S ORVP=+ORSCPAT(NEXTP)_";DPT("
. D EN^ORQ1(ORVP,ORDG,+ORPRES,0,+ORSSTRT,+ORSSTOP,0,1,ORAW)
. 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^ORPRS02
. D @$S(ORSHORT:"EN^ORPRS04",1:"EN^ORPRS03")
. K ^TMP("ORR",$J,ORLIST)
I ORSHORT W !
END ; Clean up variables
K I,II,J,K,NEXTP,NB,ND,NS,ORSLTR,ORES,ODATE,ORAGE,ORDCFC,ORMD,ORDG,ORDIC,ORDOB,OREND,ORFT,ORGRP,ORH,ORH2,ORHI,ORIO,ORL,ORLST,ORODT,ORNP,ORPD,ORPFG,ORPNM,ORPRES,ORUSER,ORPV,ORREQ
K ORSEL,ORSEQ,ORSEX,ORSP,ORSPAT,ORSPL,ORSSN,ORSSTOP,ORSSTRT,ORSTRT,ORSTOP,ORSTS,ORASTS,ORTIT,ORTM,ORTS,ORTX,ORVP,ORWARD,ORX,X,X1,Y,%,%DT,%IS,ORSWD,ORSWDN,ORRPG,ORIFN
I $D(ZTQUEUED) S ZTREQ="@"
Q
ORPRS10 ; slc/dcm - Summary time, when the livin is easy... ;10/19/98 13:50
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**23,37,11,69,121**;Dec 17, 1997
DAY ;PROCESS 24-HR ORDER SUMMARY
+1 SET OREND=0
SET ORTIT="DAILY ORDER SUMMARY"
SET ORPRES=1
+2 IF $DATA(ORSCPAT)'>9
DO P^ORPRS01
+3 IF OREND
GOTO END
+4 DO DAY^ORPRS01()
+5 IF OREND
GOTO END
+6 DO CONT(ORTIT)
+7 QUIT
RANGE ;PROCESS START THRU STOP DATE/TIME RANGE
+1 SET OREND=0
SET ORTIT="ORDER SUMMARY"
SET ORPRES=1
+2 IF $DATA(ORSCPAT)'>9
DO P^ORPRS01
+3 IF OREND
GOTO END
+4 DO RANGE^ORPRS01()
+5 IF OREND
GOTO END
+6 DO CONT("Order summary for date range")
+7 QUIT
GENERIC ;PROCESS WITH PROMPTS FOR ALL REPORT VARIABLES
+1 SET OREND=0
+2 IF $DATA(ORSCPAT)'>9
DO P^ORPRS01
+3 IF OREND!'$DATA(ORSCPAT)
GOTO END
+4 DO PRES^ORPRS09
+5 IF OREND
GOTO END
+6 DO SERV^ORPRS09
+7 IF OREND
GOTO END
+8 DO RANGE^ORPRS01()
+9 IF OREND
GOTO END
+10 SET ORTIT=$PIECE(ORPRES,";",2)_" for "_ORGRP("NAM")_" SERVICES"
+11 DO CONT(ORTIT)
+12 QUIT
CONT(DESC) ;
+1 DO QUE^ORUTL1("EN1^ORPRS10",$GET(DESC))
+2 QUIT
EN1 ;Entry point for Batch Processing
+1 ;Setup display group list, patient list, and process reports
+2 NEW ORDG,ORGRP,ORSEL,ORSEQ,ORLIST,ORAW
+3 USE IO
+4 SET ORDG=1
SET ORGRP("NAM")="ALL"
SET ORGRP("ROOT")=1
SET ORSEL="BILD"
SET ORSEQ=0
SET ORPRES=1
+5 SET ORAW=$SELECT(+$$GET^XPAR("SYS","OR ORDER SUMMARY CONTEXT",1,"I"):"AW",1:"")
+6 IF $EXTRACT(IOST)'="C"
IF $LENGTH($GET(ORSWDN))
SET ORSLTR=$EXTRACT(ORSWDN,1,(IOM\15))
DO ^ORSLTR
+7 IF ORSHORT
DO PTOP^ORPRS05(0,ORTIT,ORSHORT,ORSSTRT,ORSSTOP)
+8 SET (NEXTP,OREND)=0
+9 FOR
SET NEXTP=$ORDER(ORSCPAT(NEXTP))
IF NEXTP=""!(OREND=1)
QUIT
Begin DoDot:1
+10 SET ORVP=+ORSCPAT(NEXTP)_";DPT("
+11 DO EN^ORQ1(ORVP,ORDG,+ORPRES,0,+ORSSTRT,+ORSSTOP,0,1,ORAW)
+12 NEW ORPI,ORPA,ORPN,X,ORPIFN
+13 SET ORPI=0
FOR
SET ORPI=$ORDER(^TMP("ORR",$JOB,ORLIST,ORPI))
IF 'ORPI
QUIT
Begin DoDot:2
+14 SET ORPIFN=+^TMP("ORR",$JOB,ORLIST,ORPI)
SET ORPA=$PIECE(^(ORPI),";",2)
+15 IF $DATA(^OR(100,ORPIFN,8,ORPA,0))
SET X=^(0)
SET ORPN=$PIECE(X,"^",12)
+16 IF $GET(ORPN)
IF $DATA(^ORD(100.02,ORPN,1))
IF '$PIECE(^(1),"^",3)
KILL ^TMP("ORR",$JOB,ORLIST,ORPI)
End DoDot:2
+17 IF $$GET^XPAR("ALL","ORPF SUMMARY SORT FORWARD",1,"I")
DO SORT^ORPRS02
+18 DO @$SELECT(ORSHORT:"EN^ORPRS04",1:"EN^ORPRS03")
+19 KILL ^TMP("ORR",$JOB,ORLIST)
End DoDot:1
+20 IF ORSHORT
WRITE !
END ; Clean up variables
+1 KILL I,II,J,K,NEXTP,NB,ND,NS,ORSLTR,ORES,ODATE,ORAGE,ORDCFC,ORMD,ORDG,ORDIC,ORDOB,OREND,ORFT,ORGRP,ORH,ORH2,ORHI,ORIO,ORL,ORLST,ORODT,ORNP,ORPD,ORPFG,ORPNM,ORPRES,ORUSER,ORPV,ORREQ
+2 KILL ORSEL,ORSEQ,ORSEX,ORSP,ORSPAT,ORSPL,ORSSN,ORSSTOP,ORSSTRT,ORSTRT,ORSTOP,ORSTS,ORASTS,ORTIT,ORTM,ORTS,ORTX,ORVP,ORWARD,ORX,X,X1,Y,%,%DT,%IS,ORSWD,ORSWDN,ORRPG,ORIFN
+3 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+4 QUIT