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

SDESGETSTOPCODE.m

Go to the documentation of this file.
  1. SDESGETSTOPCODE ;ALB/ANU - VISTA SCHEDULING READ STOP CODE DETAILS ;Jan 25,2022@15:01
  1. ;;5.3;Scheduling;**807**;Aug 13, 1993;Build 5
  1. ;;Per VHA Directive 6402, this routine should not be modified
  1. Q
  1. ;
  1. GETSTCDDTL(SDSTCDJSON,SDSTCD) ;get all details of Stop Code from CLINIC STOP file #40.7
  1. ; INPUT:
  1. ; SDSTCD - Clinic Stop Code
  1. ;
  1. N ERRPOP,ERR,ERRMSG,SDECI,SDSTCDREC,SDSTCDIEN
  1. D INIT
  1. D VALIDATE
  1. I ERRPOP D BLDJSON Q
  1. D GETSTCDINF
  1. D BLDJSON
  1. Q
  1. ;
  1. INIT ; initialize values needed
  1. S SDECI=0,SDSTCDIEN=""
  1. S ERR=""
  1. S ERRPOP=0,ERRMSG=""
  1. Q
  1. ;
  1. VALIDATE ;Validate required fields are sent
  1. I $G(SDSTCD)="" D ERRLOG^SDESJSON(.SDSTCDREC,98) S ERRPOP=1 Q
  1. S SDSTCDIEN=$$FIND1^DIC(40.7,,"X",$G(SDSTCD),"C",,"SDERR")
  1. I $G(SDSTCDIEN)=""!$G(SDSTCDIEN)=0 D ERRLOG^SDESJSON(.SDSTCDREC,99) S ERRPOP=1 Q
  1. Q
  1. ;
  1. GETSTCDINF ; Get Stop Code Information
  1. N SDFIELDS,SDDATA,SDMSG
  1. S SDFIELDS=".01;2;3;4;5;6"
  1. D GETS^DIQ(40.7,SDSTCDIEN_",",SDFIELDS,"IE","SDDATA","SDMSG")
  1. S SDSTCDREC("Stop Code","Name")=$G(SDDATA(40.7,SDSTCDIEN_",",.01,"E")) ;Stop Code Name
  1. S SDSTCDREC("Stop Code","IEN")=SDSTCDIEN ;Stop Code IEN
  1. S SDSTCDREC("Stop Code","Inactive Date")=$$FMTISO^SDAMUTDT($G(SDDATA(40.7,SDSTCDIEN_",",2,"I"))) ;Inactive Date
  1. S SDSTCDREC("Stop Code","Cost Distribution Center")=$G(SDDATA(40.7,SDSTCDIEN_",",4,"E")) ;Cost Distribution Center
  1. S SDSTCDREC("Stop Code","Restriction Type")=$G(SDDATA(40.7,SDSTCDIEN_",",5,"E")) ;Restrication Type
  1. S SDSTCDREC("Stop Code","Restriction Date")=$$FMTISO^SDAMUTDT($G(SDDATA(40.7,SDSTCDIEN_",",6,"I"))) ;Restriction Date
  1. Q
  1. ;
  1. BLDJSON ; Build JSON format
  1. D ENCODE^SDESJSON(.SDSTCDREC,.SDSTCDJSON,.ERR)
  1. K SDUSRSREC
  1. Q
  1. ;