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

DVBCPSH2.m

Go to the documentation of this file.
  1. DVBCPSH2 ;ALB/RJA - DBQ PUSH UTILITY RPC; MAY 9, 2024@8:20am ; 5/9/24 8:20am
  1. ;;2.7;AMIE;**252**;Apr 10, 1995;Build 92
  1. ;Per VHA Directive 6402 this routine should not be modified
  1. ;
  1. Q
  1. ;
  1. LISTTEMP(DVBRET,DVBFILT,DVBSORT) ;
  1. ;DVBA CAPRI TEMP DEF LIST CAPRI-10314 RJA 05/10/24
  1. ;
  1. N DVBIEN,DVBCNT,DVBNM,DVBFLAGRLS,DVBFLAGUSR,DVBFLAGACT,DVBAD
  1. K ^TMP("DVBLTMP",$J)
  1. S DVBCNT=0
  1. ;Default filtering and sorting to 0 if no value is passed (No Filter, Alphabetical)
  1. I $G(DVBFILT)="" S DVBFILT=0
  1. I $G(DVBSORT)="" S DVBSORT=0
  1. S DVBIEN=0 F S DVBIEN=$O(^DVB(396.18,DVBIEN)) Q:DVBIEN=""!('DVBIEN) D
  1. .;DVBFILT=0: (Default) No Filter
  1. .I DVBFILT=0 D SETARRAY Q
  1. .S DVBFLAGRLS=0 I $$GET1^DIQ(396.18,DVBIEN,9)="YES" S DVBFLAGRLS=1
  1. .;DVBFILT=1: "Released"
  1. .I DVBFILT=1,DVBFLAGRLS D SETARRAY Q
  1. .;DVBFILT=2: "Selectable by User"
  1. .S DVBFLAGUSR=0 I $$GET1^DIQ(396.18,DVBIEN,7)="YES" S DVBFLAGUSR=1
  1. .I DVBFILT=2,DVBFLAGUSR D SETARRAY Q
  1. .;DVBFILT=3: "Activated"
  1. .S DVBFLAGACT=0 I $$GET1^DIQ(396.18,DVBIEN,3)="" S DVBFLAGACT=1
  1. .I DVBFILT=3,DVBFLAGACT D SETARRAY Q
  1. .;DVBFILT=4: "Released" & "Selectable by User"
  1. .I DVBFILT=4,DVBFLAGRLS,DVBFLAGUSR D SETARRAY Q
  1. .;DVBFILT=5: "Released" & "Activated"
  1. .I DVBFILT=5,DVBFLAGRLS,DVBFLAGACT D SETARRAY Q
  1. .;DVBFILT=6: "Selectable by User" & "Activated"
  1. .I DVBFILT=6,DVBFLAGUSR,DVBFLAGACT D SETARRAY Q
  1. .;DVBFILT=7: "Released" & "Selectable by User" & "Activated"
  1. .I DVBFILT=7,DVBFLAGRLS,DVBFLAGUSR,DVBFLAGACT D SETARRAY Q
  1. .Q
  1. ;DVBSORT=0: (Default) Alphabetical
  1. I DVBSORT=0 D SORT0
  1. ;DVBSORT=1: "Activated" followed by "Deactivated"
  1. I DVBSORT=1 D SORTACT,SORTDEACT
  1. ;DVBSORT=2: "Deactivated" followed by "Activated"
  1. I DVBSORT=2 D SORTDEACT,SORTACT
  1. K ^TMP("DVBLTMP",$J)
  1. Q
  1. SETARRAY ;
  1. S DVBNM=$$GET1^DIQ(396.18,DVBIEN,.01)
  1. ;Include DVBIEN as subnode so that duplicate template names with differing IENs are accounted for
  1. S DVBAD=$S($$GET1^DIQ(396.18,DVBIEN,3)="":"A",1:"D")
  1. S ^TMP("DVBLTMP",$J,DVBNM,DVBIEN)=DVBAD
  1. Q
  1. SORT0 ;
  1. ; DVBSORT=0: (Default) Alphabetical
  1. ;Set DVBRET array from ^TMP as it is already sorted alphabetical
  1. S DVBNM="",DVBCNT=0 F S DVBNM=$O(^TMP("DVBLTMP",$J,DVBNM)) Q:DVBNM="" D
  1. .;Include DVBIEN as subnode so that duplicate template names with differing IENs are accounted for
  1. .S DVBIEN="" F S DVBIEN=$O(^TMP("DVBLTMP",$J,DVBNM,DVBIEN)) Q:DVBIEN="" D
  1. ..S DVBRET(DVBCNT)=DVBNM_U_DVBIEN,DVBCNT=DVBCNT+1
  1. ..Q
  1. .Q
  1. Q
  1. SORTACT ;
  1. ; Set array with active template definitions
  1. S DVBNM="" F S DVBNM=$O(^TMP("DVBLTMP",$J,DVBNM)) Q:DVBNM="" D
  1. .;Include DVBIEN as subnode so that duplicate template names with differing IENs are accounted for
  1. .S DVBIEN="" F S DVBIEN=$O(^TMP("DVBLTMP",$J,DVBNM,DVBIEN)) Q:DVBIEN="" D
  1. ..;Set array only with activated template definitions (1)
  1. ..I $G(^TMP("DVBLTMP",$J,DVBNM,DVBIEN))="A" S DVBRET(DVBCNT)=DVBNM_U_DVBIEN,DVBCNT=DVBCNT+1
  1. ..Q
  1. .Q
  1. Q
  1. SORTDEACT ;
  1. ; Set array with deactivated template definitions
  1. S DVBNM="" F S DVBNM=$O(^TMP("DVBLTMP",$J,DVBNM)) Q:DVBNM="" D
  1. .;Include DVBIEN as subnode so that duplicate template names with differing IENs are accounted for
  1. .S DVBIEN="" F S DVBIEN=$O(^TMP("DVBLTMP",$J,DVBNM,DVBIEN)) Q:DVBIEN="" D
  1. ..;Set array only with deactivated template definitions (2)
  1. ..I $G(^TMP("DVBLTMP",$J,DVBNM,DVBIEN))="D" S DVBRET(DVBCNT)=DVBNM_U_DVBIEN,DVBCNT=DVBCNT+1
  1. ..Q
  1. .Q
  1. Q