source: FOIAVistA/trunk/r/GEN_MED_REC_GENERATOR-GMRG/GMRGUT0.m@ 757

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

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1GMRGUT0 ;HIRMFO/RM-UTILITIES ROUTINE FOR GMRG FILES (CONT.) ;9/11/95
2 ;;3.0;Text Generator;;Jan 24, 1996
3EN1 ; ENTRY FROM AUDT XREF ON SELECTION:AUDIT TRAIL:MODIFICATION
4 ; FIELD OF THE GMR TEXT FILE (#124.3). THIS XREF SETS THE
5 ; SELECTION:AUDIT TRAIL:MODIFIED TEXT FIELD TO THE VALUE OF THE
6 ; SELECTION:ADDITIONAL TEXT FIELD AND DELETES THE DATA IN THE
7 ; SELECTION:ADDITIONAL FIELD IF A RECORD IS BEING FLAGGED AS
8 ; DELETED.
9 S GMRG("DAX")=DA(2)_"^"_DA(1)_"^"_DA_"^"_X,GMRGT=$S($D(^GMR(124.3,DA(2),1,DA(1),0)):^(0),1:""),X=$P(GMRGT,"^",2),$P(GMRG(0),"^",2)=$P(GMRGT,"^"),$P(GMRG(0),"^",3)=$S($D(^GMR(124.3,DA(2),1,DA(1),2,DA,0)):$P(^(0),"^"),1:"")
10 S DA=0 F GMRG=0:0 S GMRG=$O(^GMR(124.3,DA(2),1,DA(1),2,"AA",GMRG)) Q:GMRG'>0!(DA>0) F GMRG(1)=0:0 S GMRG(1)=$O(^(GMRG,GMRG(1))) Q:GMRG(1)'>0!(DA>0) F DA=0:0 S DA=$O(^(GMRG(1),DA)) Q:DA'>0 I DA'=$P(GMRG("DAX"),"^",3) Q
11 I X'="" D TEXT^GMRGUTL,DELAD
12 S X=$S($D(^GMR(124.3,DA(2),1,DA(1),"ADD")):^("ADD"),1:"") I X'="" D ADTX^GMRGUTL,DELTX
13 S $P(GMRG(0),"^")=$S($D(^GMR(124.3,DA(2),1,DA(1),0)):$P(^(0),"^"),1:"")
14 I $P(GMRG(0),"^")'="" F GMRG(1)=0:0 S GMRG(1)=$O(^GMRD(124.2,$P(GMRG(0),"^"),1,"B",GMRG(1))) Q:GMRG(1)'>0 D:$D(^GMR(124.3,DA(2),1,"B",GMRG(1))) DELCH
15 S DA(2)=$P(GMRG("DAX"),"^"),DA(1)=$P(GMRG("DAX"),"^",2),DA=$P(GMRG("DAX"),"^",3),X=$P(GMRG("DAX"),"^",4) K GMRG,GMRGLDT,GMRGT
16 Q
17DELAD ; DELETE ADDITIONAL TEXT IF SELECTION IS BEING FLAGGED AS DELETED
18 S GMRGDAZ(1)=DA(1),GMRGDAZ=DA,DA(1)=DA(2),DA=DA(1) F GMRG=0:0 S GMRG=$O(^DD(124.31,1,1,GMRG)) Q:GMRG'>0 X:$P(^DD(124.31,1,1,GMRG,0),"^",2)'="AUD2"&$D(^DD(124.31,1,1,GMRG,2)) ^(2)
19 S DA(1)=GMRGDAZ(1),DA=GMRGDAZ,$P(^GMR(124.3,DA(2),1,DA(1),0),"^",2)="" K GMRGDAZ
20 Q
21DELTX ;
22 S GMRGDAZ(1)=DA(1),GMRGDAZ=DA,DA(1)=DA(2),DA=DA(1) F GMRG=0:0 S GMRG=$O(^DD(124.31,1,2,GMRG)) Q:GMRG'>0 X:$P(^DD(124.31,1,2,GMRG,0),"^",2)'="AUD3"&$D(^DD(124.31,1,2,GMRG,2)) ^(2)
23 S DA(1)=GMRGDAZ(1),DA=GMRGDAZ,^GMR(124.3,DA(2),1,DA(1),"ADD")="" K GMRGDAZ
24 Q
25DELCH ; DELETE CHILDREN OF A SELECTION IF ITSELF IS DELETED.
26 S GMRGT=$P(GMRG(0),"^",2,3)_"^"_GMRG(1) N GMRG W:$D(GMRGDFLG) "."
27 S GMRG(1)=$P(GMRGT,"^",3),DA(1)=$O(^GMR(124.3,DA(2),1,"B",GMRG(1),0)),GMRGXY("DT0")=$P(GMRGT,"^",2),$P(GMRG(0),"^",2)=$P(GMRGT,"^")
28 S GMRGT=1 F GMRGT(0)=0:0 S GMRGT(0)=$O(^GMRD(124.2,"AKID",GMRG(1),GMRGT(0))) Q:GMRGT(0)'>0 I $D(^GMR(124.3,DA(2),1,"ALIST",GMRGT(0))),GMRGT(0)'=$P(GMRG(0),"^",2) S GMRGT=0 Q
29 G:'GMRGT QD
30 I DA(1)'>0 G QD
31 S DA=$P(^GMR(124.3,DA(2),1,DA(1),2,0),"^",3)
32LD S DA=DA+1 I $D(^GMR(124.3,DA(2),1,DA(1),2,DA,0)) G LD
33 S GMRGST(1)=DA(2),GMRGST=DA(1) D STAT^GMRGRUT0 G QD:'$P(GMRGSTAT,"^",3) S GMRGLDT=+$P(GMRGSTAT,"^",2),%=GMRGXY("DT0") D PAST^GMRGUTL:%'>GMRGLDT
34 S GMRGXY("DT0")=%,^GMR(124.3,DA(2),1,DA(1),2,DA,0)=GMRGXY("DT0")_"^"_0_"^"_DUZ,$P(^GMR(124.3,DA(2),1,DA(1),2,0),"^",3,4)=DA_"^"_($P(^GMR(124.3,DA(2),1,DA(1),2,0),"^",4)+1)
35 F GMRGXY=.01,1,2 S X=$S(GMRGXY=.01:GMRGXY("DT0"),GMRGXY=1:0,1:DUZ) F GMRGXY(0)=0:0 S GMRGXY(0)=$O(^DD(124.313,GMRGXY,1,GMRGXY(0))) Q:GMRGXY(0)'>0 X:$D(^DD(124.313,GMRGXY,1,GMRGXY(0),1)) ^(1)
36 D EN1
37QD K GMRGXY,GMRGSTAT
38 Q
Note: See TracBrowser for help on using the repository browser.