BGP0PDL1 ; IHS/CMI/LAB - print ind 1 01 Jul 2009 8:03 PM ;
;;10.0;IHS CLINICAL REPORTING;**1**;JUN 18, 2010
;
;
I1 ;EP
D:'$G(BGPSUMON) H1
I1A1 ;001.A, 001.B, 001.C
I BGPINDT'="E" F BGPPC1="1.1","1.2","1.3" D PI
I BGPINDT="E" S BGPPC1="1.4" D PI
D I1AGE^BGP0PDL9
Q
IREG ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:$P(^BGPINDT(BGPIC,0),U,13) S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IASCRN ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:4 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
D ^BGP0PDLL
Q
I8 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:1 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I9 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:1 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
D ^BGP0PD19
Q
I12 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:7 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I13 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:3 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
D I1AGE^BGP0PD19
Q
I14 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:3 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I007 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:7 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I008 ;
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:5 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IB ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:6 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IH ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:6 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
D I1AGE^BGP0PDLA
Q
I91 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:3 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
D I1AGE^BGP0PDLB
Q
PHYACT ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:$P(^BGPINDT(BGPIC,0),U,13) S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
D I1AGE^BGP0PDPA
Q
IG ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IF ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:3 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IA ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:18 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
ICRSAMM ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,0),U,2) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I031A ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:13 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
ID ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:9 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I0302 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:9 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I0303 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:3 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I0302A ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:4 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IHEDBBH ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:6 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IHEDPBH ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:6 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IHEDCHM ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:6 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IE2 ;
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:1 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IE1 ;
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:1 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IK ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:6 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IOMW ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IRAO ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
II ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IL ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IAS ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:8 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IMS ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IC2 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IAST1 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:12 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IRAA ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IRAR ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IHEDCWP ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
IHEDURI ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
I28 ;EP
D:'$G(BGPSUMON) H1
S BGPORDP=$P(^BGPINDT(BGPIC,12),U,6) F BGPORDP1=1:1:2 S BGPPC1=BGPORDP_"."_BGPORDP1 D PI
Q
PI ;EP
S BGPDENP=0
S BGPPC2=0 F S BGPPC2=$O(^BGPINDTC("ABC",BGPPC1,BGPPC2)) Q:BGPPC2="" S BGPPC=$O(^BGPINDTC("ABC",BGPPC1,BGPPC2,0)) D PI1
Q
PI1 ;EP
K BGPEXCT,BGPSDP,BGPSDPN,BGPSDPO,BGP0SDPD
Q:'$$CHECK^BGP0DP1C(BGPPC)
I $P(^BGPINDTC(BGPPC,0),U,4)="E-2.B.3" S X=" " D S(X,1,1) D PI1^BGP0PDL2 Q ;count only
S BGPDF=$P(^BGPINDTC(BGPPC,0),U,8)
;get denominator value of measure
S BGPNP=$P(^DD(90377.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S BGPCYD=$$V^BGP0DP1C(1,BGPRPT,N,P,1) I $G(BGPAREAA) D SETEXA^BGP0DP1C(1,N,P)
S BGPPRD=$$V^BGP0DP1C(2,BGPRPT,N,P,1) I $G(BGPAREAA) D SETEXA^BGP0DP1C(2,N,P)
S BGPBLD=$$V^BGP0DP1C(3,BGPRPT,N,P,1) I $G(BGPAREAA) D SETEXA^BGP0DP1C(3,N,P)
;write out denominator
;write out denom
I BGPRTYPE=1,$P(^BGPINDTC(BGPPC,0),U,4)="MS.A.9" S BGPDENP=0
I BGPRTYPE=1,$P(^BGPINDTC(BGPPC,0),U,4)="DM.2.1" S BGPDENP=0
I BGPRTYPE=1,$P(^BGPINDTC(BGPPC,0),U,4)="E-2.A.1" S BGPDENP=0
I BGPRTYPE=9,$P(^BGPINDTC(BGPPC,0),U,4)="027.C.36" S BGPDENP=0
I BGPRTYPE=7,$P(^BGPINDTC(BGPPC,0),U,4)="028.C.4" S BGPDENP=0
I 'BGPDENP S Y=" " D:$E($P($G(^BGPINDTC(BGPPC,12)),U,4),1,4)'=48.2!($P($G(^BGPINDTC(BGPPC,12)),U,4)="48.2.1")!($P($G(^BGPINDTC(BGPPC,12)),U,4)="43.22.1") S(Y,1,1) D
.I $P($G(^BGPINDTC(BGPPC,12)),U,14) Q
.I BGPRTYPE=1,$P($G(^BGPINDTC(BGPPC,20)),U,4)]"" S Y=$P(^BGPINDTC(BGPPC,20),U,4)_" "_$P(^BGPINDTC(BGPPC,20),U,5)_" "_$P(^BGPINDTC(BGPPC,20),U,6) D S(Y,1,1) I 1
.E D
..I BGPRTYPE=4,BGP0RPTH="P" D S($P(^DIBT(BGPSEAT,0),U)_" Population",1,1)
..S Y=$P(^BGPINDTC(BGPPC,0),U,17)_" "_$P(^BGPINDTC(BGPPC,0),U,18)_" "_$P(^BGPINDTC(BGPPC,0),U,21) D S(Y,1,1)
.S Y=BGPCYD_"^^"_BGPPRD_"^^^"_BGPBLD D S(Y,,2)
.S BGPDENP=1
;get numerator value of measure and calc %
I $E($P(^BGPINDTC(BGPPC,0),U,4),1,2)="I." D
.S BGPDF=$P(^BGPINDTC(BGPPC,0),U,8)
.;get denominator value of measure
.S BGPNP=$P(^DD(90377.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
.S BGPCYD=$$V^BGP0DP1C(1,BGPRPT,N,P,1) I $G(BGPAREAA) D SETEXA^BGP0DP1C(1,N,P)
.S BGPPRD=$$V^BGP0DP1C(2,BGPRPT,N,P,1) I $G(BGPAREAA) D SETEXA^BGP0DP1C(2,N,P)
.S BGPBLD=$$V^BGP0DP1C(3,BGPRPT,N,P,1) I $G(BGPAREAA) D SETEXA^BGP0DP1C(3,N,P)
S BGPNF=$P(^BGPINDTC(BGPPC,0),U,9)
S BGPNP=$P(^DD(90377.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
D SETN
I BGPRTYPE=1,$P($G(^BGPINDTC(BGPPC,20)),U)]"" S X=$P(^BGPINDTC(BGPPC,20),U,1)_" "_$P(^BGPINDTC(BGPPC,20),U,2)_" "_$P(^BGPINDTC(BGPPC,20),U,3) D S(X,1,1) I 1
E D
.I $P(^BGPINDTC(BGPPC,0),U,22) D S(" ",1,1)
.S X=$P(^BGPINDTC(BGPPC,0),U,15)_" "_$P(^BGPINDTC(BGPPC,0),U,16)_" "_$P(^BGPINDTC(BGPPC,0),U,19) D S(X,1,1)
D H2
Q
SETN ;EP - set numerator fields
S BGPIIDEL=1
D SETN^BGP0DP1C
Q
C(X,X2,X3) ;
D COMMA^%DTC
Q X
S(Y,F,P) ;set up array
I '$G(F) S F=0
S %=$P(^TMP($J,"BGPDEL",0),U)+F,$P(^TMP($J,"BGPDEL",0),U)=%
I '$D(^TMP($J,"BGPDEL",%)) S ^TMP($J,"BGPDEL",%)=""
S $P(^TMP($J,"BGPDEL",%),U,P)=Y
Q
CALC(N,O) ;
NEW Z
S Z=N-O,Z=$FN(Z,"+,",1)
Q Z
H3 ;EP
S X="Age Distribution" D S(X,1,1) S X=" " D S(X,1,1)
S Y="<15" D S(Y,1,2)
S Y="15-19" D S(Y,,3)
S Y="20-24" D S(Y,,4)
S Y="25-34" D S(Y,,5)
S Y="35-44" D S(Y,,6)
S Y="45-54" D S(Y,,7)
S Y="55-64" D S(Y,,8)
S Y=">64 yrs" D S(Y,,9)
Q
SB(X) ;EP - Strip leading and trailing blanks from X.
NEW %
X ^DD("FUNC",$O(^DD("FUNC","B","STRIPBLANKS",0)),1)
Q X
H2 ;EP
S BGPX="",BGPX=BGPCYN,$P(BGPX,U,2)=$$SB($J(BGPCYP,5,1)),$P(BGPX,U,3)=BGPPRN,$P(BGPX,U,4)=$$SB($J(BGPPRP,5,1)),$P(BGPX,U,5)=$$SB($J($$CALC(BGPCYP,BGPPRP),6)),$P(BGPX,U,6)=BGPBLN,$P(BGPX,U,7)=$$SB($J(BGPBLP,5,1))
S $P(BGPX,U,8)=$$SB($J($$CALC(BGPCYP,BGPBLP),6))
D S(BGPX,,2)
Q
H1 ;EP
S Y="" D S(Y,1,1)
S Y="REPORT" D S(Y,1,2)
S Y="%" D S(Y,,3)
S Y="PREV YR" D S(Y,,4)
S Y="%" D S(Y,,5)
S Y="CHG from" D S(Y,,6)
S Y="BASE" D S(Y,,7)
S Y="%" D S(Y,,8)
S Y="CHG from" D S(Y,,9)
S Y="PERIOD" D S(Y,1,2)
S Y="PERIOD" D S(Y,,4)
S Y="PREV YR %" D S(Y,,6)
S Y="PERIOD" D S(Y,,7)
S Y="BASE %" D S(Y,,9)
Q
BGP0PDL1 ; IHS/CMI/LAB - print ind 1 01 Jul 2009 8:03 PM ;
+1 ;;10.0;IHS CLINICAL REPORTING;**1**;JUN 18, 2010
+2 ;
+3 ;
I1 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
I1A1 ;001.A, 001.B, 001.C
+1 IF BGPINDT'="E"
FOR BGPPC1="1.1","1.2","1.3"
DO PI
+2 IF BGPINDT="E"
SET BGPPC1="1.4"
DO PI
+3 DO I1AGE^BGP0PDL9
+4 QUIT
IREG ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:$PIECE(^BGPINDT(BGPIC,0),U,13)
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IASCRN ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:4
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 DO ^BGP0PDLL
+4 QUIT
I8 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:1
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I9 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:1
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 DO ^BGP0PD19
+4 QUIT
I12 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:7
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I13 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:3
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 DO I1AGE^BGP0PD19
+4 QUIT
I14 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:3
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I007 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:7
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I008 ;
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:5
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IB ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:6
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IH ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:6
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 DO I1AGE^BGP0PDLA
+4 QUIT
I91 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:3
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 DO I1AGE^BGP0PDLB
+4 QUIT
PHYACT ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:$PIECE(^BGPINDT(BGPIC,0),U,13)
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 DO I1AGE^BGP0PDPA
+4 QUIT
IG ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IF ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:3
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IA ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:18
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
ICRSAMM ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,0),U,2)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I031A ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:13
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
ID ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:9
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I0302 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:9
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I0303 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:3
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I0302A ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:4
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IHEDBBH ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:6
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IHEDPBH ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:6
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IHEDCHM ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:6
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IE2 ;
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:1
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IE1 ;
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:1
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IK ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:6
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IOMW ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IRAO ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
II ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IL ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IAS ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:8
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IMS ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IC2 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IAST1 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:12
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IRAA ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IRAR ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IHEDCWP ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
IHEDURI ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
I28 ;EP
+1 IF '$GET(BGPSUMON)
DO H1
+2 SET BGPORDP=$PIECE(^BGPINDT(BGPIC,12),U,6)
FOR BGPORDP1=1:1:2
SET BGPPC1=BGPORDP_"."_BGPORDP1
DO PI
+3 QUIT
PI ;EP
+1 SET BGPDENP=0
+2 SET BGPPC2=0
FOR
SET BGPPC2=$ORDER(^BGPINDTC("ABC",BGPPC1,BGPPC2))
IF BGPPC2=""
QUIT
SET BGPPC=$ORDER(^BGPINDTC("ABC",BGPPC1,BGPPC2,0))
DO PI1
+3 QUIT
PI1 ;EP
+1 KILL BGPEXCT,BGPSDP,BGPSDPN,BGPSDPO,BGP0SDPD
+2 IF '$$CHECK^BGP0DP1C(BGPPC)
QUIT
+3 ;count only
IF $PIECE(^BGPINDTC(BGPPC,0),U,4)="E-2.B.3"
SET X=" "
DO S(X,1,1)
DO PI1^BGP0PDL2
QUIT
+4 SET BGPDF=$PIECE(^BGPINDTC(BGPPC,0),U,8)
+5 ;get denominator value of measure
+6 SET BGPNP=$PIECE(^DD(90377.03,BGPDF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+7 SET BGPCYD=$$V^BGP0DP1C(1,BGPRPT,N,P,1)
IF $GET(BGPAREAA)
DO SETEXA^BGP0DP1C(1,N,P)
+8 SET BGPPRD=$$V^BGP0DP1C(2,BGPRPT,N,P,1)
IF $GET(BGPAREAA)
DO SETEXA^BGP0DP1C(2,N,P)
+9 SET BGPBLD=$$V^BGP0DP1C(3,BGPRPT,N,P,1)
IF $GET(BGPAREAA)
DO SETEXA^BGP0DP1C(3,N,P)
+10 ;write out denominator
+11 ;write out denom
+12 IF BGPRTYPE=1
IF $PIECE(^BGPINDTC(BGPPC,0),U,4)="MS.A.9"
SET BGPDENP=0
+13 IF BGPRTYPE=1
IF $PIECE(^BGPINDTC(BGPPC,0),U,4)="DM.2.1"
SET BGPDENP=0
+14 IF BGPRTYPE=1
IF $PIECE(^BGPINDTC(BGPPC,0),U,4)="E-2.A.1"
SET BGPDENP=0
+15 IF BGPRTYPE=9
IF $PIECE(^BGPINDTC(BGPPC,0),U,4)="027.C.36"
SET BGPDENP=0
+16 IF BGPRTYPE=7
IF $PIECE(^BGPINDTC(BGPPC,0),U,4)="028.C.4"
SET BGPDENP=0
+17 IF 'BGPDENP
SET Y=" "
IF $EXTRACT($PIECE($GET(^BGPINDTC(BGPPC,12)),U,4),1,4)'=48.2!($PIECE($GET(^BGPINDTC(BGPPC,12)),U,4)="48.2.1")!($PIECE($GET(^BGPINDTC(BGPPC,12)),U,4)="43.22.1")
DO S(Y,1,1)
Begin DoDot:1
+18 IF $PIECE($GET(^BGPINDTC(BGPPC,12)),U,14)
QUIT
+19 IF BGPRTYPE=1
IF $PIECE($GET(^BGPINDTC(BGPPC,20)),U,4)]""
SET Y=$PIECE(^BGPINDTC(BGPPC,20),U,4)_" "_$PIECE(^BGPINDTC(BGPPC,20),U,5)_" "_$PIECE(^BGPINDTC(BGPPC,20),U,6)
DO S(Y,1,1)
IF 1
+20 IF '$TEST
Begin DoDot:2
+21 IF BGPRTYPE=4
IF BGP0RPTH="P"
DO S($PIECE(^DIBT(BGPSEAT,0),U)_" Population",1,1)
+22 SET Y=$PIECE(^BGPINDTC(BGPPC,0),U,17)_" "_$PIECE(^BGPINDTC(BGPPC,0),U,18)_" "_$PIECE(^BGPINDTC(BGPPC,0),U,21)
DO S(Y,1,1)
End DoDot:2
+23 SET Y=BGPCYD_"^^"_BGPPRD_"^^^"_BGPBLD
DO S(Y,,2)
+24 SET BGPDENP=1
End DoDot:1
+25 ;get numerator value of measure and calc %
+26 IF $EXTRACT($PIECE(^BGPINDTC(BGPPC,0),U,4),1,2)="I."
Begin DoDot:1
+27 SET BGPDF=$PIECE(^BGPINDTC(BGPPC,0),U,8)
+28 ;get denominator value of measure
+29 SET BGPNP=$PIECE(^DD(90377.03,BGPDF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+30 SET BGPCYD=$$V^BGP0DP1C(1,BGPRPT,N,P,1)
IF $GET(BGPAREAA)
DO SETEXA^BGP0DP1C(1,N,P)
+31 SET BGPPRD=$$V^BGP0DP1C(2,BGPRPT,N,P,1)
IF $GET(BGPAREAA)
DO SETEXA^BGP0DP1C(2,N,P)
+32 SET BGPBLD=$$V^BGP0DP1C(3,BGPRPT,N,P,1)
IF $GET(BGPAREAA)
DO SETEXA^BGP0DP1C(3,N,P)
End DoDot:1
+33 SET BGPNF=$PIECE(^BGPINDTC(BGPPC,0),U,9)
+34 SET BGPNP=$PIECE(^DD(90377.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+35 DO SETN
+36 IF BGPRTYPE=1
IF $PIECE($GET(^BGPINDTC(BGPPC,20)),U)]""
SET X=$PIECE(^BGPINDTC(BGPPC,20),U,1)_" "_$PIECE(^BGPINDTC(BGPPC,20),U,2)_" "_$PIECE(^BGPINDTC(BGPPC,20),U,3)
DO S(X,1,1)
IF 1
+37 IF '$TEST
Begin DoDot:1
+38 IF $PIECE(^BGPINDTC(BGPPC,0),U,22)
DO S(" ",1,1)
+39 SET X=$PIECE(^BGPINDTC(BGPPC,0),U,15)_" "_$PIECE(^BGPINDTC(BGPPC,0),U,16)_" "_$PIECE(^BGPINDTC(BGPPC,0),U,19)
DO S(X,1,1)
End DoDot:1
+40 DO H2
+41 QUIT
SETN ;EP - set numerator fields
+1 SET BGPIIDEL=1
+2 DO SETN^BGP0DP1C
+3 QUIT
C(X,X2,X3) ;
+1 DO COMMA^%DTC
+2 QUIT X
S(Y,F,P) ;set up array
+1 IF '$GET(F)
SET F=0
+2 SET %=$PIECE(^TMP($JOB,"BGPDEL",0),U)+F
SET $PIECE(^TMP($JOB,"BGPDEL",0),U)=%
+3 IF '$DATA(^TMP($JOB,"BGPDEL",%))
SET ^TMP($JOB,"BGPDEL",%)=""
+4 SET $PIECE(^TMP($JOB,"BGPDEL",%),U,P)=Y
+5 QUIT
CALC(N,O) ;
+1 NEW Z
+2 SET Z=N-O
SET Z=$FNUMBER(Z,"+,",1)
+3 QUIT Z
H3 ;EP
+1 SET X="Age Distribution"
DO S(X,1,1)
SET X=" "
DO S(X,1,1)
+2 SET Y="<15"
DO S(Y,1,2)
+3 SET Y="15-19"
DO S(Y,,3)
+4 SET Y="20-24"
DO S(Y,,4)
+5 SET Y="25-34"
DO S(Y,,5)
+6 SET Y="35-44"
DO S(Y,,6)
+7 SET Y="45-54"
DO S(Y,,7)
+8 SET Y="55-64"
DO S(Y,,8)
+9 SET Y=">64 yrs"
DO S(Y,,9)
+10 QUIT
SB(X) ;EP - Strip leading and trailing blanks from X.
+1 NEW %
+2 XECUTE ^DD("FUNC",$ORDER(^DD("FUNC","B","STRIPBLANKS",0)),1)
+3 QUIT X
H2 ;EP
+1 SET BGPX=""
SET BGPX=BGPCYN
SET $PIECE(BGPX,U,2)=$$SB($JUSTIFY(BGPCYP,5,1))
SET $PIECE(BGPX,U,3)=BGPPRN
SET $PIECE(BGPX,U,4)=$$SB($JUSTIFY(BGPPRP,5,1))
SET $PIECE(BGPX,U,5)=$$SB($JUSTIFY($$CALC(BGPCYP,BGPPRP),6))
SET $PIECE(BGPX,U,6)=BGPBLN
SET $PIECE(BGPX,U,7)=$$SB($JUSTIFY(BGPBLP,5,1))
+2 SET $PIECE(BGPX,U,8)=$$SB($JUSTIFY($$CALC(BGPCYP,BGPBLP),6))
+3 DO S(BGPX,,2)
+4 QUIT
H1 ;EP
+1 SET Y=""
DO S(Y,1,1)
+2 SET Y="REPORT"
DO S(Y,1,2)
+3 SET Y="%"
DO S(Y,,3)
+4 SET Y="PREV YR"
DO S(Y,,4)
+5 SET Y="%"
DO S(Y,,5)
+6 SET Y="CHG from"
DO S(Y,,6)
+7 SET Y="BASE"
DO S(Y,,7)
+8 SET Y="%"
DO S(Y,,8)
+9 SET Y="CHG from"
DO S(Y,,9)
+10 SET Y="PERIOD"
DO S(Y,1,2)
+11 SET Y="PERIOD"
DO S(Y,,4)
+12 SET Y="PREV YR %"
DO S(Y,,6)
+13 SET Y="PERIOD"
DO S(Y,,7)
+14 SET Y="BASE %"
DO S(Y,,9)
+15 QUIT