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

AMHRP3.m

Go to the documentation of this file.
AMHRP3 ; IHS/CMI/LAB - All visit report driver ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
START ; 
 I '$G(DUZ(2)) W $C(7),$C(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",!! K AMHSITE Q
 S AMHJOB=$J,AMHBTH=$H
 D INFORM
GETDATES ;
BD ;get beginning date
 W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning Encounter Date" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G XIT
 S AMHBD=Y
ED ;get ending date
 W ! S DIR(0)="D^"_AMHBD_":DT:EP",DIR("A")="Enter ending Encounter Date" S Y=AMHBD D DD^%DT D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G BD
 S AMHED=Y
 S X1=AMHBD,X2=-1 D C^%DTC S AMHSD=X
 ;
PROG ;select program to run report for
 S AMHPROG=""
 S DIR(0)="S^M:MENTAL HEALTH;S:SOCIAL SERVICES;C:CHEMICAL DEPENDENCY or ALCOHOL/SUBSTANCE ABUSE;O:OTHER;A:ALL",DIR("A")="Run Report for which Program",DIR("B")="M" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 G:$D(DIRUT) BD
 S AMHPROG=Y,AMHPROG=$S(AMHPROG="A":"",1:AMHPROG)
PRV ;
 S DIR(0)="S^1:ONE PROVIDER;2:ALL PROVIDERS",DIR("A")="Run Report for",DIR("B")="1" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G PROG
 S AMHS=Y
 S AMHPRV=0
 I AMHS=1 S DIC=200,DIC(0)="AEQMZ",DIC("A")="Enter PROVIDER: " D ^DIC G PRV:Y<0 S AMHPRV=+Y
PS ;
 S AMHPSP=""
 S DIR(0)="S^P:Primary Provider Only;S:Both Primary and Secondary Providers",DIR("A")="Include which providers",DIR("B")="P" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G PRV
 S AMHPSP=Y
DEMO ;
 D DEMOCHK^AMHUTIL1(.AMHDEMO)
 I AMHDEMO=-1 G PS
ZIS ;CALL TO XBDBQUE
 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) G XIT
 I $G(Y)="B" D BROWSE,XIT Q
 S XBRP="^AMHRP3P",XBRC="^AMHRP31",XBRX="XIT^AMHRP3",XBNS="AMH"
 D ^XBDBQUE
 D XIT
 Q
ERR W $C(7),$C(7),!,"Must be a valid date and be Today or earlier. Time not allowed!" Q
XIT ;EP
 K AMHACT,AMHAREA,AMHAT,AMHATOT,AMHBD,AMHBDD,AMHBT,AMHBTH,AMHDISC,AMHDT,AMHED,AMHEDD,AMHET,AMHFTOT,AMHJOB,AMHLENG,AMHLOC,AMHLTOT,AMHODAT,AMHPAT,AMHPG,AMHPNAME,AMHPROG,AMHPROV,AMHPTOT,AMHQUIT,AMHR,AMHR0,AMHRCNT,AMHREC,AMHSD,AMHSITE,AMHSTOT
 K AMHSU,AMHX,AMHACTOT,AMHATOT,AMHPRV,AMHPSP
 K DIR,DIRUT,DTOUT,DUOUT,X,X1,X2,Y
 Q
 ;
BROWSE ;
 S XBRP="VIEWR^XBLM(""^AMHRP3P"")"
 S XBNS="AMH",XBRC="^AMHRP31",XBRX="XIT^AMHRP3",XBIOP=0 D ^XBDBQUE
 Q
INFORM ;
 W:$D(IOF) @IOF
 W !,"****** ACTIVITY BY PRIMARY PUPOSE REPORT ******",!
 W !,"This report will tally PRIMARY problems by service unit, facility, and by ",!,"provider and activity.",!
 D DBHUSR^AMHUTIL
 Q
 ;
 ;