BGP7ELL3 ; IHS/CMI/LAB - print ind ;
;;17.1;IHS CLINICAL REPORTING;;MAY 10, 2017;Build 29
;
I1AGE ;EP
S BGPHD1="ACTIVE DIABETIC PATIENTS 55+",BGPHD2="# Active Diabetic Pts"
S X=" " D S(X,1,1) D H3^BGP7ELL2 S X=" " D S(X,1,1)
K BGPDAC,BGPDAP,BGPDAB S (C,D,E,F,G,H,I,J,K)=0 F BGPX="GCB.1","GCB.2","GCB.3","GCB.4" D I1AGE1,I1AGE2,I1AGE3,I1AGE4,I1AGE5,I1AGE6,I1AGE7,I1AGE8,I1AGE9
D I1AGEP
Q
I1AGE1 ;
S C=C+1
S BGPF="ELD."_BGPX S BGPPC=$O(^BGPELIIG("C",BGPF,0))
S BGPDF=$P(^BGPELIIG(BGPPC,0),U,8)
S BGPNP=$P(^DD(90559.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U)=$$V(1,BGPRPT,N,P)
S $P(BGPDAP(C),U)=$$V(2,BGPRPT,N,P)
S $P(BGPDAB(C),U)=$$V(3,BGPRPT,N,P)
;
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U,2)=$$V(1,BGPRPT,N,P),$P(BGPDAC(C),U,3)=$S($P(BGPDAC(C),U,1):($P(BGPDAC(C),U,2)/$P(BGPDAC(C),U)*100),1:"")
S $P(BGPDAP(C),U,2)=$$V(2,BGPRPT,N,P),$P(BGPDAP(C),U,3)=$S($P(BGPDAP(C),U,1):($P(BGPDAP(C),U,2)/$P(BGPDAP(C),U)*100),1:"")
S $P(BGPDAB(C),U,2)=$$V(3,BGPRPT,N,P),$P(BGPDAB(C),U,3)=$S($P(BGPDAB(C),U,1):($P(BGPDAB(C),U,2)/$P(BGPDAB(C),U)*100),1:"")
Q
I1AGE2 ;
S D=D+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+4) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(D),U,4)=$$V(1,BGPRPT,N,P),$P(BGPDAC(D),U,5)=$S($P(BGPDAC(D),U,1):($P(BGPDAC(D),U,4)/$P(BGPDAC(D),U)*100),1:"")
S $P(BGPDAP(D),U,4)=$$V(2,BGPRPT,N,P),$P(BGPDAP(D),U,5)=$S($P(BGPDAP(D),U,1):($P(BGPDAP(D),U,4)/$P(BGPDAP(D),U)*100),1:"")
S $P(BGPDAB(D),U,4)=$$V(3,BGPRPT,N,P),$P(BGPDAB(D),U,5)=$S($P(BGPDAB(D),U,1):($P(BGPDAB(D),U,4)/$P(BGPDAB(D),U)*100),1:"")
Q
I1AGE3 ;
S E=E+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+8) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(E),U,6)=$$V(1,BGPRPT,N,P),$P(BGPDAC(E),U,7)=$S($P(BGPDAC(E),U,1):($P(BGPDAC(E),U,6)/$P(BGPDAC(E),U)*100),1:"")
S $P(BGPDAP(E),U,6)=$$V(2,BGPRPT,N,P),$P(BGPDAP(E),U,7)=$S($P(BGPDAP(E),U,1):($P(BGPDAP(E),U,6)/$P(BGPDAP(E),U)*100),1:"")
S $P(BGPDAB(E),U,6)=$$V(3,BGPRPT,N,P),$P(BGPDAB(E),U,7)=$S($P(BGPDAB(E),U,1):($P(BGPDAB(E),U,6)/$P(BGPDAB(E),U)*100),1:"")
Q
I1AGE4 ;
S F=F+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+12) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(F),U,8)=$$V(1,BGPRPT,N,P),$P(BGPDAC(F),U,9)=$S($P(BGPDAC(F),U,1):($P(BGPDAC(F),U,8)/$P(BGPDAC(F),U)*100),1:"")
S $P(BGPDAP(F),U,8)=$$V(2,BGPRPT,N,P),$P(BGPDAP(F),U,9)=$S($P(BGPDAP(F),U,1):($P(BGPDAP(F),U,8)/$P(BGPDAP(F),U)*100),1:"")
S $P(BGPDAB(F),U,8)=$$V(3,BGPRPT,N,P),$P(BGPDAB(F),U,9)=$S($P(BGPDAB(F),U,1):($P(BGPDAB(F),U,8)/$P(BGPDAB(F),U)*100),1:"")
Q
I1AGE5 ;
S G=G+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+16) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;set 4th piece to numerator and 5th to %
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(G),U,10)=$$V(1,BGPRPT,N,P),$P(BGPDAC(G),U,11)=$S($P(BGPDAC(G),U,1):($P(BGPDAC(G),U,10)/$P(BGPDAC(G),U)*100),1:"")
S $P(BGPDAP(G),U,10)=$$V(2,BGPRPT,N,P),$P(BGPDAP(G),U,11)=$S($P(BGPDAP(G),U,1):($P(BGPDAP(G),U,10)/$P(BGPDAP(G),U)*100),1:"")
S $P(BGPDAB(G),U,10)=$$V(3,BGPRPT,N,P),$P(BGPDAB(G),U,11)=$S($P(BGPDAB(G),U,1):($P(BGPDAB(G),U,10)/$P(BGPDAB(G),U)*100),1:"")
Q
I1AGE6 ;
S H=H+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+20) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;set 4th piece to numerator and 5th to %
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(H),U,12)=$$V(1,BGPRPT,N,P),$P(BGPDAC(H),U,13)=$S($P(BGPDAC(H),U,1):($P(BGPDAC(H),U,12)/$P(BGPDAC(H),U)*100),1:"")
S $P(BGPDAP(H),U,12)=$$V(2,BGPRPT,N,P),$P(BGPDAP(H),U,13)=$S($P(BGPDAP(H),U,1):($P(BGPDAP(H),U,12)/$P(BGPDAP(H),U)*100),1:"")
S $P(BGPDAB(H),U,12)=$$V(3,BGPRPT,N,P),$P(BGPDAB(H),U,13)=$S($P(BGPDAB(H),U,1):($P(BGPDAB(H),U,12)/$P(BGPDAB(H),U)*100),1:"")
Q
I1AGE7 ;
S I=I+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+32) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(I),U,14)=$$V(1,BGPRPT,N,P),$P(BGPDAC(I),U,15)=$S($P(BGPDAC(I),U,1):($P(BGPDAC(I),U,14)/$P(BGPDAC(I),U)*100),1:"")
S $P(BGPDAP(I),U,14)=$$V(2,BGPRPT,N,P),$P(BGPDAP(I),U,15)=$S($P(BGPDAP(I),U,1):($P(BGPDAP(I),U,14)/$P(BGPDAP(I),U)*100),1:"")
S $P(BGPDAB(I),U,14)=$$V(3,BGPRPT,N,P),$P(BGPDAB(I),U,15)=$S($P(BGPDAB(I),U,1):($P(BGPDAB(I),U,14)/$P(BGPDAB(I),U)*100),1:"")
Q
I1AGE8 ;
S J=J+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+24) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(J),U,16)=$$V(1,BGPRPT,N,P),$P(BGPDAC(J),U,17)=$S($P(BGPDAC(J),U,1):($P(BGPDAC(J),U,16)/$P(BGPDAC(J),U)*100),1:"")
S $P(BGPDAP(J),U,16)=$$V(2,BGPRPT,N,P),$P(BGPDAP(J),U,17)=$S($P(BGPDAP(J),U,1):($P(BGPDAP(J),U,16)/$P(BGPDAP(J),U)*100),1:"")
S $P(BGPDAB(J),U,16)=$$V(3,BGPRPT,N,P),$P(BGPDAB(J),U,17)=$S($P(BGPDAB(J),U,1):($P(BGPDAB(J),U,16)/$P(BGPDAB(J),U)*100),1:"")
Q
I1AGE9 ;
S K=K+1
S BGPF="ELD."_$P(BGPX,".")_"."_($P(BGPX,".",2)+28) S BGPPC=$O(^BGPELIIG("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIG(BGPPC,0),U,9)
S BGPNP=$P(^DD(90559.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(K),U,18)=$$V(1,BGPRPT,N,P),$P(BGPDAC(K),U,19)=$S($P(BGPDAC(K),U,1):($P(BGPDAC(K),U,18)/$P(BGPDAC(K),U)*100),1:"")
S $P(BGPDAP(K),U,18)=$$V(2,BGPRPT,N,P),$P(BGPDAP(K),U,19)=$S($P(BGPDAP(K),U,1):($P(BGPDAP(K),U,18)/$P(BGPDAP(K),U)*100),1:"")
S $P(BGPDAB(K),U,18)=$$V(3,BGPRPT,N,P),$P(BGPDAB(K),U,19)=$S($P(BGPDAB(K),U,1):($P(BGPDAB(K),U,18)/$P(BGPDAB(K),U)*100),1:"")
Q
I1AGEP ;
D I1AGEP^BGP7ELLQ
Q
SETN ;
S BGPCYN=$$V(1,BGPRPT,N,P)
S BGPPRN=$$V(2,BGPRPT,N,P)
S BGPBLN=$$V(3,BGPRPT,N,P)
S BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
S BGPBLP=$S(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
Q
V(T,R,N,P) ;EP
I $G(BGPAREAA) G VA
NEW X
I T=1 S X=$P($G(^BGPEDLCG(R,N)),U,P) Q $S(X]"":X,1:0)
I T=2 S X=$P($G(^BGPEDLPG(R,N)),U,P) Q $S(X]"":X,1:0)
I T=3 S X=$P($G(^BGPEDLBG(R,N)),U,P) Q $S(X]"":X,1:0)
Q ""
VA ;
NEW X,V,C S X=0,C="" F S X=$O(BGPSUL(X)) Q:X'=+X D
.I T=1 S C=C+$P($G(^BGPEDLCG(X,N)),U,P)
.I T=2 S C=C+$P($G(^BGPEDLPG(X,N)),U,P)
.I T=3 S C=C+$P($G(^BGPEDLBG(X,N)),U,P)
.Q
Q $S(C:C,1:0)
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
BGP7ELL3 ; IHS/CMI/LAB - print ind ;
+1 ;;17.1;IHS CLINICAL REPORTING;;MAY 10, 2017;Build 29
+2 ;
I1AGE ;EP
+1 SET BGPHD1="ACTIVE DIABETIC PATIENTS 55+"
SET BGPHD2="# Active Diabetic Pts"
+2 SET X=" "
DO S(X,1,1)
DO H3^BGP7ELL2
SET X=" "
DO S(X,1,1)
+3 KILL BGPDAC,BGPDAP,BGPDAB
SET (C,D,E,F,G,H,I,J,K)=0
FOR BGPX="GCB.1","GCB.2","GCB.3","GCB.4"
DO I1AGE1
DO I1AGE2
DO I1AGE3
DO I1AGE4
DO I1AGE5
DO I1AGE6
DO I1AGE7
DO I1AGE8
DO I1AGE9
+4 DO I1AGEP
+5 QUIT
I1AGE1 ;
+1 SET C=C+1
+2 SET BGPF="ELD."_BGPX
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 SET BGPDF=$PIECE(^BGPELIIG(BGPPC,0),U,8)
+4 SET BGPNP=$PIECE(^DD(90559.03,BGPDF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+5 SET $PIECE(BGPDAC(C),U)=$$V(1,BGPRPT,N,P)
+6 SET $PIECE(BGPDAP(C),U)=$$V(2,BGPRPT,N,P)
+7 SET $PIECE(BGPDAB(C),U)=$$V(3,BGPRPT,N,P)
+8 ;
+9 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+10 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+11 SET $PIECE(BGPDAC(C),U,2)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(C),U,3)=$SELECT($PIECE(BGPDAC(C),U,1):($PIECE(BGPDAC(C),U,2)/$PIECE(BGPDAC(C),U)*100),1:"")
+12 SET $PIECE(BGPDAP(C),U,2)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(C),U,3)=$SELECT($PIECE(BGPDAP(C),U,1):($PIECE(BGPDAP(C),U,2)/$PIECE(BGPDAP(C),U)*100),1:"")
+13 SET $PIECE(BGPDAB(C),U,2)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(C),U,3)=$SELECT($PIECE(BGPDAB(C),U,1):($PIECE(BGPDAB(C),U,2)/$PIECE(BGPDAB(C),U)*100),1:"")
+14 QUIT
I1AGE2 ;
+1 SET D=D+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+4)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(D),U,4)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(D),U,5)=$SELECT($PIECE(BGPDAC(D),U,1):($PIECE(BGPDAC(D),U,4)/$PIECE(BGPDAC(D),U)*100),1:"")
+7 SET $PIECE(BGPDAP(D),U,4)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(D),U,5)=$SELECT($PIECE(BGPDAP(D),U,1):($PIECE(BGPDAP(D),U,4)/$PIECE(BGPDAP(D),U)*100),1:"")
+8 SET $PIECE(BGPDAB(D),U,4)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(D),U,5)=$SELECT($PIECE(BGPDAB(D),U,1):($PIECE(BGPDAB(D),U,4)/$PIECE(BGPDAB(D),U)*100),1:"")
+9 QUIT
I1AGE3 ;
+1 SET E=E+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+8)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(E),U,6)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(E),U,7)=$SELECT($PIECE(BGPDAC(E),U,1):($PIECE(BGPDAC(E),U,6)/$PIECE(BGPDAC(E),U)*100),1:"")
+7 SET $PIECE(BGPDAP(E),U,6)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(E),U,7)=$SELECT($PIECE(BGPDAP(E),U,1):($PIECE(BGPDAP(E),U,6)/$PIECE(BGPDAP(E),U)*100),1:"")
+8 SET $PIECE(BGPDAB(E),U,6)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(E),U,7)=$SELECT($PIECE(BGPDAB(E),U,1):($PIECE(BGPDAB(E),U,6)/$PIECE(BGPDAB(E),U)*100),1:"")
+9 QUIT
I1AGE4 ;
+1 SET F=F+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+12)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(F),U,8)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(F),U,9)=$SELECT($PIECE(BGPDAC(F),U,1):($PIECE(BGPDAC(F),U,8)/$PIECE(BGPDAC(F),U)*100),1:"")
+7 SET $PIECE(BGPDAP(F),U,8)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(F),U,9)=$SELECT($PIECE(BGPDAP(F),U,1):($PIECE(BGPDAP(F),U,8)/$PIECE(BGPDAP(F),U)*100),1:"")
+8 SET $PIECE(BGPDAB(F),U,8)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(F),U,9)=$SELECT($PIECE(BGPDAB(F),U,1):($PIECE(BGPDAB(F),U,8)/$PIECE(BGPDAB(F),U)*100),1:"")
+9 QUIT
I1AGE5 ;
+1 SET G=G+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+16)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;set 4th piece to numerator and 5th to %
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(G),U,10)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(G),U,11)=$SELECT($PIECE(BGPDAC(G),U,1):($PIECE(BGPDAC(G),U,10)/$PIECE(BGPDAC(G),U)*100),1:"")
+7 SET $PIECE(BGPDAP(G),U,10)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(G),U,11)=$SELECT($PIECE(BGPDAP(G),U,1):($PIECE(BGPDAP(G),U,10)/$PIECE(BGPDAP(G),U)*100),1:"")
+8 SET $PIECE(BGPDAB(G),U,10)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(G),U,11)=$SELECT($PIECE(BGPDAB(G),U,1):($PIECE(BGPDAB(G),U,10)/$PIECE(BGPDAB(G),U)*100),1:"")
+9 QUIT
I1AGE6 ;
+1 SET H=H+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+20)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;set 4th piece to numerator and 5th to %
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(H),U,12)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(H),U,13)=$SELECT($PIECE(BGPDAC(H),U,1):($PIECE(BGPDAC(H),U,12)/$PIECE(BGPDAC(H),U)*100),1:"")
+7 SET $PIECE(BGPDAP(H),U,12)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(H),U,13)=$SELECT($PIECE(BGPDAP(H),U,1):($PIECE(BGPDAP(H),U,12)/$PIECE(BGPDAP(H),U)*100),1:"")
+8 SET $PIECE(BGPDAB(H),U,12)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(H),U,13)=$SELECT($PIECE(BGPDAB(H),U,1):($PIECE(BGPDAB(H),U,12)/$PIECE(BGPDAB(H),U)*100),1:"")
+9 QUIT
I1AGE7 ;
+1 SET I=I+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+32)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(I),U,14)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(I),U,15)=$SELECT($PIECE(BGPDAC(I),U,1):($PIECE(BGPDAC(I),U,14)/$PIECE(BGPDAC(I),U)*100),1:"")
+7 SET $PIECE(BGPDAP(I),U,14)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(I),U,15)=$SELECT($PIECE(BGPDAP(I),U,1):($PIECE(BGPDAP(I),U,14)/$PIECE(BGPDAP(I),U)*100),1:"")
+8 SET $PIECE(BGPDAB(I),U,14)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(I),U,15)=$SELECT($PIECE(BGPDAB(I),U,1):($PIECE(BGPDAB(I),U,14)/$PIECE(BGPDAB(I),U)*100),1:"")
+9 QUIT
I1AGE8 ;
+1 SET J=J+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+24)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(J),U,16)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(J),U,17)=$SELECT($PIECE(BGPDAC(J),U,1):($PIECE(BGPDAC(J),U,16)/$PIECE(BGPDAC(J),U)*100),1:"")
+7 SET $PIECE(BGPDAP(J),U,16)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(J),U,17)=$SELECT($PIECE(BGPDAP(J),U,1):($PIECE(BGPDAP(J),U,16)/$PIECE(BGPDAP(J),U)*100),1:"")
+8 SET $PIECE(BGPDAB(J),U,16)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(J),U,17)=$SELECT($PIECE(BGPDAB(J),U,1):($PIECE(BGPDAB(J),U,16)/$PIECE(BGPDAB(J),U)*100),1:"")
+9 QUIT
I1AGE9 ;
+1 SET K=K+1
+2 SET BGPF="ELD."_$PIECE(BGPX,".")_"."_($PIECE(BGPX,".",2)+28)
SET BGPPC=$ORDER(^BGPELIIG("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIG(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90559.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(K),U,18)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(K),U,19)=$SELECT($PIECE(BGPDAC(K),U,1):($PIECE(BGPDAC(K),U,18)/$PIECE(BGPDAC(K),U)*100),1:"")
+7 SET $PIECE(BGPDAP(K),U,18)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(K),U,19)=$SELECT($PIECE(BGPDAP(K),U,1):($PIECE(BGPDAP(K),U,18)/$PIECE(BGPDAP(K),U)*100),1:"")
+8 SET $PIECE(BGPDAB(K),U,18)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(K),U,19)=$SELECT($PIECE(BGPDAB(K),U,1):($PIECE(BGPDAB(K),U,18)/$PIECE(BGPDAB(K),U)*100),1:"")
+9 QUIT
I1AGEP ;
+1 DO I1AGEP^BGP7ELLQ
+2 QUIT
SETN ;
+1 SET BGPCYN=$$V(1,BGPRPT,N,P)
+2 SET BGPPRN=$$V(2,BGPRPT,N,P)
+3 SET BGPBLN=$$V(3,BGPRPT,N,P)
+4 SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+5 SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+6 SET BGPBLP=$SELECT(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
+7 QUIT
V(T,R,N,P) ;EP
+1 IF $GET(BGPAREAA)
GOTO VA
+2 NEW X
+3 IF T=1
SET X=$PIECE($GET(^BGPEDLCG(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+4 IF T=2
SET X=$PIECE($GET(^BGPEDLPG(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+5 IF T=3
SET X=$PIECE($GET(^BGPEDLBG(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+6 QUIT ""
VA ;
+1 NEW X,V,C
SET X=0
SET C=""
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:1
+2 IF T=1
SET C=C+$PIECE($GET(^BGPEDLCG(X,N)),U,P)
+3 IF T=2
SET C=C+$PIECE($GET(^BGPEDLPG(X,N)),U,P)
+4 IF T=3
SET C=C+$PIECE($GET(^BGPEDLBG(X,N)),U,P)
+5 QUIT
End DoDot:1
+6 QUIT $SELECT(C:C,1:0)
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