AMHRP5 ; IHS/CMI/LAB - ACTIVE CLIENT LIST ;
;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
;
I '$D(IOF) D HOME^%ZIS
W @(IOF),!!
W "********** TALLY CASE OPEN/ADMIT/CLOSED DATES **********",!!
W "This report will count the total number of cases that were opened,",!,"admitted or closed during a date range you specify.",!
GETDATES ;
BD ;get beginning date
W !,"Please enter the date range during which the case should have been",!,"opened, admitted or closed",!
W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter BEGINNING 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 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 S Y=AMHBD D DD^%DT S AMHBDD=Y S Y=AMHED D DD^%DT S AMHEDD=Y
;
ZIS ;
S XBRC="PROC^AMHRP5",XBRP="PRINT^AMHRP5",XBNS="AMH",XBRX="XIT^AMHRP5"
D ^XBDBQUE
XIT K ZTSK,Y,AMHBD,AMHED,IO("Q"),AMH80D,AMHBTH,AMHHRCN,AMHJOB,AMHLENG,AMHPCNT,AMHPG,AMHPROV,AMHX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D
K AMHPRNM,AMHPRNT,AMHPROB,AMHPRV,AMHR,AMHRCNT,AMHRLOC,AMHSD,AMHTOT,AMHBDD,AMHBT,AMHEDD,AMHEDO,AMHBDO,AMHBT,AMHFOUND,AMHHIT,AMHID,AMHLINE,AMHP
Q
;
PROC ;EP - entry point for processing
S AMHJOB=$J,AMHBTH=$H,AMHTOT=0,DFN=0,AMHBT=$H
F S DFN=$O(^AMHPATR(DFN)) Q:DFN'=+DFN D PROC1
S AMHET=$H
K DFN
Q
PROC1 ;
S X=$G(^AMHPATR(DFN,0))
I $P(X,U,5)]"",$P(X,U,5)'<AMHBD,$P(X,U,5)'>AMHED S ^("OPEN")=$S($D(^TMP("AMHRP5",AMHJOB,AMHBTH,"OPEN")):^("OPEN")+1,1:1)
I $P(X,U,6)]"",$P(X,U,6)'<AMHBD,$P(X,U,6)'>AMHED S ^("ADMIT")=$S($D(^TMP("AMHRP5",AMHJOB,AMHBTH,"ADMIT")):^("ADMIT")+1,1:1)
I $P(X,U,7)]"",$P(X,U,7)'<AMHBD,$P(X,U,7)'>AMHED S ^("CLOSED")=$S($D(^TMP("AMHRP5",AMHJOB,AMHBTH,"CLOSED")):^("CLOSED")+1,1:1)
Q
PRINT ;EP
S Y=AMHBD D DD^%DT S AMHBDD=Y S Y=AMHED D DD^%DT S AMHEDD=Y
S AMH80D="-------------------------------------------------------------------------------"
W:$D(IOF) @IOF
W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
W !,$P(^VA(200,DUZ,0),U,2),?72,"Page 1 ",!
W ?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),!
W ?20,"Date Range: ",AMHBDD," to ",AMHEDD,!
W ?22,"TALLY OF CASES OPENED/ADMITTED/CLOSED",!
W AMH80D,!
I '$D(^TMP("AMHRP5",AMHJOB,AMHBTH)) W !!,"NO DATA TO REPORT" G DONE
W !?22,"CASES OPENED: ",?39,$S($G(^TMP("AMHRP5",AMHJOB,AMHBTH,"OPEN")):^("OPEN"),1:0)
W !?22,"CASES ADMITTED: ",?39,$S($G(^TMP("AMHRP5",AMHJOB,AMHBTH,"ADMIT")):^("ADMIT"),1:0)
W !?22,"CASES CLOSED: ",?39,$S($G(^TMP("AMHRP5",AMHJOB,AMHBTH,"CLOSED")):^("CLOSED"),1:0)
DONE D DONE^AMHLEIN,^AMHEKL
K ^TMP("AMHRP5",AMHJOB,AMHBTH),AMHJOB,AMHBTH
Q
AMHRP5 ; IHS/CMI/LAB - ACTIVE CLIENT LIST ;
+1 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
+2 ;
+3 IF '$DATA(IOF)
DO HOME^%ZIS
+4 WRITE @(IOF),!!
+5 WRITE "********** TALLY CASE OPEN/ADMIT/CLOSED DATES **********",!!
+6 WRITE "This report will count the total number of cases that were opened,",!,"admitted or closed during a date range you specify.",!
GETDATES ;
BD ;get beginning date
+1 WRITE !,"Please enter the date range during which the case should have been",!,"opened, admitted or closed",!
+2 WRITE !
SET DIR(0)="D^:DT:EP"
SET DIR("A")="Enter BEGINNING Date"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF $DATA(DIRUT)
GOTO XIT
+4 SET AMHBD=Y
ED ;get ending date
+1 WRITE !
SET DIR(0)="D^"_AMHBD_":DT:EP"
SET DIR("A")="Enter ENDING Date"
SET Y=AMHBD
DO DD^%DT
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 IF $DATA(DIRUT)
GOTO BD
+3 SET AMHED=Y
+4 SET X1=AMHBD
SET X2=-1
DO C^%DTC
SET AMHSD=X
SET Y=AMHBD
DO DD^%DT
SET AMHBDD=Y
SET Y=AMHED
DO DD^%DT
SET AMHEDD=Y
+5 ;
ZIS ;
+1 SET XBRC="PROC^AMHRP5"
SET XBRP="PRINT^AMHRP5"
SET XBNS="AMH"
SET XBRX="XIT^AMHRP5"
+2 DO ^XBDBQUE
XIT KILL ZTSK,Y,AMHBD,AMHED,IO("Q"),AMH80D,AMHBTH,AMHHRCN,AMHJOB,AMHLENG,AMHPCNT,AMHPG,AMHPROV,AMHX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D
+1 KILL AMHPRNM,AMHPRNT,AMHPROB,AMHPRV,AMHR,AMHRCNT,AMHRLOC,AMHSD,AMHTOT,AMHBDD,AMHBT,AMHEDD,AMHEDO,AMHBDO,AMHBT,AMHFOUND,AMHHIT,AMHID,AMHLINE,AMHP
+2 QUIT
+3 ;
PROC ;EP - entry point for processing
+1 SET AMHJOB=$JOB
SET AMHBTH=$HOROLOG
SET AMHTOT=0
SET DFN=0
SET AMHBT=$HOROLOG
+2 FOR
SET DFN=$ORDER(^AMHPATR(DFN))
IF DFN'=+DFN
QUIT
DO PROC1
+3 SET AMHET=$HOROLOG
+4 KILL DFN
+5 QUIT
PROC1 ;
+1 SET X=$GET(^AMHPATR(DFN,0))
+2 IF $PIECE(X,U,5)]""
IF $PIECE(X,U,5)'<AMHBD
IF $PIECE(X,U,5)'>AMHED
SET ^("OPEN")=$SELECT($DATA(^TMP("AMHRP5",AMHJOB,AMHBTH,"OPEN")):^("OPEN")+1,1:1)
+3 IF $PIECE(X,U,6)]""
IF $PIECE(X,U,6)'<AMHBD
IF $PIECE(X,U,6)'>AMHED
SET ^("ADMIT")=$SELECT($DATA(^TMP("AMHRP5",AMHJOB,AMHBTH,"ADMIT")):^("ADMIT")+1,1:1)
+4 IF $PIECE(X,U,7)]""
IF $PIECE(X,U,7)'<AMHBD
IF $PIECE(X,U,7)'>AMHED
SET ^("CLOSED")=$SELECT($DATA(^TMP("AMHRP5",AMHJOB,AMHBTH,"CLOSED")):^("CLOSED")+1,1:1)
+5 QUIT
PRINT ;EP
+1 SET Y=AMHBD
DO DD^%DT
SET AMHBDD=Y
SET Y=AMHED
DO DD^%DT
SET AMHEDD=Y
+2 SET AMH80D="-------------------------------------------------------------------------------"
+3 IF $DATA(IOF)
WRITE @IOF
+4 WRITE !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
+5 WRITE !,$PIECE(^VA(200,DUZ,0),U,2),?72,"Page 1 ",!
+6 WRITE ?(80-$LENGTH($PIECE(^DIC(4,DUZ(2),0),U))/2),$PIECE(^DIC(4,DUZ(2),0),U),!
+7 WRITE ?20,"Date Range: ",AMHBDD," to ",AMHEDD,!
+8 WRITE ?22,"TALLY OF CASES OPENED/ADMITTED/CLOSED",!
+9 WRITE AMH80D,!
+10 IF '$DATA(^TMP("AMHRP5",AMHJOB,AMHBTH))
WRITE !!,"NO DATA TO REPORT"
GOTO DONE
+11 WRITE !?22,"CASES OPENED: ",?39,$SELECT($GET(^TMP("AMHRP5",AMHJOB,AMHBTH,"OPEN")):^("OPEN"),1:0)
+12 WRITE !?22,"CASES ADMITTED: ",?39,$SELECT($GET(^TMP("AMHRP5",AMHJOB,AMHBTH,"ADMIT")):^("ADMIT"),1:0)
+13 WRITE !?22,"CASES CLOSED: ",?39,$SELECT($GET(^TMP("AMHRP5",AMHJOB,AMHBTH,"CLOSED")):^("CLOSED"),1:0)
DONE DO DONE^AMHLEIN
DO ^AMHEKL
+1 KILL ^TMP("AMHRP5",AMHJOB,AMHBTH),AMHJOB,AMHBTH
+2 QUIT