source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDUL1.m@ 1579

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1SDUL1 ;ALB/MJK - Screen Malipulation Utilities ; 12/1/91
2 ;;5.3;Scheduling;**140**;Aug 13, 1993
3 ;
4INSTR(STR,X,Y,LENGTH,ERASE) ; -- insert text
5 ; STR := string to insert
6 ; X := X coordinate
7 ; Y := Y coordinate
8 ; LENGTH := clear # of characters
9 ; ERASE := erase chars first
10 ;
11 W IOSC
12 I $G(ERASE) S DY=Y-1,DX=X-1 X IOXY W $J("",LENGTH)
13 S DY=Y-1,DX=X-1 X IOXY W STR
14 W IORC
15 Q
16 ;
17FLDUPD(STR,FLD,ENTRY) ; -- update entry and field on screen
18 ; STR := string to insert
19 ; FLD := col name
20 ; ENTRY := entry # in list
21 ;
22 D INSTR(.STR,+$P(SDULDDF(FLD),U,2),ENTRY-SDULBG+SDUL("TM"),$P(SDULDDF(FLD),U,3),1)
23 Q
24 ;
25SETFLD(STR,VAR,FLD) ; -- set field in var
26 ; input: STR := string to insert
27 ; VAR := destination string
28 ; FLD := col name
29 Q $$SETSTR^SDUL1(STR,VAR,+$P(SDULDDF(FLD),U,2),+$P(SDULDDF(FLD),U,3))
30 ;
31SETSTR(S,V,X,L) ; -- insert text(S) into variable(V)
32 ; S := string to insert
33 ; V := destination string
34 ; X := insert @ col X
35 ; L := clear # of chars (length)
36 ;
37 Q $E(V_$J("",X-1),1,X-1)_$E(S_$J("",L),1,L)_$E(V,X+L,999)
38 ;
39FULL ; set full scrolling region
40 I '$D(IOSTBM) D TERM^SDUL0
41 I IOSTBM]"" S IOTM=1,IOBM=IOSL W IOSC W @IOSTBM W IORC
42 Q
43 ;
44CLEAR ; -- clear screen
45 D FULL,ERASE W @IOF
46 Q
47 ;
48ERASE ;
49 F X="IOUOFF","IOINORM" W $G(@X)
50 Q
51 ;
52FDATE(Y) ; -- return formatted date
53 ; input: Y := field name
54 ; output: [returned] := formatted date only
55 Q $TR($$FMTE^XLFDT(Y,"5DF")," ","0")
56 ;
57FTIME(Y) ; -- return formatted date/time
58 ; input: Y := internal date/time
59 ; output: [returned] := formatted date and time
60 D DD^%DT
61 Q Y
62 ;
63FDTTM(Y) ; -- return formatted date/time
64 ; input: Y := internal date/time
65 ; output: [returned] := formatted date and time
66 N SDY
67 S SDY=$TR($$FMTE^XLFDT(Y,"5DF")," ","0")
68 D DD^%DT
69 Q SDY_$S($P(Y,"@",2)]"":"@"_$P(Y,"@",2),1:"")
70 ;
71NOW() ; -- return now
72 D NOW^%DTC
73 Q $$FTIME(%)
74 ;
75RANGE ; -- change date range
76 ; input: ^TMP("SDUL DATA",$J SDULEVL,"DAYS") := number of days allowed
77 ; SDB := default beginning date {optional}
78 ;
79 I $D(SDB) S Y=SDB D DD^%DT S:Y]"" %DT("B")=Y
80 W ! S:$D(SDMIN) %DT(0)=SDMIN S %DT="AEX",%DT("A")="Select Beginning Date: " D ^%DT K %DT
81 G RANGEQ:Y<0 S (X1,SDX)=Y,X2=+$G(^TMP("SDUL DATA",$J,SDULEVL,"DAYS")) D C^%DTC S SDX1=X,X=""
82 I SDX'>DT,SDX1>DT S X="TODAY"
83 I X="" S Y=SDX D DD^%DT S X=Y
84 S DIR("B")=X
85 S DIR(0)="DA"_U_SDX_":"_SDX1_":EX",DIR("A")="Select Ending Date: "
86 S DIR("?",1)="Date range can be a maximum of "_+$G(^TMP("SDUL DATA",$J,SDULEVL,"DAYS"))_" days long.",DIR("?",2)=" "
87 S DIR("?",3)="Enter a date between "_$$FDATE(SDX)_" and "_$$FDATE(SDX1)_".",DIR("?")=" "
88 D ^DIR K DIR G RANGEQ:Y'>0 S SDEND=Y,SDBEG=SDX
89RANGEQ K SDX,SDX1 Q
90 ;
91PAUSE ;
92 W ! S DIR(0)="E" D ^DIR K DIR W !
93 Q
94 ;
95PRT ; -- prt screen (PS)
96 N SDESC
97 S SDULBCK=$S(SDULCC:"",1:"R")
98 S %ZIS="Q" D ^%ZIS G PRTQ:POP
99 I '$D(IO("Q")),IO=IO(0) S SDULBCK="R" D CLEAR
100 I '$D(IO("Q")) G PRTS
101 S ZTRTN="PRTS^SDUL1",ZTIO=ION,ZTDESC="Print Screen -- List Manager Action"
102 D SAVE,^%ZTLOAD G PRTQ
103 ;
104PRTS ;
105 N SDULCC,SDULCAP
106 S SDULCC=0,SDULCAP=$$CAPTION^SDUL
107 U IO D HDR^SDUL,LIST^SDUL,FTR
108PRTQ D:'$D(ZTQUEUED) ^%ZISC D TERM^SDUL0
109 Q
110 ;
111SAVE ; -- save to queue
112 F X="SDULPGE","SDULWD","SDULCNT","SDULBG","SDULDDF(","SDULHDR(","SDUL(","SDULAR",$E(SDULAR,1,$L(SDULAR)-1)_$S($E(SDULAR,$L(SDULAR))=")":",",1:"(") S ZTSAVE(X)=""
113 Q
114 ;
115FTR ; -- footer to print
116 S SDESC=""
117 I $E(IOST,1,2)="C-" D PAUSE S SDESC='Y
118 Q
119 ;
120PRTL ; -- prt list (PL)
121 N SDESC
122 S SDULBCK=$S(SDULCC:"",1:"R")
123 S %ZIS="Q" D ^%ZIS G PRTQ:POP
124 I '$D(IO("Q")),IO=IO(0) S SDULBCK="R" D CLEAR
125 I '$D(IO("Q")) G PRTLS
126 S ZTRTN="PRTLS^SDUL1",ZTIO=ION,ZTDESC="Print List -- List Manager Action"
127 D SAVE,^%ZTLOAD G PRTLQ
128 ;
129PRTLS ;
130 N SDULPGE,SDESC,SDULCC,SDI,SDLINES,SDULCAP
131 S SDLINES=SDUL("LINES")
132 S SDUL("LINES")=IOSL-5,SDULCC=0,SDULPGE=1,SDULCAP=$$CAPTION^SDUL
133 U IO D HDR^SDUL
134 F SDI=1:1:SDULCNT S X=$G(@SDULAR@($$GET^SDUL4(SDI),0)) W !,X I IOSL<($Y+6) D FTR G PRTLQ:SDESC S SDULPGE=SDULPGE+1 D HDR^SDUL
135 D FTR
136PRTLQ D:'$D(ZTQUEUED) ^%ZISC D TERM^SDUL0
137 S:$D(SDLINES) SDUL("LINES")=SDLINES
138 Q
139 ;
140UPPER(X) ; -- convert to uppercase
141 Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
142 ;
143LOWER(X) ;
144 N Y,C,Z,I
145 S Y=$E(X)_$TR($E(X,2,999),"ABCDEFGHIJKLMNOPQRSTUVWXYZ@","abcdefghijklmnopqrstuvwxyz ")
146 F C=" ",",","/" F I=2:1 S Z=$P(Y,C,I,999) Q:Z="" S Y=$P(Y,C,1,I-1)_C_$TR($E(Z),"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")_$E(Z,2,999)
147 Q Y
148 ;
Note: See TracBrowser for help on using the repository browser.