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

AMHRP5.m

Go to the documentation of this file.
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