SCCVPAR ;ALB/TMP - SCHED VISITS CONVERSION PARAMETERS; [ 03/02/98 10:47 AM ]
;;5.3;Scheduling;**211**;Aug 13, 1993
;
PARAM ; Main entry point - display scheduling conversion parameters
D EN^VALM("SCCV CONV PARAM MENU")
D REFRESH^SCCVCDSP
Q
;
INIT ; -- set up initial variables
D FNL
S U="^",VALMCNT=0,VALMBG=1
D BLD
Q
;
HDR ;
S VALMHDR(1)=""
Q
;
FNL ; Clean up
K ^TMP("SCCV.PARAM",$J),^TMP("SCCV.PARAM.DX",$J)
Q
;
BLD ;Build parameter display
N SCCVCNV
S VALMBG=1
K ^TMP("SCCV.PARAM",$J)
S VALMCNT=0
S SCCVCNV=$G(^SD(404.91,1,"CNV"))
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT," ")
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT,"Earliest encounter date to be converted: "_$S(+SCCVCNV:$$FMTE^XLFDT(+SCCVCNV,"1D"),1:"<Not Specified>"))
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT,"Limit CST date range to 1 year or less?: "_$$EXPAND^SCCVDSP2(404.91,905,+$P(SCCVCNV,U,5)))
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT," Default Disposition Clinic: "_$$NONE^SCCVDSP2(404.91,902,$P(SCCVCNV,U,2),"<Not Specified>"))
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT," Maximum Errors Allowed: "_$$EXPAND^SCCVDSP2(404.91,907,$S($P(SCCVCNV,U,7):$P(SCCVCNV,U,7),1:1000)))
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT," Display Cancelled Templates: "_$$EXPAND^SCCVDSP2(404.91,909,+$P(SCCVCNV,U,9)))
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT," ")
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT,"Date Conversion Completed: "_$S('$$COMPL():"* UNEDITABLE - CST entry(s) missing or incomplete *",1:$$FMTE^XLFDT($P(SCCVCNV,U,4),"1D")))
S VALMCNT=VALMCNT+1
D SET^VALM10(VALMCNT,"Date Deletion Completed: "_$S('$$COMPL():"* UNEDITABLE - CST entry(s) missing or incomplete *",1:$$FMTE^XLFDT($P(SCCVCNV,U,3),"1D")))
Q
;
EDIT ; Edit scheduling conversion parameters
N SCDT1
S SCDT1=$P($G(^SD(404.91,1,"CNV")),U,4)
D FULL^VALM1
S DIE="^SD(404.91,",DA=1,DR="[SCCV CONV EDIT SITE PARAMS]"
D ^DIE
I 'SCDT1,$P($G(^SD(404.91,1,"CNV")),U,4) D
. S DIR(0)="YA",DIR("A")="Do you want to delete the old scheduling files now? ",DIR("B")="NO" D ^DIR K DIR
. I Y=1 D
.. D EN^SCCVDEL
D BLD
S VALMBCK="R"
Q
;
903(SKIPTO) ;
N DIR,Y
;
Q:'$P($G(^SD(404.91,1,"CNV")),U,3)!($G(SCCVX(903)))
;
I '$P($G(^SD(404.91,1,"CNV")),U,4) D G Q903
.S DIR(0)="EA"
.S DIR("A",1)="DATE CONVERSION COMPLETED must be entered before you can enter this date",DIR("A")="Press RETURN to continue"
.D ^DIR K DIR
.S SKIPTO="@30"
;
S DIR(0)="YA",DIR("B")="NO"
S DIR("A",1)="Entering this date indicates that your site is finished",DIR("A",2)="deleting any old encounter files that can be deleted.",DIR("A",3)=" ",DIR("A")="Are you sure you want to do this?: "
D ^DIR K DIR
I Y'=1 S SKIPTO="@30"
;
Q903 Q
;
904(SKIPTO) ;
N DIR,SC0,SCLACT,SCLEVT,SCOK,Y,Z
;
G:'$P($G(^SD(404.91,1,"CNV")),U,4)!($G(SCCVX(904))) Q904
;
; All CST's must be canceled or completed before date can be entered
I '$$COMPL() D S SKIPTO="@20" G Q904
. W !
. S DIR(0)="EA"
.S DIR("A",1)="You must complete or cancel each CST before you may enter this date",DIR("A",2)="At least one CST was found to be missing or incomplete",DIR("A")="Press RETURN to continue "
. D ^DIR K DIR
. W !
;
I $$SEQGAP() D S SKIPTO="@20" G Q904 ; Check for gaps in the dt range
. N DIR,Y,SCDT1
. S SCDT1=$P($G(^SD(404.91,1,"CNV")),U)
. S:SCDT1 SCDT1=$$FMTE^XLFDT(SCDT1,2)
. W !
. S DIR(0)="EA"
. S DIR("A",1)="You have one or more gaps in conversion dates from your earliest date to",DIR("A",2)=" convert ("_$S(SCDT1'="":SCDT1,1:"NOT ENTERED")_") to 9-30-96"
. S DIR("A",3)="You must finish converting before you can enter the conversion completed date",DIR("A")="Press RETURN to continue "
. D ^DIR K DIR
. W !
;
S DIR(0)="YA",DIR("B")="NO"
S DIR("A",1)="Entering this date prevents you from converting any more data from the old",DIR("A",2)=" Scheduling files to the PCE V-files",DIR("A",3)=" ",DIR("A")="Are you sure you want to do this?: "
D ^DIR K DIR
I Y'=1 S SKIPTO="@20"
;
Q904 Q
;
COMPL(ANY) ; Check if all/any CST's are complete or canceled
; Returns 0 if function fails, 1 if function succeeds
; ANY = 1: just check for ANY completed
;
N Z,SC0,SCOK,SCLACT,SCLEVT,SCANY
;
I '$G(ANY) S SCOK='$$SEQGAP() G COMPLQ ;Check all for full range
;
S Z=0,SCANY=0
F S Z=$O(^SD(404.98,Z)) Q:'Z S SC0=$G(^(Z,0)) D Q:SCANY
. Q:$P(SC0,U,9) ; CST canceled
. S SCLACT=+$$LSTACT^SCCVLOG(Z),SCLEVT=+$$LSTEVT^SCCVLOG(Z)
. I $S(SCLACT'=5:0,1:"12"[SCLEVT) S SCANY=1 Q ; Last actn (cnvrt/recnvrt) completed
;
COMPLQ Q $S($G(ANY):SCANY,1:SCOK)
;
SEQGAP() ; Checks entire date range from start to 9-30-96 has been converted
; Returns 0 if no gap found from earliest date to convert to 09/30/96
; 1 if gap found
N Z,Z0,SC0,SCLACT,SCLEVT,SCGAP,SCDT1,SCDT2
;
S Z=0,SCGAP=0
F S Z=$O(^SD(404.98,Z)) Q:'Z S SC0=$G(^(Z,0)) D
. Q:$P(SC0,U,9) ; CST canceled
. S SCLACT=+$$LSTACT^SCCVLOG(Z),SCLEVT=+$$LSTEVT^SCCVLOG(Z)
. I $S(SCLACT'=5:0,1:"12"[SCLEVT) D ; Last actn (cnvrt/recnvrt) completed
.. S SCGAP(+$$FMTH^XLFDT($P(SC0,U,3),1))=+$$FMTH^XLFDT($P(SC0,U,4),1)
;
S SCDT1=+$$FMTH^XLFDT(+$G(^SD(404.91,1,"CNV"),2801001),1) ; start date
S SCDT2=+$$FMTH^XLFDT($$ENDDATE^SCCVU(),1) ; end date
S SCGAP=0,Z=SCDT1
F S Z0=$G(SCGAP(Z)) D Q:SCGAP!(Z0=SCDT2) ;Check ranges for gaps
. I Z0=SCDT2 Q ; No gaps found
. I Z0="" S SCGAP=1 Q ; Gap found...S/B an entry at Z
. I Z=SCDT1 S Z=Z0+1 Q ; First date range
. S Z=Z0+1
;
Q SCGAP
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCCVPAR 5692 printed Oct 16, 2024@18:39:35 Page 2
SCCVPAR ;ALB/TMP - SCHED VISITS CONVERSION PARAMETERS; [ 03/02/98 10:47 AM ]
+1 ;;5.3;Scheduling;**211**;Aug 13, 1993
+2 ;
PARAM ; Main entry point - display scheduling conversion parameters
+1 DO EN^VALM("SCCV CONV PARAM MENU")
+2 DO REFRESH^SCCVCDSP
+3 QUIT
+4 ;
INIT ; -- set up initial variables
+1 DO FNL
+2 SET U="^"
SET VALMCNT=0
SET VALMBG=1
+3 DO BLD
+4 QUIT
+5 ;
HDR ;
+1 SET VALMHDR(1)=""
+2 QUIT
+3 ;
FNL ; Clean up
+1 KILL ^TMP("SCCV.PARAM",$JOB),^TMP("SCCV.PARAM.DX",$JOB)
+2 QUIT
+3 ;
BLD ;Build parameter display
+1 NEW SCCVCNV
+2 SET VALMBG=1
+3 KILL ^TMP("SCCV.PARAM",$JOB)
+4 SET VALMCNT=0
+5 SET SCCVCNV=$GET(^SD(404.91,1,"CNV"))
+6 SET VALMCNT=VALMCNT+1
+7 DO SET^VALM10(VALMCNT," ")
+8 SET VALMCNT=VALMCNT+1
+9 DO SET^VALM10(VALMCNT,"Earliest encounter date to be converted: "_$SELECT(+SCCVCNV:$$FMTE^XLFDT(+SCCVCNV,"1D"),1:"<Not Specified>"))
+10 SET VALMCNT=VALMCNT+1
+11 DO SET^VALM10(VALMCNT,"Limit CST date range to 1 year or less?: "_$$EXPAND^SCCVDSP2(404.91,905,+$PIECE(SCCVCNV,U,5)))
+12 SET VALMCNT=VALMCNT+1
+13 DO SET^VALM10(VALMCNT," Default Disposition Clinic: "_$$NONE^SCCVDSP2(404.91,902,$PIECE(SCCVCNV,U,2),"<Not Specified>"))
+14 SET VALMCNT=VALMCNT+1
+15 DO SET^VALM10(VALMCNT," Maximum Errors Allowed: "_$$EXPAND^SCCVDSP2(404.91,907,$SELECT($PIECE(SCCVCNV,U,7):$PIECE(SCCVCNV,U,7),1:1000)))
+16 SET VALMCNT=VALMCNT+1
+17 DO SET^VALM10(VALMCNT," Display Cancelled Templates: "_$$EXPAND^SCCVDSP2(404.91,909,+$PIECE(SCCVCNV,U,9)))
+18 SET VALMCNT=VALMCNT+1
+19 DO SET^VALM10(VALMCNT," ")
+20 SET VALMCNT=VALMCNT+1
+21 DO SET^VALM10(VALMCNT,"Date Conversion Completed: "_$SELECT('$$COMPL():"* UNEDITABLE - CST entry(s) missing or incomplete *",1:$$FMTE^XLFDT($PIECE(SCCVCNV,U,4),"1D")))
+22 SET VALMCNT=VALMCNT+1
+23 DO SET^VALM10(VALMCNT,"Date Deletion Completed: "_$SELECT('$$COMPL():"* UNEDITABLE - CST entry(s) missing or incomplete *",1:$$FMTE^XLFDT($PIECE(SCCVCNV,U,3),"1D")))
+24 QUIT
+25 ;
EDIT ; Edit scheduling conversion parameters
+1 NEW SCDT1
+2 SET SCDT1=$PIECE($GET(^SD(404.91,1,"CNV")),U,4)
+3 DO FULL^VALM1
+4 SET DIE="^SD(404.91,"
SET DA=1
SET DR="[SCCV CONV EDIT SITE PARAMS]"
+5 DO ^DIE
+6 IF 'SCDT1
IF $PIECE($GET(^SD(404.91,1,"CNV")),U,4)
Begin DoDot:1
+7 SET DIR(0)="YA"
SET DIR("A")="Do you want to delete the old scheduling files now? "
SET DIR("B")="NO"
DO ^DIR
KILL DIR
+8 IF Y=1
Begin DoDot:2
+9 DO EN^SCCVDEL
End DoDot:2
End DoDot:1
+10 DO BLD
+11 SET VALMBCK="R"
+12 QUIT
+13 ;
903(SKIPTO) ;
+1 NEW DIR,Y
+2 ;
+3 if '$PIECE($GET(^SD(404.91,1,"CNV")),U,3)!($GET(SCCVX(903)))
QUIT
+4 ;
+5 IF '$PIECE($GET(^SD(404.91,1,"CNV")),U,4)
Begin DoDot:1
+6 SET DIR(0)="EA"
+7 SET DIR("A",1)="DATE CONVERSION COMPLETED must be entered before you can enter this date"
SET DIR("A")="Press RETURN to continue"
+8 DO ^DIR
KILL DIR
+9 SET SKIPTO="@30"
End DoDot:1
GOTO Q903
+10 ;
+11 SET DIR(0)="YA"
SET DIR("B")="NO"
+12 SET DIR("A",1)="Entering this date indicates that your site is finished"
SET DIR("A",2)="deleting any old encounter files that can be deleted."
SET DIR("A",3)=" "
SET DIR("A")="Are you sure you want to do this?: "
+13 DO ^DIR
KILL DIR
+14 IF Y'=1
SET SKIPTO="@30"
+15 ;
Q903 QUIT
+1 ;
904(SKIPTO) ;
+1 NEW DIR,SC0,SCLACT,SCLEVT,SCOK,Y,Z
+2 ;
+3 if '$PIECE($GET(^SD(404.91,1,"CNV")),U,4)!($GET(SCCVX(904)))
GOTO Q904
+4 ;
+5 ; All CST's must be canceled or completed before date can be entered
+6 IF '$$COMPL()
Begin DoDot:1
+7 WRITE !
+8 SET DIR(0)="EA"
+9 SET DIR("A",1)="You must complete or cancel each CST before you may enter this date"
SET DIR("A",2)="At least one CST was found to be missing or incomplete"
SET DIR("A")="Press RETURN to continue "
+10 DO ^DIR
KILL DIR
+11 WRITE !
End DoDot:1
SET SKIPTO="@20"
GOTO Q904
+12 ;
+13 ; Check for gaps in the dt range
IF $$SEQGAP()
Begin DoDot:1
+14 NEW DIR,Y,SCDT1
+15 SET SCDT1=$PIECE($GET(^SD(404.91,1,"CNV")),U)
+16 if SCDT1
SET SCDT1=$$FMTE^XLFDT(SCDT1,2)
+17 WRITE !
+18 SET DIR(0)="EA"
+19 SET DIR("A",1)="You have one or more gaps in conversion dates from your earliest date to"
SET DIR("A",2)=" convert ("_$SELECT(SCDT1'="":SCDT1,1:"NOT ENTERED")_") to 9-30-96"
+20 SET DIR("A",3)="You must finish converting before you can enter the conversion completed date"
SET DIR("A")="Press RETURN to continue "
+21 DO ^DIR
KILL DIR
+22 WRITE !
End DoDot:1
SET SKIPTO="@20"
GOTO Q904
+23 ;
+24 SET DIR(0)="YA"
SET DIR("B")="NO"
+25 SET DIR("A",1)="Entering this date prevents you from converting any more data from the old"
SET DIR("A",2)=" Scheduling files to the PCE V-files"
SET DIR("A",3)=" "
SET DIR("A")="Are you sure you want to do this?: "
+26 DO ^DIR
KILL DIR
+27 IF Y'=1
SET SKIPTO="@20"
+28 ;
Q904 QUIT
+1 ;
COMPL(ANY) ; Check if all/any CST's are complete or canceled
+1 ; Returns 0 if function fails, 1 if function succeeds
+2 ; ANY = 1: just check for ANY completed
+3 ;
+4 NEW Z,SC0,SCOK,SCLACT,SCLEVT,SCANY
+5 ;
+6 ;Check all for full range
IF '$GET(ANY)
SET SCOK='$$SEQGAP()
GOTO COMPLQ
+7 ;
+8 SET Z=0
SET SCANY=0
+9 FOR
SET Z=$ORDER(^SD(404.98,Z))
if 'Z
QUIT
SET SC0=$GET(^(Z,0))
Begin DoDot:1
+10 ; CST canceled
if $PIECE(SC0,U,9)
QUIT
+11 SET SCLACT=+$$LSTACT^SCCVLOG(Z)
SET SCLEVT=+$$LSTEVT^SCCVLOG(Z)
+12 ; Last actn (cnvrt/recnvrt) completed
IF $SELECT(SCLACT'=5:0,1:"12"[SCLEVT)
SET SCANY=1
QUIT
End DoDot:1
if SCANY
QUIT
+13 ;
COMPLQ QUIT $SELECT($GET(ANY):SCANY,1:SCOK)
+1 ;
SEQGAP() ; Checks entire date range from start to 9-30-96 has been converted
+1 ; Returns 0 if no gap found from earliest date to convert to 09/30/96
+2 ; 1 if gap found
+3 NEW Z,Z0,SC0,SCLACT,SCLEVT,SCGAP,SCDT1,SCDT2
+4 ;
+5 SET Z=0
SET SCGAP=0
+6 FOR
SET Z=$ORDER(^SD(404.98,Z))
if 'Z
QUIT
SET SC0=$GET(^(Z,0))
Begin DoDot:1
+7 ; CST canceled
if $PIECE(SC0,U,9)
QUIT
+8 SET SCLACT=+$$LSTACT^SCCVLOG(Z)
SET SCLEVT=+$$LSTEVT^SCCVLOG(Z)
+9 ; Last actn (cnvrt/recnvrt) completed
IF $SELECT(SCLACT'=5:0,1:"12"[SCLEVT)
Begin DoDot:2
+10 SET SCGAP(+$$FMTH^XLFDT($PIECE(SC0,U,3),1))=+$$FMTH^XLFDT($PIECE(SC0,U,4),1)
End DoDot:2
End DoDot:1
+11 ;
+12 ; start date
SET SCDT1=+$$FMTH^XLFDT(+$GET(^SD(404.91,1,"CNV"),2801001),1)
+13 ; end date
SET SCDT2=+$$FMTH^XLFDT($$ENDDATE^SCCVU(),1)
+14 SET SCGAP=0
SET Z=SCDT1
+15 ;Check ranges for gaps
FOR
SET Z0=$GET(SCGAP(Z))
Begin DoDot:1
+16 ; No gaps found
IF Z0=SCDT2
QUIT
+17 ; Gap found...S/B an entry at Z
IF Z0=""
SET SCGAP=1
QUIT
+18 ; First date range
IF Z=SCDT1
SET Z=Z0+1
QUIT
+19 SET Z=Z0+1
End DoDot:1
if SCGAP!(Z0=SCDT2)
QUIT
+20 ;
+21 QUIT SCGAP
+22 ;