ORPRS08 ; slc/dcm - Nightly Order Summary Task ;6/10/97 15:45
;;3.0;ORDER ENTRY/RESULTS REPORTING;**11,69**;Dec 17, 1997
MAIN ; Controls branching
N ORL,ORI,ORPDOS,ORDOS
D ENVAL^XPAR(.ORDOS,"ORPF DAILY ORDER SUMMARY DEVC")
D ENVAL^XPAR(.ORPDOS,"ORPF PRINT DAILY ORDER SUMMARY")
S ORL=""
F S ORL=$O(ORPDOS(ORL)) Q:ORL="" I $G(ORPDOS(ORL,1)),$G(ORDOS(ORL,1)) D LOC(ORL,ORDOS(ORL,1))
Q
LOC(ORL,ORDVC) ; Build patient list and task summary for each Inpatient location
I $S(+ORL'>0:1,ORDVC'>0:1,1:0) G LOCX
N %,%H,%I,%T,DFN,ORDT,ORPM,ORSHORT,ORSCPAT,ORSSTOP,ORSSTRT,ORTIT,X,ORSCPAT,ORSWDN
N ORPRES,ORVP,ORX,IOP,Y,ZTIO,ZTSK,ZTRTN,ZTDESC,ZTDTH,ZTSAVE
S ORSWDN=$P($G(^SC(+ORL,0)),"^")
D PATARAY(.ORSCPAT,+ORL)
I '$D(ORSCPAT) G LOCX
D NOW^%DTC
S (ORDT,X1)=$P(%,"."),(ORPM,X2)=$S($E($P(%,".",2),1,2)>12:1,1:-1)
D C^%DTC
S ORSSTRT=$S(ORPM>0:ORDT,1:X),ORSSTOP=$S(ORPM>0:X,1:ORDT),ORSHORT=$$SHORT^ORPRS02(),ORTIT="DAILY ORDER SUMMARY",ORPRES="DATE"
S ZTRTN="EN1^ORPRS10",ZTDTH=$H,ZTDESC="Daily Order Summary for "_ORSWDN,ZTIO="`"_ORDVC,ZTSAVE("O*")=""
D ^%ZTLOAD
LOCX Q
PATARAY(ORSCPAT,LOC) ;Loads patients into ORSCPAT local array
;LOC=Location
;ORVP=Patient variable pointer
Q:'$L($G(LOC))
Q:'$D(^SC(+LOC,42)) Q:'$D(^DIC(42,^(42),0)) S NAME=$P(^(0),"^")
N X,I
S I=0
F S I=$O(^DPT("CN",NAME,I)) Q:'I S X=^DPT(I,0),ORSCPAT($P(X,"^")_" "_I)=I
Q
ORPRS08 ; slc/dcm - Nightly Order Summary Task ;6/10/97 15:45
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**11,69**;Dec 17, 1997
MAIN ; Controls branching
+1 NEW ORL,ORI,ORPDOS,ORDOS
+2 DO ENVAL^XPAR(.ORDOS,"ORPF DAILY ORDER SUMMARY DEVC")
+3 DO ENVAL^XPAR(.ORPDOS,"ORPF PRINT DAILY ORDER SUMMARY")
+4 SET ORL=""
+5 FOR
SET ORL=$ORDER(ORPDOS(ORL))
IF ORL=""
QUIT
IF $GET(ORPDOS(ORL,1))
IF $GET(ORDOS(ORL,1))
DO LOC(ORL,ORDOS(ORL,1))
+6 QUIT
LOC(ORL,ORDVC) ; Build patient list and task summary for each Inpatient location
+1 IF $SELECT(+ORL'>0:1,ORDVC'>0:1,1:0)
GOTO LOCX
+2 NEW %,%H,%I,%T,DFN,ORDT,ORPM,ORSHORT,ORSCPAT,ORSSTOP,ORSSTRT,ORTIT,X,ORSCPAT,ORSWDN
+3 NEW ORPRES,ORVP,ORX,IOP,Y,ZTIO,ZTSK,ZTRTN,ZTDESC,ZTDTH,ZTSAVE
+4 SET ORSWDN=$PIECE($GET(^SC(+ORL,0)),"^")
+5 DO PATARAY(.ORSCPAT,+ORL)
+6 IF '$DATA(ORSCPAT)
GOTO LOCX
+7 DO NOW^%DTC
+8 SET (ORDT,X1)=$PIECE(%,".")
SET (ORPM,X2)=$SELECT($EXTRACT($PIECE(%,".",2),1,2)>12:1,1:-1)
+9 DO C^%DTC
+10 SET ORSSTRT=$SELECT(ORPM>0:ORDT,1:X)
SET ORSSTOP=$SELECT(ORPM>0:X,1:ORDT)
SET ORSHORT=$$SHORT^ORPRS02()
SET ORTIT="DAILY ORDER SUMMARY"
SET ORPRES="DATE"
+11 SET ZTRTN="EN1^ORPRS10"
SET ZTDTH=$HOROLOG
SET ZTDESC="Daily Order Summary for "_ORSWDN
SET ZTIO="`"_ORDVC
SET ZTSAVE("O*")=""
+12 DO ^%ZTLOAD
LOCX QUIT
PATARAY(ORSCPAT,LOC) ;Loads patients into ORSCPAT local array
+1 ;LOC=Location
+2 ;ORVP=Patient variable pointer
+3 IF '$LENGTH($GET(LOC))
QUIT
+4 IF '$DATA(^SC(+LOC,42))
QUIT
IF '$DATA(^DIC(42,^(42),0))
QUIT
SET NAME=$PIECE(^(0),"^")
+5 NEW X,I
+6 SET I=0
+7 FOR
SET I=$ORDER(^DPT("CN",NAME,I))
IF 'I
QUIT
SET X=^DPT(I,0)
SET ORSCPAT($PIECE(X,"^")_" "_I)=I
+8 QUIT