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

ADELETE.m

Go to the documentation of this file.
ADELETE ; IHS/HQT/MJL  - DELETE DENTAL VISIT ;12:30 PM  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;**26**;APRIL 1999;Build 13
 ;;IHS/OIT/GAB 11.2014 Modified for 2015 Code Updates - PATCH 26
 S $P(ADELIN,"*",79)="",ADEFAST=0,ADETITL="VISIT DELETION MODE",AUPNLK("ALL")=""
CTRL ;------->LOOK UP PATIENT
 D PTLOOK^ADEGRL1 G:Y<1 END S ^ADEUTL("ADELOCK",ADEPAT)="" D HRN^ADEGRL3
 ;------->LOOK UP VISIT
VS D VSLOOK^ADEGRL2 G:'Y END I ADENEWVS W *7," ??" G VS
 S ADECON=$P(^ADEPCD(ADEDFN,0),U,9) S:ADECON="c" ADECON=1,ADEDIR=0 S:ADECON'="c" ADECON=0,ADEDIR=1
 ;------->DISPLAY
 D MOD^ADEGRL,LIST^ADEGRL3
 ;------->CONFIRM
C W !!?5,"DELETE THIS VISIT" S %=2 D YN^DICN
 I %Y["?" W !?10,"ANSWER `Y' TO DELETE THIS VISIT, `N' TO ABORT" G C
Z G:%'=1 END
 ;------->DELETE PCC VISIT AND VISIT RELATED
 S ADENEWVS=1 D ^ADEAPC2
 ;------->IF FAILED APPT UPDATE ^ADEPAT
 ;IHS/OIT/GAB 11.2014 commented the below & added the next line for the 2015 updates - Patch #26
 ;I $D(ADEV("9130"))!$D(ADEV("9140")) D FAIL
 I $D(ADEV("9130"))!$D(ADEV("9140"))!$D(ADEV("9986"))!$D(ADEV("9987")) D FAIL
 ;------->DELETE ENTRY IN ^ADEPCD
 D DELPCD
 ;------->END
END K:$D(ADEPAT) ^ADEUTL("ADELOCK",ADEPAT),DIK K AUPNLK("ALL") D END^ADEGRL Q
DELPCD S DA=ADEDFN,DIK="^ADEPCD(" D ^DIK Q
FAIL Q:'$D(^ADEPAT(ADEPAT,"FA"))
 S X=ADEVDATE,%DT="" D ^%DT
 I '$D(^ADEPAT(ADEPAT,"FA","B",Y)) K X,Y,%DT Q
 S DA=$O(^ADEPAT(ADEPAT,"FA","B",Y,0)) I '+DA K X,Y,%DT Q
 S DIE="^ADEPAT(DA(1),""FA"",",DA(1)=ADEPAT,DR=".01///@" D ^DIE
 K DA,DIE,DR,X,Y,%DT Q