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

BWGRVLP.m

Go to the documentation of this file.
BWGRVLP ; IHS/CMI/LAB - PRINT WH GENERAL REPORT ;15-Feb-2003 21:53;PLS
 ;;2.0;WOMEN'S HEALTH;**6,8**;MAY 16, 1996
START ;EP - Set up header line, dash line
 S BWGRFCNT=0
 S X=0,BWGRHEAD="" F  S X=$O(^BWGRTRPT(BWGRRPT,12,X)) Q:X'=+X  S BWGRHDR=$P(^BWGRI($P(^BWGRTRPT(BWGRRPT,12,X,0),U),0),U,6),BWGRLENG=$P(^BWGRTRPT(BWGRRPT,12,X,0),U,2),BWGRHDR=$E(BWGRHDR,1,BWGRLENG) D
 .S J=$L(BWGRHDR),BWGRHEAD=BWGRHEAD_BWGRHDR,K=$P(^BWGRTRPT(BWGRRPT,12,X,0),U,2)+1 F I=J:1:K S BWGRHEAD=BWGRHEAD_" "
 .Q
 S BWGRDASH="",$P(BWGRDASH,"-",BWGRTCW)="-"
 D COVPAGE^BWGRVLP1 ;print cover page - note: if user ^'s out of cover page, processing continues
PROC ;process printing of report
 I BWGRCTYP="T" G DONE ;--- if displaying only total, that was done in the cover page - go to done
 I BWGRCTYP="C" G DONE ;--- if doing a template, that's already done so goto done
 S BWGRPG=0 I '$D(^XTMP("BWGRVL",BWGRJOB,BWGRBTH)) G DONE
 S (BWGRSRTV,BWGRFRST)="" K BWGRQUIT
 F  S BWGRSRTV=$O(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"DATA HITS",BWGRSRTV)) Q:BWGRSRTV=""!($D(BWGRQUIT))  D V
 G:$D(BWGRQUIT) DONE
 I $Y>(IOSL-4) D HEAD G:$D(BWGRQUIT) DONE
 I $D(BWGRRCNT) W !!!,"Total ",$S(BWGRPTVS="P":"Patients",1:"Procedures"),":  ",BWGRRCNT
 I $G(BWGRPTVS)="R" W !,"Total Patients:  ",BWGRPTCT
DONE ;
 D DONE^BWGRVLP2
 Q
V ;GETS DATA HITS
 S BWGRSCNT=0
 ;get readable sort value
 K BWGRPRNT
 S BWGRSRTR="",BWGRVIEN=$O(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"DATA HITS",BWGRSRTV,0)) I BWGRVIEN]"" S BWGRCRIT=BWGRSORT D
 .I BWGRPTVS="R" S BWGRVREC=^BWPCD(BWGRVIEN,0),DFN=$P(BWGRVREC,U,2) X:$D(^BWGRI(BWGRSORT,3)) ^(3) S BWGRSRTR=BWGRPRNT
 .I BWGRPTVS="P" S DFN=BWGRVIEN X:$D(^BWGRI(BWGRSORT,3)) ^(3) S BWGRSRTR=BWGRPRNT
 I $G(BWGRSPAG)!($D(BWGRFRST)) D HEAD Q:$D(BWGRQUIT)
 K BWGRFRST
 S BWGRVIEN=0 F  S BWGRVIEN=$O(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"DATA HITS",BWGRSRTV,BWGRVIEN)) Q:BWGRVIEN'=+BWGRVIEN!($D(BWGRQUIT))  D
 .I BWGRPTVS="R" S BWGRVREC=^BWPCD(BWGRVIEN,0),DFN=$P(BWGRVREC,U,2) D PRINT Q
 .S DFN=BWGRVIEN D PRINT
 .Q
 Q:$D(BWGRQUIT)
 I $Y>(IOSL-3) D HEAD Q:$D(BWGRQUIT)
 I $G(BWGRSPAG) W !!,"SUB-TOTAL for ",BWGRSORV," ",BWGRSRTR,":  ",BWGRSCNT I BWGRPTVS="R" W "    # of PATIENTS:  ",$S($D(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRTV)):^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRTV),1:0)
 I BWGRCTYP="S",(BWGRPTVS="R") W !,?10,$E(BWGRSRTR,1,30),?45,$J(BWGRSCNT,8)," (PROC)",?60,$S($D(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRTV)):$J(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRTV),8),1:0)," (PATS)"
 I BWGRCTYP="S",(BWGRPTVS="P") W !,?10,$E(BWGRSRTR,1,30),?45,$J(BWGRSCNT,8)
 Q
PRINT ;
 S BWGRSCNT=BWGRSCNT+1 Q:BWGRCTYP="S"
 K ^XTMP("BWGRLINE",$J) S ^XTMP("BWGRLINE",$J,1)=""
 I $Y>(IOSL-5) D HEAD Q:$D(BWGRQUIT)
 S BWGRI=0 F  S BWGRI=$O(^BWGRTRPT(BWGRRPT,12,BWGRI)) Q:BWGRI'=+BWGRI!($D(BWGRQUIT))  S BWGRCRIT=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U) D
 .I '$P(^BWGRI(BWGRCRIT,0),U,8) D SINGLE Q
 .D MULT
 .Q
 S BWGRX=0 F  S BWGRX=$O(^XTMP("BWGRLINE",$J,BWGRX)) Q:BWGRX'=+BWGRX!($D(BWGRQUIT))  D
 .I $Y>(IOSL-4) D HEAD Q:$D(BWGRQUIT)
 .W !,^XTMP("BWGRLINE",$J,BWGRX)
 Q
SINGLE ;process single valued item
 K BWGRPRNT
 S BWGRX=0
 X:$D(^BWGRI(BWGRCRIT,3)) ^(3)
 S BWGRLENG=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2),BWGRPRNT=$E(BWGRPRNT,1,BWGRLENG) D
 .S J=$L(BWGRPRNT),^XTMP("BWGRLINE",$J,1)=^XTMP("BWGRLINE",$J,1)_BWGRPRNT,K=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2)+1 F I=J:1:K S ^XTMP("BWGRLINE",$J,1)=^XTMP("BWGRLINE",$J,1)_" "
 .S X=1 F  S X=$O(^XTMP("BWGRLINE",$J,X)) Q:X'=+X  I $L(^XTMP("BWGRLINE",$J,X))<$L(^XTMP("BWGRLINE",$J,1)) S K=$L(^XTMP("BWGRLINE",$J,X))+1,J=$L(^XTMP("BWGRLINE",$J,1)) F I=K:1:J S ^XTMP("BWGRLINE",$J,X)=^XTMP("BWGRLINE",$J,X)_" "
 Q
MULT ;
 K BWGRPRNT,BWGRPRNM,BWGRY S (BWGRX,BWGRPCNT)=0
 X:$D(^BWGRI(BWGRCRIT,3)) ^(3)
 I '$D(BWGRPRNM) S BWGRPRNT="--" D
 .S BWGRLENG=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2),BWGRPRNT=$E(BWGRPRNT,1,BWGRLENG) D
 ..S J=$L(BWGRPRNT),^XTMP("BWGRLINE",$J,1)=^XTMP("BWGRLINE",$J,1)_BWGRPRNT,K=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2)+1 F I=J:1:K S ^XTMP("BWGRLINE",$J,1)=^XTMP("BWGRLINE",$J,1)_" "
 S X=0 F  S X=$O(BWGRPRNM(X)) Q:X'=+X  D
 .I X=1 D  Q
 ..S BWGRLENG=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2),BWGRPRNT=$E(BWGRPRNM(1),1,BWGRLENG) D
 ...S J=$L(BWGRPRNT),^XTMP("BWGRLINE",$J,1)=^XTMP("BWGRLINE",$J,1)_BWGRPRNT,K=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2)+1 F I=J:1:K S ^XTMP("BWGRLINE",$J,1)=^XTMP("BWGRLINE",$J,1)_" "
 .S BWGRLENG=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2),BWGRPRNT=$E(BWGRPRNM(X),1,BWGRLENG) D
 ..I '$D(^XTMP("BWGRLINE",$J,X)) S ^XTMP("BWGRLINE",$J,X)="",K=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2)+1,$P(^XTMP("BWGRLINE",$J,X)," ",($L(^XTMP("BWGRLINE",$J,1))-K))=""
 ..S J=$L(BWGRPRNT),^XTMP("BWGRLINE",$J,X)=^XTMP("BWGRLINE",$J,X)_BWGRPRNT,K=$P(^BWGRTRPT(BWGRRPT,12,BWGRI,0),U,2)+1 F I=J:1:K S ^XTMP("BWGRLINE",$J,X)=^XTMP("BWGRLINE",$J,X)_" "
 S X=1 F  S X=$O(^XTMP("BWGRLINE",$J,X)) Q:X'=+X  I $L(^XTMP("BWGRLINE",$J,X))<$L(^XTMP("BWGRLINE",$J,1)) S K=$L(^XTMP("BWGRLINE",$J,X))+1,J=$L(^XTMP("BWGRLINE",$J,1)) F I=K:1:J S ^XTMP("BWGRLINE",$J,X)=^XTMP("BWGRLINE",$J,X)_" "
 Q
DIQ ;
 K BWGRPRNT,BWGRFILE,BWGRFIEL
 S BWGRFILE=$P($P(^BWGRI(BWGRCRIT,0),U,4),","),BWGRFIEL=$P($P(^(0),U,4),",",2)
 S DIQ(0)="EN",DIQ="BWGRPRNT(",DIC=BWGRFILE,DR=BWGRFIEL D EN^DIQ1 K DIC,DR,DIQ
 I '$D(BWGRPRNT(BWGRFILE,DA,BWGRFIEL,"E")) S BWGRPRNT(BWGRFILE,DA,BWGRFIEL,"E")="--"
 S BWGRPRNT=BWGRPRNT(BWGRFILE,DA,BWGRFIEL,"E")
 Q
 D HEAD^BWGRVLP2
 Q
WRITEF ;write flat file from global
 D WRITEF^BWGRVLP2
 Q