source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDTU02.m@ 1000

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

initial load of WorldVistAEHR

File size: 3.1 KB
RevLine 
[613]1KMPDTU02 ;OAK/RAK - CP Tools Compile & File Daily Timing Stats ;2/17/04 09:43
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;;Mar 22, 2002
3 ;
4DAILY ;(KMPDST,KMPDEN);-entry point
5 ;-----------------------------------------------------------------------
6 ; KMPDST... Start date in internal fileman format.
7 ; KMPDEN... End date in internal fileman format.
8 ;
9 ; This API gathers Timing data from ^KMPTMP("KMPDT") and stores it in
10 ; file 8973.2 (CP TIMING)
11 ;
12 ;-----------------------------------------------------------------------
13 ;
14 ;Q:'$G(KMPDST)
15 ;Q:'$G(KMPDEN)
16 ; make sure end date has hours
17 ;S:'$P(KMPDEN,".",2) $P(KMPDEN,".",2)="99"
18 ;S:'$G(DT) DT=$$DT^XLFDT
19 ;
20 W:'$D(ZTQUEUED) !,"Compiling Timing data..."
21 D COMPILE
22 ;
23 Q
24 ;
25COMPILE ;-- compile & file timing data
26 ;
27 Q:$O(^KMPTMP("KMPDT",""))=""
28 N COUNT,DATA,DATA1,ID,OK,SBSCR,TODAY
29 S TODAY=$P($H,",") Q:'TODAY
30 S SBSCR="",COUNT=0
31 F S SBSCR=$O(^KMPTMP("KMPDT",SBSCR)) Q:SBSCR="" S ID="" D
32 .F S ID=$O(^KMPTMP("KMPDT",SBSCR,ID)) Q:ID="" S DATA=^(ID) D
33 ..; quit if not 'previous' to DT
34 ..Q:$P($P(DATA,U),".")'<TODAY
35 ..; set up DATA1 for filing
36 ..; identifier
37 ..S $P(DATA1,U)=ID
38 ..; server start date/time in internal fileman format
39 ..S $P(DATA1,U,3)=$$HTFM^XLFDT($P(DATA,U))
40 ..; server delta
41 ..S:$P(DATA,U,2) $P(DATA1,U,4)=$$HDIFF^XLFDT($P(DATA,U,2),$P(DATA,U),2)
42 ..; person
43 ..S $P(DATA1,U,5)=$P(DATA,U,3)
44 ..; client name
45 ..S $P(DATA1,U,6)=$P(DATA,U,4)
46 ..; kmptmp subscript
47 ..S $P(DATA1,U,7)=SBSCR
48 ..; title
49 ..S $P(DATA1,U,8)=$$TITLEG(SBSCR)
50 ..; ip address
51 ..S $P(DATA1,U,9)=$P($P(ID,"-")," ",2)
52 ..; file data
53 ..D FILE(DATA1,.OK)
54 ..; update counter if successfully filed
55 ..S:OK COUNT=COUNT+1
56 ..; kill of old node if successfully filed
57 ..K:OK ^KMPTMP("KMPDT",SBSCR,ID)
58 ..I '$D(ZTQUEUED) W:'(COUNT#100) "."
59 ;
60 W:'$D(ZTQUEUED) !,COUNT," records filed!"
61 ;
62 Q
63 ;
64FILE(DATA,KMPDOK) ;-- file timing data into file #8973.2
65 ;-----------------------------------------------------------------------
66 ; DATA.... Data to file in format:
67 ; piece "^" 1 - id
68 ; 3 - start date/time in internal fileman format
69 ; 4 - delta
70 ; 5 - new person
71 ; 6 - client name
72 ; 7 - kmptmp subscript
73 ; 8 - title
74 ; 9 - ip address
75 ;
76 ; KMPDOK.. Returned
77 ; 0 - not filed successfully
78 ; 1 - filed successfully
79 ;-----------------------------------------------------------------------
80 ;
81 S KMPDOK=0
82 Q:$G(DATA)=""
83 ; id
84 Q:$P(DATA,U)=""
85 ; start date/time
86 Q:$P(DATA,U,3)=""
87 ;
88 N ERROR,FDA,I,IEN,ZIEN
89 ; build fda() array for filing
90 F I=1:1:9 I $P(DATA,U,I)'="" D
91 .S FDA($J,8973.2,"+1,",(I*.01))=$P(DATA,U,I)
92 ; quit if no fda() array
93 Q:'$D(FDA($J))
94 ; file data
95 D UPDATE^DIE("","FDA($J)","ZIEN","ERROR")
96 ; if error
97 I $D(ERROR) D MSG^DIALOG("HA",.ERROR,60,5,"ERROR") Q
98 S KMPDOK=1
99 ;
100 Q
101 ;
102TITLEG(SBSCR) ;-- extrinsic function - return title name
103 Q:$G(SBSCR)="" ""
104 N I,TITLE,X S TITLE=""
105 F I=1:1 S X=$T(TITLE+I) Q:X="" I $P(X,";",3)=SBSCR S TITLE=$P(X,";",4) Q
106 Q TITLE
107 ;
108TITLE ;-- convert subscript to title
109 ;;ORWCV;CPRS Cover Sheet
Note: See TracBrowser for help on using the repository browser.