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

ADEFPC.m

Go to the documentation of this file.
ADEFPC ; IHS/HQT/MJL - F COMPLIANCE PT 1 ;05:11 PM  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;
 D ^XBKVAR I '$D(DUZ(2)) W !,"DIVISION NOT SET IN USER FILE -- CONTACT SITE MANAGER OR ISC" Q
 I DUZ(2)=0 W !,"DIVISION SET TO ZERO (UNIVERSAL). DIVISION MUST BE SET TO ONE OF THE ",!,"SITES IN THE DENTAL SITE PARAMETER FILE. -- CONTACT SITE MANAGER" Q
 ;
PRE D ^ADECLS
 S ADEXX="Compliance Summary By Water System"
 W $J("",(80-$L(ADEXX))\2)_ADEXX,!,!
 N ADEROPT
 S ADECOMP=$S($D(^ADEPARAM(DUZ(2),0)):+$P(^ADEPARAM(DUZ(2),0),U,7),1:1) S:'ADECOMP ADECOMP=1
DATE ;GET DATE RANGE
 S U="^",%DT="AE",%DT(0)=-DT,%DT("A")="SELECT BEGINNING MONTH-YEAR: " D ^%DT K %DT
 G:Y<0 END S ADEBD=Y,%DT="AE",%DT(0)=ADEBD,%DT("A")="SELECT ENDING MONTH-YEAR: " D ^%DT K %DT
 G:X="^" DATE G:Y<0 END S ADEED=Y I ADEED>DT W " ??",*7 G DATE
 ;
ROPT ;GET REPORT OPTIONS
 W !
 S ADEROPT=$$REP^ADEFPC4()
 I $$HAT^ADEPQA() W ! G DATE
 I ADEROPT="" W !!,"No reports selected."  G END
 W !!
 I ADEROPT[1 W "AREA" W:$L(ADEROPT)>2 ", "
 I ADEROPT[2 W:ADEROPT=12 " and " W "SERVICE UNIT"
 I ADEROPT[3 W:$L(ADEROPT)>1 " and " W "WATER SYSTEM"
 W " Report" W:$L(ADEROPT)>1 "s" W " will be printed.",!
 ;
 S ADEU=$$ADEU()
 K ^TMP("ADEFPC",ADEU)
 ;^TMP is a transient, non-fileman working global.
 S ^TMP("ADEFPC",ADEU)="RUNNING"
 ;W !!,"JOB ",$J,": ADEU=",ADEU R !!,AZZ ;***COMMENT & KEEP
 D ASKDEV
 I POP K ^TMP("ADEFPC",ADEU) G END
 ;FHL 9/9/98 I $D(ZTSK) G END
 I $D(ZTQUEUED) G END
 ;
ZTM ;EP TASKMAN ENTRY FOR PROCESSING PHASE
 I $D(ZTQUEUED) L +^TMP("ADEFPC",ADEU):1 I '$T S ZTREQ="@" G END
 S ADEJ=($E(ADEED,1,3)-$E(ADEBD,1,3)+1)*12-($E(ADEBD,4,5)-1)-($E(ADEED,1,3)_"12"-$E(ADEED,1,5))
 S ^TMP("ADEFPC",ADEU)=ADEBD_U_ADEED_U_DT_U_ADEJ
 S ADEWSDFN=0
 F  S ADEWSDFN=$O(^ADEWS(ADEWSDFN)) Q:'+ADEWSDFN  D
 . S ADEWSNOD=^ADEWS(ADEWSDFN,0)
 . S ADEWSNAM=$P(ADEWSNOD,"^",2)_"-"_$P(ADEWSNOD,"^")
 . I $P(ADEWSNOD,U,8)="y" Q
 . S ADECOMM=$P(ADEWSNOD,"^",6) Q:ADECOMM']""
 . S ADECOMM=^AUTTCOM(ADECOMM,0)
 . S ADESU=$P(ADECOMM,"^",5) Q:ADESU']""
 . S ADESU=^AUTTSU(ADESU,0)
 . S ADESUNAM=$P(ADESU,U)
 . S ADESU=$P(ADESU,U,4) Q:ADESU']""
 . S ADEAREA=$P(ADECOMM,"^",6) Q:'ADEAREA
 . S ADEAREA=^AUTTAREA(ADEAREA,0)
 . S ADEARNAM=$P(ADEAREA,U)
 . S ADEAREA=$P(ADEAREA,U,2) Q:ADEAREA']""
 . Q:'$D(^ADEFLU("B",ADEWSDFN))
 . S ADEFLDFN=$O(^ADEFLU("B",ADEWSDFN,0))
 . D ^ADEFPC1
 D PCOMP^ADEFPC3
 I $O(^TMP("ADEFPC",ADEU,0))="" G END
 ;
 I $D(ZTQUEUED) D  G END
 . I $D(IOT),IOT'="HFS" D  Q
 . . S ZTREQ=$H_U_ADEIOP_U_"FLUORIDE COMPLIANCE REPORT"_U_"PRINT^ADEFPC"
 . D PRINT Q
 I '$D(ZTQUEUED) D PRINT
 ;
 ;
END I $D(ADEU) L -^TMP("ADEFPC",ADEU)
 K ADEABS,ADEABSMO,ADEBD,ADEBM,ADEBSU,ADECML,ADECOMM,ADECOMP,ADECPPM,ADECUR,ADEDEF,ADEED,ADEEM,ADEESU,ADEFLDFN,ADEINC
 K ADEJ,ADEK,ADELAT,ADELIN,ADEMCNT,ADEMOCNT,ADEMPPM,ADENAT,ADENEX,ADENEXMO,ADEOPT,ADEPAG,ADEPOP,ADEQ,ADEQIT,ADESHORT,ADESL
 K ADESTOP,ADESU,ADESUCNT,ADESYS,ADESYCNT,ADETCNT,ADETDAY,ADETPPM,ADETST,ADEWSDFN,ADEWSNAM,ADEWSNOD,ADEXX,ADEX,ADEYM
 K ADEIOP,ADEU,ADEAREA,ADETMON,ADESUNAM,ADEARNAM,ADEMO
 K ADED0,ADED1,ADED2,ADED3,ADEZTSK,ADEIOPAR
 K ADENOD,ADEROPT
 Q
 ;
PRINT ;EP TASKMAN ENTRY FOR PRINT PHASE
 I '$D(^TMP("ADEFPC",ADEU)) G PRNEND
 I '+$O(^TMP("ADEFPC",ADEU,0)) G PRNEND
 I $D(ZTQUEUED) L +^TMP("ADEFPC",ADEU):1 I '$T S ADENOLOK=1 G PRNEND
 N FLDS
 F FLDS="[ADEP-ADEFPC-AREA]","[ADEP-ADEFPC-SU]","[ADEP-ADEFPC-SYS2]" D
 . Q:FLDS["AREA"&(ADEROPT'["1")
 . Q:FLDS["SU"&(ADEROPT'["2")
 . Q:FLDS["SYS"&(ADEROPT'["3")
 . N DIC,BY,ADED0,ADED1,ADED2,ADED3,DHD,Y
 . S IOP=ADEIOP
 . S %ZIS("IOPAR")=ADEIOPAR
 . D ^%ZIS
 . S IOP=ADEIOP
 . S %ZIS("IOPAR")=ADEIOPAR
 . S DIC="^ADEDUM(",BY="@NUMBER",(FR,TO)=""
 . S ADED0=0,ADED1=0
 . ;FHL 9/9/98 I $D(ZTSK) S ADEZTSK=ZTSK K ZTSK
 . I $D(ZTQUEUED) S ADEZTSK=ZTSK K ZTSK
 . D EN1^DIP
 . I $D(ADEZTSK) S ZTSK=ADEZTSK
PRNEND I $D(ZTQUEUED) S ZTREQ="@"
 I '$D(ADENOLOK) K ^TMP("ADEFPC",ADEU)
 K ADENOLOK
 Q
 ;
ASKDEV ;
 K ADEIOP,IOP,ZTSK,ADEIOPAR
 W !!,"Enter 'Q' at the DEVICE prompt to queue this report to run in the background."
 S %ZIS="NQ"
 D ^%ZIS
 Q:POP
 S ADEIOP=ION_";"_IOM_";"_IOSL
 S ADEIOPAR=IOPAR
 Q:'$D(IO("Q"))
 D QUE
 ;FHL 9/9/98 I '$D(ZTSK) K IOP,ADEIOP G ASKDEV
 I '$D(ZTQUEUED) K IOP,ADEIOP G ASKDEV
 D HOME^%ZIS
 W !,"REPORT IS QUEUED!"
 Q
 ;
QUE ;
 N ADEJ
 S ZTRTN="ZTM^ADEFPC",ZTDESC="FLUORIDE REPORT PROCESSING"
 F ADEJ="ADEIOP","ADEBD","ADEED","ADECOMP","ADEU" S ZTSAVE(ADEJ)=""
 S ZTSAVE("ADEIOPAR")=""
 S ZTSAVE("ADEROPT")=""
 S ZTIO=""
 I $D(IO("HFSIO")) D
 . S ZTIO=ADEIOP
 D ^%ZTLOAD
 Q
 ;
ADEU() ;GET UNIQUE SUBSCRIPT NUMBER AND LOCK REPORT NODE
 ;RETURNS SUBSCRIPT NUMBER
 S ADEU=$J
ADEU1 F  L +^TMP("ADEFPC",ADEU):.1 Q:$T  S ADEU=ADEU+1
 I $G(^TMP("ADEFPC",ADEU))="RUNNING" L -^TMP("ADEFPC",ADEU) S ADEU=ADEU+1 G ADEU1
 Q ADEU