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

SDESGETAPPTREQ2.m

Go to the documentation of this file.
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