[459] | 1 | unit fOrderFlag;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fAutoSz, StdCtrls, ComCtrls, ORFn, rOrders, ORCtrls;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmFlagOrder = class(TfrmAutoSz)
|
---|
| 11 | txtReason: TCaptionEdit;
|
---|
| 12 | Label1: TLabel;
|
---|
| 13 | cmdOK: TButton;
|
---|
| 14 | cmdCancel: TButton;
|
---|
| 15 | memOrder: TMemo;
|
---|
| 16 | lblAlertRecipient: TLabel;
|
---|
| 17 | cboAlertRecipient: TORComboBox;
|
---|
| 18 | procedure FormCreate(Sender: TObject);
|
---|
| 19 | procedure cmdOKClick(Sender: TObject);
|
---|
| 20 | procedure cmdCancelClick(Sender: TObject);
|
---|
| 21 | procedure cboOnExit(Sender: TObject);
|
---|
| 22 | procedure cboAlertRecipientNeedData(Sender: TObject;
|
---|
| 23 | const StartFrom: String; Direction, InsertAt: Integer);
|
---|
| 24 | private
|
---|
| 25 | OKPressed: Boolean;
|
---|
| 26 | end;
|
---|
| 27 |
|
---|
| 28 | function ExecuteFlagOrder(AnOrder: TOrder): Boolean;
|
---|
| 29 |
|
---|
| 30 | implementation
|
---|
| 31 |
|
---|
| 32 | {$R *.DFM}
|
---|
| 33 |
|
---|
| 34 | uses uCore, rCore;
|
---|
| 35 |
|
---|
| 36 | var AlertRecip: Int64;
|
---|
| 37 |
|
---|
| 38 | function ExecuteFlagOrder(AnOrder: TOrder): Boolean;
|
---|
| 39 | var
|
---|
| 40 | frmFlagOrder: TfrmFlagOrder;
|
---|
| 41 | begin
|
---|
| 42 | Result := False;
|
---|
| 43 | frmFlagOrder := TfrmFlagOrder.Create(Application);
|
---|
| 44 | try
|
---|
| 45 | ResizeFormToFont(TForm(frmFlagOrder));
|
---|
| 46 | //AlertRecip := User.DUZ;
|
---|
| 47 | with frmFlagOrder do
|
---|
| 48 | begin
|
---|
| 49 | memOrder.SetTextBuf(PChar(AnOrder.Text));
|
---|
| 50 | ShowModal;
|
---|
| 51 | if OKPressed then
|
---|
| 52 | begin
|
---|
| 53 | FlagOrder(AnOrder, txtReason.Text, AlertRecip);
|
---|
| 54 | Result := True;
|
---|
| 55 | end;
|
---|
| 56 | end;
|
---|
| 57 | finally
|
---|
| 58 | frmFlagOrder.Release;
|
---|
[460] | 59 | AlertRecip := 0;
|
---|
[459] | 60 | end;
|
---|
| 61 | end;
|
---|
| 62 |
|
---|
| 63 | procedure TfrmFlagOrder.FormCreate(Sender: TObject);
|
---|
| 64 | begin
|
---|
| 65 | inherited;
|
---|
| 66 | OKPressed := False;
|
---|
| 67 | cboAlertRecipient.InitLongList('');
|
---|
| 68 | //cboAlertRecipient.SelectByIEN(User.DUZ);
|
---|
| 69 | end;
|
---|
| 70 |
|
---|
| 71 | procedure TfrmFlagOrder.cmdOKClick(Sender: TObject);
|
---|
| 72 | const
|
---|
| 73 | TX_REASON_REQ = 'A reason must be entered to flag an order.';
|
---|
| 74 | TC_REASON_REQ = 'Reason Required';
|
---|
| 75 | begin
|
---|
| 76 | inherited;
|
---|
| 77 | if txtReason.Text = '' then
|
---|
| 78 | begin
|
---|
| 79 | InfoBox(TX_REASON_REQ, TC_REASON_REQ, MB_OK);
|
---|
| 80 | Exit;
|
---|
| 81 | end;
|
---|
| 82 | cmdOK.SetFocus;
|
---|
| 83 | OKPressed := True;
|
---|
| 84 | Close;
|
---|
| 85 | end;
|
---|
| 86 |
|
---|
| 87 | procedure TfrmFlagOrder.cmdCancelClick(Sender: TObject);
|
---|
| 88 | begin
|
---|
| 89 | inherited;
|
---|
| 90 | Close;
|
---|
| 91 | end;
|
---|
| 92 |
|
---|
| 93 | procedure TfrmFlagOrder.cboOnExit(Sender: TObject);
|
---|
| 94 | begin
|
---|
| 95 | with cboAlertRecipient do
|
---|
| 96 | if (ItemIndex = -1) or (Text = '') then
|
---|
| 97 | begin
|
---|
| 98 | AlertRecip := -1;
|
---|
| 99 | ItemIndex := -1;
|
---|
| 100 | Text := '';
|
---|
| 101 | end
|
---|
| 102 | else
|
---|
| 103 | begin
|
---|
| 104 | AlertRecip := ItemIEN;
|
---|
| 105 | end;
|
---|
| 106 | end;
|
---|
| 107 |
|
---|
| 108 | procedure TfrmFlagOrder.cboAlertRecipientNeedData(Sender: TObject;
|
---|
| 109 | const StartFrom: String; Direction, InsertAt: Integer);
|
---|
| 110 | begin
|
---|
| 111 | cboAlertRecipient.ForDataUse(SubSetOfPersons(StartFrom, Direction));
|
---|
| 112 | end;
|
---|
| 113 |
|
---|
| 114 | end.
|
---|