HBHCRP17 ; LR VAMC(IRMS)/MJT-HBHC report on file 632, user selected date range, CPT code(s) (can be range of CPTs), with summary totals, calls: CPT^HBHCUTL3, EN1^HBHCUTL4 & KILL^HBHCUTL4 ; Apr 2000
;;1.0;HOSPITAL BASED HOME CARE;**6,11,16**;NOV 01, 1993
D EN1^HBHCUTL4
G:(HBHCBEG1=-1)!(HBHCEND1=-1)!($D(DTOUT))!(('$D(HBHCCPTB))&('$D(HBHCCPTE))&('$D(HBHCTMP)))!(($D(HBHCCPTB))&('$D(HBHCCPTE))) EXIT
S %ZIS="Q",HBHCCC=0 K IOP,ZTIO,ZTSAVE D ^%ZIS G:POP EXIT
I $D(IO("Q")) S ZTRTN="DQ^HBHCRP17",ZTDESC="HBPC CPT Code Summary Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
DQ ; De-queue
U IO
K ^TMP("HBHC",$J)
S HBHCCC=0,HBHCHEAD="CPT Code Summary",HBHCHDR="W !,""CPT Code"",?39,""Total""",HBHCCOLM=(80-(30+$L(HBHCHEAD))\2) S:HBHCCOLM'>0 HBHCCOLM=1
S HBHCTOT=0,$P(HBHCY,"-",81)=""
LOOP ; Loop thru ^HBHC(632) "C" (visit date) cross-ref to build report
S X1=HBHCBEG1,X2=-1 D C^%DTC S HBHCDATE=X_.9999
F S HBHCDATE=$O(^HBHC(632,"C",HBHCDATE)) Q:(HBHCDATE="")!($P(HBHCDATE,".")>HBHCEND1) S HBHCDFN="" F S HBHCDFN=$O(^HBHC(632,"C",HBHCDATE,HBHCDFN)) Q:HBHCDFN="" S HBHCNOD0=^HBHC(632,HBHCDFN,0) D:$P(HBHCNOD0,U,7)="" PROCESS
D:IO'=IO(0)!($D(IO("S"))) HDRRANGE^HBHCUTL
I '$D(IO("S")),(IO=IO(0)) S HBHCCC=HBHCCC+1 D HDRRANGE^HBHCUTL
W:'$D(^TMP("HBHC",$J)) !!,"No Visits containing CPT codes requested found for Date Range selected."
I $D(^TMP("HBHC",$J)) D PRTLOOP
I ($D(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5) W @IOF D HDRRANGE^HBHCUTL
W !!,HBHCZ,!,"Total CPT Codes: ",$J(HBHCTOT,6),!,HBHCZ
D ENDRPT^HBHCUTL1
EXIT ; Exit module
D ^%ZISC,KILL^HBHCUTL4
K DIC,DTOUT,DUOUT,HBHCBEG1,HBHCCPTB,HBHCCPTE,HBHCEND1,HBHCHEAD,Y
Q
PROCESS ; Process record & create ^TMP("HBHC",$J global
S HBHCDPT0=^DPT($P(HBHCNOD0,U),0)
D CPT^HBHCUTL3
S HBHCI=0 F S HBHCI=$O(HBHCCPTA(HBHCI)) Q:HBHCI'>0 S HBHCCPT=HBHCCPTA(HBHCI) D SET
Q
SET ; Set TMP node for CPTs
I HBHCDIR=1 Q:(($P(HBHCCPT," "))<HBHCCPTB)!(($P(HBHCCPT," "))>HBHCCPTE)
Q:(HBHCDIR=0)&('$D(HBHCTMP($P(HBHCCPT," "))))
S:$D(^TMP("HBHC",$J,HBHCCPT)) ^TMP("HBHC",$J,HBHCCPT)=^TMP("HBHC",$J,HBHCCPT)+1
S:'$D(^TMP("HBHC",$J,HBHCCPT)) ^TMP("HBHC",$J,HBHCCPT)=1
Q
PRTLOOP ; Print loop
S HBHCCPT="" F S HBHCCPT=$O(^TMP("HBHC",$J,HBHCCPT)) Q:HBHCCPT="" D PRINT
Q
PRINT ; Print report
S HBHCCNT=^TMP("HBHC",$J,HBHCCPT)
S HBHCTOT=HBHCTOT+HBHCCNT
I ($D(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5) W @IOF D HDRRANGE^HBHCUTL
W !,HBHCCPT,?39,$J(HBHCCNT,5)
W !,HBHCY
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHBHCRP17 2456 printed Dec 13, 2024@01:58:20 Page 2
HBHCRP17 ; LR VAMC(IRMS)/MJT-HBHC report on file 632, user selected date range, CPT code(s) (can be range of CPTs), with summary totals, calls: CPT^HBHCUTL3, EN1^HBHCUTL4 & KILL^HBHCUTL4 ; Apr 2000
+1 ;;1.0;HOSPITAL BASED HOME CARE;**6,11,16**;NOV 01, 1993
+2 DO EN1^HBHCUTL4
+3 if (HBHCBEG1=-1)!(HBHCEND1=-1)!($DATA(DTOUT))!(('$DATA(HBHCCPTB))&('$DATA(HBHCCPTE))&('$DATA(HBHCTMP)))!(($DATA(HBHCCPTB))&('$DATA(HBHCCPTE)))
GOTO EXIT
+4 SET %ZIS="Q"
SET HBHCCC=0
KILL IOP,ZTIO,ZTSAVE
DO ^%ZIS
if POP
GOTO EXIT
+5 IF $DATA(IO("Q"))
SET ZTRTN="DQ^HBHCRP17"
SET ZTDESC="HBPC CPT Code Summary Report"
SET ZTSAVE("HBHC*")=""
DO ^%ZTLOAD
GOTO EXIT
DQ ; De-queue
+1 USE IO
+2 KILL ^TMP("HBHC",$JOB)
+3 SET HBHCCC=0
SET HBHCHEAD="CPT Code Summary"
SET HBHCHDR="W !,""CPT Code"",?39,""Total"""
SET HBHCCOLM=(80-(30+$LENGTH(HBHCHEAD))\2)
if HBHCCOLM'>0
SET HBHCCOLM=1
+4 SET HBHCTOT=0
SET $PIECE(HBHCY,"-",81)=""
LOOP ; Loop thru ^HBHC(632) "C" (visit date) cross-ref to build report
+1 SET X1=HBHCBEG1
SET X2=-1
DO C^%DTC
SET HBHCDATE=X_.9999
+2 FOR
SET HBHCDATE=$ORDER(^HBHC(632,"C",HBHCDATE))
if (HBHCDATE="")!($PIECE(HBHCDATE,".")>HBHCEND1)
QUIT
SET HBHCDFN=""
FOR
SET HBHCDFN=$ORDER(^HBHC(632,"C",HBHCDATE,HBHCDFN))
if HBHCDFN=""
QUIT
SET HBHCNOD0=^HBHC(632,HBHCDFN,0)
if $PIECE(HBHCNOD0,U,7)=""
DO PROCESS
+3 if IO'=IO(0)!($DATA(IO("S")))
DO HDRRANGE^HBHCUTL
+4 IF '$DATA(IO("S"))
IF (IO=IO(0))
SET HBHCCC=HBHCCC+1
DO HDRRANGE^HBHCUTL
+5 if '$DATA(^TMP("HBHC",$JOB))
WRITE !!,"No Visits containing CPT codes requested found for Date Range selected."
+6 IF $DATA(^TMP("HBHC",$JOB))
DO PRTLOOP
+7 IF ($DATA(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5)
WRITE @IOF
DO HDRRANGE^HBHCUTL
+8 WRITE !!,HBHCZ,!,"Total CPT Codes: ",$JUSTIFY(HBHCTOT,6),!,HBHCZ
+9 DO ENDRPT^HBHCUTL1
EXIT ; Exit module
+1 DO ^%ZISC
DO KILL^HBHCUTL4
+2 KILL DIC,DTOUT,DUOUT,HBHCBEG1,HBHCCPTB,HBHCCPTE,HBHCEND1,HBHCHEAD,Y
+3 QUIT
PROCESS ; Process record & create ^TMP("HBHC",$J global
+1 SET HBHCDPT0=^DPT($PIECE(HBHCNOD0,U),0)
+2 DO CPT^HBHCUTL3
+3 SET HBHCI=0
FOR
SET HBHCI=$ORDER(HBHCCPTA(HBHCI))
if HBHCI'>0
QUIT
SET HBHCCPT=HBHCCPTA(HBHCI)
DO SET
+4 QUIT
SET ; Set TMP node for CPTs
+1 IF HBHCDIR=1
if (($PIECE(HBHCCPT," "))<HBHCCPTB)!(($PIECE(HBHCCPT," "))>HBHCCPTE)
QUIT
+2 if (HBHCDIR=0)&('$DATA(HBHCTMP($PIECE(HBHCCPT," "))))
QUIT
+3 if $DATA(^TMP("HBHC",$JOB,HBHCCPT))
SET ^TMP("HBHC",$JOB,HBHCCPT)=^TMP("HBHC",$JOB,HBHCCPT)+1
+4 if '$DATA(^TMP("HBHC",$JOB,HBHCCPT))
SET ^TMP("HBHC",$JOB,HBHCCPT)=1
+5 QUIT
PRTLOOP ; Print loop
+1 SET HBHCCPT=""
FOR
SET HBHCCPT=$ORDER(^TMP("HBHC",$JOB,HBHCCPT))
if HBHCCPT=""
QUIT
DO PRINT
+2 QUIT
PRINT ; Print report
+1 SET HBHCCNT=^TMP("HBHC",$JOB,HBHCCPT)
+2 SET HBHCTOT=HBHCTOT+HBHCCNT
+3 IF ($DATA(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5)
WRITE @IOF
DO HDRRANGE^HBHCUTL
+4 WRITE !,HBHCCPT,?39,$JUSTIFY(HBHCCNT,5)
+5 WRITE !,HBHCY
+6 QUIT