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

SDESGETRESOURCE.m

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