SCRPI01 ;ALB/SCK - IEMM REPORT OF INCOMPLETE ENCOUNTERS ; 2/2/97
;;5.3;Scheduling;**66,338,1015**;AUG 13, 1993;Build 21
;
EN ; Main entry point for report of incomplete encounters report
; Variables
; SDTXT - String array for initial message display
; SDDT - date Range, Begin^End
; SDSEL1,2 - Selection methods Line Tag
; SDOK - Flag, 1 - Ok to continu, 0 - Quit
;
N VAUTD,VAUTC,VAUDS,VAUTSTR,VAUTNI,SDTXT,SDDT,ZTSAVE,VAUTN,VAUER,SDSEL1,SDSEL2,SDOK,NDX,VAUTVB
;
W !,$C(7)
F NDX=1:1 S SDTXT=$P($T(MSG+NDX),";;",2) Q:SDTXT="$$END" D
. W !,SDTXT
W !!
S DIR(0)="E" D ^DIR K DIR Q:'$G(Y)
;
I $$DIV^SCRPIUT1<0 G ENQ
D MSG2
S SDSEL1=$$SELCT("","First") G:SDSEL1']"" ENQ
S SDSEL2=$$SELCT(SDSEL1,"Next") G:SDSEL2']"" ENQ
I '$$ASKDT^SCENI01(.SDDT) G ENQ
;
D @SDSEL1 Q:$G(SDOK)<0
D @SDSEL2 Q:$G(SDOK)<0
;
F X="SDDT","VAUTC","VAUTD","VAUDS","VAUDS(","VAUTC(","VAUTD(","SDSEL1","SDSEL2","VAUTN","VAUTN(","VAUER","VAUER(" D
. S ZTSAVE(X)=""
S IOP="Q"
W !!,"This report requires 132 columns and could take some time.",!,"Remember to QUEUE the report.",!
D EN^XUTMDEVQ("RPT^SCRPI01","IEMM Error Listing",.ZTSAVE)
D HOME^%ZIS
ENQ Q
;
RPT ; Build report, then call print
K ^TMP("SCRPI ERR",$J)
D BLD
D PRINT^SCRPI01A
Q
;
EXIT ;
K ^TMP("SCRPI ERR",$J)
Q
;
SELCT(S1,SCT) ; Set selection criteria
; Input
; S1 - Previous selection method
; SCT - first or second selection method
;
; Returns
; CLN - Clinic
; ERR - Error Code
; PAT - Patient
; DSS - Stop Code
;
; Variables
; SCTEXT - Set up display list
;
N X,CNT,SCTEXT
S X="SM^"
F CNT=1:1 S SCTEXT=$P($T(OPTIONS+CNT),";;",2) Q:SCTEXT="$$END" D
. Q:S1[$P(SCTEXT,":")
. S X=X_SCTEXT
;
S DIR(0)=X,DIR("A")="Set "_SCT_" Selection Criteria"
S DIR("?")="Pick a selection criteria from those listed below."
S DIR("??")="^D HLP^SCRPI01"
D ^DIR K DIR
Q $S(Y["C":"CLN",Y["P":"PAT",Y["E":"ERR",Y["D":"DSS",1:"")
;
CLN ; Clinic selection o/m/a
W !!,"Clinic Selection"
S VAUTNI=2
D CLINIC^VAUTOMA
W !
S SDOK=Y
Q
;
PAT ; Patient selection o/m/a
W !!,"Patient Selection"
S VAUTNI=2
D PATIENT^VAUTOMA
W !
S SDOK=Y
Q
;
ERR ; Error selection o/m/a
W !!,"Transmission Error Selection"
S DIC="^SD(409.76,",VAUTSTR="Error",VAUTVB="VAUER",VAUTNI=2
D FIRST^VAUTOMA
W !
S SDOK=Y
Q
;
DSS ; Clinic Stop code selection o/m/a
W !!,"Clinic Stop Code Selection"
S DIC="^DIC(40.7,",VAUTSTR="Stop Code",VAUTVB="VAUDS",VAUTNI=2
D FIRST^VAUTOMA
W !
S SDOK=1
Q
;
BLD ; Search for incomplete encounters and build TMP global
; Variables
; SDEND - End date of date range
; SDOE - Encounter IEN
; SDOEDT - Encounter date
; SDCNT - Entry count
;
N SDEND,SDOE,SDOEDT,SDCNT
;
S SDOEDT=$P(SDDT,U)-.1,SDEND=$P(SDDT,U,2)+.9,SDCNT=0
F S SDOEDT=$O(^SD(409.75,"AEDT",SDOEDT)) Q:'SDOEDT!(SDOEDT>SDEND) D
. S SDXMT=0 F S SDXMT=$O(^SD(409.75,"AEDT",SDOEDT,SDXMT)) Q:'SDXMT D
.. S SDXER=0 F S SDXER=$O(^SD(409.75,"AEDT",SDOEDT,SDXMT,SDXER)) Q:'SDXER D BLD1(SDXER,SDXMT)
Q
;
BLD1(SDE,SDX) ; If error passes checks, add to sorted TMP global
; Input
; SDE - Pointer to #409.75
; SDX - Pointer to #409.73
;
; Variables
; SCEN - Temporary array for encounter information
; SDDEL - Deleted Encounter Marker "*"
; SDRSLT - -1:error, 1:Deleted Encounter, 0:Not deleted
; SDIV - Division IEN
; SDCDE - Stop code
;
; Output
; ^TMP("SCRPI ERR",$J,Division Name,Clinic Name,Patient Name,Encounter Date,Error code IEN,0)=DFN^#409.73 Pointer^Deleted Flag
;
N SCEN,SDDEL,SDRSLT,SDIV,SDCDE
;
I '$D(ZTQUEUED) S SDCNT=SDCNT+1 W:(SDCNT#10)=0 "."
;
S SDRSLT=$$OPENC^SCUTIE1(SDXMT,"SCEN")
Q:SDRSLT<0
S:SDRSLT SDDEL="*"
;
I SDRSLT D
. S SDIV=$P(^SD(409.74,SCEN("DELIEN"),1),U,11)
. S SDCDE=$P(^SD(409.74,SCEN("DELIEN"),1),U,3)
E D
. S SDIV=$P(^SCE(SCEN("SDOIEN"),0),U,11)
. S SDCDE=$P(^SCE(SCEN("SDOIEN"),0),U,3)
;
I $S(VAUTD:0,$D(VAUTD(SDIV)):0,1:1) Q
;
I SDSEL1="CLN",$S(VAUTC:0,$D(VAUTC(SCEN("CLINIC"))):0,1:1) Q
I SDSEL1="PAT",$S(VAUTN:0,$D(VAUTN(SCEN("DFN"))):0,1:1) Q
I SDSEL1="ERR" Q:'$D(^SD(409.75,SDE,0)) I $S(VAUER:0,$D(VAUER($P(^SD(409.75,SDE,0),U,2))):0,1:1) Q ; SD*5.3*338
I SDSEL1="DSS",$S(VAUDS:0,$D(VAUDS(SDCDE)):0,1:1) Q
;
I SDSEL2="CLN",$S(VAUTC:0,$D(VAUTC(SCEN("CLINIC"))):0,1:1) Q
I SDSEL2="PAT",$S(VAUTN:0,$D(VAUTN(SCEN("DFN"))):0,1:1) Q
I SDSEL2="ERR" Q:'$D(^SD(409.75,SDE,0)) I $S(VAUER:0,$D(VAUER($P(^SD(409.75,SDE,0),U,2))):0,1:1) Q ; SD*5.3*338
I SDSEL2="DSS",$S(VAUDS:0,$D(VAUDS(SDCDE)):0,1:1) Q
;
S ^TMP("SCRPI ERR",$J,$P(^DG(40.8,SDIV,0),U),$P(^SC(SCEN("CLINIC"),0),U),$P(^DPT(SCEN("DFN"),0),U),SCEN("ENCOUNTER"),SDE,0)=SCEN("DFN")_U_SDX_U_$G(SDDEL)
Q
;
SELMTHD(SEL) ; Returns 'external' version of selection method
Q $S(SEL="CLN":"Clinic",SEL="PAT":"Patient",SEL="ERR":"Error Code",SEL="DSS":"Clinic Stop Code")
;
HLP ; '??' help for the selection criteria.
;
W !?2,"You may select any two of the following selection criteria, one at a time, for"
W !?2,"your report. You will be asked for one/many/all selections for each criteria"
W !?2,"selected."
W !
W !?2,"Selection criteria are not sort criteria. The sort criteria are Division,"
W !?2,"Clinic, Patient, and Encounter. Selection criteria limit what will be"
W !?2,"printed in the report."
Q
;
MSG2 ;
W !!!
W "The following are selection criteria which are used to specify a group of or"
W !,"particular clinic, patient, error code or clinic stop code to be printed."
W !,"You are asked to pick two, one at a time. Type '??' for more details."
Q
;
MSG ;
;; This report requires 132 columns to print and will default to
;; QUEUING required. If you print this report to your terminal,
;; answer 'NO' to the 'Do you still want your output queued' prompt.
;;$$END
;
OPTIONS ; Selection methods
;;C:Clinic;
;;P:Patient;
;;E:Error Code;
;;D:Clinic Stop Code;
;;$$END
;
SCRPI01 ;ALB/SCK - IEMM REPORT OF INCOMPLETE ENCOUNTERS ; 2/2/97
+1 ;;5.3;Scheduling;**66,338,1015**;AUG 13, 1993;Build 21
+2 ;
EN ; Main entry point for report of incomplete encounters report
+1 ; Variables
+2 ; SDTXT - String array for initial message display
+3 ; SDDT - date Range, Begin^End
+4 ; SDSEL1,2 - Selection methods Line Tag
+5 ; SDOK - Flag, 1 - Ok to continu, 0 - Quit
+6 ;
+7 NEW VAUTD,VAUTC,VAUDS,VAUTSTR,VAUTNI,SDTXT,SDDT,ZTSAVE,VAUTN,VAUER,SDSEL1,SDSEL2,SDOK,NDX,VAUTVB
+8 ;
+9 WRITE !,$CHAR(7)
+10 FOR NDX=1:1
SET SDTXT=$PIECE($TEXT(MSG+NDX),";;",2)
IF SDTXT="$$END"
QUIT
Begin DoDot:1
+11 WRITE !,SDTXT
End DoDot:1
+12 WRITE !!
+13 SET DIR(0)="E"
DO ^DIR
KILL DIR
IF '$GET(Y)
QUIT
+14 ;
+15 IF $$DIV^SCRPIUT1<0
GOTO ENQ
+16 DO MSG2
+17 SET SDSEL1=$$SELCT("","First")
IF SDSEL1']""
GOTO ENQ
+18 SET SDSEL2=$$SELCT(SDSEL1,"Next")
IF SDSEL2']""
GOTO ENQ
+19 IF '$$ASKDT^SCENI01(.SDDT)
GOTO ENQ
+20 ;
+21 DO @SDSEL1
IF $GET(SDOK)<0
QUIT
+22 DO @SDSEL2
IF $GET(SDOK)<0
QUIT
+23 ;
+24 FOR X="SDDT","VAUTC","VAUTD","VAUDS","VAUDS(","VAUTC(","VAUTD(","SDSEL1","SDSEL2","VAUTN","VAUTN(","VAUER","VAUER("
Begin DoDot:1
+25 SET ZTSAVE(X)=""
End DoDot:1
+26 SET IOP="Q"
+27 WRITE !!,"This report requires 132 columns and could take some time.",!,"Remember to QUEUE the report.",!
+28 DO EN^XUTMDEVQ("RPT^SCRPI01","IEMM Error Listing",.ZTSAVE)
+29 DO HOME^%ZIS
ENQ QUIT
+1 ;
RPT ; Build report, then call print
+1 KILL ^TMP("SCRPI ERR",$JOB)
+2 DO BLD
+3 DO PRINT^SCRPI01A
+4 QUIT
+5 ;
EXIT ;
+1 KILL ^TMP("SCRPI ERR",$JOB)
+2 QUIT
+3 ;
SELCT(S1,SCT) ; Set selection criteria
+1 ; Input
+2 ; S1 - Previous selection method
+3 ; SCT - first or second selection method
+4 ;
+5 ; Returns
+6 ; CLN - Clinic
+7 ; ERR - Error Code
+8 ; PAT - Patient
+9 ; DSS - Stop Code
+10 ;
+11 ; Variables
+12 ; SCTEXT - Set up display list
+13 ;
+14 NEW X,CNT,SCTEXT
+15 SET X="SM^"
+16 FOR CNT=1:1
SET SCTEXT=$PIECE($TEXT(OPTIONS+CNT),";;",2)
IF SCTEXT="$$END"
QUIT
Begin DoDot:1
+17 IF S1[$PIECE(SCTEXT,"
QUIT
+18 SET X=X_SCTEXT
End DoDot:1
+19 ;
+20 SET DIR(0)=X
SET DIR("A")="Set "_SCT_" Selection Criteria"
+21 SET DIR("?")="Pick a selection criteria from those listed below."
+22 SET DIR("??")="^D HLP^SCRPI01"
+23 DO ^DIR
KILL DIR
+24 QUIT $SELECT(Y["C":"CLN",Y["P":"PAT",Y["E":"ERR",Y["D":"DSS",1:"")
+25 ;
CLN ; Clinic selection o/m/a
+1 WRITE !!,"Clinic Selection"
+2 SET VAUTNI=2
+3 DO CLINIC^VAUTOMA
+4 WRITE !
+5 SET SDOK=Y
+6 QUIT
+7 ;
PAT ; Patient selection o/m/a
+1 WRITE !!,"Patient Selection"
+2 SET VAUTNI=2
+3 DO PATIENT^VAUTOMA
+4 WRITE !
+5 SET SDOK=Y
+6 QUIT
+7 ;
ERR ; Error selection o/m/a
+1 WRITE !!,"Transmission Error Selection"
+2 SET DIC="^SD(409.76,"
SET VAUTSTR="Error"
SET VAUTVB="VAUER"
SET VAUTNI=2
+3 DO FIRST^VAUTOMA
+4 WRITE !
+5 SET SDOK=Y
+6 QUIT
+7 ;
DSS ; Clinic Stop code selection o/m/a
+1 WRITE !!,"Clinic Stop Code Selection"
+2 SET DIC="^DIC(40.7,"
SET VAUTSTR="Stop Code"
SET VAUTVB="VAUDS"
SET VAUTNI=2
+3 DO FIRST^VAUTOMA
+4 WRITE !
+5 SET SDOK=1
+6 QUIT
+7 ;
BLD ; Search for incomplete encounters and build TMP global
+1 ; Variables
+2 ; SDEND - End date of date range
+3 ; SDOE - Encounter IEN
+4 ; SDOEDT - Encounter date
+5 ; SDCNT - Entry count
+6 ;
+7 NEW SDEND,SDOE,SDOEDT,SDCNT
+8 ;
+9 SET SDOEDT=$PIECE(SDDT,U)-.1
SET SDEND=$PIECE(SDDT,U,2)+.9
SET SDCNT=0
+10 FOR
SET SDOEDT=$ORDER(^SD(409.75,"AEDT",SDOEDT))
IF 'SDOEDT!(SDOEDT>SDEND)
QUIT
Begin DoDot:1
+11 SET SDXMT=0
FOR
SET SDXMT=$ORDER(^SD(409.75,"AEDT",SDOEDT,SDXMT))
IF 'SDXMT
QUIT
Begin DoDot:2
+12 SET SDXER=0
FOR
SET SDXER=$ORDER(^SD(409.75,"AEDT",SDOEDT,SDXMT,SDXER))
IF 'SDXER
QUIT
DO BLD1(SDXER,SDXMT)
End DoDot:2
End DoDot:1
+13 QUIT
+14 ;
BLD1(SDE,SDX) ; If error passes checks, add to sorted TMP global
+1 ; Input
+2 ; SDE - Pointer to #409.75
+3 ; SDX - Pointer to #409.73
+4 ;
+5 ; Variables
+6 ; SCEN - Temporary array for encounter information
+7 ; SDDEL - Deleted Encounter Marker "*"
+8 ; SDRSLT - -1:error, 1:Deleted Encounter, 0:Not deleted
+9 ; SDIV - Division IEN
+10 ; SDCDE - Stop code
+11 ;
+12 ; Output
+13 ; ^TMP("SCRPI ERR",$J,Division Name,Clinic Name,Patient Name,Encounter Date,Error code IEN,0)=DFN^#409.73 Pointer^Deleted Flag
+14 ;
+15 NEW SCEN,SDDEL,SDRSLT,SDIV,SDCDE
+16 ;
+17 IF '$DATA(ZTQUEUED)
SET SDCNT=SDCNT+1
IF (SDCNT#10)=0
WRITE "."
+18 ;
+19 SET SDRSLT=$$OPENC^SCUTIE1(SDXMT,"SCEN")
+20 IF SDRSLT<0
QUIT
+21 IF SDRSLT
SET SDDEL="*"
+22 ;
+23 IF SDRSLT
Begin DoDot:1
+24 SET SDIV=$PIECE(^SD(409.74,SCEN("DELIEN"),1),U,11)
+25 SET SDCDE=$PIECE(^SD(409.74,SCEN("DELIEN"),1),U,3)
End DoDot:1
+26 IF '$TEST
Begin DoDot:1
+27 SET SDIV=$PIECE(^SCE(SCEN("SDOIEN"),0),U,11)
+28 SET SDCDE=$PIECE(^SCE(SCEN("SDOIEN"),0),U,3)
End DoDot:1
+29 ;
+30 IF $SELECT(VAUTD:0,$DATA(VAUTD(SDIV)):0,1:1)
QUIT
+31 ;
+32 IF SDSEL1="CLN"
IF $SELECT(VAUTC:0,$DATA(VAUTC(SCEN("CLINIC"))):0,1:1)
QUIT
+33 IF SDSEL1="PAT"
IF $SELECT(VAUTN:0,$DATA(VAUTN(SCEN("DFN"))):0,1:1)
QUIT
+34 ; SD*5.3*338
IF SDSEL1="ERR"
IF '$DATA(^SD(409.75,SDE,0))
QUIT
IF $SELECT(VAUER:0,$DATA(VAUER($PIECE(^SD(409.75,SDE,0),U,2))):0,1:1)
QUIT
+35 IF SDSEL1="DSS"
IF $SELECT(VAUDS:0,$DATA(VAUDS(SDCDE)):0,1:1)
QUIT
+36 ;
+37 IF SDSEL2="CLN"
IF $SELECT(VAUTC:0,$DATA(VAUTC(SCEN("CLINIC"))):0,1:1)
QUIT
+38 IF SDSEL2="PAT"
IF $SELECT(VAUTN:0,$DATA(VAUTN(SCEN("DFN"))):0,1:1)
QUIT
+39 ; SD*5.3*338
IF SDSEL2="ERR"
IF '$DATA(^SD(409.75,SDE,0))
QUIT
IF $SELECT(VAUER:0,$DATA(VAUER($PIECE(^SD(409.75,SDE,0),U,2))):0,1:1)
QUIT
+40 IF SDSEL2="DSS"
IF $SELECT(VAUDS:0,$DATA(VAUDS(SDCDE)):0,1:1)
QUIT
+41 ;
+42 SET ^TMP("SCRPI ERR",$JOB,$PIECE(^DG(40.8,SDIV,0),U),$PIECE(^SC(SCEN("CLINIC"),0),U),$PIECE(^DPT(SCEN("DFN"),0),U),SCEN("ENCOUNTER"),SDE,0)=SCEN("DFN")_U_SDX_U_$GET(SDDEL)
+43 QUIT
+44 ;
SELMTHD(SEL) ; Returns 'external' version of selection method
+1 QUIT $SELECT(SEL="CLN":"Clinic",SEL="PAT":"Patient",SEL="ERR":"Error Code",SEL="DSS":"Clinic Stop Code")
+2 ;
HLP ; '??' help for the selection criteria.
+1 ;
+2 WRITE !?2,"You may select any two of the following selection criteria, one at a time, for"
+3 WRITE !?2,"your report. You will be asked for one/many/all selections for each criteria"
+4 WRITE !?2,"selected."
+5 WRITE !
+6 WRITE !?2,"Selection criteria are not sort criteria. The sort criteria are Division,"
+7 WRITE !?2,"Clinic, Patient, and Encounter. Selection criteria limit what will be"
+8 WRITE !?2,"printed in the report."
+9 QUIT
+10 ;
MSG2 ;
+1 WRITE !!!
+2 WRITE "The following are selection criteria which are used to specify a group of or"
+3 WRITE !,"particular clinic, patient, error code or clinic stop code to be printed."
+4 WRITE !,"You are asked to pick two, one at a time. Type '??' for more details."
+5 QUIT
+6 ;
MSG ;
+1 ;; This report requires 132 columns to print and will default to
+2 ;; QUEUING required. If you print this report to your terminal,
+3 ;; answer 'NO' to the 'Do you still want your output queued' prompt.
+4 ;;$$END
+5 ;
OPTIONS ; Selection methods
+1 ;;C:Clinic;
+2 ;;P:Patient;
+3 ;;E:Error Code;
+4 ;;D:Clinic Stop Code;
+5 ;;$$END
+6 ;