source: WorldVistAEHR/trunk/r/RECORD_TRACKING-RT/RTDEL.m@ 1604

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

initial load of WorldVistAEHR

File size: 3.9 KB
RevLine 
[613]1RTDEL ;TROY ISC/MJK-Delete a Record; ; 5/7/87 10:08 AM ;
2 ;;v 2.0;Record Tracking;;10/22/91
3DEL W ! S RTINACFL="",DIC(0)="AZEMQ",RTSEL="" D ^RTDPA K RTINACFL,DIC,RTESC,RTY,RTC G DELQ:Y<0 S RT=+Y,RT0=Y(0),V=+$P(RT0,"^",7),P=$S(V=1:RT,1:+$P(RT0,"^",5)),T=+$P(RT0,"^",3) G DEL:'P
4 S V1=0,RTTOV1=0 F I=0:0 S I=$O(^RT("P",P,I)) Q:'I I $D(^RT(I,0)),$P(^(0),"^",7)>V1 S V1=+$P(^(0),"^",7),RTTOV1=I
5 I V1>V W !!?5,*7,"This record is volume '",V,"' of a '",V1,"' record set.",!?12,"...no deletion is allowed." G DEL
6 S V1=0,RTTO=RTTOV1 F I=0:0 S I=$O(^RT("P",P,I)) Q:'I I RTTOV1'=I,$D(^RT(I,0)),$P(^(0),"^",7)>V1 S V1=+$P(^(0),"^",7),RTTO=I
7 I RTTO=RTTOV1 S RTTO=P
8 I V>1,RTTO I $D(^RT(+RTTO,0)) S RTVOL=$P(^(0),"^",7)
9 E W !!?5,"There is no record/volume to transfer requests to .." S RTTO=0
10 I RTTO S Y=T D TYPE1^RTUTL I '$D(RTTY) W !!?5,"Unknown Record type" K RTVOL S RTTO=0
11 I RTTO S RTPAR=P,RTFROM=RT,RT=RTTO D RTDEL1 S RT=RTFROM K RTFROM I $D(RTESC) K RTESC,RT G DEL
12 S Y=$P(RT0,"^") D NAME^RTB W !!,"Record Chosen: ",Y,"'s ",$S($D(^DIC(195.2,+$P(RT0,"^",3),0)):$P(^(0),"^"),1:"UNKNOWN")," [Volume: ",+$P(RT0,"^",7),"]"
13 W !!,"Deletion of this record will also cause the following to be deleted:",!?10,"- any requests for the record",!?10,"- any missing record log entries",!?10,"- all movement history log entries"
14 S RTRD(1)="Yes^delete record",RTRD(2)="No^stop the deletion process",RTRD("B")=2,RTRD(0)="S",RTRD("A")="Are you sure you want to delete this record? " D SET^RTRD K RTRD G DEL:$E(X)'="Y"
15 W !,"Deletion process beginning..."
16 F RTQ=0:0 S RTQ=$O(^RTV(190.1,"B",RT,RTQ)) Q:'RTQ D RTQ S DA=RTQ,DIK="^RTV(190.1," D ^DIK W "."
17 F RTDIK=190.2,190.3 F RTI=0:0 S RTI=$O(^RTV(RTDIK,"B",RT,RTI)) Q:'RTI S DA=RTI,DIK="^RTV("_RTDIK_"," D ^DIK W "."
18 S XMB="RT RECORD DELETION",Y=$P(RT0,"^") D NAME^RTB S XMB(1)=Y,XMB(2)=$S($D(^DIC(195.2,+$P(RT0,"^",3),0)):$P(^(0),"^"),1:"UNKNOWN"),XMB(3)=+$P(RT0,"^",7),XMB(4)=RT,XMB(5)=$S($D(^VA(200,DUZ,0)):$P(^(0),"^"),1:"UNKNOWN")
19 D NOW^%DTC S Y=$E(%,1,12) D D^DIQ S XMB(6)=Y D SEND^RTT2 K XMB
20 S DA=RT,DIK="^RT(" D ^DIK W !?10,"...deletion complete"
21DELQ K RTDIK,RTI,RT,V,V1
22 K T,RTBCIFN,RTSEL,RTTOV1,RT0,RTFROM,%,%H,%Y,%YV,DA,DIC1,DIK,DIY,DIYS,N,POP
23 K X,Y,RTTO,RTQ Q
24RTQ K RTQ1 G SC:'$D(^RTV(190.1,"APAR",RTQ)) S RTQ1=+$O(^(RTQ,0)) S DA=RTQ1,DR="11///@",DIE="^RTV(190.1," D ^DIE K DE,DQ
25 F RTQ2=0:0 S RTQ2=$O(^RTV(190.1,"APAR",RTQ,RTQ2)) Q:'RTQ2 S DA=RTQ2,DR="11////"_RTQ1,DIE="^RTV(190.1," D ^DIE K DE,DQ
26SC Q:'$D(^RTV(190.1,RTQ,0)) S X=^(0) Q:'$D(^RTV(195.9,+$P(X,"^",5),0)) S X1=^(0) Q:'$D(^SC(+$P(X1,"^",2),0)) S SDTTM=+$P(X,"^",4),SDSC=+$P(X1,"^",2)
27 F SDPL=0:0 S SDPL=$O(^SC(SDSC,"S",SDTTM,1,SDPL)) Q:'SDPL I $D(^(SDPL,"RTR")),+^("RTR")=RTQ S ^("RTR")=$S($D(RTQ1):RTQ1,1:"") Q
28 K SDSC,SDTTM,SDPL,RTQ1,RTQ2,DR,DIE,X1,X Q
29 ;
30RTDEL1 D EN K X,P,Z,RDT,RTV0,RTWND
31 K RTTO,RTPAR,RTVOL,RTTY,RTSEL Q
32EN S RTRD(1)="Yes^transfer Requests to Record/Volume "_RTVOL
33 S RTRD(2)="No^not change the Record/Volume(s) Requested."
34 S RTRD("A")="Pending Requests can be transferred to Record/Volume ,"_RTVOL_$C(13,10)_" Transfer Requests to Volume '"_RTVOL_"' ? "
35 ;
36 S RTRD(0)="S",RTRD("B")=2 D SET^RTRD K RTRD S X=$E(X) S:X["^" RTESC="" I X'="Y" Q
37 ;get pend cut
38 Q:'$D(RTTY) D PND^RTRPT Q:'$D(RTWND(+RTTY))
39 ;get requests
40GET S RTV0=RTFROM
41 ;z=da
42FIND F Z=0:0 S Z=$O(^RTV(190.1,"B",RTV0,Z)) Q:'Z D REC L -^RTV(190.1,Z)
43 QUIT
44 ;
45REC I $D(^RTV(190.1,Z,0)),$D(^RT(+^RTV(190.1,Z,0))) L +^RTV(190.1,Z):1 I '$T G REC
46 I '$D(^RTV(190.1,Z,0))!('$D(^RT(+^RTV(190.1,Z,0)))) Q
47 ;only requests,pending
48 S RDT=+$P(^RTV(190.1,Z,0),"^",4) Q:'RDT I $P(RDT,".")<RTWND(+RTTY) Q
49 I $P(^RTV(190.1,Z,0),"^",6)'="r" Q
50 S $P(^RTV(190.1,Z,0),"^",1)=RT,^RTV(190.1,"B",RT,Z)="" K ^RTV(190.1,"B",RTV0,Z) W " ." R X:0
51 ;date/time needed
52DAT I RDT,$D(^RTV(190.1,"AC",RTV0,$P(RDT,"."),Z)) S ^RTV(190.1,"AC",RT,$P(RDT,"."),Z)="" K ^RTV(190.1,"AC",RTV0,$P(RDT,"."),Z)
53 ;
54 ;pull list
55PUL S P=+$P(^RTV(190.1,Z,0),"^",10)
56 I P,$D(^RTV(190.1,"AP1",P,RTV0,Z)) S ^RTV(190.1,"AP1",P,RT,Z)="" K ^RTV(190.1,"AP1",P,RTV0,Z)
57 Q
Note: See TracBrowser for help on using the repository browser.