[613] | 1 | ECXSADEN ;BIR/DMA-SAS Report from Dental Extract; 31 Aug 95 / 1:40 PM
|
---|
| 2 | ;;3.0;DSS EXTRACTS;**8**;Dec 22, 1997
|
---|
| 3 | EN ;entry point from menu option
|
---|
| 4 | W @IOF,!!,"Dental Extract SAS Report",!!
|
---|
| 5 | ;ecxaud=1 for 'sas' audit
|
---|
| 6 | S ECXHEAD="DEN",ECXAUD=1
|
---|
| 7 | ;select extract
|
---|
| 8 | D AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
|
---|
| 9 | I ECXERR D AUDIT^ECXKILL Q
|
---|
| 10 | ;select all dental sites/divisions
|
---|
| 11 | S ECXALL=1 D DEN^ECXDVSN(.ECXDIV,ECXALL,.ECXERR)
|
---|
| 12 | I ECXERR D AUDIT^ECXKILL Q
|
---|
| 13 | W !!
|
---|
| 14 | S ECXPGM="PROCESS^ECXSADEN",ECXDESC="Dental Extract SAS Report"
|
---|
| 15 | S ECXSAVE("ECXHEAD")="",ECXSAVE("ECXDIV(")="",ECXSAVE("ECXARRAY(")=""
|
---|
| 16 | W !
|
---|
| 17 | D DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
|
---|
| 18 | I ECXSAVE("POP")=1 D Q
|
---|
| 19 | .W !!,?5,"Try agian later... exiting.",!
|
---|
| 20 | .D AUDIT^ECXKILL
|
---|
| 21 | I ECXSAVE("ZTSK")=0 D
|
---|
| 22 | .K ECXSAVE,ECXPGM,ECXDESC
|
---|
| 23 | .D PROCESS
|
---|
| 24 | I IO'=IO(0) D ^%ZISC
|
---|
| 25 | D HOME^%ZIS
|
---|
| 26 | D AUDIT^ECXKILL
|
---|
| 27 | Q
|
---|
| 28 | ;
|
---|
| 29 | PROCESS ;queued entry
|
---|
| 30 | N J,K,X,Y,JJ,SS,LN,PG,DIV,DIVNUM,EC,ECQ,ECFK,ECFL,QFLG,TOT,DIR,DIRUT,DTOUT,DUOUT
|
---|
| 31 | K ^TMP($J,"ECXAUD")
|
---|
| 32 | S ECXEXT=ECXARRAY("EXTRACT"),ECXDEF=ECXARRAY("DEF")
|
---|
| 33 | S (QFLG,PG)=0,$P(LN,"-",80)=""
|
---|
| 34 | ;get run date in external format
|
---|
| 35 | D NOW^%DTC S Y=$E(%,1,12) D DD^%DT S ECXRUN=Y
|
---|
| 36 | ;arrange dental divisions by station #
|
---|
| 37 | S DIV="" F S DIV=$O(ECXDIV(DIV)) Q:DIV="" S DIVNUM=$P(ECXDIV(DIV),U,3),DIV(DIVNUM)=ECXDIV(DIV)
|
---|
| 38 | ;process the extract records
|
---|
| 39 | S J="" F S J=$O(^ECX(727.806,"AC",ECXEXT,J)) Q:'J I $D(^ECX(727.806,J,0)) S EC=^(0),ECFL=$P(EC,U,41) D
|
---|
| 40 | .I $P(EC,U,12) S ^("D09")=$G(^TMP($J,"ECXAUD",ECFL,"D09"))+1
|
---|
| 41 | .F K=10,11,15:1:18,20:1:24,27:1:37 S ECQ=$P(EC,U,K+3) I ECQ S ^("D"_K)=$G(^TMP($J,"ECXAUD",ECFL,"D"_K))+ECQ
|
---|
| 42 | .I $P(EC,U,11)="C" S ^("D08C")=$G(^TMP($J,"ECXAUD",ECFL,"D08C"))+1
|
---|
| 43 | .I $P(EC,U,11)="S" S ^("D08S")=$G(^TMP($J,"ECXAUD",ECFL,"D08S"))+1
|
---|
| 44 | .F K=12,13,14 I $P(EC,U,K+3)=1 S ^("D"_K)=$G(^TMP($J,"ECXAUD",ECFL,"D"_K))+1
|
---|
| 45 | .I $P(EC,U,28)=3 S ^("D25I")=$G(^TMP($J,"ECXAUD",ECFL,"D25I"))+1
|
---|
| 46 | .I $P(EC,U,28)=4 S ^("D25G")=$G(^TMP($J,"ECXAUD",ECFL,"D25G"))+1
|
---|
| 47 | .I $P(EC,U,29)=1 S ^("D26S")=$G(^TMP($J,"ECXAUD",ECFL,"D26S"))+1
|
---|
| 48 | .I $P(EC,U,29)=3 S ^("D26F")=$G(^TMP($J,"ECXAUD",ECFL,"D26F"))+1
|
---|
| 49 | .I $P(EC,U,42)=2 S ^("D39C")=$G(^TMP($J,"ECXAUD",ECFL,"D39C"))+1
|
---|
| 50 | .I $P(EC,U,42)=3 S ^("D39T")=$G(^TMP($J,"ECXAUD",ECFL,"D39T"))+1
|
---|
| 51 | .F K=40:1:42 I $P(EC,U,K+3)=1 S ^("D"_K)=$G(^TMP($J,"ECXAUD",ECFL,"D"_K))+1
|
---|
| 52 | .S EC=$P(EC,U,46),EC=$S(EC=1:"M",EC=2:"Q",EC=3:"R",1:"") I EC]"" S ^("D43"_EC)=$G(^TMP($J,"ECXAUD",ECFL,"D43"_EC))+1
|
---|
| 53 | ;print the report
|
---|
| 54 | U IO
|
---|
| 55 | S ECFL="" F S ECFL=$O(^TMP($J,"ECXAUD",ECFL)) Q:ECFL="" D Q:QFLG
|
---|
| 56 | .D HEADER
|
---|
| 57 | .S TOT(ECFL)=0
|
---|
| 58 | .S ECFK="" F S ECFK=$O(^TMP($J,"ECXAUD",ECFL,ECFK)) Q:ECFK="" S TOT=^(ECFK) D Q:QFLG
|
---|
| 59 | ..D:($Y+3>IOSL) HEADER Q:QFLG W !,?3,ECFL,?43,ECFK,?68,$$RJ^XLFSTR(TOT,5," ")
|
---|
| 60 | ..S TOT(ECFL)=TOT(ECFL)+TOT
|
---|
| 61 | .D:($Y+3>IOSL) HEADER Q:QFLG W !,?40,$E(LN,1,34)
|
---|
| 62 | .D:($Y+3>IOSL) HEADER Q:QFLG W !,"Total for Feeder Location "_ECFL_":",?68,$$RJ^XLFSTR(TOT(ECFL),5," ")
|
---|
| 63 | ;close
|
---|
| 64 | I $E(IOST)'="C" W @IOF
|
---|
| 65 | I $E(IOST)="C",'QFLG D
|
---|
| 66 | .S SS=22-$Y F JJ=1:1:SS W !
|
---|
| 67 | .S DIR(0)="E" W ! D ^DIR K DIR
|
---|
| 68 | D AUDIT^ECXKILL
|
---|
| 69 | Q
|
---|
| 70 | ;
|
---|
| 71 | HEADER ;print the header
|
---|
| 72 | D SASHEAD^ECXUTLA(ECFL,ECXHEAD,.DIV,.ECXARRAY,.PG)
|
---|
| 73 | Q
|
---|