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

APCLYV43.m

Go to the documentation of this file.
APCLYV43 ; IHS/CMI/LAB - CLINIC VISIT COUNTS FOR 1 DAY (PRINT) ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
INIT ;initialize variables
 I '$D(^XTMP("APCLYV4",APCLJOB,APCLBT)) D HEAD0^APCLYV42 G END
 S APCLSTOP="",APCLPAGE=0
 S APCLTOT=0 ;total count
 ;
SET ;set up print fields
 S APCLCLP=0 D HEAD
SET1 S APCLCLP=$O(^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP)) G FINAL:APCLCLP=""
 S APCLCLX=0
SET2 S APCLCLX=$O(^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP,APCLCLX)) G SET1:APCLCLX=""
 S APCLVDT=0
SET3 S APCLVDT=$O(^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP,APCLCLX,APCLVDT)) G SET2:APCLVDT=""
 S APCLCNT=^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP,APCLCLX,APCLVDT),APCLTOT=APCLTOT+APCLCNT
 I $Y>(IOSL-5) D PAGE G END:APCLSTOP="^"
 W !?20,$E(APCLCLP,1,20)
 W " ",$S($D(^DIC(40.7,APCLCLX,0)):$P(^(0),"^",2),1:"??")
 W ?45,$J(APCLCNT,5) G SET3
 ;
FINAL ;print grand totals
 I $Y>(IOSL-5) D PAGE
 W !!?30,"TOTAL VISITS:",?45,$J(APCLTOT,5),!!
END ;
 D DONE^APCLOSUT
 K APCLCTOT,APCLTOT,APCLCLX,APCLVDT,APCLPAGE,APCLSTOP,APCLCNT
 K ^XTMP("APCLYV4",APCLJOB,APCLBT)
 Q
 ;
 W !!,$P(^VA(200,DUZ,0),"^",2),?(80-$L(X)/2),X,?70,"Page ",APCLPAGE
 S X=$P($H,",",2) D TIME W !,Y,?26,"VISIT COUNTS FOR ALL CLINICS"
 S Y=DT X ^DD("DD") W !,Y
 W ?34,"for ",$E(APCLBD,4,5),"/",$E(APCLBD,6,7),"/",$E(APCLBD,2,3)
 W !!?20,"CLINIC",?41,"NUMBER OF VISITS",!?20,"------",?41,"----------------",!
 Q
 ;
PAGE ;form feed to new page
 I IOST'?1"C-".E D HEAD Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="E" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLSTOP="^" Q
 I APCLSTOP'="^" D HEAD
 Q
TIME NEW %A,%B,%C S Y="" Q:'$D(X)  Q:X<0!(X>86400)
 S %A=X\60,%B=%A\60 S:%B>12 %B=%B-12 S:%B=0 %B=12 S:%B<10 %B=" "_%B
 S %C=$S(%A=0:"M ",%A=720:"N ",%A=1440:"M ",%A<720:"am",1:"pm")
 S Y=%B_":"_$E(%A#60+100,2,3)_" "_%C K %A,%B,%C Q