SCCVCST1 ; ALB/TMP - SCHED VSTS CONV/ARCHIVE - REQUEST/EDIT ; 25-NOV-97
;;5.3;Scheduling;**211,1015**;Aug 13, 1993;Build 21
;
REQ(SCFUNC,SCCVSCRN,ASKBULL) ; -- Schedule request to run/stop
; SCFUNC = 0 if from add new template, 1 if from edit or schedule
; SCCVSCRN = 1 if called from main menu, 2 if called from log menu
; ASKBULL = 1 if user should be asked to answer send bulletin question
; = 0 if user already answered the question during this action
; Assumes SCCVDA = template entry ien from List Manager selection
;
N DA,DIC,DIE,DR,SCCV,SCCV0,SCCV1,SCCVACT,SCCVDA1,SCCVOK,SCCVNOW,SCCV7,SCCV8,SCCV5,SCRESULT,SCSTOP,SCABORT,X,Y
D FULL^VALM1
I $G(SCCVDA),$P($G(^SD(404.98,SCCVDA,0)),U,9) D G REQX
. W *7,!,"You cannot run a canceled template!"
. D PAUSE^SCCVU
I $D(SCCVDONE) D DONE G REQX
I '$G(SCCVDA) D SELX^SCCVDSP("CST",1)
G:'$G(SCCVDA) REQX
;
S SCCV0=$G(^SD(404.98,SCCVDA,0)),SCCV1=$G(^(1)),SCCV7=$P(SCCV0,U,7),SCCV5=$P(SCCV0,U,5),SCCV8=$P(SCCV0,U,8),SCCVACT="",SCABORT=0
;
; -- quit is convert or reconvert and conversion disabled
IF SCCV5=1!(SCCV5=2),'$$OK^SCCVU(1) S SCABORT=1 G REQX
;
I $P(SCCV1,U,3) D G:SCABORT REQX ; Check log's task
. D TASKSTA^SCCVU1(.SCRESULT,SCCVDA)
. Q:$S($G(SCRESULT):0,$P(SCRESULT,U,3)=0:1,"124"[SCCV7:1,1:$P(SCRESULT,U,3)>2)
. W !!,$S($G(SCRESULT):"An error has occurred (",1:"This CST already has a valid task "_$P(SCCV1,U,3)_" (")_$P(SCRESULT,U,2)_")."
. I $G(SCRESULT) D PAUSE^SCCVU K:$G(SCCVSCRN)'=2 SCCVDA S SCABORT=1 Q
;
I SCCV7=5 D G:SCABORT REQX ;Last event completed
.;
. I $P(SCCV0,U,5)=1 D K:$G(SCCVSCRN)'=2 SCCVDA Q ;Convert complete
.. W !!,"This CST has completed converting the data in its date range."
.. W !,"The event must be 'RE-CONVERT' in order to run this CST again."
.. D PAUSE^SCCVU
.. S SCABORT=1
.;
. I $P(SCCV0,U,5)=2 D Q ;Re-convert complete
.. S DIR(0)="YA",DIR("B")="NO",DIR("A",1)="You are about to request a RE-CONVERT event 'again' using this CST."
.. S DIR("A")="Are you sure you want to do this?: "
.. D ^DIR K DIR
.. I Y'=1 K:$G(SCCVSCRN)'=2 SCCVDA S SCABORT=1
.;
. I '$P(SCCV0,U,5) D Q ;Estimate complete
.. S DIR(0)="YA",DIR("B")="NO"
.. S DIR("A",1)=" ",DIR("A",2)="This CST has already completed an ESTIMATE event.",DIR("A",3)="Re-running the ESTIMATE will delete the totals previously stored."
.. S DIR("A")="Are you sure you want to do this?: "
.. D ^DIR K DIR
.. I Y'=1 K:$G(SCCVSCRN)'=2 SCCVDA S SCABORT=1
;
W !!,"Requested Event : ",$$EXPAND^SCCVDSP2(404.98,.05,$P(SCCV0,U,5))
W !,"Last Event Status : ",$$EXPAND^SCCVDSP2(404.98,.07,$P(SCCV0,U,7))
W !,"Last Requested Action: ",$$NONE^SCCVDSP2(404.98,.08,$P(SCCV0,U,8),"<No action requested>"),!
;
D G:SCCVACT'>0 REQX
.I SCCV7<2 S SCCVACT=1 Q ;Never started
.S DIR(0)="SABM^"
.I SCCV5 S DIR(0)=DIR(0)_$S(SCCV7'=5&(SCCV5=1):"1:SCHEDULE;",SCCV7=5&(SCCV5=2):"1:SCHEDULE",1:"")_$S(SCCV7'=5:"2:STOP;3:RE-START",1:"")
.I 'SCCV5 S DIR(0)=DIR(0)_$S(SCCV7'=4:"1:SCHEDULE"_$S(SCCV7'=5:";",1:""),1:"")_$S(SCCV7'=5:"2:STOP",1:"")
.S DIR("A")="Request Action: "
.I SCCV5 S DIR("B")=$S("23"[SCCV7:"RE-START",SCCV7=5:"SCHEDULE",1:"STOP")
.I 'SCCV5 S DIR("B")=$S("35"[SCCV7:"SCHEDULE",1:"STOP")
.W !
.D ^DIR K DIR
.S SCCVACT=+Y
.IF SCCVACT'>0 S SCCVACT="" Q
.I $S(SCCVACT=2:SCCV7=3,SCCVACT=1!(SCCVACT=3):SCCV7=2!(SCCV7=4)!(SCCV7=6),1:0) D
..S Z=1,DIR(0)="YA",DIR("B")="NO"
..S:SCCVACT=2 DIR("A",1)="You are requesting to STOP the running of this CST.",Z=Z+1
..S DIR("A",Z)="This ACTION is the same(or similar) as the previous action on this CST."
..S DIR("A")="Are you sure you want to do this?: "
..D ^DIR K DIR
..I Y'=1 S SCCVACT=""
I SCCVACT=2 D G:SCCVACT'>0 REQX
.S SCSTOP=1
.I SCCV7'=3 S DIR(0)="YA",DIR("A",1)="You are requesting to STOP the running of this CST.",DIR("A")="Are you sure you want to do this?: ",DIR("B")="NO" D ^DIR K DIR I Y'=1 S SCCVACT=""
S SCCVOK=0 K SCCVDA1
S DIE="^SD(404.98,",DR="[SCCV SCHEDULE REQUEST]",DA=SCCVDA
D ^DIE
I 'SCCVOK D:$G(SCCVDA1) NOTDONE G REQX
;
S SCCV("TEMPLNO")=SCCVDA,SCCV("REQNUM")=SCCVDA1
D PROCREQ^SCCVU1(.SCRESULT,.SCCV)
;
I $G(SCFUNC) D
.I $G(SCCVSCRN)=2 D BLD^SCCVCDS1
.I $G(SCCVSCRN)=1 D BLD^SCCVDSP("CST")
REQX S VALMBCK="R"
I $G(SCCVSCRN)'=2 K SCCVDA
Q
;
NOTDONE ; -- all needed fields not answered - delete entry
N DIK,DA,X,Y
S DA(1)=SCCVDA,DA=SCCVDA1,DIK="^SD(404.98,"_DA(1)_",""R""," D ^DIK
W !,"All fields must be answered. Nothing has been scheduled."
D PAUSE^SCCVU
Q
;
EDIT(SCCVSCRN) ; -- Edit the selected CST
N DA,DIC,DIE,DIR,DR,SCCV,SCCVX,SCCV0,SCCV1,SCCVY,SCRERUN,X,Y
;
D FULL^VALM1
I $G(SCCVDA),$P($G(^SD(404.98,SCCVDA,0)),U,9) D G EDITX
.W *7,!,"You cannot edit a canceled template!"
.D PAUSE^SCCVU
I $G(SCCVDONE) D DONE G EDITX
I $G(SCCVSCRN)=1 N SCCVDA D SELX^SCCVDSP("CST",1)
G:'$G(SCCVDA) EDITX
;
S SCCV0=$G(^SD(404.98,SCCVDA,0)),SCCV1=$G(^(1))
S SCCV("STARTDT")=$P(SCCV0,U,3),SCCV("ENDDT")=$P(SCCV0,U,4)
S SCCVY=""
;
IF $P(SCCV0,U,5),$P(SCCV0,U,7)=5 S SCRERUN=0 D G:'SCRERUN EDITX
. W !!,"This template has completed its "_$P("^re-",U,$P(SCCV0,U,5))_"conversion."
. ; -- site parameter must allow re-convert
. IF '$P($G(^SD(404.91,1,"CNV")),U,6) D PAUSE^SCCVU Q
. ;
. S DIR("A")="Do you want to request a"_$P("^nother",U,$P(SCCV0,U,5))_" 'RE-CONVERT' to be run for this CST?: "
. S DIR(0)="YA",DIR("B")="NO"
. D ^DIR K DIR
. IF Y S SCCVY="@12",SCRERUN=1
;
S DIE("NO^")="",DIE="^SD(404.98,",DA=SCCVDA,DR="[SCCV EDIT TEMPLATE]",SCCVY=$S(SCCVY'="":SCCVY,$P(SCCV1,U,2):"@15",$$CNVTSCH^SCCVU1(SCCVDA):"@15",1:"@5") D ^DIE K DIE
S SCCV0=$G(^SD(404.98,SCCVDA,0))
W !
S DIR(0)="YA",DIR("A")="Do you want to schedule this "_$$EXPAND^SCCVDSP2(404.98,.05,$P(SCCV0,U,5))_" event to run?: ",DIR("B")="YES" D ^DIR K DIR
D
.I Y D REQ(1,$G(SCCVSCRN),0) Q
.I $G(SCCVSCRN)=2 D BLD^SCCVCDS1,HDR^SCCVDSP1(SCCVDA,"CST")
.I $G(SCCVSCRN)=1 D BLD^SCCVDSP("CST")
EDITX S VALMBCK="R"
Q
;
BULL ; Re-generate bulletin for estimate
N SCCVSENT,SCEST,Z
D FULL^VALM1
;
I $D(SCCVDONE) D DONE G BULLX
I $G(SCCVSCRN)=1 N SCCVDA D SELX^SCCVDSP("CST")
G:'$G(SCCVDA) BULLX
;
S SCEST=$$CHKACT^SCCVLOG(SCCVDA,0,5,"CST")
;
I 'SCEST D G BULLX
. W !,"The CST must have a completed ESTIMATE event to re-generate the bulletin."
. D PAUSE^SCCVU
;
D MAILSUM^SCCVEGD0(SCCVDA,.SCCVSENT)
;
W !,"Estimate bulletin "_$S($G(SCCVSENT):"has been sent to "_SCCVSENT_" user"_$S(SCCVSENT>1:"s",1:""),1:"was not generated due to an error - try agin later")_"."
D PAUSE^SCCVU
;
BULLX S VALMBCK="R"
Q
;
CANCEL ; Cancel a selected CST that has not been completely converted
N SCCVLST,SCCVEVT,SCCVACT,SCCVOK
D FULL^VALM1
I $D(SCCVDONE) D DONE G CANCQ
I $G(SCCVSCRN)=1 N SCCVDA D SELX^SCCVDSP("CST",1)
G:'$G(SCCVDA) CANCQ
;
S SCCV0=$G(^SD(404.98,SCCVDA,0))
S SCCVLST=+$$LSTACT^SCCVLOG(SCCVDA)
S SCCVEVT=+$$LSTEVT^SCCVLOG(SCCVDA)
S SCCVOK=0
;
; Check: If reconvert or convert, did it ever finish?
I SCCVEVT=0 S SCCVOK=1
I (SCCVEVT=1!(SCCVEVT=2)),'$$CHKACT^SCCVLOG(SCCVDA,SCCVEVT,5,"CST") S SCCVOK=1
;
I 'SCCVOK D G CANCQ
. W !,"This template has "_$S(SCCVEVT<3:"completed successfully and does not need to be canceled",1:"already been canceled")_"."
. D PAUSE^SCCVU
;
I SCCVEVT,SCCVOK S DIR("A",1)="This CST has started, but has not successfully completed running."
W !
S DIR(0)="YA",DIR("A")="Are you sure you want to cancel this CST? ",DIR("B")="NO" D ^DIR K DIR
G:Y'=1 CANCQ
W !
S DIE="^SD(404.98,",DR="[SCCV CONV CANCEL]",DA=SCCVDA D ^DIE
I $G(SCCVSCRN)=2 D BLD^SCCVCDS1,HDR^SCCVDSP1(SCCVDA,"CST")
I $G(SCCVSCRN)=1 D BLD^SCCVDSP("CST")
;
CANCQ S VALMBCK="R"
Q
;
DONE ; Message to say complete is over
W *7,!!,"Conversion is complete - this function is invalid!"
D PAUSE^SCCVU
Q
;
SCCVCST1 ; ALB/TMP - SCHED VSTS CONV/ARCHIVE - REQUEST/EDIT ; 25-NOV-97
+1 ;;5.3;Scheduling;**211,1015**;Aug 13, 1993;Build 21
+2 ;
REQ(SCFUNC,SCCVSCRN,ASKBULL) ; -- Schedule request to run/stop
+1 ; SCFUNC = 0 if from add new template, 1 if from edit or schedule
+2 ; SCCVSCRN = 1 if called from main menu, 2 if called from log menu
+3 ; ASKBULL = 1 if user should be asked to answer send bulletin question
+4 ; = 0 if user already answered the question during this action
+5 ; Assumes SCCVDA = template entry ien from List Manager selection
+6 ;
+7 NEW DA,DIC,DIE,DR,SCCV,SCCV0,SCCV1,SCCVACT,SCCVDA1,SCCVOK,SCCVNOW,SCCV7,SCCV8,SCCV5,SCRESULT,SCSTOP,SCABORT,X,Y
+8 DO FULL^VALM1
+9 IF $GET(SCCVDA)
IF $PIECE($GET(^SD(404.98,SCCVDA,0)),U,9)
Begin DoDot:1
+10 WRITE *7,!,"You cannot run a canceled template!"
+11 DO PAUSE^SCCVU
End DoDot:1
GOTO REQX
+12 IF $DATA(SCCVDONE)
DO DONE
GOTO REQX
+13 IF '$GET(SCCVDA)
DO SELX^SCCVDSP("CST",1)
+14 IF '$GET(SCCVDA)
GOTO REQX
+15 ;
+16 SET SCCV0=$GET(^SD(404.98,SCCVDA,0))
SET SCCV1=$GET(^(1))
SET SCCV7=$PIECE(SCCV0,U,7)
SET SCCV5=$PIECE(SCCV0,U,5)
SET SCCV8=$PIECE(SCCV0,U,8)
SET SCCVACT=""
SET SCABORT=0
+17 ;
+18 ; -- quit is convert or reconvert and conversion disabled
+19 IF SCCV5=1!(SCCV5=2)
IF '$$OK^SCCVU(1)
SET SCABORT=1
GOTO REQX
+20 ;
+21 ; Check log's task
IF $PIECE(SCCV1,U,3)
Begin DoDot:1
+22 DO TASKSTA^SCCVU1(.SCRESULT,SCCVDA)
+23 IF $SELECT($GET(SCRESULT)
QUIT
+24 WRITE !!,$SELECT($GET(SCRESULT):"An error has occurred (",1:"This CST already has a valid task "_$PIECE(SCCV1,U,3)_" (")_$PIECE(SCRESULT,U,2)_")."
+25 IF $GET(SCRESULT)
DO PAUSE^SCCVU
IF $GET(SCCVSCRN)'=2
KILL SCCVDA
SET SCABORT=1
QUIT
End DoDot:1
IF SCABORT
GOTO REQX
+26 ;
+27 ;Last event completed
IF SCCV7=5
Begin DoDot:1
+28 ;
+29 ;Convert complete
IF $PIECE(SCCV0,U,5)=1
Begin DoDot:2
+30 WRITE !!,"This CST has completed converting the data in its date range."
+31 WRITE !,"The event must be 'RE-CONVERT' in order to run this CST again."
+32 DO PAUSE^SCCVU
+33 SET SCABORT=1
End DoDot:2
IF $GET(SCCVSCRN)'=2
KILL SCCVDA
QUIT
+34 ;
+35 ;Re-convert complete
IF $PIECE(SCCV0,U,5)=2
Begin DoDot:2
+36 SET DIR(0)="YA"
SET DIR("B")="NO"
SET DIR("A",1)="You are about to request a RE-CONVERT event 'again' using this CST."
+37 SET DIR("A")="Are you sure you want to do this?: "
+38 DO ^DIR
KILL DIR
+39 IF Y'=1
IF $GET(SCCVSCRN)'=2
KILL SCCVDA
SET SCABORT=1
End DoDot:2
QUIT
+40 ;
+41 ;Estimate complete
IF '$PIECE(SCCV0,U,5)
Begin DoDot:2
+42 SET DIR(0)="YA"
SET DIR("B")="NO"
+43 SET DIR("A",1)=" "
SET DIR("A",2)="This CST has already completed an ESTIMATE event."
SET DIR("A",3)="Re-running the ESTIMATE will delete the totals previously stored."
+44 SET DIR("A")="Are you sure you want to do this?: "
+45 DO ^DIR
KILL DIR
+46 IF Y'=1
IF $GET(SCCVSCRN)'=2
KILL SCCVDA
SET SCABORT=1
End DoDot:2
QUIT
End DoDot:1
IF SCABORT
GOTO REQX
+47 ;
+48 WRITE !!,"Requested Event : ",$$EXPAND^SCCVDSP2(404.98,.05,$PIECE(SCCV0,U,5))
+49 WRITE !,"Last Event Status : ",$$EXPAND^SCCVDSP2(404.98,.07,$PIECE(SCCV0,U,7))
+50 WRITE !,"Last Requested Action: ",$$NONE^SCCVDSP2(404.98,.08,$PIECE(SCCV0,U,8),"<No action requested>"),!
+51 ;
+52 Begin DoDot:1
+53 ;Never started
IF SCCV7<2
SET SCCVACT=1
QUIT
+54 SET DIR(0)="SABM^"
+55 IF SCCV5
SET DIR(0)=DIR(0)_$SELECT(SCCV7'=5&(SCCV5=1):"1:SCHEDULE;",SCCV7=5&(SCCV5=2):"1:SCHEDULE",1:"")_$SELECT(SCCV7'=5:"2:STOP;3:RE-START",1:"")
+56 IF 'SCCV5
SET DIR(0)=DIR(0)_$SELECT(SCCV7'=4:"1:SCHEDULE"_$SELECT(SCCV7'=5:";",1:""),1:"")_$SELECT(SCCV7'=5:"2:STOP",1:"")
+57 SET DIR("A")="Request Action: "
+58 IF SCCV5
SET DIR("B")=$SELECT("23"[SCCV7:"RE-START",SCCV7=5:"SCHEDULE",1:"STOP")
+59 IF 'SCCV5
SET DIR("B")=$SELECT("35"[SCCV7:"SCHEDULE",1:"STOP")
+60 WRITE !
+61 DO ^DIR
KILL DIR
+62 SET SCCVACT=+Y
+63 IF SCCVACT'>0
SET SCCVACT=""
QUIT
+64 IF $SELECT(SCCVACT=2:SCCV7=3,SCCVACT=1!(SCCVACT=3):SCCV7=2!(SCCV7=4)!(SCCV7=6),1:0)
Begin DoDot:2
+65 SET Z=1
SET DIR(0)="YA"
SET DIR("B")="NO"
+66 IF SCCVACT=2
SET DIR("A",1)="You are requesting to STOP the running of this CST."
SET Z=Z+1
+67 SET DIR("A",Z)="This ACTION is the same(or similar) as the previous action on this CST."
+68 SET DIR("A")="Are you sure you want to do this?: "
+69 DO ^DIR
KILL DIR
+70 IF Y'=1
SET SCCVACT=""
End DoDot:2
End DoDot:1
IF SCCVACT'>0
GOTO REQX
+71 IF SCCVACT=2
Begin DoDot:1
+72 SET SCSTOP=1
+73 IF SCCV7'=3
SET DIR(0)="YA"
SET DIR("A",1)="You are requesting to STOP the running of this CST."
SET DIR("A")="Are you sure you want to do this?: "
SET DIR("B")="NO"
DO ^DIR
KILL DIR
IF Y'=1
SET SCCVACT=""
End DoDot:1
IF SCCVACT'>0
GOTO REQX
+74 SET SCCVOK=0
KILL SCCVDA1
+75 SET DIE="^SD(404.98,"
SET DR="[SCCV SCHEDULE REQUEST]"
SET DA=SCCVDA
+76 DO ^DIE
+77 IF 'SCCVOK
IF $GET(SCCVDA1)
DO NOTDONE
GOTO REQX
+78 ;
+79 SET SCCV("TEMPLNO")=SCCVDA
SET SCCV("REQNUM")=SCCVDA1
+80 DO PROCREQ^SCCVU1(.SCRESULT,.SCCV)
+81 ;
+82 IF $GET(SCFUNC)
Begin DoDot:1
+83 IF $GET(SCCVSCRN)=2
DO BLD^SCCVCDS1
+84 IF $GET(SCCVSCRN)=1
DO BLD^SCCVDSP("CST")
End DoDot:1
REQX SET VALMBCK="R"
+1 IF $GET(SCCVSCRN)'=2
KILL SCCVDA
+2 QUIT
+3 ;
NOTDONE ; -- all needed fields not answered - delete entry
+1 NEW DIK,DA,X,Y
+2 SET DA(1)=SCCVDA
SET DA=SCCVDA1
SET DIK="^SD(404.98,"_DA(1)_",""R"","
DO ^DIK
+3 WRITE !,"All fields must be answered. Nothing has been scheduled."
+4 DO PAUSE^SCCVU
+5 QUIT
+6 ;
EDIT(SCCVSCRN) ; -- Edit the selected CST
+1 NEW DA,DIC,DIE,DIR,DR,SCCV,SCCVX,SCCV0,SCCV1,SCCVY,SCRERUN,X,Y
+2 ;
+3 DO FULL^VALM1
+4 IF $GET(SCCVDA)
IF $PIECE($GET(^SD(404.98,SCCVDA,0)),U,9)
Begin DoDot:1
+5 WRITE *7,!,"You cannot edit a canceled template!"
+6 DO PAUSE^SCCVU
End DoDot:1
GOTO EDITX
+7 IF $GET(SCCVDONE)
DO DONE
GOTO EDITX
+8 IF $GET(SCCVSCRN)=1
NEW SCCVDA
DO SELX^SCCVDSP("CST",1)
+9 IF '$GET(SCCVDA)
GOTO EDITX
+10 ;
+11 SET SCCV0=$GET(^SD(404.98,SCCVDA,0))
SET SCCV1=$GET(^(1))
+12 SET SCCV("STARTDT")=$PIECE(SCCV0,U,3)
SET SCCV("ENDDT")=$PIECE(SCCV0,U,4)
+13 SET SCCVY=""
+14 ;
+15 IF $PIECE(SCCV0,U,5)
IF $PIECE(SCCV0,U,7)=5
SET SCRERUN=0
Begin DoDot:1
+16 WRITE !!,"This template has completed its "_$PIECE("^re-",U,$PIECE(SCCV0,U,5))_"conversion."
+17 ; -- site parameter must allow re-convert
+18 IF '$PIECE($GET(^SD(404.91,1,"CNV")),U,6)
DO PAUSE^SCCVU
QUIT
+19 ;
+20 SET DIR("A")="Do you want to request a"_$PIECE("^nother",U,$PIECE(SCCV0,U,5))_" 'RE-CONVERT' to be run for this CST?: "
+21 SET DIR(0)="YA"
SET DIR("B")="NO"
+22 DO ^DIR
KILL DIR
+23 IF Y
SET SCCVY="@12"
SET SCRERUN=1
End DoDot:1
IF 'SCRERUN
GOTO EDITX
+24 ;
+25 SET DIE("NO^")=""
SET DIE="^SD(404.98,"
SET DA=SCCVDA
SET DR="[SCCV EDIT TEMPLATE]"
SET SCCVY=$SELECT(SCCVY'="":SCCVY,$PIECE(SCCV1,U,2):"@15",$$CNVTSCH^SCCVU1(SCCVDA):"@15",1:"@5")
DO ^DIE
KILL DIE
+26 SET SCCV0=$GET(^SD(404.98,SCCVDA,0))
+27 WRITE !
+28 SET DIR(0)="YA"
SET DIR("A")="Do you want to schedule this "_$$EXPAND^SCCVDSP2(404.98,.05,$PIECE(SCCV0,U,5))_" event to run?: "
SET DIR("B")="YES"
DO ^DIR
KILL DIR
+29 Begin DoDot:1
+30 IF Y
DO REQ(1,$GET(SCCVSCRN),0)
QUIT
+31 IF $GET(SCCVSCRN)=2
DO BLD^SCCVCDS1
DO HDR^SCCVDSP1(SCCVDA,"CST")
+32 IF $GET(SCCVSCRN)=1
DO BLD^SCCVDSP("CST")
End DoDot:1
EDITX SET VALMBCK="R"
+1 QUIT
+2 ;
BULL ; Re-generate bulletin for estimate
+1 NEW SCCVSENT,SCEST,Z
+2 DO FULL^VALM1
+3 ;
+4 IF $DATA(SCCVDONE)
DO DONE
GOTO BULLX
+5 IF $GET(SCCVSCRN)=1
NEW SCCVDA
DO SELX^SCCVDSP("CST")
+6 IF '$GET(SCCVDA)
GOTO BULLX
+7 ;
+8 SET SCEST=$$CHKACT^SCCVLOG(SCCVDA,0,5,"CST")
+9 ;
+10 IF 'SCEST
Begin DoDot:1
+11 WRITE !,"The CST must have a completed ESTIMATE event to re-generate the bulletin."
+12 DO PAUSE^SCCVU
End DoDot:1
GOTO BULLX
+13 ;
+14 DO MAILSUM^SCCVEGD0(SCCVDA,.SCCVSENT)
+15 ;
+16 WRITE !,"Estimate bulletin "_$SELECT($GET(SCCVSENT):"has been sent to "_SCCVSENT_" user"_$SELECT(SCCVSENT>1:"s",1:""),1:"was not generated due to an error - try agin later")_"."
+17 DO PAUSE^SCCVU
+18 ;
BULLX SET VALMBCK="R"
+1 QUIT
+2 ;
CANCEL ; Cancel a selected CST that has not been completely converted
+1 NEW SCCVLST,SCCVEVT,SCCVACT,SCCVOK
+2 DO FULL^VALM1
+3 IF $DATA(SCCVDONE)
DO DONE
GOTO CANCQ
+4 IF $GET(SCCVSCRN)=1
NEW SCCVDA
DO SELX^SCCVDSP("CST",1)
+5 IF '$GET(SCCVDA)
GOTO CANCQ
+6 ;
+7 SET SCCV0=$GET(^SD(404.98,SCCVDA,0))
+8 SET SCCVLST=+$$LSTACT^SCCVLOG(SCCVDA)
+9 SET SCCVEVT=+$$LSTEVT^SCCVLOG(SCCVDA)
+10 SET SCCVOK=0
+11 ;
+12 ; Check: If reconvert or convert, did it ever finish?
+13 IF SCCVEVT=0
SET SCCVOK=1
+14 IF (SCCVEVT=1!(SCCVEVT=2))
IF '$$CHKACT^SCCVLOG(SCCVDA,SCCVEVT,5,"CST")
SET SCCVOK=1
+15 ;
+16 IF 'SCCVOK
Begin DoDot:1
+17 WRITE !,"This template has "_$SELECT(SCCVEVT<3:"completed successfully and does not need to be canceled",1:"already been canceled")_"."
+18 DO PAUSE^SCCVU
End DoDot:1
GOTO CANCQ
+19 ;
+20 IF SCCVEVT
IF SCCVOK
SET DIR("A",1)="This CST has started, but has not successfully completed running."
+21 WRITE !
+22 SET DIR(0)="YA"
SET DIR("A")="Are you sure you want to cancel this CST? "
SET DIR("B")="NO"
DO ^DIR
KILL DIR
+23 IF Y'=1
GOTO CANCQ
+24 WRITE !
+25 SET DIE="^SD(404.98,"
SET DR="[SCCV CONV CANCEL]"
SET DA=SCCVDA
DO ^DIE
+26 IF $GET(SCCVSCRN)=2
DO BLD^SCCVCDS1
DO HDR^SCCVDSP1(SCCVDA,"CST")
+27 IF $GET(SCCVSCRN)=1
DO BLD^SCCVDSP("CST")
+28 ;
CANCQ SET VALMBCK="R"
+1 QUIT
+2 ;
DONE ; Message to say complete is over
+1 WRITE *7,!!,"Conversion is complete - this function is invalid!"
+2 DO PAUSE^SCCVU
+3 QUIT
+4 ;