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

ACMRLP.m

Go to the documentation of this file.
ACMRLP ; IHS/TUCSON/TMJ - PRINT LISTER REPORT ; [ 06/01/1999  1:40 PM ]
 ;;2.0;ACM CASE MANAGEMENT SYSTEM;**1**;JAN 10, 1996
 ;IHS/CMI/LAB - patch 1 tmp to xtmp, flat file
 ;IHS/CMI/LAB - tmp to xtmp
START ;EP - Set up header line, dash line
 K ^TMP("AMHFLAT",$J) ;IHS/CMI/LAB
 I ACMCTYP="F" D FLATP^ACMRLF G DONE ;IHS/CMI/LAB
 S X=0,ACMHEAD="" F  S X=$O(^ACM(58.8,ACMRPT,12,X)) Q:X'=+X  S ACMHDR=$P(^ACM(58.1,$P(^ACM(58.8,ACMRPT,12,X,0),U),0),U,6),ACMLENG=$P(^ACM(58.8,ACMRPT,12,X,0),U,2),ACMHDR=$E(ACMHDR,1,ACMLENG) D
 .S J=$L(ACMHDR),ACMHEAD=ACMHEAD_ACMHDR,K=$P(^ACM(58.8,ACMRPT,12,X,0),U,2)+1 F I=J:1:K S ACMHEAD=ACMHEAD_" "
 .Q
 S ACMDASH="",$P(ACMDASH,"-",ACMTCW)="-"
 D COVPAGE^ACMRLP1 ;print cover page - note: if user ^'s out of cover page, processing continues
PROC ;process printing of report
 I ACMCTYP="T" G DONE ;--- if displaying only total, that was done in the cover page - go to done
 S ACMPG=0 I '$D(^XTMP("ACMRL",ACMJOB,ACMBTH)) G DONE
 S (ACMSRTV,ACMFRST)="" K ACMQUIT
 F  S ACMSRTV=$O(^XTMP("ACMRL",ACMJOB,ACMBTH,"DATA HITS",ACMSRTV)) Q:ACMSRTV=""!($D(ACMQUIT))  D V
 G:$D(ACMQUIT) DONE
 I $Y>(IOSL-4) D HEAD G:$D(ACMQUIT) DONE
 I $D(ACMRCNT) W !!!,"Total Patients ",ACMRCNT
DONE ;
 D DONE^ACMRLP2
 Q
V ;GETS DATA HITS
 S ACMSCNT=0
 ;get readable sort value
 S ACMSRTR="",DFN=$O(^XTMP("ACMRL",ACMJOB,ACMBTH,"DATA HITS",ACMSRTV,0)) I DFN]"" S ACMCRIT=ACMSORT D
 .S ACMIFN=$G(^ACM(41,"AC",DFN,ACMRG)) X:$D(^ACM(58.1,ACMSORT,3)) ^(3) S ACMSRTR=ACMPRNT
 I $G(ACMSPAG)!($D(ACMFRST)) D HEAD Q:$D(ACMQUIT)
 K ACMFRST
 S DFN=0 F  S DFN=$O(^XTMP("ACMRL",ACMJOB,ACMBTH,"DATA HITS",ACMSRTV,DFN)) Q:DFN'=+DFN!($D(ACMQUIT))  D
 .S ACMIFN=$G(^ACM(41,"AC",DFN,ACMRG)) D PRINT
 .Q
 Q:$D(ACMQUIT)
 I $Y>(IOSL-3) D HEAD Q:$D(ACMQUIT)
 W:$G(ACMSPAG) !!,"SUB-TOTAL for ",ACMSORV," ",ACMSRTR,":  ",ACMSCNT
 W:ACMCTYP="S" !,?10,$E(ACMSRTR,1,30),?45,$J(ACMSCNT,8)
 Q
PRINT ;
 S ACMSCNT=ACMSCNT+1 Q:ACMCTYP="S"
 K ^XTMP("ACMLINE",$J) S ^XTMP("ACMLINE",$J,1)=""
 I $Y>(IOSL-5) D HEAD Q:$D(ACMQUIT)
 S ACMI=0 F  S ACMI=$O(^ACM(58.8,ACMRPT,12,ACMI)) Q:ACMI'=+ACMI!($D(ACMQUIT))  S ACMCRIT=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U) D
 .I '$P(^ACM(58.1,ACMCRIT,0),U,8) D SINGLE Q
 .D MULT
 .Q
 S ACMX=0 F  S ACMX=$O(^XTMP("ACMLINE",$J,ACMX)) Q:ACMX'=+ACMX!($D(ACMQUIT))  D
 .I $Y>(IOSL-4) D HEAD Q:$D(ACMQUIT)
 .W !,^XTMP("ACMLINE",$J,ACMX)
 Q
SINGLE ;process single valued item
 K ACMPRNT
 S ACMX=0
 X:$D(^ACM(58.1,ACMCRIT,3)) ^(3)
 S ACMLENG=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2),ACMPRNT=$E(ACMPRNT,1,ACMLENG) D
 .S J=$L(ACMPRNT),^XTMP("ACMLINE",$J,1)=^XTMP("ACMLINE",$J,1)_ACMPRNT,K=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2)+1 F I=J:1:K S ^XTMP("ACMLINE",$J,1)=^XTMP("ACMLINE",$J,1)_" "
 .S X=1 F  S X=$O(^XTMP("ACMLINE",$J,X)) Q:X'=+X  I $L(^XTMP("ACMLINE",$J,X))<$L(^XTMP("ACMLINE",$J,1)) S K=$L(^XTMP("ACMLINE",$J,X))+1,J=$L(^XTMP("ACMLINE",$J,1)) F I=K:1:J S ^XTMP("ACMLINE",$J,X)=^XTMP("ACMLINE",$J,X)_" "
 Q
MULT ;
 K ACMPRNT,ACMPRNM S (ACMX,ACMPCNT)=0
 X:$D(^ACM(58.1,ACMCRIT,3)) ^(3)
 I '$D(ACMPRNM) S ACMPRNT="--" D
 .S ACMLENG=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2),ACMPRNT=$E(ACMPRNT,1,ACMLENG) D
 ..S J=$L(ACMPRNT),^XTMP("ACMLINE",$J,1)=^XTMP("ACMLINE",$J,1)_ACMPRNT,K=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2)+1 F I=J:1:K S ^XTMP("ACMLINE",$J,1)=^XTMP("ACMLINE",$J,1)_" "
 S X=0 F  S X=$O(ACMPRNM(X)) Q:X'=+X  D
 .I X=1 D  Q
 ..S ACMLENG=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2),ACMPRNT=$E(ACMPRNM(1),1,ACMLENG) D
 ...S J=$L(ACMPRNT),^XTMP("ACMLINE",$J,1)=^XTMP("ACMLINE",$J,1)_ACMPRNT,K=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2)+1 F I=J:1:K S ^XTMP("ACMLINE",$J,1)=^XTMP("ACMLINE",$J,1)_" "
 .S ACMLENG=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2),ACMPRNT=$E(ACMPRNM(X),1,ACMLENG) D
 ..I '$D(^XTMP("ACMLINE",$J,X)) S ^XTMP("ACMLINE",$J,X)="",K=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2)+1,$P(^XTMP("ACMLINE",$J,X)," ",($L(^XTMP("ACMLINE",$J,1))-K))=""
 ..S J=$L(ACMPRNT),^XTMP("ACMLINE",$J,X)=^XTMP("ACMLINE",$J,X)_ACMPRNT,K=$P(^ACM(58.8,ACMRPT,12,ACMI,0),U,2)+1 F I=J:1:K S ^XTMP("ACMLINE",$J,X)=^XTMP("ACMLINE",$J,X)_" "
 S X=1 F  S X=$O(^XTMP("ACMLINE",$J,X)) Q:X'=+X  I $L(^XTMP("ACMLINE",$J,X))<$L(^XTMP("ACMLINE",$J,1)) S K=$L(^XTMP("ACMLINE",$J,X))+1,J=$L(^XTMP("ACMLINE",$J,1)) F I=K:1:J S ^XTMP("ACMLINE",$J,X)=^XTMP("ACMLINE",$J,X)_" "
 Q
DIQ ;
 K ACMPRNT,ACMFILE,ACMFIEL
 S ACMFILE=$P($P(^ACM(58.1,ACMCRIT,0),U,4),","),ACMFIEL=$P($P(^(0),U,4),",",2)
 S DIQ(0)="EN",DIQ="ACMPRNT(",DIC=ACMFILE,DR=ACMFIEL D EN^DIQ1 K DIC,DR,DIQ
 I '$D(ACMPRNT(ACMFILE,DA,ACMFIEL,"E")) S ACMPRNT(ACMFILE,DA,ACMFIEL,"E")="--"
 S ACMPRNT=ACMPRNT(ACMFILE,DA,ACMFIEL,"E")
 Q
 D HEAD^ACMRLP2
 Q