HBHCRP22 ; LR VAMC(IRMS)/MJT-HBHC rpt, file 632, user selected date range, CPT code(s) (can be range of CPTs), & Provider, with summary totals ; Apr 2000
;;1.0;HOSPITAL BASED HOME CARE;**11,16**;NOV 01, 1993
; calls: PROV^HBHCUTL2, EN^HBHCUTL2, TOT^HBHCUTL2, FTOT^HBHCUTL2, CPT^HBHCUTL3, EN1^HBHCUTL4, & KILL^HBHCUTL4
D PROV^HBHCUTL2,EN^HBHCUTL2
G:(%=-1)!($D(DTOUT))!($D(DUOUT)) EXIT
D EN1^HBHCUTL4
G:(HBHCBEG1=-1)!(HBHCEND1=-1)!($D(DTOUT))!(('$D(HBHCCPTB))&('$D(HBHCCPTE))&('$D(HBHCTMP)))!(($D(HBHCCPTB))&('$D(HBHCCPTE))) EXIT
S %ZIS="Q" K IOP,ZTIO,ZTSAVE D ^%ZIS G:POP EXIT
I $D(IO("Q")) S ZTRTN="DQ^HBHCRP22",ZTDESC="HBPC Provider CPT Code Summary Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
DQ ; De-queue
U IO
K ^TMP("HBHC",$J)
S HBHCONE=1,(HBHCFTOT,HBHCTOT)=0,$P(HBHCY,"-",81)="",HBHCTXT="CPT Code",HBHCHEAD="Provider CPT Code Summary",HBHCHDR="W !,""CPT Code"",?39,""Total""",HBHCCOLM=(80-(30+$L(HBHCHEAD))\2) S:HBHCCOLM'>0 HBHCCOLM=1
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
I '$D(^TMP("HBHC",$J)) K HBHCNAM D HDRRANGE^HBHCUTL W !!,"No Visits containing CPT codes requested found for Date Range selected."
I $D(^TMP("HBHC",$J)) D PRTLOOP D:'$D(HBHCPRVL) FTOT^HBHCUTL2
D ENDRPT^HBHCUTL1
EXIT ; Exit module
D ^%ZISC,KILL^HBHCUTL4
K DIC,DTOUT,DUOUT,HBHCBEG1,HBHCCLM1,HBHCCPTB,HBHCCPTE,HBHCEND1,HBHCFTOT,HBHCHEAD,HBHCNAM,HBHCONE,HBHCPRV,HBHCPRVL,HBHCTXT,HBHCWHO,HBHCWHOC,HBHCWHOS,Y,%
Q
PROCESS ; Process record & create ^TMP("HBHC",$J global
; Quit if not provider requested
S HBHCPRV=$P(HBHCNOD0,U,4)
I $D(HBHCPRVL) Q:'$D(HBHCPRVL(HBHCPRV))
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 HBHCNAM=$P(^VA(200,$P(^HBHC(631.4,HBHCPRV,0),U,2),0),U)_" ("_$P(^HBHC(631.4,HBHCPRV,0),U)_")"
S:$D(^TMP("HBHC",$J,HBHCNAM,HBHCCPT)) ^TMP("HBHC",$J,HBHCNAM,HBHCCPT)=^TMP("HBHC",$J,HBHCNAM,HBHCCPT)+1
S:'$D(^TMP("HBHC",$J,HBHCNAM,HBHCCPT)) ^TMP("HBHC",$J,HBHCNAM,HBHCCPT)=1
Q
PRTLOOP ; Print loop
S HBHCPRV="" F S HBHCPRV=$O(^TMP("HBHC",$J,HBHCPRV)) D:HBHCTOT>0 TOT^HBHCUTL2 Q:HBHCPRV="" D HDR S HBHCCPT="" F S HBHCCPT=$O(^TMP("HBHC",$J,HBHCPRV,HBHCCPT)) Q:HBHCCPT="" D PRINT
Q
PRINT ; Print report
S HBHCCNT=^TMP("HBHC",$J,HBHCPRV,HBHCCPT)
S HBHCTOT=HBHCTOT+HBHCCNT
I ($D(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5) W @IOF D HDRRANGE^HBHCUTL
W !,HBHCCPT,?39,HBHCCNT
W !,HBHCY
Q
HDR ; Report header setup
S HBHCPAGE=0,HBHCNAM=HBHCPRV,HBHCCLM1=(80-(20+$L(HBHCNAM))\2) S:HBHCCLM1'>0 HBHCCLM1=1
W @IOF D HDRRANGE^HBHCUTL
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHBHCRP22 3044 printed Dec 13, 2024@01:58:27 Page 2
HBHCRP22 ; LR VAMC(IRMS)/MJT-HBHC rpt, file 632, user selected date range, CPT code(s) (can be range of CPTs), & Provider, with summary totals ; Apr 2000
+1 ;;1.0;HOSPITAL BASED HOME CARE;**11,16**;NOV 01, 1993
+2 ; calls: PROV^HBHCUTL2, EN^HBHCUTL2, TOT^HBHCUTL2, FTOT^HBHCUTL2, CPT^HBHCUTL3, EN1^HBHCUTL4, & KILL^HBHCUTL4
+3 DO PROV^HBHCUTL2
DO EN^HBHCUTL2
+4 if (%=-1)!($DATA(DTOUT))!($DATA(DUOUT))
GOTO EXIT
+5 DO EN1^HBHCUTL4
+6 if (HBHCBEG1=-1)!(HBHCEND1=-1)!($DATA(DTOUT))!(('$DATA(HBHCCPTB))&('$DATA(HBHCCPTE))&('$DATA(HBHCTMP)))!(($DATA(HBHCCPTB))&('$DATA(HBHCCPTE)))
GOTO EXIT
+7 SET %ZIS="Q"
KILL IOP,ZTIO,ZTSAVE
DO ^%ZIS
if POP
GOTO EXIT
+8 IF $DATA(IO("Q"))
SET ZTRTN="DQ^HBHCRP22"
SET ZTDESC="HBPC Provider CPT Code Summary Report"
SET ZTSAVE("HBHC*")=""
DO ^%ZTLOAD
GOTO EXIT
DQ ; De-queue
+1 USE IO
+2 KILL ^TMP("HBHC",$JOB)
+3 SET HBHCONE=1
SET (HBHCFTOT,HBHCTOT)=0
SET $PIECE(HBHCY,"-",81)=""
SET HBHCTXT="CPT Code"
SET HBHCHEAD="Provider CPT Code Summary"
SET HBHCHDR="W !,""CPT Code"",?39,""Total"""
SET HBHCCOLM=(80-(30+$LENGTH(HBHCHEAD))\2)
if HBHCCOLM'>0
SET HBHCCOLM=1
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 '$DATA(^TMP("HBHC",$JOB))
KILL HBHCNAM
DO HDRRANGE^HBHCUTL
WRITE !!,"No Visits containing CPT codes requested found for Date Range selected."
+4 IF $DATA(^TMP("HBHC",$JOB))
DO PRTLOOP
if '$DATA(HBHCPRVL)
DO FTOT^HBHCUTL2
+5 DO ENDRPT^HBHCUTL1
EXIT ; Exit module
+1 DO ^%ZISC
DO KILL^HBHCUTL4
+2 KILL DIC,DTOUT,DUOUT,HBHCBEG1,HBHCCLM1,HBHCCPTB,HBHCCPTE,HBHCEND1,HBHCFTOT,HBHCHEAD,HBHCNAM,HBHCONE,HBHCPRV,HBHCPRVL,HBHCTXT,HBHCWHO,HBHCWHOC,HBHCWHOS,Y,%
+3 QUIT
PROCESS ; Process record & create ^TMP("HBHC",$J global
+1 ; Quit if not provider requested
+2 SET HBHCPRV=$PIECE(HBHCNOD0,U,4)
+3 IF $DATA(HBHCPRVL)
if '$DATA(HBHCPRVL(HBHCPRV))
QUIT
+4 SET HBHCDPT0=^DPT($PIECE(HBHCNOD0,U),0)
+5 DO CPT^HBHCUTL3
+6 SET HBHCI=0
FOR
SET HBHCI=$ORDER(HBHCCPTA(HBHCI))
if HBHCI'>0
QUIT
SET HBHCCPT=HBHCCPTA(HBHCI)
DO SET
+7 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 SET HBHCNAM=$PIECE(^VA(200,$PIECE(^HBHC(631.4,HBHCPRV,0),U,2),0),U)_" ("_$PIECE(^HBHC(631.4,HBHCPRV,0),U)_")"
+4 if $DATA(^TMP("HBHC",$JOB,HBHCNAM,HBHCCPT))
SET ^TMP("HBHC",$JOB,HBHCNAM,HBHCCPT)=^TMP("HBHC",$JOB,HBHCNAM,HBHCCPT)+1
+5 if '$DATA(^TMP("HBHC",$JOB,HBHCNAM,HBHCCPT))
SET ^TMP("HBHC",$JOB,HBHCNAM,HBHCCPT)=1
+6 QUIT
PRTLOOP ; Print loop
+1 SET HBHCPRV=""
FOR
SET HBHCPRV=$ORDER(^TMP("HBHC",$JOB,HBHCPRV))
if HBHCTOT>0
DO TOT^HBHCUTL2
if HBHCPRV=""
QUIT
DO HDR
SET HBHCCPT=""
FOR
SET HBHCCPT=$ORDER(^TMP("HBHC",$JOB,HBHCPRV,HBHCCPT))
if HBHCCPT=""
QUIT
DO PRINT
+2 QUIT
PRINT ; Print report
+1 SET HBHCCNT=^TMP("HBHC",$JOB,HBHCPRV,HBHCCPT)
+2 SET HBHCTOT=HBHCTOT+HBHCCNT
+3 IF ($DATA(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5)
WRITE @IOF
DO HDRRANGE^HBHCUTL
+4 WRITE !,HBHCCPT,?39,HBHCCNT
+5 WRITE !,HBHCY
+6 QUIT
HDR ; Report header setup
+1 SET HBHCPAGE=0
SET HBHCNAM=HBHCPRV
SET HBHCCLM1=(80-(20+$LENGTH(HBHCNAM))\2)
if HBHCCLM1'>0
SET HBHCCLM1=1
+2 WRITE @IOF
DO HDRRANGE^HBHCUTL
+3 QUIT