source: FOIAVistA/trunk/r/SOCIAL_WORK-SOW-SWBH-SWFG/SOWKCLEA.m@ 1169

Last change on this file since 1169 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1SOWKCLEA ;B'HAM ISC/SAB-ROUTINE TO DELETE CLOSED AND TRANSMITTED CASES ; 10/26/92 17:53
2 ;;3.0; Social Work ;**53**;27 Apr 93
3 S SOWKAU=$P(^SOWK(650.1,1,0),"^",3),J=0,%DT="AEXP",%DT("A")="CUTOFF DATE: " D ^%DT G:"^"[$E(X) CLOS S CUT=Y H 3 W @IOF
4 W !!,*7,"ALL CASES ON OR BEFORE "_$E(CUT,4,5)_"/"_$E(CUT,6,7)_"/"_$E(CUT,2,3)_".",! F I=1:1 S T=$T(K+I) Q:T="" W !,$P(T,";",3,99)
5 F Q=0:0 W !!!,"ARE YOU SURE YOU WANT TO RUN THIS OPTION" S %=2 D YN^DICN Q:% I %Y["?" D YN^SOWKHELP
6 G:%=2!(%=-1) CLOS
7 F Q=0:0 W !!,"DO YOU WANT THIS OPTION QUEUED" S %=2 D YN^DICN Q:% I %Y["?" D YN^SOWKHELP
8 G:%=-1 CLOS I %=1 S ZTIO="",ZTDESC="Option to Purge Case Management Data (files 650 and 655)",ZTRTN="BEG^SOWKCLEA" F G="SOWKAU","CUT","J" S:$D(@G) ZTSAVE(G)=""
9 W ! I %=1 D ^%ZTLOAD G:'$D(ZTSK) CLOS W:$D(ZTSK) *7,!!,"Purge Case Management Data option Queued to run" K ZTSK G CLOS
10BEG D:'$D(ZTSK) WAIT^DICD I SOWKAU F I=0:0 S I=$O(^SOWK(650,I)) Q:'I S C=^SOWK(650,I,0) I $P(C,"^",18),$P(C,"^",6),$P(C,"^",18)'>CUT S CN=I,FLAG=$S($P(^SOWK(651,$P(C,"^",13),0),"^",6)="R":1,1:0),P=$P(C,"^",8) D REM,DB
11 I 'SOWKAU F I=0:0 S I=$O(^SOWK(650,I)) Q:'I S C=^SOWK(650,I,0) I $P(C,"^",18),$P(C,"^",18)'>CUT S CN=I,FLAG=$S($P(^SOWK(651,$P(C,"^",13),0),"^",6)="R":1,1:0),P=$P(C,"^",8) D REM,DB
12 W:'$D(ZTSK) " <"_J_" RECORDS DELETED>"
13CLOS K G,ZTDESC,ZTIO,ZTRTN,ZTSAVE,%,%Y,FLAG,%DT,I,P,Y,DA,K,T,Q,X,AL,C,J,DIC,DIK,HM,CN,CUT,SOWKAU D:$D(ZTSK) KILL^%ZTLOAD Q
14REM I 'FLAG S DA=I,DIK="^SOWK(650," W:'$D(ZTSK) "." D ^DIK S J=J+1 I $D(^SOWK(655,P,0)),'$P(^SOWK(655,P,0),"^",2) S DIK="^SOWK(655,",DA=P D ^DIK Q
15 Q:'FLAG
16 F HM=0:0 S HM=$O(^SOWK(655,P,4,HM)) Q:'HM I $P(^SOWK(655,P,4,HM,0),"^",5)=I D CHK
17 Q
18CHK I SOWKAU,$P(^SOWK(655,P,4,HM,0),"^",3),$P(^(0),"^",4) S J=J+1,DA(1)=P,DIK="^SOWK(655,"_DA(1)_",4,",DA=HM D ^DIK S DA=I,DIK="^SOWK(650," D ^DIK
19 I 'SOWKAU S J=J+1,DA(1)=P,DIK="^SOWK(655,"_DA(1)_",4,",DA=HM D ^DIK S DA=I,DIK="^SOWK(650," D ^DIK
20 I '$O(^SOWK(655,P,4,0)) S DA=P,DIK="^SOWK(655," D ^DIK
21 Q
22DEL ;Entry point to delete cases entered in error
23 S (DIC,DIK)="^SOWK(650,",DIC(0)="AEFQM",DIC("A")="SELECT CASE: " D ^DIC G:Y'>0 CLOS S (CN,DA)=+Y,AL=$P(^SOWK(650,CN,0),"^",13),P=$P(^(0),"^",8) D ^DIK D DB
24 I $P(^SOWK(651,AL,0),"^",6)="R" F I=0:0 S I=$O(^SOWK(655,P,4,I)) Q:'I I $P(^SOWK(655,P,4,I,0),"^",5)=CN S DA=I,DA(1)=P,DIK="^SOWK(655,"_DA(1)_",4," D ^DIK
25 I '$O(^SOWK(655,P,4,0)) S DA=P,DIK="^SOWK(655," D ^DIK
26 W *7," <RECORD DELETED>"
27 G CLOS Q
28DB S DA(1)=P,DIK="^SOWK(655.2,"_DA(1)_",23,",DA=$O(^SOWK(655.2,P,23,"AG",CN,0)) I DA D ^DIK
29 Q
30K ;TEXT TO EXPLAIN CLEAR PROBLEMS AND OUTCOME OPTION
31 ;;THERE ARE TWO WAYS TO CLEAR PROBLEMS/OUTCOMES.
32 ;;IF TRANSMITTING TO AUSTIN, THIS OPTION DELETES CASES THAT HAVE BEEN CLOSED,
33 ;;TRANSMITTED TO AUSTIN AND RCH CASES REMOVED FROM RCH PROGRAM.
34 ;;IF YOU ANSWER 'YES' TO THIS OPTION IT WILL DELETE THESE RECORDS. ONCE
35 ;;THESE RECORDS ARE DELETED THERE IS NO WAY TO RECOVER THEM, SO BE VERY
36 ;;CERTAIN THAT IT IS END OF QUARTER AND YOUR AMIS DATA TO AUSTIN IS ERROR
37 ;;FREE !!
38 ;;
39 ;;IF YOU ARE NOT TRANSMITTING TO AUSTIN ALL CASES THAT ARE CLOSED WILL BE DELETED.
Note: See TracBrowser for help on using the repository browser.