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

ACDDFAC.m

Go to the documentation of this file.
  1. ACDDFAC ;IHS/ADC/EDE/KML - CLEAN OUT AREA/HQ DB OF FACILITY ENTRIES;
  1. ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
  1. ;************************************************************
  1. ;This CDMIS utility runs at the Area or HQ to clean out the
  1. ;Area or HQ database of facility data by date range. The user
  1. ;specifies which date range to delete data for, and which facility
  1. ;to delete. This routine will prep an Area/HQ machine for an upcomming
  1. ;import from a facility. There will be a need to clean out the
  1. ;Area/HQ machine prior to importing. This will be the case if a
  1. ;facility needs to resend data up to the Area. The Area database
  1. ;must first be cleaned out so not to have duplicate entries.
  1. ;
  1. ;Note this utility DOES NOT delete intervention data.
  1. ;//[ACD SUPER2]
  1. ;************************************************************
  1. EN ;EP
  1. W @IOF,!,*7,*7,*7,"WARNING..This utility will 'PERMANENTLY DELETE' CDMIS DATA."
  1. W !,"This is not a data archive (the data cannot be retrieved)",!
  1. W !,"This utility should only be run on machines receiving data imports."
  1. W !,"This utility should 'NEVER' run at the facility or on an",!,"Area machine where facilities are dialing into the Area to access CDMIS."
  1. ;
  1. D EN4^ACDV4MES
  1. ;
  1. ;
  1. ;
  1. ;
  1. EN1 ;
  1. ;Stop user if facility
  1. I $E(ACD6DIG)'=9,$E(ACD6DIG,3,4)'="00" W !!,*7,*7,"Facilities may not delete data using this option." D K Q
  1. ;
  1. K ACDPGM
  1. ;
  1. ;Load program names from the CDMIS VISIT file
  1. ;Load program names from the CDMIS PREVENTION file
  1. W !!,"Delete data for all programs" S %=2 D YN^DICN I %=1 F ACDDA=0:0 S ACDDA=$O(^ACDVIS("C",ACDDA)) Q:'ACDDA S ACDPGM(ACDDA)=""
  1. I %=1 F ACDDA=0:0 S ACDDA=$O(^ACDPD("C",ACDDA)) Q:'ACDDA S ACDPGM(ACDDA)=""
  1. I %=0 W !!,"Answer yes to 'PERMANENTLY DELETE DATA' for 'ALL' programs."
  1. I %=0 W !,"If you answer yes, I will show you a list of programs found."
  1. I %=0 W !,"Answer no, and you may then select individual programs." G EN1
  1. I %=2 F S DIC(0)="AEQ",DIC=4,DIC("A")="SELECT PROGRAM: " D ^DIC Q:Y<0 S ACDPGM(+Y)=""
  1. I '$O(ACDPGM(0)) G K
  1. ;Ask user for dates
  1. K ACDQUIT D D^ACDWRQ I $D(ACDQUIT) G K
  1. ;verify user wants to continue
  1. W !!!,"Deleting CDMIS VISIT ENTRIES for all CDMIS visit/prevention data",!!,"from: ",$$DD^ACDFUNC(ACDFR)," through: ",$$DD^ACDFUNC(ACDTO),!!,"for Program(s): " F DA=0:0 S DA=$O(ACDPGM(DA)) Q:'DA W !,$P(^DIC(4,DA,0),U)
  1. ;
  1. W !!!,*7,*7,"Your last chance to quit without deleting data is NOW !!??"
  1. W !!
  1. F W !!,"OK to continue" S %=2 D YN^DICN W:%=0 " Answer Yes or No" G:%'=1&(%'=0) K Q:%=1
  1. W !!,"First let me break the Visit Links....."
  1. F ACDAT=ACDFR-.01:0 S ACDAT=$O(^ACDVIS("B",ACDAT)) Q:'ACDAT!(ACDAT>ACDTO) F DA=0:0 S DA=$O(^ACDVIS("B",ACDAT,DA)) Q:'DA I $D(^ACDVIS(DA,0)),$D(^ACDVIS(DA,"BWP")),$D(ACDPGM(^("BWP"))) S DIK="^ACDVIS(" D ^DIK
  1. D EN1^ACDCLN
  1. F ACDAT=ACDFR-.01:0 S ACDAT=$O(^ACDPD("B",ACDAT)) Q:'ACDAT!(ACDAT>ACDTO) F DA=0:0 S DA=$O(^ACDPD("B",ACDAT,DA)) Q:'DA I $D(^ACDPD(DA,0)),$D(ACDPGM($P(^(0),U,4))) S DIK="^ACDPD(" D ^DIK
  1. K ;
  1. K DIC,DIK,DA,ACDPGM,Y,ACDTO,ACDFR
  1. K ACDAT
  1. Q