SDES2VAL44 ;ALB/BWF,MGD/BLB - SDES2 Clinic validation utilities ;DEC 31, 2023
;;5.3;Scheduling;**853,857,864,866,871**;Aug 13, 1993;Build 13
;;Per VHA Directive 6402, this routine should not be modified
;
Q
; ISREQUIRED - 1 = true - this forces a clinic ien to be passed in and must be valid
; 0 or "" = false - the incoming value of "" will pass validation - i.e. not required
; ALLOWDELETE - 1 = true - this allows '@' to be valid for deletion. "" is also valid since
; it does the same as '@' from a data perspective
; 0 or "" = false - '@' will not be valid
VALCLINIEN(ERRORS,SDIEN,ISREQUIRED,ALLOWDELETE) ;
I $G(ISREQUIRED),SDIEN="" D ERRLOG^SDES2JSON(.ERRORS,18) Q
I '$G(ISREQUIRED),SDIEN="" Q
I $G(ALLOWDELETE),(SDIEN="@")!(SDIEN="") Q
I '$G(ALLOWDELETE),SDIEN="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Clinic ID") Q
I '$D(^SC(SDIEN,0)) D ERRLOG^SDES2JSON(.ERRORS,19)
Q
;
VALNAME(ERRORS,SDNAME,FDATA) ; required - cannot be deleted with @ or "" - can be changed
I SDNAME="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Clinic Name") Q
I SDNAME="" D ERRLOG^SDES2JSON(.ERRORS,50) Q
S SDNAME=$$UP^XLFSTR(SDNAME)
I $L(SDNAME)>30!($L(SDNAME)<2)!'(SDNAME'?1P.E)!(SDNAME'?.ANP) D ERRLOG^SDES2JSON(.ERRORS,51) Q
I SDNAME'="",$D(^SC("B",$E(SDNAME,1,30))) D ERRLOG^SDES2JSON(.ERRORS,481) Q
S FDATA("NAME")=SDNAME
Q
;
VALABBR(ERRORS,SDABR,FDATA) ;
I SDABR="@" S FDATA("ABBREVIATION")="" Q
I SDABR'="",$L(SDABR)>7 D ERRLOG^SDES2JSON(.ERRORS,251) Q
S FDATA("ABBREVIATION")=SDABR
Q
;
VALPATFNAME(ERRORS,SDPATNAME,FDATA) ;
I SDPATNAME="@" S FDATA("PATIENT FRIENDLY NAME")="" Q
I SDPATNAME'="",(($L(SDPATNAME)<3)!($L(SDPATNAME)>80)) D ERRLOG^SDES2JSON(.ERRORS,482) Q
S FDATA("PATIENT FRIENDLY NAME")=SDPATNAME
Q
;
VALMEETATFACIL(ERRORS,SDMEETATFAC,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
I SDMEETATFAC="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Clinic meets at this facility?") Q
; Default to Y like SDBUILD
I SDMEETATFAC="" S SDMEETATFAC="Y"
I '$$CHECKYN^SDES2UTIL(SDMEETATFAC) D ERRLOG^SDES2JSON(.ERRORS,87) Q
S FDATA("MEETS AT FACILITY")=SDMEETATFAC
Q
;
VALDIRPATSCHED(ERRORS,SDPATSCHED,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
I SDPATSCHED="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Direct Patient Scheduling") Q
I SDPATSCHED="" D ERRLOG^SDES2JSON(.ERRORS,88) Q
I '$$CHECKYN^SDES2UTIL(SDPATSCHED) D ERRLOG^SDES2JSON(.ERRORS,89) Q
S FDATA("DIRECT PATIENT SCHEDULING")=SDPATSCHED
Q
;
VALDISPAPPT(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
N SDDISPAPPT
S SDDISPAPPT=$G(SDCLINIC("DISPLAY APPOINTMENTS"))
I SDDISPAPPT="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Display Clinic Appointment to Patients") Q
I SDDISPAPPT="" D ERRLOG^SDES2JSON(.ERRORS,90) Q
I '$$CHECKYN^SDES2UTIL(SDDISPAPPT) D ERRLOG^SDES2JSON(.ERRORS,91)
S FDATA("DISPLAY APPOINTMENTS")=SDDISPAPPT
Q
;
VALSERVICE(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with @ or "" - can be changed
N VRET
D VALFIELD^SDES2VALUTIL(.VRET,.ERRORS,44,9,$G(SDCLINIC("SERVICE")),1,,92,93,229)
S FDATA("SERVICE")=$G(VRET(44,9,"I"))
Q
;
VALNONCOUNT(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
N SDNONCOUNT
S SDNONCOUNT=$G(SDCLINIC("NON-COUNT"))
I SDNONCOUNT="" D ERRLOG^SDES2JSON(.ERRORS,94) Q
I SDNONCOUNT="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Non-count Clinic") Q
I '$$CHECKYN^SDES2UTIL(SDNONCOUNT) D ERRLOG^SDES2JSON(.ERRORS,95) Q
S FDATA("NON-COUNT")=SDNONCOUNT
Q
;
VALDIV(ERRORS,SDCLINIC,FDATA) ; required field, cannot be deleted with @ or "" - can be changed
N SDDIVISION
S SDDIVISION=$G(SDCLINIC("DIVISION"))
I SDDIVISION="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Division") Q
I SDDIVISION="" D ERRLOG^SDES2JSON(.ERRORS,96) Q
I +SDDIVISION,$D(^DG(40.8,SDDIVISION,0)) S FDATA("DIVISION")=SDDIVISION Q
S SDDIVISION=$O(^DG(40.8,"B",$E(SDDIVISION,1,30),"A"),-1)
I SDDIVISION="" S SDDIVISION=$G(SDCLINIC("DIVISION")),SDDIVISION=$O(^DG(40.8,"C",$E(SDDIVISION,1,30),""),-1)
I 'SDDIVISION D ERRLOG^SDES2JSON(.ERRORS,97) Q
S FDATA("DIVISION")=SDDIVISION
Q
;
VALINCPERHOUR(ERRORS,SDCLINIC,FDATA) ; required field, cannot be deleted with @ or "" - can't be changed
N SDDISINCPERHOUR,ERR
S SDDISINCPERHOUR=$G(SDCLINIC("DISPLAY INCREMENTS PER HOUR"))
I SDDISINCPERHOUR="" D ERRLOG^SDES2JSON(.ERRORS,117) Q
I SDDISINCPERHOUR="@" D ERRLOG^SDES2JSON(.ERRORS,229) Q
I SDDISINCPERHOUR'="" D
.S ERR='$F("^60^30^20^15^10^","^"_SDDISINCPERHOUR_"^")
.I ERR D ERRLOG^SDES2JSON(.ERRORS,118) Q
.S SDDISINCPERHOUR=60\SDDISINCPERHOUR
.S FDATA("DISPLAY INCREMENTS PER HOUR")=SDDISINCPERHOUR
Q
;
VALAPPTTYPE(ERRORS,SDCLINIC,FDATA) ;
N SDAPPTTYP
S SDAPPTTYP=$G(SDCLINIC("DEFAULT APPOINTMENT TYPE"))
I SDAPPTTYP=""!(SDAPPTTYP="@") S FDATA("DEFAULT APPOINTMENT TYPE")="" Q
I +SDAPPTTYP,$D(^SD(409.1,SDAPPTTYP,0)) S FDATA("DEFAULT APPOINTMENT TYPE")=SDAPPTTYP Q
S SDAPPTTYP=$O(^SD(409.1,"B",$E(SDAPPTTYP,1,30),""),-1)
I 'SDAPPTTYP D ERRLOG^SDES2JSON(.ERRORS,83) Q
I SDAPPTTYP S FDATA("DEFAULT APPOINTMENT TYPE")=SDAPPTTYP Q
;
VALINPATMED(ERRORS,SDCLINIC,FDATA) ;
N SDINPATMED
S SDINPATMED=$G(SDCLINIC("ADMIN INPATIENT MEDS"))
I SDINPATMED="@"!(SDINPATMED="") S FDATA("ADMIN INPATIENT MEDS")="" Q
I SDINPATMED'="Y" D ERRLOG^SDES2JSON(.ERRORS,122) Q
S FDATA("ADMIN INPATIENT MEDS")=$$YNTOBOOL^SDES2UTIL(SDINPATMED)
Q
;
VALPHONE(ERRORS,SDPHONE,FDATA) ;
I SDPHONE=""!(SDPHONE="@") S FDATA("TELEPHONE")="" Q
I $L(SDPHONE)<3!($L(SDPHONE)>13) D ERRLOG^SDES2JSON(.ERRORS,483) Q
S FDATA("TELEPHONE")=SDPHONE
Q
VALPHONEEXT(ERRORS,SDPHONEEXT,FDATA) ;
I SDPHONEEXT=""!(SDPHONEEXT="@") S FDATA("TELEPHONE EXTENSION")="" Q
I $L(SDPHONEEXT)>26 D ERRLOG^SDES2JSON(.ERRORS,424) Q
S FDATA("TELEPHONE EXTENSION")=SDPHONEEXT
Q
;
VALXRAY(ERRORS,SDREQXRAY,FDATA) ;
I SDREQXRAY="@"!(SDREQXRAY="") S FDATA("REQUIRE X-RAY")="" Q
I SDREQXRAY'="Y" D ERRLOG^SDES2JSON(.ERRORS,123) Q
S FDATA("REQUIRE X-RAY")=SDREQXRAY
Q
;
VALSCHEDHOLIDAY(ERRORS,SDSCHEDHOLIDAY,FDATA) ; SCHEDULE ON HOLIDAYS?
I SDSCHEDHOLIDAY="@"!(SDSCHEDHOLIDAY="") S FDATA("SCHEDULE ON HOLIDAYS")="" Q
I SDSCHEDHOLIDAY'="",SDSCHEDHOLIDAY'="Y" D ERRLOG^SDES2JSON(.ERRORS,360) Q
S FDATA("SCHEDULE ON HOLIDAYS")=SDSCHEDHOLIDAY
Q
;
VALPROFILE(ERRORS,SDCLINIC,FDATA) ; required - cannot be deleted with '@' or "" - can be changed
N SDREQPROFILE
S SDREQPROFILE=$G(SDCLINIC("REQUIRE ACTION PROFILES"))
I SDREQPROFILE="" D ERRLOG^SDES2JSON(.ERRORS,477) Q
I SDREQPROFILE="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Require Action Profiles") Q
I '$$CHECKYN^SDES2UTIL(SDREQPROFILE) D ERRLOG^SDES2JSON(.ERRORS,100) Q
S SDREQPROFILE=$$YNTOBOOL^SDES2UTIL(SDREQPROFILE)
I SDREQPROFILE?1N S FDATA("REQUIRE ACTION PROFILES")='SDREQPROFILE ;Because this field is defined oddly where 1=No and 0=Yes
Q
;
VALNOSHOWLET(ERRORS,SDCLINIC,FDATA) ;
N SDNOSHOWLET,NOSHOWERRORS
S SDNOSHOWLET=$G(SDCLINIC("NO-SHOW LETTER"))
I SDNOSHOWLET=""!(SDNOSHOWLET="@") S FDATA("NO-SHOW LETTER")="" Q
S SDNOSHOWLET=$$LETTERIEN(.NOSHOWERRORS,SDNOSHOWLET)
I 'SDNOSHOWLET D ERRLOG^SDES2JSON(.ERRORS,82,"No-show") Q
S FDATA("NO-SHOW LETTER")=SDNOSHOWLET
Q
;
VALPREAPTLET(ERRORS,SDCLINIC,FDATA) ;
N SDPREAPTLET,PREAPTERRORS
S SDPREAPTLET=$G(SDCLINIC("PRE-APPOINTMENT LETTER"))
I SDPREAPTLET=""!(SDPREAPTLET="@") S FDATA("PRE-APPOINTMENT LETTER")="" Q
S SDPREAPTLET=$$LETTERIEN(.PREAPTERRORS,SDPREAPTLET)
I 'SDPREAPTLET D ERRLOG^SDES2JSON(.ERRORS,82,"Pre appointment") Q
S FDATA("PRE-APPOINTMENT LETTER")=SDPREAPTLET
Q
;
VALCANLET(ERRORS,SDCLINIC,FDATA) ;
N SDCANLET,CANLETERRORS
S SDCANLET=$G(SDCLINIC("CLINIC CANCELLATION LETTER"))
I SDCANLET=""!(SDCANLET="@") S FDATA("CLINIC CANCELLATION LETTER")="" Q
S SDCANLET=$$LETTERIEN(.CANLETERRORS,SDCANLET)
I 'SDCANLET D ERRLOG^SDES2JSON(.ERRORS,82,"Clinic cancellation") Q
S FDATA("CLINIC CANCELLATION LETTER")=SDCANLET
Q
;
VALAPTCANLET(ERRORS,SDCLINIC,FDATA) ;
N SDAPTCANLET,CANLETERRORS
S SDAPTCANLET=$G(SDCLINIC("APPOINTMENT CANCELLATION LETTER"))
I SDAPTCANLET=""!(SDAPTCANLET="@") S FDATA("APPOINTMENT CANCELLATION LETTER")="" Q
S SDAPTCANLET=$$LETTERIEN(.CANLETERRORS,SDAPTCANLET)
I 'SDAPTCANLET D ERRLOG^SDES2JSON(.ERRORS,82,"Appointment cancellation") Q
S FDATA("APPOINTMENT CANCELLATION LETTER")=SDAPTCANLET
Q
;
VALINOUTTIME(ERRORS,SDCLINIC,FDATA) ;
N SDINOUTTIME
S SDINOUTTIME=$G(SDCLINIC("ASK CHECK IN/OUT"))
I SDINOUTTIME="@"!(SDINOUTTIME="") S FDATA("ASK CHECK IN/OUT")="" Q
I '$$CHECKYN^SDES2UTIL(SDINOUTTIME) D ERRLOG^SDES2JSON(.ERRORS,101) Q
S SDINOUTTIME=$$YNTOBOOL^SDES2UTIL(SDINOUTTIME)
S FDATA("ASK CHECK IN/OUT")=SDINOUTTIME
Q
;
VALSTARTHOUR(ERRORS,SDSTARTHR,FDATA) ; HOUR CLINIC DISPLAY BEGINS
I SDSTARTHR="" S SDSTARTHR=8 ;default
I SDSTARTHR'="" S SDSTARTHR=+SDSTARTHR
I SDSTARTHR>16 D ERRLOG^SDES2JSON(.ERRORS,119) Q
S FDATA("HOUR CLINIC DISPLAY BEGINS")=SDSTARTHR
Q
;
VALDEFAULTTOPRAC(ERRORS,SDCLINIC,FDATA) ;
N SDPRACTIONER
S SDPRACTIONER=$G(SDCLINIC("DEFAULT TO PC PRACTITIONER"))
I SDPRACTIONER="@"!(SDPRACTIONER="") S FDATA("DEFAULT TO PC PRACTITIONER")="" Q
I '$$CHECKYN^SDES2UTIL(SDPRACTIONER) D ERRLOG^SDES2JSON(.ERRORS,102) Q
S SDPRACTIONER=$$YNTOBOOL^SDES2UTIL(SDPRACTIONER)
S FDATA("DEFAULT TO PC PRACTITIONER")=SDPRACTIONER
Q
;
VALWORKLOAD(ERRORS,SDCLINIC,FDATA) ;
N SDWORKLOAD
S SDWORKLOAD=$G(SDCLINIC("WORKLOAD VALIDATION"))
I SDWORKLOAD="@"!(SDWORKLOAD="") S FDATA("WORKLOAD VALIDATION")="" Q
I '$$CHECKYN^SDES2UTIL(SDWORKLOAD) D ERRLOG^SDES2JSON(.ERRORS,103) Q
S SDWORKLOAD=$$YNTOBOOL^SDES2UTIL(SDWORKLOAD)
S FDATA("WORKLOAD VALIDATION")=SDWORKLOAD
Q
;
VALALLOWNOSHOW(ERRORS,SDALLOWNOSHW,FDATA) ; required - cannot be deleted with '@' or "" - can be changed
I SDALLOWNOSHW="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Allowable Consecutive No-Shows") Q
I SDALLOWNOSHW="" D ERRLOG^SDES2JSON(.ERRORS,104) Q
I SDALLOWNOSHW["."!(SDALLOWNOSHW'?1.3N) D ERRLOG^SDES2JSON(.ERRORS,105) Q
S FDATA("ALLOWABLE CONSECUTIVE NO-SHOWS")=SDALLOWNOSHW
Q
;
VALMAXFUTBOOK(ERRORS,SDMAXFUTBOOK,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
I SDMAXFUTBOOK="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Max # Days for Future Booking") Q
I SDMAXFUTBOOK="" D ERRLOG^SDES2JSON(.ERRORS,106) Q
I SDMAXFUTBOOK'?1.3N D ERRLOG^SDES2JSON(.ERRORS,107) Q
I SDMAXFUTBOOK["."!((SDMAXFUTBOOK<11)!(SDMAXFUTBOOK>999)) D ERRLOG^SDES2JSON(.ERRORS,107) Q
S FDATA("MAX DAYS FUTURE BOOKING")=SDMAXFUTBOOK
Q
;
VALNOACCESS(ERRORS,SDNOACCESS,FDATA) ;
I SDNOACCESS="@"!(SDNOACCESS="") S FDATA("PROHIBIT ACCESS TO CLINIC")="" Q
I SDNOACCESS'="Y" D ERRLOG^SDES2JSON(.ERRORS,485) Q
S FDATA("PROHIBIT ACCESS TO CLINIC")=SDNOACCESS
Q
;
VALINCLUDEFROOM(ERRORS,SDFILEROOM,FDATA) ;
I SDFILEROOM="@"!(SDFILEROOM="") S FDATA("INCLUDE ON FILE ROOM LISTS")="" Q
I '$$CHECKYN^SDES2UTIL(SDFILEROOM) D ERRLOG^SDES2JSON(.ERRORS,495) Q
S FDATA("INCLUDE ON FILE ROOM LISTS")=SDFILEROOM
Q
;
VALLOCATION(ERRORS,SDLOCATION,FDATA) ;
I SDLOCATION=""!(SDLOCATION="@") S FDATA("PHYSICAL LOCATION")="" Q
I $L(SDLOCATION)<1!($L(SDLOCATION)>25) D ERRLOG^SDES2JSON(.ERRORS,484) Q
S FDATA("PHYSICAL LOCATION")=SDLOCATION
Q
;
VALPRINCLINIC(ERRORS,SDPRINCLINIC,FDATA) ;
I SDPRINCLINIC="@"!(SDPRINCLINIC="") S FDATA("PRINCIPAL CLINIC")="" Q
I +SDPRINCLINIC,$$INACTIVE^SDES2UTIL(SDPRINCLINIC,DT) D ERRLOG^SDES2JSON(.ERRORS,510,SDPRINCLINIC) Q
I +SDPRINCLINIC,$D(^SC(SDPRINCLINIC,0)) S FDATA("PRINCIPAL CLINIC")=SDPRINCLINIC Q
S SDPRINCLINIC=$O(^SC("B",$E(SDPRINCLINIC,1,30),""),-1)
I SDPRINCLINIC="" D ERRLOG^SDES2JSON(.ERRORS,110) Q
I $$INACTIVE^SDES2UTIL(SDPRINCLINIC,DT) D ERRLOG^SDES2JSON(.ERRORS,510,$$GET1^DIQ(44,SDPRINCLINIC,.01,"E")) Q
S FDATA("PRINCIPAL CLINIC")=SDPRINCLINIC
Q
;
VALOVBDAYMAX(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
N SDOVBDAYMAX
S SDOVBDAYMAX=$G(SDCLINIC("OVERBOOKS/DAY MAX"))
I SDOVBDAYMAX="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Overbooks/Day Maximum") Q
I SDOVBDAYMAX="" D ERRLOG^SDES2JSON(.ERRORS,111) Q
I SDOVBDAYMAX'?1.4N D ERRLOG^SDES2JSON(.ERRORS,112) Q
S FDATA("OVERBOOKS/DAY MAX")=SDOVBDAYMAX
Q
;
VALCHECKIN(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
N SDECHECKIN
S SDECHECKIN=$G(SDCLINIC("E-CHECKIN ALLOWED"))
I SDECHECKIN="" D ERRLOG^SDES2JSON(.ERRORS,478) Q
I SDECHECKIN="@" D ERRLOG^SDES2JSON(.ERRORS,229,"E-Checkin Allowed") Q
I '$$CHECKYN^SDES2UTIL(SDECHECKIN) D ERRLOG^SDES2JSON(.ERRORS,113) Q
S SDECHECKIN=$$YNTOBOOL^SDES2UTIL(SDECHECKIN)
S FDATA("E-CHECKIN ALLOWED")=SDECHECKIN
Q
;
VALPRECHECKIN(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
N SDPRECHECKIN
S SDPRECHECKIN=$G(SDCLINIC("PRE-CHECKIN ALLOWED"))
I SDPRECHECKIN="" D ERRLOG^SDES2JSON(.ERRORS,476) Q
I SDPRECHECKIN="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Pre-Check-in Allowed") Q
I '$$CHECKYN^SDES2UTIL(SDPRECHECKIN) D ERRLOG^SDES2JSON(.ERRORS,114) Q
S SDPRECHECKIN=$$YNTOBOOL^SDES2UTIL(SDPRECHECKIN)
S FDATA("PRE-CHECKIN ALLOWED")=SDPRECHECKIN
Q
;
VALAPPTLENGTH(ERRORS,SDLENGTHOFAPT,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
I SDLENGTHOFAPT="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Length of Appointment") Q
I SDLENGTHOFAPT="" D ERRLOG^SDES2JSON(.ERRORS,115) Q
I ((SDLENGTHOFAPT<10)!(SDLENGTHOFAPT>240)) D ERRLOG^SDES2JSON(.ERRORS,116) Q
I (SDLENGTHOFAPT#10'=0),(SDLENGTHOFAPT#15'=0) D ERRLOG^SDES2JSON(.ERRORS,116) Q
S FDATA("LENGTH OF APPOINTMENT")=SDLENGTHOFAPT
Q
;
VALVARAPTLENGTH(ERRORS,SDCLINIC,FDATA) ;
N SDVARAPTLNG
S SDVARAPTLNG=$G(SDCLINIC("VARIABLE APPOINTMENT LENGTH"))
I SDVARAPTLNG="@"!(SDVARAPTLNG="") S FDATA("VARIABLE APPOINTMENT LENGTH")="" Q
I '$$CHECKYN^SDES2UTIL(SDVARAPTLNG) D ERRLOG^SDES2JSON(.ERRORS,301) Q
I SDVARAPTLNG="Y" S SDVARAPTLNG="V",FDATA("VARIABLE APPOINTMENT LENGTH")=SDVARAPTLNG Q
S SDVARAPTLNG=""
S FDATA("VARIABLE APPOINTMENT LENGTH")=SDVARAPTLNG
Q
;
VALPRIMAMIS(ERRORS,SDCLINIC,FDATA) ; PRIMARY AMIS STOP CODE
N SDPRIMAMIS,SDAMISERROR
S SDPRIMAMIS=$G(SDCLINIC("PRIMARY AMIS"))
I SDPRIMAMIS="" D ERRLOG^SDES2JSON(.ERRORS,479) Q
I SDPRIMAMIS="@" D ERRLOG^SDES2JSON(.ERRORS,229,"Primary AMIS") Q
S SDAMISERROR=$$VALIDATEAMIS^SDES2UTIL(.SDPRIMAMIS,"P")
I SDAMISERROR D ERRLOG^SDES2JSON(.ERRORS,SDAMISERROR) Q
S FDATA("PRIMARY AMIS")=SDPRIMAMIS
Q
;
VALCREDITAMIS(ERRORS,SDCLINIC,FDATA) ; CREDIT AMIS STOP CODE
N SDCREDITAMIS,SDAMISERROR
S SDCREDITAMIS=$G(SDCLINIC("CREDIT AMIS"))
I SDCREDITAMIS=""!(SDCREDITAMIS="@") S FDATA("CREDIT AMIS")=SDCREDITAMIS Q
S SDAMISERROR=$$VALIDATEAMIS^SDES2UTIL(.SDCREDITAMIS,"C")
I SDAMISERROR D ERRLOG^SDES2JSON(.ERRORS,SDAMISERROR) Q
S FDATA("CREDIT AMIS")=SDCREDITAMIS
Q
;
CONDAMISCHECK(ERRORS,SDPRIMAMIS,SDCREDITAMIS) ;
; Primary & Credit Stop Codes can't be the same
I SDPRIMAMIS=SDCREDITAMIS D ERRLOG^SDES2JSON(.ERRORS,380)
Q
;
LETTERIEN(ERRORS,LETTER) ;Look up the letter IEN
I LETTER'="@",LETTER'="" D
.I +LETTER,$$GET1^DIQ(407.5,LETTER,.01)'="" Q
.S LETTER=$O(^VA(407.5,"B",$E(LETTER,1,30),""))
Q LETTER
;
VALPBSPID(ERRORS,PBSPID,FDATA) ;
N VAL
I $L(PBSPID)>100 D ERRLOG^SDES2JSON(.ERRORS,556)
S FDATA("PBSPID")=PBSPID
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2VAL44 15479 printed Oct 16, 2024@18:55:18 Page 2
SDES2VAL44 ;ALB/BWF,MGD/BLB - SDES2 Clinic validation utilities ;DEC 31, 2023
+1 ;;5.3;Scheduling;**853,857,864,866,871**;Aug 13, 1993;Build 13
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ; ISREQUIRED - 1 = true - this forces a clinic ien to be passed in and must be valid
+6 ; 0 or "" = false - the incoming value of "" will pass validation - i.e. not required
+7 ; ALLOWDELETE - 1 = true - this allows '@' to be valid for deletion. "" is also valid since
+8 ; it does the same as '@' from a data perspective
+9 ; 0 or "" = false - '@' will not be valid
VALCLINIEN(ERRORS,SDIEN,ISREQUIRED,ALLOWDELETE) ;
+1 IF $GET(ISREQUIRED)
IF SDIEN=""
DO ERRLOG^SDES2JSON(.ERRORS,18)
QUIT
+2 IF '$GET(ISREQUIRED)
IF SDIEN=""
QUIT
+3 IF $GET(ALLOWDELETE)
IF (SDIEN="@")!(SDIEN="")
QUIT
+4 IF '$GET(ALLOWDELETE)
IF SDIEN="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Clinic ID")
QUIT
+5 IF '$DATA(^SC(SDIEN,0))
DO ERRLOG^SDES2JSON(.ERRORS,19)
+6 QUIT
+7 ;
VALNAME(ERRORS,SDNAME,FDATA) ; required - cannot be deleted with @ or "" - can be changed
+1 IF SDNAME="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Clinic Name")
QUIT
+2 IF SDNAME=""
DO ERRLOG^SDES2JSON(.ERRORS,50)
QUIT
+3 SET SDNAME=$$UP^XLFSTR(SDNAME)
+4 IF $LENGTH(SDNAME)>30!($LENGTH(SDNAME)<2)!'(SDNAME'?1P.E)!(SDNAME'?.ANP)
DO ERRLOG^SDES2JSON(.ERRORS,51)
QUIT
+5 IF SDNAME'=""
IF $DATA(^SC("B",$EXTRACT(SDNAME,1,30)))
DO ERRLOG^SDES2JSON(.ERRORS,481)
QUIT
+6 SET FDATA("NAME")=SDNAME
+7 QUIT
+8 ;
VALABBR(ERRORS,SDABR,FDATA) ;
+1 IF SDABR="@"
SET FDATA("ABBREVIATION")=""
QUIT
+2 IF SDABR'=""
IF $LENGTH(SDABR)>7
DO ERRLOG^SDES2JSON(.ERRORS,251)
QUIT
+3 SET FDATA("ABBREVIATION")=SDABR
+4 QUIT
+5 ;
VALPATFNAME(ERRORS,SDPATNAME,FDATA) ;
+1 IF SDPATNAME="@"
SET FDATA("PATIENT FRIENDLY NAME")=""
QUIT
+2 IF SDPATNAME'=""
IF (($LENGTH(SDPATNAME)<3)!($LENGTH(SDPATNAME)>80))
DO ERRLOG^SDES2JSON(.ERRORS,482)
QUIT
+3 SET FDATA("PATIENT FRIENDLY NAME")=SDPATNAME
+4 QUIT
+5 ;
VALMEETATFACIL(ERRORS,SDMEETATFAC,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
+1 IF SDMEETATFAC="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Clinic meets at this facility?")
QUIT
+2 ; Default to Y like SDBUILD
+3 IF SDMEETATFAC=""
SET SDMEETATFAC="Y"
+4 IF '$$CHECKYN^SDES2UTIL(SDMEETATFAC)
DO ERRLOG^SDES2JSON(.ERRORS,87)
QUIT
+5 SET FDATA("MEETS AT FACILITY")=SDMEETATFAC
+6 QUIT
+7 ;
VALDIRPATSCHED(ERRORS,SDPATSCHED,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
+1 IF SDPATSCHED="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Direct Patient Scheduling")
QUIT
+2 IF SDPATSCHED=""
DO ERRLOG^SDES2JSON(.ERRORS,88)
QUIT
+3 IF '$$CHECKYN^SDES2UTIL(SDPATSCHED)
DO ERRLOG^SDES2JSON(.ERRORS,89)
QUIT
+4 SET FDATA("DIRECT PATIENT SCHEDULING")=SDPATSCHED
+5 QUIT
+6 ;
VALDISPAPPT(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
+1 NEW SDDISPAPPT
+2 SET SDDISPAPPT=$GET(SDCLINIC("DISPLAY APPOINTMENTS"))
+3 IF SDDISPAPPT="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Display Clinic Appointment to Patients")
QUIT
+4 IF SDDISPAPPT=""
DO ERRLOG^SDES2JSON(.ERRORS,90)
QUIT
+5 IF '$$CHECKYN^SDES2UTIL(SDDISPAPPT)
DO ERRLOG^SDES2JSON(.ERRORS,91)
+6 SET FDATA("DISPLAY APPOINTMENTS")=SDDISPAPPT
+7 QUIT
+8 ;
VALSERVICE(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with @ or "" - can be changed
+1 NEW VRET
+2 DO VALFIELD^SDES2VALUTIL(.VRET,.ERRORS,44,9,$GET(SDCLINIC("SERVICE")),1,,92,93,229)
+3 SET FDATA("SERVICE")=$GET(VRET(44,9,"I"))
+4 QUIT
+5 ;
VALNONCOUNT(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with "@" or "" - can be changed
+1 NEW SDNONCOUNT
+2 SET SDNONCOUNT=$GET(SDCLINIC("NON-COUNT"))
+3 IF SDNONCOUNT=""
DO ERRLOG^SDES2JSON(.ERRORS,94)
QUIT
+4 IF SDNONCOUNT="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Non-count Clinic")
QUIT
+5 IF '$$CHECKYN^SDES2UTIL(SDNONCOUNT)
DO ERRLOG^SDES2JSON(.ERRORS,95)
QUIT
+6 SET FDATA("NON-COUNT")=SDNONCOUNT
+7 QUIT
+8 ;
VALDIV(ERRORS,SDCLINIC,FDATA) ; required field, cannot be deleted with @ or "" - can be changed
+1 NEW SDDIVISION
+2 SET SDDIVISION=$GET(SDCLINIC("DIVISION"))
+3 IF SDDIVISION="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Division")
QUIT
+4 IF SDDIVISION=""
DO ERRLOG^SDES2JSON(.ERRORS,96)
QUIT
+5 IF +SDDIVISION
IF $DATA(^DG(40.8,SDDIVISION,0))
SET FDATA("DIVISION")=SDDIVISION
QUIT
+6 SET SDDIVISION=$ORDER(^DG(40.8,"B",$EXTRACT(SDDIVISION,1,30),"A"),-1)
+7 IF SDDIVISION=""
SET SDDIVISION=$GET(SDCLINIC("DIVISION"))
SET SDDIVISION=$ORDER(^DG(40.8,"C",$EXTRACT(SDDIVISION,1,30),""),-1)
+8 IF 'SDDIVISION
DO ERRLOG^SDES2JSON(.ERRORS,97)
QUIT
+9 SET FDATA("DIVISION")=SDDIVISION
+10 QUIT
+11 ;
VALINCPERHOUR(ERRORS,SDCLINIC,FDATA) ; required field, cannot be deleted with @ or "" - can't be changed
+1 NEW SDDISINCPERHOUR,ERR
+2 SET SDDISINCPERHOUR=$GET(SDCLINIC("DISPLAY INCREMENTS PER HOUR"))
+3 IF SDDISINCPERHOUR=""
DO ERRLOG^SDES2JSON(.ERRORS,117)
QUIT
+4 IF SDDISINCPERHOUR="@"
DO ERRLOG^SDES2JSON(.ERRORS,229)
QUIT
+5 IF SDDISINCPERHOUR'=""
Begin DoDot:1
+6 SET ERR='$FIND("^60^30^20^15^10^","^"_SDDISINCPERHOUR_"^")
+7 IF ERR
DO ERRLOG^SDES2JSON(.ERRORS,118)
QUIT
+8 SET SDDISINCPERHOUR=60\SDDISINCPERHOUR
+9 SET FDATA("DISPLAY INCREMENTS PER HOUR")=SDDISINCPERHOUR
End DoDot:1
+10 QUIT
+11 ;
VALAPPTTYPE(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDAPPTTYP
+2 SET SDAPPTTYP=$GET(SDCLINIC("DEFAULT APPOINTMENT TYPE"))
+3 IF SDAPPTTYP=""!(SDAPPTTYP="@")
SET FDATA("DEFAULT APPOINTMENT TYPE")=""
QUIT
+4 IF +SDAPPTTYP
IF $DATA(^SD(409.1,SDAPPTTYP,0))
SET FDATA("DEFAULT APPOINTMENT TYPE")=SDAPPTTYP
QUIT
+5 SET SDAPPTTYP=$ORDER(^SD(409.1,"B",$EXTRACT(SDAPPTTYP,1,30),""),-1)
+6 IF 'SDAPPTTYP
DO ERRLOG^SDES2JSON(.ERRORS,83)
QUIT
+7 IF SDAPPTTYP
SET FDATA("DEFAULT APPOINTMENT TYPE")=SDAPPTTYP
QUIT
+8 ;
VALINPATMED(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDINPATMED
+2 SET SDINPATMED=$GET(SDCLINIC("ADMIN INPATIENT MEDS"))
+3 IF SDINPATMED="@"!(SDINPATMED="")
SET FDATA("ADMIN INPATIENT MEDS")=""
QUIT
+4 IF SDINPATMED'="Y"
DO ERRLOG^SDES2JSON(.ERRORS,122)
QUIT
+5 SET FDATA("ADMIN INPATIENT MEDS")=$$YNTOBOOL^SDES2UTIL(SDINPATMED)
+6 QUIT
+7 ;
VALPHONE(ERRORS,SDPHONE,FDATA) ;
+1 IF SDPHONE=""!(SDPHONE="@")
SET FDATA("TELEPHONE")=""
QUIT
+2 IF $LENGTH(SDPHONE)<3!($LENGTH(SDPHONE)>13)
DO ERRLOG^SDES2JSON(.ERRORS,483)
QUIT
+3 SET FDATA("TELEPHONE")=SDPHONE
+4 QUIT
VALPHONEEXT(ERRORS,SDPHONEEXT,FDATA) ;
+1 IF SDPHONEEXT=""!(SDPHONEEXT="@")
SET FDATA("TELEPHONE EXTENSION")=""
QUIT
+2 IF $LENGTH(SDPHONEEXT)>26
DO ERRLOG^SDES2JSON(.ERRORS,424)
QUIT
+3 SET FDATA("TELEPHONE EXTENSION")=SDPHONEEXT
+4 QUIT
+5 ;
VALXRAY(ERRORS,SDREQXRAY,FDATA) ;
+1 IF SDREQXRAY="@"!(SDREQXRAY="")
SET FDATA("REQUIRE X-RAY")=""
QUIT
+2 IF SDREQXRAY'="Y"
DO ERRLOG^SDES2JSON(.ERRORS,123)
QUIT
+3 SET FDATA("REQUIRE X-RAY")=SDREQXRAY
+4 QUIT
+5 ;
VALSCHEDHOLIDAY(ERRORS,SDSCHEDHOLIDAY,FDATA) ; SCHEDULE ON HOLIDAYS?
+1 IF SDSCHEDHOLIDAY="@"!(SDSCHEDHOLIDAY="")
SET FDATA("SCHEDULE ON HOLIDAYS")=""
QUIT
+2 IF SDSCHEDHOLIDAY'=""
IF SDSCHEDHOLIDAY'="Y"
DO ERRLOG^SDES2JSON(.ERRORS,360)
QUIT
+3 SET FDATA("SCHEDULE ON HOLIDAYS")=SDSCHEDHOLIDAY
+4 QUIT
+5 ;
VALPROFILE(ERRORS,SDCLINIC,FDATA) ; required - cannot be deleted with '@' or "" - can be changed
+1 NEW SDREQPROFILE
+2 SET SDREQPROFILE=$GET(SDCLINIC("REQUIRE ACTION PROFILES"))
+3 IF SDREQPROFILE=""
DO ERRLOG^SDES2JSON(.ERRORS,477)
QUIT
+4 IF SDREQPROFILE="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Require Action Profiles")
QUIT
+5 IF '$$CHECKYN^SDES2UTIL(SDREQPROFILE)
DO ERRLOG^SDES2JSON(.ERRORS,100)
QUIT
+6 SET SDREQPROFILE=$$YNTOBOOL^SDES2UTIL(SDREQPROFILE)
+7 ;Because this field is defined oddly where 1=No and 0=Yes
IF SDREQPROFILE?1N
SET FDATA("REQUIRE ACTION PROFILES")='SDREQPROFILE
+8 QUIT
+9 ;
VALNOSHOWLET(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDNOSHOWLET,NOSHOWERRORS
+2 SET SDNOSHOWLET=$GET(SDCLINIC("NO-SHOW LETTER"))
+3 IF SDNOSHOWLET=""!(SDNOSHOWLET="@")
SET FDATA("NO-SHOW LETTER")=""
QUIT
+4 SET SDNOSHOWLET=$$LETTERIEN(.NOSHOWERRORS,SDNOSHOWLET)
+5 IF 'SDNOSHOWLET
DO ERRLOG^SDES2JSON(.ERRORS,82,"No-show")
QUIT
+6 SET FDATA("NO-SHOW LETTER")=SDNOSHOWLET
+7 QUIT
+8 ;
VALPREAPTLET(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDPREAPTLET,PREAPTERRORS
+2 SET SDPREAPTLET=$GET(SDCLINIC("PRE-APPOINTMENT LETTER"))
+3 IF SDPREAPTLET=""!(SDPREAPTLET="@")
SET FDATA("PRE-APPOINTMENT LETTER")=""
QUIT
+4 SET SDPREAPTLET=$$LETTERIEN(.PREAPTERRORS,SDPREAPTLET)
+5 IF 'SDPREAPTLET
DO ERRLOG^SDES2JSON(.ERRORS,82,"Pre appointment")
QUIT
+6 SET FDATA("PRE-APPOINTMENT LETTER")=SDPREAPTLET
+7 QUIT
+8 ;
VALCANLET(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDCANLET,CANLETERRORS
+2 SET SDCANLET=$GET(SDCLINIC("CLINIC CANCELLATION LETTER"))
+3 IF SDCANLET=""!(SDCANLET="@")
SET FDATA("CLINIC CANCELLATION LETTER")=""
QUIT
+4 SET SDCANLET=$$LETTERIEN(.CANLETERRORS,SDCANLET)
+5 IF 'SDCANLET
DO ERRLOG^SDES2JSON(.ERRORS,82,"Clinic cancellation")
QUIT
+6 SET FDATA("CLINIC CANCELLATION LETTER")=SDCANLET
+7 QUIT
+8 ;
VALAPTCANLET(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDAPTCANLET,CANLETERRORS
+2 SET SDAPTCANLET=$GET(SDCLINIC("APPOINTMENT CANCELLATION LETTER"))
+3 IF SDAPTCANLET=""!(SDAPTCANLET="@")
SET FDATA("APPOINTMENT CANCELLATION LETTER")=""
QUIT
+4 SET SDAPTCANLET=$$LETTERIEN(.CANLETERRORS,SDAPTCANLET)
+5 IF 'SDAPTCANLET
DO ERRLOG^SDES2JSON(.ERRORS,82,"Appointment cancellation")
QUIT
+6 SET FDATA("APPOINTMENT CANCELLATION LETTER")=SDAPTCANLET
+7 QUIT
+8 ;
VALINOUTTIME(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDINOUTTIME
+2 SET SDINOUTTIME=$GET(SDCLINIC("ASK CHECK IN/OUT"))
+3 IF SDINOUTTIME="@"!(SDINOUTTIME="")
SET FDATA("ASK CHECK IN/OUT")=""
QUIT
+4 IF '$$CHECKYN^SDES2UTIL(SDINOUTTIME)
DO ERRLOG^SDES2JSON(.ERRORS,101)
QUIT
+5 SET SDINOUTTIME=$$YNTOBOOL^SDES2UTIL(SDINOUTTIME)
+6 SET FDATA("ASK CHECK IN/OUT")=SDINOUTTIME
+7 QUIT
+8 ;
VALSTARTHOUR(ERRORS,SDSTARTHR,FDATA) ; HOUR CLINIC DISPLAY BEGINS
+1 ;default
IF SDSTARTHR=""
SET SDSTARTHR=8
+2 IF SDSTARTHR'=""
SET SDSTARTHR=+SDSTARTHR
+3 IF SDSTARTHR>16
DO ERRLOG^SDES2JSON(.ERRORS,119)
QUIT
+4 SET FDATA("HOUR CLINIC DISPLAY BEGINS")=SDSTARTHR
+5 QUIT
+6 ;
VALDEFAULTTOPRAC(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDPRACTIONER
+2 SET SDPRACTIONER=$GET(SDCLINIC("DEFAULT TO PC PRACTITIONER"))
+3 IF SDPRACTIONER="@"!(SDPRACTIONER="")
SET FDATA("DEFAULT TO PC PRACTITIONER")=""
QUIT
+4 IF '$$CHECKYN^SDES2UTIL(SDPRACTIONER)
DO ERRLOG^SDES2JSON(.ERRORS,102)
QUIT
+5 SET SDPRACTIONER=$$YNTOBOOL^SDES2UTIL(SDPRACTIONER)
+6 SET FDATA("DEFAULT TO PC PRACTITIONER")=SDPRACTIONER
+7 QUIT
+8 ;
VALWORKLOAD(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDWORKLOAD
+2 SET SDWORKLOAD=$GET(SDCLINIC("WORKLOAD VALIDATION"))
+3 IF SDWORKLOAD="@"!(SDWORKLOAD="")
SET FDATA("WORKLOAD VALIDATION")=""
QUIT
+4 IF '$$CHECKYN^SDES2UTIL(SDWORKLOAD)
DO ERRLOG^SDES2JSON(.ERRORS,103)
QUIT
+5 SET SDWORKLOAD=$$YNTOBOOL^SDES2UTIL(SDWORKLOAD)
+6 SET FDATA("WORKLOAD VALIDATION")=SDWORKLOAD
+7 QUIT
+8 ;
VALALLOWNOSHOW(ERRORS,SDALLOWNOSHW,FDATA) ; required - cannot be deleted with '@' or "" - can be changed
+1 IF SDALLOWNOSHW="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Allowable Consecutive No-Shows")
QUIT
+2 IF SDALLOWNOSHW=""
DO ERRLOG^SDES2JSON(.ERRORS,104)
QUIT
+3 IF SDALLOWNOSHW["."!(SDALLOWNOSHW'?1.3N)
DO ERRLOG^SDES2JSON(.ERRORS,105)
QUIT
+4 SET FDATA("ALLOWABLE CONSECUTIVE NO-SHOWS")=SDALLOWNOSHW
+5 QUIT
+6 ;
VALMAXFUTBOOK(ERRORS,SDMAXFUTBOOK,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
+1 IF SDMAXFUTBOOK="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Max # Days for Future Booking")
QUIT
+2 IF SDMAXFUTBOOK=""
DO ERRLOG^SDES2JSON(.ERRORS,106)
QUIT
+3 IF SDMAXFUTBOOK'?1.3N
DO ERRLOG^SDES2JSON(.ERRORS,107)
QUIT
+4 IF SDMAXFUTBOOK["."!((SDMAXFUTBOOK<11)!(SDMAXFUTBOOK>999))
DO ERRLOG^SDES2JSON(.ERRORS,107)
QUIT
+5 SET FDATA("MAX DAYS FUTURE BOOKING")=SDMAXFUTBOOK
+6 QUIT
+7 ;
VALNOACCESS(ERRORS,SDNOACCESS,FDATA) ;
+1 IF SDNOACCESS="@"!(SDNOACCESS="")
SET FDATA("PROHIBIT ACCESS TO CLINIC")=""
QUIT
+2 IF SDNOACCESS'="Y"
DO ERRLOG^SDES2JSON(.ERRORS,485)
QUIT
+3 SET FDATA("PROHIBIT ACCESS TO CLINIC")=SDNOACCESS
+4 QUIT
+5 ;
VALINCLUDEFROOM(ERRORS,SDFILEROOM,FDATA) ;
+1 IF SDFILEROOM="@"!(SDFILEROOM="")
SET FDATA("INCLUDE ON FILE ROOM LISTS")=""
QUIT
+2 IF '$$CHECKYN^SDES2UTIL(SDFILEROOM)
DO ERRLOG^SDES2JSON(.ERRORS,495)
QUIT
+3 SET FDATA("INCLUDE ON FILE ROOM LISTS")=SDFILEROOM
+4 QUIT
+5 ;
VALLOCATION(ERRORS,SDLOCATION,FDATA) ;
+1 IF SDLOCATION=""!(SDLOCATION="@")
SET FDATA("PHYSICAL LOCATION")=""
QUIT
+2 IF $LENGTH(SDLOCATION)<1!($LENGTH(SDLOCATION)>25)
DO ERRLOG^SDES2JSON(.ERRORS,484)
QUIT
+3 SET FDATA("PHYSICAL LOCATION")=SDLOCATION
+4 QUIT
+5 ;
VALPRINCLINIC(ERRORS,SDPRINCLINIC,FDATA) ;
+1 IF SDPRINCLINIC="@"!(SDPRINCLINIC="")
SET FDATA("PRINCIPAL CLINIC")=""
QUIT
+2 IF +SDPRINCLINIC
IF $$INACTIVE^SDES2UTIL(SDPRINCLINIC,DT)
DO ERRLOG^SDES2JSON(.ERRORS,510,SDPRINCLINIC)
QUIT
+3 IF +SDPRINCLINIC
IF $DATA(^SC(SDPRINCLINIC,0))
SET FDATA("PRINCIPAL CLINIC")=SDPRINCLINIC
QUIT
+4 SET SDPRINCLINIC=$ORDER(^SC("B",$EXTRACT(SDPRINCLINIC,1,30),""),-1)
+5 IF SDPRINCLINIC=""
DO ERRLOG^SDES2JSON(.ERRORS,110)
QUIT
+6 IF $$INACTIVE^SDES2UTIL(SDPRINCLINIC,DT)
DO ERRLOG^SDES2JSON(.ERRORS,510,$$GET1^DIQ(44,SDPRINCLINIC,.01,"E"))
QUIT
+7 SET FDATA("PRINCIPAL CLINIC")=SDPRINCLINIC
+8 QUIT
+9 ;
VALOVBDAYMAX(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
+1 NEW SDOVBDAYMAX
+2 SET SDOVBDAYMAX=$GET(SDCLINIC("OVERBOOKS/DAY MAX"))
+3 IF SDOVBDAYMAX="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Overbooks/Day Maximum")
QUIT
+4 IF SDOVBDAYMAX=""
DO ERRLOG^SDES2JSON(.ERRORS,111)
QUIT
+5 IF SDOVBDAYMAX'?1.4N
DO ERRLOG^SDES2JSON(.ERRORS,112)
QUIT
+6 SET FDATA("OVERBOOKS/DAY MAX")=SDOVBDAYMAX
+7 QUIT
+8 ;
VALCHECKIN(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
+1 NEW SDECHECKIN
+2 SET SDECHECKIN=$GET(SDCLINIC("E-CHECKIN ALLOWED"))
+3 IF SDECHECKIN=""
DO ERRLOG^SDES2JSON(.ERRORS,478)
QUIT
+4 IF SDECHECKIN="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"E-Checkin Allowed")
QUIT
+5 IF '$$CHECKYN^SDES2UTIL(SDECHECKIN)
DO ERRLOG^SDES2JSON(.ERRORS,113)
QUIT
+6 SET SDECHECKIN=$$YNTOBOOL^SDES2UTIL(SDECHECKIN)
+7 SET FDATA("E-CHECKIN ALLOWED")=SDECHECKIN
+8 QUIT
+9 ;
VALPRECHECKIN(ERRORS,SDCLINIC,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
+1 NEW SDPRECHECKIN
+2 SET SDPRECHECKIN=$GET(SDCLINIC("PRE-CHECKIN ALLOWED"))
+3 IF SDPRECHECKIN=""
DO ERRLOG^SDES2JSON(.ERRORS,476)
QUIT
+4 IF SDPRECHECKIN="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Pre-Check-in Allowed")
QUIT
+5 IF '$$CHECKYN^SDES2UTIL(SDPRECHECKIN)
DO ERRLOG^SDES2JSON(.ERRORS,114)
QUIT
+6 SET SDPRECHECKIN=$$YNTOBOOL^SDES2UTIL(SDPRECHECKIN)
+7 SET FDATA("PRE-CHECKIN ALLOWED")=SDPRECHECKIN
+8 QUIT
+9 ;
VALAPPTLENGTH(ERRORS,SDLENGTHOFAPT,FDATA) ; required, cannot be deleted with '@' or "" - can be changed
+1 IF SDLENGTHOFAPT="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Length of Appointment")
QUIT
+2 IF SDLENGTHOFAPT=""
DO ERRLOG^SDES2JSON(.ERRORS,115)
QUIT
+3 IF ((SDLENGTHOFAPT<10)!(SDLENGTHOFAPT>240))
DO ERRLOG^SDES2JSON(.ERRORS,116)
QUIT
+4 IF (SDLENGTHOFAPT#10'=0)
IF (SDLENGTHOFAPT#15'=0)
DO ERRLOG^SDES2JSON(.ERRORS,116)
QUIT
+5 SET FDATA("LENGTH OF APPOINTMENT")=SDLENGTHOFAPT
+6 QUIT
+7 ;
VALVARAPTLENGTH(ERRORS,SDCLINIC,FDATA) ;
+1 NEW SDVARAPTLNG
+2 SET SDVARAPTLNG=$GET(SDCLINIC("VARIABLE APPOINTMENT LENGTH"))
+3 IF SDVARAPTLNG="@"!(SDVARAPTLNG="")
SET FDATA("VARIABLE APPOINTMENT LENGTH")=""
QUIT
+4 IF '$$CHECKYN^SDES2UTIL(SDVARAPTLNG)
DO ERRLOG^SDES2JSON(.ERRORS,301)
QUIT
+5 IF SDVARAPTLNG="Y"
SET SDVARAPTLNG="V"
SET FDATA("VARIABLE APPOINTMENT LENGTH")=SDVARAPTLNG
QUIT
+6 SET SDVARAPTLNG=""
+7 SET FDATA("VARIABLE APPOINTMENT LENGTH")=SDVARAPTLNG
+8 QUIT
+9 ;
VALPRIMAMIS(ERRORS,SDCLINIC,FDATA) ; PRIMARY AMIS STOP CODE
+1 NEW SDPRIMAMIS,SDAMISERROR
+2 SET SDPRIMAMIS=$GET(SDCLINIC("PRIMARY AMIS"))
+3 IF SDPRIMAMIS=""
DO ERRLOG^SDES2JSON(.ERRORS,479)
QUIT
+4 IF SDPRIMAMIS="@"
DO ERRLOG^SDES2JSON(.ERRORS,229,"Primary AMIS")
QUIT
+5 SET SDAMISERROR=$$VALIDATEAMIS^SDES2UTIL(.SDPRIMAMIS,"P")
+6 IF SDAMISERROR
DO ERRLOG^SDES2JSON(.ERRORS,SDAMISERROR)
QUIT
+7 SET FDATA("PRIMARY AMIS")=SDPRIMAMIS
+8 QUIT
+9 ;
VALCREDITAMIS(ERRORS,SDCLINIC,FDATA) ; CREDIT AMIS STOP CODE
+1 NEW SDCREDITAMIS,SDAMISERROR
+2 SET SDCREDITAMIS=$GET(SDCLINIC("CREDIT AMIS"))
+3 IF SDCREDITAMIS=""!(SDCREDITAMIS="@")
SET FDATA("CREDIT AMIS")=SDCREDITAMIS
QUIT
+4 SET SDAMISERROR=$$VALIDATEAMIS^SDES2UTIL(.SDCREDITAMIS,"C")
+5 IF SDAMISERROR
DO ERRLOG^SDES2JSON(.ERRORS,SDAMISERROR)
QUIT
+6 SET FDATA("CREDIT AMIS")=SDCREDITAMIS
+7 QUIT
+8 ;
CONDAMISCHECK(ERRORS,SDPRIMAMIS,SDCREDITAMIS) ;
+1 ; Primary & Credit Stop Codes can't be the same
+2 IF SDPRIMAMIS=SDCREDITAMIS
DO ERRLOG^SDES2JSON(.ERRORS,380)
+3 QUIT
+4 ;
LETTERIEN(ERRORS,LETTER) ;Look up the letter IEN
+1 IF LETTER'="@"
IF LETTER'=""
Begin DoDot:1
+2 IF +LETTER
IF $$GET1^DIQ(407.5,LETTER,.01)'=""
QUIT
+3 SET LETTER=$ORDER(^VA(407.5,"B",$EXTRACT(LETTER,1,30),""))
End DoDot:1
+4 QUIT LETTER
+5 ;
VALPBSPID(ERRORS,PBSPID,FDATA) ;
+1 NEW VAL
+2 IF $LENGTH(PBSPID)>100
DO ERRLOG^SDES2JSON(.ERRORS,556)
+3 SET FDATA("PBSPID")=PBSPID
+4 QUIT
+5 ;