SCRPW81 ; ALB/SCK - SCDX AMB CARE CLOSEOUT RPT FOR MT INDICATOR = U ; 9 JULY 2003
;;5.3;Scheduling;**302,440,474**;AUG 13, 1993;Build 4
;
EN ; Main entry point for report
N DIR,DIRUT,SDBEG,SDEND,RSLT,Y,X
;
S DIR("A")="Please select fiscal year",DIR(0)="SM^A:Previous Fiscal Year;B:Current Fiscal Year;O:Other Date Range"
S DIR("B")="B"
S DIR("?")="You may select either the previous fiscal year (A) or the current fiscal year (B). Select (O) if you choose to specify your own date range."
D ^DIR K DIR
Q:$D(DIRUT)
S RSLT=Y
;
I RSLT="A" D
. D PASTYR(.SDBEG,.SDEND)
E I RSLT="B" D
. D CURYR(.SDBEG,.SDEND)
E D
. D GETDT(.SDBEG,.SDEND)
Q:'$G(SDBEG)!('$G(SDEND))
W !!?3,"Date Range: "_$$FMTE^XLFDT(SDBEG)_" to "_$$FMTE^XLFDT(SDEND)
;
N X,Y,IORVON,IORVOFF
S X="IORVON;IORVOFF"
D ENDR^%ZISS
W:$D(IORVON) IORVON
W !,"A 132-Column printer is required for this report."
W !,"This report will NOT print correctly to the screen!"
W:$D(IORVOFF) IORVOFF
;
N ZTSAVE,ZTRTN,ZTDESC,POP,%ZIS
S %ZIS="Q" D ^%ZIS G:POP EXIT
I $D(IO("Q")) D Q
. S ZTSAVE("SDBEG")="",ZTSAVE("SDEND")="",ZTSAVE("DUZ")=""
. S ZTRTN="RUN^SCRPW81"
. S ZTDESC="XMITED OE MT=U RPT"
. D ^%ZTLOAD D HOME^%ZIS K IO("Q")
D RUN
D ^%ZISC
EXIT S:$D(ZTQUEUED) ZTREQ="@" Q
;
RUN ; Run report
U IO
K ^TMP("SCDX MTU",$J),^TMP("SCDX ASORT",$J)
;
D BLD(SDBEG,SDEND)
D CHKMT
D SRTNAME
D MAIL
D PRINT
K ^TMP("SCDX MTU",$J),^TMP("SCDX ASORT",$J)
Q
;
PASTYR(SDBEG,SDEND) ; Set dates for previous fiscal year
N CURYR,PRVYR,CURMN,%I
;
D NOW^%DTC
S CURYR=%I(3),CURMN=%I(1)
I CURMN>9 D
. S CURYR=CURYR+1
S PRVYR=CURYR-1
S SDEND=$$FMADD^XLFDT(PRVYR_"1001",-1)
S SDBEG=$$FMADD^XLFDT(PRVYR_"1001",-365)
Q
;
CURYR(SDBEG,SDEND) ; Set dates for current fiscal year
N CURYR,CURMN,%I
;
D NOW^%DTC
S CURYR=%I(3),CURMN=%I(1)
I CURMN<10 D
. S CURYR=CURYR-1
S SDBEG=CURYR_"1001"
S SDEND=$P($$NOW^XLFDT,".")
Q
;
GETDT(SDBEG,SDEND) ; Get beginning and ending date for search
; Output SDBEG Beginning for date range
; SDEND End of date range
; result 1 - If function successful
; 0 - If function NOT successful (User quit)
;
N DIR,DIRUT,Y
;
W !!?3,"You have selected to specify your own date range. Please note that by"
W !?3,"doing so you may not generate an accurate picture of the AMB CARE"
W !?3,"closeouts where the means test indicator equals 'U'.",!
;
S DIR(0)="DAO^:DT:EX"
S DIR("A")="Beginning Date: "
S DIR("?")="^D HELP^%DTC"
D ^DIR
I $D(DIRUT) D Q
. S SDBEG=0
S SDBEG=Y
;
S DIR(0)="DAO^:DT:EX"
S DIR("A")="Ending Date: "
D ^DIR
I $D(DIRUT) D Q
. S SDEND=0
S SDEND=Y
Q
;
BLD(SDBEG,SDEND) ; Build list of patient OE's for date range
; Input SDBEG
; SDEND
;
N SDX,SDMAX,SDOEI,CNT,NODE,SDOEX,SDLOC
;
S SDX=$$FMADD^XLFDT(SDBEG,0,0,0,-1) ; set inital search DT to beginning date minus one second
S SDMAX=$$FMADD^XLFDT(SDEND,0,23,59,59) ; set search end date to end date plus one day
;
S ^TMP("SCDX MTU",$J,0,"BEGIN")=$H
F S SDX=$O(^SCE("B",SDX)) Q:'SDX D Q:SDX>SDMAX
. S SDOEI=0
. F S SDOEI=$O(^SCE("B",SDX,SDOEI)) Q:'SDOEI D
. . S NODE=$G(^SCE(SDOEI,0))
. . Q:$P(NODE,U,6)>0 ; Quit if not parent encounter
. . Q:$P(NODE,U,8)>3 ; Quit if Originating process is for credit stop code
. . S SDLOC=+$P(NODE,U,4)
. . Q:$$GET1^DIQ(44,SDLOC,2502,"I")="Y" ; Quit if non-count clinic
. . S SDOEX=$O(^SD(409.73,"AENC",SDOEI,0))
. . Q:'$P(NODE,U,2)
. . S ^TMP("SCDX MTU",$J,$P(NODE,U,2),SDOEI)=$P(NODE,U,1)_U_SDOEX
. . S ^TMP("SCDX MTU",$J,0,"CNT")=$G(^TMP("SCDX MTU",$J,0,"CNT"))+1
S ^TMP("SCDX MTU",$J,0,"END")=$H
Q
;
CHKMT ; Clean out all except those meeting the MT=U conditions
N DFN,SDOEI,SDOEDT,SDMT,SDO,SDR,SDN,SDAT,SDEC,SDMTI,SDMTT
;
S DFN=0
F S DFN=$O(^TMP("SCDX MTU",$J,DFN)) Q:'DFN D
. I '$D(^DGMT(408.31,"C",DFN)) D Q ; No MT Data, bypass patient
. . K ^TMP("SCDX MTU",$J,DFN)
. S (SDR,SDO,SDN,SDOEI)=0
. F S SDOEI=$O(^TMP("SCDX MTU",$J,DFN,SDOEI)) Q:'SDOEI D
. . S SDOEDT=$P($G(^TMP("SCDX MTU",$J,DFN,SDOEI)),U,1)
. . Q:'SDOEDT
. . S SDEC=$$GET1^DIQ(409.68,SDOEI,.13,"I")
. . S SDAT=$$GET1^DIQ(409.68,SDOEI,.1,"I")
. . S SDMTI=$$MTI^SCDXUTL0(DFN,SDOEDT,SDEC,SDAT,SDOEI)
. . I SDMTI'="U" D Q
. . . K ^TMP("SCDX MTU",$J,DFN)
. . S SDMTT=$$LST^DGMTU(DFN,SDOEDT,1) I $P(SDMTT,U,4)="N" D Q
. . . K ^TMP("SCDX MTU",$J,DFN)
. . S $P(^TMP("SCDX MTU",$J,DFN,SDOEI),U,4)=SDMTI
S ^TMP("SCDX MTU",$J,0,"END")=$H K SDMTT
Q
;
SRTNAME ; Sort remaining encounters by patient name and OE date
N DFN,SDOEI,SDNAME,SDOEDT
;
S DFN=0
F S DFN=$O(^TMP("SCDX MTU",$J,DFN)) Q:'DFN D
. S SDNAME=$$GET1^DIQ(2,DFN,.01)
. Q:SDNAME']""
. S ^TMP("SCDX MTU",$J,0,"PATNUM")=$G(^TMP("SCDX MTU",$J,0,"PATNUM"))+1
. S SDOEI=0
. F S SDOEI=$O(^TMP("SCDX MTU",$J,DFN,SDOEI)) Q:'SDOEI D
. . S SDOEDT=$P(^TMP("SCDX MTU",$J,DFN,SDOEI),U,1)
. . S ^TMP("SCDX ASORT",$J,SDNAME,SDOEDT)=$P(^TMP("SCDX MTU",$J,DFN,SDOEI),U,2)_U_SDOEI_U_DFN_U_$P(^TMP("SCDX MTU",$J,DFN,SDOEI),U,4)
. . S ^TMP("SCDX MTU",$J,0,"FINAL CNT")=$G(^TMP("SCDX MTU",$J,0,"FINAL CNT"))+1
S ^TMP("SCDX MTU",$J,0,"END2")=$H
Q
;
MAIL ; send message with report statistics
N MSG,XMSUB,XMY,XMTEXT,XMDUZ
;
S MSG(1)="Date Range for Report "_$$FMTE^XLFDT(SDBEG,2)_" to "_$$FMTE^XLFDT(SDEND,2)
S MSG(2)=""
S MSG(3)="Report Started "_$$HTE^XLFDT(^TMP("SCDX MTU",$J,0,"BEGIN"),2)
S MSG(4)="Report Finished "_$$HTE^XLFDT(^TMP("SCDX MTU",$J,0,"END2"),2)
S MSG(5)="Total Time for Report "_$$HDIFF^XLFDT(^TMP("SCDX MTU",$J,0,"END2"),^TMP("SCDX MTU",$J,0,"BEGIN"),3)
S MSG(6)=""
S MSG(7)="Outpatient Encounters Scanned "_$J($FN(+$G(^TMP("SCDX MTU",$J,0,"CNT")),","),20)
S MSG(8)="Outpatient Encounters Reported "_$J($FN(+$G(^TMP("SCDX MTU",$J,0,"FINAL CNT")),","),20)
S MSG(9)="Patient Count "_$J($FN(+$G(^TMP("SCDX MTU",$J,0,"PATNUM")),","),20)
;
S XMSUB="MEANS TEST = 'U' REPORT STATISTICS"
S XMTEXT="MSG("
S XMY(DUZ)=""
S XMDUZ="ACRP MT=U STATS"
D ^XMD
Q
;
PRINT ; Print Report
;SD*5.3*474 added SDFLAG and corresponding logic
N SDNAME,SDNODE,SDXNODE,SDOEI,SDOEX,SDOEDT,DFN,PRNTL4,VA,PAGE,SDFLAG
;
S PAGE=0
D HDR
S SDNAME=""
F S SDNAME=$O(^TMP("SCDX ASORT",$J,SDNAME)) Q:SDNAME']"" D
. W !,$E(SDNAME,1,30)
. S PRNTL4=0,SDFLAG=1
. S SDOEDT=0
. F S SDOEDT=$O(^TMP("SCDX ASORT",$J,SDNAME,SDOEDT)) Q:'SDOEDT D
. . S DFN=$P($G(^TMP("SCDX ASORT",$J,SDNAME,SDOEDT)),U,3)
. . S SDOEX=$P($G(^TMP("SCDX ASORT",$J,SDNAME,SDOEDT)),U,1)
. . S SDOEI=$P($G(^TMP("SCDX ASORT",$J,SDNAME,SDOEDT)),U,2)
. . I 'PRNTL4 D S PRNTL4=1
. . . D PID^VADPT6
. . . W ?($L(SDNAME)+1),"(",VA("BID"),")"
. . I 'SDFLAG D S SDFLAG=1
. . . W !,$E(SDNAME,1,30)
. . . D PID^VADPT6
. . . W ?($L(SDNAME)+1),"(",VA("BID"),")"
. . W ?35,$$FMTE^XLFDT(SDOEDT,"D"),$S(SDOEX>0:" *",1:" ")
. . W ?56,$P($G(^TMP("SCDX ASORT",$J,SDNAME,SDOEDT)),U,4)
. . S SDNODE=$G(^SCE(SDOEI,0))
. . W ?68,$E($$GET1^DIQ(40.8,$P(SDNODE,U,11),.01),1,30)
. . W ?100,$E($$GET1^DIQ(44,$P(SDNODE,U,4),.01),1,30)
. . I ($Y+5)>IOSL D HDR S SDFLAG=0 Q
. . W !
D FTR1
Q
;
HDR ; Report Header
N SPACE,LINE,TAB,PRNTLN
;
I PAGE>0 D FTR
W:PAGE>0 @IOF
S PAGE=PAGE+1
;
S PRNTLN="Transmitted Outpatient Encounters with Means Test = 'U'"
S TAB=(IOM-$L(PRNTLN))\2
W !?TAB,PRNTLN
S PRNTLN="Date Range: "_$$FMTE^XLFDT(SDBEG)_" thru "_$$FMTE^XLFDT(SDEND)
S TAB=(IOM-$L(PRNTLN))\2
W !!?TAB,PRNTLN
S PRNTLN="Print Date: "_$$FMTE^XLFDT($$NOW^XLFDT)
S TAB=(IOM-$L(PRNTLN))\2
W !?TAB,PRNTLN
S PRNTLN="Page: "_PAGE
S TAB=(IOM-$L(PRNTLN))\2
W !?TAB,PRNTLN
;
W !!?35,"Outpatient",?52,"",?68,"Medical Ctr"
W !,"PATIENT NAME",?35,"Encounter Date",?52,"MT Indicator",?68,"Division",?100,"Clinic"
;
S $P(LINE,"=",IOM)="" W !,LINE
Q
;
FTR ; Report Footer
N SDX
;
F SDX=$Y:1:IOSL-2 W !
W ?5,"* - Transmitted Outpatient Encounter"
Q
;
FTR1 ;
W !?5,"* - Transmitted Outpatient Encounter"
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCRPW81 8189 printed Dec 13, 2024@02:44:11 Page 2
SCRPW81 ; ALB/SCK - SCDX AMB CARE CLOSEOUT RPT FOR MT INDICATOR = U ; 9 JULY 2003
+1 ;;5.3;Scheduling;**302,440,474**;AUG 13, 1993;Build 4
+2 ;
EN ; Main entry point for report
+1 NEW DIR,DIRUT,SDBEG,SDEND,RSLT,Y,X
+2 ;
+3 SET DIR("A")="Please select fiscal year"
SET DIR(0)="SM^A:Previous Fiscal Year;B:Current Fiscal Year;O:Other Date Range"
+4 SET DIR("B")="B"
+5 SET DIR("?")="You may select either the previous fiscal year (A) or the current fiscal year (B). Select (O) if you choose to specify your own date range."
+6 DO ^DIR
KILL DIR
+7 if $DATA(DIRUT)
QUIT
+8 SET RSLT=Y
+9 ;
+10 IF RSLT="A"
Begin DoDot:1
+11 DO PASTYR(.SDBEG,.SDEND)
End DoDot:1
+12 IF '$TEST
IF RSLT="B"
Begin DoDot:1
+13 DO CURYR(.SDBEG,.SDEND)
End DoDot:1
+14 IF '$TEST
Begin DoDot:1
+15 DO GETDT(.SDBEG,.SDEND)
End DoDot:1
+16 if '$GET(SDBEG)!('$GET(SDEND))
QUIT
+17 WRITE !!?3,"Date Range: "_$$FMTE^XLFDT(SDBEG)_" to "_$$FMTE^XLFDT(SDEND)
+18 ;
+19 NEW X,Y,IORVON,IORVOFF
+20 SET X="IORVON;IORVOFF"
+21 DO ENDR^%ZISS
+22 if $DATA(IORVON)
WRITE IORVON
+23 WRITE !,"A 132-Column printer is required for this report."
+24 WRITE !,"This report will NOT print correctly to the screen!"
+25 if $DATA(IORVOFF)
WRITE IORVOFF
+26 ;
+27 NEW ZTSAVE,ZTRTN,ZTDESC,POP,%ZIS
+28 SET %ZIS="Q"
DO ^%ZIS
if POP
GOTO EXIT
+29 IF $DATA(IO("Q"))
Begin DoDot:1
+30 SET ZTSAVE("SDBEG")=""
SET ZTSAVE("SDEND")=""
SET ZTSAVE("DUZ")=""
+31 SET ZTRTN="RUN^SCRPW81"
+32 SET ZTDESC="XMITED OE MT=U RPT"
+33 DO ^%ZTLOAD
DO HOME^%ZIS
KILL IO("Q")
End DoDot:1
QUIT
+34 DO RUN
+35 DO ^%ZISC
EXIT if $DATA(ZTQUEUED)
SET ZTREQ="@"
QUIT
+1 ;
RUN ; Run report
+1 USE IO
+2 KILL ^TMP("SCDX MTU",$JOB),^TMP("SCDX ASORT",$JOB)
+3 ;
+4 DO BLD(SDBEG,SDEND)
+5 DO CHKMT
+6 DO SRTNAME
+7 DO MAIL
+8 DO PRINT
+9 KILL ^TMP("SCDX MTU",$JOB),^TMP("SCDX ASORT",$JOB)
+10 QUIT
+11 ;
PASTYR(SDBEG,SDEND) ; Set dates for previous fiscal year
+1 NEW CURYR,PRVYR,CURMN,%I
+2 ;
+3 DO NOW^%DTC
+4 SET CURYR=%I(3)
SET CURMN=%I(1)
+5 IF CURMN>9
Begin DoDot:1
+6 SET CURYR=CURYR+1
End DoDot:1
+7 SET PRVYR=CURYR-1
+8 SET SDEND=$$FMADD^XLFDT(PRVYR_"1001",-1)
+9 SET SDBEG=$$FMADD^XLFDT(PRVYR_"1001",-365)
+10 QUIT
+11 ;
CURYR(SDBEG,SDEND) ; Set dates for current fiscal year
+1 NEW CURYR,CURMN,%I
+2 ;
+3 DO NOW^%DTC
+4 SET CURYR=%I(3)
SET CURMN=%I(1)
+5 IF CURMN<10
Begin DoDot:1
+6 SET CURYR=CURYR-1
End DoDot:1
+7 SET SDBEG=CURYR_"1001"
+8 SET SDEND=$PIECE($$NOW^XLFDT,".")
+9 QUIT
+10 ;
GETDT(SDBEG,SDEND) ; Get beginning and ending date for search
+1 ; Output SDBEG Beginning for date range
+2 ; SDEND End of date range
+3 ; result 1 - If function successful
+4 ; 0 - If function NOT successful (User quit)
+5 ;
+6 NEW DIR,DIRUT,Y
+7 ;
+8 WRITE !!?3,"You have selected to specify your own date range. Please note that by"
+9 WRITE !?3,"doing so you may not generate an accurate picture of the AMB CARE"
+10 WRITE !?3,"closeouts where the means test indicator equals 'U'.",!
+11 ;
+12 SET DIR(0)="DAO^:DT:EX"
+13 SET DIR("A")="Beginning Date: "
+14 SET DIR("?")="^D HELP^%DTC"
+15 DO ^DIR
+16 IF $DATA(DIRUT)
Begin DoDot:1
+17 SET SDBEG=0
End DoDot:1
QUIT
+18 SET SDBEG=Y
+19 ;
+20 SET DIR(0)="DAO^:DT:EX"
+21 SET DIR("A")="Ending Date: "
+22 DO ^DIR
+23 IF $DATA(DIRUT)
Begin DoDot:1
+24 SET SDEND=0
End DoDot:1
QUIT
+25 SET SDEND=Y
+26 QUIT
+27 ;
BLD(SDBEG,SDEND) ; Build list of patient OE's for date range
+1 ; Input SDBEG
+2 ; SDEND
+3 ;
+4 NEW SDX,SDMAX,SDOEI,CNT,NODE,SDOEX,SDLOC
+5 ;
+6 ; set inital search DT to beginning date minus one second
SET SDX=$$FMADD^XLFDT(SDBEG,0,0,0,-1)
+7 ; set search end date to end date plus one day
SET SDMAX=$$FMADD^XLFDT(SDEND,0,23,59,59)
+8 ;
+9 SET ^TMP("SCDX MTU",$JOB,0,"BEGIN")=$HOROLOG
+10 FOR
SET SDX=$ORDER(^SCE("B",SDX))
if 'SDX
QUIT
Begin DoDot:1
+11 SET SDOEI=0
+12 FOR
SET SDOEI=$ORDER(^SCE("B",SDX,SDOEI))
if 'SDOEI
QUIT
Begin DoDot:2
+13 SET NODE=$GET(^SCE(SDOEI,0))
+14 ; Quit if not parent encounter
if $PIECE(NODE,U,6)>0
QUIT
+15 ; Quit if Originating process is for credit stop code
if $PIECE(NODE,U,8)>3
QUIT
+16 SET SDLOC=+$PIECE(NODE,U,4)
+17 ; Quit if non-count clinic
if $$GET1^DIQ(44,SDLOC,2502,"I")="Y"
QUIT
+18 SET SDOEX=$ORDER(^SD(409.73,"AENC",SDOEI,0))
+19 if '$PIECE(NODE,U,2)
QUIT
+20 SET ^TMP("SCDX MTU",$JOB,$PIECE(NODE,U,2),SDOEI)=$PIECE(NODE,U,1)_U_SDOEX
+21 SET ^TMP("SCDX MTU",$JOB,0,"CNT")=$GET(^TMP("SCDX MTU",$JOB,0,"CNT"))+1
End DoDot:2
End DoDot:1
if SDX>SDMAX
QUIT
+22 SET ^TMP("SCDX MTU",$JOB,0,"END")=$HOROLOG
+23 QUIT
+24 ;
CHKMT ; Clean out all except those meeting the MT=U conditions
+1 NEW DFN,SDOEI,SDOEDT,SDMT,SDO,SDR,SDN,SDAT,SDEC,SDMTI,SDMTT
+2 ;
+3 SET DFN=0
+4 FOR
SET DFN=$ORDER(^TMP("SCDX MTU",$JOB,DFN))
if 'DFN
QUIT
Begin DoDot:1
+5 ; No MT Data, bypass patient
IF '$DATA(^DGMT(408.31,"C",DFN))
Begin DoDot:2
+6 KILL ^TMP("SCDX MTU",$JOB,DFN)
End DoDot:2
QUIT
+7 SET (SDR,SDO,SDN,SDOEI)=0
+8 FOR
SET SDOEI=$ORDER(^TMP("SCDX MTU",$JOB,DFN,SDOEI))
if 'SDOEI
QUIT
Begin DoDot:2
+9 SET SDOEDT=$PIECE($GET(^TMP("SCDX MTU",$JOB,DFN,SDOEI)),U,1)
+10 if 'SDOEDT
QUIT
+11 SET SDEC=$$GET1^DIQ(409.68,SDOEI,.13,"I")
+12 SET SDAT=$$GET1^DIQ(409.68,SDOEI,.1,"I")
+13 SET SDMTI=$$MTI^SCDXUTL0(DFN,SDOEDT,SDEC,SDAT,SDOEI)
+14 IF SDMTI'="U"
Begin DoDot:3
+15 KILL ^TMP("SCDX MTU",$JOB,DFN)
End DoDot:3
QUIT
+16 SET SDMTT=$$LST^DGMTU(DFN,SDOEDT,1)
IF $PIECE(SDMTT,U,4)="N"
Begin DoDot:3
+17 KILL ^TMP("SCDX MTU",$JOB,DFN)
End DoDot:3
QUIT
+18 SET $PIECE(^TMP("SCDX MTU",$JOB,DFN,SDOEI),U,4)=SDMTI
End DoDot:2
End DoDot:1
+19 SET ^TMP("SCDX MTU",$JOB,0,"END")=$HOROLOG
KILL SDMTT
+20 QUIT
+21 ;
SRTNAME ; Sort remaining encounters by patient name and OE date
+1 NEW DFN,SDOEI,SDNAME,SDOEDT
+2 ;
+3 SET DFN=0
+4 FOR
SET DFN=$ORDER(^TMP("SCDX MTU",$JOB,DFN))
if 'DFN
QUIT
Begin DoDot:1
+5 SET SDNAME=$$GET1^DIQ(2,DFN,.01)
+6 if SDNAME']""
QUIT
+7 SET ^TMP("SCDX MTU",$JOB,0,"PATNUM")=$GET(^TMP("SCDX MTU",$JOB,0,"PATNUM"))+1
+8 SET SDOEI=0
+9 FOR
SET SDOEI=$ORDER(^TMP("SCDX MTU",$JOB,DFN,SDOEI))
if 'SDOEI
QUIT
Begin DoDot:2
+10 SET SDOEDT=$PIECE(^TMP("SCDX MTU",$JOB,DFN,SDOEI),U,1)
+11 SET ^TMP("SCDX ASORT",$JOB,SDNAME,SDOEDT)=$PIECE(^TMP("SCDX MTU",$JOB,DFN,SDOEI),U,2)_U_SDOEI_U_DFN_U_$PIECE(^TMP("SCDX MTU",$JOB,DFN,SDOEI),U,4)
+12 SET ^TMP("SCDX MTU",$JOB,0,"FINAL CNT")=$GET(^TMP("SCDX MTU",$JOB,0,"FINAL CNT"))+1
End DoDot:2
End DoDot:1
+13 SET ^TMP("SCDX MTU",$JOB,0,"END2")=$HOROLOG
+14 QUIT
+15 ;
MAIL ; send message with report statistics
+1 NEW MSG,XMSUB,XMY,XMTEXT,XMDUZ
+2 ;
+3 SET MSG(1)="Date Range for Report "_$$FMTE^XLFDT(SDBEG,2)_" to "_$$FMTE^XLFDT(SDEND,2)
+4 SET MSG(2)=""
+5 SET MSG(3)="Report Started "_$$HTE^XLFDT(^TMP("SCDX MTU",$JOB,0,"BEGIN"),2)
+6 SET MSG(4)="Report Finished "_$$HTE^XLFDT(^TMP("SCDX MTU",$JOB,0,"END2"),2)
+7 SET MSG(5)="Total Time for Report "_$$HDIFF^XLFDT(^TMP("SCDX MTU",$JOB,0,"END2"),^TMP("SCDX MTU",$JOB,0,"BEGIN"),3)
+8 SET MSG(6)=""
+9 SET MSG(7)="Outpatient Encounters Scanned "_$JUSTIFY($FNUMBER(+$GET(^TMP("SCDX MTU",$JOB,0,"CNT")),","),20)
+10 SET MSG(8)="Outpatient Encounters Reported "_$JUSTIFY($FNUMBER(+$GET(^TMP("SCDX MTU",$JOB,0,"FINAL CNT")),","),20)
+11 SET MSG(9)="Patient Count "_$JUSTIFY($FNUMBER(+$GET(^TMP("SCDX MTU",$JOB,0,"PATNUM")),","),20)
+12 ;
+13 SET XMSUB="MEANS TEST = 'U' REPORT STATISTICS"
+14 SET XMTEXT="MSG("
+15 SET XMY(DUZ)=""
+16 SET XMDUZ="ACRP MT=U STATS"
+17 DO ^XMD
+18 QUIT
+19 ;
PRINT ; Print Report
+1 ;SD*5.3*474 added SDFLAG and corresponding logic
+2 NEW SDNAME,SDNODE,SDXNODE,SDOEI,SDOEX,SDOEDT,DFN,PRNTL4,VA,PAGE,SDFLAG
+3 ;
+4 SET PAGE=0
+5 DO HDR
+6 SET SDNAME=""
+7 FOR
SET SDNAME=$ORDER(^TMP("SCDX ASORT",$JOB,SDNAME))
if SDNAME']""
QUIT
Begin DoDot:1
+8 WRITE !,$EXTRACT(SDNAME,1,30)
+9 SET PRNTL4=0
SET SDFLAG=1
+10 SET SDOEDT=0
+11 FOR
SET SDOEDT=$ORDER(^TMP("SCDX ASORT",$JOB,SDNAME,SDOEDT))
if 'SDOEDT
QUIT
Begin DoDot:2
+12 SET DFN=$PIECE($GET(^TMP("SCDX ASORT",$JOB,SDNAME,SDOEDT)),U,3)
+13 SET SDOEX=$PIECE($GET(^TMP("SCDX ASORT",$JOB,SDNAME,SDOEDT)),U,1)
+14 SET SDOEI=$PIECE($GET(^TMP("SCDX ASORT",$JOB,SDNAME,SDOEDT)),U,2)
+15 IF 'PRNTL4
Begin DoDot:3
+16 DO PID^VADPT6
+17 WRITE ?($LENGTH(SDNAME)+1),"(",VA("BID"),")"
End DoDot:3
SET PRNTL4=1
+18 IF 'SDFLAG
Begin DoDot:3
+19 WRITE !,$EXTRACT(SDNAME,1,30)
+20 DO PID^VADPT6
+21 WRITE ?($LENGTH(SDNAME)+1),"(",VA("BID"),")"
End DoDot:3
SET SDFLAG=1
+22 WRITE ?35,$$FMTE^XLFDT(SDOEDT,"D"),$SELECT(SDOEX>0:" *",1:" ")
+23 WRITE ?56,$PIECE($GET(^TMP("SCDX ASORT",$JOB,SDNAME,SDOEDT)),U,4)
+24 SET SDNODE=$GET(^SCE(SDOEI,0))
+25 WRITE ?68,$EXTRACT($$GET1^DIQ(40.8,$PIECE(SDNODE,U,11),.01),1,30)
+26 WRITE ?100,$EXTRACT($$GET1^DIQ(44,$PIECE(SDNODE,U,4),.01),1,30)
+27 IF ($Y+5)>IOSL
DO HDR
SET SDFLAG=0
QUIT
+28 WRITE !
End DoDot:2
End DoDot:1
+29 DO FTR1
+30 QUIT
+31 ;
HDR ; Report Header
+1 NEW SPACE,LINE,TAB,PRNTLN
+2 ;
+3 IF PAGE>0
DO FTR
+4 if PAGE>0
WRITE @IOF
+5 SET PAGE=PAGE+1
+6 ;
+7 SET PRNTLN="Transmitted Outpatient Encounters with Means Test = 'U'"
+8 SET TAB=(IOM-$LENGTH(PRNTLN))\2
+9 WRITE !?TAB,PRNTLN
+10 SET PRNTLN="Date Range: "_$$FMTE^XLFDT(SDBEG)_" thru "_$$FMTE^XLFDT(SDEND)
+11 SET TAB=(IOM-$LENGTH(PRNTLN))\2
+12 WRITE !!?TAB,PRNTLN
+13 SET PRNTLN="Print Date: "_$$FMTE^XLFDT($$NOW^XLFDT)
+14 SET TAB=(IOM-$LENGTH(PRNTLN))\2
+15 WRITE !?TAB,PRNTLN
+16 SET PRNTLN="Page: "_PAGE
+17 SET TAB=(IOM-$LENGTH(PRNTLN))\2
+18 WRITE !?TAB,PRNTLN
+19 ;
+20 WRITE !!?35,"Outpatient",?52,"",?68,"Medical Ctr"
+21 WRITE !,"PATIENT NAME",?35,"Encounter Date",?52,"MT Indicator",?68,"Division",?100,"Clinic"
+22 ;
+23 SET $PIECE(LINE,"=",IOM)=""
WRITE !,LINE
+24 QUIT
+25 ;
FTR ; Report Footer
+1 NEW SDX
+2 ;
+3 FOR SDX=$Y:1:IOSL-2
WRITE !
+4 WRITE ?5,"* - Transmitted Outpatient Encounter"
+5 QUIT
+6 ;
FTR1 ;
+1 WRITE !?5,"* - Transmitted Outpatient Encounter"
+2 QUIT
+3 ;