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

AMHRC2.m

Go to the documentation of this file.
AMHRC2 ; IHS/CMI/LAB - ACTIVE CLIENT LIST - OPEN NOT SEEN IN N ZIS ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
START ;
 I '$D(IOF) D HOME^%ZIS
 W @(IOF),!!
 W "*******  TALLY OF CASES OPENED, ADMITTED, CLOSED IN A TIME FRAME  *******",!!
 W "This report will produce a tally of the case open, admit and closed dates",!
 W "in a time period.",!
 I '$D(^AMHSITE(DUZ(2),16,DUZ)) D
 .W !,"This report will only include Cases on which you are the documented"
 .W !,"provider.",!!
 D DBHUSRP^AMHUTIL
 ;
GETDATES ;
BD ;get beginning date
 W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning of Time Period" 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 end of Time Period" 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 ;
 S AMHPROG=""
 S DIR(0)="S^O:ONE Program;A:ALL Programs",DIR("A")="Run the Report for which PROGRAM",DIR("B")="A" KILL DA D ^DIR KILL DIR
 G:$D(DIRUT) GETDATES
 I Y="A" G PROV
 S DIR(0)="9002011.58,.03",DIR("A")="Which PROGRAM" KILL DA D ^DIR KILL DIR
 G:$D(DIRUT) PROG
 I X="" G PROG
 S AMHPROG=Y
PROV ;
 S AMHPROV=""
 S DIR(0)="S^A:Any Provider;O:One Provider",DIR("A")="Include cases opened by",DIR("B")="A" K DA D ^DIR K DIR
 G:$D(DIRUT) GETDATES
 I Y="A" G ZIS
 S DIC="^VA(200,",DIC(0)="AEMQ",DIC("A")="Which PROVIDER: " D ^DIC
 K DIC,DA
 I Y=-1 G PROV
 S AMHPROV=+Y
ZIS ;
DEMO ;
 D DEMOCHK^AMHUTIL1(.AMHDEMO)
 I AMHDEMO=-1 G PROV
 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 XBRC="PROC^AMHRC2",XBRP="^AMHRC2P",XBNS="AMH",XBRX="XIT^AMHRC2"
 D ^XBDBQUE
XIT ;
 K AMHCASE,AMHBD,AMHSD,AMHED,AMHOPEN,AMHADMIT,AMHCLOSE,AMHPG,AMH80D,AMHDISP,AMHBT,AMHPROV,AMHX
 Q
 ;
BROWSE ;
 S XBRP="VIEWR^XBLM(""^AMHRC2P"")"
 S XBNS="AMH",XBRC="PROC^AMHRC2",XBRX="XIT^AMHRC2",XBIOP=0 D ^XBDBQUE
 Q
PROC ;EP - entry point for processing
 S AMHBT=$H,AMHOPEN=0,AMHADMIT=0,AMHCLOSE=0 K AMHDISP
 S AMHCASE=0
 F  S AMHCASE=$O(^AMHPCASE(AMHCASE)) Q:AMHCASE'=+AMHCASE  D PROC1
 S AMHET=$H
 K AMHCASE
 Q
PROC1 ;
 Q:'$$ALLOWCD^AMHLCD(DUZ,AMHCASE)
 I AMHPROG]"",$P(^AMHPCASE(AMHCASE,0),U,3)'=AMHPROG Q
 I AMHPROV,AMHPROV'=$P(^AMHPCASE(AMHCASE,0),U,8) Q
 S AMHR=^AMHPCASE(AMHCASE,0)
 Q:'$$ALLOWP^AMHUTIL(DUZ,$P(AMHR,U,2))
 Q:$$DEMO^AMHUTIL1($P(AMHR,U,2),$G(AMHDEMO))
 I $P(AMHR,U)]"",$P(AMHR,U)'<AMHBD,$P(AMHR,U)'>AMHED S AMHOPEN=AMHOPEN+1
 I $P(AMHR,U,4)]"",$P(AMHR,U,4)'<AMHBD,$P(AMHR,U,4)'>AMHED S AMHADMIT=AMHADMIT+1
 I $P(AMHR,U,5)]"",$P(AMHR,U,5)'<AMHBD,$P(AMHR,U,5)'>AMHED S AMHCLOSE=AMHCLOSE+1 D
 .I $P(AMHR,U,6)]"" S X=$P(^AMHPOCM($P(AMHR,U,6),0),U) S:'$D(AMHDISP(X)) AMHDISP(X)="" S AMHDISP(X)=AMHDISP(X)+1
 Q