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

BMCRR23.m

Go to the documentation of this file.
BMCRR23 ; IHS/OIT/FCJ - REPORT FOR CALL IN REFERRALS (1/2)
 ;;4.0;REFERRED CARE INFO SYSTEM;**12**;JAN 09, 2006;Build 101
 ;4.0*12 NEW ROUTINE
 ;NEW REPORT FOR GAO REQUIREMENT TO TRACK CALL IN REFERRALS
 ;
START ;
 D PCCTST S BMCJOB=$J
 K ^XTMP(BMCJOB,"BMCRR23")
 W:$D(IOF) @IOF
 W !,?14,"************* CHS Paid Referral Report *************"
 W !!,"Report will capture CHS Primary referrals. Report will sort by Call-in"
 W !,"Referrals. The CHS PO's must be final paid without out any Third Party"
 W !,"Payment. If the call-in notification date is not available the referral"
 W !,"will be checked for a PCC Visit to identify Call-in referrals."
 W !!,"If the PCC link was not on during anytime within reporting time"
 W !,"frame, this report MAY NOT be accurate for identifying Call-in referrals."
 I BMCPDT'="" D
 .W !!,"Facility does not use the PCC link, the earliest beginning date for report"
 .W !,"can be ",BMCPDT1,"."
 W !,!
BD ;get beginning date and ending dates
 K DIR("B")
 I BMCPDT'="" D
 .W ! S DIR(0)="D^"_BMCPDT_":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 EXIT
 .S BMCBD=Y
 .D ED^BMCRUTL
 E  D BD^BMCRUTL
 G:$D(DIRUT) EXIT
SELRPT ;REPORT TYPE CALL-IN, NON CALL-IN OR BOTH
 K DIR,DIC
 S DIR("A")="Report Type",DIR(0)="S^C:Call-in Referrals;N:Non Call-in Referrals;B:Both" S DIR("B")="Both"
 W !
 D ^DIR
 G BD:$D(DUOUT),EXIT:$D(DTOUT),EXIT:$D(DIROUT)
 S BMCRPT=Y
TYPE ; TYPE OF REPORT SUMARRY OR DETAILED
 ; Enter Summary or Detail
 S DIR(0)="S^S:SUMMARY;D:DETAILED",DIR("A")="Report Type ",DIR("B")="SUMMARY"
 S DIR("?")="Detail will display indiviual Referrals, Summary will display only the totals"
 D ^DIR
 G SELRPT:$D(DUOUT),EXIT:$D(DTOUT),EXIT:$D(DIROUT)
 S BMCRTYP=Y
FILE ;CREATE A FILE
 S %=$$DIR^XBDIR("Y","Create a file","N","","","^D HELP^ACHS(""H2"",""ACHSVUR2"")",2)
 G TYPE:$D(DUOUT),EXIT:$D(DTOUT)
 S BMCFIL=$S(%:"Y",1:"N")
ZIS ;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="" Q
 S BMCOPT=Y
 G:$G(BMCQUIT) FILE
 I $G(BMCOPT)="B" D BROWSE,EXIT Q
 S XBRP="^BMCRR23P",XBRC="STPROC^BMCRR23",XBRX="EXIT^BMCRR23",XBNS="BMC"
 D ^XBDBQUE
 Q
BROWSE ;
 S XBRP="VIEWR^XBLM(""^BMCRR23P"")"
 S XBRC="STPROC^BMCRR23",XBIOP=0 D ^XBDBQUE
 Q
FIL2 ;CREATE THE FILE
 D FILHDR^BMCRR23P
 D FILSUM^BMCRR23P
 D FILSAV^BMCRR23P
 Q
EXIT ;
 I $D(BMCFIL) D:BMCFIL="Y" FIL2
 D KILL^AUPNPAT
 K BMC80D,BMC80E,BMCBT,BMCBTH,BMCET,BMCOPT,BMCPG,BMCQUIT,BMCRCNT,BMCREF,BMCRREC,BMCSORT,BMCSTYPE
 K BMCBD,BMCED,BMCBDD,BMCEDD,BMCSD,BMCRTYP,BMCFIL,BMCRTH,BMCCHS,BMCHIT,BMCJOB,BMCODAT,BMCPDT,BMCRPT
 K BMCCFC,BMCCHS0,BMCCPO,BMCPOC,BMCR,BMCRCDAY,BMCRCTOT,BMCREC,BMCRPO,BMCRRDAY,BMCRRTOT,BMCRTOT,BMCSRTH,BMCTAVG
 K DA,DFN,DIR,X,Y
 K ^XTMP($J,"BMCRR23")
 Q
PCCTST ;IF SITE DOES NOT USE PCC LINK THE EARLIEST DATE FOR REPORT WILL BE WHEN V4 P12 WAS INSTALLED
 S BMCPDT="",BMCPDT=""
 I $P(^BMCPARM(DUZ(2),0),U,3)<1 S BMCPDT=$P(^BMCPARM(DUZ(2),4100),U,12),Y=BMCPDT D DD^%DT S BMCPDT1=Y
 Q
STPROC ;
 S (BMCBT,BMCBTH)=$H,BMCRCNT=0
 D PROCESS,END
 Q
 ;
PROCESS ;
 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 BMCREF=""
 F  S BMCREF=$O(^BMCREF("B",BMCODAT,BMCREF)) Q:BMCREF'=+BMCREF  S BMCRREC=^BMCREF(BMCREF,0) D PROCESS2
 Q
 ;
END ;
 S BMCET=$H
 Q
PROCESS2 ;
 S BMCRREC=^BMCREF(BMCREF,0),DFN=$P(BMCRREC,U,3),BMCSORT="R"
 ;TEST FOR CHS REFERRAL
 Q:$P(BMCRREC,U,4)'="C"
 ;TEST FOR PRIMARY REFERRAL
 Q:$P($G(^BMCREF(BMCREF,1)),U)'=""
 ;TEST FOR PO AND PAID
 Q:($P($G(^BMCREF(BMCREF,11)),U,15)<1)&($P($G(^BMCREF(BMCREF,11)),U,16)<0)
 ;TEST FOR 0 THIRD PARTY PAY, FINAL PAY AND FIRST PO ENTERED
 S L=0,BMCCHS="",BMCHIT=""
 S L=$O(^BMCREF(BMCREF,41,L)) Q:L'?1N.N  D
 .S BMCCHS=$P(^BMCREF(BMCREF,41,L,0),U)
 .Q:$P($G(^ACHSF(DUZ(2),"D",BMCCHS,"PA")),U,5)>0
 .S:$P($G(^ACHSF(DUZ(2),"D",BMCCHS,"PA")),U,4)="F" BMCHIT=1
 Q:BMCHIT<1
 ;NOTIFICATION or PCC VISIT - Will be considered a call in if PCC link is on
 I BMCPDT,$P($G(^BMCREF(BMCREF,1)),U,4)'="" S BMCSORT="C" G SET   ;PCC LINK AND CALL IN
 I ($P($G(^BMCREF(BMCREF,1)),U,4)'="")!($P($G(^BMCREF(BMCREF,13)),U,9)="") S BMCSORT="C"  ;CALLIN OR NO VISIT
SET ;
 Q:((BMCSORT="C")&(BMCRPT="N"))
 Q:((BMCSORT="R")&(BMCRPT="C"))
 Q:$P(^BMCREF(BMCREF,0),U,5)'=DUZ(2)
 S ^XTMP(BMCJOB,"BMCRR23",BMCBTH,"DATA HITS",DUZ(2),BMCSORT,BMCREF)="",BMCRCNT=BMCRCNT+1
 Q