source: FOIAVistA/trunk/r/HEALTH_SUMMARY-GMTS/GMTSRN.m@ 635

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

initial load of FOIAVistA 6/30/08 version

File size: 1.9 KB
Line 
1GMTSRN ;SLC/JER - Renumber Selected Health Summary Type ; 08/27/2002
2 ;;2.7;Health Summary;**36,56**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10026 ^DIR
6 ; DBIA 10076 ^XUSEC(
7 ; DBIA 10076 ^XUSEC("GMTSMGR")
8 ; DBIA 10013 ^DIK (file #142)
9 ;
10MAIN ; Initializes Variables and Controls Branching
11 N CHANGE,GMTSIFN,GMTSUM,GMTSEG,GMTSI,GMTSJ,GMTSQIT F D SELECT Q:$D(GMTSQIT) D COPY,RNMBR:CHANGE W !
12 Q
13SELECT ; Select Health Summary Type
14 N DIR,GMTSKEY,GMTSMGR,GMTSOWN,X,Y
15 W ! S DIR(0)="PO^142:AEMQZ" D ^DIR K DIR I $D(DIRUT) S GMTSQIT="" Q
16 S GMTSIFN=+Y,GMTSUM=$P(Y,U,2)
17 S GMTSKEY=$S($P(^GMT(142,GMTSIFN,0),U,2)]"":$P(^(0),U,2),1:" ZZZ"),GMTSOWN=$S($P(^(0),U,3)>0:$P(^(0),U,3),1:DUZ)
18 S GMTSMGR=$S($D(^XUSEC("GMTSMGR",DUZ)):1,$D(^XUSEC(GMTSKEY,DUZ)):1,GMTSOWN=DUZ:1,1:0)
19 I GMTSMGR Q
20 I '$D(^XUSEC(GMTSKEY,DUZ)) W !,$C(7),"This summary is currently locked to prevent alteration.",! S GMTSQIT="" Q
21 I GMTSOWN'=DUZ W !,$C(7),"Alteration of this summary is restricted to its owner.",!,"See the Clinical Coordinator if you need additional help." S GMTSQIT=""
22 Q
23COPY ; Copies Structure Multiple into GMTSEG(SEQ,
24 N GMTSI,SEQ K GMTSEG S (CHANGE,GMTSI)=0 I '$D(^GMT(142,GMTSIFN,1,5)) S CHANGE=1
25 F S GMTSI=$O(^GMT(142,GMTSIFN,1,GMTSI)) Q:GMTSI'>0 W "." I GMTSI#5'=0 S CHANGE=1
26 I 'CHANGE Q
27 S (SEQ,GMTSI)=0 F S GMTSI=$O(^GMT(142,GMTSIFN,1,GMTSI)) Q:GMTSI'>0 I $P(^(GMTSI,0),U,2) S SEQ=SEQ+1,GMTSEG(SEQ)=^(0) D GETSEL,PURGE W "."
28 Q
29GETSEL ; Gets Selection Items from Multiple
30 N SN S SN=0 F S SN=$O(^GMT(142,GMTSIFN,1,GMTSI,1,SN)) Q:SN'>0 S GMTSEG(SEQ,SN)=^(SN,0)
31 Q
32PURGE ; Deletes Old Node from ^GMT(142,GMTSIFN,1,GMTSI, using ^DIK
33 N DA,DIK S DA(1)=GMTSIFN,DA=GMTSI,DIK="^GMT(142,"_GMTSIFN_",1," D ^DIK
34 Q
35RNMBR ; Traverses GMTSEG(SEQ) - Resets ^GMT(142,GMTSIFN,1,
36 N DA,DR,DIE,ISEQ,SEQ,CCT S (CCT,SEQ)=0 F S SEQ=$O(GMTSEG(SEQ)) Q:SEQ'>0 K DA S DIE="^GMT(142,"_GMTSIFN_",1,",DA(1)=GMTSIFN D LOADCMP^GMTSRM5 S CCT=CCT+1 W:CCT#2=0 "."
37 Q
Note: See TracBrowser for help on using the repository browser.