SDESGETAPPTREQ2 ;ALB/CGP,LAB,TJB - GET APPT REQ RPCS 2 ;Sep 11,2023
;;5.3;Scheduling;**839,847,861**;Aug 13, 1993;Build 17
;;Per VHA Directive 6402, this routine should not be modified
;
VALIDATEDATES(REQUESTIEN,STARTRANGE,ENDRANGE) ;
N STARTDATE,ENDDATE,CREATEDATE,VALIDSTDATE,VALIDENDATE
S (STARTDATE,ENDDATE,CREATEDATE,VALIDSTDATE,VALIDENDATE)=""
;
S CREATEDATE=$$GET1^DIQ(409.85,REQUESTIEN,1,"I")
Q:CREATEDATE="" 0
;
I STARTRANGE="" S VALIDSTDATE=1
I STARTRANGE'="" D
.S STARTDATE=$$ISOTFM^SDAMUTDT(STARTRANGE)
.I (STARTDATE<CREATEDATE)!(STARTDATE=CREATEDATE) S VALIDSTDATE=1
.I STARTDATE>CREATEDATE S VALIDSTDATE=0
;
Q:VALIDSTDATE=0 0
;
I ENDRANGE="" S VALIDENDATE=1
I ENDRANGE'="" D
.S ENDDATE=$$ISOTFM^SDAMUTDT(ENDRANGE)
.I (CREATEDATE<ENDDATE)!(ENDDATE=CREATEDATE) S VALIDENDATE=1
.I CREATEDATE>ENDDATE S VALIDENDATE=0
;
Q:VALIDENDATE=0 0
;
I (VALIDSTDATE'=1)&(VALIDENDATE'=1) Q 0
Q 1
;
VALIDATESTART(ERRORS,STARTDATE) ;
N ERRORFLAG
S STARTDATE=$$ISOTFM^SDAMUTDT(STARTDATE)
I STARTDATE=-1!(STARTDATE="") D ERRLOG^SDESJSON(.ERRORS,11)
I $L(STARTDATE,".")>1 D ERRLOG^SDESJSON(.ERRORS,431)
Q
;
VALIDATEEND(ERRORS,ENDDATE) ;
N ERRORFLAG
S ENDDATE=$$ISOTFM^SDAMUTDT(ENDDATE)
I ENDDATE=-1!(ENDDATE="") D ERRLOG^SDESJSON(.ERRORS,12)
I $L(ENDDATE,".")>1 D ERRLOG^SDESJSON(.ERRORS,431)
Q
;
VALIDATERANGE(ERRORS,STARTDATE,ENDDATE) ;
N ERRORFLAG
S STARTDATE=$$ISOTFM^SDAMUTDT(STARTDATE)
S ENDDATE=$$ISOTFM^SDAMUTDT(ENDDATE)
I ENDDATE<STARTDATE D ERRLOG^SDESJSON(.ERRORS,13)
Q
VALIDATEREQIEN(ERRORS,REQUESTIEN) ;
I REQUESTIEN="" D ERRLOG^SDESJSON(.ERRORS,3) Q 0
I REQUESTIEN'="",('$D(^SDEC(409.85,REQUESTIEN)))!(REQUESTIEN=0) D ERRLOG^SDESJSON(.ERRORS,4) Q 0
Q 1
;
VALIDATEAPPTIEN(ERRORS,APPTIEN) ;
I APPTIEN="" D ERRLOG^SDESJSON(.ERRORS,14) Q 0
I APPTIEN'="",'$D(^SDEC(409.84,APPTIEN,0)) D ERRLOG^SDESJSON(.ERRORS,15) Q 0
Q 1
;
VALIDATEDFN(ERRORS,DFN) ;
I DFN="" D ERRLOG^SDESJSON(.ERRORS,1) Q 0
I DFN'="",'$D(^DPT(DFN,0)) D ERRLOG^SDESJSON(.ERRORS,2) Q 0
Q 1
;
VALIDATEEAS(ERRORS,EAS) ;
I $L(EAS) S EAS=$$EASVALIDATE^SDESUTIL($G(EAS))
I $P($G(EAS),U)=-1 D ERRLOG^SDESJSON(.ERRORS,142) Q 0
Q 1
;
FINISHAPPTREQ(REQUEST,NUM,REQUESTIEN) ; finish building Request object
I '$D(^SDEC(409.86,"SRP",REQUESTIEN)) D
.S REQUEST("Request",NUM,"SdecContactNumberOfCalls")=""
.S REQUEST("Request",NUM,"SdecContactNumberOfLetters")=""
.S REQUEST("Request",NUM,"SdecContactNumberOfEmailContact")=""
.S REQUEST("Request",NUM,"SdecContactNumberOfTextContact")=""
.S REQUEST("Request",NUM,"SdecContactNumberOfSecureMessage")=""
.S REQUEST("Request",NUM,"SdecContactDateOfLastLetterSent")=""
.S REQUEST("Request",NUM,"SdecContactNumberOfContacts")=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETAPPTREQ2 2781 printed Oct 16, 2024@18:57:01 Page 2
SDESGETAPPTREQ2 ;ALB/CGP,LAB,TJB - GET APPT REQ RPCS 2 ;Sep 11,2023
+1 ;;5.3;Scheduling;**839,847,861**;Aug 13, 1993;Build 17
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
VALIDATEDATES(REQUESTIEN,STARTRANGE,ENDRANGE) ;
+1 NEW STARTDATE,ENDDATE,CREATEDATE,VALIDSTDATE,VALIDENDATE
+2 SET (STARTDATE,ENDDATE,CREATEDATE,VALIDSTDATE,VALIDENDATE)=""
+3 ;
+4 SET CREATEDATE=$$GET1^DIQ(409.85,REQUESTIEN,1,"I")
+5 if CREATEDATE=""
QUIT 0
+6 ;
+7 IF STARTRANGE=""
SET VALIDSTDATE=1
+8 IF STARTRANGE'=""
Begin DoDot:1
+9 SET STARTDATE=$$ISOTFM^SDAMUTDT(STARTRANGE)
+10 IF (STARTDATE<CREATEDATE)!(STARTDATE=CREATEDATE)
SET VALIDSTDATE=1
+11 IF STARTDATE>CREATEDATE
SET VALIDSTDATE=0
End DoDot:1
+12 ;
+13 if VALIDSTDATE=0
QUIT 0
+14 ;
+15 IF ENDRANGE=""
SET VALIDENDATE=1
+16 IF ENDRANGE'=""
Begin DoDot:1
+17 SET ENDDATE=$$ISOTFM^SDAMUTDT(ENDRANGE)
+18 IF (CREATEDATE<ENDDATE)!(ENDDATE=CREATEDATE)
SET VALIDENDATE=1
+19 IF CREATEDATE>ENDDATE
SET VALIDENDATE=0
End DoDot:1
+20 ;
+21 if VALIDENDATE=0
QUIT 0
+22 ;
+23 IF (VALIDSTDATE'=1)&(VALIDENDATE'=1)
QUIT 0
+24 QUIT 1
+25 ;
VALIDATESTART(ERRORS,STARTDATE) ;
+1 NEW ERRORFLAG
+2 SET STARTDATE=$$ISOTFM^SDAMUTDT(STARTDATE)
+3 IF STARTDATE=-1!(STARTDATE="")
DO ERRLOG^SDESJSON(.ERRORS,11)
+4 IF $LENGTH(STARTDATE,".")>1
DO ERRLOG^SDESJSON(.ERRORS,431)
+5 QUIT
+6 ;
VALIDATEEND(ERRORS,ENDDATE) ;
+1 NEW ERRORFLAG
+2 SET ENDDATE=$$ISOTFM^SDAMUTDT(ENDDATE)
+3 IF ENDDATE=-1!(ENDDATE="")
DO ERRLOG^SDESJSON(.ERRORS,12)
+4 IF $LENGTH(ENDDATE,".")>1
DO ERRLOG^SDESJSON(.ERRORS,431)
+5 QUIT
+6 ;
VALIDATERANGE(ERRORS,STARTDATE,ENDDATE) ;
+1 NEW ERRORFLAG
+2 SET STARTDATE=$$ISOTFM^SDAMUTDT(STARTDATE)
+3 SET ENDDATE=$$ISOTFM^SDAMUTDT(ENDDATE)
+4 IF ENDDATE<STARTDATE
DO ERRLOG^SDESJSON(.ERRORS,13)
+5 QUIT
VALIDATEREQIEN(ERRORS,REQUESTIEN) ;
+1 IF REQUESTIEN=""
DO ERRLOG^SDESJSON(.ERRORS,3)
QUIT 0
+2 IF REQUESTIEN'=""
IF ('$DATA(^SDEC(409.85,REQUESTIEN)))!(REQUESTIEN=0)
DO ERRLOG^SDESJSON(.ERRORS,4)
QUIT 0
+3 QUIT 1
+4 ;
VALIDATEAPPTIEN(ERRORS,APPTIEN) ;
+1 IF APPTIEN=""
DO ERRLOG^SDESJSON(.ERRORS,14)
QUIT 0
+2 IF APPTIEN'=""
IF '$DATA(^SDEC(409.84,APPTIEN,0))
DO ERRLOG^SDESJSON(.ERRORS,15)
QUIT 0
+3 QUIT 1
+4 ;
VALIDATEDFN(ERRORS,DFN) ;
+1 IF DFN=""
DO ERRLOG^SDESJSON(.ERRORS,1)
QUIT 0
+2 IF DFN'=""
IF '$DATA(^DPT(DFN,0))
DO ERRLOG^SDESJSON(.ERRORS,2)
QUIT 0
+3 QUIT 1
+4 ;
VALIDATEEAS(ERRORS,EAS) ;
+1 IF $LENGTH(EAS)
SET EAS=$$EASVALIDATE^SDESUTIL($GET(EAS))
+2 IF $PIECE($GET(EAS),U)=-1
DO ERRLOG^SDESJSON(.ERRORS,142)
QUIT 0
+3 QUIT 1
+4 ;
FINISHAPPTREQ(REQUEST,NUM,REQUESTIEN) ; finish building Request object
+1 IF '$DATA(^SDEC(409.86,"SRP",REQUESTIEN))
Begin DoDot:1
+2 SET REQUEST("Request",NUM,"SdecContactNumberOfCalls")=""
+3 SET REQUEST("Request",NUM,"SdecContactNumberOfLetters")=""
+4 SET REQUEST("Request",NUM,"SdecContactNumberOfEmailContact")=""
+5 SET REQUEST("Request",NUM,"SdecContactNumberOfTextContact")=""
+6 SET REQUEST("Request",NUM,"SdecContactNumberOfSecureMessage")=""
+7 SET REQUEST("Request",NUM,"SdecContactDateOfLastLetterSent")=""
+8 SET REQUEST("Request",NUM,"SdecContactNumberOfContacts")=""
End DoDot:1
+9 QUIT