SCMCCV1 ;ALB/JLU;PC Attending conversion;5/6/99
;;5.3;Scheduling;**195,1015**;AUG 13, 1993;Build 21
;
MAIN I $$XTMP() D XTMPW G MAINQ ;is there another conversion job?
;
N SCMCTM,SCMCPOS,SCMCSTOP,SCMCFIX,SCMCTYPE
S SCMCSTOP=0
;
S SCMCFIX=$$CNTFIX ;fix or check mode?
I SCMCFIX=0 G MAINQ ;uparrowed out
;
S SCMCSTOP=$$ASKQUEST ;how to sort for conversion? SETS SCMCTM, SCMCPOS
I SCMCSTOP G MAIN Q
;
D SUMARIZE ; display what was selected
S SCMCSTOP=$$ASKCONT ;ask user if they wish to continue.
I SCMCSTOP G MAINQ
;
D QOFF ;queue off the conversion job
;
MAINQ Q
;
XTMPW ;writes to the user.
;
N VAR
S VAR=$O(^XTMP("SCMCATTCONV",0))
;
W *7,!!,"A conversion job (#"_VAR_") has already been started."
W !,"You will not be able to start another conversion job until this one finishes.",!!
D PAUSE^SCMCMU1
Q
;
XTMP() ;checks to see if another job is running.
;
Q $S($D(^XTMP("SCMCATTCONV")):1,1:0)
;
CNTFIX() ;ask the user if they want to FIX(Convert) or CHECK
;Output F for FIX mode
; C for Check mode
;
N DIR
S DIR(0)="SM^C:CHECK;F:FIX"
S DIR("?")="Check mode will only count the entries that could or could not be converted."
S DIR("?",1)="Fix mode will actually convert these entries."
S DIR("A")="In which mode would you like to run the conversion?"
D ^DIR
Q $S($D(DIRUT):0,1:Y)
;
ASKQUEST() ;askes the user how they wish to sort or break up the conversion.
;Outputs
;sets up the SCMCTM and SCMCPOS arrays
;returns a 1 if to stop
;returns a zero to not stop
;
N STOP
S STOP=0
S SCMCTYPE=$$TYPE() ;gets the type of selection (team, position or all)
I SCMCTYPE=0 S STOP=1 G ASKQSTQ
;
I SCMCTYPE="T" D TMLP S:'$D(SCMCTM) STOP=1 ;team selection
;
I SCMCTYPE="P" D POS S:'$D(SCMCTM)!('$D(SCMCPOS)) STOP=1 ;position selection
;
I SCMCTYPE="A" K SCMCTM,SCMCPOS
;
ASKQSTQ Q STOP
;
;
TYPE() ;askes the user how they wish to sort or select the conversion.
;A for All teams and positions
;T for by selecting teams. All positions for each team.
;P for by selection positions. Only one team and specific positions.
;
;returns a zero to quit
;returns a one to continue
;
N DIR
S DIR(0)="SM^A:All teams and positions;T:Specific teams;P:One team, specifc positions"
S DIR("?",1)="Select A for a conversion of all teams and all positions on those teams."
S DIR("?",2)="Select T to select specific teams. All positions for each team are reviewed."
S DIR("?",3)="Select P to be able to select specific positions from a single team."
S DIR("?")=" "
;
D ^DIR
Q $S($D(DIRUT):0,1:Y)
;
;
TMLP ;allows the user to select which teams. Allows the selection of
;multiple teams.
;sets up the SCMCTM array with the teams
;sets stop=1 if need to stop
;
N SCSTOP
S SCSTOP=0
F D I SCSTOP Q
.N TM
.S TM=$$TEAM^SCMCMU(DT)
.I TM>0 S SCMCTM(TM)=""
.E S SCSTOP=1
.Q
Q
;
POSLP(TM) ;allows the user to select one team and multiple positions from that
;team.
;the SCMCTM and SCMCPOS arrays will be populated.
;
N SCSTOP
S SCSTOP=0
K SCMCPOS
F DO I SCSTOP Q
.N POS
.S POS=$$POS^SCMCMU(TM,DT) ; get positions using today.
.I POS>0 S SCMCPOS(POS)=""
.E S SCSTOP=1
.Q
Q
;
POS ;gets the team first then calls POSLP to get the positions
;populates the SCMCTM array
;
N TTM
K SCMCTM
S TTM=$$TEAM^SCMCMU(DT)
I TTM>0 DO
.S SCMCTM(TTM)=""
.D POSLP(TTM)
.Q
Q
;
;
SUMARIZE ;presents the selections to the user.
;
W !!!,"You have made the following selections."
W !,"Please verify they are what you want:",!
;
I SCMCTYPE="A" D TYPEA
I SCMCTYPE="T" D TYPET
I SCMCTYPE="P" D TYPEP
;
W !!,*7,"** This job will be run in a ",$S(SCMCFIX="F":"FIX",1:"CHECK")," mode. **",!
Q
;
;
TYPEA ;
W !,"You have selected to convert assignments in all teams and positions."
Q
;
;
TYPET ;
N VAR
W !,"You have selected to convert PC Attending assignments in the following teams:"
;
S VAR=0
F S VAR=$O(SCMCTM(VAR)) Q:VAR="" W !,$P(^SCTM(404.51,VAR,0),U,1)
;
W !!,"All position assignments for each team will be reviewed."
Q
;
;
TYPEP ;
N LP,VAR
S VAR=$O(SCMCTM(0)) Q:VAR=""
;
W !,"You have selected to convert PC Attending assignments for team:"
W !,$P(^SCTM(404.51,VAR,0),U,1)
W !!,"The positions that were selected are:"
;
S VAR=0
F S VAR=$O(SCMCPOS(VAR)) Q:VAR="" W !,$P(^SCTM(404.57,VAR,0),U,1)
Q
;
;
ASKCONT() ;ask the user if they wish to continue.
;
N Y,DIR
S DIR(0)="Y^"
S DIR("A")="Are these selections correct? Do you wish to continue"
D ^DIR
Q $S(Y=1:0,1:1) ; CHANGING TO MATCH STOP FORMAT.
;
;
SETLOCK ; sets the global to lock out other attempted jobs
;
S ^XTMP("SCMCATTCONV",0)=DT+1_"^"_DT
Q
;
;
QOFF ;queue the task off to be processed in the background.
;
N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSAVE
S ZTRTN="STRTQJOB^SCMCCV2"
S ZTDESC="PCMM conversion of PC Attending assignments."
S ZTDTH=$H
S ZTIO=""
S ZTSAVE("SCMCTM(")=""
S ZTSAVE("SCMCPOS(")=""
S ZTSAVE("SCMCFIX")=""
S ZTSAVE("SCMCTYPE")=""
D ^%ZTLOAD
I $D(ZTSK) W !!,"Task queued. ",ZTSK D SETLOCK ;LOCKS FOR NEXT ATTEMPT
E W !!,"Task NOT queued."
K ZTSK
Q
;
;
FUTURE ;checks if can make an assignment for today.
;
N VARTWO
K ERR
S VARTWO=$$YSPTTPPC^SCMCTPU2(DFN,DT,1)
I 'VARTWO S ERR="-"_$P(VARTWO,U,2) D SETERR^SCMCCV2(ERR) Q
S REASSIGN=1
Q
;
;
REOPEN ;reactivate old assignment.
;
N DA,DR,DIE
S DIE="^SCPT(404.43,"
S DA=POSASGN
D NOW^%DTC
S DR=".04///@;.08///"_$G(DUZ,.5)_";.09///"_%
K X
D ^DIE
Q
;
;
CHANGE(AIEN) ;the actual FM call to convert.
N DIE,DA,DR
S DIE="^SCPT(404.43,"
S DA=AIEN
S DR=".05///1"
D ^DIE
Q
;
;
INIT ;set up variables
;
S XMDUZ=.5
S XMY($S($G(DUZ):DUZ,1:XMDUZ))=""
S XMSUB="PC Attending conversion"
S XMTEXT="^TMP(""SCMC"",$J,""MSG"","
S CNTR=0
Q
SCMCCV1 ;ALB/JLU;PC Attending conversion;5/6/99
+1 ;;5.3;Scheduling;**195,1015**;AUG 13, 1993;Build 21
+2 ;
MAIN ;is there another conversion job?
IF $$XTMP()
DO XTMPW
GOTO MAINQ
+1 ;
+2 NEW SCMCTM,SCMCPOS,SCMCSTOP,SCMCFIX,SCMCTYPE
+3 SET SCMCSTOP=0
+4 ;
+5 ;fix or check mode?
SET SCMCFIX=$$CNTFIX
+6 ;uparrowed out
IF SCMCFIX=0
GOTO MAINQ
+7 ;
+8 ;how to sort for conversion? SETS SCMCTM, SCMCPOS
SET SCMCSTOP=$$ASKQUEST
+9 IF SCMCSTOP
GOTO MAIN
QUIT
+10 ;
+11 ; display what was selected
DO SUMARIZE
+12 ;ask user if they wish to continue.
SET SCMCSTOP=$$ASKCONT
+13 IF SCMCSTOP
GOTO MAINQ
+14 ;
+15 ;queue off the conversion job
DO QOFF
+16 ;
MAINQ QUIT
+1 ;
XTMPW ;writes to the user.
+1 ;
+2 NEW VAR
+3 SET VAR=$ORDER(^XTMP("SCMCATTCONV",0))
+4 ;
+5 WRITE *7,!!,"A conversion job (#"_VAR_") has already been started."
+6 WRITE !,"You will not be able to start another conversion job until this one finishes.",!!
+7 DO PAUSE^SCMCMU1
+8 QUIT
+9 ;
XTMP() ;checks to see if another job is running.
+1 ;
+2 QUIT $SELECT($DATA(^XTMP("SCMCATTCONV")):1,1:0)
+3 ;
CNTFIX() ;ask the user if they want to FIX(Convert) or CHECK
+1 ;Output F for FIX mode
+2 ; C for Check mode
+3 ;
+4 NEW DIR
+5 SET DIR(0)="SM^C:CHECK;F:FIX"
+6 SET DIR("?")="Check mode will only count the entries that could or could not be converted."
+7 SET DIR("?",1)="Fix mode will actually convert these entries."
+8 SET DIR("A")="In which mode would you like to run the conversion?"
+9 DO ^DIR
+10 QUIT $SELECT($DATA(DIRUT):0,1:Y)
+11 ;
ASKQUEST() ;askes the user how they wish to sort or break up the conversion.
+1 ;Outputs
+2 ;sets up the SCMCTM and SCMCPOS arrays
+3 ;returns a 1 if to stop
+4 ;returns a zero to not stop
+5 ;
+6 NEW STOP
+7 SET STOP=0
+8 ;gets the type of selection (team, position or all)
SET SCMCTYPE=$$TYPE()
+9 IF SCMCTYPE=0
SET STOP=1
GOTO ASKQSTQ
+10 ;
+11 ;team selection
IF SCMCTYPE="T"
DO TMLP
IF '$DATA(SCMCTM)
SET STOP=1
+12 ;
+13 ;position selection
IF SCMCTYPE="P"
DO POS
IF '$DATA(SCMCTM)!('$DATA(SCMCPOS))
SET STOP=1
+14 ;
+15 IF SCMCTYPE="A"
KILL SCMCTM,SCMCPOS
+16 ;
ASKQSTQ QUIT STOP
+1 ;
+2 ;
TYPE() ;askes the user how they wish to sort or select the conversion.
+1 ;A for All teams and positions
+2 ;T for by selecting teams. All positions for each team.
+3 ;P for by selection positions. Only one team and specific positions.
+4 ;
+5 ;returns a zero to quit
+6 ;returns a one to continue
+7 ;
+8 NEW DIR
+9 SET DIR(0)="SM^A:All teams and positions;T:Specific teams;P:One team, specifc positions"
+10 SET DIR("?",1)="Select A for a conversion of all teams and all positions on those teams."
+11 SET DIR("?",2)="Select T to select specific teams. All positions for each team are reviewed."
+12 SET DIR("?",3)="Select P to be able to select specific positions from a single team."
+13 SET DIR("?")=" "
+14 ;
+15 DO ^DIR
+16 QUIT $SELECT($DATA(DIRUT):0,1:Y)
+17 ;
+18 ;
TMLP ;allows the user to select which teams. Allows the selection of
+1 ;multiple teams.
+2 ;sets up the SCMCTM array with the teams
+3 ;sets stop=1 if need to stop
+4 ;
+5 NEW SCSTOP
+6 SET SCSTOP=0
+7 FOR
Begin DoDot:1
+8 NEW TM
+9 SET TM=$$TEAM^SCMCMU(DT)
+10 IF TM>0
SET SCMCTM(TM)=""
+11 IF '$TEST
SET SCSTOP=1
+12 QUIT
End DoDot:1
IF SCSTOP
QUIT
+13 QUIT
+14 ;
POSLP(TM) ;allows the user to select one team and multiple positions from that
+1 ;team.
+2 ;the SCMCTM and SCMCPOS arrays will be populated.
+3 ;
+4 NEW SCSTOP
+5 SET SCSTOP=0
+6 KILL SCMCPOS
+7 FOR
Begin DoDot:1
+8 NEW POS
+9 ; get positions using today.
SET POS=$$POS^SCMCMU(TM,DT)
+10 IF POS>0
SET SCMCPOS(POS)=""
+11 IF '$TEST
SET SCSTOP=1
+12 QUIT
End DoDot:1
IF SCSTOP
QUIT
+13 QUIT
+14 ;
POS ;gets the team first then calls POSLP to get the positions
+1 ;populates the SCMCTM array
+2 ;
+3 NEW TTM
+4 KILL SCMCTM
+5 SET TTM=$$TEAM^SCMCMU(DT)
+6 IF TTM>0
Begin DoDot:1
+7 SET SCMCTM(TTM)=""
+8 DO POSLP(TTM)
+9 QUIT
End DoDot:1
+10 QUIT
+11 ;
+12 ;
SUMARIZE ;presents the selections to the user.
+1 ;
+2 WRITE !!!,"You have made the following selections."
+3 WRITE !,"Please verify they are what you want:",!
+4 ;
+5 IF SCMCTYPE="A"
DO TYPEA
+6 IF SCMCTYPE="T"
DO TYPET
+7 IF SCMCTYPE="P"
DO TYPEP
+8 ;
+9 WRITE !!,*7,"** This job will be run in a ",$SELECT(SCMCFIX="F":"FIX",1:"CHECK")," mode. **",!
+10 QUIT
+11 ;
+12 ;
TYPEA ;
+1 WRITE !,"You have selected to convert assignments in all teams and positions."
+2 QUIT
+3 ;
+4 ;
TYPET ;
+1 NEW VAR
+2 WRITE !,"You have selected to convert PC Attending assignments in the following teams:"
+3 ;
+4 SET VAR=0
+5 FOR
SET VAR=$ORDER(SCMCTM(VAR))
IF VAR=""
QUIT
WRITE !,$PIECE(^SCTM(404.51,VAR,0),U,1)
+6 ;
+7 WRITE !!,"All position assignments for each team will be reviewed."
+8 QUIT
+9 ;
+10 ;
TYPEP ;
+1 NEW LP,VAR
+2 SET VAR=$ORDER(SCMCTM(0))
IF VAR=""
QUIT
+3 ;
+4 WRITE !,"You have selected to convert PC Attending assignments for team:"
+5 WRITE !,$PIECE(^SCTM(404.51,VAR,0),U,1)
+6 WRITE !!,"The positions that were selected are:"
+7 ;
+8 SET VAR=0
+9 FOR
SET VAR=$ORDER(SCMCPOS(VAR))
IF VAR=""
QUIT
WRITE !,$PIECE(^SCTM(404.57,VAR,0),U,1)
+10 QUIT
+11 ;
+12 ;
ASKCONT() ;ask the user if they wish to continue.
+1 ;
+2 NEW Y,DIR
+3 SET DIR(0)="Y^"
+4 SET DIR("A")="Are these selections correct? Do you wish to continue"
+5 DO ^DIR
+6 ; CHANGING TO MATCH STOP FORMAT.
QUIT $SELECT(Y=1:0,1:1)
+7 ;
+8 ;
SETLOCK ; sets the global to lock out other attempted jobs
+1 ;
+2 SET ^XTMP("SCMCATTCONV",0)=DT+1_"^"_DT
+3 QUIT
+4 ;
+5 ;
QOFF ;queue the task off to be processed in the background.
+1 ;
+2 NEW ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSAVE
+3 SET ZTRTN="STRTQJOB^SCMCCV2"
+4 SET ZTDESC="PCMM conversion of PC Attending assignments."
+5 SET ZTDTH=$HOROLOG
+6 SET ZTIO=""
+7 SET ZTSAVE("SCMCTM(")=""
+8 SET ZTSAVE("SCMCPOS(")=""
+9 SET ZTSAVE("SCMCFIX")=""
+10 SET ZTSAVE("SCMCTYPE")=""
+11 DO ^%ZTLOAD
+12 ;LOCKS FOR NEXT ATTEMPT
IF $DATA(ZTSK)
WRITE !!,"Task queued. ",ZTSK
DO SETLOCK
+13 IF '$TEST
WRITE !!,"Task NOT queued."
+14 KILL ZTSK
+15 QUIT
+16 ;
+17 ;
FUTURE ;checks if can make an assignment for today.
+1 ;
+2 NEW VARTWO
+3 KILL ERR
+4 SET VARTWO=$$YSPTTPPC^SCMCTPU2(DFN,DT,1)
+5 IF 'VARTWO
SET ERR="-"_$PIECE(VARTWO,U,2)
DO SETERR^SCMCCV2(ERR)
QUIT
+6 SET REASSIGN=1
+7 QUIT
+8 ;
+9 ;
REOPEN ;reactivate old assignment.
+1 ;
+2 NEW DA,DR,DIE
+3 SET DIE="^SCPT(404.43,"
+4 SET DA=POSASGN
+5 DO NOW^%DTC
+6 SET DR=".04///@;.08///"_$GET(DUZ,.5)_";.09///"_%
+7 KILL X
+8 DO ^DIE
+9 QUIT
+10 ;
+11 ;
CHANGE(AIEN) ;the actual FM call to convert.
+1 NEW DIE,DA,DR
+2 SET DIE="^SCPT(404.43,"
+3 SET DA=AIEN
+4 SET DR=".05///1"
+5 DO ^DIE
+6 QUIT
+7 ;
+8 ;
INIT ;set up variables
+1 ;
+2 SET XMDUZ=.5
+3 SET XMY($SELECT($GET(DUZ):DUZ,1:XMDUZ))=""
+4 SET XMSUB="PC Attending conversion"
+5 SET XMTEXT="^TMP(""SCMC"",$J,""MSG"","
+6 SET CNTR=0
+7 QUIT