TIUCOPR ;SLC/TDP - Copy/Paste Report ;Aug 03, 2021@15:08:29
;;1.0;TEXT INTEGRATION UTILITIES;**290,338**;Jun 20, 1997;Build 9
;
; DBIA 10003 ^%DT
; DBIA 10086 ^%ZIS
; DBIA 10089 ^%ZISC
; DBIA 10063 ^%ZTLOAD
; DBIA 10006 ^DIC
; DBIA 2056 $$GET1^DIQ
; DBIA 10026 ^DIR
; DBIA 10060 ^VA(200,
; DBIA 10090 ^DIC(4
; DBIA 10040 ^SC(
; DBIA 10103 $$NOW^XLFDT
;
Q
;
EN ;Start of Copy/Paste Tracking Report
;IOF is global variable
N CLIN,CLN,DIC,DIR,DIROUT,DIRUT,DIV,DTOUT,DUOUT,DV,EDT,EXIT,ICNT,PAT
N PRV,PROV,SDT,SPRSTXT,SRC,SRT,STP,X,Y,%DT
I '$$VIEW^TIUCOP(DUZ,"",DUZ(2)) D Q
. W !!,"YOU MUST BELONG TO A SPECIAL USERCLASS TO ACCESS THIS OPTION.",!!
. HANG 5
. W @IOF
. Q
D SCRNHDR
N CLINEXT,CLINLP,DIVEXT,DIVLP,EDTEXT,EDTLP,EXTALL,OEDT,OSDT,PROVEXT
N PROVLP,RNRPT,SDTEXT,SDTLP,SRCEXT,SRCLP
S (OEDT,OSDT)=""
S (EXTALL,RNRPT,SDTEXT,SDTLP)=0
F SDTLP=1:1 Q:SDTEXT=1 Q:EXTALL D
. S SDT=""
. D SDT(.SDT,.SDTEXT,.EXTALL,OSDT)
. I SDT="",SDTEXT=0,EXTALL=0 S EXTALL=1
. I (SDTEXT=1)!(EXTALL=1) Q
. S OSDT=SDT
. S (EDTEXT,EDTLP)=0
. F EDTLP=1:1 Q:RNRPT=1 Q:EDTEXT=1 Q:EXTALL D
.. S EDT=""
.. D EDT(.EDT,.EDTEXT,.EXTALL,.SDT,OEDT)
.. I EDT="",EDTEXT=0,EXTALL=0 S EDTEXT=1
.. I (EDTEXT=1)!(EXTALL=1) Q
.. S OEDT=EDT
.. K DIV
.. S DIV=""
.. S (DIVEXT,DIVLP)=0
.. F DIVLP=1:1 Q:RNRPT=1 Q:DIVEXT=1 Q:EXTALL D
... D DIV(.DIV,.DIVEXT,.EXTALL)
... I DIV="",DIVEXT=0,EXTALL=0 S DIVEXT=1
... I (DIVEXT=1)!(EXTALL=1) Q
... K CLIN
... S CLIN=""
... S (CLINEXT,CLINLP)=0
... F CLINLP=1:1 Q:RNRPT=1 Q:CLINEXT=1 Q:EXTALL D
.... D CLINIC(.CLIN,.CLINEXT,.EXTALL)
.... I CLIN="",CLINEXT=0,EXTALL=0 S CLINEXT=1
.... I (CLINEXT=1)!(EXTALL=1) Q
.... K PROV
.... S PROV=""
.... S (PROVEXT,PROVLP)=0
.... F PROVLP=1:1 Q:RNRPT=1 Q:PROVEXT=1 Q:EXTALL D
..... D PROVIDER(.PROV,.PROVEXT,.EXTALL)
..... I PROV="",PROVEXT=0,EXTALL=0 S PROVEXT=1
..... I (PROVEXT=1)!(EXTALL=1) Q
..... K SRC
..... S SRC=""
..... S (SRCEXT,SRCLP)=0
..... F SRCLP=1:1 Q:RNRPT=1 Q:SRCEXT=1 Q:EXTALL D
...... D SOURCE(.SRC,.SRCEXT,.EXTALL)
...... I SRC="",SRCEXT=0,EXTALL=0 S SRCEXT=1
...... I (SRCEXT=1)!(EXTALL=1) Q
...... S RNRPT=1
...... D PRINT(.CLIN,.DIV,DUZ,EDT,.PROV,SDT,SRC)
...... Q
..... Q
.... Q
... Q
.. Q
. S RNRPT=0
. W @IOF
. D SCRNHDR
. Q
Q
;
SDT(SDT,SDTEXT,EXTALL,OSDT) ;Start Date Prompt
N %DT,DTOUT,LP,SDTQ,X,Y
S SDTQ=0
F LP=1:1 Q:SDTQ Q:SDTEXT Q:EXTALL D
. S (%DT,%DT("A"),%DT(0),DTOUT,SDT,X,Y)=""
. S %DT="AEP"
. S %DT("A")="START DATE: "
. S %DT("B")=$S(OSDT'="":$$FMTE^XLFDT(OSDT,5),1:"")
. S %DT(0)="-NOW"
. D ^%DT
. I ($G(DTOUT))!(X="")!(X["^") S EXTALL=1 Q
. I Y=-1 Q
. S SDT=Y
. S SDTQ=1
. Q
Q
;
EDT(EDT,EDTEXT,EXTALL,SDT,OEDT) ;End Date Prompt
N %DT,DTOUT,LP,EDTQ,X,Y
S EDTQ=0
F LP=1:1 Q:EDTQ Q:EDTEXT Q:EXTALL D
. S (%DT,%DT("A"),%DT(0),DTOUT,EDT,X,Y)=""
. S %DT="AEP"
. S %DT("A")="END DATE: "
. S %DT("B")=$S(OEDT'="":$$FMTE^XLFDT(OEDT,5),1:"")
. S %DT(0)="-NOW"
. D ^%DT
. I ($G(DTOUT))!(X="") S EDTEXT=1 Q
. I X["^" S EXTALL=1 Q
. I Y=-1 Q
. S EDT=Y
. S EDTQ=1
. I EDT<SDT D
.. S EDT=SDT
.. S SDT=Y
.. Q
. Q
Q
;
DIV(DIV,DIVEXT,EXTALL) ;Select Division
N DIC,DIVIEN,DIVIENS,DIVNM,DIVQ,DTOUT,DUOUT,LP,LP1,LP1Q,X,Y
S DIVQ=0
F LP=1:1 Q:DIVQ Q:DIVEXT Q:EXTALL D
. ;W !!,"Enter ""^L"" at the Select Division prompt to view previously selected divisions."
. S LP1Q=0
. F LP1=1:1 Q:DIVQ Q:DIVEXT Q:EXTALL Q:LP1Q D
.. K DTOUT,DUOUT,X,Y
.. S DIC=4,DIC("A")="Select Division: ",DIC(0)="AEQM" D ^DIC K DIC
.. ;I X="^L" D DIVLIST(.DIV) S LP1Q=1 Q
.. I $G(DTOUT) S DIVEXT=1 Q
.. I $G(DUOUT) S EXTALL=1 Q
.. I DIV>0,X="" S DIVQ=1 Q
.. I X="" S DIV=0,DIVQ=1 Q
.. I +Y<1 Q
.. S DIV=+DIV+1
.. S DIVIEN=+$P(Y,U,1)
.. S DIVIENS=DIVIEN_","
.. S DIVNM=$P(Y,U,2)
.. S DIV(DIVIEN)=DIVNM
.. S DIV("B",DIVNM,DIVIEN)=$$GET1^DIQ(4,DIVIENS,99)
.. Q
. Q
Q
;
CLINIC(CLIN,CLINEXT,EXTALL) ;Select clinic to return results
N DIC,DTOUT,DUOUT,CLINQ,CLNIEN,CLNNM,LP,LP1,LP1Q,X,Y
S CLINQ=0
F LP=1:1 Q:CLINQ Q:CLINEXT Q:EXTALL D
. ;W !!,"Enter ""^L"" at the Select Location prompt to view previously selected locations."
. S LP1Q=0
. F LP1=1:1 Q:CLINQ Q:CLINEXT Q:EXTALL Q:LP1Q D
.. K DTOUT,DUOUT,X,Y
.. S DIC=44,DIC("A")="Select Location: ",DIC(0)="AEQM" D ^DIC K DIC
.. ;I X="^L" D CLNLIST(.CLIN) S LP1Q=1 Q
.. I $G(DTOUT) S CLINEXT=1 Q
.. I $G(DUOUT) S EXTALL=1 Q
.. I CLIN>0,X="" S CLINQ=1 Q
.. I X="" S CLIN=0,CLINQ=1 Q
.. I +Y<1 Q
.. S CLIN=CLIN+1
.. S CLNIEN=+$P(Y,U,1)
.. S CLNNM=$P(Y,U,2)
.. S CLIN(CLNIEN)=CLNNM
.. S CLIN("B",CLNNM,CLNIEN)=""
.. Q
. Q
Q
;
PROVIDER(PROV,PROVEXT,EXTALL) ;Select provider to return results
N DIC,DTOUT,DUOUT,LP,LP1,LP1Q,PROVQ,PRVIEN,PRVNM,X,Y
S PROVQ=0
F LP=1:1 Q:PROVQ Q:PROVEXT Q:EXTALL D
. ;W !!,"Enter ""^L"" at the Select Provider prompt to view previously selected providers."
. S LP1Q=0
. F LP1=1:1 Q:PROVQ Q:PROVEXT Q:EXTALL Q:LP1Q D
.. K DTOUT,DUOUT,X,Y
.. S DIC=200,DIC("A")="Select Provider: ",DIC(0)="AEQM" D ^DIC K DIC
.. ;I X="^L" D PRVLIST(.PROV) S LP1Q=1 Q
.. I $G(DTOUT) S PROVEXT=1 Q
.. I $G(DUOUT) S EXTALL=1 Q
.. I PROV>0,X="" S PROVQ=1 Q
.. I X="" S PROV=0,PROVQ=1 Q
.. I +Y<1 Q
.. S PROV=PROV+1
.. S PRVIEN=+$P(Y,U,1)
.. S PRVNM=$P(Y,U,2)
.. S PROV(PRVIEN)=PRVNM
.. S PROV("B",PRVNM,PRVIEN)=""
.. Q
. Q
Q
;
SOURCE(SRC,SRCEXT,EXTALL) ;Select Source of pasted text
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
S SRC=""
W !!,"Select T, C, O, X, E, or any combination of these as the source."
W !,"Type ? for more information."
S DIR(0)="FAOr^1:5^K:$L($TR(X,""TCOXE"","""")) X"
S DIR("?")=" E: EVERYTHING ELSE"
S DIR("?",1)="Enter 1 to 5 characters representing the copy from source(s)"
S DIR("?",2)="you want included in the report. Each character represents"
S DIR("?",3)="one source to be included. To include all sources you would"
S DIR("?",4)="include every choice, such as TCOXE."
S DIR("?",5)=""
S DIR("?",6)="Available choices:"
S DIR("?",7)=" T: TIU DOCUMENTS C: REQUEST/CONSULTATIONS"
S DIR("?",8)=" O: ORDERS X: OUTSIDE OF CPRS"
S DIR("A")="Select Source: "
S DIR("B")="TCOXE"
D ^DIR I $G(DTOUT) S SRCEXT=1 Q
I ($G(DUOUT))!($G(DIROUT)) S EXTALL=1 Q
S SRC=Y
Q
;
DIVLIST(DIV) ;List previously selected divisions
I DIV=0 D Q
. W !!," No divisions have been selected"
. HANG 2
. W !!
. Q
N DIVCNT,DIVNM,DIVIEN
W !!,"Selected Divisions ("_+DIV_"):"
S DIVNM=""
F S DIVNM=$O(DIV("B",DIVNM)) Q:DIVNM="" D
. S DIVIEN=0
. F S DIVIEN=$O(DIV("B",DIVNM,DIVIEN)) Q:DIVIEN="" D
.. W !," "_DIVIEN_$E(" ",1,(12-$L(DIVIEN)))_DIVNM_" ("_$G(DIV("B",DIVNM,DIVIEN))_")"
.. Q
. Q
HANG 2
W !!
Q
;
CLNLIST(CLIN) ;List previously selected hospital locations
I CLIN=0 D Q
. W !!," No clinics have been selected"
. HANG 2
. W !!
. Q
N CLINCNT,CLINNM,CLINIEN
W !!,"Selected Locations ("_+CLIN_"):"
S CLINNM=""
F S CLINNM=$O(CLIN("B",CLINNM)) Q:CLINNM="" D
. S CLINIEN=0
. F S CLINIEN=$O(CLIN("B",CLINNM,CLINIEN)) Q:CLINIEN="" D
.. W !," "_CLINIEN_$E(" ",1,(12-$L(CLINIEN)))_CLINNM
.. Q
. Q
HANG 2
W !!
Q
;
PRVLIST(PROV) ;List previously selected providers
I PROV=0 D Q
. W !!," No providers have been selected"
. HANG 2
. W !!
. Q
N PROVCNT,PROVNM,PROVIEN
W !!,"Selected Providers ("_+PROV_"):"
S PROVNM=""
F S PROVNM=$O(PROV("B",PROVNM)) Q:PROVNM="" D
. S PROVIEN=0
. F S PROVIEN=$O(PROV("B",PROVNM,PROVIEN)) Q:PROVIEN="" D
.. W !," "_PROVIEN_$E(" ",1,(12-$L(PROVIEN)))_PROVNM
.. Q
. Q
HANG 2
W !!
Q
;
PRINT(CLIN,DIV,DUZ,EDT,PROV,SDT,SRC) ;Print the selected report
;IOF are global variable
N %A,%E,%H,%I,%T,%X,%Y,%ZIS,IOP,POP,QUEUE,RUNDT
S RUNDT=$$NOW^XLFDT
W !!,"This report may take a considerable amount of time to complete."
;W !,"It is HIGHLY recommended to queue this report!!!"
W !!,"This report requires 255 character width output."
S %ZIS="MQ"
;S IOP="Q"
D ^%ZIS Q:POP
S QUEUE=0
;QUEUE
I $D(IO("Q")) D Q
. S QUEUE=1
. D QUE
. Q
;NOQUEUE
D NOQUE(.CLIN,.DIV,DUZ,EDT,.PROV,RUNDT,SDT,SRC)
Q
;
QUE ;Queue output
;ION is a global variable
;Variables CLIN,DIV,DUZ,EDT,PROV,RUNDT,SDT,SRC,ZTDESC,ZTRTN are expected to exist
N %,IOP,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
F %="SDT","EDT","PROV","PROV(","CLIN","CLIN(","DIV","DIV(","SRC","DUZ","RUNDT","QUEUE" S ZTSAVE(%)=""
S ZTRTN="DETAILQ^TIUCOPR1"
S ZTDESC="COPY/PASTE TRACKING REPORT" S ZTIO=ION
D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued! Task #"_ZTSK_".",1:"Request Cancelled!")
K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE D ^%ZISC
S IOP="HOME" D ^%ZIS
Q
;
NOQUE(CLIN,DIV,DUZ,EDT,PROV,RUNDT,SDT,SRC) ;Directly run report
D DETAIL^TIUCOPR1(.CLIN,.DIV,DUZ,EDT,.PROV,RUNDT,SDT,SRC)
D ^%ZISC
Q
;
SCRNHDR ;Report screen header
;IOF,IOM are global variables
N SCRTTL
S SCRTTL="COPY/PASTE TRACKING REPORT"
W @IOF
W ?(IOM-$L(SCRTTL)/2),SCRTTL,!!!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUCOPR 9251 printed Dec 13, 2024@02:39:23 Page 2
TIUCOPR ;SLC/TDP - Copy/Paste Report ;Aug 03, 2021@15:08:29
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**290,338**;Jun 20, 1997;Build 9
+2 ;
+3 ; DBIA 10003 ^%DT
+4 ; DBIA 10086 ^%ZIS
+5 ; DBIA 10089 ^%ZISC
+6 ; DBIA 10063 ^%ZTLOAD
+7 ; DBIA 10006 ^DIC
+8 ; DBIA 2056 $$GET1^DIQ
+9 ; DBIA 10026 ^DIR
+10 ; DBIA 10060 ^VA(200,
+11 ; DBIA 10090 ^DIC(4
+12 ; DBIA 10040 ^SC(
+13 ; DBIA 10103 $$NOW^XLFDT
+14 ;
+15 QUIT
+16 ;
EN ;Start of Copy/Paste Tracking Report
+1 ;IOF is global variable
+2 NEW CLIN,CLN,DIC,DIR,DIROUT,DIRUT,DIV,DTOUT,DUOUT,DV,EDT,EXIT,ICNT,PAT
+3 NEW PRV,PROV,SDT,SPRSTXT,SRC,SRT,STP,X,Y,%DT
+4 IF '$$VIEW^TIUCOP(DUZ,"",DUZ(2))
Begin DoDot:1
+5 WRITE !!,"YOU MUST BELONG TO A SPECIAL USERCLASS TO ACCESS THIS OPTION.",!!
+6 HANG 5
+7 WRITE @IOF
+8 QUIT
End DoDot:1
QUIT
+9 DO SCRNHDR
+10 NEW CLINEXT,CLINLP,DIVEXT,DIVLP,EDTEXT,EDTLP,EXTALL,OEDT,OSDT,PROVEXT
+11 NEW PROVLP,RNRPT,SDTEXT,SDTLP,SRCEXT,SRCLP
+12 SET (OEDT,OSDT)=""
+13 SET (EXTALL,RNRPT,SDTEXT,SDTLP)=0
+14 FOR SDTLP=1:1
if SDTEXT=1
QUIT
if EXTALL
QUIT
Begin DoDot:1
+15 SET SDT=""
+16 DO SDT(.SDT,.SDTEXT,.EXTALL,OSDT)
+17 IF SDT=""
IF SDTEXT=0
IF EXTALL=0
SET EXTALL=1
+18 IF (SDTEXT=1)!(EXTALL=1)
QUIT
+19 SET OSDT=SDT
+20 SET (EDTEXT,EDTLP)=0
+21 FOR EDTLP=1:1
if RNRPT=1
QUIT
if EDTEXT=1
QUIT
if EXTALL
QUIT
Begin DoDot:2
+22 SET EDT=""
+23 DO EDT(.EDT,.EDTEXT,.EXTALL,.SDT,OEDT)
+24 IF EDT=""
IF EDTEXT=0
IF EXTALL=0
SET EDTEXT=1
+25 IF (EDTEXT=1)!(EXTALL=1)
QUIT
+26 SET OEDT=EDT
+27 KILL DIV
+28 SET DIV=""
+29 SET (DIVEXT,DIVLP)=0
+30 FOR DIVLP=1:1
if RNRPT=1
QUIT
if DIVEXT=1
QUIT
if EXTALL
QUIT
Begin DoDot:3
+31 DO DIV(.DIV,.DIVEXT,.EXTALL)
+32 IF DIV=""
IF DIVEXT=0
IF EXTALL=0
SET DIVEXT=1
+33 IF (DIVEXT=1)!(EXTALL=1)
QUIT
+34 KILL CLIN
+35 SET CLIN=""
+36 SET (CLINEXT,CLINLP)=0
+37 FOR CLINLP=1:1
if RNRPT=1
QUIT
if CLINEXT=1
QUIT
if EXTALL
QUIT
Begin DoDot:4
+38 DO CLINIC(.CLIN,.CLINEXT,.EXTALL)
+39 IF CLIN=""
IF CLINEXT=0
IF EXTALL=0
SET CLINEXT=1
+40 IF (CLINEXT=1)!(EXTALL=1)
QUIT
+41 KILL PROV
+42 SET PROV=""
+43 SET (PROVEXT,PROVLP)=0
+44 FOR PROVLP=1:1
if RNRPT=1
QUIT
if PROVEXT=1
QUIT
if EXTALL
QUIT
Begin DoDot:5
+45 DO PROVIDER(.PROV,.PROVEXT,.EXTALL)
+46 IF PROV=""
IF PROVEXT=0
IF EXTALL=0
SET PROVEXT=1
+47 IF (PROVEXT=1)!(EXTALL=1)
QUIT
+48 KILL SRC
+49 SET SRC=""
+50 SET (SRCEXT,SRCLP)=0
+51 FOR SRCLP=1:1
if RNRPT=1
QUIT
if SRCEXT=1
QUIT
if EXTALL
QUIT
Begin DoDot:6
+52 DO SOURCE(.SRC,.SRCEXT,.EXTALL)
+53 IF SRC=""
IF SRCEXT=0
IF EXTALL=0
SET SRCEXT=1
+54 IF (SRCEXT=1)!(EXTALL=1)
QUIT
+55 SET RNRPT=1
+56 DO PRINT(.CLIN,.DIV,DUZ,EDT,.PROV,SDT,SRC)
+57 QUIT
End DoDot:6
+58 QUIT
End DoDot:5
+59 QUIT
End DoDot:4
+60 QUIT
End DoDot:3
+61 QUIT
End DoDot:2
+62 SET RNRPT=0
+63 WRITE @IOF
+64 DO SCRNHDR
+65 QUIT
End DoDot:1
+66 QUIT
+67 ;
SDT(SDT,SDTEXT,EXTALL,OSDT) ;Start Date Prompt
+1 NEW %DT,DTOUT,LP,SDTQ,X,Y
+2 SET SDTQ=0
+3 FOR LP=1:1
if SDTQ
QUIT
if SDTEXT
QUIT
if EXTALL
QUIT
Begin DoDot:1
+4 SET (%DT,%DT("A"),%DT(0),DTOUT,SDT,X,Y)=""
+5 SET %DT="AEP"
+6 SET %DT("A")="START DATE: "
+7 SET %DT("B")=$SELECT(OSDT'="":$$FMTE^XLFDT(OSDT,5),1:"")
+8 SET %DT(0)="-NOW"
+9 DO ^%DT
+10 IF ($GET(DTOUT))!(X="")!(X["^")
SET EXTALL=1
QUIT
+11 IF Y=-1
QUIT
+12 SET SDT=Y
+13 SET SDTQ=1
+14 QUIT
End DoDot:1
+15 QUIT
+16 ;
EDT(EDT,EDTEXT,EXTALL,SDT,OEDT) ;End Date Prompt
+1 NEW %DT,DTOUT,LP,EDTQ,X,Y
+2 SET EDTQ=0
+3 FOR LP=1:1
if EDTQ
QUIT
if EDTEXT
QUIT
if EXTALL
QUIT
Begin DoDot:1
+4 SET (%DT,%DT("A"),%DT(0),DTOUT,EDT,X,Y)=""
+5 SET %DT="AEP"
+6 SET %DT("A")="END DATE: "
+7 SET %DT("B")=$SELECT(OEDT'="":$$FMTE^XLFDT(OEDT,5),1:"")
+8 SET %DT(0)="-NOW"
+9 DO ^%DT
+10 IF ($GET(DTOUT))!(X="")
SET EDTEXT=1
QUIT
+11 IF X["^"
SET EXTALL=1
QUIT
+12 IF Y=-1
QUIT
+13 SET EDT=Y
+14 SET EDTQ=1
+15 IF EDT<SDT
Begin DoDot:2
+16 SET EDT=SDT
+17 SET SDT=Y
+18 QUIT
End DoDot:2
+19 QUIT
End DoDot:1
+20 QUIT
+21 ;
DIV(DIV,DIVEXT,EXTALL) ;Select Division
+1 NEW DIC,DIVIEN,DIVIENS,DIVNM,DIVQ,DTOUT,DUOUT,LP,LP1,LP1Q,X,Y
+2 SET DIVQ=0
+3 FOR LP=1:1
if DIVQ
QUIT
if DIVEXT
QUIT
if EXTALL
QUIT
Begin DoDot:1
+4 ;W !!,"Enter ""^L"" at the Select Division prompt to view previously selected divisions."
+5 SET LP1Q=0
+6 FOR LP1=1:1
if DIVQ
QUIT
if DIVEXT
QUIT
if EXTALL
QUIT
if LP1Q
QUIT
Begin DoDot:2
+7 KILL DTOUT,DUOUT,X,Y
+8 SET DIC=4
SET DIC("A")="Select Division: "
SET DIC(0)="AEQM"
DO ^DIC
KILL DIC
+9 ;I X="^L" D DIVLIST(.DIV) S LP1Q=1 Q
+10 IF $GET(DTOUT)
SET DIVEXT=1
QUIT
+11 IF $GET(DUOUT)
SET EXTALL=1
QUIT
+12 IF DIV>0
IF X=""
SET DIVQ=1
QUIT
+13 IF X=""
SET DIV=0
SET DIVQ=1
QUIT
+14 IF +Y<1
QUIT
+15 SET DIV=+DIV+1
+16 SET DIVIEN=+$PIECE(Y,U,1)
+17 SET DIVIENS=DIVIEN_","
+18 SET DIVNM=$PIECE(Y,U,2)
+19 SET DIV(DIVIEN)=DIVNM
+20 SET DIV("B",DIVNM,DIVIEN)=$$GET1^DIQ(4,DIVIENS,99)
+21 QUIT
End DoDot:2
+22 QUIT
End DoDot:1
+23 QUIT
+24 ;
CLINIC(CLIN,CLINEXT,EXTALL) ;Select clinic to return results
+1 NEW DIC,DTOUT,DUOUT,CLINQ,CLNIEN,CLNNM,LP,LP1,LP1Q,X,Y
+2 SET CLINQ=0
+3 FOR LP=1:1
if CLINQ
QUIT
if CLINEXT
QUIT
if EXTALL
QUIT
Begin DoDot:1
+4 ;W !!,"Enter ""^L"" at the Select Location prompt to view previously selected locations."
+5 SET LP1Q=0
+6 FOR LP1=1:1
if CLINQ
QUIT
if CLINEXT
QUIT
if EXTALL
QUIT
if LP1Q
QUIT
Begin DoDot:2
+7 KILL DTOUT,DUOUT,X,Y
+8 SET DIC=44
SET DIC("A")="Select Location: "
SET DIC(0)="AEQM"
DO ^DIC
KILL DIC
+9 ;I X="^L" D CLNLIST(.CLIN) S LP1Q=1 Q
+10 IF $GET(DTOUT)
SET CLINEXT=1
QUIT
+11 IF $GET(DUOUT)
SET EXTALL=1
QUIT
+12 IF CLIN>0
IF X=""
SET CLINQ=1
QUIT
+13 IF X=""
SET CLIN=0
SET CLINQ=1
QUIT
+14 IF +Y<1
QUIT
+15 SET CLIN=CLIN+1
+16 SET CLNIEN=+$PIECE(Y,U,1)
+17 SET CLNNM=$PIECE(Y,U,2)
+18 SET CLIN(CLNIEN)=CLNNM
+19 SET CLIN("B",CLNNM,CLNIEN)=""
+20 QUIT
End DoDot:2
+21 QUIT
End DoDot:1
+22 QUIT
+23 ;
PROVIDER(PROV,PROVEXT,EXTALL) ;Select provider to return results
+1 NEW DIC,DTOUT,DUOUT,LP,LP1,LP1Q,PROVQ,PRVIEN,PRVNM,X,Y
+2 SET PROVQ=0
+3 FOR LP=1:1
if PROVQ
QUIT
if PROVEXT
QUIT
if EXTALL
QUIT
Begin DoDot:1
+4 ;W !!,"Enter ""^L"" at the Select Provider prompt to view previously selected providers."
+5 SET LP1Q=0
+6 FOR LP1=1:1
if PROVQ
QUIT
if PROVEXT
QUIT
if EXTALL
QUIT
if LP1Q
QUIT
Begin DoDot:2
+7 KILL DTOUT,DUOUT,X,Y
+8 SET DIC=200
SET DIC("A")="Select Provider: "
SET DIC(0)="AEQM"
DO ^DIC
KILL DIC
+9 ;I X="^L" D PRVLIST(.PROV) S LP1Q=1 Q
+10 IF $GET(DTOUT)
SET PROVEXT=1
QUIT
+11 IF $GET(DUOUT)
SET EXTALL=1
QUIT
+12 IF PROV>0
IF X=""
SET PROVQ=1
QUIT
+13 IF X=""
SET PROV=0
SET PROVQ=1
QUIT
+14 IF +Y<1
QUIT
+15 SET PROV=PROV+1
+16 SET PRVIEN=+$PIECE(Y,U,1)
+17 SET PRVNM=$PIECE(Y,U,2)
+18 SET PROV(PRVIEN)=PRVNM
+19 SET PROV("B",PRVNM,PRVIEN)=""
+20 QUIT
End DoDot:2
+21 QUIT
End DoDot:1
+22 QUIT
+23 ;
SOURCE(SRC,SRCEXT,EXTALL) ;Select Source of pasted text
+1 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+2 SET SRC=""
+3 WRITE !!,"Select T, C, O, X, E, or any combination of these as the source."
+4 WRITE !,"Type ? for more information."
+5 SET DIR(0)="FAOr^1:5^K:$L($TR(X,""TCOXE"","""")) X"
+6 SET DIR("?")=" E: EVERYTHING ELSE"
+7 SET DIR("?",1)="Enter 1 to 5 characters representing the copy from source(s)"
+8 SET DIR("?",2)="you want included in the report. Each character represents"
+9 SET DIR("?",3)="one source to be included. To include all sources you would"
+10 SET DIR("?",4)="include every choice, such as TCOXE."
+11 SET DIR("?",5)=""
+12 SET DIR("?",6)="Available choices:"
+13 SET DIR("?",7)=" T: TIU DOCUMENTS C: REQUEST/CONSULTATIONS"
+14 SET DIR("?",8)=" O: ORDERS X: OUTSIDE OF CPRS"
+15 SET DIR("A")="Select Source: "
+16 SET DIR("B")="TCOXE"
+17 DO ^DIR
IF $GET(DTOUT)
SET SRCEXT=1
QUIT
+18 IF ($GET(DUOUT))!($GET(DIROUT))
SET EXTALL=1
QUIT
+19 SET SRC=Y
+20 QUIT
+21 ;
DIVLIST(DIV) ;List previously selected divisions
+1 IF DIV=0
Begin DoDot:1
+2 WRITE !!," No divisions have been selected"
+3 HANG 2
+4 WRITE !!
+5 QUIT
End DoDot:1
QUIT
+6 NEW DIVCNT,DIVNM,DIVIEN
+7 WRITE !!,"Selected Divisions ("_+DIV_"):"
+8 SET DIVNM=""
+9 FOR
SET DIVNM=$ORDER(DIV("B",DIVNM))
if DIVNM=""
QUIT
Begin DoDot:1
+10 SET DIVIEN=0
+11 FOR
SET DIVIEN=$ORDER(DIV("B",DIVNM,DIVIEN))
if DIVIEN=""
QUIT
Begin DoDot:2
+12 WRITE !," "_DIVIEN_$EXTRACT(" ",1,(12-$LENGTH(DIVIEN)))_DIVNM_" ("_$GET(DIV("B",DIVNM,DIVIEN))_")"
+13 QUIT
End DoDot:2
+14 QUIT
End DoDot:1
+15 HANG 2
+16 WRITE !!
+17 QUIT
+18 ;
CLNLIST(CLIN) ;List previously selected hospital locations
+1 IF CLIN=0
Begin DoDot:1
+2 WRITE !!," No clinics have been selected"
+3 HANG 2
+4 WRITE !!
+5 QUIT
End DoDot:1
QUIT
+6 NEW CLINCNT,CLINNM,CLINIEN
+7 WRITE !!,"Selected Locations ("_+CLIN_"):"
+8 SET CLINNM=""
+9 FOR
SET CLINNM=$ORDER(CLIN("B",CLINNM))
if CLINNM=""
QUIT
Begin DoDot:1
+10 SET CLINIEN=0
+11 FOR
SET CLINIEN=$ORDER(CLIN("B",CLINNM,CLINIEN))
if CLINIEN=""
QUIT
Begin DoDot:2
+12 WRITE !," "_CLINIEN_$EXTRACT(" ",1,(12-$LENGTH(CLINIEN)))_CLINNM
+13 QUIT
End DoDot:2
+14 QUIT
End DoDot:1
+15 HANG 2
+16 WRITE !!
+17 QUIT
+18 ;
PRVLIST(PROV) ;List previously selected providers
+1 IF PROV=0
Begin DoDot:1
+2 WRITE !!," No providers have been selected"
+3 HANG 2
+4 WRITE !!
+5 QUIT
End DoDot:1
QUIT
+6 NEW PROVCNT,PROVNM,PROVIEN
+7 WRITE !!,"Selected Providers ("_+PROV_"):"
+8 SET PROVNM=""
+9 FOR
SET PROVNM=$ORDER(PROV("B",PROVNM))
if PROVNM=""
QUIT
Begin DoDot:1
+10 SET PROVIEN=0
+11 FOR
SET PROVIEN=$ORDER(PROV("B",PROVNM,PROVIEN))
if PROVIEN=""
QUIT
Begin DoDot:2
+12 WRITE !," "_PROVIEN_$EXTRACT(" ",1,(12-$LENGTH(PROVIEN)))_PROVNM
+13 QUIT
End DoDot:2
+14 QUIT
End DoDot:1
+15 HANG 2
+16 WRITE !!
+17 QUIT
+18 ;
PRINT(CLIN,DIV,DUZ,EDT,PROV,SDT,SRC) ;Print the selected report
+1 ;IOF are global variable
+2 NEW %A,%E,%H,%I,%T,%X,%Y,%ZIS,IOP,POP,QUEUE,RUNDT
+3 SET RUNDT=$$NOW^XLFDT
+4 WRITE !!,"This report may take a considerable amount of time to complete."
+5 ;W !,"It is HIGHLY recommended to queue this report!!!"
+6 WRITE !!,"This report requires 255 character width output."
+7 SET %ZIS="MQ"
+8 ;S IOP="Q"
+9 DO ^%ZIS
if POP
QUIT
+10 SET QUEUE=0
+11 ;QUEUE
+12 IF $DATA(IO("Q"))
Begin DoDot:1
+13 SET QUEUE=1
+14 DO QUE
+15 QUIT
End DoDot:1
QUIT
+16 ;NOQUEUE
+17 DO NOQUE(.CLIN,.DIV,DUZ,EDT,.PROV,RUNDT,SDT,SRC)
+18 QUIT
+19 ;
QUE ;Queue output
+1 ;ION is a global variable
+2 ;Variables CLIN,DIV,DUZ,EDT,PROV,RUNDT,SDT,SRC,ZTDESC,ZTRTN are expected to exist
+3 NEW %,IOP,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
+4 FOR %="SDT","EDT","PROV","PROV(","CLIN","CLIN(","DIV","DIV(","SRC","DUZ","RUNDT","QUEUE"
SET ZTSAVE(%)=""
+5 SET ZTRTN="DETAILQ^TIUCOPR1"
+6 SET ZTDESC="COPY/PASTE TRACKING REPORT"
SET ZTIO=ION
+7 DO ^%ZTLOAD
WRITE !,$SELECT($DATA(ZTSK):"Request Queued! Task #"_ZTSK_".",1:"Request Cancelled!")
+8 KILL ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
DO ^%ZISC
+9 SET IOP="HOME"
DO ^%ZIS
+10 QUIT
+11 ;
NOQUE(CLIN,DIV,DUZ,EDT,PROV,RUNDT,SDT,SRC) ;Directly run report
+1 DO DETAIL^TIUCOPR1(.CLIN,.DIV,DUZ,EDT,.PROV,RUNDT,SDT,SRC)
+2 DO ^%ZISC
+3 QUIT
+4 ;
SCRNHDR ;Report screen header
+1 ;IOF,IOM are global variables
+2 NEW SCRTTL
+3 SET SCRTTL="COPY/PASTE TRACKING REPORT"
+4 WRITE @IOF
+5 WRITE ?(IOM-$LENGTH(SCRTTL)/2),SCRTTL,!!!
+6 QUIT