[459] | 1 | unit fOrdersHold;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fAutoSz, StdCtrls, ORFn, ORCtrls;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmHoldOrders = class(TfrmAutoSz)
|
---|
| 11 | lstOrders: TCaptionListBox;
|
---|
| 12 | Label1: TLabel;
|
---|
| 13 | cmdOK: TButton;
|
---|
| 14 | cmdCancel: TButton;
|
---|
| 15 | procedure FormCreate(Sender: TObject);
|
---|
| 16 | procedure cmdOKClick(Sender: TObject);
|
---|
| 17 | procedure cmdCancelClick(Sender: TObject);
|
---|
| 18 | private
|
---|
| 19 | OKPressed: Boolean;
|
---|
| 20 | end;
|
---|
| 21 |
|
---|
| 22 | function ExecuteHoldOrders(SelectedList: TList): Boolean;
|
---|
| 23 |
|
---|
| 24 | implementation
|
---|
| 25 |
|
---|
| 26 | {$R *.DFM}
|
---|
| 27 |
|
---|
| 28 | uses rOrders, uConst, uCore;
|
---|
| 29 |
|
---|
| 30 | function ExecuteHoldOrders(SelectedList: TList): Boolean;
|
---|
| 31 | var
|
---|
| 32 | frmHoldOrders: TfrmHoldOrders;
|
---|
| 33 | OriginalID: string;
|
---|
| 34 | i: Integer;
|
---|
| 35 | begin
|
---|
| 36 | Result := False;
|
---|
| 37 | if SelectedList.Count = 0 then Exit;
|
---|
| 38 | frmHoldOrders := TfrmHoldOrders.Create(Application);
|
---|
| 39 | try
|
---|
| 40 | ResizeFormToFont(TForm(frmHoldOrders));
|
---|
| 41 | with SelectedList do for i := 0 to Count - 1 do
|
---|
| 42 | frmHoldOrders.lstOrders.Items.Add(TOrder(Items[i]).Text);
|
---|
| 43 | frmHoldOrders.ShowModal;
|
---|
| 44 | if frmHoldOrders.OKPressed then
|
---|
| 45 | begin
|
---|
| 46 | with SelectedList do for i := 0 to Count - 1 do
|
---|
| 47 | begin
|
---|
| 48 | OriginalID := TOrder(Items[i]).ID;
|
---|
| 49 | HoldOrder(TOrder(Items[i]));
|
---|
| 50 | TOrder(Items[i]).ActionOn := OriginalID + '=HD';
|
---|
| 51 | SendMessage(Application.MainForm.Handle, UM_NEWORDER, ORDER_ACT, Integer(Items[i]));
|
---|
| 52 | end;
|
---|
| 53 | Result := True;
|
---|
| 54 | end
|
---|
| 55 | else with SelectedList do for i := 0 to Count - 1 do UnlockOrder(TOrder(Items[i]).ID);
|
---|
| 56 | finally
|
---|
| 57 | frmHoldOrders.Release;
|
---|
| 58 | end;
|
---|
| 59 | end;
|
---|
| 60 |
|
---|
| 61 | procedure TfrmHoldOrders.FormCreate(Sender: TObject);
|
---|
| 62 | begin
|
---|
| 63 | inherited;
|
---|
| 64 | OKPressed := False;
|
---|
| 65 | end;
|
---|
| 66 |
|
---|
| 67 | procedure TfrmHoldOrders.cmdOKClick(Sender: TObject);
|
---|
| 68 | begin
|
---|
| 69 | inherited;
|
---|
| 70 | OKPressed := True;
|
---|
| 71 | Close;
|
---|
| 72 | end;
|
---|
| 73 |
|
---|
| 74 | procedure TfrmHoldOrders.cmdCancelClick(Sender: TObject);
|
---|
| 75 | begin
|
---|
| 76 | inherited;
|
---|
| 77 | Close;
|
---|
| 78 | end;
|
---|
| 79 |
|
---|
| 80 | end.
|
---|