source: cprs/trunk/CPRS-Chart/Orders/fOrdersHold.pas@ 485

Last change on this file since 485 was 456, checked in by Kevin Toppenberg, 16 years ago

Initial Upload of Official WV CPRS 1.0.26.76

File size: 1.9 KB
RevLine 
[456]1unit fOrdersHold;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fAutoSz, StdCtrls, ORFn, ORCtrls;
8
9type
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
22function ExecuteHoldOrders(SelectedList: TList): Boolean;
23
24implementation
25
26{$R *.DFM}
27
28uses rOrders, uConst, uCore;
29
30function ExecuteHoldOrders(SelectedList: TList): Boolean;
31var
32 frmHoldOrders: TfrmHoldOrders;
33 OriginalID: string;
34 i: Integer;
35begin
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;
59end;
60
61procedure TfrmHoldOrders.FormCreate(Sender: TObject);
62begin
63 inherited;
64 OKPressed := False;
65end;
66
67procedure TfrmHoldOrders.cmdOKClick(Sender: TObject);
68begin
69 inherited;
70 OKPressed := True;
71 Close;
72end;
73
74procedure TfrmHoldOrders.cmdCancelClick(Sender: TObject);
75begin
76 inherited;
77 Close;
78end;
79
80end.
Note: See TracBrowser for help on using the repository browser.