[459] | 1 | unit fOrdersUnhold;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fAutoSz, StdCtrls, ORFn, ORCtrls;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmUnholdOrders = class(TfrmAutoSz)
|
---|
| 11 | Label1: TLabel;
|
---|
| 12 | lstOrders: TCaptionListBox;
|
---|
| 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 ExecuteUnholdOrders(SelectedList: TList): Boolean;
|
---|
| 23 |
|
---|
| 24 | implementation
|
---|
| 25 |
|
---|
| 26 | {$R *.DFM}
|
---|
| 27 |
|
---|
| 28 | uses rOrders, uConst, uCore;
|
---|
| 29 |
|
---|
| 30 | function ExecuteUnholdOrders(SelectedList: TList): Boolean;
|
---|
| 31 | var
|
---|
| 32 | frmUnholdOrders: TfrmUnholdOrders;
|
---|
| 33 | OriginalID: string;
|
---|
| 34 | i: Integer;
|
---|
| 35 | begin
|
---|
| 36 | Result := False;
|
---|
| 37 | if SelectedList.Count = 0 then Exit;
|
---|
| 38 | frmUnholdOrders := TfrmUnholdOrders.Create(Application);
|
---|
| 39 | try
|
---|
| 40 | ResizeFormToFont(TForm(frmUnholdOrders));
|
---|
| 41 | with SelectedList do for i := 0 to Count - 1 do
|
---|
| 42 | frmUnholdOrders.lstOrders.Items.Add(TOrder(Items[i]).Text);
|
---|
| 43 | frmUnholdOrders.ShowModal;
|
---|
| 44 | if frmUnholdOrders.OKPressed then
|
---|
| 45 | begin
|
---|
| 46 | with SelectedList do for i := 0 to Count - 1 do
|
---|
| 47 | begin
|
---|
| 48 | OriginalID := TOrder(Items[i]).ID;
|
---|
| 49 | ReleaseOrderHold(TOrder(Items[i]));
|
---|
| 50 | end;
|
---|
| 51 | Result := True;
|
---|
| 52 | end
|
---|
| 53 | else with SelectedList do for i := 0 to Count - 1 do UnlockOrder(TOrder(Items[i]).ID);
|
---|
| 54 | finally
|
---|
| 55 | frmUnholdOrders.Release;
|
---|
| 56 | end;
|
---|
| 57 | end;
|
---|
| 58 |
|
---|
| 59 | procedure TfrmUnholdOrders.FormCreate(Sender: TObject);
|
---|
| 60 | begin
|
---|
| 61 | inherited;
|
---|
| 62 | OKPressed := False;
|
---|
| 63 | end;
|
---|
| 64 |
|
---|
| 65 | procedure TfrmUnholdOrders.cmdOKClick(Sender: TObject);
|
---|
| 66 | begin
|
---|
| 67 | inherited;
|
---|
| 68 | OKPressed := True;
|
---|
| 69 | Close;
|
---|
| 70 | end;
|
---|
| 71 |
|
---|
| 72 | procedure TfrmUnholdOrders.cmdCancelClick(Sender: TObject);
|
---|
| 73 | begin
|
---|
| 74 | inherited;
|
---|
| 75 | Close;
|
---|
| 76 | end;
|
---|
| 77 |
|
---|
| 78 | end.
|
---|