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
;
HEAD W:$D(IOF) @IOF S X=$P(^DIC(4,DUZ(2),0),"^"),APCLPAGE=APCLPAGE+1
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
APCLYV43 ; IHS/CMI/LAB - CLINIC VISIT COUNTS FOR 1 DAY (PRINT) ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;
INIT ;initialize variables
+1 IF '$DATA(^XTMP("APCLYV4",APCLJOB,APCLBT))
DO HEAD0^APCLYV42
GOTO END
+2 SET APCLSTOP=""
SET APCLPAGE=0
+3 ;total count
SET APCLTOT=0
+4 ;
SET ;set up print fields
+1 SET APCLCLP=0
DO HEAD
SET1 SET APCLCLP=$ORDER(^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP))
IF APCLCLP=""
GOTO FINAL
+1 SET APCLCLX=0
SET2 SET APCLCLX=$ORDER(^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP,APCLCLX))
IF APCLCLX=""
GOTO SET1
+1 SET APCLVDT=0
SET3 SET APCLVDT=$ORDER(^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP,APCLCLX,APCLVDT))
IF APCLVDT=""
GOTO SET2
+1 SET APCLCNT=^XTMP("APCLYV4",APCLJOB,APCLBT,APCLCLP,APCLCLX,APCLVDT)
SET APCLTOT=APCLTOT+APCLCNT
+2 IF $Y>(IOSL-5)
DO PAGE
IF APCLSTOP="^"
GOTO END
+3 WRITE !?20,$EXTRACT(APCLCLP,1,20)
+4 WRITE " ",$SELECT($DATA(^DIC(40.7,APCLCLX,0)):$PIECE(^(0),"^",2),1:"??")
+5 WRITE ?45,$JUSTIFY(APCLCNT,5)
GOTO SET3
+6 ;
FINAL ;print grand totals
+1 IF $Y>(IOSL-5)
DO PAGE
+2 WRITE !!?30,"TOTAL VISITS:",?45,$JUSTIFY(APCLTOT,5),!!
END ;
+1 DO DONE^APCLOSUT
+2 KILL APCLCTOT,APCLTOT,APCLCLX,APCLVDT,APCLPAGE,APCLSTOP,APCLCNT
+3 KILL ^XTMP("APCLYV4",APCLJOB,APCLBT)
+4 QUIT
+5 ;
HEAD IF $DATA(IOF)
WRITE @IOF
SET X=$PIECE(^DIC(4,DUZ(2),0),"^")
SET APCLPAGE=APCLPAGE+1
+1 WRITE !!,$PIECE(^VA(200,DUZ,0),"^",2),?(80-$LENGTH(X)/2),X,?70,"Page ",APCLPAGE
+2 SET X=$PIECE($HOROLOG,",",2)
DO TIME
WRITE !,Y,?26,"VISIT COUNTS FOR ALL CLINICS"
+3 SET Y=DT
XECUTE ^DD("DD")
WRITE !,Y
+4 WRITE ?34,"for ",$EXTRACT(APCLBD,4,5),"/",$EXTRACT(APCLBD,6,7),"/",$EXTRACT(APCLBD,2,3)
+5 WRITE !!?20,"CLINIC",?41,"NUMBER OF VISITS",!?20,"------",?41,"----------------",!
+6 QUIT
+7 ;
PAGE ;form feed to new page
+1 IF IOST'?1"C-".E
DO HEAD
QUIT
+2 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET APCLSTOP="^"
QUIT
+3 IF APCLSTOP'="^"
DO HEAD
+4 QUIT
TIME NEW %A,%B,%C
SET Y=""
IF '$DATA(X)
QUIT
IF X<0!(X>86400)
QUIT
+1 SET %A=X\60
SET %B=%A\60
IF %B>12
SET %B=%B-12
IF %B=0
SET %B=12
IF %B<10
SET %B=" "_%B
+2 SET %C=$SELECT(%A=0:"M ",%A=720:"N ",%A=1440:"M ",%A<720:"am",1:"pm")
+3 SET Y=%B_":"_$EXTRACT(%A#60+100,2,3)_" "_%C
KILL %A,%B,%C
QUIT