| 1 | QAPSDEL ;557/THM-DELETE A SURVEY, QUESTIONS, RESPONSES [ 06/20/95  12:40 PM ]
 | 
|---|
| 2 |  ;;2.0;Survey Generator;;Jun 20, 1995
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  D SCREEN^QAPUTIL
 | 
|---|
| 5 | EN W @IOF,! S QAPHDR="Delete a Survey, Questions, and Responses" X QAPBAR W !!
 | 
|---|
| 6 |  W "This program will ",BLDON,"COMPLETELY",BLDOFF," delete a survey, its questions",!,"and responses.",!!!
 | 
|---|
| 7 |  S DIC("S")="I $P(^(0),U,5)=DUZ!($D(^XUSEC(""QAP MANAGER"",DUZ)))!($D(^QA(748,""AB"",DUZ,+Y)))"
 | 
|---|
| 8 |  S DIC="^QA(748,",DIC(0)="AEQMZ" D ^DIC G:X=""!(X[U) EXIT  S SURVEY=+Y
 | 
|---|
| 9 |  S OWNER=$P(Y(0),U,5)
 | 
|---|
| 10 |  W ! K DIR S DIR("?")="Enter Y if it is the right one or N if not",DIR(0)="Y",DIR("A")="Is this the correct survey" D ^DIR G:$D(DTOUT) EXIT G:Y=0!(X[U)!($D(DIRUT)) EN
 | 
|---|
| 11 |  I DUZ'=OWNER W *7,!!,"This survey belongs to ",BLDON,$S($D(^VA(200,+OWNER,0)):$P(^(0),U,1),1:"an unknown survey developer"),BLDOFF,".",!," Be sure you want to delete ",BLDON,"THIS",BLDOFF," survey !!",! H 1
 | 
|---|
| 12 |  S DELETE=0 W !! K DIR
 | 
|---|
| 13 |  S DIR("?")="Enter Y if you are COMPLETELY sure or N if not"
 | 
|---|
| 14 |  S DIR(0)="Y",DIR("A")="Are you absolutely sure" D ^DIR G:$D(DTOUT) EXIT G:Y=0!(X[U)!($D(DIRUT)) EN
 | 
|---|
| 15 |  I Y=1 DO
 | 
|---|
| 16 |  .W !!,*7,"Survey now DISABLED ... ",!! H 1 S DIE="^QA(748,",DR=".05///e",DA=SURVEY D ^DIE
 | 
|---|
| 17 |  .L ^QA(748,SURVEY,0) S DA=SURVEY,DIK="^QA(748," W !,"Deleting the survey . . ." D ^DIK W "."
 | 
|---|
| 18 |  .L ^QA(748.25,SURVEY,0) S DA=SURVEY,DIK="^QA(748.25," W !,"Deleting the questions . . ." D ^DIK W "."
 | 
|---|
| 19 |  .W !,"Deleting the responses . . ." F DA=0:0 S DA=$O(^QA(748.3,"B",SURVEY,DA)) Q:DA=""  S DIK="^QA(748.3," D ^DIK W "."
 | 
|---|
| 20 |  .LOCK  H 1
 | 
|---|
| 21 |  G EN
 | 
|---|
| 22 |  ;
 | 
|---|
| 23 | EXIT G EXIT^QAPUTIL
 | 
|---|