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

AMHRP4.m

Go to the documentation of this file.
  1. AMHRP4 ; IHS/CMI/LAB - ACTIVE CLIENT LIST ;
  1. ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
  1. ;
  1. START ;
  1. I '$D(IOF) D HOME^%ZIS
  1. W @(IOF),!!
  1. W "********** ACTIVE CLIENT LIST (USING CASE OPEN DATE) **********",!!
  1. W "This report will produce a list of patients who have a case open date without a",!,"case closed date.",!
  1. I '$D(^AMHSITE(DUZ(2),16,DUZ)) D
  1. .W !,"This report will only include Cases on which you are the documented"
  1. .W !,"provider.",!!
  1. D DBHUSRP^AMHUTIL
  1. ;
  1. PROG ;
  1. D XIT
  1. S AMHPROG=""
  1. 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
  1. G:$D(DIRUT) XIT
  1. I Y="A" G PROV
  1. S DIR(0)="9002011.58,.03",DIR("A")="Which PROGRAM" KILL DA D ^DIR KILL DIR
  1. G:$D(DIRUT) PROG
  1. I X="" G PROG
  1. S AMHPROG=Y
  1. PROV ;
  1. S AMHPROV=""
  1. S DIR(0)="S^A:All Providers;O:One Provider",DIR("A")="Include cases opened by",DIR("B")="A" K DA D ^DIR K DIR
  1. G:$D(DIRUT) XIT
  1. I Y="A" G DEMO
  1. S DIC="^VA(200,",DIC(0)="AEMQ",DIC("A")="Which PROVIDER: " D ^DIC
  1. K DIC,DA
  1. I Y=-1 G PROV
  1. S AMHPROV=+Y
  1. DEMO ;
  1. D DEMOCHK^AMHUTIL1(.AMHDEMO)
  1. I AMHDEMO=-1 G PROV
  1. ZIS ;
  1. 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
  1. I $D(DIRUT) G XIT
  1. I $G(Y)="B" D BROWSE,XIT Q
  1. S XBRC="PROC^AMHRP4",XBRP="^AMHRP4P",XBNS="AMH",XBRX="XIT^AMHRP4"
  1. D ^XBDBQUE
  1. XIT ;
  1. K ZTSK,Y,AMHBD,AMHED,IO("Q")
  1. D EN^XBVK("AMH")
  1. Q
  1. ;
  1. BROWSE ;
  1. S XBRP="VIEWR^XBLM(""^AMHRP4P"")"
  1. S XBNS="AMH",XBRC="PROC^AMHRP4",XBRX="XIT^AMHRP4",XBIOP=0 D ^XBDBQUE
  1. Q
  1. PROC ;EP - entry point for processing
  1. S AMHPCNT=0
  1. S AMHJOB=$J,AMHBTH=$H,AMHTOT=0,AMHCASE=0,AMHBT=$H,AMHCCNT=0
  1. D XTMP^AMHUTIL("AMHRP4","BH - ACTIVE CLIENT REPORT")
  1. F S AMHCASE=$O(^AMHPCASE(AMHCASE)) Q:AMHCASE'=+AMHCASE D PROC1
  1. S AMHET=$H
  1. K AMHCASE
  1. Q
  1. PROC1 ;
  1. I '$$ALLOWCD^AMHLCD(DUZ,AMHCASE) Q
  1. Q:$P(^AMHPCASE(AMHCASE,0),U,5)]"" ;closed
  1. I AMHPROG]"",$P(^AMHPCASE(AMHCASE,0),U,3)'=AMHPROG Q
  1. I AMHPROV,$P(^AMHPCASE(AMHCASE,0),U,8)'=AMHPROV Q
  1. S DFN=$P(^AMHPCASE(AMHCASE,0),U,2)
  1. Q:'DFN
  1. Q:'$$ALLOWP^AMHUTIL(DUZ,DFN)
  1. Q:$$DEMO^AMHUTIL1(DFN,$G(AMHDEMO))
  1. I '$D(^XTMP("AMHRP4",AMHJOB,AMHBTH,"PATIENTS",DFN)) S AMHPCNT=AMHPCNT+1,^XTMP("AMHRP4",AMHJOB,AMHBTH,"PATIENTS",DFN)=""
  1. S ^XTMP("AMHRP4",AMHJOB,AMHBTH,"CASES",$P(^DPT(DFN,0),U),DFN,AMHCASE)=AMHCASE,AMHCCNT=AMHCCNT+1
  1. Q
  1. ;