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

BMCRLP1.m

Go to the documentation of this file.
BMCRLP1 ; IHS/PHXAO/TMJ - CONT OF BMCRLP ;    
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
 ;IHS/ITSC/FCJ FX FOR PRINTING MULT WP ENTRIES
 ;IHS/ITSC/FCJ ADDED CSRVR,BOCOM AND MED MODULES WILL
 ;    TEST FOR SCREENS WHEN PRINTING CASE REVIEWER,BO COMMENTS AND
 ;    MED HX
 ;
 ;
COVPAGE ;EP
 I $E(IOST,1,2)="C-" W:$D(IOF) @IOF
 W !?20,"REFERRED CARE INFORMATION SYSTEM  ",$S(BMCPTVS="P":"PATIENT",1:"REFERRAL")," ",$S(BMCCTYP="D":"LISTING",1:"COUNT")
 W !!,"REPORT REQUESTED BY: ",$P(^VA(200,DUZ,0),U)
 W !!,"The following report contains a ",$S(BMCPTVS="R":"RCIS Referral",1:"Patient")," report based on the",!,"following criteria:",!
SHOW ;
 W !,$S(BMCPTVS="P":"PATIENT",1:"REFERRAL")," Selection Criteria"
 ;W:BMCTYPE="D" !!?6,"Encounter Date range:  ",BMCBDD," to ",BMCEDD,!
 ;W:BMCTYPE="S" !!?6,"Search Template: ",$P(^DIBT(BMCSEAT,0),U),!
 I '$D(^BMCRTMP(BMCRPT,11)) G SHOWP
 S BMCI=0 F  S BMCI=$O(^BMCRTMP(BMCRPT,11,BMCI)) Q:BMCI'=+BMCI  D
 .I $Y>(IOSL-5) D PAUSE^BMCRL01 W @IOF
 .W !?6,$P(^BMCTSORT(BMCI,0),U),":  "
 .K BMCQ S BMCY="",C=0 K BMCQ F  S BMCY=$O(^BMCRTMP(BMCRPT,11,BMCI,11,"B",BMCY)) S C=C+1 W:C'=1&(BMCY'="") " ; " Q:BMCY=""!($D(BMCQ))  S X=BMCY X:$D(^BMCTSORT(BMCI,2)) ^(2) W X
 K BMCQ
SHOWP ;
 I BMCCTYP="T" D COUNT Q
 I BMCCTYP="S" D  I 1
 .I $Y>(IOSL-6) D PAUSE^BMCRL01 W @IOF
 .W !!,"Report will contain sub-totals by ",$P(^BMCTSORT(BMCSORT,0),U),"."
 .I '$D(^XTMP("BMCRL",BMCJOB,BMCBTH)) W !!,"NO DATA TO REPORT.",! D PAUSE^BMCRL01
 .Q
 I BMCCTYP'="D" D PAUSE^BMCRL01 Q
 I $Y>(IOSL-4) D PAUSE^BMCRL01 W @IOF
 W !!,"PRINT Field Selection"
 I '$D(^BMCRTMP(BMCRPT,12)) G PAUSE
 S BMCI=0 F  S BMCI=$O(^BMCRTMP(BMCRPT,12,BMCI)) Q:BMCI'=+BMCI  S BMCCRIT=$P(^BMCRTMP(BMCRPT,12,BMCI,0),U) D
 .I $Y>(IOSL-4) D PAUSE^BMCRL01 W:$D(IOF) @IOF
 .W !?6,$P(^BMCTSORT(BMCCRIT,0),U),"  (" S X=$O(^BMCRTMP(BMCRPT,12,"B",BMCCRIT,"")) W $P(^BMCRTMP(BMCRPT,12,X,0),U,2),")"
 I $Y>(IOSL-4) D PAUSE^BMCRL01 W:$D(IOF) @IOF
 W !?10,"     TOTAL column width: ",BMCTCW
 Q:'$G(BMCSORT)
 I $Y>(IOSL-4) D PAUSE^BMCRL01 W:$D(IOF) @IOF
 W !!,$S(BMCPTVS="R":"Referrals",1:"Patients")," will be SORTED by:  ",$P(^BMCTSORT(BMCSORT,0),U),!
 I $Y>(IOSL-4) D PAUSE^BMCRL01 W:$D(IOF) @IOF
 I $G(BMCSPAG) W !?6,"Each ",$P(^BMCTSORT(BMCSORT,0),U)," will be on a separate page.",!
 I '$D(^XTMP("BMCRL",BMCJOB,BMCBTH)) W !!,"NO DATA TO REPORT.",!
 D PAUSE^BMCRL01
 Q
DONE ;ENTRY POINT - END OF REPORT TIME DISPLAY
 I $D(BMCET) S BMCTS=(86400*($P(BMCET,",")-$P(BMCBT,",")))+($P(BMCET,",",2)-$P(BMCBT,",",2)),BMCH=$P(BMCTS/3600,".") S:BMCH="" BMCH=0 D
 .S BMCTS=BMCTS-(BMCH*3600),BMCM=$P(BMCTS/60,".") S:BMCM="" BMCM=0 S BMCTS=BMCTS-(BMCM*60),BMCS=BMCTS W !!,"RUN TIME (H.M.S): ",BMCH,".",BMCM,".",BMCS
 I $E(IOST)="C",IO=IO(0) S DIR(0)="EO",DIR("A")="End of report.  HIT RETURN" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 K BMCTS,BMCS,BMCH,BMCM,BMCET
 Q
PAUSE ;
 D PAUSE^BMCRL01
 Q
COUNT ;if COUNTING entries only   
 I $Y>(IOSL-5) D PAUSE^BMCRL01 W:$D(IOF) @IOF
 I '$D(^XTMP("BMCRL",BMCJOB,BMCBTH)) W !!!,"NO DATA TO REPORT.",!
 W:$D(BMCRCNT) !!!,"Total COUNT of ",$S(BMCPTVS="P":"Patients",1:"Referrals"),":  ",BMCRCNT
 Q
WP ;EP - Entry point to print wp fields pass node in BMCNODE
 ;PASS FILE IN BMCFILE, ENTRY IN BMCDA
 K ^UTILITY($J,"W")
 S BMCRLX=0
 S BMCG1=^DIC(BMCFILE,0,"GL"),BMCG=BMCG1_BMCDA_","_BMCNODE_",BMCRLX)",BMCGR=BMCG1_BMCDA_","_BMCNODE_",BMCRLX"
 S DIWL=1,DIWR=$P(^BMCRTMP(BMCRPT,12,BMCI,0),U,2) F  S BMCRLX=$O(@BMCG) Q:BMCRLX'=+BMCRLX  D
 .S Y=BMCGR_",0)" S X=@Y D ^DIWP
 .Q
 S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z  S BMCPCNT=BMCPCNT+1,BMCPRNM(BMCPCNT)=^UTILITY($J,"W",DIWL,Z,0)
 K DIWL,DIWR,DIWF,Z
 K ^UTILITY($J,"W"),BMCNODE,BMCFILE,BMCDA,BMCG1,BMCGR,BMCRLX
 Q
WPS ;EP
 S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z  S BMCPCNT=BMCPCNT+1,BMCPRNM(BMCPCNT)=^UTILITY($J,"W",DIWL,Z,0)
 K DIWL,DIWR,DIWF,Z
 K ^UTILITY($J,"W"),BMCNODE,BMCFILE,BMCDA
 Q
CSRVR ;EP ;TEST FOR SCREEN ON PRINTING CASE REVIEWER
 S BMCTST=1
 I $D(^BMCRTMP(BMCRPT,11,188)) S BMCTST=0 D
 .S Z=0 F  S Z=$O(^BMCRTMP(BMCRPT,11,188,11,Z)) Q:Z'=+Z  D  Q:BMCTST
 ..I $P(^BMCRTMP(BMCRPT,11,188,11,Z,0),U)=$P(^BMCCOM(BMCX,0),U,4) S BMCTST=1
 K Z Q
BOCOM ;EP ;TEST FOR SCREEN ON PRINTING BUSINESS OFFICE COMMENTS
 S BMCTST=1
 I $D(^BMCRTMP(BMCRPT,11,136)) S BMCTST=0 D
 .S Y=0 F  S Y=$O(^BMCCOM(BMCX,1,Y)) Q:Y'=+Y  S B=^(Y,0) D
 ..S Z=0 F  S Z=$O(^BMCRTMP(BMCRPT,11,136,11,Z)) Q:Z'=+Z  D  Q:BMCTST
 ...I B[^BMCRTMP(BMCRPT,11,136,11,Z,0) S BMCTST=1
 K Y,B,Z Q
BOMED ;EP ;TEST FOR SCREEN ON BUSINESS OFFICE COMMENTS AND PRINTING MED HX 
 S BMCTST=1
 I $D(^BMCRTMP(BMCRPT,11,BMCCRIT)) S BMCTST=0 D
 .S Y=0 F  S Y=$O(^BMCCOM(BMCX,1,Y)) Q:Y'=+Y  S B=^(Y,0) D
 ..S Z=0 F  S Z=$O(^BMCRTMP(BMCRPT,11,BMCCRIT,11,Z)) Q:Z'=+Z  D  Q:BMCTST
 ...I B[^BMCRTMP(BMCRPT,11,BMCCRIT,11,Z,0) S BMCTST=1
 K Y,B,Z Q