ECXLARA ;ALB/JRC - LAR Extract Audit Report ;3/27/14 16:10
;;3.0;DSS EXTRACTS;**105,112,120,136,149**;Dec 22, 1997;Build 27
Q
EN ;entry point for NUT extract audit report
N %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR,DIRUT,DTOUT,DUOUT,SCRNARR,REPORT
N SCRNARR,ECXERR,ECXHEAD,ECXAUD,ECXARRAY,STATUS,FLAG,ECXALL,TMP
N ZTQUEUED,ZTSTOP,ECXPORT,CNT ;149
S SCRNARR="^TMP(""ECX"",$J,""SCRNARR"")"
K @SCRNARR@("DIVISION")
S (ECXERR,FLAG)=0
;ecxaud=0 for 'extract' audit
S ECXHEAD="LAR",ECXAUD=0
W !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
;select extract
D AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
Q:ECXERR
W !!
;select divisions/sites; all divisions if ecxall=1
S ECXERR=$$NUT^ECXDVSN()
I ECXERR=1 D Q
.W !!,?5,"Try again later... exiting.",!
.K @SCRNARR@("DIVISION")
.D AUDIT^ECXKILL
S X=ECXARRAY("START") D ^%DT S ECXSTART=Y S X=ECXARRAY("END") D ^%DT S ECXEND=Y
S ECXPORT=$$EXPORT^ECXUTL1 Q:ECXPORT=-1 I $G(ECXPORT) D Q ;149 Section added
.K ^TMP($J,"ECXPORT")
.S ^TMP($J,"ECXPORT",0)="EXTRACT LOG #^DIVISION^TEST CODE^DSS TEST NAME^MONTH YEAR^TOTAL COUNT",CNT=1
.D PROCESS
.D EXPDISP^ECXUTL1
.D AUDIT^ECXKILL
W !
;determine output device and queue if requested
S ECXPGM="PROCESS^ECXLARA",ECXDESC="LAR Extract Audit Report"
S ECXSAVE("ECXHEAD")="",ECXSAVE("ECXALL")="",ECXSAVE("STATUS")="",ECXSAVE("REPORT")="",ECXSAVE("FLAG")="",ECXSAVE("ECXDIV(")="",ECXSAVE("ECXARRAY(")="",ECXSAVE("SCRNARR")="",TMP=$$OREF^DILF(SCRNARR),ECXSAVE(TMP)=""
W !
D DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
I ECXSAVE("POP")=1 D Q
.W !!,?5,"Try again later... exiting.",!
.K @SCRNARR@("DIVISION")
.D AUDIT^ECXKILL
I ECXSAVE("ZTSK")=0 D
.K ECXSAVE,ECXPGM,ECXDESC
.D PROCESS^ECXLARA
I IO'=IO(0) D ^%ZISC
D HOME^%ZIS
D AUDIT^ECXKILL
Q
;
PROCESS ;process data in file #727.824 and store in ^tmp global
N %,ARRAY,ECXEXT,ECXDEF,X,ECXSTART,ECXEND,ECXRUN,IEN,FLAG,NODE0,NODE1,DATE,DIV,TEST,I,MIN,MAX,RESULT
S ARRAY="^TMP($J,""ECXORDER"")",FLAG=0
S ECXEXT=ECXARRAY("EXTRACT"),ECXDEF=ECXARRAY("DEF")
S X=ECXARRAY("START") D ^%DT S ECXSTART=Y S X=ECXARRAY("END") D ^%DT S ECXEND=Y
;get run date in external format
D NOW^%DTC S Y=$E(%,1,12) D DD^%DT S ECXRUN=Y
;get records in date range and set values
S IEN=0 F S IEN=$O(^ECX(727.824,"AC",ECXEXT,IEN)) Q:IEN="" D Q:FLAG
.S NODE0=$G(^ECX(727.824,IEN,0)),NODE1=$D(^(1))
.S DIV=$P(NODE0,U,4),DATE=$P(NODE0,U,9),TEST=$P(NODE0,U,10),RESULT=$P(NODE0,U,11)
.;filter out divisions if not all selected
.Q:$G(@SCRNARR@("DIVISION"))'=1&'$D(@SCRNARR@("DIVISION",+$G(DIV)))
.;convert free text date to fm internal format date
.S $E(DATE,1,2)=$E(DATE,1,2)-17
.;check for unknowns so that they won't be lost
.F I="DIV","TEST","DATE" I @I="" S @I="UNKNOWN"
.;increment div/test count, check min/max save in ^tmp global
.S $P(^TMP($J,"ECXDSS",DIV,TEST),U)=$P($G(^TMP($J,"ECXDSS",DIV,TEST)),U)+1
.;S MIN=$P(^TMP($J,"ECXDSS",DIV,TEST),U,2)
.;S MAX=$P(^TMP($J,"ECXDSS",DIV,TEST),U,3)
.;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)
.;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:"")
.;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)
I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
D PRINT
I $G(ECXPORT) Q ;149
D AUDIT^ECXKILL
Q
;
PRINT ;print report
N PG,NODE,ECN,ECXTSTNM,DSSID ;149
U IO
I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
S PG=0,ECXTSTNM=""
I '$D(^TMP($J,"ECXDSS")) D Q
.S DIV=0 F S DIV=$O(@SCRNARR@("DIVISION",DIV)) Q:'DIV D Q:FLAG
..D HEADER Q:FLAG
..I $G(ECXPORT) S ^TMP($J,"ECXPORT",CNT)=ECXEXT_U_DSSID_U_"No data available for this division",CNT=CNT+1 Q ;149
..W !
..W !,"**************************************************"
..W !,"* No data available for this division. *"
..W !,"**************************************************"
S DIV=0 F S DIV=$O(^TMP($J,"ECXDSS",DIV)) Q:'DIV D
.D HEADER Q:FLAG
.S ECN=0 F S ECN=$O(^ECX(727.29,"AC",ECN)) Q:'ECN S TEST=$$RJ^XLFSTR(ECN,4,0),ECXTSTNM=$$GET1^DIQ(727.29,+$O(^ECX(727.29,"AC",ECN,0)),.03) D Q:FLAG
..S NODE=$S($D(^TMP($J,"ECXDSS",DIV,TEST)):^TMP($J,"ECXDSS",DIV,TEST),1:"")
..;S TEST="" F S TEST=$O(^TMP($J,"ECXDSS",DIV,TEST)) Q:TEST']"" D Q:FLAG
..;S NODE=^TMP($J,"ECXDSS",DIV,TEST)
..;S MIN=$P(^TMP($J,"ECXDSS",DIV,TEST),U,2)
..;S MAX=$P(^TMP($J,"ECXDSS",DIV,TEST),U,3)
..I '$G(ECXPORT) D:($Y+3>IOSL) HEADER Q:FLAG ;149
..I $G(ECXPORT) S ^TMP($J,"ECXPORT",CNT)=ECXEXT_U_DSSID_U_TEST_U_ECXTSTNM_U_$$ECXYMX^ECXUTL($$ECXYM^ECXUTL(DATE))_U_$S(NODE:$P(NODE,U),1:"Not in Extract"),CNT=CNT+1 Q ;149
..W !,?1,TEST,?13,ECXTSTNM,?55,$$ECXYMX^ECXUTL($$ECXYM^ECXUTL(DATE)),?65,$S(NODE:$J($P(NODE,U,1),15),1:$J("Not in Extract",15))
..;;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)
Q
;
N JJ,SS,DIR,DIRUT,DTOUT,DUOUT ;149 Moved DSSID to be NEW in print section
I '$G(ECXPORT) I $E(IOST)="C" D ;149
.S SS=22-$Y F JJ=1:1:SS W !
.I PG>0 S DIR(0)="E" W ! D ^DIR K DIR S:'Y FLAG=1
Q:FLAG
S DSSID=$S($G(DIV):$$NNT^XUAF4(DIV),1:"UNKNOWN^^"),DSSID=$P(DSSID,U)_$S($P(DSSID,U,2)'="":" ("_$P(DSSID,U,2)_")",1:"") I $G(ECXPORT) Q ;149
W:$Y!($E(IOST)="C") @IOF S PG=PG+1
W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
W !,"DSS Extract Log #: "_ECXEXT
W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
W !,"Report Run Date/Time: "_ECXRUN
W !,"Division: "_DSSID,?68,"Page: "_PG ;149
;Detailed report sub-header
Q:'$D(^TMP($J))
W !!,?1,"Test Code",?13,"DSS TEST NAME",?53,"Month Year",?69,"Total Count"
;W !!,?2,"Test Code",?14,"Month Year",?32,"Min Result",?49,"Max Result",?64,"Total Count"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECXLARA 6146 printed Oct 16, 2024@17:53:39 Page 2
ECXLARA ;ALB/JRC - LAR Extract Audit Report ;3/27/14 16:10
+1 ;;3.0;DSS EXTRACTS;**105,112,120,136,149**;Dec 22, 1997;Build 27
+2 QUIT
EN ;entry point for NUT extract audit report
+1 NEW %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR,DIRUT,DTOUT,DUOUT,SCRNARR,REPORT
+2 NEW SCRNARR,ECXERR,ECXHEAD,ECXAUD,ECXARRAY,STATUS,FLAG,ECXALL,TMP
+3 ;149
NEW ZTQUEUED,ZTSTOP,ECXPORT,CNT
+4 SET SCRNARR="^TMP(""ECX"",$J,""SCRNARR"")"
+5 KILL @SCRNARR@("DIVISION")
+6 SET (ECXERR,FLAG)=0
+7 ;ecxaud=0 for 'extract' audit
+8 SET ECXHEAD="LAR"
SET ECXAUD=0
+9 WRITE !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
+10 ;select extract
+11 DO AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
+12 if ECXERR
QUIT
+13 WRITE !!
+14 ;select divisions/sites; all divisions if ecxall=1
+15 SET ECXERR=$$NUT^ECXDVSN()
+16 IF ECXERR=1
Begin DoDot:1
+17 WRITE !!,?5,"Try again later... exiting.",!
+18 KILL @SCRNARR@("DIVISION")
+19 DO AUDIT^ECXKILL
End DoDot:1
QUIT
+20 SET X=ECXARRAY("START")
DO ^%DT
SET ECXSTART=Y
SET X=ECXARRAY("END")
DO ^%DT
SET ECXEND=Y
+21 ;149 Section added
SET ECXPORT=$$EXPORT^ECXUTL1
if ECXPORT=-1
QUIT
IF $GET(ECXPORT)
Begin DoDot:1
+22 KILL ^TMP($JOB,"ECXPORT")
+23 SET ^TMP($JOB,"ECXPORT",0)="EXTRACT LOG #^DIVISION^TEST CODE^DSS TEST NAME^MONTH YEAR^TOTAL COUNT"
SET CNT=1
+24 DO PROCESS
+25 DO EXPDISP^ECXUTL1
+26 DO AUDIT^ECXKILL
End DoDot:1
QUIT
+27 WRITE !
+28 ;determine output device and queue if requested
+29 SET ECXPGM="PROCESS^ECXLARA"
SET ECXDESC="LAR Extract Audit Report"
+30 SET ECXSAVE("ECXHEAD")=""
SET ECXSAVE("ECXALL")=""
SET ECXSAVE("STATUS")=""
SET ECXSAVE("REPORT")=""
SET ECXSAVE("FLAG")=""
SET ECXSAVE("ECXDIV(")=""
SET ECXSAVE("ECXARRAY(")=""
SET ECXSAVE("SCRNARR")=""
SET TMP=$$OREF^DILF(SCRNARR)
SET ECXSAVE(TMP)=""
+31 WRITE !
+32 DO DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
+33 IF ECXSAVE("POP")=1
Begin DoDot:1
+34 WRITE !!,?5,"Try again later... exiting.",!
+35 KILL @SCRNARR@("DIVISION")
+36 DO AUDIT^ECXKILL
End DoDot:1
QUIT
+37 IF ECXSAVE("ZTSK")=0
Begin DoDot:1
+38 KILL ECXSAVE,ECXPGM,ECXDESC
+39 DO PROCESS^ECXLARA
End DoDot:1
+40 IF IO'=IO(0)
DO ^%ZISC
+41 DO HOME^%ZIS
+42 DO AUDIT^ECXKILL
+43 QUIT
+44 ;
PROCESS ;process data in file #727.824 and store in ^tmp global
+1 NEW %,ARRAY,ECXEXT,ECXDEF,X,ECXSTART,ECXEND,ECXRUN,IEN,FLAG,NODE0,NODE1,DATE,DIV,TEST,I,MIN,MAX,RESULT
+2 SET ARRAY="^TMP($J,""ECXORDER"")"
SET FLAG=0
+3 SET ECXEXT=ECXARRAY("EXTRACT")
SET ECXDEF=ECXARRAY("DEF")
+4 SET X=ECXARRAY("START")
DO ^%DT
SET ECXSTART=Y
SET X=ECXARRAY("END")
DO ^%DT
SET ECXEND=Y
+5 ;get run date in external format
+6 DO NOW^%DTC
SET Y=$EXTRACT(%,1,12)
DO DD^%DT
SET ECXRUN=Y
+7 ;get records in date range and set values
+8 SET IEN=0
FOR
SET IEN=$ORDER(^ECX(727.824,"AC",ECXEXT,IEN))
if IEN=""
QUIT
Begin DoDot:1
+9 SET NODE0=$GET(^ECX(727.824,IEN,0))
SET NODE1=$DATA(^(1))
+10 SET DIV=$PIECE(NODE0,U,4)
SET DATE=$PIECE(NODE0,U,9)
SET TEST=$PIECE(NODE0,U,10)
SET RESULT=$PIECE(NODE0,U,11)
+11 ;filter out divisions if not all selected
+12 if $GET(@SCRNARR@("DIVISION"))'=1&'$DATA(@SCRNARR@("DIVISION",+$GET(DIV)))
QUIT
+13 ;convert free text date to fm internal format date
+14 SET $EXTRACT(DATE,1,2)=$EXTRACT(DATE,1,2)-17
+15 ;check for unknowns so that they won't be lost
+16 FOR I="DIV","TEST","DATE"
IF @I=""
SET @I="UNKNOWN"
+17 ;increment div/test count, check min/max save in ^tmp global
+18 SET $PIECE(^TMP($JOB,"ECXDSS",DIV,TEST),U)=$PIECE($GET(^TMP($JOB,"ECXDSS",DIV,TEST)),U)+1
+19 ;S MIN=$P(^TMP($J,"ECXDSS",DIV,TEST),U,2)
+20 ;S MAX=$P(^TMP($J,"ECXDSS",DIV,TEST),U,3)
+21 ;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)
+22 ;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:"")
+23 ;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)
End DoDot:1
if FLAG
QUIT
+24 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
KILL ZTREQ
QUIT
+25 DO PRINT
+26 ;149
IF $GET(ECXPORT)
QUIT
+27 DO AUDIT^ECXKILL
+28 QUIT
+29 ;
PRINT ;print report
+1 ;149
NEW PG,NODE,ECN,ECXTSTNM,DSSID
+2 USE IO
+3 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
KILL ZTREQ
QUIT
+4 SET PG=0
SET ECXTSTNM=""
+5 IF '$DATA(^TMP($JOB,"ECXDSS"))
Begin DoDot:1
+6 SET DIV=0
FOR
SET DIV=$ORDER(@SCRNARR@("DIVISION",DIV))
if 'DIV
QUIT
Begin DoDot:2
+7 DO HEADER
if FLAG
QUIT
+8 ;149
IF $GET(ECXPORT)
SET ^TMP($JOB,"ECXPORT",CNT)=ECXEXT_U_DSSID_U_"No data available for this division"
SET CNT=CNT+1
QUIT
+9 WRITE !
+10 WRITE !,"**************************************************"
+11 WRITE !,"* No data available for this division. *"
+12 WRITE !,"**************************************************"
End DoDot:2
if FLAG
QUIT
End DoDot:1
QUIT
+13 SET DIV=0
FOR
SET DIV=$ORDER(^TMP($JOB,"ECXDSS",DIV))
if 'DIV
QUIT
Begin DoDot:1
+14 DO HEADER
if FLAG
QUIT
+15 SET ECN=0
FOR
SET ECN=$ORDER(^ECX(727.29,"AC",ECN))
if 'ECN
QUIT
SET TEST=$$RJ^XLFSTR(ECN,4,0)
SET ECXTSTNM=$$GET1^DIQ(727.29,+$ORDER(^ECX(727.29,"AC",ECN,0)),.03)
Begin DoDot:2
+16 SET NODE=$SELECT($DATA(^TMP($JOB,"ECXDSS",DIV,TEST)):^TMP($JOB,"ECXDSS",DIV,TEST),1:"")
+17 ;S TEST="" F S TEST=$O(^TMP($J,"ECXDSS",DIV,TEST)) Q:TEST']"" D Q:FLAG
+18 ;S NODE=^TMP($J,"ECXDSS",DIV,TEST)
+19 ;S MIN=$P(^TMP($J,"ECXDSS",DIV,TEST),U,2)
+20 ;S MAX=$P(^TMP($J,"ECXDSS",DIV,TEST),U,3)
+21 ;149
IF '$GET(ECXPORT)
if ($Y+3>IOSL)
DO HEADER
if FLAG
QUIT
+22 ;149
IF $GET(ECXPORT)
SET ^TMP($JOB,"ECXPORT",CNT)=ECXEXT_U_DSSID_U_TEST_U_ECXTSTNM_U_$$ECXYMX^ECXUTL($$ECXYM^ECXUTL(DATE))_U_$SELECT(NODE:$PIECE(NODE,U),1:"Not in Extract")
SET CNT=CNT+1
QUIT
+23 WRITE !,?1,TEST,?13,ECXTSTNM,?55,$$ECXYMX^ECXUTL($$ECXYM^ECXUTL(DATE)),?65,$SELECT(NODE:$JUSTIFY($PIECE(NODE,U,1),15),1:$JUSTIFY("Not in Extract",15))
+24 ;;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)
End DoDot:2
if FLAG
QUIT
End DoDot:1
+25 QUIT
+26 ;
+1 ;149 Moved DSSID to be NEW in print section
NEW JJ,SS,DIR,DIRUT,DTOUT,DUOUT
+2 ;149
IF '$GET(ECXPORT)
IF $EXTRACT(IOST)="C"
Begin DoDot:1
+3 SET SS=22-$Y
FOR JJ=1:1:SS
WRITE !
+4 IF PG>0
SET DIR(0)="E"
WRITE !
DO ^DIR
KILL DIR
if 'Y
SET FLAG=1
End DoDot:1
+5 if FLAG
QUIT
+6 ;149
SET DSSID=$SELECT($GET(DIV):$$NNT^XUAF4(DIV),1:"UNKNOWN^^")
SET DSSID=$PIECE(DSSID,U)_$SELECT($PIECE(DSSID,U,2)'="":" ("_$PIECE(DSSID,U,2)_")",1:"")
IF $GET(ECXPORT)
QUIT
+7 if $Y!($EXTRACT(IOST)="C")
WRITE @IOF
SET PG=PG+1
+8 WRITE !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
+9 WRITE !,"DSS Extract Log #: "_ECXEXT
+10 WRITE !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
+11 WRITE !,"Report Run Date/Time: "_ECXRUN
+12 ;149
WRITE !,"Division: "_DSSID,?68,"Page: "_PG
+13 ;Detailed report sub-header
+14 if '$DATA(^TMP($JOB))
QUIT
+15 WRITE !!,?1,"Test Code",?13,"DSS TEST NAME",?53,"Month Year",?69,"Total Count"
+16 ;W !!,?2,"Test Code",?14,"Month Year",?32,"Min Result",?49,"Max Result",?64,"Total Count"
+17 QUIT