APCLYV63 ; IHS/CMI/LAB - VISIT COUNTS BY PROV FOR 1 DAY (PRINT) ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;
INIT ;initialize variables
I '$D(^XTMP("APCLYV6",APCLJOB,APCLBT)) D HEAD W !,"No data to report." G END
S APCLSTOP="",PAGE=0
S APCLTOT=0 ;total count
;
SET ;set up print fields
S APCLCS=0 D HEAD
SET1 S APCLCS=$O(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS)) G FINAL:APCLCS=""
S APCLPRN=0 I APCLS'=1 W !!,APCLCS,":"
SET2 S APCLPRN=$O(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN)) G SET1:APCLPRN=""
S APCLPR=0
SET3 S APCLPR=$O(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN,APCLPR)) G SET2:APCLPR=""
S APCLVDAT=0,APCLFLG=0
SET4 S APCLVDAT=$O(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN,APCLPR,APCLVDAT))
G SET3:APCLVDAT="" S APCLCL=0
SET5 S APCLCL=$O(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN,APCLPR,APCLVDAT,APCLCL)) G SET4:APCLCL="" S APCLCNT=^(APCLCL),APCLTOT=APCLTOT+APCLCNT
I $Y>(IOSL-5) D PAGE G END:APCLSTOP="^"
I 'APCLFLG W !,APCLPRN,?25,APCLCL,?60,$J(APCLCNT,5) S APCLFLG=1 G SET5
W !?25,APCLCL,?60,$J(APCLCNT,5) G SET5
;
FINAL ;print grand totals
I $Y>(IOSL-5) D PAGE
W !!?40,"TOTAL VISITS:",?60,$J(APCLTOT,5),!!
END ;
D DONE^APCLOSUT
K APCLCL,APCLTOT,APCLCS,APCLVDAT,PAGE,APCLSTOP,APCLCNT
K APCLPRN,APCLPR,APCLPRV,APCLPDFN,APCLSTR,APCLFLG,APCLBD
K APCLED,X,Y
W:IOST'?1"C-".E @IOF K ^XTMP("APCLYV6",APCLJOB,APCLBT)
Q
Q
;
HEAD W:$D(IOF) @IOF S X=$P(^DIC(4,DUZ(2),0),"^"),PAGE=PAGE+1
W !!,$P(^VA(200,DUZ,0),"^",2),?(80-$L(X)/2),X,?70,"Page ",PAGE
S X=$P($H,",",2) D TIME W !,Y,?28,"VISIT COUNTS BY PROVIDER"
S Y=DT X ^DD("DD") W !,Y
W ?34,"for ",$E(APCLBD,4,5),"/",$E(APCLBD,6,7),"/",$E(APCLBD,2,3)
W !!,"PROVIDER",?25,"CLINIC",?60,"NUMBER OF VISITS"
W !,"--------",?25,"------",?60,"----------------"
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 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
APCLYV63 ; IHS/CMI/LAB - VISIT COUNTS BY PROV FOR 1 DAY (PRINT) ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;
INIT ;initialize variables
+1 IF '$DATA(^XTMP("APCLYV6",APCLJOB,APCLBT))
DO HEAD
WRITE !,"No data to report."
GOTO END
+2 SET APCLSTOP=""
SET PAGE=0
+3 ;total count
SET APCLTOT=0
+4 ;
SET ;set up print fields
+1 SET APCLCS=0
DO HEAD
SET1 SET APCLCS=$ORDER(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS))
IF APCLCS=""
GOTO FINAL
+1 SET APCLPRN=0
IF APCLS'=1
WRITE !!,APCLCS,":"
SET2 SET APCLPRN=$ORDER(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN))
IF APCLPRN=""
GOTO SET1
+1 SET APCLPR=0
SET3 SET APCLPR=$ORDER(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN,APCLPR))
IF APCLPR=""
GOTO SET2
+1 SET APCLVDAT=0
SET APCLFLG=0
SET4 SET APCLVDAT=$ORDER(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN,APCLPR,APCLVDAT))
+1 IF APCLVDAT=""
GOTO SET3
SET APCLCL=0
SET5 SET APCLCL=$ORDER(^XTMP("APCLYV6",APCLJOB,APCLBT,APCLCS,APCLPRN,APCLPR,APCLVDAT,APCLCL))
IF APCLCL=""
GOTO SET4
SET APCLCNT=^(APCLCL)
SET APCLTOT=APCLTOT+APCLCNT
+1 IF $Y>(IOSL-5)
DO PAGE
IF APCLSTOP="^"
GOTO END
+2 IF 'APCLFLG
WRITE !,APCLPRN,?25,APCLCL,?60,$JUSTIFY(APCLCNT,5)
SET APCLFLG=1
GOTO SET5
+3 WRITE !?25,APCLCL,?60,$JUSTIFY(APCLCNT,5)
GOTO SET5
+4 ;
FINAL ;print grand totals
+1 IF $Y>(IOSL-5)
DO PAGE
+2 WRITE !!?40,"TOTAL VISITS:",?60,$JUSTIFY(APCLTOT,5),!!
END ;
+1 DO DONE^APCLOSUT
+2 KILL APCLCL,APCLTOT,APCLCS,APCLVDAT,PAGE,APCLSTOP,APCLCNT
+3 KILL APCLPRN,APCLPR,APCLPRV,APCLPDFN,APCLSTR,APCLFLG,APCLBD
+4 KILL APCLED,X,Y
+5 IF IOST'?1"C-".E
WRITE @IOF
KILL ^XTMP("APCLYV6",APCLJOB,APCLBT)
+6 QUIT
+7 QUIT
+8 ;
HEAD IF $DATA(IOF)
WRITE @IOF
SET X=$PIECE(^DIC(4,DUZ(2),0),"^")
SET PAGE=PAGE+1
+1 WRITE !!,$PIECE(^VA(200,DUZ,0),"^",2),?(80-$LENGTH(X)/2),X,?70,"Page ",PAGE
+2 SET X=$PIECE($HOROLOG,",",2)
DO TIME
WRITE !,Y,?28,"VISIT COUNTS BY PROVIDER"
+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 !!,"PROVIDER",?25,"CLINIC",?60,"NUMBER OF VISITS"
+6 WRITE !,"--------",?25,"------",?60,"----------------"
+7 QUIT
+8 ;
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 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