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

BMCRDLT.m

Go to the documentation of this file.
BMCRDLT ; IHS/PHXAO/TMJ - REFERRAL DELETE ;
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
 ;
 S U="^"
 Q:'$D(BMCRDLT)
 Q:'BMCRDLT
 Q:'$D(^BMCREF(BMCRDLT,0))
 ;
 ;Quit Deletion -reason to quit, ie CHS, ETC.
 Q:$D(^BMCREF(BMCRDSP,41,0))  ;  Quit if CHS Authorization Multiple
 ;Q:$P($G(^BMCREF(BMCRDSP,11)),U,12)]""  ; Quit if CHS Flds 1112 TO 1122
 Q:$P($G(^BMCREF(BMCRDSP,11)),U,13)]""
 Q:$P($G(^BMCREF(BMCRDSP,11)),U,14)]""
 Q:$P($G(^BMCREF(BMCRDSP,11)),U,15)]""
 Q:$P($G(^BMCREF(BMCRDSP,11)),U,16)]""
 Q:$P($G(^BMCREF(BMCRDSP,11)),U,17)]""
 Q:$P($G(^BMCREF(BMCRDSP,11)),U,18)]""
 Q:$P($G(^BMCREF(BMCRDSP,11)),U,19)]""
 ;Q:$P($G(^BMCREF(BMCRDSP,11)),U,20)]""
 ;Q:$P($G(^BMCREF(BMCRDSP,11)),U,21)]""
 ;Q:$P($G(^BMCREF(BMCRDSP,11)),U,22)]""
 Q:$P($G(^BMCREF(BMCRDSP,0)),U,29)]""  ; Quit if PCC Visit Entry
 D DELETE
 D EOJ
 Q
 ;
DELETE ;
 S BMCVFLE=90001 F BMCVL=0:0 S BMCVFLE=$O(^DIC(BMCVFLE)) Q:BMCVFLE>90001.99!(BMCVFLE'=+BMCVFLE)  D DELETE2
 ;S BMCREF=BMCRDLT D DEL^BMCREF K BMCREF
 ;Do not need above line to set Delete Flag but do need to Delete Referral
 ;
 S DA=BMCRDSP,DIK="^BMCREF(" D ^DIK K DIK
 W !!,"Referral Record Deleted - "_BMCRDSP
 Q
 ;
DELETE2 ;
 S BMCVNM=$P(^DIC(BMCVFLE,0),U)
 S BMCVDG=^DIC(BMCVFLE,0,"GL"),BMCVIGR=BMCVDG_"""AD"",BMCRDLT,BMCVDFN)"
 S BMCVDFN="" F BMCVI=1:1 S BMCVDFN=$O(@BMCVIGR) Q:BMCVDFN=""  W:'$D(ZTQUEUED) "." S DIK=BMCVDG,DA=BMCVDFN D ^DIK
 Q
 ;
EOJ ; EOJ CLEANUP
 K BMCVDFN,BMCVDG,BMCRDLT,BMCVFLE,BMCVI,BMCVIGR,BMCVL,BMCVNM,BMCCTR,BMCH,BMCRIO,BMCRREC,BMCRSTAT,BMCSTR
 K %,X
 K D,D0,DA,DIC,DICR,DIE,DIG,DIH,DIU,DIV,DIW,DQ,DR
 Q