SCCVE ;ALB/RMO,TMP - Encounter Conversion Driver; [ 04/05/95 8:19 AM ]
;;5.3;Scheduling;**211,1015**;Aug 13, 1993;Build 21
;
QUE(SCLOG,SCREQ) ;Schedule encounter conversion via task manager
; Input -- SCLOG CST log IEN
; SCREQ CST request IEN
; Output -- None
N I,SCERRMSG,SCREQ0,SCREQD,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
S SCREQ0=$G(^SD(404.98,SCLOG,"R",SCREQ,0))
;
; -- quit if convert or reconvert & conversion disabled
IF $P(SCREQ0,U,3)=1!($P(SCREQ0,U,3)=2),'$$OK^SCCVU(1) G QUEQ
;
I SCREQ0="" D G QUEQ
. N SCERRIP
. S SCERRIP(1)=SCLOG
. S SCERRIP(2)=SCREQ
. S SCERRIP(3)="Conversion"
. D GETERR^SCCVLOG1(4049004.001,"",.SCERRIP,SCLOG,0,.SCERRMSG)
S SCREQD=$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.02,$P(SCREQ0,U,2)))
S ZTDESC="CST Log #"_SCLOG_" - "_SCREQD_" ("_$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.03,$P(SCREQ0,U,3)))_")"
S ZTRTN="EN^SCCVE"
F I="SCLOG","SCREQ" S ZTSAVE(I)=""
S ZTIO="SCCV RESOURCE"
S ZTDTH=$S($P(SCREQ0,U,4):$P(SCREQ0,U,4),1:$$NOW^XLFDT)
D ^%ZTLOAD
I $D(ZTSK) D
. W " (Task: #",ZTSK,")"
. D UPD^SCCVLOG("CST",SCLOG,"","","",ZTSK,$G(^%ZOSF("VOL")),6)
QUEQ Q
;
EN ;Entry point to run encounter estimate/conversion
; Input -- SCLOG CST log IEN
; SCREQ CST request IEN
; Output -- None
N SCACT,SCCVEVT,SCEND,SCERRMSG,SCRSTDT,SCRSTPT,SCSTDT,SCSTOPF,SCBULL,SCTOT,SCRSTDFN,SCCVERRH,SCCVERRT,SCCVDIS,SCCVACRP,SCCV900,ZZLOG,SCCVMAXE
I '$G(SCLOG)!('$G(SCREQ))!('$G(DUZ)) D G ENQ ;req vars missing
. N SCERRIP
. S SCERRIP(1)=$S('$G(SCLOG):"SCLOG",'$G(SCREQ):"SCREQ",1:"DUZ")
. S SCERRIP(2)="EN^SCCVE"
. D GETERR^SCCVLOG1(4040001.001,"",.SCERRIP,$G(SCLOG),0,.SCERRMSG)
. I $G(SCLOG),$G(SCREQ) D STOP^SCCVLOG(SCLOG,SCREQ,1)
;
; -- set overall variables
S SCCVACRP=$$ENDDATE^SCCVU()
S SCCV900=+$O(^DIC(40.7,"C",900,0))
S SCCVMAXE=$S($P($G(^SD(404.91,1,"CNV")),U,7):$P(^("CNV"),U,7),1:1000)-1
;
D SET(SCLOG,SCREQ,.SCACT,.SCCVEVT,.SCSTDT,.SCENDT,.SCRSTPT,.SCRSTDT,.SCBULL,.SCRSTDFN)
;
; -- quit if convert or reconvert & conversion disabled
IF SCCVEVT=1!(SCCVEVT=2),'$$OK^SCCVU(0) G ENQ
;
;Log event
D UPD^SCCVLOG("CST",SCLOG,"","","","","",SCACT)
;
I $G(SCCVEVT)=1,$$CHKACT^SCCVLOG(SCLOG,SCCVEVT,5,"CST") D G ENQ ;converted
. D GETERR^SCCVLOG1(4049001.008,"","",SCLOG,0,.SCERRMSG)
;
I "^2^4^"'[(U_SCACT_U) D G ENQ ;start or re-start
. D GETERR^SCCVLOG1(4049006.001,"","",SCLOG,0,.SCERRMSG)
. D STOP^SCCVLOG(SCLOG,SCREQ,1)
;
I '$G(SCSTDT)!('$G(SCENDT)) D G ENQ ;start date or end date undefined
. D GETERR^SCCVLOG1(4049001.003,"","",SCLOG,0,.SCERRMSG)
. D STOP^SCCVLOG(SCLOG,SCREQ,1)
;
I $G(SCCVEVT)="" D G ENQ ;event undefined
. D GETERR^SCCVLOG1(4049001.009,"","",SCLOG,0,.SCERRMSG)
. D STOP^SCCVLOG(SCLOG,SCREQ,1)
;
I $$VERDT^SCCVU2(SCSTDT,SCENDT,SCLOG) D G ENQ ;invalid date range
. D STOP^SCCVLOG(SCLOG,SCREQ,1)
;
S (SCCVERRH,SCCVERRT)=+$P($G(^SD(404.98,SCLOG,1)),U,5)
I SCCVEVT S SCTOT(1.02)=$P($G(^SD(404.98,SCLOG,1)),U,2),SCTOT(2.06)=$P($G(^(2)),U,6)
I 'SCCVEVT K ^XTMP("SCCV-VIS-"_SCLOG),^XTMP("SCCV-BOTH-"_SCLOG)
;
;Convert appointments
I $G(SCRSTPT)<2 D EN^SCCVEAP(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,+$G(SCRSTDFN),.SCSTOPF) G ENQ:$G(SCSTOPF) I $G(SCRSTPT) S (SCRSTDT,SCRSTDFN)=""
;
;Convert disposition
I $S('$G(SCRSTPT):1,1:SCRSTPT'=2) D EN^SCCVEDI(SCCVEVT,$S($G(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF) G ENQ:$G(SCSTOPF) I $G(SCRSTPT) S (SCRSTDT,SCRSTDFN)=""
;
;Convert add/edits
D EN^SCCVEAE(SCCVEVT,$S($G(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF) G ENQ:$G(SCSTOPF)
;
;Log completion
D UPD^SCCVLOG("CST",SCLOG,"","","","@","@",5)
;
ENQ Q
;
SET(SCLOG,SCREQ,SCACT,SCCVEVT,SCSTDT,SCENDT,SCRSTPT,SCRSTDT,SCBULL,SCRSTDFN) ;
; Set variables
; Input -- SCLOG CST log IEN
; SCREQ CST request IEN
; Output -- SCACT Action
; SCCVEVT Conversion event
; SCSTDT Start date
; SCENDT End date
; SCRSTPT Conversion re-start point (1=appt, 2=a/e, 3=disp)
; SCRSTDT Re-start date
; SCBULL Send bulletin flag
; SCRSTDFN Re-start dfn
N SCLOG0,SCLOG1,SCOE,SCOE0,SCREQACT
S SCLOG0=$G(^SD(404.98,SCLOG,0)),SCLOG1=$G(^(1))
S SCREQACT=$P($G(^SD(404.98,SCLOG,"R",SCREQ,0)),U,2)
S SCACT=$S(SCREQACT=1:2,SCREQACT=3:4,1:"") ;action based on request
S SCCVEVT=$P(SCLOG0,U,5)
S SCSTDT=$P(SCLOG0,U,3)
S SCENDT=$P(SCLOG0,U,4)
S SCBULL=$P(SCLOG0,U,6)
;
I +SCLOG1,SCCVEVT,SCACT=4 D ;Only for re-start of conversion
. S SCOE=+SCLOG1 ;last entry
. I $P($G(^SCE(SCOE,0)),U,6) S SCOE=+$P(^(0),U,6) ;re-start at parent
. S SCOE0=$G(^SCE(SCOE,0))
. S SCRSTPT=+$P(SCOE0,U,8),SCRSTDT=$P(+SCOE0,"."),SCRSTDFN=$P(SCOE0,U,2) ;set re-start point
;
I 'SCCVEVT D ;Estimate must start counting over from beginning
.N Z,SC2,SCDATA,SCF
.S SC2=$G(^SD(404.98,SCLOG,2))
.F Z=1:1:11 I $P(SC2,U,Z) S SCF="2."_$S(Z<10:"0",1:"")_Z,SCDATA(+SCF)=0
.I $D(SCDATA) D UPD^SCCVDBU(404.98,SCLOG,.SCDATA) ;Re-set totals to 0
;
I SCCVEVT=2,SCACT'=4 D ;'Start' of re-convert deletes errors and resets counts to 0
. N SCDATA
. S SCDATA(1.05)=0,SCDATA(50)="@",SCDATA(2.06)=0,SCDATA(1.02)=0
. D UPD^SCCVDBU(404.98,SCLOG,.SCDATA)
Q
;
STOP(SCLOG,SCREQ) ;User request to stop conversion
; Input -- SCLOG CST log IEN
; SCREQ CST request IEN
; Output -- None
N SCSTOPF
D STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
Q
;
SCCVE ;ALB/RMO,TMP - Encounter Conversion Driver; [ 04/05/95 8:19 AM ]
+1 ;;5.3;Scheduling;**211,1015**;Aug 13, 1993;Build 21
+2 ;
QUE(SCLOG,SCREQ) ;Schedule encounter conversion via task manager
+1 ; Input -- SCLOG CST log IEN
+2 ; SCREQ CST request IEN
+3 ; Output -- None
+4 NEW I,SCERRMSG,SCREQ0,SCREQD,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
+5 SET SCREQ0=$GET(^SD(404.98,SCLOG,"R",SCREQ,0))
+6 ;
+7 ; -- quit if convert or reconvert & conversion disabled
+8 IF $PIECE(SCREQ0,U,3)=1!($PIECE(SCREQ0,U,3)=2)
IF '$$OK^SCCVU(1)
GOTO QUEQ
+9 ;
+10 IF SCREQ0=""
Begin DoDot:1
+11 NEW SCERRIP
+12 SET SCERRIP(1)=SCLOG
+13 SET SCERRIP(2)=SCREQ
+14 SET SCERRIP(3)="Conversion"
+15 DO GETERR^SCCVLOG1(4049004.001,"",.SCERRIP,SCLOG,0,.SCERRMSG)
End DoDot:1
GOTO QUEQ
+16 SET SCREQD=$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.02,$PIECE(SCREQ0,U,2)))
+17 SET ZTDESC="CST Log #"_SCLOG_" - "_SCREQD_" ("_$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.03,$PIECE(SCREQ0,U,3)))_")"
+18 SET ZTRTN="EN^SCCVE"
+19 FOR I="SCLOG","SCREQ"
SET ZTSAVE(I)=""
+20 SET ZTIO="SCCV RESOURCE"
+21 SET ZTDTH=$SELECT($PIECE(SCREQ0,U,4):$PIECE(SCREQ0,U,4),1:$$NOW^XLFDT)
+22 DO ^%ZTLOAD
+23 IF $DATA(ZTSK)
Begin DoDot:1
+24 WRITE " (Task: #",ZTSK,")"
+25 DO UPD^SCCVLOG("CST",SCLOG,"","","",ZTSK,$GET(^%ZOSF("VOL")),6)
End DoDot:1
QUEQ QUIT
+1 ;
EN ;Entry point to run encounter estimate/conversion
+1 ; Input -- SCLOG CST log IEN
+2 ; SCREQ CST request IEN
+3 ; Output -- None
+4 NEW SCACT,SCCVEVT,SCEND,SCERRMSG,SCRSTDT,SCRSTPT,SCSTDT,SCSTOPF,SCBULL,SCTOT,SCRSTDFN,SCCVERRH,SCCVERRT,SCCVDIS,SCCVACRP,SCCV900,ZZLOG,SCCVMAXE
+5 ;req vars missing
IF '$GET(SCLOG)!('$GET(SCREQ))!('$GET(DUZ))
Begin DoDot:1
+6 NEW SCERRIP
+7 SET SCERRIP(1)=$SELECT('$GET(SCLOG):"SCLOG",'$GET(SCREQ):"SCREQ",1:"DUZ")
+8 SET SCERRIP(2)="EN^SCCVE"
+9 DO GETERR^SCCVLOG1(4040001.001,"",.SCERRIP,$GET(SCLOG),0,.SCERRMSG)
+10 IF $GET(SCLOG)
IF $GET(SCREQ)
DO STOP^SCCVLOG(SCLOG,SCREQ,1)
End DoDot:1
GOTO ENQ
+11 ;
+12 ; -- set overall variables
+13 SET SCCVACRP=$$ENDDATE^SCCVU()
+14 SET SCCV900=+$ORDER(^DIC(40.7,"C",900,0))
+15 SET SCCVMAXE=$SELECT($PIECE($GET(^SD(404.91,1,"CNV")),U,7):$PIECE(^("CNV"),U,7),1:1000)-1
+16 ;
+17 DO SET(SCLOG,SCREQ,.SCACT,.SCCVEVT,.SCSTDT,.SCENDT,.SCRSTPT,.SCRSTDT,.SCBULL,.SCRSTDFN)
+18 ;
+19 ; -- quit if convert or reconvert & conversion disabled
+20 IF SCCVEVT=1!(SCCVEVT=2)
IF '$$OK^SCCVU(0)
GOTO ENQ
+21 ;
+22 ;Log event
+23 DO UPD^SCCVLOG("CST",SCLOG,"","","","","",SCACT)
+24 ;
+25 ;converted
IF $GET(SCCVEVT)=1
IF $$CHKACT^SCCVLOG(SCLOG,SCCVEVT,5,"CST")
Begin DoDot:1
+26 DO GETERR^SCCVLOG1(4049001.008,"","",SCLOG,0,.SCERRMSG)
End DoDot:1
GOTO ENQ
+27 ;
+28 ;start or re-start
IF "^2^4^"'[(U_SCACT_U)
Begin DoDot:1
+29 DO GETERR^SCCVLOG1(4049006.001,"","",SCLOG,0,.SCERRMSG)
+30 DO STOP^SCCVLOG(SCLOG,SCREQ,1)
End DoDot:1
GOTO ENQ
+31 ;
+32 ;start date or end date undefined
IF '$GET(SCSTDT)!('$GET(SCENDT))
Begin DoDot:1
+33 DO GETERR^SCCVLOG1(4049001.003,"","",SCLOG,0,.SCERRMSG)
+34 DO STOP^SCCVLOG(SCLOG,SCREQ,1)
End DoDot:1
GOTO ENQ
+35 ;
+36 ;event undefined
IF $GET(SCCVEVT)=""
Begin DoDot:1
+37 DO GETERR^SCCVLOG1(4049001.009,"","",SCLOG,0,.SCERRMSG)
+38 DO STOP^SCCVLOG(SCLOG,SCREQ,1)
End DoDot:1
GOTO ENQ
+39 ;
+40 ;invalid date range
IF $$VERDT^SCCVU2(SCSTDT,SCENDT,SCLOG)
Begin DoDot:1
+41 DO STOP^SCCVLOG(SCLOG,SCREQ,1)
End DoDot:1
GOTO ENQ
+42 ;
+43 SET (SCCVERRH,SCCVERRT)=+$PIECE($GET(^SD(404.98,SCLOG,1)),U,5)
+44 IF SCCVEVT
SET SCTOT(1.02)=$PIECE($GET(^SD(404.98,SCLOG,1)),U,2)
SET SCTOT(2.06)=$PIECE($GET(^(2)),U,6)
+45 IF 'SCCVEVT
KILL ^XTMP("SCCV-VIS-"_SCLOG),^XTMP("SCCV-BOTH-"_SCLOG)
+46 ;
+47 ;Convert appointments
+48 IF $GET(SCRSTPT)<2
DO EN^SCCVEAP(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,+$GET(SCRSTDFN),.SCSTOPF)
IF $GET(SCSTOPF)
GOTO ENQ
IF $GET(SCRSTPT)
SET (SCRSTDT,SCRSTDFN)=""
+49 ;
+50 ;Convert disposition
+51 IF $SELECT('$GET(SCRSTPT):1,1:SCRSTPT'=2)
DO EN^SCCVEDI(SCCVEVT,$SELECT($GET(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF)
IF $GET(SCSTOPF)
GOTO ENQ
IF $GET(SCRSTPT)
SET (SCRSTDT,SCRSTDFN)=""
+52 ;
+53 ;Convert add/edits
+54 DO EN^SCCVEAE(SCCVEVT,$SELECT($GET(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF)
IF $GET(SCSTOPF)
GOTO ENQ
+55 ;
+56 ;Log completion
+57 DO UPD^SCCVLOG("CST",SCLOG,"","","","@","@",5)
+58 ;
ENQ QUIT
+1 ;
SET(SCLOG,SCREQ,SCACT,SCCVEVT,SCSTDT,SCENDT,SCRSTPT,SCRSTDT,SCBULL,SCRSTDFN) ;
+1 ; Set variables
+2 ; Input -- SCLOG CST log IEN
+3 ; SCREQ CST request IEN
+4 ; Output -- SCACT Action
+5 ; SCCVEVT Conversion event
+6 ; SCSTDT Start date
+7 ; SCENDT End date
+8 ; SCRSTPT Conversion re-start point (1=appt, 2=a/e, 3=disp)
+9 ; SCRSTDT Re-start date
+10 ; SCBULL Send bulletin flag
+11 ; SCRSTDFN Re-start dfn
+12 NEW SCLOG0,SCLOG1,SCOE,SCOE0,SCREQACT
+13 SET SCLOG0=$GET(^SD(404.98,SCLOG,0))
SET SCLOG1=$GET(^(1))
+14 SET SCREQACT=$PIECE($GET(^SD(404.98,SCLOG,"R",SCREQ,0)),U,2)
+15 ;action based on request
SET SCACT=$SELECT(SCREQACT=1:2,SCREQACT=3:4,1:"")
+16 SET SCCVEVT=$PIECE(SCLOG0,U,5)
+17 SET SCSTDT=$PIECE(SCLOG0,U,3)
+18 SET SCENDT=$PIECE(SCLOG0,U,4)
+19 SET SCBULL=$PIECE(SCLOG0,U,6)
+20 ;
+21 ;Only for re-start of conversion
IF +SCLOG1
IF SCCVEVT
IF SCACT=4
Begin DoDot:1
+22 ;last entry
SET SCOE=+SCLOG1
+23 ;re-start at parent
IF $PIECE($GET(^SCE(SCOE,0)),U,6)
SET SCOE=+$PIECE(^(0),U,6)
+24 SET SCOE0=$GET(^SCE(SCOE,0))
+25 ;set re-start point
SET SCRSTPT=+$PIECE(SCOE0,U,8)
SET SCRSTDT=$PIECE(+SCOE0,".")
SET SCRSTDFN=$PIECE(SCOE0,U,2)
End DoDot:1
+26 ;
+27 ;Estimate must start counting over from beginning
IF 'SCCVEVT
Begin DoDot:1
+28 NEW Z,SC2,SCDATA,SCF
+29 SET SC2=$GET(^SD(404.98,SCLOG,2))
+30 FOR Z=1:1:11
IF $PIECE(SC2,U,Z)
SET SCF="2."_$SELECT(Z<10:"0",1:"")_Z
SET SCDATA(+SCF)=0
+31 ;Re-set totals to 0
IF $DATA(SCDATA)
DO UPD^SCCVDBU(404.98,SCLOG,.SCDATA)
End DoDot:1
+32 ;
+33 ;'Start' of re-convert deletes errors and resets counts to 0
IF SCCVEVT=2
IF SCACT'=4
Begin DoDot:1
+34 NEW SCDATA
+35 SET SCDATA(1.05)=0
SET SCDATA(50)="@"
SET SCDATA(2.06)=0
SET SCDATA(1.02)=0
+36 DO UPD^SCCVDBU(404.98,SCLOG,.SCDATA)
End DoDot:1
+37 QUIT
+38 ;
STOP(SCLOG,SCREQ) ;User request to stop conversion
+1 ; Input -- SCLOG CST log IEN
+2 ; SCREQ CST request IEN
+3 ; Output -- None
+4 NEW SCSTOPF
+5 DO STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
+6 QUIT
+7 ;