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