1 | DIPTED ;GFT ;04:17 PM 13 Feb 2002
|
---|
2 | ;;22.0;VA FileMan;**97**;Mar 30, 1999
|
---|
3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | N DIC,DIPT,DIPTED,DRK,DIPTEDTY,I,J
|
---|
5 | S DIC=.4,DIC(0)="AEQ",DIC("S")="I $P(^(0),U,8)=7!'$P(^(0),U,8)" D ^DIC Q:Y<1
|
---|
6 | K DIC
|
---|
7 | S DIPT=+Y D E
|
---|
8 | D PUT
|
---|
9 | K K ^TMP("DIPTED",$J),^UTILITY("DIP2",$J)
|
---|
10 | Q
|
---|
11 | ;
|
---|
12 | EDIT(DIPT) ; EDIT PRINT TEMPLATE 'DIPT' VIA VA FILEMAN SCREEN EDITOR
|
---|
13 | N DIPTED,DRK,DIPTEDTY,I,J
|
---|
14 | E N DA,D0,DUOUT,DTOUT,DIPTEDER,DIPTH,L,DY,Y,DIPTX,D,C,Q,DIPTROW,DCL,DXS,DNP,DHD,DISH,DV,DJ,DL,DK,DIL
|
---|
15 | X ^%ZOSF("EON")
|
---|
16 | I '$D(^DIPT(DIPT,0)) W !,"NO TEMPLATE SELECTED",! Q
|
---|
17 | S DIPTED="Print",DIPTEDTY=$P(^(0),U,8) I DIPTEDTY=7 S DIPTED="EXPORT FIELDS"
|
---|
18 | S DIPTED=DIPTED_" Template """_$P(^(0),U)_""""
|
---|
19 | D GET("^TMP(""DIPTED"",$J)")
|
---|
20 | S DIPTH="Editing "_DIPTED,DIPTROW=1
|
---|
21 | DDW D EDIT^DDW("^TMP(""DIPTED"",$J)","M",DIPTH,"(File "_DRK_")",DIPTROW)
|
---|
22 | K ^UTILITY($J,0),^UTILITY("DIP2",$J),I,J
|
---|
23 | I $D(DTOUT)!$D(DUOUT) K ^TMP("DIPTED",$J) W $C(7),$$EZBLD^DIALOG(8077) Q
|
---|
24 | S (DV,DNP)="",(DIL,DJ)=0,(DL,DXS)=1,DK=DRK,J(0)=DK,I(0)=^DIC(DK,0,"GL")
|
---|
25 | D PROCESS("^TMP(""DIPTED"",$J)")
|
---|
26 | X ^%ZOSF("EON")
|
---|
27 | S DIPTROW=$O(DIPTEDER(0)) I DIPTROW W " ",DIPTEDER(DIPTROW) H 2 S DIPTH="ERROR! Re-editing "_DIPTED K DIPTEDER G DDW
|
---|
28 | I '$D(^UTILITY("DIP2",$J)) W "<NOTHING TO SAVE>",$C(7) G K
|
---|
29 | I $D(DXS)>9 M ^UTILITY("DIP2",$J,U,"DXS")=DXS
|
---|
30 | M ^UTILITY("DIP2",$J,U,"DCL")=DCL
|
---|
31 | I $D(DNP) S ^UTILITY("DIP2",$J,U,"DNP")=1
|
---|
32 | I $G(DISH) S ^("SUB")=1
|
---|
33 | I $G(DHD)]"" S ^("H")=DHD
|
---|
34 | Q
|
---|
35 | ;
|
---|
36 | GET(DIPTA) ;put displayable template into @DIPTA
|
---|
37 | N DS,DIWD,D9
|
---|
38 | K @DIPTA
|
---|
39 | S (DRK,J(0))=$P(^DIPT(DIPT,0),U,4),L=0,D(L)="0FIELD",C=",",D9="",Y=2,Q="""",D0=DIPT,DHD=$G(^("H")),DISH=$D(^("SUB"))
|
---|
40 | F DS(1)=0:0 S DS(1)=$O(^DIPT(DIPT,"F",DS(1))) Q:DS(1)="" S DY=^(DS(1)) D Y^DIPT
|
---|
41 | D:D9]"" UP^DIPT
|
---|
42 | F D=2:1 Q:'$D(DS(D)) S @DIPTA@(D-1)=$J("",D>2&$G(DIWD(D))*3)_DS(D) ;indentation showing level of subfiles
|
---|
43 | Q
|
---|
44 | ;
|
---|
45 | PROCESS(DIPTA) ;puts nodes into ^UTILITY("DIP2")
|
---|
46 | N D0,DM,DQI,DA,ERR,P,S,LINE,X,DIETAB
|
---|
47 | S DIETAB=0
|
---|
48 | F LINE=1:1 Q:'$D(@DIPTA@(LINE)) K ERR S X=^(LINE) D
|
---|
49 | .I X?1"^".E S LINE=999999999 K ^UTILITY("DIP2",$J) Q
|
---|
50 | .S X=$$LINE(X) I X]"" S ^($O(^UTILITY("DIP2",$J,""),-1)+1)=X Q
|
---|
51 | .I $D(ERR) W "LINE ",LINE S DIPTEDER(LINE)=ERR,LINE=-LINE Q ;stop if we find one error
|
---|
52 | I LINE<0 W " ERROR!" Q
|
---|
53 | Q
|
---|
54 | ;
|
---|
55 | LINE(X) ;returns X as component of Template. DD number is currently 'DK'
|
---|
56 | N DIC,DICMX,DATE,Y,DICOMPX,DICOMP,DP,DJ
|
---|
57 | F P=$L(X):-1:1 Q:$A(X,P)>32 S X=$E(X,1,P-1) ;strip off trailing spaces
|
---|
58 | F P=0:1 Q:$A(X)-32 S X=$E(X,2,999) ;strip off 'P' leading spaces
|
---|
59 | I P<DIETAB,DL>1 D U ;pop Up if we find outdentation
|
---|
60 | S DIETAB=P
|
---|
61 | F S (P,S)=""
|
---|
62 | LIT I $E(X)="""",$L(X,"""")#2 F I=3:2:$L(X,"""") Q:$P(X,"""",I)]""&($E($P(X,"""",I)'=$C(95)))
|
---|
63 | I I $P($P(X,"""",I),";")="" G DJ
|
---|
64 | S DIC="^DD(DK,",DIC(0)="ZO"
|
---|
65 | DIC I X="NUMBER" S Y=0 G S
|
---|
66 | D ^DIC G GF:Y>0
|
---|
67 | I X="" D U:DL>2 Q X
|
---|
68 | STRIP I DIPTEDTY-7 D G:'$D(D) DIC S X=$RE(X) D S X=$RE(X) G:'$D(D) DIC ;from beginning, then end
|
---|
69 | .F D="+","#","*","&","!" I $E(X)=D S P=D,X=$E(X,2,999) K D Q
|
---|
70 | I X[";" G EXP:DIPTEDTY=7 S S=";"_$P(X,";",2,99)_S,X=$P(X,";") G DIC
|
---|
71 | HARD S DM=X,DQI="DIP(",DA="DXS("_DXS_C,S=S_";Z;"""_X_"""",DICOMP=DIL_$E("?",''L)_"TI",DICOMPX=""
|
---|
72 | I X'?.E1":" S DICMX="X DICMX" D EN^DICOMP G QQ:'$D(X) D FLY^DIP22 S X=S G DJ
|
---|
73 | G EXP:DIPTEDTY=7 S DICMX="S DIXX=DIXX("_DL_") D M" D ^DICOMPW
|
---|
74 | I $D(X) D S S=U_$P(DP,U,2)_U_$E(1,Y["m")_U_S,DIL(DL)=DIL,DV(DL)=DV,DL(DL)=DK,DK=+DP,DV=DV_-DP_C,DL=DL+1,DIL=+Y,Y=0,X=DV_S K P G VAL3 ;relational jump
|
---|
75 | .N Y D OVFL^DIP22,F^DIP22
|
---|
76 | QQ S ERR="" Q ""
|
---|
77 | ;
|
---|
78 | GF I $P(Y(0),U,2) D D S X=$P($P(Y(0),U,4),";"),I(DIL)=$S(+X=X:X,1:Q_X_Q),J(DIL)=DK G WORD:$P($G(^DD(DK,.01,0)),U,2)["W" Q "" ;down to a multiple
|
---|
79 | I +Y=.001 S Y=0
|
---|
80 | S S X=+Y_S
|
---|
81 | DJ S X=DV_X
|
---|
82 | VAL3 I DIPTEDTY'=7!(S'[";W"&(S'[";m")) S S="" D P Q X
|
---|
83 | EXP S ERR="NOT ALLOWED WHEN SELECTING EXPORT FIELDS" Q ""
|
---|
84 | ;
|
---|
85 | P D:$D(P) Q
|
---|
86 | .I P="" K DNP Q
|
---|
87 | .I P="*" S DCL=$G(DCL)+1
|
---|
88 | .S DCL(DK_U_+Y)=$S($T:DCL_P,1:P)
|
---|
89 | ;
|
---|
90 | D S DIL(DL)=DIL,DV(DL)=DV,DL(DL)=DK,DK=+$P(^DD(DK,+Y,0),U,2),DL=DL+1,DIL=DIL+1,DV=DV_+Y_C,Y=0 Q ;go Down a level
|
---|
91 | ;
|
---|
92 | WORD I DIPTEDTY=7 G EXP
|
---|
93 | S Y=.01 D P S X=DV_Y_S D U Q X
|
---|
94 | ;
|
---|
95 | U S DL=DL-1,DV=DV(DL),DK=DL(DL),DIL=DIL(DL) F %=DIL:0 S %=$O(I(%)) Q:%="" K I(%),J(%)
|
---|
96 | Q
|
---|
97 | ;
|
---|
98 | PUT ;save template from ^UTILITY
|
---|
99 | I '$D(^UTILITY("DIP2",$J)) Q
|
---|
100 | N DIC,DIPZ
|
---|
101 | S DIC("B")=DIPT
|
---|
102 | SAVEAS S DIC=.4,DIC("A")="Save revised "_DIPTED_" as: ",DIC(0)="AEQL",DIC("S")="I $P(^(0),U,4)=DRK,$P(^(0),U,8)=DIPTEDTY"
|
---|
103 | D ^DIC
|
---|
104 | Q:Y<0 I $O(^DIPT(+Y,0))]"" W !,$C(7),"Are you sure you want to overwrite this '",$P(Y,U,2)," 'Template" S %=1 D YN^DICN I %-1 Q:%<2 K DIC("B") G SAVEAS
|
---|
105 | L +^DIPT(+Y)
|
---|
106 | S ^DIPT("F"_J(0),$P(Y,U,2),+Y)=1
|
---|
107 | S $P(^(0),U,4)=J(0),$P(^(0),U,8)=DIPTEDTY
|
---|
108 | L -^DIPT(+Y)
|
---|
109 | D SAVEFLDS(+Y)
|
---|
110 | Q
|
---|
111 | ;
|
---|
112 | SAVEFLDS(Y) ;
|
---|
113 | N DMAX,J,X
|
---|
114 | Q:'$D(^UTILITY("DIP2",$J))!'$G(Y)
|
---|
115 | D NOW^%DTC S $P(^DIPT(Y,0),U,2)=+$J(%,0,4)
|
---|
116 | S $P(^DIPT(Y,0),U,5)=$G(DUZ)
|
---|
117 | K ^DIPT(Y,"F") S J="" D D J
|
---|
118 | .F %=1:1 Q:'$D(^UTILITY("DIP2",$J,%)) S X=^(%) I X]"" D
|
---|
119 | ..I $L(J)+$L(X)>150 D J S J=""
|
---|
120 | ..S J=J_X_$C(126)
|
---|
121 | K ^DIPT(Y,"DXS"),^("DCL"),^("DNP")
|
---|
122 | M ^DIPT(Y)=^UTILITY("DIP2",$J,U)
|
---|
123 | I $D(^DIPT(Y,"ROU")) K ^("ROU") I $D(^("IOM")) S IOM=^("IOM") K ^("IOM") I $D(^("ROUOLD")) S X=^("ROUOLD") I X]"",$G(DISYS),$D(^DD("OS",DISYS,"ZS")) S DMAX=^DD("ROU") D ENZ^DIPZ I $D(^DIPT(DIPZ,"H")) S DHD=^("H")
|
---|
124 | D K
|
---|
125 | Q
|
---|
126 | ;
|
---|
127 | J S ^($O(^DIPT(+Y,"F",""),-1)+1)=J Q
|
---|