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

BCHRP1.m

Go to the documentation of this file.
BCHRP1 ; IHS/CMI/LAB - DETAILED/BRIEF LISTING OF RECORDS, REPORT 1 ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;IHS/CMI/LAB - Y2K
 ;IHS/CMI/LAB - tmp to xtmp
 ;
 ;
BDRL ;type of report
 W !!?5,"Report Print Selection."
 S DIR(0)="S^D:Detailed (132 column print);B:Brief (80 column print)",DIR("A")="Type of Report to Print",DIR("B")="B" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) S BCHQUIT=1 Q
 S BCHRTYPE=Y
 Q
PRINT ;EP
 S BCHCW=$S(BCHRTYPE="B":80,1:132)
 D COVPAGE^BCHRPTCP
 I '$D(^XTMP("BCHRPT",BCHJOB,BCHBTH,"RECORDS")) G DONE
 S (BCHRSRT,BCHFRST)="",(BCHPG,BCHRCNT)=0 K BCHQUIT
 F  S BCHRSRT=$O(^XTMP("BCHRPT",BCHJOB,BCHBTH,"RECORDS",BCHRSRT)) Q:BCHRSRT=""!($D(BCHQUIT))  D PRINT1
 G:$D(BCHQUIT) DONE
 I $Y>(IOSL-6) D HEADER G:$D(BCHQUIT) DONE
DONE ;
 D DONE^BCHUTIL1,XIT^BCHRPTU
 K ^XTMP("BCHRPT",BCHJOB,BCHBT)
 K BCHBT,BCHBTH,BCHJOB,BCHET
 Q
PRINT1 ;
 ;get readable sort variable
 S BCHSRTR="<NONE AVAILABLE>",BCHR=$O(^XTMP("BCHRPT",BCHJOB,BCHBTH,"RECORDS",BCHRSRT,"")) I BCHR]"" S BCHCRIT=BCHSORT D
 .S BCHR0=^BCHR(BCHR,0),DFN=$P(BCHR0,U,4) X:$D(^BCHSORT(BCHSORT,3)) ^BCHSORT(BCHSORT,3)
 .Q
 S (BCHSCNT,BCHR)=0 I $G(BCHSPAG)!($D(BCHFRST)) D HEADER Q:$D(BCHQUIT)
 K BCHFRST
 F  S BCHR=$O(^XTMP("BCHRPT",BCHJOB,BCHBTH,"RECORDS",BCHRSRT,BCHR)) Q:BCHR=""!($D(BCHQUIT))  S BCHR0=^BCHR(BCHR,0) D @("PRINT"_BCHRTYPE)
 I $Y>(IOSL-3) D HEADER Q:$D(BCHQUIT)
 W:$G(BCHSPAG) !!!,"SUB-TOTAL for ",BCHSORV," ",BCHRSRT,":  ",BCHSCNT
 Q
PRINTB ;
 S:$G(BCHSPAG) BCHSCNT=BCHSCNT+1
 I $Y>(IOSL-6) D HEADER Q:$D(BCHQUIT)
 S BCHRCNT=BCHRCNT+1
 ;begin Y2K - modified several lines to fit in 4 digit year
 W !,$E($P(BCHR0,U),4,5),"/",$E($P(BCHR0,U),6,7),"/",(1700+($E($P(BCHR0,U),1,3))) S X=$P(BCHR0,U,2) ;I X]"" W ?11,$P(^BCHTPROG(X,0),U,5) ;Y2000
 W ?11,$$PPINI^BCHUTIL(BCHR) ;Y2000
 W ?15,$S($P(BCHR0,U,4)]"":$E($P(^DPT($P(BCHR0,U,4),0),U),1,20),$G(^BCHR(BCHR,11))]"":$E($P(^BCHR(BCHR,11),U),1,20),1:"  <none>") ;Y2000
 S BCHACTL=$P(BCHR0,U,6) I BCHACTL]"" S BCHACTL=$E($P(^BCHTACTL(BCHACTL,0),U),1,5) ;Y2000
 S BCHSFAC=$P(BCHR0,U,5) I BCHSFAC]"" S BCHSFAC=$E($P(^AUTTLOC(BCHSFAC,0),U,2),1,5) ;Y2000
 I BCHSFAC="" S BCHSFAC=BCHACTL
 W ?38,BCHSFAC
 W ?44,$P(BCHR0,U,11)
 ;end Y2K
 I '$D(^BCHRPROB("AD",BCHR)) W ?51,"           --"
 E  S BCHP=0,BCHC=0 F  S BCHP=$O(^BCHRPROB("AD",BCHR,BCHP)) Q:BCHP'=+BCHP  S BCHPREC=^BCHRPROB(BCHP,0) D GETPROB  W:BCHC ! W ?49,BCHX S BCHC=BCHC+1
 Q
 ;
PRINTD ;detailed print
 S:$G(BCHSPAG) BCHSCNT=BCHSCNT+1
 I $Y>(IOSL-6) D HEADER Q:$D(BCHQUIT)
 S BCHRCNT=BCHRCNT+1
 ;begin Y2K - reformat for 4 digit year
 W !,$E($P(BCHR0,U),4,5),"/",$E($P(BCHR0,U),6,7),"/",(1700+($E($P(BCHR0,U),1,3))) S X=$P(BCHR0,U,2) ;I X]"" W ?11,$P(^BCHTPROG(X,0),U,5) ;Y2000
 W ?11,$$PPINI^BCHUTIL(BCHR) ;Y2000
 W ?15,$S($P(BCHR0,U,4)]"":$E($P(^DPT($P(BCHR0,U,4),0),U),1,20),$G(^BCHR(BCHR,11))]"":$E($P(^BCHR(BCHR,11),U),1,20),1:"  <none>") ;Y2000
 S BCHACTL=$P(BCHR0,U,6) I BCHACTL]"" S BCHACTL=$E($P(^BCHTACTL(BCHACTL,0),U),1,5) ;Y2000
 S BCHSFAC=$P(BCHR0,U,5) I BCHSFAC]"" S BCHSFAC=$E($P(^AUTTLOC(BCHSFAC,0),U,2),1,5) ;Y2000
 I BCHSFAC="" S BCHSFAC=BCHACTL
 W ?38,BCHSFAC
 W ?43,$P(BCHR0,U,11)
 ;end Y2K
 I '$D(^BCHRPROB("AD",BCHR)) W ?51,"           --"
 E  S BCHP=0,BCHC=0 F  S BCHP=$O(^BCHRPROB("AD",BCHR,BCHP)) Q:BCHP'=+BCHP  S BCHPREC=^BCHRPROB(BCHP,0) D GETPROB  W:BCHC ! W ?49,BCHX S BCHC=BCHC+1
 ;S X=$P(BCHR0,U,7) I X]"" W ?86,$E($P(^BCHTREF(X,0),U),1,7)
 ;S X=$P(BCHR0,U,8) I X]"" W ?96,$E($P(^BCHTREF(X,0),U),1,7)
 ;table both and print 1,2,3,etc
 KILL BCHREFB,BCHREFT,C
 S X=0,C=0 F  S X=$O(^BCHR(BCHR,41,X)) Q:X'=+X  S C=C+1,BCHREFB(C)=$P(^BCHTREF($P(^BCHR(BCHR,41,X,0),U),0),U,1)
 S X=0,C=0 F  S X=$O(^BCHR(BCHR,42,X)) Q:X'=+X  S C=C+1,BCHREFT(C)=$P(^BCHTREF($P(^BCHR(BCHR,42,X,0),U),0),U,1)
 F X=1:1:20 I $D(BCHREFB(X))!($D(BCHREFT(X))) D
 .I X>1 W !
 .W ?86,$E($G(BCHREFB(X)),1,7),?96,$E($G(BCHREFT(X)),1,7)
 W ?105,$P(BCHR0,U,9)
 W ?110,$P(BCHR0,U,11)
 W ?116,$P(BCHR0,U,12)
 ;
 Q
GETPROB ;
 S BCHX=""
 S X=$P(^BCHTPROB($P(BCHPREC,U),0),U,2)_" "
 S X=X_$S($P(BCHPREC,U,4)]"":$P(^BCHTSERV($P(BCHPREC,U,4),0),U,3),1:" ")_" "
 S X=X_$J($P(BCHPREC,U,5),3)_" "
 S N=$P(BCHPREC,U,6) I N,$D(^AUTNPOV(N,0)) S N=$P(^AUTNPOV(N,0),U)
 S X=X_$S(N]"":$E(N,1,20),1:"  ")
 S BCHX=BCHX_X
 Q
 D HEADER^BCHRP11
 Q