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

BNIGVLP.m

Go to the documentation of this file.
BNIGVLP ; IHS/CMI/LAB - print bni general retrieval ;
 ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
START ;EP - Set up header line, dash line
 S BNIGFCNT=0
 S BNIIOSL=$S($G(BNIGUI):55,1:$G(IOSL))
 I BNIGCTYP="L" D DELIMIT^BNIGVLP8 Q
 S X=0,BNIGHEAD="" F  S X=$O(^BNIRTMP(BNIGRPT,12,X)) Q:X'=+X  S BNIGHDR=$P(^BNIGRI($P(^BNIRTMP(BNIGRPT,12,X,0),U),0),U,6),BNIGLENG=$P(^BNIRTMP(BNIGRPT,12,X,0),U,2),BNIGHDR=$E(BNIGHDR,1,BNIGLENG) D
 .S J=$L(BNIGHDR),BNIGHEAD=BNIGHEAD_BNIGHDR,K=$P(^BNIRTMP(BNIGRPT,12,X,0),U,2)+1 F I=J:1:K S BNIGHEAD=BNIGHEAD_" "
 .Q
 S BNIGDASH="",$P(BNIGDASH,"-",BNIGTCW)="-"
 D COVPAGE^BNIGVLP1 ;print cover page - note: if user ^'s out of cover page, processing continues
PROC ;process printing of report
 I BNIGCTYP="T" G DONE ;--- if displaying only total, that was done in the cover page - go to done
 I BNIGCTYP="C" G DONE ;--- if doing a template, that's already done so goto done
 S BNIGPG=0 I '$D(^XTMP("BNIGVL",BNIGJOB,BNIGBTH)) G DONE
 S (BNIGSRTV,BNIGFRST)="" K BNIGQUIT
 D HEAD F  S BNIGSRTV=$O(^XTMP("BNIGVL",BNIGJOB,BNIGBTH,"DATA HITS",BNIGSRTV)) Q:BNIGSRTV=""!($D(BNIGQUIT))  D V
 G:$D(BNIGQUIT) DONE
 I $Y>(BNIIOSL-4) D HEAD G:$D(BNIGQUIT) DONE
 I $D(BNIGRCNT) W !!!,"Total CPHAD Activity records:  ",BNIGRCNT
DONE ;
 D DONE^BNIGVLP2
 Q
V ;GETS DATA HITS
 S BNIGSCNT=0
 ;get readable sort value
 K BNIGPRNT
 S BNIGSRTR="",BNIGVIEN=$O(^XTMP("BNIGVL",BNIGJOB,BNIGBTH,"DATA HITS",BNIGSRTV,0)) I BNIGVIEN]"" S BNIGCRIT=BNIGSORT D
 .I BNIGPTVS="R" S BNIGVREC=^BNIREC(BNIGVIEN,0) X:$D(^BNIGRI(BNIGSORT,3)) ^(3) S BNIGSRTR=BNIGPRNT
 I $G(BNIGSPAG)!($D(BNIGFRST)) D HEAD Q:$D(BNIGQUIT)
 K BNIGFRST
 S BNIGVIEN=0 F  S BNIGVIEN=$O(^XTMP("BNIGVL",BNIGJOB,BNIGBTH,"DATA HITS",BNIGSRTV,BNIGVIEN)) Q:BNIGVIEN'=+BNIGVIEN!($D(BNIGQUIT))  D
 .I BNIGPTVS="R" S BNIGVREC=^BNIREC(BNIGVIEN,0) D PRINT Q
 .Q
 Q:$D(BNIGQUIT)
 I $Y>(BNIIOSL-3) D HEAD Q:$D(BNIGQUIT)
 I $G(BNIGSPAG) W !!,"SUB-TOTAL for ",BNIGSORV," ",BNIGSRTR,":  ",BNIGSCNT I BNIGCTYP="S",(BNIGPTVS="R") W !,?10,$E(BNIGSRTR,1,30),?45,$J(BNIGSCNT,8)
 I BNIGCTYP="S" W !,?10,$E(BNIGSRTR,1,30),?45,$J(BNIGSCNT,8)
 Q
PRINT ;
 S BNIGSCNT=BNIGSCNT+1 Q:BNIGCTYP="S"
 K ^XTMP("BNIGLINE",$J) S ^XTMP("BNIGLINE",$J,1)=""
 I $Y>(BNIIOSL-5) D HEAD Q:$D(BNIGQUIT)
 S BNIGI=0 F  S BNIGI=$O(^BNIRTMP(BNIGRPT,12,BNIGI)) Q:BNIGI'=+BNIGI!($D(BNIGQUIT))  S BNIGCRIT=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U) D
 .I '$P(^BNIGRI(BNIGCRIT,0),U,8) D SINGLE Q
 .D MULT
 .Q
 S BNIGX=0 F  S BNIGX=$O(^XTMP("BNIGLINE",$J,BNIGX)) Q:BNIGX'=+BNIGX!($D(BNIGQUIT))  D
 .I $Y>(BNIIOSL-4) D HEAD Q:$D(BNIGQUIT)
 .W !,^XTMP("BNIGLINE",$J,BNIGX)
 Q
SINGLE ;process single valued item
 K BNIGPRNT
 S BNIGX=0
 X:$D(^BNIGRI(BNIGCRIT,3)) ^(3)
 S BNIGLENG=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2),BNIGPRNT=$E(BNIGPRNT,1,BNIGLENG) D
 .S J=$L(BNIGPRNT),^XTMP("BNIGLINE",$J,1)=^XTMP("BNIGLINE",$J,1)_BNIGPRNT,K=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2)+1 F I=J:1:K S ^XTMP("BNIGLINE",$J,1)=^XTMP("BNIGLINE",$J,1)_" "
 .S X=1 F  S X=$O(^XTMP("BNIGLINE",$J,X)) Q:X'=+X  I $L(^XTMP("BNIGLINE",$J,X))<$L(^XTMP("BNIGLINE",$J,1)) S K=$L(^XTMP("BNIGLINE",$J,X))+1,J=$L(^XTMP("BNIGLINE",$J,1)) F I=K:1:J S ^XTMP("BNIGLINE",$J,X)=^XTMP("BNIGLINE",$J,X)_" "
 Q
MULT ;
 K BNIGPRNT,BNIGPRNM,BNIGY S (BNIGX,BNIGPCNT)=0
 X:$D(^BNIGRI(BNIGCRIT,3)) ^(3)
 I '$D(BNIGPRNM) S BNIGPRNT="--" D
 .S BNIGLENG=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2),BNIGPRNT=$E(BNIGPRNT,1,BNIGLENG) D
 ..S J=$L(BNIGPRNT),^XTMP("BNIGLINE",$J,1)=^XTMP("BNIGLINE",$J,1)_BNIGPRNT,K=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2)+1 F I=J:1:K S ^XTMP("BNIGLINE",$J,1)=^XTMP("BNIGLINE",$J,1)_" "
 S X=0 F  S X=$O(BNIGPRNM(X)) Q:X'=+X  D
 .I X=1 D  Q
 ..S BNIGLENG=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2),BNIGPRNT=$E(BNIGPRNM(1),1,BNIGLENG) D
 ...S J=$L(BNIGPRNT),^XTMP("BNIGLINE",$J,1)=^XTMP("BNIGLINE",$J,1)_BNIGPRNT,K=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2)+1 F I=J:1:K S ^XTMP("BNIGLINE",$J,1)=^XTMP("BNIGLINE",$J,1)_" "
 .S BNIGLENG=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2),BNIGPRNT=$E(BNIGPRNM(X),1,BNIGLENG) D
 ..I '$D(^XTMP("BNIGLINE",$J,X)) S ^XTMP("BNIGLINE",$J,X)="",K=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2)+1,$P(^XTMP("BNIGLINE",$J,X)," ",($L(^XTMP("BNIGLINE",$J,1))-K))=""
 ..S J=$L(BNIGPRNT),^XTMP("BNIGLINE",$J,X)=^XTMP("BNIGLINE",$J,X)_BNIGPRNT,K=$P(^BNIRTMP(BNIGRPT,12,BNIGI,0),U,2)+1 F I=J:1:K S ^XTMP("BNIGLINE",$J,X)=^XTMP("BNIGLINE",$J,X)_" "
 S X=1 F  S X=$O(^XTMP("BNIGLINE",$J,X)) Q:X'=+X  I $L(^XTMP("BNIGLINE",$J,X))<$L(^XTMP("BNIGLINE",$J,1)) S K=$L(^XTMP("BNIGLINE",$J,X))+1,J=$L(^XTMP("BNIGLINE",$J,1)) F I=K:1:J S ^XTMP("BNIGLINE",$J,X)=^XTMP("BNIGLINE",$J,X)_" "
 Q
DIQ ;
 K BNIGPRNT,BNIGFILE,BNIGFIEL
 S BNIGFILE=$P($P(^BNIGRI(BNIGCRIT,0),U,4),","),BNIGFIEL=$P($P(^(0),U,4),",",2)
 S DIQ(0)="EN",DIQ="BNIGPRNT(",DIC=BNIGFILE,DR=BNIGFIEL D EN^DIQ1 K DIC,DR,DIQ
 I '$D(BNIGPRNT(BNIGFILE,DA,BNIGFIEL,"E")) S BNIGPRNT(BNIGFILE,DA,BNIGFIEL,"E")="--"
 S BNIGPRNT=BNIGPRNT(BNIGFILE,DA,BNIGFIEL,"E")
 Q
 D HEAD^BNIGVLP2
 Q