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

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

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1DIQ ;SFISC/GFT-CAPTIONED TEMPLATE ;05:55 PM 17 Apr 2003
2 ;;22.0;VA FileMan;**19,64,74,81,99,133**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 G INQ^DII
5 ;
6GET1(DIQGR,DA,DR,DIQGPARM,DIQGETA,DIQGERRA,DIQGIPAR) ;Extrinsic Function
7 ; file,record,field,parm,targetarray,errortargetarray,internal
8 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
9 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
10 G DDENTRY^DIQG
11 ;
12GETS(DIQGR,DA,DR,DIQGPARM,DIQGTA,DIQGERRA,DIQGIPAR) ;Procedure Call
13 ; file,record,field,parm,targetarray,errortargetarray,internal
14 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
15 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
16 N DIQGQERR
17 D DDENTRY^DIQGQ
18 I $G(DIQGQERR)]"" S DIERR=DIQGQERR
19 D:$G(DIQGERRA)]"" CALLOUT^DIEFU(DIQGERRA)
20 Q
21 ;
22 ;
23CAPTION(DD,DA,A,N,E) ;
24 ; Newing of Line Counter 'S' needs to be before call
25 N D0,DIQ,DIC,DIQS
26 S DIQ(0)=$G(A),DIC=^DIC(DD,0,"GL") I $G(DIA),DD=.6!(DD=1.1) S DIC=DIC_DIA_"," ;In DIQ(0), 'A' means AUDIT, 'R' means SHOW RECORD NUMBER
27 S E=$S($G(E)="":"N<0",1:"N]]"""_E_"""")
28 S N=$S($G(N)="":-1,1:$O(@(DIC_"DA,N)"),-1))
29 D R
30 S X=""
31 Q
32 ;
33GUY ;from DII
34 N N S N=-1
35R S:'$G(IOM) IOM=80 S:'$G(IOSL) IOSL=24,IOST="C-OTHER"
36 S:'$D(DTIME) DTIME=300 K DTOUT,DUOUT,DIRUT,DIR
37 N DIQDD,DIQAUDD,DIQZ,D,DL,D1,D2,D3,D4,D5,D6,D7,D8,D9
38 S D0=DA,D=DIC_DA_",",DL=1,DIQDD=DD S:'$G(S) S=3
39 I '$D(DIQS) W !
40 E D
41 .S DIQZ=0,A=0 F S @("DIQZ=$O("_DIQS_"DIQZ))") Q:DIQZ="" S @(DIQS_"DIQZ)=""""")
42 D 1(DA)
43 G Q
44 ;
451(DA) ;recursive, for 1 entry or subentry
46 N DIQAUD,DIQAUDE
47 I $D(DIQS) D ;old parameter -- undocumented
48 .S DIQZ=0,A=0 F S @("DIQZ=$O("_DIQS_"DIQZ))") Q:DIQZ="" D
49 ..S A=$O(^DD(DD,"B",DIQZ,0)) Q:'A
50 ..I $D(^DD(DD,A,0)) S C=$P(^(0),U,2) I C["C" D COM S @(DIQS_"DIQZ)=X")
51 I N<0,$D(^DD(DD,.001,0)) S W=.001,A=-1,Y=@("D"_(DL\2)) D W Q:'S G A
52 I $G(DIQ(0))["R",DL=1 S W=.001,A=-1,O="NUMBER",Y=D0 D W2 Q:'S
53A I DIQ(0)["A" D
54 .N Z,D,SUB
55 .S DIQAUDD="",DIQAUDE=D0 F A=3:2:DL S DIQAUDE=DIQAUDE_","_(@("D"_(A\2))),DIQAUDD=DIQAUDD_DIQAUDD(A-1)_","
56 .F Z=0:0 S Z=$O(^DIA(DIQDD,"B",DIQAUDE,Z)) Q:'Z D
57 ..S D=$P($G(^DIA(DIQDD,Z,0)),U,3) Q:'D ;get field number
58 ..I DL>1 S D=$P(D,DIQAUDD,2,9)
59 ..E I E["]]"!(N]]0) S SUB=$P($P($G(^DD(DIQDD,+D,0)),U,4),";") D
60 ...I N]]SUB S D=0 Q
61 ...N N S N=SUB I @E S D=0 Q
62 ..I D S DIQAUD(D,Z)="" Q
63 ;..S DIQAUDR(Z)=""
64N S @("N=$O("_D_"N))") I N="" S N=-1 G END:DL#2,UP
65 I DL=1,@E G END
66 S DIQZ=$G(^(N)) I DIQZ]"" S A="" F S A=$O(^DD(DD,"GL",N,A)) G N:A="" D G Q:'S ;write out what's on one data node
67 .S W=$O(^(A,0)) Q:'W I A S Y=$P(DIQZ,U,A) Q:Y=""
68 .E S Y=$E(DIQZ,+$E(A,2,9),$P(A,",",2)) Q:Y?." "
69 .D W
70 I DL#2 S DIQZ=$O(^DD(DD,"GL",N,0,0)) G N:DIQZ="" S O=0,X=+$P(^DD(DD,DIQZ,0),U,2) X:$D(DICS) DICS E G N
71 E G UP:N'>0 S X=DD,O=-1,@("D"_(DL\2)_"=N") Q:$$STOP I $D(DSC(X)) X DSC(X) E G N ;we've found a new sub-entry
72 S DD(DL)=DD,D(DL)=D,N(DL)=N,DL=DL+1,DIQAUDD(DL)=DIQZ S:+N'=N N=""""_N_"""" S D=D_N_",",N=O,DD=X ;down a level
73 I DL#2=0 S N=0 N DIQAUDR G N ;let's look for the 1st multiple
74WP I '$D(DIQS),$P(^DD(DD,.01,0),U,2)["W" S O=$P(^(0),U),C=$P(^(0),U,2) D S DL=DL-1 G UP:S Q
75 .N DIWF,DIWL,DIWR,DN,N,DD ;Word-processing field
76 .D DIQ^DIWW I $D(DN),'DN S S=0
77 S N=-1 D 1(DA) Q:'S
78UP S DL=DL-1,D=D(DL),DD=DD(DL),N=N(DL) Q:$$STOP G N ;go back UP a level
79 ;
80END Q:$$STOP
81 I $O(DIQAUD(0)) D ;write out audited DELETED fields
82 .N D F DIQZ=0:0 S DIQZ=$O(DIQAUD(DIQZ)) Q:'DIQZ W ?2,$P($G(^DD(DD,DIQZ,0)),U),":" D PRINTAUD(DIQZ) Q:$$STOP
83 I S,$G(DIQ(0))["C",$D(@(D_"0)")) D ^DIQ1 ;Computed fields at this level -- ONLY IF ENTRY EXISTS
84 Q
85 ;
86W S O=$P(^DD(DD,W,0),U),C=$P(^(0),U,2) I $D(DICS) X DICS E Q
87 D Y
88 I $D(DIQS) S:$D(@(DIQS_"O)")) @(DIQS_"O)=Y") S:$D(^(W)) @(DIQS_"W)=Y") Q
89W2 ;from DIQ1
90 N DIQX
91 S O=$E(O,1,253-$L(Y))_": "_Y
92 D I $L(O)+DIQX>IOM!$D(DIQAUD(W)) Q:$$STOP D
93 .S DIQX=$S($X:$X+1\40+1*40,W=.01!(W=.001):0,1:2)
94 W ?DIQX
95 D WRITE(O) D:$D(DIQAUD(W)) PRINTAUD(W) Q
96 ;
97PRINTAUD(FLD) N E,O,Z,W,N
98 S E=""
99 F S E=$O(DIQAUD(FLD,E),-1) Q:'E Q:$$STOP D
100 .;K DIQAUDR(E)
101 .S O=$G(^DIA(DIQDD,E,2)),N=$G(^(3))
102 .I N="" S W="Deleted """_O_""""
103 .E S W=$S(O]"":"Changed from """_O_"""",1:"Created")
104 .I $D(^(0)) S Z=$P(^(0),U,4),W=W_" on "_$$FMTE^DILIBF($P(^(0),U,2),"IL") I Z]"" S W=W_" by User #"_Z
105 .S Z=$G(^(4.1)),O=$P(Z,U),Z=$P(Z,U,2) I O,$D(^DIC(19,O,0)) S W=W_" ("_$P(^(0),U)_" Option)"
106 .I Z S O=+Z,Z=$P(Z,";",2) I Z]"",$D(@(U_Z_O_",0)")) S W=W_" ("_$P(^(0),U)_" Protocol)"
107 .W ?4 D WRITE(W)
108 K DIQAUD(FLD)
109 D LF Q
110WRITE(DIQW) N DIQWL
111 F S DIQWL=IOM-$X W $E(DIQW,1,DIQWL) S DIQW=$E(DIQW,DIQWL+1,999) Q:DIQW="" Q:$$STOP
112 Q
113 ;
114Y I C["O",$D(^(2)) X ^(2) Q ;NAKED REFERENCE IS TO ^DD(FILE#,FIELD#,0)
115S I C["S" S C=";"_$P(^(0),U,3),%=$F(C,";"_Y_":") S:% Y=$P($E(C,%,999),";",1) Q
116 I C["P",$D(@("^"_$P(^(0),U,3)_"0)")) S C=$P(^(0),U,2) Q:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+C,.01,0)) S C=$P(^(0),U,2) G S
117 I C["V",+Y,$D(@("^"_$P(Y,";",2)_"0)")) S C=$P(^(0),U,2) Q:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+C,.01,0)) S C=$P(^(0),U,2) G S
118 Q:C'["D" Q:'Y
119D S Y=$$FMTE^DILIBF(Y,"1U") Q
120 ;
121DT D D:Y W Y Q
122H G H^DIO2
123 ;
124STOP() D LF Q 'S
125LF I '$D(DIQS),$X W ! S S=S+1
126 I '$D(DIOT(2)),$G(IOSL),$S('$D(DIWF):1,$P(DIWF,"B",2):$P(DIWF,"B",2),1:1)+$Y'<IOSL D
127 .I '$D(DX(0)),$G(IOST)?1"C".E D:S>21 Q
128 ..N X,Y,DIR S DIR(0)="E" D ^DIR W ! S S='$D(DIRUT)
129 .I $G(^UTILITY($J,1))?1U1P1E.E D S:Y=U!($D(DTOUT))!($D(DUOUT)) S=0
130 ..N S X ^(1)
131 .S $Y=0
132 Q
133 ;
134EN1 S DRX=DR
135EN2 S DR=$P(DRX,";",1),DRX=$P(DRX,";",2,999) D EN W ! G EN2:DRX]""&S
136 K DRX Q
137EN ;
138 N C,O,W,N,E,Z,D,DD S S=0 S:$D(DICSS) DICS=DICSS
139 I '$D(IOST)!'$D(IOSL)!'$D(IOM) S IOP="HOME" D ^%ZIS Q:POP S:'$G(IOM) IOM=80
140 G Q:'$D(@(DIC_"0)")) S U="^",DD=+$P(^(0),U,2),DK=DD
141 I '$D(DR) S N=-1,O=""
142 E S N=$P(DR,":"),N=$S(0[N:-1,+N=N:N-.000001,1:$E(N,1,$L(N)-1)_$C($A(N,$L(N))-1)),O=$P(DR,":",DR[":"+1) G EN1:DR[";"
143 S E="N<0" I O]"" S E=E_"!(N]"""_$S(+O=O:"?"")!(N>"_O_")",1:O_""")")
144 I '$D(DIQ(0)) N DIQ S DIQ(0)=""
145 D R S DA=D0
146Q K C,O,W,N,E,Z,D,DD,IOP Q
147 ;
148COM X $P(^(0),U,5,99) S C=$P($P(C,"J",2),",",2) I C?1N.E,X S X=$J(X,0,C)
Note: See TracBrowser for help on using the repository browser.