Produced by Araxis Merge on 3/31/2017 10:45:43 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSDATETIME | frmGMV_DateTime.pas | Tue Dec 13 18:25:50 2016 UTC |
2 | CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSDATETIME | frmGMV_DateTime.pas | Fri Mar 31 15:01:38 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 848 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | unit frmGM V_DateTime ; | |
2 | { | |
3 | ========== ========== ========== ========== ========== ========== ========== ========== | |
4 | * | |
5 | * Ap plication: Vitals | |
6 | * Re vision: $Revisio n: 1 $ $M odtime: 12 /20/07 12: 44p $ | |
7 | * De veloper: PII | |
8 | * Si te: Hines OI FO | |
9 | * | |
10 | * De scription: This is an Date/Ti me Selecti on Dialog | |
11 | * | |
12 | * No tes: Original ly compile d in Delph i V | |
13 | * Uses rou tines from uGMV-Comm on module: | |
14 | * uGMV- Common.Cal lServer(.. .) -- to c all 'GMV G ET CURRENT TIME' rou tine, | |
15 | * to reteive M-date/ti me | |
16 | * uGMV- Common.FMD ateTimeToW indowsDate Time(...) | |
17 | * -- to c onvert M-d ate/time | |
18 | * | |
19 | ========== ========== ========== ========== ========== ========== ========== ========== | |
20 | * $A rchive: /V itals/5.0 (Version 5 .0)/5.0.23 (Patch 23 )/VITALS_5 _0_23_8/So urce/VITAL SDATETIME/ frmGMV_Dat eTime.pas $ | |
21 | * | |
22 | * $History : frmGMV_D ateTime.pa s $ | |
23 | * | |
24 | * ******* ********** Version 1 ******* ********** | |
25 | * User: V haishandri a Date: 8/ 12/09 T ime: 8:29a | |
26 | * Created in $/Vita ls/5.0 (Ve rsion 5.0) /5.0.23 (P atch 23)/V ITALS_5_0_ 23_8/Sourc e/VITALSDA TETIME | |
27 | * | |
28 | * ******* ********** Version 1 ******* ********** | |
29 | * User: V haishandri a Date: 3/ 09/09 T ime: 3:39p | |
30 | * Created in $/Vita ls/5.0 (Ve rsion 5.0) /5.0.23 (P atch 23)/V ITALS_5_0_ 23_6/Sourc e/VITALSDA TETIME | |
31 | * | |
32 | * ******* ********** Version 1 ******* ********** | |
33 | * User: V haishandri a Date: 1/ 13/09 T ime: 1:26p | |
34 | * Created in $/Vita ls/5.0 (Ve rsion 5.0) /5.0.23 (P atch 23)/V ITALS_5_0_ 23_4/Sourc e/VITALSDA TETIME | |
35 | * | |
36 | * ******* ********** Version 1 ******* ********** | |
37 | * User: V haishandri a Date: 5/ 14/07 T ime: 10:30 a | |
38 | * Created in $/Vita ls GUI 200 7/Vitals-5 -0-18/VITA LSDATETIME | |
39 | * | |
40 | * ******* ********** Version 1 ******* ********** | |
41 | * User: V haishandri a Date: 5/ 16/06 T ime: 5:43p | |
42 | * Created in $/Vita ls/VITALS- 5-0-18/Vit alsDateTim e | |
43 | * GUI v. 5.0.18 upd ates the d efault vit al type IE Ns with th e local | |
44 | * values. | |
45 | * | |
46 | * ******* ********** Version 1 ******* ********** | |
47 | * User: V haishandri a Date: 5/ 16/06 T ime: 5:33p | |
48 | * Created in $/Vita ls/Vitals- 5-0-18/VIT ALS-5-0-18 /VitalsDat eTime | |
49 | * | |
50 | * ******* ********** Version 1 ******* ********** | |
51 | * User: V haishandri a Date: 5/ 24/05 T ime: 3:37p | |
52 | * Created in $/Vita ls/Vitals GUI v 5.0 .2.1 -5.0. 3.1 - Patc h GMVR-5-7 (CASMed, CCOW) - De lphi 6/Vit alsDateTim e | |
53 | * | |
54 | * ******* ********** Version 1 ******* ********** | |
55 | * User: V haishandri a Date: 4/ 16/04 T ime: 4:21p | |
56 | * Created in $/Vita ls/Vitals GUI Versio n 5.0.3 (C COW, CPRS, Delphi 7) /VITALSDAT ETIME | |
57 | * | |
58 | * ******* ********** Version 2 ******* ********** | |
59 | * User: V haishandri a Date: 2/ 02/04 T ime: 5:18p | |
60 | * Updated in $/Vita lsLite/Dat eTimeDLL | |
61 | * | |
62 | * ******* ********** Version 1 ******* ********** | |
63 | * User: V haishandri a Date: 1/ 30/04 T ime: 4:34p | |
64 | * Created in $/Vita lsLite/Dat eTimeDLL | |
65 | * | |
66 | * ******* ********** Version 1 ******* ********** | |
67 | * User: V haishandri a Date: 1/ 15/04 T ime: 3:06p | |
68 | * Created in $/Vita lsLite/Vit alsLiteDLL | |
69 | * Vitals Lite DLL | |
70 | * | |
71 | } | |
72 | ||
73 | interface | |
74 | ||
75 | uses | |
76 | {$IFDEF DL L} | |
77 | ShareMem , | |
78 | {$ENDIF} | |
79 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dia logs, | |
80 | StdCtrls , Buttons, ComCtrls, ExtCtrls; | |
81 | ||
82 | type | |
83 | TfGMV_Da teTime = c lass(TForm ) | |
84 | Panel1 : TPanel; | |
85 | grpBox DT: TGroup Box; | |
86 | Panel2 : TPanel; | |
87 | pnlDat e: TPanel; | |
88 | Panel5 : TPanel; | |
89 | bbtnTo day: TBitB tn; | |
90 | mncCal endar: TMo nthCalenda r; | |
91 | Panel6 : TPanel; | |
92 | lbxHou rs: TListB ox; | |
93 | lbxMin utes: TLis tBox; | |
94 | Panel4 : TPanel; | |
95 | bbtnMi dnight: TB itBtn; | |
96 | bbtnNo w: TBitBtn ; | |
97 | SpeedB utton2: TS peedButton ; | |
98 | SpeedB utton1: TS peedButton ; | |
99 | edtTim e: TEdit; | |
100 | pnlDat eTimeText: TPanel; | |
101 | Label1 : TLabel; | |
102 | bbtnYe sterday: T BitBtn; | |
103 | bbtnTo morrow: TB itBtn; | |
104 | Timer1 : TTimer; | |
105 | Label2 : TLabel; | |
106 | proced ure FormCr eate(Sende r: TObject ); | |
107 | proced ure lbxHou rsClick(Se nder: TObj ect); | |
108 | proced ure lbxMin utesClick( Sender: TO bject); | |
109 | proced ure edtTim eKeyPress( Sender: TO bject; var Key: Char ); | |
110 | proced ure bbtnNo wClick(Sen der: TObje ct); | |
111 | proced ure bbtnMi dnightClic k(Sender: TObject); | |
112 | proced ure bbtnTo dayClick(S ender: TOb ject); | |
113 | proced ure SpeedB utton1Clic k(Sender: TObject); | |
114 | proced ure SpeedB utton2Clic k(Sender: TObject); | |
115 | proced ure edtTim eChange(Se nder: TObj ect); | |
116 | proced ure mncCal endarClick (Sender: T Object); | |
117 | proced ure SetDat eTimeText; | |
118 | proced ure Update Text; | |
119 | proced ure bbtnYe sterdayCli ck(Sender: TObject); | |
120 | proced ure bbtnTo morrowClic k(Sender: TObject); | |
121 | proced ure FormAc tivate(Sen der: TObje ct); | |
122 | proced ure Timer1 Timer(Send er: TObjec t); | |
123 | proced ure FormKe yPress(Sen der: TObje ct; var Ke y: Char); | |
124 | private | |
125 | { Priv ate declar ations } | |
126 | dltTim e: TDateTi me; | |
127 | proced ure SetDat eTime; | |
128 | functi on TimeIsV alid(h, m: Integer): Boolean; | |
129 | proced ure SetBut tonState; | |
130 | proced ure setSer verDelay; | |
131 | public | |
132 | { Publ ic declara tions } | |
133 | end; | |
134 | ||
135 | var | |
136 | fGMV_Dat eTime: TfG MV_DateTim e; | |
137 | ||
138 | implementa tion | |
139 | ||
140 | uses | |
141 | uGMV_Com mon, | |
142 | uGMV_Eng ine, uGMV_ Const | |
143 | ; | |
144 | ||
145 | {$IFDEF DA TETIMEDLL} | |
146 | var | |
147 | PrevApp: TApplicat ion; | |
148 | PrevScre en: TScree n; | |
149 | {$ENDIF} | |
150 | ||
151 | {$R *.DFM} | |
152 | ||
153 | procedure TfGMV_Date Time.FormC reate(Send er: TObjec t); | |
154 | begin | |
155 | //{$IFDEF DLL} | |
156 | // fix R emedy 1540 38 ------- ---------- ---------- ---------- ---------- ---- start | |
157 | // prior to this f ix the cod e was used within DL L only | |
158 | setServe rDelay; | |
159 | //{$ELSE} | |
160 | // dltTim e := 0; | |
161 | // edtTim e.Text := FormatDate Time('hh:m m',Now); | |
162 | //{$ENDIF} | |
163 | // fix R emedy 1540 38 ------- ---------- ---------- ---------- ---------- ------ end | |
164 | Caption := 'Select Date & Ti me up to ' + FormatD ateTime('m m/dd/yyyy hh:mm', mn cCalendar. MaxDate); | |
165 | end; | |
166 | ||
167 | procedure TfGMV_Date Time.setSe rverDelay; | |
168 | var | |
169 | aNow: TD ateTime; | |
170 | s: strin g; | |
171 | f: Real; | |
172 | begin | |
173 | aNow := Now; | |
174 | try | |
175 | s := g etCurrentD ateTime; | |
176 | if s < > '' then | |
177 | try | |
178 | f := StrToFloa t(s); | |
179 | f := FMDateTim eToWindows DateTime(f ); | |
180 | dltT ime := aNo w - f; | |
181 | aNow := f; | |
182 | except | |
183 | on E : EConvert Error do | |
184 | begi n | |
185 | Me ssageDlg(' Unable to set client to the se rvers time .', mtWarn ing, [mbok ], 0); | |
186 | dl tTime := 0 ; | |
187 | aN ow := Now; | |
188 | ed tTime.Text := Format DateTime(' hh:mm', aN ow); | |
189 | end; | |
190 | end; | |
191 | except | |
192 | on E: EConvertEr ror do | |
193 | Mess ageDlg('Un able to ge t the serv ers time.' , mtWarnin g, [mbok], 0); | |
194 | end; | |
195 | grpBoxDT .Caption : = ''; | |
196 | mncCalen dar.MaxDat e := aNow; | |
197 | mncCalen dar.Date : = mncCalen dar.MaxDat e; | |
198 | end; | |
199 | ||
200 | procedure TfGMV_Date Time.SetDa teTime; | |
201 | var | |
202 | S: strin g; | |
203 | i, j: In teger; | |
204 | begin | |
205 | try | |
206 | i := S trToInt(lb xHours.Ite ms[lbxHour s.ItemInde x]); | |
207 | except | |
208 | i := 0 ; | |
209 | end; | |
210 | try | |
211 | S := l bxMinutes. Items[lbxM inutes.Ite mIndex]; | |
212 | while (pos('0', S) = 1) or (pos(':', S) = 1) d o | |
213 | S := copy(s, 2 , Length(S ) - 1); | |
214 | if pos (' --', S) = 1 then | |
215 | j := 0 | |
216 | else | |
217 | j := StrToInt( Piece(S, ' ', 1)); | |
218 | except | |
219 | j := 0 ; | |
220 | end; | |
221 | if TimeI sValid(i, j) then | |
222 | edtTim e.Text := Format('%2 .2d:%2.2d' , [i, j]) | |
223 | else | |
224 | begin | |
225 | Messag eDlg('Sorr y, you can not select a future date or ti me' + #13 + #13 + | |
226 | 'or date more than 1 yea r old' | |
227 | , mt Error, [mb Ok], 0) | |
228 | end; | |
229 | SetDateT imeText; | |
230 | end; | |
231 | ||
232 | procedure TfGMV_Date Time.lbxHo ursClick(S ender: TOb ject); | |
233 | begin | |
234 | SetDateT ime; | |
235 | end; | |
236 | ||
237 | procedure TfGMV_Date Time.lbxMi nutesClick (Sender: T Object); | |
238 | begin | |
239 | SetDateT ime; | |
240 | end; | |
241 | ||
242 | procedure TfGMV_Date Time.edtTi meKeyPress (Sender: T Object; va r Key: Cha r); | |
243 | begin | |
244 | if Key = #13 then | |
245 | begin | |
246 | try | |
247 | Upda teText; | |
248 | except | |
249 | Mess ageDlg('In valid time string.', mtError, [mbOk], 0) ; | |
250 | acti vecontrol := edtTime ; | |
251 | end; | |
252 | end; | |
253 | end; | |
254 | ||
255 | procedure TfGMV_Date Time.Updat eText; | |
256 | begin | |
257 | begin | |
258 | try | |
259 | SetD ateTimeTex t; | |
260 | except | |
261 | Mess ageDlg('Ch eck time v alue!', mt Error, [mb Yes, mbCan cel], 0); | |
262 | end; | |
263 | end; | |
264 | end; | |
265 | ||
266 | procedure TfGMV_Date Time.bbtnN owClick(Se nder: TObj ect); | |
267 | var | |
268 | aNow: TD ateTime; | |
269 | begin | |
270 | setServe rDelay; | |
271 | aNow := Now - dltT ime; | |
272 | ||
273 | edtTime. Text := Fo rmatDateTi me(GMV_Tim eFormat, a Now); | |
274 | try | |
275 | mncCal endar.MinD ate := 0; | |
276 | mncCal endar.MinD ate := aNo w - 365; | |
277 | except | |
278 | end; | |
279 | mncCalen dar.MaxDat e := aNow; | |
280 | mncCalen dar.Date : = aNow; | |
281 | caption := 'Select Date & Ti me up to ' + FormatD ateTime('m m/dd/yyyy hh:mm', mn cCalendar. MaxDate); | |
282 | ||
283 | SetButto nState; | |
284 | updateTe xt; | |
285 | try | |
286 | lbxHou rs.ItemInd ex := -1; | |
287 | lbxMin utes.ItemI ndex := -1 ; | |
288 | except | |
289 | end; | |
290 | end; | |
291 | ||
292 | procedure TfGMV_Date Time.bbtnM idnightCli ck(Sender: TObject); | |
293 | begin | |
294 | edtTime. Text := Fo rmatDateTi me('hh:mm' , 0); | |
295 | updateTe xt; | |
296 | try | |
297 | lbxHou rs.ItemInd ex := -1; | |
298 | lbxMin utes.ItemI ndex := -1 ; | |
299 | except | |
300 | end; | |
301 | end; | |
302 | ||
303 | procedure TfGMV_Date Time.bbtnT odayClick( Sender: TO bject); | |
304 | begin | |
305 | mncCalen dar.Date : = Now - dl tTime; | |
306 | SetDateT imeText; | |
307 | bbtnTomo rrow.Enabl ed := Fals e; | |
308 | end; | |
309 | ||
310 | procedure TfGMV_Date Time.Speed Button1Cli ck(Sender: TObject); | |
311 | var | |
312 | T: TDate Time; | |
313 | begin | |
314 | try | |
315 | T := S trToTime(e dtTime.Tex t); | |
316 | if (T + trunc(mn cCalendar. Date)) - m ncCalendar .MaxDate > 2 / 24 / 3600 then | |
317 | Mess ageDlg('So rry, you c annot sele ct a futur e date or time', //A AN 10/30/2 002 | |
318 | mt Error, [mb Ok], 0) // AAN 10/30/ 2002 | |
319 | else i f (T + tru nc(mncCale ndar.Date) ) < mncCal endar.MinD ate then | |
320 | Mess ageDlg('So rry, you c annot sele ct a date more than 1 year old ', //AAN 2 003/06/04 | |
321 | mt Error, [mb Ok], 0) // AAN 2003/0 6/04 | |
322 | else | |
323 | Moda lResult := mrOK | |
324 | except | |
325 | Messag eDlg('Inva lid time s tring.', m tError, [m bOk], 0); | |
326 | active control := edtTime; | |
327 | end; | |
328 | end; | |
329 | ||
330 | procedure TfGMV_Date Time.Speed Button2Cli ck(Sender: TObject); | |
331 | begin | |
332 | ModalRes ult := mrC ancel; | |
333 | end; | |
334 | ||
335 | procedure TfGMV_Date Time.edtTi meChange(S ender: TOb ject); | |
336 | begin | |
337 | SetDateT imeText; | |
338 | end; | |
339 | ||
340 | procedure TfGMV_Date Time.SetDa teTimeText ; | |
341 | begin | |
342 | pnlDateT imeText.Ca ption := F ormatDateT ime(' m m/dd/yy ', mncCalend ar.Date) + edtTime.T ext; | |
343 | end; | |
344 | ||
345 | procedure TfGMV_Date Time.mncCa lendarClic k(Sender: TObject); | |
346 | begin | |
347 | SetDateT imeText; | |
348 | SetButto nState; | |
349 | end; | |
350 | ||
351 | function T fGMV_DateT ime.TimeIs Valid(h, m : Integer) : boolean; | |
352 | begin | |
353 | result : = | |
354 | (trunc (mncCalend ar.Date) + h / 24 + m / 24 / 6 0 < mncCal endar.MaxD ate) | |
355 | and | |
356 | (mncCa lendar.Min Date < tru nc(mncCale ndar.Date) + h / 24 + m / 24 / 60); | |
357 | end; | |
358 | ||
359 | procedure TfGMV_Date Time.bbtnY esterdayCl ick(Sender : TObject) ; | |
360 | begin | |
361 | try | |
362 | mncCal endar.Date := mncCal endar.Date - 1; | |
363 | Update Text; | |
364 | SetBut tonState; | |
365 | except | |
366 | end; | |
367 | end; | |
368 | ||
369 | procedure TfGMV_Date Time.bbtnT omorrowCli ck(Sender: TObject); | |
370 | begin | |
371 | try | |
372 | mncCal endar.Date := mncCal endar.Date + 1; | |
373 | Update Text; | |
374 | SetBut tonState; | |
375 | except | |
376 | end; | |
377 | end; | |
378 | ||
379 | procedure TfGMV_Date Time.SetBu ttonState; | |
380 | begin | |
381 | if trunc (mncCalend ar.Date) = trunc(mnc Calendar.M axDate) th en | |
382 | bbtnTo morrow.Ena bled := Fa lse | |
383 | else | |
384 | bbtnTo morrow.Ena bled := Tr ue; | |
385 | if trunc (mncCalend ar.Date) = trunc(mnc Calendar.M inDate) th en | |
386 | bbtnYe sterday.En abled := F alse | |
387 | else | |
388 | bbtnYe sterday.En abled := T rue; | |
389 | end; | |
390 | ||
391 | procedure TfGMV_Date Time.FormA ctivate(Se nder: TObj ect); | |
392 | begin | |
393 | updateTe xt; | |
394 | SetButto nState; | |
395 | end; | |
396 | ||
397 | procedure TfGMV_Date Time.Timer 1Timer(Sen der: TObje ct); | |
398 | var | |
399 | aNow: TD ateTime; | |
400 | begin | |
401 | try | |
402 | aNow : = Now - dl tTime; | |
403 | label2 .Caption : = FormatDa teTime(GMV _DateTimeF ormat, aNo w); | |
404 | mncCal endar.MaxD ate := aNo w; | |
405 | except | |
406 | end; | |
407 | end; | |
408 | ||
409 | procedure TfGMV_Date Time.FormK eyPress(Se nder: TObj ect; var K ey: Char); | |
410 | begin | |
411 | if Key = char(VK_E SCAPE) the n | |
412 | ModalR esult := m rCancel; | |
413 | end; | |
414 | ||
415 | {$IFDEF DA TETIMEDLL} | |
416 | initializa tion | |
417 | PrevApp := Applica tion; | |
418 | PrevScre en := Scre en; | |
419 | ||
420 | finalizati on | |
421 | Applicat ion := Pre vApp; | |
422 | Screen : = PrevScre en; | |
423 | {$ENDIF} | |
424 | end. | |
425 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.