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

BMCRR15.m

Go to the documentation of this file.
BMCRR15 ; IHS/PHXAO/TMJ - IN HOUSE REFERRALS BY PROVIDER ;   
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
 ;4.0 IHS/OIT/FCJ ADDED BROWSE FUNCTION AND TOTALS
 ;
START ;
 S BMCJOB=$J,BMCBTH=$H
 W !!,"This report will tally all in-house referrals by provider of service.",!
 W "Report will include both Primary and Secondary Referrals.",!!
D ;DATE RANGE
BD ;get beginning date
 W ! S DIR(0)="D^::EP",DIR("A")="Enter beginning Referral Date" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G XIT
 S BMCBD=Y
ED ;get ending date
 W ! S DIR(0)="D^"_BMCBD_"::EP",DIR("A")="Enter ending Referral Date"  D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G BD
 S BMCED=Y
 S X1=BMCBD,X2=-1 D C^%DTC S BMCSD=X
 ;
PROV ;
 S BMCPROV="" S DIR(0)="S^A:ALL Providers;O:ONE Provider",DIR("A")="Report should tally referrals for ",DIR("B")="A" K DA D ^DIR K DIR
 G:$D(DIRUT) D
 I Y="O" D GETPROV G:BMCPROV="" PROV
ZIS ;call to XBDBQUE
 D ZIS^BMCRUTL
 I $D(DIRUT) S BMCQUIT="" G XIT
 G:$G(BMCQUIT) XIT
 I $G(BMCOPT)="B" D BROWSE,XIT Q
 S XBRP="PRINT^BMCRR15",XBRC="PROC^BMCRR15",XBRX="XIT^BMCRR15",XBNS="BMC"
 D ^XBDBQUE
 D XIT
 Q
BROWSE ;
 S XBRP="VIEWR^XBLM(""PRINT^BMCRR15"")"
 S XBRC="PROC^BMCRR15",XBRX="XIT^BMCRR15",XBIOP=0,XBNS="BMC" D ^XBDBQUE
 Q
XIT ;EP
 K BMCPROV,BMCREF,BMCODAT,BMCBD,BMCED,BMCSD,BMCQUIT,BMCPG,BMCCLIN,BMCBT,BMCBTH,BMCET,BMCRREC,C,D,DFN,DIC,DIRUT,P,X,X1,X2,BMCSTOT
 D KILL^AUPNPAT
 Q
GETPROV ;
 S DIC="^VA(200,",DIC(0)="AEMQ",D="AK.PROVIDER",DIC("A")="Enter PROVIDER (Lastname,Firstname): " D MIX^DIC1 K DIC,D
 Q:Y=-1
 S BMCPROV=+Y
 Q
PROC ;EP called from xbdbque
 S BMCBT=$H
 S BMCODAT=$O(^BMCREF("B",BMCSD)) I BMCODAT="" S BMCET=$H Q
 S BMCODAT=BMCSD_".9999" F  S BMCODAT=$O(^BMCREF("B",BMCODAT)) Q:BMCODAT=""!((BMCODAT\1)>BMCED)  D R1
END ;
 S BMCET=$H
 Q
R1 ;
 S BMCREF="" F  S BMCREF=$O(^BMCREF("B",BMCODAT,BMCREF)) Q:BMCREF'=+BMCREF  I $P(^BMCREF(BMCREF,0),U,4)="N" S BMCRREC=^BMCREF(BMCREF,0),DFN=$P(BMCRREC,U,3) D PROCR
 Q
PROCR ;
 I BMCPROV,$P(BMCRREC,U,6)'=BMCPROV Q
 S C=$P(BMCRREC,U,23),P=$P(BMCRREC,U,6)
 S C=$S(C:$P(^DIC(40.7,C,0),U),1:"<UNKNOWN>")
 S P=$S(P:$P(^VA(200,P,0),U),1:"<UNKNOWN>")
 S R=$S($P($G(^BMCREF(BMCREF,1)),U)'="":"S",1:"P") ;IHS/OIT/FCJ
 S ^(C)=$S($D(^XTMP("BMCRR15",BMCJOB,BMCBTH,"PROV",P,C)):^(C)+1,1:1)
 S ^(R)=$S($D(^XTMP("BMCRR16",BMCJOB,BMCBTH,"PROV",P,0,R)):^(R)+1,1:1) ;IHS/OIT/FCJ
 Q
PRINT ;EP called from xbdbque
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-")))
 S BMCQUIT=0
 I '$D(^XTMP("BMCRR15",BMCJOB,BMCBTH)) W !!,"No IN-HOUSE REFERRALS",! G DONE
 S BMCPROV="" F  S BMCPROV=$O(^XTMP("BMCRR15",BMCJOB,BMCBTH,"PROV",BMCPROV)) Q:BMCPROV=""!(BMCQUIT)  D CLINIC
DONE ;
 K ^XTMP("BMCRR15",BMCJOB,BMCBTH)
 D DONE^BMCRLP2
 Q
CLINIC ;
 I $Y>(IOSL-5) D HEAD Q:BMCQUIT
 W !!,BMCPROV S BMCSTOT=0
 S BMCCLIN=0 F  S BMCCLIN=$O(^XTMP("BMCRR15",BMCJOB,BMCBTH,"PROV",BMCPROV,BMCCLIN)) Q:BMCCLIN=""!(BMCQUIT)  D
 .I $Y>(IOSL-5) D HEAD Q:BMCQUIT
 .W !?25,BMCCLIN,?55,$J(^XTMP("BMCRR15",BMCJOB,BMCBTH,"PROV",BMCPROV,BMCCLIN),5) S BMCSTOT=BMCSTOT+^(BMCCLIN)
 S BMCSRTOT=$G(^XTMP("BMCRR16",BMCJOB,BMCBTH,"PROV",BMCPROV,0,"S")) ;IHS/OIT/FCJ
 S BMCPRTOT=$G(^XTMP("BMCRR16",BMCJOB,BMCBTH,"PROV",BMCPROV,0,"P")) ;IHS/OIT/FCJ
 I $Y>(IOSL-5) D HEAD Q:BMCQUIT
 W !!,"Total Secondary Referrals = ",$S(BMCSRTOT="":0,1:BMCSRTOT) ;IHS/OIT/FCJ
 W !,"Total Primary Referrals = ",$S(BMCPRTOT="":0,1:BMCPRTOT) ;IHS/OIT/FCJ
 W !,"Total for ",BMCPROV,?55,$J(BMCSTOT,5)
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BMCQUIT=1 Q
HEAD1 ;
 W:$D(IOF) @IOF
HEAD2 ;
 S BMCPG=BMCPG+1
 W !?55,$$FMTE^XLFDT(DT),?72,"Page ",BMCPG,!
 W ?20,"IN-HOUSE REFERRALS BY PROVIDER",!
 W ?14,"REFERRAL DATE RANGE: ",$$FMTE^XLFDT(BMCBD)," to ",$$FMTE^XLFDT(BMCED)
 W !!,"PROVIDER",?25,"CLINIC REFERRED TO",?55,"NUMBER"
 W !,$TR($J(" ",80)," ","-")
 Q