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

SDES2GETELIGCD.m

Go to the documentation of this file.
SDES2GETELIGCD ;ALB/LAB - SDES2 GET ELIGIBILITY CODES ;NOV 22, 2022
 ;;5.3;Scheduling;**869**;Aug 13, 1993;Build 13
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 Q
 ;
GETELIGCODES(RESULT,SDCONTEXT,SDPARAM) ;
 N ELIGCODES,ERRORS
  ;validate context array for accuracy
 D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
 I $D(ERRORS) S ERRORS("EligibilityCodes",1)="" D BUILDJSON^SDES2JSON(.RESULT,.ERRORS) Q
 D:$G(SDPARAM("EligibilityCodeName"))'="" SINGLECODE(.ELIGCODES,.SDPARAM)
 D:$G(SDPARAM("EligibilityCodeName"))="" ALLCODES(.ELIGCODES)
 ;
 D BUILDJSON^SDES2JSON(.RESULT,.ELIGCODES)
 Q
 ;
SINGLECODE(ELIGCODES,SDPARAM) ;
 N COUNT,ELIGCODEIEN
 S COUNT=1
 S ELIGCODEIEN=$O(^DIC(8,"B",SDPARAM("EligibilityCodeName"),""))
 I ELIGCODEIEN="" S ELIGCODES("EligibilityCodes",1)="",ELIGCODES("Error",1)="Code not Found" Q
 D BUILD(.ELIGCODES,ELIGCODEIEN,COUNT)
 Q
 ;
ALLCODES(ELIGCODES) ;
 N COUNT,ELIGCODEIEN
 ;
 S ELIGCODEIEN=0,COUNT=0
 F  S ELIGCODEIEN=$O(^DIC(8,ELIGCODEIEN)) Q:'ELIGCODEIEN  D
 .S COUNT=COUNT+1
 .D BUILD(.ELIGCODES,ELIGCODEIEN,COUNT)
 Q
 ;
BUILD(ELIGCODES,ELIGCODEIEN,COUNT) ;
 N MASELIGCODE
 S ELIGCODES("EligibilityCodes",COUNT,"IEN")=ELIGCODEIEN
 S ELIGCODES("EligibilityCodes",COUNT,"Name")=$$GET1^DIQ(8,ELIGCODEIEN,.01,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"CardColor")=$$GET1^DIQ(8,ELIGCODEIEN,1,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"Abbreviation")=$$GET1^DIQ(8,ELIGCODEIEN,2,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"VACodeNumber")=$$GET1^DIQ(8,ELIGCODEIEN,3,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"Type")=$$GET1^DIQ(8,ELIGCODEIEN,4,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"PrintName")=$$GET1^DIQ(8,ELIGCODEIEN,5,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"Inactive")=$$GET1^DIQ(8,ELIGCODEIEN,6,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"CardColor")=$$GET1^DIQ(8,ELIGCODEIEN,1,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"SelectAsAdditional")=$$GET1^DIQ(8,ELIGCODEIEN,7,"E")
 S MASELIGCODE=$$GET1^DIQ(8,ELIGCODEIEN,8,"I")
 S ELIGCODES("EligibilityCodes",COUNT,"MASEligibilityCode",1,"IEN")=MASELIGCODE
 S ELIGCODES("EligibilityCodes",COUNT,"MASEligibilityCode",1,"NAME")=$$GET1^DIQ(8.1,ELIGCODEIEN,.01,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"IDFormat")=$$GET1^DIQ(8,ELIGCODEIEN,9,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"Agency")=$$GET1^DIQ(8,ELIGCODEIEN,11,"E")
 S ELIGCODES("EligibilityCodes",COUNT,"MakeRecordSensitive")=$$GET1^DIQ(8,ELIGCODEIEN,.12,"E")
 Q
 ;