Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APCLBIN1

APCLBIN1.m

Go to the documentation of this file.
APCLBIN1 ; IHS/CMI/LAB - MAKES AGE BIN REPORTS ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 I '$D(APCLZZZ) S (APCLZZZ,APCLXXX)=0
 S APCLZZZ=APCLZZZ+1
VAR S APCLDFN=@$S($D(APCLDEEP):($E("DDDDDD",1,APCLDEEP)_"D0"),$D(DD0):"DD0",1:"D0"),APCLVAL=Y I '$D(^DPT(APCLDFN)) D FAIL Q
 S DOB=$P(^DPT(APCLDFN,0),U,3)
 I DOB="" D FAIL Q
 I $E(IOST)="C",APCLZZZ>1 W *13,APCLZZZ I APCLXXX W "  (",APCLXXX,")"
 I APCLVAL="" S APCLVAL="UNSPECIFIED"
 I $D(APCLBIN) D ATT Q
REP I '$D(APCLAGEG) D SETBIN
 S APCLNN=APCLAGEG,APCLA=""
 S DIOEND="D BLIST^APCLBIN1"
 I $E(IOST)="C" W !!!!,"CRUNCH, CRUNCH....",!!
 K ^TMP("APCLAGE",$J)
 F I=1:1 S APCLX=$P(APCLNN,";",I) Q:APCLX=""  D SETA
 S APCLBIN=APCLA,G="^TMP(""APCLAGE"",$J)"
 F I=1:1:$L(APCLA,";") S @G@("B",I)=0
 D ATT
 Q
 ;
FAIL S APCLXXX=APCLXXX+1
 I APCLZZZ>1 W *13,APCLZZZ,"  (",APCLXXX,")"
 Q
 ;
SETA S APCLY=$P(APCLX,":"),APCLZ=$P(APCLX,":",2)
 I APCLA]"" S APCLA=APCLA_";"
 S APCLA=APCLA_(DT+1-(10000*(APCLZ+1)))_":"_(DT-(APCLY*10000))
 Q
 ;
ATT S APCLA=APCLBIN
 F I=1:1 S APCLNN=$P(APCLA,";",I) Q:APCLNN=""  S APCLX=$P(APCLNN,":"),APCLY=$P(APCLNN,":",2) I DOB'<APCLX,DOB'>APCLY D SETV Q
 Q
 ;
SETV I '$D(@G@("V",APCLVAL)) S ^(APCLVAL)=0
 S @G@("V",APCLVAL)=@G@("V",APCLVAL)+1
 S @G@("B",I)=@G@("B",I)+1
 I '$D(@G@(1,APCLVAL,I)) S ^(I)=0
 S @G@(1,APCLVAL,I)=@G@(1,APCLVAL,I)+1
 Q
 ;
BLIST I $E(IOST)="C" W !!,"<>" H 2
 ;
 D HEADER
BLVAR S G="^TMP(""APCLAGE"",$J)",N=""
 S APCLLINE=""
 F APCLLINE=1:1 S I=0,N=$O(@G@(1,N)) Q:N=""  D:'(APCLLINE#(IOSL-8)) PAUSE Q:APCLLINE=999999  W !,$E(N,1,12) D B1
 W !!,"TOTAL"
 S (I,APCLZ)=0 F J=12:7 S I=$O(@G@("B",I)) Q:'I  W ?J,$J(^(I),6) S APCLZ=APCLZ+^(I)
 W ?J,$J(APCLZ,6)
 I $D(APCLXXX),APCLXXX W !!,APCLXXX," ENTR",$S(APCLXXX>1:"IES",1:"Y")," NOT INCLUDED BECAUSE OF BAD POINTERS OR LACK OF DOB"
 I $E(IOST)'?1"C" W:$D(IOF) @IOF D ^%ZISC G EXIT
 D ^%ZISC R !!,"<>",APCLX:DTIME
EXIT K ^TMP("APCLAGE",$J),X,Y,Z,APCLNN,APCLVAL,APCLAV,APCLDFN,DOB,APCLSNA,APCLSNO,A,G,APCLDEEP,APCLZZZ,APCLXXX,APCLLINE,APCLBIN,N,APCLAGEG
 Q
 ;
B1 F J=12:7 S I=I+1 Q:I>$L(APCLAGEG,";")  W ?J,$J($S($D(@G@(1,N,I)):^(I),1:"."),6) I I+1>$L(APCLAGEG,";") W ?(J+7),$J(@G@("V",N),6) Q
 Q
PAUSE I $E(IOST)="C" R !,"<>",APCLQ:DTIME S:'$T!(APCLQ=U) APCLLINE=999999 K APCLQ
 D HEADER
 Q
 ;
 ;W !?35,"AGE GROUPS",!
 W ! D HDR^APCLAGE
 I '$D(APCLSNA) S APCLSNA="ATTRIBUTE"
 S APCLNN=$E(APCLSNA,1,12) I $L(APCLNN)<12 S APCLNN=APCLNN_$J("",12-$L(APCLNN))
 W APCLNN
 S APCLNN=APCLAGEG,APCLI=0
 S APCLJ=""
 F APCLJ=14:7 S APCLI=APCLI+1,APCLX=$P(APCLNN,";",APCLI) Q:APCLX=""  W ?APCLJ,$S($P(APCLX,":")=$P(APCLX,":",2):"  ",1:($P(APCLX,":")_"-")),$P(APCLX,":",2)
 W ?(APCLJ+2),"TOT"
 S APCLX="",$P(APCLX,"-",80)="" W !,APCLX
 K APCLI,APCLJ,APCLX
 Q
 ;
 ;
SETBIN ;
 S APCLAGEG="0:0;1:4;5:14;15:19;20:24;25:44;45:64;65:125"
 Q