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

BCHRLP.m

Go to the documentation of this file.
BCHRLP ; IHS/CMI/LAB - PRINT CHR RECORD REPORT ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;
 ;IHS/CMI/LAB - tmp to xtmp
 ;CMI/TUCSON/LAB - modified 2 lines to replace a reference to the 8th piece to a reference to 4th piece 6/22/98 patch 5
START ;EP - Set up header line, dash line
 S X=0,BCHHEAD="" F  S X=$O(^BCHTRPT(BCHRPT,12,X)) Q:X'=+X  S BCHHDR=$P(^BCHSORT($P(^BCHTRPT(BCHRPT,12,X,0),U),0),U,6),BCHLENG=$P(^BCHTRPT(BCHRPT,12,X,0),U,2),BCHHDR=$E(BCHHDR,1,BCHLENG) D
 .S J=$L(BCHHDR),BCHHEAD=BCHHEAD_BCHHDR,K=$P(^BCHTRPT(BCHRPT,12,X,0),U,2)+1 F I=J:1:K S BCHHEAD=BCHHEAD_" "
 .Q
 S BCHDASH="",$P(BCHDASH,"-",BCHTCW)="-"
 D COVPAGE^BCHRLP1 ;print cover page - note: if user ^'s out of cover page, processing continues
PROC ;process printing of report
 I BCHCTYP="T" G DONE ;--- if displaying only total, that was done in the cover page - go to done
 S BCHPG=0 I '$D(^XTMP("BCHRL",BCHJOB,BCHBTH)) G DONE
 S (BCHSRTV,BCHFRST)="" K BCHQUIT
 F  S BCHSRTV=$O(^XTMP("BCHRL",BCHJOB,BCHBTH,"DATA HITS",BCHSRTV)) Q:BCHSRTV=""!($D(BCHQUIT))  D V
 G:$D(BCHQUIT) DONE
 I $Y>(IOSL-4) D HEAD G:$D(BCHQUIT) DONE
 I $D(BCHRCNT),BCHPTVS="V" W !!!,"Total ",$S(BCHPTVS="P":"Patients",1:"Records"),":  ",BCHRCNT
 ;W !!,"Total Patients:  ",BCHPTCT
DONE ;
 D DONE^BCHUTIL1
 Q
V ;GETS DATA HITS
 S BCHSCNT=0
 ;get readable sort value
 S BCHSRTR="",BCHR=$O(^XTMP("BCHRL",BCHJOB,BCHBTH,"DATA HITS",BCHSRTV,"")) I BCHR]"" S BCHCRIT=BCHSORT D
 .I BCHPTVS="V" S BCHR0=^BCHR(BCHR,0),DFN=$P(BCHR0,U,4) X:$D(^BCHSORT(BCHSORT,3)) ^(3) S BCHSRTR=BCHPRNT ;CMI/TUCSON/LAB - changed ,U,8 to ,U,4 PATCH 5 6/22/98
 .I BCHPTVS="P" S DFN=BCHR X:$D(^BCHSORT(BCHSORT,3)) ^(3) S BCHSRTR=BCHPRNT
 I $G(BCHSPAG)!($D(BCHFRST)) D HEAD Q:$D(BCHQUIT)
 K BCHFRST
 S BCHR=0 F  S BCHR=$O(^XTMP("BCHRL",BCHJOB,BCHBTH,"DATA HITS",BCHSRTV,BCHR)) Q:BCHR'=+BCHR!($D(BCHQUIT))  D
 .I BCHPTVS="V" S BCHR0=^BCHR(BCHR,0),DFN=$P(BCHR0,U,4) D PRINT Q  ;CMI/TUCSON/LAB - changed 8 to 4 patch 5 6/22/98
 .S DFN=BCHR D PRINT
 .Q
 Q:$D(BCHQUIT)
 I $Y>(IOSL-3) D HEAD Q:$D(BCHQUIT)
 W:$G(BCHSPAG) !!,"SUB-TOTAL for ",BCHSORV," ",BCHSRTR,":  ",BCHSCNT
 W:BCHCTYP="S" !?10,$E(BCHSRTR,1,30),?45,$J(BCHSCNT,8)
 Q
PRINT ;
 S BCHSCNT=BCHSCNT+1 Q:BCHCTYP="S"
 K ^XTMP("BCHLINE",$J) S ^XTMP("BCHLINE",$J,1)=""
 I $Y>(IOSL-5) D HEAD Q:$D(BCHQUIT)
 S BCHI=0 F  S BCHI=$O(^BCHTRPT(BCHRPT,12,BCHI)) Q:BCHI'=+BCHI!($D(BCHQUIT))  S BCHCRIT=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U) D
 .I '$P(^BCHSORT(BCHCRIT,0),U,8) D SINGLE Q
 .D MULT
 .Q
 S BCHX=0 F  S BCHX=$O(^XTMP("BCHLINE",$J,BCHX)) Q:BCHX'=+BCHX!($D(BCHQUIT))  D
 .I $Y>(IOSL-4) D HEAD Q:$D(BCHQUIT)
 .W !,^XTMP("BCHLINE",$J,BCHX)
 Q
SINGLE ;process single valued item
 K BCHPRNT
 S BCHX=0
 X:$D(^BCHSORT(BCHCRIT,3)) ^(3) I $G(BCHPRNT)="" S BCHPRNT="--"
 S BCHLENG=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2),BCHPRNT=$E($G(BCHPRNT),1,BCHLENG) D
 .S J=$L(BCHPRNT),^XTMP("BCHLINE",$J,1)=^XTMP("BCHLINE",$J,1)_BCHPRNT,K=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2)+1 F I=J:1:K S ^XTMP("BCHLINE",$J,1)=^XTMP("BCHLINE",$J,1)_" "
 .S X=1 F  S X=$O(^XTMP("BCHLINE",$J,X)) Q:X'=+X  I $L(^XTMP("BCHLINE",$J,X))<$L(^XTMP("BCHLINE",$J,1)) S K=$L(^XTMP("BCHLINE",$J,X))+1,J=$L(^XTMP("BCHLINE",$J,1)) F I=K:1:J S ^XTMP("BCHLINE",$J,X)=^XTMP("BCHLINE",$J,X)_" "
 Q
MULT ;
 K BCHPRNT,BCHPRNM S (BCHX,BCHPCNT)=0
 X:$D(^BCHSORT(BCHCRIT,3)) ^(3)
 I '$D(BCHPRNM) S BCHPRNT="--" D
 .S BCHLENG=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2),BCHPRNT=$E(BCHPRNT,1,BCHLENG) D
 ..S J=$L(BCHPRNT),^XTMP("BCHLINE",$J,1)=^XTMP("BCHLINE",$J,1)_BCHPRNT,K=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2)+1 F I=J:1:K S ^XTMP("BCHLINE",$J,1)=^XTMP("BCHLINE",$J,1)_" "
 S X=0 F  S X=$O(BCHPRNM(X)) Q:X'=+X  D
 .I X=1 D  Q
 ..S BCHLENG=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2),BCHPRNT=$E(BCHPRNM(1),1,BCHLENG) D
 ...S J=$L(BCHPRNT),^XTMP("BCHLINE",$J,1)=^XTMP("BCHLINE",$J,1)_BCHPRNT,K=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2)+1 F I=J:1:K S ^XTMP("BCHLINE",$J,1)=^XTMP("BCHLINE",$J,1)_" "
 .S BCHLENG=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2),BCHPRNT=$E(BCHPRNM(X),1,BCHLENG) D
 ..I '$D(^XTMP("BCHLINE",$J,X)) S ^XTMP("BCHLINE",$J,X)="",K=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2)+1,$P(^XTMP("BCHLINE",$J,X)," ",($L(^XTMP("BCHLINE",$J,1))-K))=""
 ..S J=$L(BCHPRNT),^XTMP("BCHLINE",$J,X)=^XTMP("BCHLINE",$J,X)_BCHPRNT,K=$P(^BCHTRPT(BCHRPT,12,BCHI,0),U,2)+1 F I=J:1:K S ^XTMP("BCHLINE",$J,X)=^XTMP("BCHLINE",$J,X)_" "
 S X=1 F  S X=$O(^XTMP("BCHLINE",$J,X)) Q:X'=+X  I $L(^XTMP("BCHLINE",$J,X))<$L(^XTMP("BCHLINE",$J,1)) S K=$L(^XTMP("BCHLINE",$J,X))+1,J=$L(^XTMP("BCHLINE",$J,1)) F I=K:1:J S ^XTMP("BCHLINE",$J,X)=^XTMP("BCHLINE",$J,X)_" "
 Q
DIQ ;
 K BCHPRNT,BCHFILE,BCHFIEL
 S BCHFILE=$P($P(^BCHSORT(BCHCRIT,0),U,4),","),BCHFIEL=$P($P(^(0),U,4),",",2)
 S DIQ(0)="EN",DIQ="BCHPRNT(",DIC=BCHFILE,DR=BCHFIEL D EN^DIQ1 K DIC,DR,DIQ
 I '$D(BCHPRNT(BCHFILE,DA,BCHFIEL,"E")) S BCHPRNT(BCHFILE,DA,BCHFIEL,"E")="--"
 S BCHPRNT=BCHPRNT(BCHFILE,DA,BCHFIEL,"E")
 Q
 D HEAD^BCHRLP2
 Q