Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SCMCCV1

SCMCCV1.m

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