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

ADEGRL5A.m

Go to the documentation of this file.
ADEGRL5A ; IHS/HQT/MJL  - CODE EDITS ;  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;**23**;JUN 6, 2011
 ;IHS/HMW 10-31-91 HAPPY HALLOWEEN
 ;INPUTS - ADEV(ADECOD),ADEHX ARRAY
 ;$O THRU ^ADEDIT("AC",ADECOD,RESOLUTION TYPE,ENTRY NUMBER)
 ;DO SUBR CORRESPONDING TO EDIT TYPE - RESOLVE PRN
 ;OUTPUT - FLAG ON ADA CODE, REJECT ADA CODE, REPLACE ADA CODE
 ;
 ;FHL 9/9/98 B
CTRL N ADERTYP,ADERDFN,ADENOD,ADEDTYP,ADECONF,ADELIM,ADEJJ,ADEVFM,ADEPC
 G:'$D(^ADEDIT("AC",ADECOD)) EXIT
RES ;$O THRU RESOLUTION TYPE XREF
 S ADERTYP=0
 F  S ADERTYP=$O(^ADEDIT("AC",ADECOD,ADERTYP)) Q:'+ADERTYP  D RES1 Q:'$D(ADEV(ADECOD))
EXIT Q
 K ADERTYP,ADERDFN,ADENOD,ADEDTYP,ADECONF,ADELIM,ADEJJ,ADEVFM,ADEPC ;*NE
 K ADEKK ;*NE
 ;
RES1 S ADERDFN=0
 F  S ADERDFN=$O(^ADEDIT("AC",ADECOD,ADERTYP,ADERDFN)) Q:'+ADERDFN  Q:'$D(ADEV(ADECOD))  D EDIT Q:'$D(ADEV(ADECOD))
 Q
EDIT S ADENOD=^ADEDIT(ADERDFN,0)
 Q:$P(ADENOD,U,4)="n"  ;FHL 9/9/98 ;edit not enabled
 S ADEDTYP=$P(ADENOD,U,2)
 I ADEDTYP=1 D E1
 I ADEDTYP=2 D E2
 I ADEDTYP=3 D E3
 I ADEDTYP=4 D E4
 Q
E1 ;EDIT TYPE 1 -- INCOMPATIBLE CODES
 N ADEK,ADEPC,ADEVFM,ADEOP,ADEOPC,ADEKK
 ;FIRST GET LIST OF CODES
 S ADECONF=^ADEDIT(ADERDFN,1)
 I ADECONF["[" S ADECONF=$P(ADECONF,"[",2),ADECONF=^ADEDIT("GRP",$O(^ADEDIT("GRP","B",ADECONF,0)),1) ;W "ADECONF=",ADECONF H 1
 ;SEE IF CURRENT CODE ADECOD IS IN LIST - IF SO, RESOLVE
 I $P(^ADEDIT(ADERDFN,0),U,3)]"" D E1A ;Opsite specific
 I $P(^ADEDIT(ADERDFN,0),U,3)="" D E1B
 Q
E1A F ADEKK=1:1:$L(ADECONF,"|") I $D(ADEV($P(ADECONF,"|",ADEKK))),$P(ADECONF,"|",ADEKK)'=ADECOD D
 . F  Q:'$D(ADEV(ADECOD))  S ADEOP=$P(ADEV(ADECOD),U,2) S ADEPC=ADEOP_","_$P(ADEV($P(ADECONF,"|",ADEKK)),U,2) S ADEOPC=$$DUPE^ADEGRL5C(ADEPC) Q:'ADEOPC  D RESOLVE^ADEGRL5B
 Q
E1B S ADEJJ=0 F  S ADEJJ=$O(ADEV(ADEJJ)) Q:ADEJJ=""  I ADECOD'=ADEJJ,ADECONF[ADEJJ D RESOLVE^ADEGRL5B Q
 Q
E2 ;EDIT TYPE 2 -- TIME LIMIT ON CODES
 N ADEK,ADEPC,ADEVFM,ADEOP,ADEOPC,ADEKK,ADEQTY
 S ADECONF=^ADEDIT(ADERDFN,1)
 I ADECONF["[" S ADECONF=$P(ADECONF,"[",2),ADECONF=^ADEDIT("GRP",$O(^ADEDIT("GRP","B",ADECONF,0)),1)
 S X=ADEVDATE,%DT="T" D ^%DT S (ADEVFM,X1)=Y K %DT,X,Y ;IHS/HMW **2**
 S X2=$P(^ADEDIT(ADERDFN,2),U)
 S X2=$TR(X2,"|",";") ;Delimiter may be | or ;
 S ADEQTY=$P(X2,";",2),X2=$P(X2,";")
 I X2="FY" D
 . ;Set ADELIM to beginning of FY
 . S ADELIM=$$FY^ADEUTL(ADEVDATE)
 E  D
 . S X2=-X2
 . D C^%DTC S ADELIM=X K X
 ;
 ;$O THRU ADEHXC & SEE IF ANY OF THESE CODES HAVE DATES AFTER LIMIT TIME
 I $P(^ADEDIT(ADERDFN,0),U,3)]"" D E2A ;Opsite specific
 I $P(^ADEDIT(ADERDFN,0),U,3)="" D E2B
 Q
E2A ;
 S ADEOP=$P(ADEV(ADECOD),U,2)
 F ADEK=1:1:$L(ADEOP,",") S ADEOPC=$P(ADEOP,",",ADEK) D E2A2 ;Q:$D(ADEXFLG)
 Q
E2A2 F ADEKK=1:1:$L(ADECONF,"|") S ADEPC=$P(ADECONF,"|",ADEKK) I $D(ADEHXO(ADEOPC,ADEPC)),$O(ADEHXO(ADEOPC,ADEPC,ADELIM))]"",$O(ADEHXO(ADEOPC,ADEPC,ADELIM))<ADEVFM D E2A3 Q
 Q
E2A3 N ADECNT,ADED
 S ADECNT=0,ADED=ADELIM
 F  S ADED=$O(ADEHXO(ADEOPC,ADEPC,ADED)) Q:'+ADED  Q:ADED>ADEVFM  S ADECNT=ADECNT+1
 I ADECNT>(ADEQTY-1) D RESOLVE^ADEGRL5B
 Q
E2B F ADEK=1:1:$L(ADECONF,"|") S ADEPC=$P(ADECONF,"|",ADEK) I $D(ADEHXC(ADEPC)),$O(ADEHXC(ADEPC,ADELIM))]"",$O(ADEHXC(ADEPC,ADELIM))<ADEVFM D RESOLVE^ADEGRL5B Q
 Q
 ;
E3 ;Age Screen
 N ADEOP,ADEK,ADEPC,ADEOPC,ADETST
 ;FHL 9/9/98 B
 S ADETST=$P(^ADEDIT(ADERDFN,2),U,4)
 ;I @((AUPNDAYS\365.25)_"'"_$P(^ADEDIT(ADERDFN,2),U,4)) Q
 I $E(ADETST,1,1)=">"!($E(ADETST,1,1)="<") S ADETST="'(X"_ADETST_")"
 S X=AUPNDAYS\365.25
 I @ADETST Q
 ;
 I $P(^ADEDIT(ADERDFN,0),U,3)]"" D E3A ;Opsite specific
 I $P(^ADEDIT(ADERDFN,0),U,3)="" D RESOLVE^ADEGRL5B
 Q
E3A S ADEOP=$P(ADEV(ADECOD),U,2)
 F ADEK=1:1:$L(ADEOP,",") S ADEOPC=$P(ADEOP,",",ADEK) D RESOLVE^ADEGRL5B
 Q
E4 ;Permissible Opsites -use only with codes that require opsites
 ; and use only Resolution 1 (reject)
 N ADEPERM,ADEK,ADEOP,ADEOPC
 S ADEPERM=$P(^ADEDIT(ADERDFN,4),U)
 I ADEPERM["[" S ADEPERM=$P(ADEPERM,"[",2),ADEPERM=$O(^ADEDIT("GRP","B",ADEPERM,0)),ADEPERM=$P(^ADEDIT("GRP",ADEPERM,1),U)
 F ADEK=1:1:$L(ADEPERM,"|") D
 . S ADEPC=$P(ADEPERM,"|",ADEK)
 . S ADEPC=$O(^ADEOPS("B",ADEPC,0))
 . S:ADEPC ADEPERM(ADEPC)=""
 S ADEOP=$P(ADEV(ADECOD),U,2)
 Q:'ADEOP  ;IHS;SD;TPF H31091 PATCH 23
 F ADEK=1:1:$L(ADEOP,",") S ADEOPC=$P(ADEOP,",",ADEK) D
 . I '$D(ADEPERM(ADEOPC)) D RESOLVE^ADEGRL5B
 Q
 K ADEPERM ;*NE