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

BMCRC32.m

Go to the documentation of this file.
BMCRC32 ; IHS/OIT/FCJ - LIST APPROVED REFERRALS W/O PRINTED C32 ;   
 ;;4.0;REFERRED CARE INFO SYSTEM;**7,9**;JAN 09, 2006;Build 101
 ;BMC*4.0*7 NEW ROUTINE
 ;
 ; This routine prints a list of approved Referrals that a C32 has not be printed for
 ;
START ;
 W !!,"This report prints out a list of Active referrals that",!,"a C32 has not been printed for.",!!
 W "Report will include Primary and Secondary Referrals.",!
BD ;GET BEG DATE OF REPORT
 W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning Referral Date" D ^DIR S:$D(DUOUT) DIRUT=1 K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G EXT
 S (BMCBD,BMCSD)=Y
 D INIT
 Q:BMCQ
 D DBQUE
 Q
 ;
INIT ; INITIALIZAION
 S BMCQ=0
 D:$G(BMCPARM)="" PARMSET^BMC
 S BMCJOB=$J
 F  D  Q:BMCBT]""
 . S BMCBT=$H
 . LOCK +^XTMP("BMCRC32",BMCJOB,BMCBT):1
 . E  S BMCBT=""
 K ^XTMP("BMCRC32",$J,BMCBT)
 Q
 ;
DBQUE ;call to XBDBQUE
 K BMCOPT
 W ! S DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen",DIR("A")="Do you wish to",DIR("B")="P" K DA D ^DIR K DIR
 I $D(DIRUT) S BMCQUIT=1 Q
 S BMCOPT=Y
 I $G(BMCOPT)="B" D BROWSE Q
 S XBRP="REFPRT^BMCRC32",XBRC="REFCHK^BMCRC32",XBRX="EOJ^BMCRC32",XBNS="BMC"
 D ^XBDBQUE
 Q
 ;
BROWSE ;
 S XBRP="VIEWR^XBLM(""REFPRT^BMCRC32"")"
 S XBRC="REFCHK^BMCRC32",XBRX="EOJ^BMCRC32",XBNS="BMC",XBIOP=0
 D ^XBDBQUE
 Q
 ;
REFCHK ; CHECK APPROVED REFERRALS SORTED BY DATE INIT
 S BMCODAT=BMCSD-1
 F  S BMCODAT=$O(^BMCREF("B",BMCODAT)) Q:BMCODAT=""  D R1
 Q
R1 ;
 S BMCRIEN="" F  S BMCRIEN=$O(^BMCREF("B",BMCODAT,BMCRIEN)) Q:BMCRIEN'=+BMCRIEN  S BMCRREC=^BMCREF(BMCRIEN,0) D PROC
 Q
 ;
PROC ;
 ;Q:$P(BMCRREC,U,15)'="A"    ;QUIT IF NOT ACTIVE  ;BMC*4.0*9 IHS.OIT.FCJ
 Q:($P(BMCRREC,U,15)="C1")!($P(BMCRREC,U,15)="X")  ;QUIT IF NOT ACTIVE OR APPROVED ;BMC*4.0*9 IHS.OIT.FCJ 
 I '$D(^BMCREF(BMCRIEN,6)) S ^XTMP("BMCRC32",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)=""
 E  D  S:'BMCHIT ^XTMP("BMCRC32",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)=""
 . S BMCC32=0,BMCHIT=0
 . Q:'$O(^BMCREF(BMCRIEN,6,0))  ;    Not printed
 . F  S BMCC32=$O(^BMCREF(BMCRIEN,6,BMCC32)) Q:'BMCC32  D  Q:BMCHIT
 .. I ^BMCREF(BMCRIEN,6,BMCC32,0)>0 S BMCHIT=1
 Q
 ;
REFPRT ; PRINT REFERRALS SELECTED
 S $P(BMC80E,"=",80)=""
 S $P(BMC80D,"-",80)=""
 D REFPRT2
 K ^XTMP("BMCRC32",BMCJOB,BMCBT)
 Q
 ;
REFPRT2 ;
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRC32",BMCJOB,BMCBT)) W !,"No referrals to report",! D PAUSE^BMC Q
 S BMCRIEN=0 K BMCQUIT
 F  S BMCRIEN=$O(^XTMP("BMCRC32",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)) Q:BMCRIEN=""!($D(BMCQUIT))  D PRINT
 Q:$D(BMCQUIT)
 D PAUSE^BMC
 Q
 ;
PRINT ;print one referral
 S BMCRREC=^BMCREF(BMCRIEN,0)
 S Y=BMCRIEN
 D ^BMCREF
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 W BMCRNUMB_BMCSUF
 W ?17,$E(BMCREC("PAT NAME"),1,25)
 W ?49,$$FMTE^XLFDT($P(BMCRREC,U),"2D")
 ;
 K ^UTILITY($J,"W")
 F BMCL=0:0 S BMCL=$O(^BMCREF(BMCRIEN,1,BMCL)) Q:'BMCL  S X=^(BMCL,0) D
 . S DIWL=10,DIWR=70,DIWF="W"
 . D ^DIWP
 . Q
 D ^DIWW
 W !
 Q
 ;
 D PAUSE^BMC
 I $D(DIRUT) S BMCQUIT="" Q
 D HEAD1
 Q
 ;
HEAD1 ;
 W:$D(IOF) @IOF
HEAD2 ; WRITE HEADER
 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 $$CTR^BMC("ACTIVE REFERRALS WHERE A C32 HAS NOT BEEN PRINTED",80),!
 S Y=BMCBD D DD^%DT W ?17,"BEG DATE: "_Y
 S Y=DT D DD^%DT W ?40,"END DATE: "_Y,!
 W !,"REFERRAL #",?17,"PATIENT NAME",?45," REFERRAL DATE"
 W !,BMC80D
 W !
 Q
 ;
EOJ ; END OF JOB
 LOCK -^XTMP("BMCRC32",BMCJOB)
 K ^XTMP("BMCRC32",BMCJOB,BMCBT)
EXT ;
 D ^BMCKILL
 K BMC80D,BMC80E,BMCBOS,BMCBT,BMCJOB,BMCCL,BMCOPT,BMCPG,BMCRREC,BMCRSTAT,BMCSKIP
 K BMCBD,BMCSD,BMCODT
 Q