source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWLR.m@ 1361

Last change on this file since 1361 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1ORWLR ; SLC/KCM,ALB/MJK - Lab Calls ;7/20/96 15:02
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,85**;Dec 17, 1997
3 ;
4LIST(OROOT) ; -- return lists for list boxes
5 ; RPC: ORWLR REPORT LIST
6 N EOF
7 S EOF="$$END",OROOT=$NA(^TMP($J,"ORLABLIST"))
8 K @OROOT
9 D GETRPTS(.OROOT,.EOF) ; -- get list of reports
10 D GETDT^ORWRP(.OROOT,.EOF) ; -- get list of date ranges
11 Q
12GETRPTS(OROOT,EOF) ; -- get list of reports
13 N I,X,Z,Y,RPTDEF
14 S RPTDEF="^^Y^N^80"
15 D SETITEM^ORWRP(.OROOT,"[REPORT LIST]")
16 D GET64^LR7OSUM(.ORLIST)
17 S X="" F S X=$O(ORLIST(X)) Q:X="" D
18 . S Y=""
19 . F I=1:1 S Z=$P(X," ",I) Q:Z="" D
20 . . S Y=Y_$S($L(Z)>2:$E(Z)_$$LOW^XLFSTR($E(Z,2,999)),1:Z)_" "
21 . S $P(RPTDEF,U,1)=X,$P(RPTDEF,U,2)=Y
22 . D SETITEM^ORWRP(.OROOT,RPTDEF)
23 D SETITEM^ORWRP(.OROOT,.EOF)
24 Q
25RPT(OROOT,DFN,RPTID,DTRANGE,SECTION) ; -- return cum report text
26 ; RPC: ORWLR REPORT TEXT
27 IF $G(SECTION),$D(^TMP("ORLABDATA",$J,SECTION)) D G RPTQ
28 . S OROOT=$NA(^TMP("ORLABDATA",$J,SECTION))
29 N LINES,ORSUB
30 K ^TMP("ORLABDATA",$J)
31 D CUMB(DFN,RPTID,DTRANGE)
32 S LINES=$S($D(^TMP("LRH",$J,RPTID)):+^(RPTID),1:0)
33 IF LINES<241 D
34 . S OROOT=$NA(^TMP("LRC",$J))
35 . S @OROOT@(.001)="1^1"
36 ELSE D
37 . S ORSUB="ORLABDATA",OROOT=$NA(^TMP(ORSUB,$J,1))
38 . D BUILD
39RPTQ Q
40 ;
41CUMB(DFN,RPTID,DTRANGE) ; -- build tmp global w/cumulative data
42 N X,X1,IOST,IOM,ORBEG,OREND,ORSBHEAD
43 K ^TMP("LRC",$J),^TMP("LRH",$J)
44 S IOST="C-",IOM=80,X1=DT
45 S X2=-$S(DTRANGE:DTRANGE-1,1:0)
46 D C^%DTC
47 S ORBEG=X-.7641,OREND=DT+.2359
48 IF RPTID'="ALL" D
49 . S ORSBHEAD=$NA(ORSBHEAD)
50 . S ORSBHEAD(RPTID)=""
51 D EN^LR7OSUM(.OROOT,DFN,ORBEG,OREND,"",IOM,.ORSBHEAD)
52 Q
53BUILD ; -- build tmp global for report
54 N INC,CNT,MAX,SECTION,OROOT,ORI
55 S SECTION=0,MAX=20000
56 D INIT^ORWRP
57 S ORI=0
58 F S ORI=$O(^TMP("LRC",$J,ORI)) Q:'ORI S X=$G(^(ORI,0)) D
59 . I (CNT+250)>MAX D INIT^ORWRP
60 . S INC=INC+1,@OROOT@(INC)=X
61 . S CNT=CNT+$L(X)
62 D FINAL^ORWRP
63 Q
64CUM(OROOT,DFN,DAYS,ALPHA,OMEGA) ; Return cumulative report
65 N I,X,X1,X2,C,LINES,IOST,IOM,ROOT
66 S ROOT=$$SET^ORWLRR()
67 S IOST="C-",IOM=80,OROOT=$NA(^TMP("LRC",$J))
68 K ^TMP("LRC",$J),^TMP("LRH",$J)
69 Q:'$G(DFN)
70 I $L($G(DAYS)),'$G(ALPHA) S ALPHA=$$FMADD^XLFDT(DT,-DAYS),OMEGA=$$NOW^XLFDT
71 Q:'$G(ALPHA) Q:'$G(OMEGA)
72 I $$REMOTE^ORWLRR(.DFN,.ROOT) D EN^LR7OSUM(.OROOT,DFN,ALPHA,OMEGA)
73 S (I,C)=0 F S I=$O(^TMP("LRC",$J,I)) Q:I'>0 S C=C+$L(^(I,0))
74 S I=0
75 I $L($O(^TMP("LRH",$J,0))) S I=.001,^TMP("LRC",$J,I)="[HIDDEN TEXT]^" D
76 . S X="",C=2 F S X=$O(^TMP("LRH",$J,X)) Q:X="" S LINES(^(X))=X,C=C+1
77 . S $P(^TMP("LRC",$J,.001),"^",2)=C
78 . S X="" F S X=$O(LINES(X)) Q:X="" D
79 .. S I=I+.001,^TMP("LRC",$J,I)=X_"^"_LINES(X)
80 . S I=I+.001,^TMP("LRC",$J,I)="[REPORT TEXT]"
81 D CLEAN^ORWLRR(.OROOT,ROOT)
82 Q
Note: See TracBrowser for help on using the repository browser.