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

ACDRLP1.m

Go to the documentation of this file.
ACDRLP1 ;IHS/ADC/EDE/KML - CONT OF ACDRLP;
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
 ;
COVPAGE ;EP
 W:$D(IOF) @IOF
 W !?5,"CHEMICAL DEPENDENCY MIS  ",$S(ACDPTVS="P":"PATIENT",1:"CDMIS RECORD")," ",$S(ACDCTYP="D":"LISTING",1:"COUNT")
 W !!,"REPORT REQUESTED BY: ",$P(^VA(200,DUZ,0),U)
 W !!,"The following report contains a ",$S(ACDPTVS="V":"CDMIS Record",1:"Patient")," report based on the",!,"following criteria:",!
SHOW ;
 W !,$S(ACDPTVS="P":"PATIENT",1:"VISIT")," Selection Criteria"
 I $D(ACDRDTR),$D(ACDBDD) W !!?6,"Visit Date range:  ",ACDBDD," to ",ACDEDD,!
 W:ACDPTVS="V" !!?6,"Visit Date range:  ",ACDBDD," to ",ACDEDD,!
 I '$D(^ACDRPTD(ACDRPT,11)) G SHOWP
 S ACDI=0 F  S ACDI=$O(^ACDRPTD(ACDRPT,11,ACDI)) Q:ACDI'=+ACDI  D
 .I $Y>(IOSL-5) D PAUSE^ACDRL01 W @IOF
 .W !?6,$P(^ACDTITEM(ACDI,0),U),":  "
 .K ACDQ S ACDY=0,C=0 K ACDQ F  S ACDY=$O(^ACDRPTD(ACDRPT,11,ACDI,11,"B",ACDY)) S C=C+1 W:C'=1&(ACDY'="") " ; " Q:ACDY=""!($D(ACDQ))  S X=ACDY X:$D(^ACDTITEM(ACDI,2)) ^(2) W X
 K ACDQ
SHOWP ;
 I ACDCTYP="F" W !!,"FLAT FILE BEING GENERATED:  ",ACDFILE,!! W:'$D(ZTQUEUED) "HOLD ON......" Q
 I ACDCTYP="T" D COUNT Q
 I ACDCTYP="S" D  I 1
 .I $Y>(IOSL-6) D PAUSE^ACDRL01 W @IOF
 .W !!,"Report will contain sub-totals by ",$P(^ACDTITEM(ACDSORT,0),U),"."
 .I '$D(^TMP("ACDRL",ACDJOB,ACDBTH)) W !!,$S(ACDPTVS="V":"NO VISITS",1:"NO PATIENTS")_" TO REPORT.",! D PAUSE^ACDRL01 W:$D(IOF) @IOF
 .Q
 I ACDCTYP'="D" D PAUSE^ACDRL01 W:$D(IOF) @IOF Q
 I $Y>(IOSL-4) D PAUSE^ACDRL01 W @IOF
 W !!,"PRINT Field Selection"
 I '$D(^ACDRPTD(ACDRPT,12)) G PAUSE
 S ACDI=0 F  S ACDI=$O(^ACDRPTD(ACDRPT,12,ACDI)) Q:ACDI'=+ACDI  S ACDCRIT=$P(^ACDRPTD(ACDRPT,12,ACDI,0),U) D
 .I $Y>(IOSL-4) D PAUSE^ACDRL01 W:$D(IOF) @IOF
 .W !?6,$P(^ACDTITEM(ACDCRIT,0),U),"  (" S X=$O(^ACDRPTD(ACDRPT,12,"B",ACDCRIT,"")) W $P(^ACDRPTD(ACDRPT,12,X,0),U,2),")"
 I $Y>(IOSL-4) D PAUSE^ACDRL01 W:$D(IOF) @IOF
 W !?10,"     TOTAL column width: ",ACDTCW
 Q:'$G(ACDSORT)
 I $Y>(IOSL-4) D PAUSE^ACDRL01 W:$D(IOF) @IOF
 W !!?6,$S(ACDPTVS="V":"Records",1:"Patients")," will be sorted by:  ",$P(^ACDTITEM(ACDSORT,0),U),!
 I $Y>(IOSL-4) D PAUSE^ACDRL01 W:$D(IOF) @IOF
 I $G(ACDSPAG) W !?6,"Each ",$P(^ACDTITEM(ACDSORT,0),U)," will be on a separate page.",!
 I '$D(^TMP("ACDRL",ACDJOB,ACDBTH)) W !!,$S(ACDPTVS="V":"NO VISITS",1:"NO PATIENTS")_" TO REPORT.",!
PAUSE D PAUSE^ACDRL01 W:$D(IOF) @IOF
 Q
COUNT ;if COUNTING entries only   
 I $Y>(IOSL-5) D PAUSE^ACDRL01 W:$D(IOF) @IOF
 I '$D(^TMP("ACDRL",ACDJOB,ACDBTH)) W !!!,$S(ACDPTVS="V":"NO VISITS",1:"NO PATIENTS")_" TO REPORT.",!
 I $D(ACDRCNT),ACDPTVS="V" W !!!,"Total COUNT of ",$S(ACDPTVS="P":"Patients",1:"Records"),":  ",ACDRCNT
 I $D(ACDPTCT),ACDPTVS="P" W !!!,"Total COUNT of ",$S(ACDPTVS="P":"Patients",1:"Records"),":  ",ACDPTCT
 Q
WP ;EP - Entry point to print wp fields pass node in ACDNODE
 ;PASS FILE IN ACDFILE, ENTRY IN ACDDA
 K ^UTILITY($J,"W")
 S ACDG=^DIC(ACDFILE,"GL",0),ACDG=ACDG_ACDDA_",ACDX)"
 S DIWL=1,DIWR=$P(^ACDRPTD(ACDRPT,12,ACDI,0),U,2) F  S ACDX=$O(@ACDG) Q:ACDX'=+ACDX  D
 .S Y=ACDG_",0)" S X=@Y D ^DIWP
 .Q
WPS ;EP
 S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z  S ACDPCNT=ACDPCNT+1,ACDPRNM(ACDPCNT)=^UTILITY($J,"W",DIWL,Z,0)
 K DIWL,DIWR,DIWF,Z
 K ^UTILITY($J,"W"),ACDNODE,ACDFILE,ACDDA
 Q