source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDD43.m@ 995

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

initial load of FOIAVistA 6/30/08 version

File size: 6.2 KB
Line 
1ORDD43 ; SLC/MKB - Build xrefs for file 101.43 ;7/2/97 10:52
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**26,68,94,164,190**;Dec 17, 1997
3 ;
4SET(X,IFN) ; Create new entry X in SET multiple
5 N DIC,DA,Y Q:$D(^ORD(101.43,IFN,9,"B",X)) ; already exists
6 S DIC="^ORD(101.43,"_IFN_",9,",DIC(0)="L",DA(1)=IFN
7 S DIC("P")=$P(^DD(101.43,9,0),U,2) K DD,DO
8 S ^ORD(101.43,"AH",X)=$H
9 S ^ORD(101.43,"AH","S."_X)=$H
10 D FILE^DICN
11 Q
12 ;
13KILL(X,IFN) ; Remove entry X from SET multiple
14 N DIK,DA
15 S DIK="^ORD(101.43,"_IFN_",9,",DA(1)=IFN
16 S ^ORD(101.43,"AH",X)=$H
17 S DA=$O(^ORD(101.43,IFN,9,"B",X,0)) I DA D ^DIK
18 Q
19 ;
20SETRA(NAME,ITYPE,CPROC) ; Set COMMON xref
21 Q:'CPROC Q:'$L(ITYPE) ; not common, no IType
22 S ^ORD(101.43,"COMMON",ITYPE,NAME,DA)=""
23 Q
24 ;
25KILLRA(NAME,ITYPE,CPROC) ; Kill COMMON xref
26 Q:'CPROC Q:'$L(ITYPE) ; not common, no IType
27 K ^ORD(101.43,"COMMON",ITYPE,NAME,DA)
28 Q
29 ;
30SS(NAME,DATE,LABTYP) ; -- Set S.SET xref by Name, Set multiple
31 Q:'$L($G(NAME)) I ($G(LABTYP)="O")!($G(LABTYP)="N") D SK(NAME) Q
32 N SET,SET0,SETNM,SETLST,QO
33 S SET=0 F S SET=$O(^ORD(101.43,DA,9,SET)) Q:SET'>0 S SET0=$G(^(SET,0)) D
34 . S SETNM=$P(SET0,U),QO=$P(SET0,U,2)
35 . S ^ORD(101.43,"S."_SETNM,$$UP^XLFSTR(NAME),DA)=U_NAME_U_$G(DATE)_U_U_QO
36 . S ^ORD(101.43,"AH","S."_SETNM)=$H,SETLST("S."_SETNM)=""
37 I $G(DATE),(DATE>$$NOW^XLFDT) D
38 . N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTSK
39 . S ZTRTN="DQAH^ORDD43",ZTDESC="CPRS AH Update",ZTDTH=DATE,ZTIO=""
40 . S ZTSAVE("SETLST(")="" D ^%ZTLOAD
41 Q
42DQAH ; -- set new timestamps for sets where items are becoming inactive
43 S ZTREQ="@"
44 N X
45 S X="" F S X=$O(SETLST(X)) Q:X="" S ^ORD(101.43,"AH",X)=$H
46 Q
47 ;
48SK(NAME) ; -- Kill S.SET xref by Name, Set multiple
49 Q:'$L($G(NAME)) N SET,SETNM
50 S SET=0 F S SET=$O(^ORD(101.43,DA,9,SET)) Q:SET'>0 S SETNM=$P(^(SET,0),U) D
51 . K ^ORD(101.43,"S."_SETNM,$$UP^XLFSTR(NAME),DA)
52 . S ^ORD(101.43,"AH","S."_SETNM)=$H
53 Q
54 ;
55SS1(NAME,DATE,LABTYP) ; -- Set S.SET mnemonic xref by Synonym, Name, Set
56 Q:'$L($G(NAME)) I ($G(LABTYP)="O")!($G(LABTYP)="N") D SK1(NAME) Q
57 N SYN,SYNM,SET,SET0,SETNM,QO
58 S SET=0 F S SET=$O(^ORD(101.43,DA,9,SET)) Q:SET'>0 S SET0=$G(^(SET,0)) D
59 . S SETNM=$P(SET0,U),QO=$P(SET0,U,2)
60 . S SYN=0 F S SYN=$O(^ORD(101.43,DA,2,SYN)) Q:SYN'>0 S SYNM=$P(^(SYN,0),U) D
61 . . S:SYNM'=NAME ^ORD(101.43,"S."_SETNM,$$UP^XLFSTR(SYNM),DA)="1^"_SYNM_U_$G(DATE)_U_NAME_U_QO
62 . . S ^ORD(101.43,"AH","S."_SETNM)=$H
63 Q
64 ;
65SK1(NAME) ; -- Kill S.SET mnemonic xref by Synonym, Name, Set
66 N SYN,SYNM,SET,SETNM
67 S SET=0 F S SET=$O(^ORD(101.43,DA,9,SET)) Q:SET'>0 S SETNM=$P(^(SET,0),U) D
68 . S SYN=0 F S SYN=$O(^ORD(101.43,DA,2,SYN)) Q:SYN'>0 S SYNM=$P(^(SYN,0),U) D
69 . . I $G(^ORD(101.43,"S."_SETNM,$$UP^XLFSTR(SYNM),DA)) K ^(DA)
70 . . S ^ORD(101.43,"AH","S."_SETNM)=$H
71 Q
72 ;
73SS2 ; -- Set S.SET mnemonic xref from SET multiple
74 N TYP,NAME,DATE,SYN,SYNM,I,QO
75 S TYP=$P($G(^ORD(101.43,DA(1),"LR")),U,7) I (TYP="O")!(TYP="N") D SK2 Q
76 S I=+$O(^ORD(101.43,DA(1),9,"B",X,0))
77 S QO=$P($G(^ORD(101.43,DA(1),9,I,0)),U,2)
78 S SYN=0,NAME=$P(^ORD(101.43,DA(1),0),U),DATE=$G(^(.1))
79 F S SYN=$O(^ORD(101.43,DA(1),2,SYN)) Q:SYN'>0 S SYNM=$P(^(SYN,0),U) D
80 . S:SYNM'=NAME ^ORD(101.43,"S."_X,$$UP^XLFSTR(SYNM),DA(1))="1^"_SYNM_U_DATE_U_NAME_U_QO
81 . S ^ORD(101.43,"AH","S."_X)=$H
82 Q
83 ;
84SK2 ; -- Kill S.SET mnemonic xref from SET multiple
85 N SYN,SYNM
86 S SYN=0 F S SYN=$O(^ORD(101.43,DA(1),2,SYN)) Q:SYN'>0 S SYNM=$P(^(SYN,0),U) D
87 . I $G(^ORD(101.43,"S."_X,$$UP^XLFSTR(SYNM),DA(1))) K ^(DA(1))
88 . S ^ORD(101.43,"AH","S."_X)=$H
89 Q
90 ;
91SS3 ; -- Set S.SET mnemonic xref from SYN multiple
92 N TYP,NAME,DATE,SET,SET0,SETNM,QO
93 S TYP=$P($G(^ORD(101.43,DA(1),"LR")),U,7) I (TYP="O")!(TYP="N") D SK3 Q
94 S NAME=$P(^ORD(101.43,DA(1),0),U),DATE=$G(^(.1)),SET=0 Q:X=NAME
95 F S SET=$O(^ORD(101.43,DA(1),9,SET)) Q:SET'>0 S SET0=$G(^(SET,0)) D
96 . S SETNM=$P(SET0,U),QO=$P(SET0,U,2)
97 . S ^ORD(101.43,"S."_SETNM,$$UP^XLFSTR(X),DA(1))="1^"_X_U_DATE_U_NAME_U_QO
98 . S ^ORD(101.43,"AH","S."_SETNM)=$H
99 Q
100 ;
101SK3 ; -- Kill S.SET mnemonic xref from SYN multiple
102 N SET,SETNM
103 S SET=0 F S SET=$O(^ORD(101.43,DA(1),9,SET)) Q:SET'>0 S SETNM=$P(^(SET,0),U) D
104 . I $G(^ORD(101.43,"S."_SETNM,$$UP^XLFSTR(X),DA(1))) K ^(DA(1))
105 . S ^ORD(101.43,"AH","S."_SETNM)=$H
106 Q
107 ;
108CS(NAME,CODE,DATE) ; -- Set C.SET xref by 'Code Name', Set
109 Q:'$L($G(NAME)) Q:'$L($G(CODE))
110 N X,XP,ORS,SET0,SETNM,QO
111 S X=CODE_" "_NAME,XP=$$UP^XLFSTR(X)
112 S ORS=0 F S ORS=$O(^ORD(101.43,DA,9,ORS)) Q:ORS'>0 S SET0=$G(^(ORS,0)) D
113 . S SETNM=$P(SET0,U),QO=$P(SET0,U,2)
114 . S ^ORD(101.43,"C."_SETNM,XP,DA)=U_X_U_$G(DATE)_U_U_QO
115 Q
116 ;
117CK(NAME,CODE) ; -- Kill C.SET xref
118 Q:'$L($G(NAME)) Q:'$L($G(CODE))
119 N XP,ORS,ORSET S XP=$$UP^XLFSTR(CODE_" "_NAME)
120 S ORS=0 F S ORS=$O(^ORD(101.43,DA,9,ORS)) Q:ORS'>0 S ORSET=$P(^(ORS,0),U) K ^ORD(101.43,"C."_ORSET,XP,DA)
121 Q
122 ;
123QO(X) ; -- Add data to SET xrefs, set/kill AQO xref
124 N NAME,XREF,SYN,SYNM S X=$G(X)
125 S NAME=$$UP^XLFSTR($P($G(^ORD(101.43,DA(1),0)),U)),XREF="S."_$P($G(^(9,DA,0)),U)
126 S:X ^ORD(101.43,DA(1),9,"AQO",XREF)=""
127 K:'X ^ORD(101.43,DA(1),9,"AQO",XREF)
128 Q:'$D(^ORD(101.43,XREF,NAME,DA(1))) S $P(^(DA(1)),U,5)=X
129 S SYN=0 F S SYN=+$O(^ORD(101.43,DA(1),2,SYN)) Q:SYN<1 S SYNM=$P($G(^(SYN,0)),U),$P(^ORD(101.43,XREF,$$UP^XLFSTR(SYNM),DA(1)),U,5)=X
130 S ^ORD(101.43,"AH",XREF)=$H
131 Q
132 ;
133XHELP(INDEX,SCREEN) ; -- ??Help
134 N X,Y,Y0,Z,SYN,CNT,D,DONE
135 S:'$L($G(INDEX)) INDEX="B" W !!,"Choose from:" S CNT=1,D=INDEX
136 S X="" F S X=$O(^ORD(101.43,INDEX,X)) Q:X="" S Y=0 D Q:$G(DONE)
137 . F S Y=$O(^ORD(101.43,INDEX,X,Y)) Q:Y'>0 S SYN=$G(^(Y)) I 'SYN D Q:$G(DONE)
138 . . S Y0=$G(^ORD(101.43,Y,0)) X:$L($G(SCREEN)) SCREEN Q:'$T
139 . . W !," "_X ;W:SYN " "_$P(SYN,U,4) ; echo .01 if synonym
140 . . S CNT=CNT+1 Q:CNT'>(IOSL-5) S CNT=0
141 . . W !," '^' TO STOP: " R Z:DTIME S:'$T!(Z["^") DONE=1
142 W !
143 Q
144 ;
145ACTIVE(ITM) ; -- Screen, if inactive or restricted to QO use only
146 ; Use in DIC("S") when searching #101.43
147 N Y S Y=1
148 I $G(ORTYPE)="D",$L($G(D)),$D(^ORD(101.43,+ITM,9,"AQO",$P(D,U))) S Y=0
149 I $G(^ORD(101.43,+ITM,.1)),^(.1)'>$$NOW^XLFDT S Y=0 ;inactive
150 Q Y
151 ;
152ID(OLD,NEW) ; -- API for package to update ID field [ code;99XXX ]
153 ; Returns 1 or 0, if successful or not
154 N IFN,Y S Y=0
155 G:'$G(OLD) IDQ G:$G(NEW)'?1.N1";99"3U IDQ ;invalid
156 S IFN=+$O(^ORD(101.43,"ID",OLD,0)) G:IFN'>0 IDQ
157 K ^ORD(101.43,"ID",OLD,IFN)
158 S $P(^ORD(101.43,IFN,0),U,2)=NEW,^ORD(101.43,"ID",NEW,IFN)="",Y=1
159IDQ Q Y
Note: See TracBrowser for help on using the repository browser.