SCCVU2 ;ALB/RMO,TMP - SCHED VISITS CONVERT/ARCHIVE UTILITIES; [ 10/10/95 2:39 PM ]
;;5.3;Scheduling;**211**;Aug 13, 1993
;
VERDT(SCSTDT,SCENDT,SCLOG,SCERRMSG) ;Verify date range is valid
; Input -- SCSTDT Start date
; SCENDT End date
; SCLOG CST log IEN [optional]
; Output -- #=Error number and 0=No Error
; SCERRMSG Error message
N SCERRNB,SCNVPAR
S SCERRNB=0
S SCNVPAR=$G(^SD(404.91,1,"CNV"))
;
;Check start date
I SCSTDT D
. I SCSTDT<+SCNVPAR D ;start dt cannot be before earliest encounter dt
. . N SCERRIP,Y
. . S SCERRNB=4049001.001
. . S Y=+SCNVPAR D D^DIQ S SCERRIP(1)=Y
. . D GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$G(SCLOG),1,.SCERRMSG)
;
;Check end date
I 'SCERRNB,SCENDT D
. I SCENDT<+SCNVPAR D ;end dt cannot be before earliest encounter dt
. . N SCERRIP,Y
. . S SCERRNB=4049001.004
. . S Y=+SCNVPAR D D^DIQ S SCERRIP(1)=Y
. . D GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$G(SCLOG),1,.SCERRMSG)
;
;Check date range
I 'SCERRNB,SCSTDT,SCENDT D
. I SCSTDT>SCENDT D ;start date cannot be after end date
. . S SCERRNB=4049001.005
. . D GETERR^SCCVLOG1(SCERRNB,"","",$G(SCLOG),1,.SCERRMSG)
. I 'SCERRNB,SCENDT<SCSTDT D ;end date cannot be before start date
. . S SCERRNB=4049001.006
. . D GETERR^SCCVLOG1(SCERRNB,"","",$G(SCLOG),1,.SCERRMSG)
;
;Check for 1 year limit if parameter set
I 'SCERRNB,$P(SCNVPAR,U,5),$$FMADD^XLFDT(SCSTDT,365)<SCENDT D
. S SCERRNB=4049001.007
. D GETERR^SCCVLOG1(SCERRNB,"","",$G(SCLOG),1,.SCERRMSG)
Q SCERRNB
;
CHKDUP(SCCVTYP,SCSTDT,SCENDT,SCLOG,SCERRMSG) ;Check for duplicate type and date range for conversion entry
; Input -- SCCVTYP Conversion type
; SCSTDT Start date
; SCENDT End date
; SCLOG CST log IEN
; Output -- #=Error number and 0=No Error
; SCERRMSG Error message
N SCERRNB,SCLOGX,SCCV0,SCDTS,SCDTE
S (SCERRNB,SCLOGX)=0
F S SCLOGX=$O(^SD(404.98,"TYP",SCCVTYP,SCLOGX)) Q:'SCLOGX!(SCERRNB) I SCLOG'=SCLOGX D
. S SCCV0=$G(^SD(404.98,SCLOGX,0)),SCDTS=$P(SCCV0,U,3),SCDTE=$P(SCCV0,U,4)
. Q:$P(SCCV0,U,9) ;Template canceled
. ;
. ; -- 'IF SCDTE<SCSTDT!(SCDTS>SCENDT) Q'
. ; If (end < new start) or (start > new end) then ok and quit
. ; Next line is boolean negative of above 'If'
. ;
. I SCDTE'<SCSTDT,SCDTS'>SCENDT D ;date range overlap
. . N SCERRIP
. . S SCERRNB=4049001.01
. . S SCERRIP(1)=SCLOGX
. . D GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$G(SCLOG),1,.SCERRMSG)
;
Q SCERRNB
;
PROCSEL(SCRESULT,SC) ; -- Process Archive SELECT request - not used
; Input -- SC Array:
; SC("TEMPLNO") Template number ien
; ("REQNUM") Request number ien
; Output -- SCRESULT (#=Error number | 0=No Error)^Message
;
Q
N SCERRMSG,SCERRNB,SCLOG,SCREQ,SCREQACT
S SCERRNB=0
;
S SCLOG=$G(SC("TEMPLNO"))
S SCREQ=$G(SC("REQNUM"))
;
;Quit if Template number ien or request ien are not defined
I 'SCLOG!('SCREQ) D
. S SCERRNB=4049007.003
. D GETERR^SCCVLOG1(SCERRNB,"","","",1,.SCERRMSG)
;
S SCRESULT=$S('SCERRNB:0,1:SCERRNB_U_$$BLDSTR^SCCVU1(.SCERRMSG))
;
G:SCERRNB PROCSELQ
;
; Set request action
S SCREQACT=$P($G(^SD(404.99,SCLOG,"R",SCREQ,0)),U,2)
;
; Queue archive select request
;D QSEL^SCCVAST1(SCLOG,SCREQ)
;
PROCSELQ Q
;
OTHERR(ERRNO) ; Returns text of specific errors for error log
N X
S ERRNO=ERRNO+1
S X=$P($T(ERRLIST+ERRNO),";;",3,99)
Q X
;
ERRLIST ; List of 'OTHER' specific errors ;;ERROR # (OFFSET-1);;ERROR TEXT
;;0;;Unknown
;;1;;Appointment does not exist in clinic file
;;2;;Encounter was not created for appointment
;;3;;Visit was not created for appointment
;;4;;Add/edit's top level 0-node does not exist
;;5;;Add/edit does not have a valid patient DFN
;;6;;Add/edit does not have a valid division
;;7;;Add/edit does not have a valid clinic stop
;;8;;Disposition does not have a valid hospital location
;;9;;Add/edit's "CS" level 0-node does not exist
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCCVU2 4071 printed Nov 22, 2024@17:49:01 Page 2
SCCVU2 ;ALB/RMO,TMP - SCHED VISITS CONVERT/ARCHIVE UTILITIES; [ 10/10/95 2:39 PM ]
+1 ;;5.3;Scheduling;**211**;Aug 13, 1993
+2 ;
VERDT(SCSTDT,SCENDT,SCLOG,SCERRMSG) ;Verify date range is valid
+1 ; Input -- SCSTDT Start date
+2 ; SCENDT End date
+3 ; SCLOG CST log IEN [optional]
+4 ; Output -- #=Error number and 0=No Error
+5 ; SCERRMSG Error message
+6 NEW SCERRNB,SCNVPAR
+7 SET SCERRNB=0
+8 SET SCNVPAR=$GET(^SD(404.91,1,"CNV"))
+9 ;
+10 ;Check start date
+11 IF SCSTDT
Begin DoDot:1
+12 ;start dt cannot be before earliest encounter dt
IF SCSTDT<+SCNVPAR
Begin DoDot:2
+13 NEW SCERRIP,Y
+14 SET SCERRNB=4049001.001
+15 SET Y=+SCNVPAR
DO D^DIQ
SET SCERRIP(1)=Y
+16 DO GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$GET(SCLOG),1,.SCERRMSG)
End DoDot:2
End DoDot:1
+17 ;
+18 ;Check end date
+19 IF 'SCERRNB
IF SCENDT
Begin DoDot:1
+20 ;end dt cannot be before earliest encounter dt
IF SCENDT<+SCNVPAR
Begin DoDot:2
+21 NEW SCERRIP,Y
+22 SET SCERRNB=4049001.004
+23 SET Y=+SCNVPAR
DO D^DIQ
SET SCERRIP(1)=Y
+24 DO GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$GET(SCLOG),1,.SCERRMSG)
End DoDot:2
End DoDot:1
+25 ;
+26 ;Check date range
+27 IF 'SCERRNB
IF SCSTDT
IF SCENDT
Begin DoDot:1
+28 ;start date cannot be after end date
IF SCSTDT>SCENDT
Begin DoDot:2
+29 SET SCERRNB=4049001.005
+30 DO GETERR^SCCVLOG1(SCERRNB,"","",$GET(SCLOG),1,.SCERRMSG)
End DoDot:2
+31 ;end date cannot be before start date
IF 'SCERRNB
IF SCENDT<SCSTDT
Begin DoDot:2
+32 SET SCERRNB=4049001.006
+33 DO GETERR^SCCVLOG1(SCERRNB,"","",$GET(SCLOG),1,.SCERRMSG)
End DoDot:2
End DoDot:1
+34 ;
+35 ;Check for 1 year limit if parameter set
+36 IF 'SCERRNB
IF $PIECE(SCNVPAR,U,5)
IF $$FMADD^XLFDT(SCSTDT,365)<SCENDT
Begin DoDot:1
+37 SET SCERRNB=4049001.007
+38 DO GETERR^SCCVLOG1(SCERRNB,"","",$GET(SCLOG),1,.SCERRMSG)
End DoDot:1
+39 QUIT SCERRNB
+40 ;
CHKDUP(SCCVTYP,SCSTDT,SCENDT,SCLOG,SCERRMSG) ;Check for duplicate type and date range for conversion entry
+1 ; Input -- SCCVTYP Conversion type
+2 ; SCSTDT Start date
+3 ; SCENDT End date
+4 ; SCLOG CST log IEN
+5 ; Output -- #=Error number and 0=No Error
+6 ; SCERRMSG Error message
+7 NEW SCERRNB,SCLOGX,SCCV0,SCDTS,SCDTE
+8 SET (SCERRNB,SCLOGX)=0
+9 FOR
SET SCLOGX=$ORDER(^SD(404.98,"TYP",SCCVTYP,SCLOGX))
if 'SCLOGX!(SCERRNB)
QUIT
IF SCLOG'=SCLOGX
Begin DoDot:1
+10 SET SCCV0=$GET(^SD(404.98,SCLOGX,0))
SET SCDTS=$PIECE(SCCV0,U,3)
SET SCDTE=$PIECE(SCCV0,U,4)
+11 ;Template canceled
if $PIECE(SCCV0,U,9)
QUIT
+12 ;
+13 ; -- 'IF SCDTE<SCSTDT!(SCDTS>SCENDT) Q'
+14 ; If (end < new start) or (start > new end) then ok and quit
+15 ; Next line is boolean negative of above 'If'
+16 ;
+17 ;date range overlap
IF SCDTE'<SCSTDT
IF SCDTS'>SCENDT
Begin DoDot:2
+18 NEW SCERRIP
+19 SET SCERRNB=4049001.01
+20 SET SCERRIP(1)=SCLOGX
+21 DO GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$GET(SCLOG),1,.SCERRMSG)
End DoDot:2
End DoDot:1
+22 ;
+23 QUIT SCERRNB
+24 ;
PROCSEL(SCRESULT,SC) ; -- Process Archive SELECT request - not used
+1 ; Input -- SC Array:
+2 ; SC("TEMPLNO") Template number ien
+3 ; ("REQNUM") Request number ien
+4 ; Output -- SCRESULT (#=Error number | 0=No Error)^Message
+5 ;
+6 QUIT
+7 NEW SCERRMSG,SCERRNB,SCLOG,SCREQ,SCREQACT
+8 SET SCERRNB=0
+9 ;
+10 SET SCLOG=$GET(SC("TEMPLNO"))
+11 SET SCREQ=$GET(SC("REQNUM"))
+12 ;
+13 ;Quit if Template number ien or request ien are not defined
+14 IF 'SCLOG!('SCREQ)
Begin DoDot:1
+15 SET SCERRNB=4049007.003
+16 DO GETERR^SCCVLOG1(SCERRNB,"","","",1,.SCERRMSG)
End DoDot:1
+17 ;
+18 SET SCRESULT=$SELECT('SCERRNB:0,1:SCERRNB_U_$$BLDSTR^SCCVU1(.SCERRMSG))
+19 ;
+20 if SCERRNB
GOTO PROCSELQ
+21 ;
+22 ; Set request action
+23 SET SCREQACT=$PIECE($GET(^SD(404.99,SCLOG,"R",SCREQ,0)),U,2)
+24 ;
+25 ; Queue archive select request
+26 ;D QSEL^SCCVAST1(SCLOG,SCREQ)
+27 ;
PROCSELQ QUIT
+1 ;
OTHERR(ERRNO) ; Returns text of specific errors for error log
+1 NEW X
+2 SET ERRNO=ERRNO+1
+3 SET X=$PIECE($TEXT(ERRLIST+ERRNO),";;",3,99)
+4 QUIT X
+5 ;
ERRLIST ; List of 'OTHER' specific errors ;;ERROR # (OFFSET-1);;ERROR TEXT
+1 ;;0;;Unknown
+2 ;;1;;Appointment does not exist in clinic file
+3 ;;2;;Encounter was not created for appointment
+4 ;;3;;Visit was not created for appointment
+5 ;;4;;Add/edit's top level 0-node does not exist
+6 ;;5;;Add/edit does not have a valid patient DFN
+7 ;;6;;Add/edit does not have a valid division
+8 ;;7;;Add/edit does not have a valid clinic stop
+9 ;;8;;Disposition does not have a valid hospital location
+10 ;;9;;Add/edit's "CS" level 0-node does not exist
+11 ;