source: FOIAVistA/trunk/r/DSS_EXTRACTS-ECX/ECXLARA.m@ 1169

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

initial load of FOIAVistA 6/30/08 version

File size: 4.8 KB
Line 
1ECXLARA ;ALB/JRC - LAR Extract Audit Report ; 6/7/07 6:58am
2 ;;3.0;DSS EXTRACTS;**105**;Dec 22, 1997;Build 70
3 Q
4EN ;entry point for NUT extract audit report
5 N %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR,DIRUT,DTOUT,DUOUT,SCRNARR,REPORT
6 N SCRNARR,ECXERR,ECXHEAD,ECXAUD,ECXARRAY,STATUS,FLAG,ECXALL,TMP
7 N ZTQUEUED,ZTSTOP
8 S SCRNARR="^TMP(""ECX"",$J,""SCRNARR"")"
9 K @SCRNARR@("DIVISION")
10 S (ECXERR,FLAG)=0
11 ;ecxaud=0 for 'extract' audit
12 S ECXHEAD="LAR",ECXAUD=0
13 W !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
14 ;select extract
15 D AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
16 Q:ECXERR
17 W !!
18 ;select divisions/sites; all divisions if ecxall=1
19 S ECXERR=$$NUT^ECXDVSN()
20 I ECXERR=1 D Q
21 .W !!,?5,"Try again later... exiting.",!
22 .K @SCRNARR@("DIVISION")
23 .D AUDIT^ECXKILL
24 S X=ECXARRAY("START") D ^%DT S ECXSTART=Y S X=ECXARRAY("END") D ^%DT S ECXEND=Y
25 W !
26 ;determine output device and queue if requested
27 S ECXPGM="PROCESS^ECXLARA",ECXDESC="LAR Extract Audit Report"
28 S ECXSAVE("ECXHEAD")="",ECXSAVE("ECXALL")="",ECXSAVE("STATUS")="",ECXSAVE("REPORT")="",ECXSAVE("FLAG")="",ECXSAVE("ECXDIV(")="",ECXSAVE("ECXARRAY(")="",ECXSAVE("SCRNARR")="",TMP=$$OREF^DILF(SCRNARR),ECXSAVE(TMP)=""
29 W !
30 D DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
31 I ECXSAVE("POP")=1 D Q
32 .W !!,?5,"Try again later... exiting.",!
33 .K @SCRNARR@("DIVISION")
34 .D AUDIT^ECXKILL
35 I ECXSAVE("ZTSK")=0 D
36 .K ECXSAVE,ECXPGM,ECXDESC
37 .D PROCESS^ECXLARA
38 I IO'=IO(0) D ^%ZISC
39 D HOME^%ZIS
40 D AUDIT^ECXKILL
41 Q
42 ;
43PROCESS ;process data in file #727.824 and store in ^tmp global
44 N %,ARRAY,ECXEXT,ECXDEF,X,ECXSTART,ECXEND,ECXRUN,IEN,FLAG,NODE0,NODE1,DATE,DIV,TEST,I,MIN,MAX,RESULT
45 S ARRAY="^TMP($J,""ECXORDER"")",FLAG=0
46 S ECXEXT=ECXARRAY("EXTRACT"),ECXDEF=ECXARRAY("DEF")
47 S X=ECXARRAY("START") D ^%DT S ECXSTART=Y S X=ECXARRAY("END") D ^%DT S ECXEND=Y
48 ;get run date in external format
49 D NOW^%DTC S Y=$E(%,1,12) D DD^%DT S ECXRUN=Y
50 ;get records in date range and set values
51 S IEN=0 F S IEN=$O(^ECX(727.824,"AC",ECXEXT,IEN)) Q:IEN="" D Q:FLAG
52 .S NODE0=$G(^ECX(727.824,IEN,0)),NODE1=$D(^(1))
53 .S DIV=$P(NODE0,U,4),DATE=$P(NODE0,U,9),TEST=$P(NODE0,U,10),RESULT=$P(NODE0,U,11)
54 .;filter out divisions if not all selected
55 .Q:$G(@SCRNARR@("DIVISION"))'=1&'$D(@SCRNARR@("DIVISION",+$G(DIV)))
56 .;convert free text date to fm internal format date
57 .S $E(DATE,1,2)=$E(DATE,1,2)-17
58 .Q:$L(DATE)<7 Q:(DATE<ECXSTART) Q:(DATE>ECXEND)
59 .;check for unknowns so that they won't be lost
60 .F I="DIV","TEST","DATE" I @I="" S @I="UNKNOWN"
61 .;increment div/test count, check min/max save in ^tmp global
62 .S $P(^TMP($J,"ECXDSS",DIV,TEST),U)=$P($G(^TMP($J,"ECXDSS",DIV,TEST)),U)+1
63 .S MIN=$P(^TMP($J,"ECXDSS",DIV,TEST),U,2)
64 .S MAX=$P(^TMP($J,"ECXDSS",DIV,TEST),U,3)
65 .;S $P(^TMP($J,"ECXDSS",DIV,TEST),U,2)=$S(MIN']"":RESULT,RESULT<MIN:RESULT,1:MIN),$P(^(TEST),U,3)=$S(RESULT>MAX:RESULT,1:MAX)
66 .;S $P(^TMP($J,"ECXDSS",DIV,TEST),U,2)=$S(RESULT["NEG":"NEG",+RESULT<+MIN:RESULT,1:""),$P(^(TEST),U,3)=$S(RESULT["POS":"POS",RESULT>MAX:RESULT,1:"")
67 .S $P(^TMP($J,"ECXDSS",DIV,TEST),U,2)=$S(RESULT["NEG":"NEG",MIN']"":RESULT,+RESULT'=0&RESULT<MIN:RESULT,1:MIN),$P(^(TEST),U,3)=$S(RESULT["POS":"POS",MAX']""&RESULT'=0:RESULT,RESULT>MAX:RESULT,1:MAX)
68 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
69 D PRINT
70 D AUDIT^ECXKILL
71 Q
72 ;
73PRINT ;print report
74 N PG,NODE
75 U IO
76 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
77 S PG=0
78 I '$D(^TMP($J,"ECXDSS")) D Q
79 .S DIV=0 F S DIV=$O(@SCRNARR@("DIVISION",DIV)) Q:'DIV D Q:FLAG
80 ..D HEADER Q:FLAG
81 ..W !
82 ..W !,"**************************************************"
83 ..W !,"* No data available for this division. *"
84 ..W !,"**************************************************"
85 S DIV=0 F S DIV=$O(^TMP($J,"ECXDSS",DIV)) Q:'DIV D
86 .D HEADER Q:FLAG
87 .S TEST="" F S TEST=$O(^TMP($J,"ECXDSS",DIV,TEST)) Q:TEST']"" D Q:FLAG
88 ..S NODE=^TMP($J,"ECXDSS",DIV,TEST)
89 ..S MIN=$P(^TMP($J,"ECXDSS",DIV,TEST),U,2)
90 ..S MAX=$P(^TMP($J,"ECXDSS",DIV,TEST),U,3)
91 ..D:($Y+3>IOSL) HEADER Q:FLAG
92 ..W !,?4,TEST,?14,$$ECXYMX^ECXUTL($$ECXYM^ECXUTL(DATE)),?27,$S(MIN["NEG":$J("NEG",15),1:$J(MIN,15,4)),?44,$S(MAX["POS":$J("POS",15),MAX>0:$J(MAX,15,4),1:""),?60,$J($P(NODE,U,1),15)
93 Q
94 ;
95HEADER ;header and page control
96 N JJ,SS,DIR,DIRUT,DTOUT,DUOUT,DSSID
97 I $E(IOST)="C" D
98 .S SS=22-$Y F JJ=1:1:SS W !
99 .I PG>0 S DIR(0)="E" W ! D ^DIR K DIR S:'Y FLAG=1
100 Q:FLAG
101 S DSSID=$S($G(DIV):$$NNT^XUAF4(DIV),1:"UNKNOWN^^")
102 W:$Y!($E(IOST)="C") @IOF S PG=PG+1
103 W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
104 W !,"DSS Extract Log #: "_ECXEXT
105 W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
106 W !,"Report Run Date/Time: "_ECXRUN
107 W !,"Division: "_$P(DSSID,U)_$S($P(DSSID,U,2)'="":" ("_$P(DSSID,U,2)_")",1:""),?68,"Page: "_PG
108 ;Detailed report sub-header
109 Q:'$D(^TMP($J))
110 W !!,?2,"Test Code",?14,"Month Year",?32,"Min Result",?49,"Max Result",?64,"Total Count"
111 Q
Note: See TracBrowser for help on using the repository browser.