source: WorldVistAEHR/trunk/r/GEN_MED_REC_GENERATOR-GMRG/GMRGUTL.m@ 931

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

initial load of WorldVistAEHR

File size: 3.4 KB
RevLine 
[613]1GMRGUTL ;HIRMFO/RM-UTILITIES ROUTINE FOR GMRG FILES ;5/2/96
2 ;;3.0;Text Generator;**1**;Jan 24, 1996
3EN1 ; ENTRY FROM AUD1 OR AUD2 XREFS TO SET AUDIT TRAIL ENTRY. IF GMRGY=1
4 ; THE ENTRY WILL BE A CREATE, IF GMRGY=2 THE ENTRY WILL BE AN EDIT.
5 ; I GMRGY=0 THEN THE ENTRY WILL BE A DELETE. THE VARIABLE GMRGY WILL BE
6 ; KILLED, AND THE VARIABLES DA(1),DA, AND X WILL ALSO BE SET AND RESET.
7 Q:'$D(GMRGRT) S GMRGDA=DA,GMRGX=X I $D(DA)\10 F GMRGY(0)=0:0 S GMRGY(0)=$O(DA(GMRGY(0))) Q:GMRGY(0)'>0 S GMRGDA(GMRGY(0))=DA(GMRGY(0))
8 S DA(2)=GMRGDA(1),DA(1)=GMRGDA
9 S GMRGST(1)=DA(2),GMRGST=DA(1) D STAT^GMRGRUT0 S GMRGLDT=+$P(GMRGSTAT,"^",2),DA=+$P(GMRGSTAT,"^") D NOW^%DTC D:%'>GMRGLDT PAST S GMRGDT=%
10 G:GMRGY=0 A0:$P(GMRGSTAT,"^",3),Q1
11 I $D(GMRGZ),DA>0 S X=GMRGX D TEXT:'GMRGAT,ADTX:GMRGAT S X=$S(GMRGAT:$S($D(^GMR(124.3,DA(2),1,DA(1),0)):$P(^(0),U,2),1:""),1:$S($D(^GMR(124.3,DA(2),1,DA(1),"ADD")):^("ADD"),1:"")) D TEXT:GMRGAT,ADTX:'GMRGAT S X=GMRGX
12 I GMRGY=2,'$P(GMRGSTAT,"^",3) S GMRGY=1 D A0 S GMRGY=2 G EN1
13A0 S:'$D(^GMR(124.3,DA(2),1,DA(1),2,0)) ^(0)="^124.313DAI^0^0" S DA=$P(^GMR(124.3,DA(2),1,DA(1),2,0),"^",3)
14A1 S DA=DA+1 I $D(^GMR(124.3,DA(2),1,DA(1),2,DA,0)) G A1
15 S ^GMR(124.3,DA(2),1,DA(1),2,DA,0)=GMRGDT_"^"_GMRGY_"^"_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)
16 F GMRGY(0)=.01,1,2 S X=$S(GMRGY(0)=.01:GMRGDT,GMRGY(0)=1:GMRGY,1:DUZ) F GMRGY(1)=0:0 S GMRGY(1)=$O(^DD(124.313,GMRGY(0),1,GMRGY(1))) Q:GMRGY(1)'>0 X:$D(^DD(124.313,GMRGY(0),1,GMRGY(1),1)) ^(1)
17 I GMRGY=0 D EN1^GMRGUT0
18Q1 K X,DA S X=GMRGX,DA=GMRGDA I $D(GMRGDA)\10 F GMRGY(0)=0:0 S GMRGY(0)=$O(GMRGDA(GMRGY(0))) Q:GMRGY(0)'>0 S DA(GMRGY(0))=GMRGDA(GMRGY(0))
19 K GMRGY,GMRGDA,GMRGX,GMRGLDT,GMRGDT,GMRGSTAT
20 Q
21PAST ; ENTRY TO HANDLE DATE/TIME ENTRIES THAT ARE EARLIER THAN OR EQUAL
22 ; TO, THE LAST DATE/TIME ENTERED
23 S %=$$FMADD^XLFDT(GMRGLDT,0,0,0,1)
24 Q
25TEXT ; UPDATE SELECTION:AUDIT TRAIL:MODIFIED TEXT FIELD
26 S $P(^GMR(124.3,DA(2),1,DA(1),2,DA,0),U,4)=$E(X,1,175) F GMRGXX=0:0 S GMRGXX=$O(^DD(124.313,3,1,GMRGXX)) Q:GMRGXX'>0 X:$D(^DD(124.313,3,1,GMRGXX,1)) ^(1)
27 K GMRGXX
28 Q
29ADTX ;
30 S ^GMR(124.3,DA(2),1,DA(1),2,DA,"ADD")=X F GMRGXX=0:0 S GMRGXX=$O(^DD(124.313,4,1,GMRGXX)) Q:GMRGXX'>0 X:$D(^DD(124.313,4,1,GMRGXX,1)) ^(1)
31 K GMRGXX
32 Q
33EN2 ; ENTRY FROM SCREEN ON SET OF CODES FOR MODIFICATION FIELD (#1) OF
34 ; THE AUDIT TRAIL SUBFIELD (#3) OF THE SELECTION MULTIPLE (#1) OF
35 ; THE GMR TEXT (#124.3) FILE.
36 S GMRGZ(0)=$P($G(^GMR(124.3,DA(2),1,DA(1),2,DA,0)),"^"),GMRGZ(0)=$S(GMRGZ(0):GMRGZ(0),1:9999999)
37 S GMRGZ=$O(^GMR(124.3,DA(2),1,DA(1),2,"AA",9999999-GMRGZ(0))),GMRGZ=$S(GMRGZ'>0:"",1:$O(^(GMRGZ,0)))
38 I GMRGZ'>0,Y=1 G Q2
39 I GMRGZ=1,(Y=0!(Y=2)) G Q2
40 I GMRGZ=2,(Y=0!(Y=2))
41Q2 K GMRGZ
42 Q
43EN3 ; ENTRY FROM SCREEN ON CHILD SUBFILED (#.01) OF CHILDREN (#1) FIELD
44 ; OF THE GMR AGGREGATE TERM (#124.2) FILE
45 I $P(^GMRD(124.2,D0,0),U,2)'>$P(^GMRD(124.2,+Y,0),U,2),D0'=+Y
46 Q
47EN4 ; ENTRY FROM SCREEN ON SELECTION SUBFIELD (#.01) OF SELECTION FIELD
48 ; (#1) OF THE GMR TEXT FILE (#124.3)
49 S GMRG("OK")=0,GMRG=$S($D(^GMR(124.3,D0,0)):$P(^(0),U),1:"") I GMRG>0,$D(^GMRD(124.2,"AKID",+Y,GMRG)) S GMRG("OK")=1
50 I 'GMRG("OK") F GMRG=0:0 Q:GMRG("OK") S GMRG=$O(^GMRD(124.2,"AKID",+Y,GMRG)) Q:GMRG'>0 S GMRG("OK")=$S($D(^GMR(124.3,D0,1,"B",GMRG)):1,1:0)
51 I GMRG("OK")
52 K GMRG,GMRGSTAT
53 Q
54S4 I GMRG(0)>0,GMRG(0)'=+Y S GMRGST=GMRG(0),GMRGST(1)=D0 D STAT^GMRGRUT0 S GMRG("OK")=$S('$P(GMRGSTAT,U,3):0,1:1)
55 Q
Note: See TracBrowser for help on using the repository browser.