Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ORWLR

ORWLR.m

Go to the documentation of this file.
ORWLR ; SLC/KCM,ALB/MJK - Lab Calls ;7/20/96  15:02
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,85,332**;Dec 17, 1997;Build 44
 ;
LIST(OROOT) ; -- return lists for list boxes
 ;  RPC: ORWLR REPORT LIST
 N EOF
 S EOF="$$END",OROOT=$NA(^TMP($J,"ORLABLIST"))
 K @OROOT
 D GETRPTS(.OROOT,.EOF) ; -- get list of reports
 D GETDT^ORWRP(.OROOT,.EOF) ; -- get list of date ranges
 Q
GETRPTS(OROOT,EOF) ;  -- get list of reports
 N I,X,Z,Y,RPTDEF
 S RPTDEF="^^Y^N^80"
 D SETITEM^ORWRP(.OROOT,"[REPORT LIST]")
 D GET64^LR7OSUM(.ORLIST)
 S X="" F  S X=$O(ORLIST(X)) Q:X=""  D
 . S Y=""
 . F I=1:1 S Z=$P(X," ",I) Q:Z=""  D
 . . S Y=Y_$S($L(Z)>2:$E(Z)_$$LOW^XLFSTR($E(Z,2,999)),1:Z)_" "
 . S $P(RPTDEF,U,1)=X,$P(RPTDEF,U,2)=Y
 . D SETITEM^ORWRP(.OROOT,RPTDEF)
 D SETITEM^ORWRP(.OROOT,.EOF)
 Q
RPT(OROOT,DFN,RPTID,DTRANGE,SECTION) ; -- return cum report text
 ;  RPC: ORWLR REPORT TEXT
 IF $G(SECTION),$D(^TMP("ORLABDATA",$J,SECTION)) D  G RPTQ
 . S OROOT=$NA(^TMP("ORLABDATA",$J,SECTION))
 N LINES,ORSUB
 K ^TMP("ORLABDATA",$J)
 D CUMB(DFN,RPTID,DTRANGE)
 S LINES=$S($D(^TMP("LRH",$J,RPTID)):+^(RPTID),1:0)
 IF LINES<241 D
 . S OROOT=$NA(^TMP("LRC",$J))
 . S @OROOT@(.001)="1^1"
 ELSE  D
 . S ORSUB="ORLABDATA",OROOT=$NA(^TMP(ORSUB,$J,1))
 . D BUILD
RPTQ Q
 ;
CUMB(DFN,RPTID,DTRANGE) ; -- build tmp global w/cumulative data
 N X,X1,IOST,IOM,ORBEG,OREND,ORSBHEAD
 K ^TMP("LRC",$J),^TMP("LRH",$J)
 S IOST="C-",IOM=80,X1=DT
 S X2=-$S(DTRANGE:DTRANGE-1,1:0)
 D C^%DTC
 S ORBEG=X-.7641,OREND=DT+.2359
 IF RPTID'="ALL" D
 . S ORSBHEAD=$NA(ORSBHEAD)
 . S ORSBHEAD(RPTID)=""
 D EN^LR7OSUM(.OROOT,DFN,ORBEG,OREND,"",IOM,.ORSBHEAD)
 Q
BUILD ; -- build tmp global for report
 N INC,CNT,MAX,SECTION,OROOT,ORI
 S SECTION=0,MAX=20000
 D INIT^ORWRP
 S ORI=0
 F  S ORI=$O(^TMP("LRC",$J,ORI)) Q:'ORI  S X=$G(^(ORI,0)) D
 . I (CNT+250)>MAX D INIT^ORWRP
 . S INC=INC+1,@OROOT@(INC)=X
 . S CNT=CNT+$L(X)
 D FINAL^ORWRP
 Q
CUM(OROOT,DFN,DAYS,ALPHA,OMEGA) ; Return cumulative report
 N I,X,X1,X2,C,LINES,IOST,IOM,ROOT
 S ROOT=$$SET^ORWLRR()
 S IOST="C-",IOM=80,OROOT=$NA(^TMP("LRC",$J))
 K ^TMP("LRC",$J),^TMP("LRH",$J)
 Q:'$G(DFN)
 I $L($G(DAYS)),'$G(ALPHA) S ALPHA=$$FMADD^XLFDT(DT,-DAYS),OMEGA=$$NOW^XLFDT
 Q:'$G(ALPHA)  Q:'$G(OMEGA)
 I $$REMOTE^ORWLRR(.DFN,.ROOT) D EN^LR7OSUM(.OROOT,DFN,ALPHA,OMEGA)
 ;S (I,C)=0 F  S I=$O(^TMP("LRC",$J,I)) Q:I'>0  S C=C+$L(^(I,0))
 S I=0
 I $L($O(^TMP("LRH",$J,0))) S I=.001,^TMP("LRC",$J,I)="[HIDDEN TEXT]^" D
 . S X="",C=2 F  S X=$O(^TMP("LRH",$J,X)) Q:X=""  S LINES(^(X))=X,C=C+1
 . S $P(^TMP("LRC",$J,.001),"^",2)=C
 . S X="" F  S X=$O(LINES(X)) Q:X=""  D
 .. S I=I+.001,^TMP("LRC",$J,I)=X_"^"_LINES(X)
 . S I=I+.001,^TMP("LRC",$J,I)="[REPORT TEXT]"
 D CLEAN^ORWLRR(.OROOT,ROOT)
 Q