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

BCHRC2P.m

Go to the documentation of this file.
BCHRC2P ; IHS/CMI/LAB - = print all visit report ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;IHS/CMI/LAB - tmp to xtmp
START ;
 D NOW^%DTC S Y=X D DD^%DT S BCHDT=Y
 S Y=BCHBD D DD^%DT S BCHBDD=Y S Y=BCHED D DD^%DT S BCHEDD=Y
 I '$D(^XTMP("BCHRC2",BCHJOB,BCHBTH)) W !!,"NO DATA TO REPORT",!! G DONE
 K BCHQUIT S BCHPG=0
REF ;
 D @("HEAD"_(2-($E(IOST,1,2)="C-")))
 ;set total numbers and print
 I $Y>(IOSL-3) D HEAD G:$D(BCHQUIT) DONE
 W !?4,"TOTAL",?26,$J($FN(^XTMP("BCHRC2",BCHJOB,BCHBT,"TOTAL","FROM"),","),5),?32,"100%"
 W ?46,"TOTAL",?69,$J($FN(^XTMP("BCHRC2",BCHJOB,BCHBT,"TOTAL","TO"),","),5),?75,"100%"
 S BCHFT=^XTMP("BCHRC2",BCHJOB,BCHBT,"TOTAL","FROM"),BCHTT=^XTMP("BCHRC2",BCHJOB,BCHBT,"TOTAL","TO")
 S BCHREF=0 F  S BCHREF=$O(^XTMP("BCHRC2",BCHJOB,BCHBTH,BCHREF)) Q:BCHREF'=+BCHREF!($D(BCHQUIT))  D
 .S BCHF=^XTMP("BCHRC2",BCHJOB,BCHBTH,BCHREF,"FROM")
 .S BCHT=^XTMP("BCHRC2",BCHJOB,BCHBTH,BCHREF,"TO")
 .I $Y>(IOSL-4) D HEAD Q:$D(BCHQUIT)
 .W !,$P(^BCHTREF(BCHREF,0),U,3),"  ",$E($P(^(0),U),1,20),?26,$J(BCHF,5),?32,$S(BCHFT:$J(((BCHF/BCHFT)*100),3,0),1:$J("0",3,0)),"%"
 .W ?44,$P(^BCHTREF(BCHREF,0),U,3),"  ",$E($P(^(0),U),1,20),?69,$J(BCHT,5),?75,$S(BCHTT:$J(((BCHT/BCHTT)*100),3,0),1:$J("0",3,0)),"%"
 .Q
DONE ;
 D DONE^BCHUTIL1
 K ^XTMP("BCHRC2",BCHJOB,BCHBTH),BCHJOB,BCHBTH
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BCHQUIT="" Q
HEAD1 ; if terminal
 W:$D(IOF) @IOF
 ;
HEAD2 ; if printer
 S BCHPG=BCHPG+1
 ;W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !,$P(^VA(200,DUZ,0),U,2),?58,BCHDT,?72,"Page ",BCHPG,!
 W $$CTR^BCHRLU($$LOC^BCHRLU),!
 W !?20,"**********  CHR REPORT NO. 4  **********"
 W !!?26,"NUMBER OF REFERRALS FROM/TO"
 S BCHPROGN=$S(BCHPRG:$P(^BCHTPROG(BCHPRG,0),U)_" ("_$P(^(0),U,5)_")",1:"ALL"),X=$L(BCHPROGN)+10
 W !!?((80-X)/2),"PROGRAM:  ",BCHPROGN
 S BCHPROVN=$S(BCHPROVT="O":$P(^VA(200,BCHCHR1,0),U),1:"ALL"),X=$L(BCHPROGN)+10
 W !?((80-X)/2),"PROVIDER:  ",BCHPROVN
 S X=$L("PATIENTS:  "_BCHREGN)
 W !?((80-X)/2),"PATIENTS:  ",BCHREGN
 W !?17,"REPORT DATES:  ",BCHBDD,"  TO  ",BCHEDD,!
 W !,"REFERRALS TO CHR FROM",?25,"# REFERRALS",?44,"REFERRALS BY CHR TO",?69,"# REFERRALS"
 W !,$TR($J(" ",80)," ","-")
 Q