source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDTU11.m@ 1240

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

initial load of WorldVistAEHR

File size: 2.7 KB
Line 
1KMPDTU11 ;OAK/RAK - CP Tools Timing Utility ;5/1/07 15:07
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**6**;Mar 22, 2002;Build 3
3 ;
4RLTMHR(KMPDQIET,KMPDASK,KMPDEF) ;-- extrinsic function - real time hours
5 ;-----------------------------------------------------------------------
6 ; KMPDQIET... Display output
7 ; 0 - display output (not quiet)
8 ; 1 - do not display output (quiet)
9 ; KMPDASK.... Ask user to select hours
10 ; 0 - do not ask user to select
11 ; 1 - ask user to select
12 ; KMPDEF..... Default
13 ; 0 - do not use default
14 ; 1 - use time range as default
15 ;
16 ; Return: List of hours (ie, 1,2,5,6,7...)
17 ; "" - no selection made
18 ;-----------------------------------------------------------------------
19 ;
20 S KMPDQIET=+$G(KMPDQIET),KMPDASK=+$G(KMPDASK),KMPDEF=+$G(KMPDEF)
21 N DATA,DIR,DOT,HOURS,HR,I,QUEUED,X,Y
22 W:'KMPDQIET !," ==> building Hours list..."
23 S I="",DOT=0
24 F S I=$O(^KMPTMP("KMPDT","ORWCV",I)) Q:I="" S DATA=^(I) I DATA]"" D
25 .S DOT=DOT+1 W:'(DOT#1000)&('KMPDQIET) "."
26 .; change $h to fileman format and get hour
27 .S HR=$E($P($$HTFM^XLFDT($P(DATA,U)),".",2),1,2) S:HR>23 HR="0"
28 .; create HOURS() array
29 .S:HR'="" HOURS(+HR)=""
30 ;
31 ; if no HOURS() array
32 Q:'$D(HOURS) ""
33 ;
34 ; do not ask user to select hours
35 I 'KMPDASK D Q X
36 .S (I,X)="" F S I=$O(HOURS(I)) Q:I="" S X=X_I_","
37 ;
38 ; ask user to select hour(s)
39 S DIR(0)="LO^"_$O(HOURS(""))_":"_$O(HOURS("A"),-1)
40 S DIR("A")="Select Hour(s)"
41 S:KMPDEF DIR("B")=$O(HOURS(""))_"-"_$O(HOURS("A"),-1)
42 W ! D ^DIR
43 Q $S(Y=""!(Y="^"):"",1:$G(Y(0)))
44 ;
45TIMING(KMPDSS,KMPDNODE,KMPDST,KMPDHTM,KMPDUZ,KMPDCL) ;-- start/stop timing stats
46 ;--------------------------------------------------------------------
47 ; KMPDSS... subscript (free text)
48 ; KMPDNODE. node name (free text)
49 ; KMPDST... start/stop
50 ; 1 - start
51 ; 2 - stop
52 ; KMPDHTM.. (optional - if not defined the current $h will be used)
53 ; time in $h format
54 ; KMPDUZ... (optional -if not defined the current duz will be used)
55 ; user duz
56 ; KMPDCL... (optional - if not defined the current IO("CLNM")) will be used)
57 ; client name (free text)
58 ;
59 ;--------------------------------------------------------------------
60 ; quit if timing stats not turned on
61 Q:'$G(^KMPTMP("KMPD-CPRS"))
62 ; quit if no subscript
63 Q:$G(KMPDSS)=""
64 ; quit if no node
65 Q:$G(KMPDNODE)=""
66 ; start/stop
67 S KMPDST=+$G(KMPDST)
68 Q:KMPDST<1!(KMPDST>2)
69 S:'$G(KMPDHTM) KMPDHTM=$H
70 S:'$G(KMPDUZ) KMPDUZ=$G(DUZ)
71 S:$G(KMPDCL)="" KMPDCL=$G(IO("CLNM"))
72 ;
73 ; start timing
74 S:KMPDST=1 ^KMPTMP("KMPDT",KMPDSS,KMPDNODE)=KMPDHTM_"^^"_KMPDUZ_"^"_KMPDCL
75 ; stop timing
76 S:KMPDST=2 $P(^KMPTMP("KMPDT",KMPDSS,KMPDNODE),"^",2)=KMPDHTM
77 ;
78 Q
Note: See TracBrowser for help on using the repository browser.