[459] | 1 | unit fNoteDR;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fAutoSz, StdCtrls;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmNoteDelReason = class(TfrmAutoSz)
|
---|
| 11 | lblInstruction: TStaticText;
|
---|
| 12 | cmdOK: TButton;
|
---|
| 13 | cmdCancel: TButton;
|
---|
| 14 | radPrivacy: TRadioButton;
|
---|
| 15 | radAdmin: TRadioButton;
|
---|
| 16 | procedure FormCreate(Sender: TObject);
|
---|
| 17 | procedure cmdOKClick(Sender: TObject);
|
---|
| 18 | procedure cmdCancelClick(Sender: TObject);
|
---|
| 19 | private
|
---|
| 20 | OKPressed: Boolean;
|
---|
| 21 | end;
|
---|
| 22 |
|
---|
| 23 | function SelectDeleteReason(ANote: Integer): string;
|
---|
| 24 |
|
---|
| 25 | implementation
|
---|
| 26 |
|
---|
| 27 | {$R *.DFM}
|
---|
| 28 |
|
---|
| 29 | uses ORFn, rTIU, uConst;
|
---|
| 30 |
|
---|
| 31 | const
|
---|
| 32 | TX_REQRSN = 'A reason must be selected, otherwise press cancel.';
|
---|
| 33 | TC_REQRSN = 'Reason Required';
|
---|
| 34 |
|
---|
| 35 | function SelectDeleteReason(ANote: Integer): string;
|
---|
| 36 | var
|
---|
| 37 | frmNoteDelReason: TfrmNoteDelReason;
|
---|
| 38 | begin
|
---|
| 39 | if not JustifyDocumentDelete(ANote) then
|
---|
| 40 | begin
|
---|
| 41 | Result := DR_NOTREQ;
|
---|
| 42 | Exit;
|
---|
| 43 | end;
|
---|
| 44 | Result := DR_CANCEL;
|
---|
| 45 | frmNoteDelReason := TfrmNoteDelReason.Create(Application);
|
---|
| 46 | try
|
---|
| 47 | ResizeFormToFont(TForm(frmNoteDelReason));
|
---|
| 48 | frmNoteDelReason.ShowModal;
|
---|
| 49 | with frmNoteDelReason do if OKPressed then
|
---|
| 50 | begin
|
---|
| 51 | if radPrivacy.Checked then Result := DR_PRIVACY;
|
---|
| 52 | if radAdmin.Checked then Result := DR_ADMIN;
|
---|
| 53 | end;
|
---|
| 54 | finally
|
---|
| 55 | frmNoteDelReason.Release;
|
---|
| 56 | end;
|
---|
| 57 | end;
|
---|
| 58 |
|
---|
| 59 | procedure TfrmNoteDelReason.FormCreate(Sender: TObject);
|
---|
| 60 | begin
|
---|
| 61 | inherited;
|
---|
| 62 | OKPressed := False;
|
---|
| 63 | end;
|
---|
| 64 |
|
---|
| 65 | procedure TfrmNoteDelReason.cmdOKClick(Sender: TObject);
|
---|
| 66 | begin
|
---|
| 67 | inherited;
|
---|
| 68 | if not (radPrivacy.Checked or radAdmin.Checked) then
|
---|
| 69 | begin
|
---|
| 70 | InfoBox(TX_REQRSN, TC_REQRSN, MB_OK);
|
---|
| 71 | Exit;
|
---|
| 72 | end;
|
---|
| 73 | OKPressed := True;
|
---|
| 74 | Close;
|
---|
| 75 | end;
|
---|
| 76 |
|
---|
| 77 | procedure TfrmNoteDelReason.cmdCancelClick(Sender: TObject);
|
---|
| 78 | begin
|
---|
| 79 | inherited;
|
---|
| 80 | Close;
|
---|
| 81 | end;
|
---|
| 82 |
|
---|
| 83 | end.
|
---|