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

BMCRCHS1.m

Go to the documentation of this file.
BMCRCHS1 ; IHS/PHXAO/TMJ - LIST PAID CHS REFERRALS ; 15 Mar 2013  9:02 AM
 ;;4.0;REFERRED CARE INFO SYSTEM;**8,9**;JAN 09, 2006;Build 101
 ;IHS/ITSC/FCJ ADDED BEG-END DATE REQ FOR REPORT AND RESORT OF DATA
 ; ADDED AMT PAID AND RMVD PRIM PRV
 ;
 ; This routine lists active CHS referrals where all CHS AUTHORIZATIONS
 ; have been paid.
 ;
START ;
 W !!,"This report prints out a list of all active CHS referrals for which all",!,"authorizations have already been paid.",!!
 W "Report will include Primary and Secondary Referrals.",!
BD ;GET BEG AND END DATE OF REPORT
 D BD^BMCRUTL
 G:$D(DIRUT) EOJ1  ;BMC*4.0*8
 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("BMCRCHS1",BMCJOB,BMCBT):1
 . E  S BMCBT=""
 . Q
 K ^XTMP("BMCRCHS1",$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^BMCRCHS1",XBRC="REFCHK^BMCRCHS1",XBRX="EOJ^BMCRCHS1",XBNS="BMC"
 D ^XBDBQUE
 Q
 ;
BROWSE ;
 S XBRP="VIEWR^XBLM(""REFPRT^BMCRCHS1"")"
 S XBRC="REFCHK^BMCRCHS1",XBRX="EOJ^BMCRCHS1",XBNS="BMC",XBIOP=0
 D ^XBDBQUE
 Q
 ;
REFCHK ; CHECK ACTIVE/CHS REFERRAL SORTED BY DATE INIT
 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
 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
 S X=^BMCREF(BMCRIEN,0)
 I $P(X,U,4)="C" D  S:BMCHIT ^XTMP("BMCRCHS1",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)=""
 . S (BMCAUTH,BMCHIT,BMCSKIP)=0
 . Q:'$O(^BMCREF(BMCRIEN,41,0))  ;    no authorizations
 . F  S BMCAUTH=$O(^BMCREF(BMCRIEN,41,BMCAUTH)) Q:'BMCAUTH  D  Q:BMCSKIP
 .. S Y=^BMCREF(BMCRIEN,41,BMCAUTH,0)
 .. S:$P(Y,U,3)="" BMCSKIP=1 ;        no dollars paid
 . S:'BMCSKIP BMCHIT=1
 Q
 ;
REFPRT ; PRINT REFERRALS SELECTED
 S $P(BMC80E,"=",80)=""
 S $P(BMC80D,"-",80)=""
 D REFPRT2
 K ^XTMP("BMCRCHS1",BMCJOB,BMCBT)
 Q
 ;
REFPRT2 ;
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRCHS1",BMCJOB,BMCBT)) W !,"No referrals to report",! D PAUSE^BMC Q
 S BMCRIEN=0 K BMCQUIT
 F  S BMCRIEN=$O(^XTMP("BMCRCHS1",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 $$FMTE^XLFDT($P(BMCRREC,U),"2D")
 W ?10,$E(BMCREC("PAT NAME"),1,20)
 W ?32,$P(BMCRREC,U,2) W:$G(^BMCREF(BMCRIEN,1)) $P(^BMCREF(BMCRIEN,1),U)
 W ?48,$E($$TOFAC^BMC(BMCRIEN),1,20)
 S I=0 F  S I=$O(^BMCREF(BMCRIEN,41,I)) Q:I'?1N.N  W ?69,$J($P(^BMCREF(BMCRIEN,41,I,0),U,3),9,2),!
 W !
 I '$O(^BMCREF(BMCRIEN,12,0)) Q  ;      no purpose of referral
 ;
 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 CHS REFERRALS WHERE ALL AUTHORIZATIONS PAID",80),!
 S Y=BMCBD D DD^%DT W ?17,"BEG DATE: "_Y
 S Y=BMCED D DD^%DT W ?40,"END DATE: "_Y,!
 W !,"REF DATE",?11,"PATIENT NAME",?32," REF #",?48,"FACILITY REF TO",?70,"AMT PAID"
 W !,BMC80D
 W !
 Q
 ;
EOJ ; END OF JOB
 LOCK -^XTMP("BMCRCHS1",BMCJOB,BMCBT)
 K ^XTMP("BMCRCHS1",BMCJOB,BMCBT)
EOJ1 ;BMC*4.0*8 ADDED LINE LABEL
 D ^BMCKILL
 K BMC80D,BMC80E,BMCBOS,BMCBT,BMCJOB,BMCCL,BMCOPT,BMCPG,BMCRREC,BMCRSTAT,BMCSKIP
 K BMCBD,BMCED,BMCBDD,BMCEDD,BMCSD
 Q