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

ADEPDFR.m

Go to the documentation of this file.
ADEPDFR ; IHS/HQT/MJL - DEFERRED SVCS PART 1 ;07:05 PM [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;------->INIT
 I $D(DUZ(2)),DUZ(2)]""
 E  W "DIVISION NOT PROPERLY SET -- CONTACT SITE MANAGER" G END
INIT ;
 ;------->SORT CRITERIA
 ;NOTE: Add additional criteria here in future version
 W !,"You may limit the report to include only patients who were added",!,"to the Deferred Services Register during a particular time."
 S ADEBEG=$$DATE^ADEPQA3()
 G:$$HAT^ADEPQA3() END
 G:'+ADEBEG END
 S ADEEND=$P(ADEBEG,U,3),ADEBEG=$P(ADEBEG,U,2)
 ;------->DEVICE
 ;FHL 9/9/98
ASKDEV S %ZIS="Q" D ^%ZIS G END:POP I $D(IO("Q")) K IO("Q") D QUE W:$D(ZTQUEUED) !,"REQUEST QUEUED." G END
ZTM ;EP
 ;------->$O THRU ADEDSR("B" (TASKMAN ENTRY)
 D PROC
 ;------->PRINT
 D ^ADEPDFR1
 I $D(ZTQUEUED) S ZTREQ="@"
 K ^ADEUTIL("ADEPDFR",$J) ;^ADEUTIL is a transient working global
 ;------->END
END K ADEAGE,ADEDFN,ADELIN,ADENAM,ADENOD,ADETOT,ADEHRN,ADEADD,ADEPAT,ADEPAG,J,ADEJ,ADEK,ADEL,ADEM,ADEGBL,ADESUB,ADESVC,ADEN,ADEBEG,ADEEND,DTOUT,DUOUT,DIROUT
 Q
QUE S ZTRTN="ZTM^ADEPDFR",ZTDESC="DENTAL DEFERRED SVCS REPORT"
 S ZTSAVE("ADEBEG")="",ZTSAVE("ADEEND")="" ;***IHS/HMW PATCH
 D ^%ZTLOAD
 Q
PROC S ADEPAT=""
 K ^ADEUTIL("ADEPDFR",$J)
 I '$D(IO("S")),$P(IOST,"-")="C" W !,"Please wait while I scan the records..."
 F ADEJ=0:0 S ADEPAT=$O(^ADEDSR("B",ADEPAT)) Q:'ADEPAT  S ADEDFN=$O(^ADEDSR("B",ADEPAT,0)) D P3 I '$D(IO("S")),$P(IOST,"-")="C" W "."
 Q
P3 Q:'$D(^ADEDSR(ADEDFN,0))
 Q:'$D(^ADEDSR(ADEDFN,1))
 Q:'$D(^ADEDSR(ADEDFN,2))
 S ADENOD=$P(^ADEDSR(ADEDFN,2),U)
 Q:ADENOD<ADEBEG
 Q:ADENOD>ADEEND
 S ADENOD=^ADEDSR(ADEDFN,0)
 S ADETOT=$P(ADENOD,U,2)
 S ADEHRN="MISSING"
 I $D(^AUPNPAT(+ADENOD,41,DUZ(2),0)) S ADEHRN=$P(^(0),U,2)
 Q:'$D(^DPT(+ADENOD,0))
 S ADENOD=^DPT(+ADENOD,0),ADENAM=$P(ADENOD,U),ADEAGE=$P(ADENOD,U,3)
 Q:'ADEAGE
 S X1=DT,X2=ADEAGE D ^%DTC Q:X<1
 ;beginning Y2K fix
 ;S ADEAGE=X\364.25
 S ADEAGE=X\365.25  ;Y2000
 ;S ADEADD="" I $D(^ADEDSR(ADEDFN,2)) S ADEADD=^(2),ADEADD=$E(ADEADD,4,5)_"-"_$E(ADEADD,6,7)_"-"_$E(ADEADD,2,3)
 S ADEADD="" I $D(^ADEDSR(ADEDFN,2)) S ADEADD=^(2) D:ADEADD'=""
 .S ADEYR=1700+$E(ADEADD,1,3) ;Y2000
 .S ADEADD=$E(ADEADD,4,5)_"-"_$E(ADEADD,6,7)_"-"_ADEYR  ;Y2000
 .K ADEYR
 ;end Y2K fix block
 D P4
 S ADEGBL=ADENAM_U_ADEHRN_U_ADEAGE_U_ADEADD
 F ADEM=1:1:16 S $P(ADEGBL,U,ADEM+4)=ADESVC(ADEM)
 S ADEGBL=ADEGBL_U_ADETOT
 S ^ADEUTIL("ADEPDFR",$J,ADENAM,ADEDFN)=ADEGBL
 Q
P4 Q:'$D(^ADEDSR(ADEDFN,1))
 F ADEN=1:1:16 S ADESVC(ADEN)="-"
 S ADESUB=0
 F  S ADESUB=$O(^ADEDSR(ADEDFN,1,ADESUB)) Q:'+ADESUB  D
 . S ADENOD=^ADEDSR(ADEDFN,1,ADESUB,0)
 . S $P(ADENOD,U)=$P(^ADEDNT(+ADENOD,0),U,2)
 . D:+ADENOD P5
 Q
P5 S ADESVC(+ADENOD)=ADESVC(+ADENOD)+$P(ADENOD,U,2)
 Q