source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DDS4.m@ 1154

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

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1DDS4 ;SFISC/MKO-FILE AND RELOAD ;21SEP2006
2 ;;22.0;VA FileMan;**11,151**;Mar 30, 1999;Build 10
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 D ^DDS41 Q:Y'=1
5 N DA,DDO,DIE,DDP,DDSDA
6 ;
7 S DX=0,DY=IOSL-1 X IOXY W "Filing form"_$P(DDGLCLR,DDGLDEL)
8 ;
9 ;File data
10 S DDS4FI="F"
11 F S DDS4FI=$O(@DDSREFT@(DDS4FI)) Q:DDS4FI'?1"F".E D
12 . S DDP=$E(DDS4FI,2,999),DDS4DA=" "
13 . F S DDS4DA=$O(@DDSREFT@(DDS4FI,DDS4DA)) Q:DDS4DA="" D REC
14 ;
15 ;Reload all pages on form
16 S DDS4P=0
17 F S DDS4P=$O(@DDSREFT@(DDS4P)) Q:'DDS4P D
18 . S DDS4B=0
19 . F S DDS4B=$O(@DDSREFT@(DDS4P,DDS4B)) Q:'DDS4B D
20 .. S DDP=$P(@DDSREFS@(DDS4P,DDS4B),U,3),DDSDA=" "
21 .. F S DDSDA=$O(@DDSREFT@(DDS4P,DDS4B,DDSDA)) Q:'DDSDA D
22 ... S $P(@DDSREFT@(DDS4P,DDS4B,DDSDA),U)=1,DIE=^(DDSDA,"GL")
23 ... Q:$P(@DDSREFT@(DDS4P,DDS4B,DDSDA),U,6)>1
24 ... D GDA(DDSDA)
25 ... D ^DDS11(DDS4B,1)
26 ;
27 I $G(^DIST(.403,+DDS,14))'?."^" D
28 . I $G(DDSPTB)_$G(DDSREP)]"" N DIE,DDP,DDSDA,DA,DDSDL D
29 .. S DA=DDSDAORG,DDSDL=DDSDLORG,DDSDA=DA_","
30 .. F DDSI=1:1:DDSDL S DA(DDSI)=DDSDAORG(DDSI),DDSDA=DDSDA_DA(DDSI)_","
31 .. S DDP=$P($G(DDSFLORG),U),DIE=U_$P($G(DDSFLORG),U,2) S:DIE=U DIE=""
32 . X ^DIST(.403,+DDS,14)
33 I '$G(DDSSAVE),$G(DDSPARM)["S" S DDSSAVE=1
34 S (Y,DDSH)=1,(DDSCHG,DX)=0,DY=IOSL-1 X IOXY W $P(DDGLCLR,DDGLDEL)
35 K @DDSREFT@("ADD"),@DDSREFT@("RXR")
36 K DIC,DDS1B,DDS1DA,DDS4B,DDS4DA,DDS4FI,DDS4FLD,DDS4FO,DDS4P
37 K DDSEXT,DDSI,DDSINT,DDSLC,DDSLN,DDSND,DDSOND,DDSOLD,DDSP,DDSPC
38 K DDSW,DDSX,DV
39 Q
40REC ;
41 G:DDS4FI="F0" FORMONLY
42 ;
43 S DIE=$G(@DDSREFT@(DDS4FI,DDS4DA,"GL")) I DIE="" Q ;JUST TO BE SAFE!
44 D GDA(DDS4DA)
45 S DDSOND=-1 K DDSLN
46 S DDS4FLD=""
47 F S DDS4FLD=$O(@DDSREFT@(DDS4FI,DDS4DA,DDS4FLD)) Q:DDS4FLD="" D FLD
48 S:$D(DDSLN)#2 @(DIE_"DA,DDSND)")=DDSLN
49 ;
50 I $D(@DDSREFT@("RXR")) D
51 . D FIRE^DIKC(DDP,.DA,"KS",$NA(@DDSREFT@("RXR")),"O^")
52 . K @DDSREFT@("RXR")
53 Q
54FLD ;
55 Q:'$G(@DDSREFT@(DDS4FI,DDS4DA,DDS4FLD,"F")) S ^("F")=""
56 I '$G(DDSCHANG),$G(DDSPARM)["C" S DDSCHANG=1
57 S DDSINT=$G(@DDSREFT@(DDS4FI,DDS4DA,DDS4FLD,"D"))
58 ;
59 ;Word processing fields (quit if multiple)
60 I $D(@DDSREFT@(DDS4FI,DDS4DA,DDS4FLD,"M"))#2 D:'$P(^("M"),U) Q
61 . N FR,TO
62 . S FR=$NA(@DDSREFT@(DDS4FI,DDS4DA,DDS4FLD,"D"))
63 . S TO=U_$$CREF^DILF($P(@DDSREFT@(DDS4FI,DDS4DA,DDS4FLD,"M"),U,2))
64 . K @TO
65 . M @TO=@FR
66 . K @FR,@DDSREFT@(DDS4FI,DDS4DA,DDS4FLD,"F")
67 ;
68 Q:$G(^DD(DDP,DDS4FLD,0))?."^" S DDSND=$P(^(0),U,4)
69 S DDSPC=$P(DDSND,";",2) Q:"0 "[DDSPC
70 S DDSND=$P(DDSND,";")
71 ;
72 I DDSOND'=DDSND D
73 . S:$D(DDSLN)#2 @(DIE_"DA,DDSOND)")=DDSLN
74 . S DDSLN=$G(@(DIE_"DA,DDSND)"))
75 . S DDSOND=DDSND
76 ;
77 I DDSPC D
78 . S DDSOLD=$P(DDSLN,U,DDSPC)
79 . S $P(DDSLN,U,DDSPC)=DDSINT
80 E D
81 . S DDSW=$E(DDSPC,2,999),DDSP=$P(DDSW,",",2)+1
82 . S DDSOLD=$E(DDSLN,+DDSW,DDSP-1)
83 . S DDSX=$E(DDSLN,DDSP,999)
84 . S DDSLN=$E(DDSLN,1,DDSW-1)_$J("",DDSW-1-$L(DDSLN))_DDSINT
85 . S:DDSX'?." " DDSLN=DDSLN_$J("",DDSP-DDSW-$L(DDSINT))_DDSX
86 ;
87 I $D(^DD(DDP,DDS4FLD,1))!($P(^(0),U,2)["a")!$D(^DD("IX","F",DDP,DDS4FLD)) D XR
88 Q
89XR ;
90 N DICRREC,DG,DP,DDS4AUD1,DDS4AUD2,DIANUM,DIIX,C,Y
91 S DP=DDP,DDSOND=-1
92 I $D(DDSLN)#2 S @(DIE_"DA,DDSND)")=DDSLN K DDSLN
93 S DICRREC="TRIG^DDS4"
94 ;
95 I $P(^DD(DDP,DDS4FLD,0),U,2)["a" D
96 . S (DDS4AUD1,DDS4AUD2)=1
97 . I $G(^DD(DDP,DDS4FLD,"AUDIT"))["e",DDSOLD="" S DDS4AUD1=0
98 ;
99 I DDSOLD]"" D
100 . S DG=0 F S DG=$O(^DD(DDP,DDS4FLD,1,DG)) Q:DG<1 D
101 .. S DIC=DIE,X=DDSOLD
102 .. X:$D(^DD(DDP,DDS4FLD,1,DG,2))#2 ^(2)
103 . I $G(DDS4AUD2) S DG=1,X=DDSOLD,DIIX="2^"_DDS4FLD D AUDIT^DIET
104 ;
105 I DDSINT]"" D
106 . S DG=0 F S DG=$O(^DD(DDP,DDS4FLD,1,DG)) Q:DG<1 D
107 .. S DIC=DIE,X=DDSINT
108 .. X:$D(^DD(DDP,DDS4FLD,1,DG,1))#2 ^(1)
109 . I $G(DDS4AUD1) S DG=1,X=DDSINT,DIIX="3^"_DDS4FLD D AUDIT^DIET
110 Q:'$D(^DD("IX","F",DDP,DDS4FLD))
111 ;
112 ;Process index file xrefs
113 N DDSFXR,DDSFXREF,DDSRXREF
114 D LOADFLD^DIKC1(DDP,DDS4FLD,"KS","",$NA(@DDSREFT@("F"))_"_","DDSFXR",$NA(@DDSREFT@("RXR")),.DDSFXREF,.DDSRXREF)
115 I $G(DDSRXREF)]""!($G(DDSFXREF)]"") D
116 . S @DDSREFT@("F"_DDP,DDS4DA,DDS4FLD,"O")=DDSOLD ;BRX-0404-11337
117 D:$G(DDSFXREF)]"" FIRE^DIKC(DDP,.DA,"KS","DDSFXR","O^")
118 Q
119GDA(DDSDA) ;
120 N I
121 K DA S DA=$P(DDSDA,",")
122 F I=2:1:$L(DDSDA,",")-1 S DA(I-1)=$P(DDSDA,",",I)
123 Q
124 ;
125FORMONLY ;
126 N X
127 D GDA(DDS4DA)
128 S DDS4FLD=""
129 F S DDS4FLD=$O(@DDSREFT@("F0",DDS4DA,DDS4FLD)) Q:DDS4FLD="" D
130 . Q:'$G(@DDSREFT@("F0",DDS4DA,DDS4FLD,"F"))
131 . S DDS4FO=$P(DDS4FLD,","),DDS4B=$P(DDS4FLD,",",2)
132 . S DDSOLD=$G(@DDSREFT@("F0",DDS4DA,DDS4FLD,"O")),X=$G(^("D")),DDSEXT=$G(^("X"),X)
133 . X:$G(^DIST(.404,DDS4B,40,DDS4FO,23))'?."^" ^(23)
134 . S ^("O")=@DDSREFT@("F0",DDS4DA,DDS4FLD,"D"),^("F")=""
135 Q
136 ;
137TRIG ;Called from trigger logic (from DICR via DICRREC)
138 N DDSRXREF
139 D LOADFLD^DIKC1(DIH,DIG,"KS","",$NA(@DDSREFT@("F"))_"_","",$NA(@DDSREFT@("RXR")),"",.DDSRXREF)
140 I $G(DDSRXREF)]"",'$D(@DDSREFT@("F"_DIH,DICRIENS,DIG,"O")) S ^("O")=DIU
141 Q
Note: See TracBrowser for help on using the repository browser.