ECXASUR ;ALB/JAP - SUR Extract Audit Report ;5/9/14 14:59
;;3.0;DSS EXTRACTS;**8,33,44,123,149**;Dec 22, 1997;Build 27
;
EN ;entry point for SUR extract audit report
;select extract
N %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR,SITES,ECX,ECXPORT,RCNT ;149
;ecxaud=0 for 'extract' audit
S ECXERR=0
S ECXHEAD="SUR",ECXAUD=0
W !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
D AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
Q:ECXERR
;determine if facility is multidivisional
K ECX D FILE^DID(133,,"ENTRIES","ECX") S SITES=ECX("ENTRIES") K ECX
I SITES=1 S ECXALL=1
I SITES>1 D
.W !!
.S DIR(0)="Y",DIR("A")="Do you want the "_ECXHEAD_" extract audit report for all divisions"
.S DIR("B")="NO" D ^DIR K DIR
.I $G(DIRUT) S ECXERR=1 Q
.;if y=0 i.e., 'no', then ecxall=0 i.e., 'selected'
.S ECXALL=Y
I ECXERR=1 D Q
.W !!,?5,"Try again later... exiting.",!
.D AUDIT^ECXKILL
;select divisions/sites; all divisions if ecxall=1
W !
S ECXSTART=ECXARRAY("START"),ECXEND=ECXARRAY("END")
D SUR^ECXDVSN2(.ECXDIV,ECXALL,.ECXERR)
I ECXERR=1 D Q
.W !!,?5,"Try again later... exiting.",!
.D AUDIT^ECXKILL
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 #^SURGERY DIVISION^TYPE OF PROCEDURES^CPT CODE^PROCEDURE^# OF PROCEDURES",RCNT=1
.D PROCESS
.D EXPDISP^ECXUTL1
.D AUDIT^ECXKILL
;determine output device and queue if requested
S ECXPGM="PROCESS^ECXASUR",ECXDESC="SUR Extract Audit Report"
S ECXSAVE("ECXHEAD")="",ECXSAVE("ECXALL")="",ECXSAVE("ECXDIV(")="",ECXSAVE("ECXARRAY(")=""
W !
D DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
I ECXSAVE("POP")=1 D Q
.W !!,?5,"Try again later... exiting.",!
.D AUDIT^ECXKILL
I ECXSAVE("ZTSK")=0 D
.K ECXSAVE,ECXPGM,ECXDESC
.D PROCESS^ECXASUR
I IO'=IO(0) D ^%ZISC
D HOME^%ZIS
D AUDIT^ECXKILL
Q
;
PROCESS ;process data in file #727.811
N X,Y,JJ,DIV,IEN,DATA,DATE,CASE,CASES,OR,LOC,PROC,PROCN,PSI,CAN,CPT,DIC,QQFLG,CNT
K ^TMP($J,"ECXAUD"),^TMP($J,"ECXS")
S (CNT,QQFLG)=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 within date range and surgery site(s)
S IEN="" F S IEN=$O(^ECX(727.811,"AC",ECXEXT,IEN)) Q:IEN="" D Q:QQFLG
.S DATA=^ECX(727.811,IEN,0),DATA1=^(1),DATE=$P(DATA,U,9)
.S DIV=$P(DATA,U,4)
.;convert free text date to fm internal format date
.S $E(DATE,1,2)=$E(DATE,1,2)-17
.Q:$L(DATE)<7 Q:(DATE<ECXSTART) Q:(DATE>ECXEND)
.Q:'$D(ECXDIV(DIV))
.Q:$P(DATA,U,17)="I"
.S CASE=$P(DATA,U,10),OR=$P(DATA,U,12),PSI=$P(DATA,U,17)
.S CAN=$P(DATA,U,28)
.S PROC=$E($P(DATA1,U,11),1,5)
.Q:(PROC="")&(PSI="I")
.S (CPT,PROCN)="" I PROC]"" D
..;from cpt code get procedure name; variable cpt should be same as variable proc
..S Y=$$CPT^ICPTCOD(PROC,DATE)
..S CPT=$P($G(Y),U,2),PROCN=$P($G(Y),U,3)
.S:CPT="" CPT="Unknown" S:PROCN="" PROCN="Unknown" S CPT="A"_CPT
.S LOC=$S(OR="":2,1:1)
.I CAN'="" S LOC=3
.;tally procedures by location and division
.I '$D(^TMP($J,"ECXAUD",DIV,LOC,CPT)) S ^TMP($J,"ECXAUD",DIV,LOC,CPT)=0_U_PROCN
.S $P(^(CPT),U,1)=$P(^TMP($J,"ECXAUD",DIV,LOC,CPT),U,1)+1,CNT=CNT+1
.I $D(ZTQUEUED),(CNT>499),'(CNT#500),$$S^%ZTLOAD S QQFLG=1,ZTSTOP=1 K ZTREQ Q
.I '$D(^TMP($J,"ECXS",DIV,LOC,CASE)) S ^TMP($J,"ECXS",DIV,LOC,CASE)=""
;total cases for each division and location
I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
S DIV="" F S DIV=$O(^TMP($J,"ECXS",DIV)) Q:DIV="" F LOC=1:1:3 S CASES(DIV,LOC)=0,CASE="" D
.F S CASE=$O(^TMP($J,"ECXS",DIV,LOC,CASE)) Q:CASE="" S CASES(DIV,LOC)=CASES(DIV,LOC)+1
K ^TMP($J,"ECXS")
;print the report
D PRINT
I $G(ECXPORT) Q ;149
D AUDIT^ECXKILL
Q
;
PRINT ;print the SUR audit report by location and division
N LN,PG,QFLG,TOT,GTOT,DIVNM,CPT,CPTN,PROCN,LOCNM,LOCNMC,SS,DIR,DR,DIRUT,DTOUT,DUOUT
U IO
I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
S (QFLG,PG)=0,$P(LN,"-",80)="",DIV=""
F S DIV=$O(ECXDIV(DIV)) Q:DIV="" F LOC=1:1:3 D Q:QFLG
.S DIVNM=$P(ECXDIV(DIV),U,2)_" ("_DIV_")",GTOT(LOC)=0
.S LOCNM=$S(LOC=1:"O.R. Surgical Procedures",LOC=2:"Non-O.R. Surgical Procedures",1:"Cancelled/Aborted Procedures")
.I '$G(ECXPORT) D HEADER ;149
.I '$D(^TMP($J,"ECXAUD",DIV,LOC)) D
..I $G(ECXPORT) S ^TMP($J,"ECXPORT",RCNT)=ECXARRAY("EXTRACT")_U_DIVNM_U_"No data available for "_LOCNM,RCNT=RCNT+1 Q ;149
..W !!,?3,"No data available for "_LOCNM_".",!!
.I $D(^TMP($J,"ECXAUD",DIV,LOC)) S CPT="" F S CPT=$O(^TMP($J,"ECXAUD",DIV,LOC,CPT)) Q:CPT="" S TOT(LOC)=$P(^(CPT),U,1),PROCN=$P(^(CPT),U,2),CPTN=$E(CPT,2,99) D Q:QFLG
..S GTOT(LOC)=GTOT(LOC)+TOT(LOC)
..;write procedure and total
..I '$G(ECXPORT) D:($Y+3>IOSL) HEADER Q:QFLG W !,?3,CPTN,?14,$E(PROCN,1,40),?63,$$RJ^XLFSTR(TOT(LOC),5," ") ;149
..I $G(ECXPORT) S ^TMP($J,"ECXPORT",RCNT)=ECXARRAY("EXTRACT")_U_DIVNM_U_LOCNM_U_CPTN_U_PROCN_U_TOT(LOC),RCNT=RCNT+1 ;149
.;write the division totals
.I $G(ECXPORT) D Q ;149 Section added
..S ^TMP($J,"ECXPORT",RCNT)="^",RCNT=RCNT+1
..S ^TMP($J,"ECXPORT",RCNT)="^For Division "_DIVNM_"^^^"_"Total "_LOCNM_U_GTOT(LOC),RCNT=RCNT+1
..S LOCNMC=$P(LOCNM,"Pro",1) S:'$D(CASES(DIV,LOC)) CASES(DIV,LOC)=0
..S ^TMP($J,"ECXPORT",RCNT)="^For Division "_DIVNM_"^^^"_"Total "_LOCNMC_"Cases"_U_CASES(DIV,LOC),RCNT=RCNT+1
..S ^TMP($J,"ECXPORT",RCNT)="^",RCNT=RCNT+1
.D:($Y+3>IOSL) HEADER Q:QFLG W !,?3,$E(LN,1,65)
.D:($Y+3>IOSL) HEADER Q:QFLG W !!,"For Division "_DIVNM_"--"
.D:($Y+3>IOSL) HEADER Q:QFLG W !,?3,"Total "_LOCNM_":",?63,$$RJ^XLFSTR(GTOT(LOC),5," ")
.S LOCNMC=$P(LOCNM,"Pro",1) S:'$D(CASES(DIV,LOC)) CASES(DIV,LOC)=0
.D:($Y+3>IOSL) HEADER Q:QFLG W !,?3,"Total "_LOCNMC_"Cases:",?63,$$RJ^XLFSTR(CASES(DIV,LOC),5," ")
;print the audit descriptive narrative
I $G(ECXPORT) Q ;149
I $E(IOST)'="C" D
.W @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,?68,"Page: ",PG
.W !!,LN,!!
.S DIC="^ECX(727.1,",DA=ECXARRAY("DEF"),DR="1" D EN^DIQ
I $E(IOST)="C",'QFLG D
.S SS=22-$Y F JJ=1:1:SS W !
.S DIR(0)="E" W ! D ^DIR K DIR
Q
;
Q:QFLG ;149 Don't print header if user entered "^"
N JJ,SS
I $E(IOST)="C" D
.S SS=22-$Y F JJ=1:1:SS W !
.I PG>0 S DIR(0)="E" W ! D ^DIR K DIR S:'Y QFLG=1
Q:QFLG
W:$Y!($E(IOST)="C") @IOF S PG=PG+1
W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
W !,"DSS Extract Log #: "_ECXARRAY("EXTRACT")
W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
W !,"Report Run Date/Time: "_ECXRUN
W !,"Surgery Division: "_$P(ECXDIV(DIV),U,2)_" ("_DIV_")",?63,"Page: "_PG
W !!,LOCNM
W !,?3,"CPT Code",?14,"Procedure",?63,"# of Procedures"
W !,LN,!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECXASUR 7024 printed Oct 16, 2024@17:53:03 Page 2
ECXASUR ;ALB/JAP - SUR Extract Audit Report ;5/9/14 14:59
+1 ;;3.0;DSS EXTRACTS;**8,33,44,123,149**;Dec 22, 1997;Build 27
+2 ;
EN ;entry point for SUR extract audit report
+1 ;select extract
+2 ;149
NEW %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR,SITES,ECX,ECXPORT,RCNT
+3 ;ecxaud=0 for 'extract' audit
+4 SET ECXERR=0
+5 SET ECXHEAD="SUR"
SET ECXAUD=0
+6 WRITE !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
+7 DO AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
+8 if ECXERR
QUIT
+9 ;determine if facility is multidivisional
+10 KILL ECX
DO FILE^DID(133,,"ENTRIES","ECX")
SET SITES=ECX("ENTRIES")
KILL ECX
+11 IF SITES=1
SET ECXALL=1
+12 IF SITES>1
Begin DoDot:1
+13 WRITE !!
+14 SET DIR(0)="Y"
SET DIR("A")="Do you want the "_ECXHEAD_" extract audit report for all divisions"
+15 SET DIR("B")="NO"
DO ^DIR
KILL DIR
+16 IF $GET(DIRUT)
SET ECXERR=1
QUIT
+17 ;if y=0 i.e., 'no', then ecxall=0 i.e., 'selected'
+18 SET ECXALL=Y
End DoDot:1
+19 IF ECXERR=1
Begin DoDot:1
+20 WRITE !!,?5,"Try again later... exiting.",!
+21 DO AUDIT^ECXKILL
End DoDot:1
QUIT
+22 ;select divisions/sites; all divisions if ecxall=1
+23 WRITE !
+24 SET ECXSTART=ECXARRAY("START")
SET ECXEND=ECXARRAY("END")
+25 DO SUR^ECXDVSN2(.ECXDIV,ECXALL,.ECXERR)
+26 IF ECXERR=1
Begin DoDot:1
+27 WRITE !!,?5,"Try again later... exiting.",!
+28 DO AUDIT^ECXKILL
End DoDot:1
QUIT
+29 ;149 Section added
SET ECXPORT=$$EXPORT^ECXUTL1
if ECXPORT=-1
QUIT
IF $GET(ECXPORT)
Begin DoDot:1
+30 KILL ^TMP($JOB,"ECXPORT")
+31 SET ^TMP($JOB,"ECXPORT",0)="EXTRACT LOG #^SURGERY DIVISION^TYPE OF PROCEDURES^CPT CODE^PROCEDURE^# OF PROCEDURES"
SET RCNT=1
+32 DO PROCESS
+33 DO EXPDISP^ECXUTL1
+34 DO AUDIT^ECXKILL
End DoDot:1
QUIT
+35 ;determine output device and queue if requested
+36 SET ECXPGM="PROCESS^ECXASUR"
SET ECXDESC="SUR Extract Audit Report"
+37 SET ECXSAVE("ECXHEAD")=""
SET ECXSAVE("ECXALL")=""
SET ECXSAVE("ECXDIV(")=""
SET ECXSAVE("ECXARRAY(")=""
+38 WRITE !
+39 DO DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
+40 IF ECXSAVE("POP")=1
Begin DoDot:1
+41 WRITE !!,?5,"Try again later... exiting.",!
+42 DO AUDIT^ECXKILL
End DoDot:1
QUIT
+43 IF ECXSAVE("ZTSK")=0
Begin DoDot:1
+44 KILL ECXSAVE,ECXPGM,ECXDESC
+45 DO PROCESS^ECXASUR
End DoDot:1
+46 IF IO'=IO(0)
DO ^%ZISC
+47 DO HOME^%ZIS
+48 DO AUDIT^ECXKILL
+49 QUIT
+50 ;
PROCESS ;process data in file #727.811
+1 NEW X,Y,JJ,DIV,IEN,DATA,DATE,CASE,CASES,OR,LOC,PROC,PROCN,PSI,CAN,CPT,DIC,QQFLG,CNT
+2 KILL ^TMP($JOB,"ECXAUD"),^TMP($JOB,"ECXS")
+3 SET (CNT,QQFLG)=0
+4 SET ECXEXT=ECXARRAY("EXTRACT")
SET ECXDEF=ECXARRAY("DEF")
+5 SET X=ECXARRAY("START")
DO ^%DT
SET ECXSTART=Y
SET X=ECXARRAY("END")
DO ^%DT
SET ECXEND=Y
+6 ;get run date in external format
+7 DO NOW^%DTC
SET Y=$EXTRACT(%,1,12)
DO DD^%DT
SET ECXRUN=Y
+8 ;get records within date range and surgery site(s)
+9 SET IEN=""
FOR
SET IEN=$ORDER(^ECX(727.811,"AC",ECXEXT,IEN))
if IEN=""
QUIT
Begin DoDot:1
+10 SET DATA=^ECX(727.811,IEN,0)
SET DATA1=^(1)
SET DATE=$PIECE(DATA,U,9)
+11 SET DIV=$PIECE(DATA,U,4)
+12 ;convert free text date to fm internal format date
+13 SET $EXTRACT(DATE,1,2)=$EXTRACT(DATE,1,2)-17
+14 if $LENGTH(DATE)<7
QUIT
if (DATE<ECXSTART)
QUIT
if (DATE>ECXEND)
QUIT
+15 if '$DATA(ECXDIV(DIV))
QUIT
+16 if $PIECE(DATA,U,17)="I"
QUIT
+17 SET CASE=$PIECE(DATA,U,10)
SET OR=$PIECE(DATA,U,12)
SET PSI=$PIECE(DATA,U,17)
+18 SET CAN=$PIECE(DATA,U,28)
+19 SET PROC=$EXTRACT($PIECE(DATA1,U,11),1,5)
+20 if (PROC="")&(PSI="I")
QUIT
+21 SET (CPT,PROCN)=""
IF PROC]""
Begin DoDot:2
+22 ;from cpt code get procedure name; variable cpt should be same as variable proc
+23 SET Y=$$CPT^ICPTCOD(PROC,DATE)
+24 SET CPT=$PIECE($GET(Y),U,2)
SET PROCN=$PIECE($GET(Y),U,3)
End DoDot:2
+25 if CPT=""
SET CPT="Unknown"
if PROCN=""
SET PROCN="Unknown"
SET CPT="A"_CPT
+26 SET LOC=$SELECT(OR="":2,1:1)
+27 IF CAN'=""
SET LOC=3
+28 ;tally procedures by location and division
+29 IF '$DATA(^TMP($JOB,"ECXAUD",DIV,LOC,CPT))
SET ^TMP($JOB,"ECXAUD",DIV,LOC,CPT)=0_U_PROCN
+30 SET $PIECE(^(CPT),U,1)=$PIECE(^TMP($JOB,"ECXAUD",DIV,LOC,CPT),U,1)+1
SET CNT=CNT+1
+31 IF $DATA(ZTQUEUED)
IF (CNT>499)
IF '(CNT#500)
IF $$S^%ZTLOAD
SET QQFLG=1
SET ZTSTOP=1
KILL ZTREQ
QUIT
+32 IF '$DATA(^TMP($JOB,"ECXS",DIV,LOC,CASE))
SET ^TMP($JOB,"ECXS",DIV,LOC,CASE)=""
End DoDot:1
if QQFLG
QUIT
+33 ;total cases for each division and location
+34 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
KILL ZTREQ
QUIT
+35 SET DIV=""
FOR
SET DIV=$ORDER(^TMP($JOB,"ECXS",DIV))
if DIV=""
QUIT
FOR LOC=1:1:3
SET CASES(DIV,LOC)=0
SET CASE=""
Begin DoDot:1
+36 FOR
SET CASE=$ORDER(^TMP($JOB,"ECXS",DIV,LOC,CASE))
if CASE=""
QUIT
SET CASES(DIV,LOC)=CASES(DIV,LOC)+1
End DoDot:1
+37 KILL ^TMP($JOB,"ECXS")
+38 ;print the report
+39 DO PRINT
+40 ;149
IF $GET(ECXPORT)
QUIT
+41 DO AUDIT^ECXKILL
+42 QUIT
+43 ;
PRINT ;print the SUR audit report by location and division
+1 NEW LN,PG,QFLG,TOT,GTOT,DIVNM,CPT,CPTN,PROCN,LOCNM,LOCNMC,SS,DIR,DR,DIRUT,DTOUT,DUOUT
+2 USE IO
+3 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
KILL ZTREQ
QUIT
+4 SET (QFLG,PG)=0
SET $PIECE(LN,"-",80)=""
SET DIV=""
+5 FOR
SET DIV=$ORDER(ECXDIV(DIV))
if DIV=""
QUIT
FOR LOC=1:1:3
Begin DoDot:1
+6 SET DIVNM=$PIECE(ECXDIV(DIV),U,2)_" ("_DIV_")"
SET GTOT(LOC)=0
+7 SET LOCNM=$SELECT(LOC=1:"O.R. Surgical Procedures",LOC=2:"Non-O.R. Surgical Procedures",1:"Cancelled/Aborted Procedures")
+8 ;149
IF '$GET(ECXPORT)
DO HEADER
+9 IF '$DATA(^TMP($JOB,"ECXAUD",DIV,LOC))
Begin DoDot:2
+10 ;149
IF $GET(ECXPORT)
SET ^TMP($JOB,"ECXPORT",RCNT)=ECXARRAY("EXTRACT")_U_DIVNM_U_"No data available for "_LOCNM
SET RCNT=RCNT+1
QUIT
+11 WRITE !!,?3,"No data available for "_LOCNM_".",!!
End DoDot:2
+12 IF $DATA(^TMP($JOB,"ECXAUD",DIV,LOC))
SET CPT=""
FOR
SET CPT=$ORDER(^TMP($JOB,"ECXAUD",DIV,LOC,CPT))
if CPT=""
QUIT
SET TOT(LOC)=$PIECE(^(CPT),U,1)
SET PROCN=$PIECE(^(CPT),U,2)
SET CPTN=$EXTRACT(CPT,2,99)
Begin DoDot:2
+13 SET GTOT(LOC)=GTOT(LOC)+TOT(LOC)
+14 ;write procedure and total
+15 ;149
IF '$GET(ECXPORT)
if ($Y+3>IOSL)
DO HEADER
if QFLG
QUIT
WRITE !,?3,CPTN,?14,$EXTRACT(PROCN,1,40),?63,$$RJ^XLFSTR(TOT(LOC),5," ")
+16 ;149
IF $GET(ECXPORT)
SET ^TMP($JOB,"ECXPORT",RCNT)=ECXARRAY("EXTRACT")_U_DIVNM_U_LOCNM_U_CPTN_U_PROCN_U_TOT(LOC)
SET RCNT=RCNT+1
End DoDot:2
if QFLG
QUIT
+17 ;write the division totals
+18 ;149 Section added
IF $GET(ECXPORT)
Begin DoDot:2
+19 SET ^TMP($JOB,"ECXPORT",RCNT)="^"
SET RCNT=RCNT+1
+20 SET ^TMP($JOB,"ECXPORT",RCNT)="^For Division "_DIVNM_"^^^"_"Total "_LOCNM_U_GTOT(LOC)
SET RCNT=RCNT+1
+21 SET LOCNMC=$PIECE(LOCNM,"Pro",1)
if '$DATA(CASES(DIV,LOC))
SET CASES(DIV,LOC)=0
+22 SET ^TMP($JOB,"ECXPORT",RCNT)="^For Division "_DIVNM_"^^^"_"Total "_LOCNMC_"Cases"_U_CASES(DIV,LOC)
SET RCNT=RCNT+1
+23 SET ^TMP($JOB,"ECXPORT",RCNT)="^"
SET RCNT=RCNT+1
End DoDot:2
QUIT
+24 if ($Y+3>IOSL)
DO HEADER
if QFLG
QUIT
WRITE !,?3,$EXTRACT(LN,1,65)
+25 if ($Y+3>IOSL)
DO HEADER
if QFLG
QUIT
WRITE !!,"For Division "_DIVNM_"--"
+26 if ($Y+3>IOSL)
DO HEADER
if QFLG
QUIT
WRITE !,?3,"Total "_LOCNM_":",?63,$$RJ^XLFSTR(GTOT(LOC),5," ")
+27 SET LOCNMC=$PIECE(LOCNM,"Pro",1)
if '$DATA(CASES(DIV,LOC))
SET CASES(DIV,LOC)=0
+28 if ($Y+3>IOSL)
DO HEADER
if QFLG
QUIT
WRITE !,?3,"Total "_LOCNMC_"Cases:",?63,$$RJ^XLFSTR(CASES(DIV,LOC),5," ")
End DoDot:1
if QFLG
QUIT
+29 ;print the audit descriptive narrative
+30 ;149
IF $GET(ECXPORT)
QUIT
+31 IF $EXTRACT(IOST)'="C"
Begin DoDot:1
+32 WRITE @IOF
SET PG=PG+1
+33 WRITE !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
+34 WRITE !,"DSS Extract Log #: "_ECXEXT
+35 WRITE !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
+36 WRITE !,"Report Run Date/Time: "_ECXRUN,?68,"Page: ",PG
+37 WRITE !!,LN,!!
+38 SET DIC="^ECX(727.1,"
SET DA=ECXARRAY("DEF")
SET DR="1"
DO EN^DIQ
End DoDot:1
+39 IF $EXTRACT(IOST)="C"
IF 'QFLG
Begin DoDot:1
+40 SET SS=22-$Y
FOR JJ=1:1:SS
WRITE !
+41 SET DIR(0)="E"
WRITE !
DO ^DIR
KILL DIR
End DoDot:1
+42 QUIT
+43 ;
+1 ;149 Don't print header if user entered "^"
if QFLG
QUIT
+2 NEW JJ,SS
+3 IF $EXTRACT(IOST)="C"
Begin DoDot:1
+4 SET SS=22-$Y
FOR JJ=1:1:SS
WRITE !
+5 IF PG>0
SET DIR(0)="E"
WRITE !
DO ^DIR
KILL DIR
if 'Y
SET QFLG=1
End DoDot:1
+6 if QFLG
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 #: "_ECXARRAY("EXTRACT")
+10 WRITE !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
+11 WRITE !,"Report Run Date/Time: "_ECXRUN
+12 WRITE !,"Surgery Division: "_$PIECE(ECXDIV(DIV),U,2)_" ("_DIV_")",?63,"Page: "_PG
+13 WRITE !!,LOCNM
+14 WRITE !,?3,"CPT Code",?14,"Procedure",?63,"# of Procedures"
+15 WRITE !,LN,!
+16 QUIT