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