source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDUTL8.m@ 1006

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

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1KMPDUTL8 ;OAK/RAK - CM Tools Utility ;2/17/04 10:52
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**2**;Mar 22, 2002
3 ;
4ADD(KMPDNAME,KMPDARRY,KMPDIEN) ;-- add new entry to file #8972.1
5 ;-----------------------------------------------------------------------
6 ; KMPDNAME... Field #.01 (free text).
7 ; KMPDARRY(). Array containing data to file in format (passed by value):
8 ; KMPDARRY(FieldNumber)=InternalEntryValue.
9 ; Example: KMPDARRY(.02)=2990719.1001
10 ; KMPDARRY(.03)=12345
11 ; KMPDARRY(.04)="1290"
12 ; KMPDARRY(...)="..."
13 ; KMPDARRY(10,1,0)="This contains word"
14 ; KMPDARRY(10,2,0)="processing text for the"
15 ; KMPDARRY(10,3,0)="COMMENTS field."
16 ; KMPDIEN... New ien for entry (if not successful KMPDIEN will be null).
17 ;-----------------------------------------------------------------------
18 ;
19 Q:$G(KMPDNAME)=""
20 ; convert disallowed characters.
21 S KMPDNAME=$$CONVERT^KMPDUTL7(KMPDNAME)
22 Q:KMPDNAME=""
23 ;
24 N FDA,I,MESSAGE,ZIEN
25 ; name.
26 S FDA($J,8972.1,"+1,",.01)=KMPDNAME
27 ; additional fields.
28 F I=.02:.01:.09 I $G(@KMPDARRY@(I))'="" D
29 .S FDA($J,8972.1,"+1,",I)=@KMPDARRY@(I)
30 ; 'comments' word-processing field.
31 S:$O(@KMPDARRY@(10,0)) FDA($J,8972.1,"+1,",10)=KMPDARRY_"(10)"
32 ;
33 ; update file 8971.1.
34 D UPDATE^DIE("","FDA($J)","ZIEN","MESSAGE")
35 S KMPDIEN=$G(ZIEN(1)) Q:'KMPDIEN
36 ; if error message.
37 I $D(MESSAGE) D MSG^DIALOG("W","",60,10,"MESSAGE")
38 ;
39 Q
40 ;
41EDIT(KMPDIEN,KMPDARRY) ;-- edit entry in file #8972.1
42 ;-----------------------------------------------------------------------
43 ; KMPDIEN... Ien for file #8972.1 (CM CODE EVALUATOR)
44 ; KMPDARRY(). Array containing data to file in format (passed by value):
45 ; KMPDARRY(FieldNumber)=InternalEntryValue.
46 ; Example: KMPDARRY(.02)=2990719.1001
47 ; KMPDARRY(.03)=12345
48 ; KMPDARRY(.04)="1290"
49 ; KMPDARRY(...)="..."
50 ; KMPDARRY(10,1,0)="This contains word"
51 ; KMPDARRY(10,2,0)="processing text for the"
52 ; KMPDARRY(10,3,0)="COMMENTS field."
53 ;-----------------------------------------------------------------------
54 ;
55 Q:'$G(KMPDIEN)
56 Q:'$D(^KMPD(8972.1,+KMPDIEN,0))#5
57 Q:$G(KMPDARRY)=""
58 ;
59 N DATA,FDA,I,MESSAGE,ZIEN
60 ;
61 ; data already stored for this entry
62 S DATA(0)=$G(^KMPD(8972.1,+KMPDIEN,0))
63 ;
64 ; date/time last edited
65 S FDA($J,8972.1,KMPDIEN_",",2.01)=$$NOW^XLFDT
66 ;
67 ; last edited by
68 S:$G(DUZ) FDA($J,8972.1,KMPDIEN_",",2.02)=DUZ
69 ;
70 ; add data elements to current data
71 F I=.04:.01:.09 D
72 .S FDA($J,8972.1,KMPDIEN_",",I)=@KMPDARRY@(I)+$P(DATA(0),U,(I*100))
73 .; make sure not negative number
74 .S FDA($J,8972.1,KMPDIEN_",",I)=$$NUMBER^KMPDUTL7(FDA($J,8972.1,KMPDIEN_",",I))
75 .; if number has grown to 15 characters or more then make this code
76 .; evaluator inactive
77 .S:$L(FDA($J,8972.1,KMPDIEN_",",I))>14 FDA($J,8971.1,KMPDIEN_",",.11)=0
78 ;
79 ; increment count
80 S FDA($J,8972.1,KMPDIEN_",",.1)=$P(DATA(0),U,10)+1
81 ;
82 ; 'comments' word-processing field.
83 S:$O(@KMPDARRY@(10,0)) FDA($J,8972.1,KMPDIEN_",",10)=KMPDARRY_"(10)"
84 ;
85 ; update file 8971.1.
86 D UPDATE^DIE("","FDA($J)","ZIEN","MESSAGE")
87 ;
88 S KMPDIEN=$G(ZIEN(1)) Q:'KMPDIEN
89 ;
90 ; if error message.
91 I $D(MESSAGE) D MSG^DIALOG("W","",60,10,"MESSAGE")
92 ;
93 Q
94 ;
95ID(KMPDIEN) ;-- display fields during lookup
96 ;-----------------------------------------------------------------------
97 ; KMPDIEN.... Ien for file #8972.1.
98 ;-----------------------------------------------------------------------
99 ;
100 Q:'$D(^KMPD(8972.1,+$G(KMPDIEN),0))
101 ;
102 N DATA,TXT
103 S DATA=$G(^KMPD(8972.1,+KMPDIEN,0))
104 S TXT(1)=$$FMTE^DILIBF($P(DATA,U,2),6)
105 S TXT(1)=TXT(1)_" "_$$GET1^DIQ(8972.1,KMPDIEN,.03)
106 S TXT(1,"F")="?35"
107 S TXT(2)="cpu tm="_$P(DATA,U,4)_" dio ref="_$P(DATA,U,5)_" "
108 S TXT(2)=TXT(2)_"bio ref="_$P(DATA,U,6)_" page flts="_$P(DATA,U,7)_" "
109 S TXT(2)=TXT(2)_"m com="_$P(DATA,U,8)_" global ref="_$P(DATA,U,9)
110 S TXT(2,"F")="!?5",TXT(3)="",TXT(3,"F")="!"
111 D EN^DDIOL(.TXT)
112 ;
113 Q
114 ;
115ELEDATA(KMPDIEN) ;-- extrinsic function - if element data
116 ;-----------------------------------------------------------------------
117 ; KMPDIEN... Ien for file #8972.1 (CM CODE EVALUATOR)
118 ;
119 ; Return: 0 - element data is NOT present
120 ; 1 - element data is present
121 ;-----------------------------------------------------------------------
122 ;
123 Q:'$G(KMPDIEN) 0
124 Q:'$D(^KMPD(8972.1,+KMPDIEN,0))#5 0
125 ;
126 N DATA,I,RETURN
127 S DATA(0)=$G(^KMPD(8972.1,+KMPDIEN,0))
128 S RETURN=1
129 F I=4,5,6,8,9 I $P(DATA(0),U,I)']"" S RETURN=0 Q
130 Q RETURN
Note: See TracBrowser for help on using the repository browser.