SCRPI02 ;ALB/SCK - Incomplete Encounter Mgmt Statistical Summary Report ; 2/4/97
;;5.3;Scheduling;**66**;AUG 13, 1993
;
EN ; Entry point for summary report
; Variables
; VAUTD,VAUTC - VA variables
; SDDT - Date range, Begin^End
; SDRTYP - Report type S - Summary Only
; D - Summary with Detail
;
N VAUTD,VAUTC,SDDT,ZTSAVE,SDRTYP
;
W !!,"Select Summary Report Only, or Summary Report with Detail",!
Q:$$REPORT(.SDRTYP)'>-1
;
S:SDRTYP["S" (VAUTD,VAUTC)=1
I SDRTYP["D",$$DIV^SCRPIUT1<0 G ENQ
I SDRTYP["D",$$CLN^SCRPIUT1<0 G ENQ
;
I '$$ASKDT(.SDDT) G ENQ
W !
F X="SDDT","VAUTC","VAUTD","VAUTC(","VAUTD(","SDRTYP" D
. S ZTSAVE(X)=""
;
D EN^XUTMDEVQ("RPT^SCRPI02","IEMM Summary Error Report",.ZTSAVE)
D HOME^%ZIS
ENQ Q
;
ENBLT ; Entry point for bulletin generation of summary only report
; Variables
; SDBLT - Flag to send output to a bulletin
; SDRTYP - See above
; SDDT - See above
;
N SDBLT,VAUTC,VAUTD,SDRTYP,SDDT
;
S SDBLT=1,SDRTYP="S",(VAUTD,VAUTC)=1
S SDDT=$$FMADD^XLFDT($$DT^XLFDT,-2)_"^"_$$DT^XLFDT
D RPT^SCRPI02
Q
;
RPT ; Entry point for building the summary report
N SCCNT
;
K ^TMP("SCRPI SUM",$J)
S SCCNT=0
Q:"SD"'[SDRTYP
;
I '$G(SDBLT) I '$D(ZTQUEUED),IOST?1"C-".E D WAIT^DICD
D BLD,BLDDEL
D PRINT^SCRPI02A
;
EXIT ;
K ^TMP("SCRPI SUM",$J)
Q
;
BLD ; Search for errors in the transmitted outpatient encounter error file
; and begin building the report
;
; Variables
; SDEND - Ending date of date range
; SDOEDT - Encounter date
; SDOE - Encounter IEN in #409.68
;
; Output
; ^TMP("SCRPI SUM",$J,Division Name,Clinic Name,0)=P1^P2^P3^P4
; P1 - Total Incomplete Encounters
; P2 - Total Incomplete Deleted Encounters
; P3 - Total Encounters
; P4 - Total Deleted Encounters
;
N SDEND,SDOE,SDOEDT
;
S SDCNT=0
S SDOEDT=$P(SDDT,U)-.1,SDEND=$P(SDDT,U,2)+.9
F S SDOEDT=$O(^SCE("B",SDOEDT)) Q:'SDOEDT!(SDOEDT>SDEND) D
. S SDOE=0 F S SDOE=$O(^SCE("B",SDOEDT,SDOE)) Q:'SDOE D
.. Q:'$D(^SD(409.73,"AENC",SDOE))
.. S SDIV=+$P($G(^SCE(SDOE,0)),U,11) Q:'SDIV
.. S SDIVN=$P($G(^DG(40.8,SDIV,0)),U)
.. Q:$S(VAUTD:0,$D(VAUTD(SDIV)):0,1:1)
.. S SDDCL=+$P($G(^SCE(SDOE,0)),U,4) Q:'SDDCL
.. S SDDCLN=$P($G(^SC(SDDCL,0)),U)
.. Q:$S(VAUTC:0,$D(VAUTC(SDDCL)):0,1:1)
.. S SDXMT=$O(^SD(409.73,"AENC",SDOE,0)) Q:'$D(^SD(409.73,SDXMT))
.. S $P(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0),U,3)=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0)),U,3)+1
.. Q:'$D(^SD(409.75,"B",SDXMT))
.. S $P(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0),U)=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0)),U)+1
.. D ADD(SDXMT,SDIV,SDIVN,SDDCL,SDDCLN,1)
Q
;
BLDDEL ; Search for entries in the Deleted Outpatient Encounter File and add to
; the report.
; Variables
; See list in BLD
;
N SDOEDT,SDEND,SDOE
;
S SDCNT=0
S SDOEDT=$P(SDDT,U)-.1,SDEND=$P(SDDT,U,2)+.9
F S SDOEDT=$O(^SD(409.74,"B",SDOEDT)) Q:'SDOEDT!(SDOEDT>SDEND) D
. S SDOE=0 F S SDOE=$O(^SD(409.74,"B",SDOEDT,SDOE)) Q:'SDOE D
.. Q:'$D(^SD(409.73,"ADEL",SDOE))
.. S SDIV=+$P($G(^SD(409.74,SDOE,1)),U,11) Q:'SDIV
.. S SDIVN=$P($G(^DG(40.8,SDIV,0)),U)
.. Q:$S(VAUTD:0,$D(VAUTD(SDIV)):0,1:1)
.. S SDDCL=+$P($G(^SD(409.74,SDOE,1)),U,4) Q:'SDDCL
.. S SDDCLN=$P($G(^SC(SDDCL,0)),U)
.. Q:$S(VAUTC:0,$D(VAUTC(SDDCL)):0,1:1)
.. S SDXMT=$O(^SD(409.73,"ADEL",SDOE,0)) Q:'$D(^SD(409.73,SDXMT))
.. Q:'$D(^SD(409.75,"B",SDXMT))
.. S $P(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0),U,4)=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0)),U,4)+1
.. D ADD(SDXMT,SDIV,SDIVN,SDDCL,SDDCLN,2)
Q
;
ADD(SDXMT,SDIV,SDIVN,SDDCL,SDDCLN,SDPCE) ; Add error entries from #409.75
; for transmission entry.
; Input
; SDXMT - Pointer to #409.75
; SDIV - Division IEN
; SDIVN - Division Name
; SDDCL - Clinic IEN
; SDDCLN - Clinic Name
; SDPCE - Piece to increment in ^TMP("SCRPI SUM",$J...
; 1 - Incomplete Encounter (P1)
; 2 - Deleted Incomplete Encounter (P2)
;
; Output
; ^TMP("SCRPI SUM",$J,Div Name, Clin Name, Error Table IEN,0)=P1^P2
;
; Variables
; SCDE - #409.75 IEN
; SCER - Pointer to #409.76
;
N SCDE,SCER
;
S SCDE=0 F S SCDE=$O(^SD(409.75,"B",SDXMT,SCDE)) Q:'SCDE D
. S SCER=$P($G(^SD(409.75,SCDE,0)),U,2) Q:'SCER
. S $P(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,SCER,0),U,SDPCE)=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,SCER,0)),U)+1
. S SDCNT=SDCNT+1
. I '$D(ZTQUEUED),(IOST?1"C-".E),(SDCNT#10=0) W "."
Q
;
REPORT(SDR) ; Select type of summary report
; Variable Input
; SDR - Returns with Report Type S - Summary Only,
; D - Summary with detail
;
; Returns
; 1 - Ok
; -1 - No report type selected
N NX,Y
;
S SDR=""
S DIR(0)="YA",DIR("A")="Summary report only? ",DIR("B")="YES"
S DIR("?")="Answer with Yes or No."
S DIR("??")="^D HELP^SCRPI02"
D ^DIR K DIR I $D(DIRUT) S Y=-1 G RPTQ
S SDR=$S(Y:"S",1:"D")
RPTQ Q Y
;
ASKDT(SDT) ; Ask for date range for report
; Variable Input
; SDT - Returns date range as Begin^End
;
; Returns
; 1 - Date range selected
; 0 - No date range selected
;
S SDBDT=$$FMADD^XLFDT($$DT^XLFDT,-7)
W !!,"Date Range for Encounters"
S DIR(0)="DA^2961001:NOW:EXP",DIR("A")="Enter beginning date for search: "
S DIR("?")="^D HELP^%DTC"
S DIR("B")=$$FMTE^XLFDT(SDBDT)
D ^DIR I $D(DIRUT) K SDT G ASKQ
K DIRUT
S SDT=Y
;
S DIR("A")="Enter ending date for search: "
S DIR("B")="TODAY"
D ^DIR K DIR I $D(DIRUT) K SDT G ASKQ
K DIRUT
S $P(SDT,U,2)=Y
ASKQ Q $G(SDT)>0
;
HELP ;
W !?2,"Answering YES, will provide a table of all clinics,"
W !?2,"showing total encounters, number of incomplete encounters, and"
W !?2,"percentage. Answering NO will include a list of error details "
W !?2,"for each selected clinic, in decsending order of occurrence,"
W !?2,"and the number of encounters and incomplete encounters.",!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCRPI02 6185 printed Nov 22, 2024@17:52:28 Page 2
SCRPI02 ;ALB/SCK - Incomplete Encounter Mgmt Statistical Summary Report ; 2/4/97
+1 ;;5.3;Scheduling;**66**;AUG 13, 1993
+2 ;
EN ; Entry point for summary report
+1 ; Variables
+2 ; VAUTD,VAUTC - VA variables
+3 ; SDDT - Date range, Begin^End
+4 ; SDRTYP - Report type S - Summary Only
+5 ; D - Summary with Detail
+6 ;
+7 NEW VAUTD,VAUTC,SDDT,ZTSAVE,SDRTYP
+8 ;
+9 WRITE !!,"Select Summary Report Only, or Summary Report with Detail",!
+10 if $$REPORT(.SDRTYP)'>-1
QUIT
+11 ;
+12 if SDRTYP["S"
SET (VAUTD,VAUTC)=1
+13 IF SDRTYP["D"
IF $$DIV^SCRPIUT1<0
GOTO ENQ
+14 IF SDRTYP["D"
IF $$CLN^SCRPIUT1<0
GOTO ENQ
+15 ;
+16 IF '$$ASKDT(.SDDT)
GOTO ENQ
+17 WRITE !
+18 FOR X="SDDT","VAUTC","VAUTD","VAUTC(","VAUTD(","SDRTYP"
Begin DoDot:1
+19 SET ZTSAVE(X)=""
End DoDot:1
+20 ;
+21 DO EN^XUTMDEVQ("RPT^SCRPI02","IEMM Summary Error Report",.ZTSAVE)
+22 DO HOME^%ZIS
ENQ QUIT
+1 ;
ENBLT ; Entry point for bulletin generation of summary only report
+1 ; Variables
+2 ; SDBLT - Flag to send output to a bulletin
+3 ; SDRTYP - See above
+4 ; SDDT - See above
+5 ;
+6 NEW SDBLT,VAUTC,VAUTD,SDRTYP,SDDT
+7 ;
+8 SET SDBLT=1
SET SDRTYP="S"
SET (VAUTD,VAUTC)=1
+9 SET SDDT=$$FMADD^XLFDT($$DT^XLFDT,-2)_"^"_$$DT^XLFDT
+10 DO RPT^SCRPI02
+11 QUIT
+12 ;
RPT ; Entry point for building the summary report
+1 NEW SCCNT
+2 ;
+3 KILL ^TMP("SCRPI SUM",$JOB)
+4 SET SCCNT=0
+5 if "SD"'[SDRTYP
QUIT
+6 ;
+7 IF '$GET(SDBLT)
IF '$DATA(ZTQUEUED)
IF IOST?1"C-".E
DO WAIT^DICD
+8 DO BLD
DO BLDDEL
+9 DO PRINT^SCRPI02A
+10 ;
EXIT ;
+1 KILL ^TMP("SCRPI SUM",$JOB)
+2 QUIT
+3 ;
BLD ; Search for errors in the transmitted outpatient encounter error file
+1 ; and begin building the report
+2 ;
+3 ; Variables
+4 ; SDEND - Ending date of date range
+5 ; SDOEDT - Encounter date
+6 ; SDOE - Encounter IEN in #409.68
+7 ;
+8 ; Output
+9 ; ^TMP("SCRPI SUM",$J,Division Name,Clinic Name,0)=P1^P2^P3^P4
+10 ; P1 - Total Incomplete Encounters
+11 ; P2 - Total Incomplete Deleted Encounters
+12 ; P3 - Total Encounters
+13 ; P4 - Total Deleted Encounters
+14 ;
+15 NEW SDEND,SDOE,SDOEDT
+16 ;
+17 SET SDCNT=0
+18 SET SDOEDT=$PIECE(SDDT,U)-.1
SET SDEND=$PIECE(SDDT,U,2)+.9
+19 FOR
SET SDOEDT=$ORDER(^SCE("B",SDOEDT))
if 'SDOEDT!(SDOEDT>SDEND)
QUIT
Begin DoDot:1
+20 SET SDOE=0
FOR
SET SDOE=$ORDER(^SCE("B",SDOEDT,SDOE))
if 'SDOE
QUIT
Begin DoDot:2
+21 if '$DATA(^SD(409.73,"AENC",SDOE))
QUIT
+22 SET SDIV=+$PIECE($GET(^SCE(SDOE,0)),U,11)
if 'SDIV
QUIT
+23 SET SDIVN=$PIECE($GET(^DG(40.8,SDIV,0)),U)
+24 if $SELECT(VAUTD
QUIT
+25 SET SDDCL=+$PIECE($GET(^SCE(SDOE,0)),U,4)
if 'SDDCL
QUIT
+26 SET SDDCLN=$PIECE($GET(^SC(SDDCL,0)),U)
+27 if $SELECT(VAUTC
QUIT
+28 SET SDXMT=$ORDER(^SD(409.73,"AENC",SDOE,0))
if '$DATA(^SD(409.73,SDXMT))
QUIT
+29 SET $PIECE(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,0),U,3)=+$PIECE($GET(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,0)),U,3)+1
+30 if '$DATA(^SD(409.75,"B",SDXMT))
QUIT
+31 SET $PIECE(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,0),U)=+$PIECE($GET(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,0)),U)+1
+32 DO ADD(SDXMT,SDIV,SDIVN,SDDCL,SDDCLN,1)
End DoDot:2
End DoDot:1
+33 QUIT
+34 ;
BLDDEL ; Search for entries in the Deleted Outpatient Encounter File and add to
+1 ; the report.
+2 ; Variables
+3 ; See list in BLD
+4 ;
+5 NEW SDOEDT,SDEND,SDOE
+6 ;
+7 SET SDCNT=0
+8 SET SDOEDT=$PIECE(SDDT,U)-.1
SET SDEND=$PIECE(SDDT,U,2)+.9
+9 FOR
SET SDOEDT=$ORDER(^SD(409.74,"B",SDOEDT))
if 'SDOEDT!(SDOEDT>SDEND)
QUIT
Begin DoDot:1
+10 SET SDOE=0
FOR
SET SDOE=$ORDER(^SD(409.74,"B",SDOEDT,SDOE))
if 'SDOE
QUIT
Begin DoDot:2
+11 if '$DATA(^SD(409.73,"ADEL",SDOE))
QUIT
+12 SET SDIV=+$PIECE($GET(^SD(409.74,SDOE,1)),U,11)
if 'SDIV
QUIT
+13 SET SDIVN=$PIECE($GET(^DG(40.8,SDIV,0)),U)
+14 if $SELECT(VAUTD
QUIT
+15 SET SDDCL=+$PIECE($GET(^SD(409.74,SDOE,1)),U,4)
if 'SDDCL
QUIT
+16 SET SDDCLN=$PIECE($GET(^SC(SDDCL,0)),U)
+17 if $SELECT(VAUTC
QUIT
+18 SET SDXMT=$ORDER(^SD(409.73,"ADEL",SDOE,0))
if '$DATA(^SD(409.73,SDXMT))
QUIT
+19 if '$DATA(^SD(409.75,"B",SDXMT))
QUIT
+20 SET $PIECE(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,0),U,4)=+$PIECE($GET(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,0)),U,4)+1
+21 DO ADD(SDXMT,SDIV,SDIVN,SDDCL,SDDCLN,2)
End DoDot:2
End DoDot:1
+22 QUIT
+23 ;
ADD(SDXMT,SDIV,SDIVN,SDDCL,SDDCLN,SDPCE) ; Add error entries from #409.75
+1 ; for transmission entry.
+2 ; Input
+3 ; SDXMT - Pointer to #409.75
+4 ; SDIV - Division IEN
+5 ; SDIVN - Division Name
+6 ; SDDCL - Clinic IEN
+7 ; SDDCLN - Clinic Name
+8 ; SDPCE - Piece to increment in ^TMP("SCRPI SUM",$J...
+9 ; 1 - Incomplete Encounter (P1)
+10 ; 2 - Deleted Incomplete Encounter (P2)
+11 ;
+12 ; Output
+13 ; ^TMP("SCRPI SUM",$J,Div Name, Clin Name, Error Table IEN,0)=P1^P2
+14 ;
+15 ; Variables
+16 ; SCDE - #409.75 IEN
+17 ; SCER - Pointer to #409.76
+18 ;
+19 NEW SCDE,SCER
+20 ;
+21 SET SCDE=0
FOR
SET SCDE=$ORDER(^SD(409.75,"B",SDXMT,SCDE))
if 'SCDE
QUIT
Begin DoDot:1
+22 SET SCER=$PIECE($GET(^SD(409.75,SCDE,0)),U,2)
if 'SCER
QUIT
+23 SET $PIECE(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,SCER,0),U,SDPCE)=+$PIECE($GET(^TMP("SCRPI SUM",$JOB,SDIVN,SDDCLN,SCER,0)),U)+1
+24 SET SDCNT=SDCNT+1
+25 IF '$DATA(ZTQUEUED)
IF (IOST?1"C-".E)
IF (SDCNT#10=0)
WRITE "."
End DoDot:1
+26 QUIT
+27 ;
REPORT(SDR) ; Select type of summary report
+1 ; Variable Input
+2 ; SDR - Returns with Report Type S - Summary Only,
+3 ; D - Summary with detail
+4 ;
+5 ; Returns
+6 ; 1 - Ok
+7 ; -1 - No report type selected
+8 NEW NX,Y
+9 ;
+10 SET SDR=""
+11 SET DIR(0)="YA"
SET DIR("A")="Summary report only? "
SET DIR("B")="YES"
+12 SET DIR("?")="Answer with Yes or No."
+13 SET DIR("??")="^D HELP^SCRPI02"
+14 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET Y=-1
GOTO RPTQ
+15 SET SDR=$SELECT(Y:"S",1:"D")
RPTQ QUIT Y
+1 ;
ASKDT(SDT) ; Ask for date range for report
+1 ; Variable Input
+2 ; SDT - Returns date range as Begin^End
+3 ;
+4 ; Returns
+5 ; 1 - Date range selected
+6 ; 0 - No date range selected
+7 ;
+8 SET SDBDT=$$FMADD^XLFDT($$DT^XLFDT,-7)
+9 WRITE !!,"Date Range for Encounters"
+10 SET DIR(0)="DA^2961001:NOW:EXP"
SET DIR("A")="Enter beginning date for search: "
+11 SET DIR("?")="^D HELP^%DTC"
+12 SET DIR("B")=$$FMTE^XLFDT(SDBDT)
+13 DO ^DIR
IF $DATA(DIRUT)
KILL SDT
GOTO ASKQ
+14 KILL DIRUT
+15 SET SDT=Y
+16 ;
+17 SET DIR("A")="Enter ending date for search: "
+18 SET DIR("B")="TODAY"
+19 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
KILL SDT
GOTO ASKQ
+20 KILL DIRUT
+21 SET $PIECE(SDT,U,2)=Y
ASKQ QUIT $GET(SDT)>0
+1 ;
HELP ;
+1 WRITE !?2,"Answering YES, will provide a table of all clinics,"
+2 WRITE !?2,"showing total encounters, number of incomplete encounters, and"
+3 WRITE !?2,"percentage. Answering NO will include a list of error details "
+4 WRITE !?2,"for each selected clinic, in decsending order of occurrence,"
+5 WRITE !?2,"and the number of encounters and incomplete encounters.",!
+6 QUIT