SDCWL ;ALB/MLI - CLINIC WORKLOAD REPORT ; 18 APRIL 88
;;5.3;Scheduling;**140,132,1001,1011,1015,1016**;Aug 13, 1993;Build 20
;cmi/flag/maw 11/9/2009 PATCH 1011 added call to CLINIC^BSDU for taxonomy
;IHS/ITSC/WAR 5/3/2004 P #1001 Removed call to WKL^SDAMQ2 (appt status
; update log) - not used by IHS. See [SDAM APPT UPDATE] menu option
;D Q S U="^" D ASK2^SDDIV G Q:Y<0 S (VAUTC,SDADD,SDALL,SDNAM,SDPRE)=0 D DATE^SDUTL G Q:POP D WKL^SDAMQ2(SDBD,SDED) G DT:($E(SDBD,6,7)&$E(SDED,6,7))
;D Q S U="^" D ASK2^SDDIV G Q:Y<0 S (VAUTC,SDADD,SDALL,SDNAM,SDPRE)=0 D DATE^SDUTL G Q:POP,DT:($E(SDBD,6,7)&$E(SDED,6,7)) ;cmi/maw 11/9/2009 orig line
D Q S U="^" ;cmi/maw PATCH 1011
S (VAUTC,SDADD,SDALL,SDNAM,SDPRE)=0 D DATE^SDUTL G Q:POP,DT:($E(SDBD,6,7)&$E(SDED,6,7)) ;cmi/maw PATCH 1011
S:'$E(SDBD,4,5) SDBD=$E(SDBD,1,3)_"0101" S:'$E(SDED,4,5) SDED=$E(SDED,1,3)_"1231" S:'$E(SDBD,6,7) SDBD=$E(SDBD,1,5)_"01" S:'$E(SDED,6,7) SDED=$E(SDED,1,5)_"31"
DT S SDB1=$TR($$FMTE^XLFDT(SDBD,"5DF")," ","0"),SDE1=$TR($$FMTE^XLFDT(SDED,"5DF")," ","0")
S SDB=$TR($$FMTE^XLFDT(SDBD,"2FD")," ","0"),SDE=$TR($$FMTE^XLFDT(SDED,"2FD")," ","0")
S SDBD=SDBD-.1,SDED=SDED+.9
;I SDED<2871001 S SDS="C" S VAUTNI=2 D CLINIC^VAUTOMA G Q:Y<0,RT ;cmi/maw PATCH 1011 orig line
I SDED<2871001 S SDS="C" D CLINIC^BSDU(2,1) G Q:$O(VAUTC(""))="",RT ;cmi/maw PATCH 1011 mod for taxonomy
1 R !,"Totals by (C)LINIC or (S)TOP CODE?: C//",X:DTIME G Q:(X="^")!'$T S Z="^CLINIC^STOP CODE" W:X["?" !,"Type:",!?10,"'C' for CLINIC totals only, or",!?10,"'S' for STOP CODE and CLINIC totals",! I X="" S X="C" W X
;D IN^DGHELP G:%=-1 1 S SDS=X I SDS="C" S VAUTNI=2 D CLINIC^VAUTOMA G Q:Y<0,RT ;cmi/maw PATCH 1011 orig line
D IN^DGHELP G:%=-1 1 S SDS=X I SDS="C" D CLINIC^BSDU(2,1) G Q:$O(VAUTC(""))="",RT ;cmi/maw PATCH 1011 mod for taxonomy
I SDS="S" D ASK2^SDDIV G Q:Y<0 ;cmi/maw PATCH 1011
2 F SDI=1:0 Q:SDI>20 W !,"Enter Stop Code: " W:'$D(SDCL) "ALL//" R X:DTIME Q:(X="^")!'$T!(X="") W:X["?" !,"Enter a stop code or return when all stop codes have been entered" D CL^SDSCP
G:X="^"!('$T&(SDI<20)) Q I X="",'$D(SDCL) S SDCL="",SDALL=1
ADD I SDS="S" W !,"Do you want to include add/edits" S %=2 D YN^DICN W:%Y["?" !,"Answer 'Y'es to see add/edits entered through the ADD/EDIT STOP CODES option or",!,"'N'o to leave them out" G Q:%<0,ADD:%'>0 S SDADD='(%-1)
RT I SDS="S"&((SDBD-10000)<2871000) S SDRT="E" G 3
R !,"Brief or Expanded Report? E//",X:DTIME G Q:X="^"!'$T S Z="^BRIEF^EXPANDED" W:X["?" !,"Enter 'B'rief to see a comparison of data to previous year only",!,"or 'E'xpanded to see patient breakdown by clinic/stop code" I X="" S X="E" W X
D IN^DGHELP S SDRT=X G RT:%=-1,ST:X="B"
3 W !,"(D)ETAIL BY DAY or (S)UMMARY BY MONTH?: D//" R X:DTIME G Q:(X="^")!'$T W:X["?" !,"TYPE:",!?10,"'D' for report by individual clinic meeting",!?10,"'S' for report by month" I X="" S X="D" W X
S Z="^DETAIL BY DAY^SUMMARY BY MONTH" D IN^DGHELP G:%=-1 3 S SDF=X
PN I SDF="D" W !,"Do you want to see patient names" S %=2 D YN^DICN W:%Y["?" "ANSWER 'Y'ES OR 'N'O" G Q:%<0,PN:%'>0 S SDNAM='(%-1)
5 I SDS="C"!((SDBD-10000)>2871000) W !,"Do you want to compare this data to the same period in the previous year" S %=2 D YN^DICN W:%Y["?" "ANSWER 'Y'ES OR 'N'O" G Q:%<0,5:%'>0 S SDPRE='(%-1)
W !!,"Report will cover the period from: ",SDB1," through ",SDE1 W:SDPRE !,"Comparison will be done against the same period for the previous year" W !!
ST S DGPGM="6^SDCWL",DGVAR="VAUTC#^VAUTD#^SDALL^SDCL#^SDB^SDB1^SDBD^SDE^SDE1^SDED^SDF^SDRT^SDS^SDADD^SDNAM^SDPRE" K IOP D ZIS^DGUTQ G:POP Q U IO D 6,CLOSE^DGUTQ Q
6 S (SDOB,SDPG,SDHR,SD1)=0,%DT="R",X="N" D ^%DT
S SDNOW=$TR($$FMTE^XLFDT(Y,"5DF")," ","0")_"@"_$P(Y,".",2)
F I=0:0 S I=$S(SDS="S"!VAUTC:$O(^SC(I)),1:$O(VAUTC(I))) Q:'I D SET^SDCWL3
;
IF SDADD D SCAN
I (SDRT="B"!SDPRE)&'$D(SDFL) S SDBD=SDBD-10000,SDED=SDED-10000,SDFL=1 G 6
I '$D(^TMP($J,"CL")),'$D(^("SC")) D NONE^SDCWL3 G Q
G Q:'$D(^TMP($J)) D:SDRT="E"&($D(^TMP($J,1))!$D(^("SC"))) ^SDCWL1,LEG^SDCWL3 D ERR^SDCWL3:$D(^TMP($J,"ERR")),PREV^SDCWL2:SDPRE!(SDRT="B")
Q W ! K ^TMP($J),%,%DT,%Y,BEGDATE,DFN,DGPGM,DGVAR,DIV,ENDDATE,I,I1,J,J1,K,K1,L,L1,M,M1,N,N1,P,P1,POP,Q,Q1,R,S,SD1,SDADD,SDAED,SDALL,SDAPT,SDAS,SDB,SDBD,SDBO,SDCA,SDCL,SDCR,SDCUR,SDD,SDDIV,SDE,SDED,SDEO,SDF,SDF1,SDFL,SDHK,SDHR
K SDF2,SDI,SDIN,SDN,SDNAM,SDNM,SDNOW,SDNS,SDNUM,SDOB,SDOLD,SDP,SDPG,SDPN,SDPRE,SDRT,SDS,SDSC,SDSCC,SDSCH,SDSCI,SDSCN,SDSCO,SDSCS,SDSCU,SDSSN,SDST,SDSTAT,SDSUB,SDT,SDTOT,SDUN,SDV,VAUTC,VAUTD,VAUTNI,X,Y,Z,SDE1,SDB1 Q
;
SCAN ; -- scan ^SCE for date range
N SDT,SDOE,SDOE0,SDSC,SDPAR,SDORG
S SDT=SDBD
F S SDT=$O(^SCE("B",SDT)) Q:'SDT!(SDT>SDED) D
. S SDOE=0
. F S SDOE=$O(^SCE("B",SDT,SDOE)) Q:'SDOE D
. . S SDOE0=$G(^SCE(SDOE,0))
. . S SDSC=+$P($G(^DIC(40.7,+$P(SDOE0,U,3),0)),U,2)
. . S SDPAR=+$P(SDOE0,U,6)
. . S SDORG=+$P(SDOE0,U,8)
. . ;
. . ; -- do checks
. . IF SDORG'=2 Q ; -- must be a/e
. . IF SDPAR Q ; -- must not have parent
. . IF '$$OKAE^SDVSIT2(SDOE) Q ; -- must be checked out
. . IF 'SDSC Q ; -- must be a vaild stop code
. . ;
. . D ADDON^SDCWL2
Q
;
SDCWL ;ALB/MLI - CLINIC WORKLOAD REPORT ; 18 APRIL 88
+1 ;;5.3;Scheduling;**140,132,1001,1011,1015,1016**;Aug 13, 1993;Build 20
+2 ;cmi/flag/maw 11/9/2009 PATCH 1011 added call to CLINIC^BSDU for taxonomy
+3 ;IHS/ITSC/WAR 5/3/2004 P #1001 Removed call to WKL^SDAMQ2 (appt status
+4 ; update log) - not used by IHS. See [SDAM APPT UPDATE] menu option
+5 ;D Q S U="^" D ASK2^SDDIV G Q:Y<0 S (VAUTC,SDADD,SDALL,SDNAM,SDPRE)=0 D DATE^SDUTL G Q:POP D WKL^SDAMQ2(SDBD,SDED) G DT:($E(SDBD,6,7)&$E(SDED,6,7))
+6 ;D Q S U="^" D ASK2^SDDIV G Q:Y<0 S (VAUTC,SDADD,SDALL,SDNAM,SDPRE)=0 D DATE^SDUTL G Q:POP,DT:($E(SDBD,6,7)&$E(SDED,6,7)) ;cmi/maw 11/9/2009 orig line
+7 ;cmi/maw PATCH 1011
DO Q
SET U="^"
+8 ;cmi/maw PATCH 1011
SET (VAUTC,SDADD,SDALL,SDNAM,SDPRE)=0
DO DATE^SDUTL
IF POP
GOTO Q
IF ($EXTRACT(SDBD,6,7)&$EXTRACT(SDED,6,7))
GOTO DT
+9 IF '$EXTRACT(SDBD,4,5)
SET SDBD=$EXTRACT(SDBD,1,3)_"0101"
IF '$EXTRACT(SDED,4,5)
SET SDED=$EXTRACT(SDED,1,3)_"1231"
IF '$EXTRACT(SDBD,6,7)
SET SDBD=$EXTRACT(SDBD,1,5)_"01"
IF '$EXTRACT(SDED,6,7)
SET SDED=$EXTRACT(SDED,1,5)_"31"
DT SET SDB1=$TRANSLATE($$FMTE^XLFDT(SDBD,"5DF")," ","0")
SET SDE1=$TRANSLATE($$FMTE^XLFDT(SDED,"5DF")," ","0")
+1 SET SDB=$TRANSLATE($$FMTE^XLFDT(SDBD,"2FD")," ","0")
SET SDE=$TRANSLATE($$FMTE^XLFDT(SDED,"2FD")," ","0")
+2 SET SDBD=SDBD-.1
SET SDED=SDED+.9
+3 ;I SDED<2871001 S SDS="C" S VAUTNI=2 D CLINIC^VAUTOMA G Q:Y<0,RT ;cmi/maw PATCH 1011 orig line
+4 ;cmi/maw PATCH 1011 mod for taxonomy
IF SDED<2871001
SET SDS="C"
DO CLINIC^BSDU(2,1)
IF $ORDER(VAUTC(""))=""
GOTO Q
GOTO RT
1 READ !,"Totals by (C)LINIC or (S)TOP CODE?: C//",X:DTIME
IF (X="^")!'$TEST
GOTO Q
SET Z="^CLINIC^STOP CODE"
IF X["?"
WRITE !,"Type:",!?10,"'C' for CLINIC totals only, or",!?10,"'S' for STOP CODE and CLINIC totals",!
IF X=""
SET X="C"
WRITE X
+1 ;D IN^DGHELP G:%=-1 1 S SDS=X I SDS="C" S VAUTNI=2 D CLINIC^VAUTOMA G Q:Y<0,RT ;cmi/maw PATCH 1011 orig line
+2 ;cmi/maw PATCH 1011 mod for taxonomy
DO IN^DGHELP
IF %=-1
GOTO 1
SET SDS=X
IF SDS="C"
DO CLINIC^BSDU(2,1)
IF $ORDER(VAUTC(""))=""
GOTO Q
GOTO RT
+3 ;cmi/maw PATCH 1011
IF SDS="S"
DO ASK2^SDDIV
IF Y<0
GOTO Q
2 FOR SDI=1:0
IF SDI>20
QUIT
WRITE !,"Enter Stop Code: "
IF '$DATA(SDCL)
WRITE "ALL//"
READ X:DTIME
IF (X="^")!'$TEST!(X="")
QUIT
IF X["?"
WRITE !,"Enter a stop code or return when all stop codes have been entered"
DO CL^SDSCP
+1 IF X="^"!('$TEST&(SDI<20))
GOTO Q
IF X=""
IF '$DATA(SDCL)
SET SDCL=""
SET SDALL=1
ADD IF SDS="S"
WRITE !,"Do you want to include add/edits"
SET %=2
DO YN^DICN
IF %Y["?"
WRITE !,"Answer 'Y'es to see add/edits entered through the ADD/EDIT STOP CODES option or",!,"'N'o to leave them out"
IF %<0
GOTO Q
IF %'>0
GOTO ADD
SET SDADD='(%-1)
RT IF SDS="S"&((SDBD-10000)<2871000)
SET SDRT="E"
GOTO 3
+1 READ !,"Brief or Expanded Report? E//",X:DTIME
IF X="^"!'$TEST
GOTO Q
SET Z="^BRIEF^EXPANDED"
IF X["?"
WRITE !,"Enter 'B'rief to see a comparison of data to previous year only",!,"or 'E'xpanded to see patient breakdown by clinic/stop code"
IF X=""
SET X="E"
WRITE X
+2 DO IN^DGHELP
SET SDRT=X
IF %=-1
GOTO RT
IF X="B"
GOTO ST
3 WRITE !,"(D)ETAIL BY DAY or (S)UMMARY BY MONTH?: D//"
READ X:DTIME
IF (X="^")!'$TEST
GOTO Q
IF X["?"
WRITE !,"TYPE:",!?10,"'D' for report by individual clinic meeting",!?10,"'S' for report by month"
IF X=""
SET X="D"
WRITE X
+1 SET Z="^DETAIL BY DAY^SUMMARY BY MONTH"
DO IN^DGHELP
IF %=-1
GOTO 3
SET SDF=X
PN IF SDF="D"
WRITE !,"Do you want to see patient names"
SET %=2
DO YN^DICN
IF %Y["?"
WRITE "ANSWER 'Y'ES OR 'N'O"
IF %<0
GOTO Q
IF %'>0
GOTO PN
SET SDNAM='(%-1)
5 IF SDS="C"!((SDBD-10000)>2871000)
WRITE !,"Do you want to compare this data to the same period in the previous year"
SET %=2
DO YN^DICN
IF %Y["?"
WRITE "ANSWER 'Y'ES OR 'N'O"
IF %<0
GOTO Q
IF %'>0
GOTO 5
SET SDPRE='(%-1)
+1 WRITE !!,"Report will cover the period from: ",SDB1," through ",SDE1
IF SDPRE
WRITE !,"Comparison will be done against the same period for the previous year"
WRITE !!
ST SET DGPGM="6^SDCWL"
SET DGVAR="VAUTC#^VAUTD#^SDALL^SDCL#^SDB^SDB1^SDBD^SDE^SDE1^SDED^SDF^SDRT^SDS^SDADD^SDNAM^SDPRE"
KILL IOP
DO ZIS^DGUTQ
IF POP
GOTO Q
USE IO
DO 6
DO CLOSE^DGUTQ
QUIT
6 SET (SDOB,SDPG,SDHR,SD1)=0
SET %DT="R"
SET X="N"
DO ^%DT
+1 SET SDNOW=$TRANSLATE($$FMTE^XLFDT(Y,"5DF")," ","0")_"@"_$PIECE(Y,".",2)
+2 FOR I=0:0
SET I=$SELECT(SDS="S"!VAUTC:$ORDER(^SC(I)),1:$ORDER(VAUTC(I)))
IF 'I
QUIT
DO SET^SDCWL3
+3 ;
+4 IF SDADD
DO SCAN
+5 IF (SDRT="B"!SDPRE)&'$DATA(SDFL)
SET SDBD=SDBD-10000
SET SDED=SDED-10000
SET SDFL=1
GOTO 6
+6 IF '$DATA(^TMP($JOB,"CL"))
IF '$DATA(^("SC"))
DO NONE^SDCWL3
GOTO Q
+7 IF '$DATA(^TMP($JOB))
GOTO Q
IF SDRT="E"&($DATA(^TMP($JOB,1))!$DATA(^("SC")))
DO ^SDCWL1
DO LEG^SDCWL3
IF $DATA(^TMP($JOB,"ERR"))
DO ERR^SDCWL3
IF SDPRE!(SDRT="B")
DO PREV^SDCWL2
Q WRITE !
KILL ^TMP($JOB),%,%DT,%Y,BEGDATE,DFN,DGPGM,DGVAR,DIV,ENDDATE,I,I1,J,J1,K,K1,L,L1,M,M1,N,N1,P,P1,POP,Q,Q1,R,S,SD1,SDADD,SDAED,SDALL,SDAPT,SDAS,SDB,SDBD,SDBO,SDCA,SDCL,SDCR,SDCUR,SDD,SDDIV,SDE,SDED,SDEO,SDF,SDF1,SDFL,SDHK,SDHR
+1 KILL SDF2,SDI,SDIN,SDN,SDNAM,SDNM,SDNOW,SDNS,SDNUM,SDOB,SDOLD,SDP,SDPG,SDPN,SDPRE,SDRT,SDS,SDSC,SDSCC,SDSCH,SDSCI,SDSCN,SDSCO,SDSCS,SDSCU,SDSSN,SDST,SDSTAT,SDSUB,SDT,SDTOT,SDUN,SDV,VAUTC,VAUTD,VAUTNI,X,Y,Z,SDE1,SDB1
QUIT
+2 ;
SCAN ; -- scan ^SCE for date range
+1 NEW SDT,SDOE,SDOE0,SDSC,SDPAR,SDORG
+2 SET SDT=SDBD
+3 FOR
SET SDT=$ORDER(^SCE("B",SDT))
IF 'SDT!(SDT>SDED)
QUIT
Begin DoDot:1
+4 SET SDOE=0
+5 FOR
SET SDOE=$ORDER(^SCE("B",SDT,SDOE))
IF 'SDOE
QUIT
Begin DoDot:2
+6 SET SDOE0=$GET(^SCE(SDOE,0))
+7 SET SDSC=+$PIECE($GET(^DIC(40.7,+$PIECE(SDOE0,U,3),0)),U,2)
+8 SET SDPAR=+$PIECE(SDOE0,U,6)
+9 SET SDORG=+$PIECE(SDOE0,U,8)
+10 ;
+11 ; -- do checks
+12 ; -- must be a/e
IF SDORG'=2
QUIT
+13 ; -- must not have parent
IF SDPAR
QUIT
+14 ; -- must be checked out
IF '$$OKAE^SDVSIT2(SDOE)
QUIT
+15 ; -- must be a vaild stop code
IF 'SDSC
QUIT
+16 ;
+17 DO ADDON^SDCWL2
End DoDot:2
End DoDot:1
+18 QUIT
+19 ;