| 1 | //kt -- Modified with SourceScanner on 8/29/2007 | 
|---|
| 2 | unit fLabCollTimes; | 
|---|
| 3 |  | 
|---|
| 4 | interface | 
|---|
| 5 |  | 
|---|
| 6 | uses | 
|---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, | 
|---|
| 8 | StdCtrls, ORCtrls, ORDtTm, ORFn, ExtCtrls, ComCtrls, DKLang; | 
|---|
| 9 |  | 
|---|
| 10 | type | 
|---|
| 11 | TfrmLabCollectTimes = class(TForm) | 
|---|
| 12 | calLabCollect: TORDateBox; | 
|---|
| 13 | lstLabCollTimes: TORListBox; | 
|---|
| 14 | cmdOK: TButton; | 
|---|
| 15 | cmdCancel: TButton; | 
|---|
| 16 | lblFutureTimes: TMemo; | 
|---|
| 17 | calMonth: TMonthCalendar; | 
|---|
| 18 | DKLanguageController1: TDKLanguageController; | 
|---|
| 19 | procedure calLabCollectChange(Sender: TObject); | 
|---|
| 20 | procedure cmdOKClick(Sender: TObject); | 
|---|
| 21 | procedure cmdCancelClick(Sender: TObject); | 
|---|
| 22 | procedure calMonthClick(Sender: TObject); | 
|---|
| 23 | procedure FormCreate(Sender: TObject); | 
|---|
| 24 | procedure calMonthKeyDown(Sender: TObject; var Key: Word; | 
|---|
| 25 | Shift: TShiftState); | 
|---|
| 26 | private | 
|---|
| 27 | FFutureLabCollTime: string; | 
|---|
| 28 | public | 
|---|
| 29 | { Public declarations } | 
|---|
| 30 | end; | 
|---|
| 31 |  | 
|---|
| 32 | function GetFutureLabTime(ACollDate: TFMDateTime): string; | 
|---|
| 33 |  | 
|---|
| 34 | implementation | 
|---|
| 35 |  | 
|---|
| 36 | uses | 
|---|
| 37 | rCore, uCore, ORNet, rODLab; | 
|---|
| 38 |  | 
|---|
| 39 | {$R *.DFM} | 
|---|
| 40 | function GetFutureLabTime(ACollDate: TFMDateTime): string; | 
|---|
| 41 | var | 
|---|
| 42 | frmLabCollectTimes: TfrmLabCollectTimes; | 
|---|
| 43 | begin | 
|---|
| 44 | frmLabCollectTimes := TfrmLabCollectTimes.Create(Application); | 
|---|
| 45 | try | 
|---|
| 46 | with frmLabCollectTimes do | 
|---|
| 47 | begin | 
|---|
| 48 | calLabCollect.FMDateTime := Trunc(ACollDate); | 
|---|
| 49 | calMonth.Date := FMDateTimeToDateTime(calLabCollect.FMDateTime); | 
|---|
| 50 | FFutureLabCollTime := ''; | 
|---|
| 51 | ShowModal; | 
|---|
| 52 | Result := FFutureLabCollTime; | 
|---|
| 53 | end; {with frmLabCollectTimes} | 
|---|
| 54 | finally | 
|---|
| 55 | frmLabCollectTimes.Release; | 
|---|
| 56 | end; | 
|---|
| 57 | end; | 
|---|
| 58 |  | 
|---|
| 59 | procedure TfrmLabCollectTimes.calLabCollectChange(Sender: TObject); | 
|---|
| 60 | begin | 
|---|
| 61 | with lstLabColltimes do | 
|---|
| 62 | begin | 
|---|
| 63 | Clear; | 
|---|
| 64 | GetLabTimesForDate(Items, calLabCollect.FMDateTime, Encounter.Location); | 
|---|
| 65 | ItemIndex := 0; | 
|---|
| 66 | end; | 
|---|
| 67 | end; | 
|---|
| 68 |  | 
|---|
| 69 | procedure TfrmLabCollectTimes.cmdOKClick(Sender: TObject); | 
|---|
| 70 | begin | 
|---|
| 71 | if lstLabCollTimes.ItemIEN > 0 then | 
|---|
| 72 | begin | 
|---|
| 73 | with calLabCollect, lstLabCollTimes do | 
|---|
| 74 | FFutureLabCollTime := RelativeTime + '@' + ItemID; | 
|---|
| 75 | Close; | 
|---|
| 76 | end | 
|---|
| 77 | else | 
|---|
| 78 | FFutureLabCollTime := ''; | 
|---|
| 79 | end; | 
|---|
| 80 |  | 
|---|
| 81 | procedure TfrmLabCollectTimes.cmdCancelClick(Sender: TObject); | 
|---|
| 82 | begin | 
|---|
| 83 | FFutureLabCollTime := ''; | 
|---|
| 84 | Close; | 
|---|
| 85 | end; | 
|---|
| 86 |  | 
|---|
| 87 | procedure TfrmLabCollectTimes.calMonthClick(Sender: TObject); | 
|---|
| 88 | begin | 
|---|
| 89 | calLabCollect.FMDateTime := DateTimeToFMDateTime(calMonth.Date); | 
|---|
| 90 | calMonth.SetFocus; | 
|---|
| 91 | end; | 
|---|
| 92 |  | 
|---|
| 93 | procedure TfrmLabCollectTimes.FormCreate(Sender: TObject); | 
|---|
| 94 | begin | 
|---|
| 95 | ResizeAnchoredFormToFont(self); | 
|---|
| 96 | end; | 
|---|
| 97 |  | 
|---|
| 98 | procedure TfrmLabCollectTimes.calMonthKeyDown(Sender: TObject; | 
|---|
| 99 | var Key: Word; Shift: TShiftState); | 
|---|
| 100 | begin | 
|---|
| 101 | case Key of | 
|---|
| 102 | VK_LEFT: calMonth.Date := calMonth.Date - 1; | 
|---|
| 103 | VK_RIGHT: calMonth.Date := calMonth.Date + 1; | 
|---|
| 104 | VK_UP: calMonth.Date := calMonth.Date - 7; | 
|---|
| 105 | VK_DOWN: calMonth.Date := calMonth.Date + 7; | 
|---|
| 106 | end; | 
|---|
| 107 | end; | 
|---|
| 108 |  | 
|---|
| 109 | end. | 
|---|