SDESGETRESOURCE ;ALB/BWF - VISTA SCHEDULING RPCS GET RESOURCE ; MAR 30,2023
;;5.3;Scheduling;**844**;Aug 13, 1993;Build 12
;;Per VHA Directive 6402, this routine should not be modified
Q
GETBYDUZ(RESULT,USERIEN) ;
N RESIEN,CNT,RESDATA,ERRORS,RESGRPIEN
S USERIEN=$G(USERIEN)
D VALIDATEUSER(.ERRORS,USERIEN)
I $D(ERRORS) S ERRORS("Resource",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
S (CNT,RESGRPIEN)=0 F S RESGRPIEN=$O(^SDEC(409.833,"AC",USERIEN,RESGRPIEN)) Q:'RESGRPIEN D
.S RESIEN=$$GET1^DIQ(409.833,RESGRPIEN,.01,"I")
.S CNT=CNT+1
.D BLDRESOURCE(.RESDATA,RESIEN,CNT)
I '$D(RESDATA) S RESDATA("Resource",1)=""
D BUILDJSON^SDESBUILDJSON(.RESULT,.RESDATA)
Q
GETBYCLINIEN(RESULT,CLINIEN) ;
N ERRORS,CNT,RESIEN,RESDATA
S CLINIEN=$G(CLINIEN)
D VALIDATECLINIC(.ERRORS,CLINIEN)
I $D(ERRORS) S ERRORS("Resource",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
S (CNT,RESIEN)=0 F S RESIEN=$O(^SDEC(409.831,"ALOC",CLINIEN,RESIEN)) Q:'RESIEN D
.S CNT=CNT+1
.D BLDRESOURCE(.RESDATA,RESIEN,CNT)
I '$D(RESDATA) S RESDATA("Resource",1)=""
D BUILDJSON^SDESBUILDJSON(.RESULT,.RESDATA)
Q
BLDRESOURCE(RSRCDATA,RIEN,CNT) ;
N RDATA,RERR,RIENS,F,ENBYIEN,CLINIEN
S F=409.831
S RIENS=RIEN_","
D GETS^DIQ(409.831,RIEN,"**","IE","RDATA","RERR")
S CLINIEN=$G(RDATA(F,RIENS,.04,"I"))
S RSRCDATA("Resource",CNT,"ClinicIEN")=CLINIEN
S RSRCDATA("Resource",CNT,"ClinicName")=$$GET1^DIQ(44,CLINIEN,.01,"E")
S RSRCDATA("Resource",CNT,"ResourceIEN")=RIEN
S RSRCDATA("Resource",CNT,"Abbreviation")=$G(RDATA(F,RIENS,.011,"E"))
S RSRCDATA("Resource",CNT,"ResourceType")=$G(RDATA(F,RIENS,.012,"E"))
S RSRCDATA("Resource",CNT,"DateTimeEntered")=$$FMTISO^SDAMUTDT($G(RDATA(F,RIENS,.015,"I")),CLINIEN)
S RSRCDATA("Resource",CNT,"EnteredByUserIen")=$G(RDATA(F,RIENS,.016,"I"))
S RSRCDATA("Resource",CNT,"EnteredByUserName")=$G(RDATA(F,RIENS,.016,"E"))
S RSRCDATA("Resource",CNT,"EnteredByUserSecId")=$$GET1^DIQ(200,$G(RDATA(F,RIENS,.016,"I")),205.1,"E")
S RSRCDATA("Resource",CNT,"Inactive")=$G(RDATA(F,RIENS,.02,"E"))
I $G(RDATA(F,RIENS,.02,"I"))="YES" D
.S RSRCDATA("Resource",CNT,"InactivatedDateTime")=$$FMTISO^SDAMUTDT($G(RDATA(F,RIENS,.021,"I")),CLINIEN)
.S RSRCDATA("Resource",CNT,"InactivatedByUserIen")=$G(RDATA(F,RIENS,.022,"I"))
.S RSRCDATA("Resource",CNT,"InactivatedByUserName")=$G(RDATA(F,RIENS,.022,"E"))
.S RSRCDATA("Resource",CNT,"InactivatedByUserSecId")=$$GET1^DIQ(200,$G(RDATA(F,RIENS,.022,"I")),205.1,"E")
I $G(RDATA(F,RIENS,.025,"I"))'="" D
.S RSRCDATA("Resource",CNT,"ReactivatedDateTime")=$$FMTISO^SDAMUTDT($G(RDATA(F,RIENS,.025,"I")),CLINIEN)
.S RSRCDATA("Resource",CNT,"ReactivatedByUserIen")=$G(RDATA(F,RIENS,.026,"I"))
.S RSRCDATA("Resource",CNT,"ReactivatedByUserName")=$G(RDATA(F,RIENS,.026,"E"))
.S RSRCDATA("Resource",CNT,"ReactivatedByUserSecId")=$$GET1^DIQ(200,$G(RDATA(F,RIENS,.026,"I")),205.1,"E")
S RSRCDATA("Resource",CNT,"TimeScale")=$G(RDATA(F,RIENS,.03,"E"))
Q
VALIDATEUSER(ERRORS,UIEN) ;
I UIEN="" D ERRLOG^SDESJSON(.ERRORS,127) Q
I '$D(^VA(200,UIEN)) D ERRLOG^SDESJSON(.ERRORS,44) Q
Q
VALIDATECLINIC(ERRORS,CLINIEN) ;
I $G(CLINIEN)="" D ERRLOG^SDESJSON(.ERRORS,18) Q
I '$D(^SC(CLINIEN)) D ERRLOG^SDESJSON(.ERRORS,19) Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETRESOURCE 3258 printed Dec 13, 2024@02:57:07 Page 2
SDESGETRESOURCE ;ALB/BWF - VISTA SCHEDULING RPCS GET RESOURCE ; MAR 30,2023
+1 ;;5.3;Scheduling;**844**;Aug 13, 1993;Build 12
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 QUIT
GETBYDUZ(RESULT,USERIEN) ;
+1 NEW RESIEN,CNT,RESDATA,ERRORS,RESGRPIEN
+2 SET USERIEN=$GET(USERIEN)
+3 DO VALIDATEUSER(.ERRORS,USERIEN)
+4 IF $DATA(ERRORS)
SET ERRORS("Resource",1)=""
DO BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS)
QUIT
+5 SET (CNT,RESGRPIEN)=0
FOR
SET RESGRPIEN=$ORDER(^SDEC(409.833,"AC",USERIEN,RESGRPIEN))
if 'RESGRPIEN
QUIT
Begin DoDot:1
+6 SET RESIEN=$$GET1^DIQ(409.833,RESGRPIEN,.01,"I")
+7 SET CNT=CNT+1
+8 DO BLDRESOURCE(.RESDATA,RESIEN,CNT)
End DoDot:1
+9 IF '$DATA(RESDATA)
SET RESDATA("Resource",1)=""
+10 DO BUILDJSON^SDESBUILDJSON(.RESULT,.RESDATA)
+11 QUIT
GETBYCLINIEN(RESULT,CLINIEN) ;
+1 NEW ERRORS,CNT,RESIEN,RESDATA
+2 SET CLINIEN=$GET(CLINIEN)
+3 DO VALIDATECLINIC(.ERRORS,CLINIEN)
+4 IF $DATA(ERRORS)
SET ERRORS("Resource",1)=""
DO BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS)
QUIT
+5 SET (CNT,RESIEN)=0
FOR
SET RESIEN=$ORDER(^SDEC(409.831,"ALOC",CLINIEN,RESIEN))
if 'RESIEN
QUIT
Begin DoDot:1
+6 SET CNT=CNT+1
+7 DO BLDRESOURCE(.RESDATA,RESIEN,CNT)
End DoDot:1
+8 IF '$DATA(RESDATA)
SET RESDATA("Resource",1)=""
+9 DO BUILDJSON^SDESBUILDJSON(.RESULT,.RESDATA)
+10 QUIT
BLDRESOURCE(RSRCDATA,RIEN,CNT) ;
+1 NEW RDATA,RERR,RIENS,F,ENBYIEN,CLINIEN
+2 SET F=409.831
+3 SET RIENS=RIEN_","
+4 DO GETS^DIQ(409.831,RIEN,"**","IE","RDATA","RERR")
+5 SET CLINIEN=$GET(RDATA(F,RIENS,.04,"I"))
+6 SET RSRCDATA("Resource",CNT,"ClinicIEN")=CLINIEN
+7 SET RSRCDATA("Resource",CNT,"ClinicName")=$$GET1^DIQ(44,CLINIEN,.01,"E")
+8 SET RSRCDATA("Resource",CNT,"ResourceIEN")=RIEN
+9 SET RSRCDATA("Resource",CNT,"Abbreviation")=$GET(RDATA(F,RIENS,.011,"E"))
+10 SET RSRCDATA("Resource",CNT,"ResourceType")=$GET(RDATA(F,RIENS,.012,"E"))
+11 SET RSRCDATA("Resource",CNT,"DateTimeEntered")=$$FMTISO^SDAMUTDT($GET(RDATA(F,RIENS,.015,"I")),CLINIEN)
+12 SET RSRCDATA("Resource",CNT,"EnteredByUserIen")=$GET(RDATA(F,RIENS,.016,"I"))
+13 SET RSRCDATA("Resource",CNT,"EnteredByUserName")=$GET(RDATA(F,RIENS,.016,"E"))
+14 SET RSRCDATA("Resource",CNT,"EnteredByUserSecId")=$$GET1^DIQ(200,$GET(RDATA(F,RIENS,.016,"I")),205.1,"E")
+15 SET RSRCDATA("Resource",CNT,"Inactive")=$GET(RDATA(F,RIENS,.02,"E"))
+16 IF $GET(RDATA(F,RIENS,.02,"I"))="YES"
Begin DoDot:1
+17 SET RSRCDATA("Resource",CNT,"InactivatedDateTime")=$$FMTISO^SDAMUTDT($GET(RDATA(F,RIENS,.021,"I")),CLINIEN)
+18 SET RSRCDATA("Resource",CNT,"InactivatedByUserIen")=$GET(RDATA(F,RIENS,.022,"I"))
+19 SET RSRCDATA("Resource",CNT,"InactivatedByUserName")=$GET(RDATA(F,RIENS,.022,"E"))
+20 SET RSRCDATA("Resource",CNT,"InactivatedByUserSecId")=$$GET1^DIQ(200,$GET(RDATA(F,RIENS,.022,"I")),205.1,"E")
End DoDot:1
+21 IF $GET(RDATA(F,RIENS,.025,"I"))'=""
Begin DoDot:1
+22 SET RSRCDATA("Resource",CNT,"ReactivatedDateTime")=$$FMTISO^SDAMUTDT($GET(RDATA(F,RIENS,.025,"I")),CLINIEN)
+23 SET RSRCDATA("Resource",CNT,"ReactivatedByUserIen")=$GET(RDATA(F,RIENS,.026,"I"))
+24 SET RSRCDATA("Resource",CNT,"ReactivatedByUserName")=$GET(RDATA(F,RIENS,.026,"E"))
+25 SET RSRCDATA("Resource",CNT,"ReactivatedByUserSecId")=$$GET1^DIQ(200,$GET(RDATA(F,RIENS,.026,"I")),205.1,"E")
End DoDot:1
+26 SET RSRCDATA("Resource",CNT,"TimeScale")=$GET(RDATA(F,RIENS,.03,"E"))
+27 QUIT
VALIDATEUSER(ERRORS,UIEN) ;
+1 IF UIEN=""
DO ERRLOG^SDESJSON(.ERRORS,127)
QUIT
+2 IF '$DATA(^VA(200,UIEN))
DO ERRLOG^SDESJSON(.ERRORS,44)
QUIT
+3 QUIT
VALIDATECLINIC(ERRORS,CLINIEN) ;
+1 IF $GET(CLINIEN)=""
DO ERRLOG^SDESJSON(.ERRORS,18)
QUIT
+2 IF '$DATA(^SC(CLINIEN))
DO ERRLOG^SDESJSON(.ERRORS,19)
QUIT
+3 QUIT