SDESEDITAPREQVAL ;ALB/JAS - Additional validation for SDESEDITAPPTREQ; FEB 21, 2024
;;5.3;Scheduling;**873**;Aug 13, 1993;Build 10
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
; RPC: SDES EDIT APPT REQ (Continued from SDESEDITAPPTREQ)
;
VALIDATEAPPTREQ(ERRORS,REQIEN) ;
I REQIEN="@" D ERRLOG^SDESJSON(.ERRORS,229) Q 0
I REQIEN="" D ERRLOG^SDESJSON(.ERRORS,3) Q 0
I REQIEN'="",('$D(^SDEC(409.85,REQIEN)))!(REQIEN=0) D ERRLOG^SDESJSON(.ERRORS,4) Q 0
Q 1
;
VALIDATEDFN(ERRORS,DFN) ;
I DFN="@" D ERRLOG^SDESJSON(.ERRORS,229) Q 0
I DFN="" D ERRLOG^SDESJSON(.ERRORS,1) Q 0
I DFN'="",'$D(^DPT(DFN,0)) D ERRLOG^SDESJSON(.ERRORS,2) Q 0
Q 1
;
VALIDATEDATETIME(ERRORS,REQUEST) ;
I $G(REQUEST("CREATE DATE"))="@" D ERRLOG^SDESJSON(.ERRORS,229) Q 0
I $G(REQUEST("CREATE DATE"))="" D ERRLOG^SDESJSON(.ERRORS,48) Q 0
I $G(REQUEST("CREATE DATE"))'="" S REQUEST("CREATE DATE")=$$ISOTFM^SDAMUTDT($G(REQUEST("CREATE DATE")))
I $G(REQUEST("CREATE DATE"))=-1 D ERRLOG^SDESJSON(.ERRORS,49) Q 0
Q 1
;
VALIDATEREQTYPE(ERRORS,REQTYPE) ;
I REQTYPE="@" D ERRLOG^SDESJSON(.ERRORS,229) Q 0
I REQTYPE="" D ERRLOG^SDESJSON(.ERRORS,60) Q 0
I REQTYPE'="",REQTYPE'="APPT",REQTYPE'="MOBILE",REQTYPE'="RTC",REQTYPE'="VETERAN" D ERRLOG^SDESJSON(.ERRORS,61) Q 0
Q 1
;
STATIONTOINST(ERRORS,STATIONNUM,INSTNAME) ; station number has precedence over institution name
N INSTITUTIONIEN
I STATIONNUM="",INSTNAME="" D ERRLOG^SDESJSON(.ERRORS,204) Q 0
I STATIONNUM="",INSTNAME'="" D
.S INSTITUTIONIEN=$$FIND1^DIC(4,"","X",INSTNAME,"B") I 'INSTITUTIONIEN D ERRLOG^SDESJSON(.ERRORS,205)
I STATIONNUM'="" S INSTITUTIONIEN=$$FIND1^DIC(4,"","X",STATIONNUM,"D") I 'INSTITUTIONIEN D ERRLOG^SDESJSON(.ERRORS,197) Q 0
Q INSTITUTIONIEN
;
VALIDATECLINSTOP(ERRORS,REQUEST,CLINICIEN,STOPCODE,SECSTOPCODE) ;
N STOPCODEIEN
I CLINICIEN'="",'$D(^SC(CLINICIEN,0)) D ERRLOG^SDESJSON(.ERRORS,19) Q 0
I STOPCODE'="" S STOPCODE=$$FIND1^DIC(40.7,"","X",STOPCODE,"C") I '$G(STOPCODE) D ERRLOG^SDESJSON(.ERRORS,99) Q 0
I SECSTOPCODE'="" S SECSTOPCODE=$$FIND1^DIC(40.7,"","X",SECSTOPCODE,"C") I '$G(SECSTOPCODE) D ERRLOG^SDESJSON(.ERRORS,214) Q 0
I SECSTOPCODE'="",STOPCODE="" D ERRLOG^SDESJSON(.ERRORS,234) Q 0
I CLINICIEN="",STOPCODE="" D ERRLOG^SDESJSON(.ERRORS,63) Q 0
I STOPCODE'="",CLINICIEN'="" D ERRLOG^SDESJSON(.ERRORS,202) Q 0
I SECSTOPCODE'="",CLINICIEN'="" D ERRLOG^SDESJSON(.ERRORS,202) Q 0
; STOP CODE IENs per VSE-5396 patch 845 - TJB
S:STOPCODE'="" REQUEST("STOP CODE")=STOPCODE
S:SECSTOPCODE'="" REQUEST("SECONDARY STOP CODE")=SECSTOPCODE
Q 1
;
VALIDATEREQBY(ERRORS,REQUESTEDBY) ;
I REQUESTEDBY="@" D ERRLOG^SDESJSON(.ERRORS,229) Q 0
I REQUESTEDBY="" D ERRLOG^SDESJSON(.ERRORS,62) Q 0
I REQUESTEDBY'="",REQUESTEDBY'="PATIENT",REQUESTEDBY'="PROVIDER" D ERRLOG^SDESJSON(.ERRORS,198) Q 0
Q 1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESEDITAPREQVAL 2870 printed Dec 13, 2024@02:56:33 Page 2
SDESEDITAPREQVAL ;ALB/JAS - Additional validation for SDESEDITAPPTREQ; FEB 21, 2024
+1 ;;5.3;Scheduling;**873**;Aug 13, 1993;Build 10
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
+6 ; RPC: SDES EDIT APPT REQ (Continued from SDESEDITAPPTREQ)
+7 ;
VALIDATEAPPTREQ(ERRORS,REQIEN) ;
+1 IF REQIEN="@"
DO ERRLOG^SDESJSON(.ERRORS,229)
QUIT 0
+2 IF REQIEN=""
DO ERRLOG^SDESJSON(.ERRORS,3)
QUIT 0
+3 IF REQIEN'=""
IF ('$DATA(^SDEC(409.85,REQIEN)))!(REQIEN=0)
DO ERRLOG^SDESJSON(.ERRORS,4)
QUIT 0
+4 QUIT 1
+5 ;
VALIDATEDFN(ERRORS,DFN) ;
+1 IF DFN="@"
DO ERRLOG^SDESJSON(.ERRORS,229)
QUIT 0
+2 IF DFN=""
DO ERRLOG^SDESJSON(.ERRORS,1)
QUIT 0
+3 IF DFN'=""
IF '$DATA(^DPT(DFN,0))
DO ERRLOG^SDESJSON(.ERRORS,2)
QUIT 0
+4 QUIT 1
+5 ;
VALIDATEDATETIME(ERRORS,REQUEST) ;
+1 IF $GET(REQUEST("CREATE DATE"))="@"
DO ERRLOG^SDESJSON(.ERRORS,229)
QUIT 0
+2 IF $GET(REQUEST("CREATE DATE"))=""
DO ERRLOG^SDESJSON(.ERRORS,48)
QUIT 0
+3 IF $GET(REQUEST("CREATE DATE"))'=""
SET REQUEST("CREATE DATE")=$$ISOTFM^SDAMUTDT($GET(REQUEST("CREATE DATE")))
+4 IF $GET(REQUEST("CREATE DATE"))=-1
DO ERRLOG^SDESJSON(.ERRORS,49)
QUIT 0
+5 QUIT 1
+6 ;
VALIDATEREQTYPE(ERRORS,REQTYPE) ;
+1 IF REQTYPE="@"
DO ERRLOG^SDESJSON(.ERRORS,229)
QUIT 0
+2 IF REQTYPE=""
DO ERRLOG^SDESJSON(.ERRORS,60)
QUIT 0
+3 IF REQTYPE'=""
IF REQTYPE'="APPT"
IF REQTYPE'="MOBILE"
IF REQTYPE'="RTC"
IF REQTYPE'="VETERAN"
DO ERRLOG^SDESJSON(.ERRORS,61)
QUIT 0
+4 QUIT 1
+5 ;
STATIONTOINST(ERRORS,STATIONNUM,INSTNAME) ; station number has precedence over institution name
+1 NEW INSTITUTIONIEN
+2 IF STATIONNUM=""
IF INSTNAME=""
DO ERRLOG^SDESJSON(.ERRORS,204)
QUIT 0
+3 IF STATIONNUM=""
IF INSTNAME'=""
Begin DoDot:1
+4 SET INSTITUTIONIEN=$$FIND1^DIC(4,"","X",INSTNAME,"B")
IF 'INSTITUTIONIEN
DO ERRLOG^SDESJSON(.ERRORS,205)
End DoDot:1
+5 IF STATIONNUM'=""
SET INSTITUTIONIEN=$$FIND1^DIC(4,"","X",STATIONNUM,"D")
IF 'INSTITUTIONIEN
DO ERRLOG^SDESJSON(.ERRORS,197)
QUIT 0
+6 QUIT INSTITUTIONIEN
+7 ;
VALIDATECLINSTOP(ERRORS,REQUEST,CLINICIEN,STOPCODE,SECSTOPCODE) ;
+1 NEW STOPCODEIEN
+2 IF CLINICIEN'=""
IF '$DATA(^SC(CLINICIEN,0))
DO ERRLOG^SDESJSON(.ERRORS,19)
QUIT 0
+3 IF STOPCODE'=""
SET STOPCODE=$$FIND1^DIC(40.7,"","X",STOPCODE,"C")
IF '$GET(STOPCODE)
DO ERRLOG^SDESJSON(.ERRORS,99)
QUIT 0
+4 IF SECSTOPCODE'=""
SET SECSTOPCODE=$$FIND1^DIC(40.7,"","X",SECSTOPCODE,"C")
IF '$GET(SECSTOPCODE)
DO ERRLOG^SDESJSON(.ERRORS,214)
QUIT 0
+5 IF SECSTOPCODE'=""
IF STOPCODE=""
DO ERRLOG^SDESJSON(.ERRORS,234)
QUIT 0
+6 IF CLINICIEN=""
IF STOPCODE=""
DO ERRLOG^SDESJSON(.ERRORS,63)
QUIT 0
+7 IF STOPCODE'=""
IF CLINICIEN'=""
DO ERRLOG^SDESJSON(.ERRORS,202)
QUIT 0
+8 IF SECSTOPCODE'=""
IF CLINICIEN'=""
DO ERRLOG^SDESJSON(.ERRORS,202)
QUIT 0
+9 ; STOP CODE IENs per VSE-5396 patch 845 - TJB
+10 if STOPCODE'=""
SET REQUEST("STOP CODE")=STOPCODE
+11 if SECSTOPCODE'=""
SET REQUEST("SECONDARY STOP CODE")=SECSTOPCODE
+12 QUIT 1
+13 ;
VALIDATEREQBY(ERRORS,REQUESTEDBY) ;
+1 IF REQUESTEDBY="@"
DO ERRLOG^SDESJSON(.ERRORS,229)
QUIT 0
+2 IF REQUESTEDBY=""
DO ERRLOG^SDESJSON(.ERRORS,62)
QUIT 0
+3 IF REQUESTEDBY'=""
IF REQUESTEDBY'="PATIENT"
IF REQUESTEDBY'="PROVIDER"
DO ERRLOG^SDESJSON(.ERRORS,198)
QUIT 0
+4 QUIT 1