1 | RGUTDAT ;CAIRO/DKM - Date range input;12-Oct-1998 12:01;DKM
|
---|
2 | ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
|
---|
3 | ;=================================================================
|
---|
4 | ; Prompt for date range (normal format)
|
---|
5 | NORMAL D D1("P1"),D2("P2")
|
---|
6 | Q
|
---|
7 | ; Prompt for date range (inverse format)
|
---|
8 | INVRSE D D1("PI1"),D2("PI2")
|
---|
9 | Q
|
---|
10 | ; Prompt for starting date
|
---|
11 | D1(RGOPT) ;
|
---|
12 | S RGDAT1=$$ENTRY("Start date: ",.RGOPT,"",0,$Y)
|
---|
13 | Q
|
---|
14 | ; Prompt for ending date
|
---|
15 | D2(RGOPT) ;
|
---|
16 | S RGDAT2=$$ENTRY("End date : ",.RGOPT,"",0,$Y+1)
|
---|
17 | Q
|
---|
18 | ; Prompt for a date
|
---|
19 | ENTRY(%RGP,%RGOPT,%RGDAT,%RGX,%RGY,%RGTRP,%RGHLP) ;
|
---|
20 | N %RGD,%RGI,%RGDT,%RGZ,%RGDISV
|
---|
21 | S %RGX=$G(%RGX,$X),%RGY=$G(%RGY,$Y),DUZ=+$G(DUZ),IO=$G(IO,$I),DTIME=$G(DTIME,999999999),%RGOPT=$$UP^XLFSTR($G(%RGOPT)),%RGDISV=""
|
---|
22 | S %RGTRP=$G(%RGTRP),%RGDAT=$G(%RGDAT)
|
---|
23 | S:$G(%RGHLP)="" %RGHLP="HELP^RGUTDAT"
|
---|
24 | S:$G(%RGP)="" %RGP="Enter date: "
|
---|
25 | F %RGZ=0:1:9 I %RGOPT[%RGZ S %RGDISV="RGDAT"_%RGZ Q
|
---|
26 | U IO
|
---|
27 | DAT1 S %RGDT="",@$$TRAP^RGZOSF("DAT1^RGUTDAT")
|
---|
28 | F %RGZ="P","T","F","X" S:%RGOPT[%RGZ %RGDT=%RGDT_%RGZ
|
---|
29 | F D Q:$D(%RGI)
|
---|
30 | .W $$XY^RGUT(%RGX,%RGY)_%RGP,*27,"[J"
|
---|
31 | .S $X=%RGX+$L(%RGP)
|
---|
32 | .I %RGOPT["E" S %RGI=$$ENTRY^RGUTEDT(%RGDAT,79-$X,$X,$Y,"","R")
|
---|
33 | .E I %RGDAT'="" S %RGI=%RGDAT,%RGDAT=""
|
---|
34 | .E R %RGI:DTIME
|
---|
35 | .I $E(%RGI)="?" D Q
|
---|
36 | ..W !
|
---|
37 | ..I %RGI["??" D HELP
|
---|
38 | ..E D @%RGHLP
|
---|
39 | ..D PAUSE()
|
---|
40 | ..K %RGI
|
---|
41 | .I %RGI=" " S %RGI=$S(%RGDISV="":"",1:$G(^DISV(DUZ,%RGDISV))) K:%RGI="" RGZ1
|
---|
42 | .W $$XY^RGUT(%RGX+$L(%RGP),%RGY),*27,"[K"
|
---|
43 | I %RGI="",%RGTRP'="" S %RGI=$G(@%RGTRP@(" "))
|
---|
44 | S %RGI=$$UP^XLFSTR(%RGI),%RGD=""
|
---|
45 | Q:"^^"[%RGI -$L(%RGI)
|
---|
46 | I %RGTRP'="" D I %RGD'="" S %RGOPT=$TR(%RGOPT,"I") G DAT2
|
---|
47 | .I $D(@%RGTRP@(%RGI)) S %RGD=@%RGTRP@(%RGI)
|
---|
48 | .E D
|
---|
49 | ..N X
|
---|
50 | ..S X=%RGI,%RGZ=""
|
---|
51 | ..F S %RGZ=$O(@%RGTRP@("?",%RGZ)) Q:%RGZ="" I %RGI?@%RGZ D Q
|
---|
52 | ...S %RGD=$$MSG^RGUT($G(@%RGTRP@("?",%RGZ)))
|
---|
53 | S %RGI=$$%DT^RGUT(%RGI,%RGDT)
|
---|
54 | G:%RGI=-1 DAT1
|
---|
55 | I %RGOPT["+",%RGI<$S(%RGI=%RGI\1:$$DT^XLFDT,1:$$NOW^XLFDT) D G DAT1
|
---|
56 | .D PAUSE("Must be on or after current date.")
|
---|
57 | I %RGOPT["-",%RGI>$S(%RGI=%RGI\1:$$DT^XLFDT,1:$$NOW^XLFDT) D G DAT1
|
---|
58 | .D PAUSE("Must be on or before current date.")
|
---|
59 | S %RGD=$$^RGCVTDT(%RGI)
|
---|
60 | DAT2 W %RGD
|
---|
61 | S:%RGDISV'="" ^DISV(DUZ,%RGDISV)=%RGI
|
---|
62 | Q $S(%RGOPT["I":9999999-%RGI,1:%RGI)
|
---|
63 | HELP W ?2,"Enter a valid ",$S(%RGOPT["+":"future ",%RGOPT["-":"past ",1:""),"date using one of the following formats:",!!
|
---|
64 | W ?5,"Format",?20,"Example",?35,"Explanation",?60,"Comments",!
|
---|
65 | W ?5,"------",?20,"-------",?35,"-----------",?60,"--------",!
|
---|
66 | W ?5,"mm/dd/yy",?20,"6/20/93",?35,"June 20, 1993",?60,"If you omit the",!
|
---|
67 | W ?5,"dd-mmm-yy",?20,"27-JUL-58",?35,"July 27, 1958",?60,"year, the "_$S(%RGOPT["P":"most",%RGOPT["F":"closest",1:"current"),!
|
---|
68 | W ?5,"mmddyy",?20,"070457",?35,"July 4, 1957",?60,$S(%RGOPT["P":"recent past date",%RGOPT["F":"future date",1:"calendar year"),!
|
---|
69 | W ?5,"mmm dd yyyy",?20,"JAN 5, 1984",?35,"January 5, 1984",?60,"is assumed.",!
|
---|
70 | W ?5,"T-n",?20,"T-5",?35,"Today's date - 5 days.",!!
|
---|
71 | Q
|
---|
72 | PAUSE(%RGZ) ;
|
---|
73 | W $$XY^RGUT(0,22),$G(%RGZ)
|
---|
74 | I $$PAUSE^RGUT
|
---|
75 | Q
|
---|