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

ADEMDEL.m

Go to the documentation of this file.
ADEMDEL ; IHS/HQT/MJL  - FOLLOWUP LIST DELETION ;06:50 PM  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;CALLED AT EN WITH ADEPAT AND ADEMDFN WILL DELETE ENTRY ADEMDFN
 ;FROM ^ADEFOL AND UPDATE ^ADEPAT
 ;------->INITIALIZE
 Q:'$D(ADEREF)!'$D(ADEREC)!'$D(ADEWAI)  S $P(ADELIN,"*",79)=""
 S ADETYP=$S(ADEREF:"rf",ADEREC:"rc",ADEWAI:"w")
 S ADEFUNC=" DELETION "
 D ^XBKVAR I '$D(DUZ(2)) W !,"DIVISION NOT SET IN USER FILE -- CONTACT SITE MANAGER OR ISC" Q
 I DUZ(2)=0 W !,"DIVISION SET TO ZERO (UNIVERSAL). DIVISION MUST BE SET TO ONE OF THE ",!,"SITES IN THE DENTAL SITE PARAMETER FILE. -- CONTACT SITE MANAGER" Q
ONE ;------->RESET CONSTANT FOLLOWUP SUBTYPE IF CALLED EXTERNALLY
 ;        TYPE SET BY CALLING OPTION
 ;        RETURN ADESUB=DFN IN ^ADETYP(
 D RESET^ADEMNG1 G:Y<1 END
TWO ;------->LOOK UP A PATIENT
 S ADEINT=0,ADEMDEL=1 D PTLOOK^ADEMNG1 K ADEINT,ADEMDEL G:Y<1 ONE
 ;------->DELETION
 K ADEMDFN D DEL
 I ADEMDFN="NO" W !?5,"--No changes made" H 2 G THREE
 I 'ADEMDFN W !,"***PATIENT NOT ON ",ADESUBN," LIST***",*7 H 2
 E  W !?5,"--DELETED" H 1
 ;------->GET ANOTHER PATIENT
THREE K ADEMDFN K ^ADEUTL("ADELOCK",ADEPAT) G TWO ;^ADEUTL is a transient working global
END K ADEADAT,ADEFUNC,ADELIN,ADEMDFN,ADENOD,ADEPAT,ADEREC,ADEREF,ADESUB,ADESUBN,ADETYP,ADEWAI,ADENEWM Q
EN D DEL Q
DEL ;EP
 ;------->GET ENTRY ADEMDFN IN ^ADEFOL
 I '$D(ADEMDFN) S ADEMDFN=0 D D1 Q:'ADEMDFN
 ;------->GET INFO ABOUT ENTRY
 S ADENOD=^ADEFOL(ADEMDFN,0)
 S ADEADAT=$P(ADENOD,U,3)
 ;------->CREATE ENTRY IN ^ADEPAT
 D CRE
 ;------->DELETE ENTRY FROM ^ADEFOL
 D DEST
 ;------->QUIT
 Q
D1 Q:'$D(^ADEFOL("TYPE",ADEPAT,ADETYP,ADESUB))
 S ADEMDFN=$O(^ADEFOL("TYPE",ADEPAT,ADETYP,ADESUB,0)) Q:'+ADEMDFN
 W !,"ARE YOU SURE YOU WANT TO DELETE?" S %=1 D YN^DICN S:%'=1 ADEMDFN="NO"
 Q
CRE ;CREATE ENTRY IN PATIENT FILE IF DOESN'T EXIST
 I '$D(^ADEPAT(ADEPAT)) S DIC="^ADEPAT(",DIC(0)="LZ",X=ADEPAT,DINUM=X K DD,DO D FILE^DICN
 ;CREATE SUBENTRY
 K DIC,DIE,DA,DR,X,Y
 S DA(1)=ADEPAT
 S DIE="^ADEPAT(DA(1),""FOL"","
 I $D(^ADEPAT(ADEPAT,"FOL",0)) S DA=$P(^ADEPAT(ADEPAT,"FOL",0),U,3)+1
 E  S ^ADEPAT(ADEPAT,"FOL",0)="^9002010.21PA^^",DA=1 ;DIE requires that the Zeroeth node of a subfile be set before adding the first subentry
 S DR=".01///`"_ADESUB_";2///"_ADEADAT_";3///"_DT
 D ^DIE
 S $P(^ADEPAT(ADEPAT,"FOL",0),U,3)=DA,$P(^ADEPAT(ADEPAT,"FOL",0),U,4)=$P(^ADEPAT(ADEPAT,"FOL",0),U,4)+1 ;Fileman requires the programmer to update the zeroeth node of a subfile after adding a subentry via DIE.
 Q
DEST S DIE="^ADEFOL(",DA=ADEMDFN,DR=".01///@" D ^DIE Q