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

BMCRR7P.m

Go to the documentation of this file.
BMCRR7P ; IHS/PHXAO/TMJ - PRNT BILL VSTS ;  
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
START ;
 S BMC80E="==============================================================================="
 S BMC80D="-------------------------------------------------------------------------------"
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRR7",BMCJOB,BMCBT)) W !,"No referrals to report",! G DONE
 S BMCSORT="" K BMCQUIT
 F  S BMCSORT=$O(^XTMP("BMCRR7",BMCJOB,BMCBT,"DATA HITS",BMCSORT)) Q:BMCSORT=""!($D(BMCQUIT))  D PRINT
 G:$D(BMCQUIT) DONE
 I $Y>(IOSL-6) D HEAD G:$D(BMCQUIT) DONE
DONE ;
 K ^XTMP("BMCRR7",BMCJOB,BMCBT)
 D DONE^BMCRLP2
 Q
PRINT ;print one referral
 I $G(BMCSPAGE),BMCPG'=1 D HEAD Q:$D(BMCQUIT)
 S BMCREF=0 F  S BMCREF=$O(^XTMP("BMCRR7",BMCJOB,BMCBT,"DATA HITS",BMCSORT,BMCREF)) Q:BMCREF'=+BMCREF!($D(BMCQUIT))  S BMCRREC=^BMCREF(BMCREF,0),DFN=$P(BMCRREC,U,3) D PRINT1
 Q
PRINT1 ;
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 W !,$$FMTE^XLFDT($P(BMCRREC,U),"5D")
 W ?12,$E($P(^DPT(DFN,0),U),1,18)
 S BMCHRN="????" I $D(^AUPNPAT(DFN,41,DUZ(2))) S BMCHRN=$P(^AUTTLOC(DUZ(2),0),U,7)_$P(^AUPNPAT(DFN,41,DUZ(2),0),U,2)
 W ?32,BMCHRN
 W ?43,$S($P(BMCRREC,U,6):$$VAL^XBDIQ1(200,$P(BMCRREC,U,6),1),1:"--")
 S BMCFAC=$$FACREF^BMCRLU(BMCREF)
 I BMCFAC="" S BMCFAC="????"
 W ?49,$E(BMCFAC,1,16)
 W ?67,$S($P($G(^BMCREF(BMCREF,11)),U,6)]"":$$FMTE^XLFDT($P($G(^BMCREF(BMCREF,11)),U,6),"2D")_" (A)",$P($G(^BMCREF(BMCREF,11)),U,5):$$FMTE^XLFDT($P($G(^BMCREF(BMCREF,11)),U,5),"2D")_" (E)",1:"")
 W !?5,"# Visits:",?16,$P($G(^BMCREF(BMCREF,11)),U,11)
 W ?20,"Type: ",$$VAL^XBDIQ1(90001,BMCREF,.04)
 W ?50,"Case Manager: ",$E($$CASEMAN^BMCRLU(BMCREF),1,15)
 W !,?5,"IHS Referring Physician: "_$$VAL^XBDIQ1(90001,BMCREF,.06)
 I $P($G(^BMCREF(BMCREF,12)),U)="" W ! Q
 S BMCP=$$GET1^DIQ(90001,BMCREF,1201,"","BMCP")
 S DIWL=1,DIWF="C66" S X=BMCP D ^DIWP
 S (C,Z)=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z!($D(BMCQUIT))  S C=C+1 D:$Y>(IOSL-4) HEAD Q:$D(BMCQUIT)  W !?6,^UTILITY($J,"W",DIWL,Z,0)
 W !
 K DIWL,DIWR,DIWF,Z,^UTILITY($J,"W")
 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="" Q
HEAD1 ;
 W:$D(IOF) @IOF
HEAD2 ;
 S BMCPG=BMCPG+1
 W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),?72,"Page ",BMCPG,!
 W ?29,"OUTPATIENT REFERRAL LOG",!
 W !,"REF DATE",?11,"PATIENT NAME",?32," HRN",?43,"PROV",?49,"FACILITY REF TO",?67," D.O.S."
 W !,BMC80D
 Q