[456] | 1 | unit fODLabImmedColl;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[829] | 7 | StdCtrls, ORCtrls, ORDtTm, ExtCtrls, ORFn, fBase508Form,
|
---|
| 8 | VA508AccessibilityManager;
|
---|
[456] | 9 |
|
---|
| 10 | type
|
---|
[829] | 11 | TfrmODLabImmedColl = class(TfrmBase508Form)
|
---|
[456] | 12 | memImmedCollect: TCaptionMemo;
|
---|
| 13 | calImmedCollect: TORDateBox;
|
---|
| 14 | cmdOK: TORAlignButton;
|
---|
| 15 | cmdCancel: TORAlignButton;
|
---|
| 16 | pnlBase: TORAutoPanel;
|
---|
| 17 | lblImmedColl: TOROffsetLabel;
|
---|
| 18 | procedure cmdCancelClick(Sender: TObject);
|
---|
| 19 | procedure cmdOKClick(Sender: TObject);
|
---|
| 20 | procedure FormShow(Sender: TObject);
|
---|
| 21 | procedure calImmedCollectKeyUp(Sender: TObject; var Key: Word;
|
---|
| 22 | Shift: TShiftState);
|
---|
| 23 | private
|
---|
| 24 | FCollTime: string;
|
---|
| 25 | { Private declarations }
|
---|
| 26 | public
|
---|
| 27 | { Public declarations }
|
---|
| 28 | end;
|
---|
| 29 |
|
---|
| 30 | function SelectImmediateCollectTime(FontSize: integer; CollTime: string): string;
|
---|
| 31 |
|
---|
| 32 | implementation
|
---|
| 33 |
|
---|
| 34 | {$R *.DFM}
|
---|
| 35 |
|
---|
| 36 | uses rODLab;
|
---|
| 37 |
|
---|
| 38 | const
|
---|
| 39 | TX_NOTIME_TEXT = 'Enter or select a collection time or press Cancel.';
|
---|
| 40 | TX_NOTIME_CAP = 'Missing Date/Time';
|
---|
| 41 | TX_BADTIME_CAP = 'Invalid Immediate Collect Time';
|
---|
| 42 |
|
---|
| 43 | function SelectImmediateCollectTime(FontSize: integer; CollTime: string): string;
|
---|
| 44 | { displays select form for immediate collect time and returns a record of the selection }
|
---|
| 45 | var
|
---|
| 46 | frmODLabImmedColl: TfrmODLabImmedColl;
|
---|
| 47 | begin
|
---|
| 48 | frmODLabImmedColl := TfrmODLabImmedColl.Create(Application);
|
---|
| 49 | try
|
---|
| 50 | ResizeAnchoredFormToFont(frmODLabImmedColl);
|
---|
| 51 | with frmODLabImmedColl do
|
---|
| 52 | begin
|
---|
| 53 | FCollTime := CollTime;
|
---|
| 54 | ShowModal;
|
---|
| 55 | Result := FCollTime;
|
---|
| 56 | end;
|
---|
| 57 | finally
|
---|
| 58 | frmODLabImmedColl.Release;
|
---|
| 59 | end;
|
---|
| 60 | end;
|
---|
| 61 |
|
---|
| 62 | procedure TfrmODLabImmedColl.cmdCancelClick(Sender: TObject);
|
---|
| 63 | begin
|
---|
| 64 | FCollTime := '-1' ;
|
---|
| 65 | Close;
|
---|
| 66 | end;
|
---|
| 67 |
|
---|
| 68 | procedure TfrmODLabImmedColl.cmdOKClick(Sender: TObject);
|
---|
| 69 | var
|
---|
| 70 | x: string;
|
---|
| 71 | begin
|
---|
| 72 | if calImmedCollect.FMDateTime = 0 then
|
---|
| 73 | begin
|
---|
| 74 | InfoBox(TX_NOTIME_TEXT, TX_NOTIME_CAP, MB_OK or MB_ICONWARNING);
|
---|
| 75 | Exit;
|
---|
| 76 | end;
|
---|
| 77 | if calImmedCollect.FMDateTime > 0 then
|
---|
| 78 | begin
|
---|
| 79 | x := ValidImmCollTime(calImmedCollect.FMDateTime);
|
---|
| 80 | if Piece(x ,U, 1) = '1' then
|
---|
| 81 | FCollTime := calImmedCollect.Text
|
---|
| 82 | else
|
---|
| 83 | begin
|
---|
| 84 | InfoBox(MixedCase(Piece(x ,U, 2)), TX_BADTIME_CAP, MB_OK or MB_ICONWARNING);
|
---|
| 85 | Exit;
|
---|
| 86 | end;
|
---|
| 87 | end
|
---|
| 88 | else
|
---|
| 89 | FCollTime := '-1';
|
---|
| 90 | Close;
|
---|
| 91 | end;
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | procedure TfrmODLabImmedColl.FormShow(Sender: TObject);
|
---|
| 95 | begin
|
---|
[829] | 96 | FastAssign(ImmediateCollectTimes, memImmedCollect.Lines);
|
---|
[456] | 97 | if Length(FCollTime) > 0 then
|
---|
| 98 | calImmedCollect.Text := FCollTime
|
---|
| 99 | else
|
---|
| 100 | calImmedCollect.FMDateTime := GetDefaultImmCollTime;
|
---|
| 101 | ActiveControl := calImmedCollect;
|
---|
| 102 | end;
|
---|
| 103 |
|
---|
| 104 | procedure TfrmODLabImmedColl.calImmedCollectKeyUp(Sender: TObject;
|
---|
| 105 | var Key: Word; Shift: TShiftState);
|
---|
| 106 | begin
|
---|
| 107 | if Key = VK_ESCAPE then
|
---|
| 108 | begin
|
---|
| 109 | Key := 0;
|
---|
| 110 | cmdCancelClick(cmdCancel);
|
---|
| 111 | end;
|
---|
| 112 | end;
|
---|
| 113 |
|
---|
| 114 | end.
|
---|