source: cprs/trunk/CPRS-Chart/Orders/fOrdersComplete.pas@ 730

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

Initial Upload of Official WV CPRS 1.0.26.76

File size: 2.4 KB
Line 
1unit fOrdersComplete;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fAutoSz, StdCtrls, ORFn, ORCtrls;
8
9type
10 TfrmCompleteOrders = class(TfrmAutoSz)
11 Label1: TLabel;
12 lstOrders: TCaptionListBox;
13 cmdOK: TButton;
14 cmdCancel: TButton;
15 lblESCode: TLabel;
16 txtESCode: TCaptionEdit;
17 procedure FormCreate(Sender: TObject);
18 procedure cmdOKClick(Sender: TObject);
19 procedure cmdCancelClick(Sender: TObject);
20 private
21 OKPressed: Boolean;
22 ESCode: string;
23 end;
24
25function ExecuteCompleteOrders(SelectedList: TList): Boolean;
26
27implementation
28
29{$R *.DFM}
30
31uses Hash, rCore, rOrders;
32
33function ExecuteCompleteOrders(SelectedList: TList): Boolean;
34var
35 frmCompleteOrders: TfrmCompleteOrders;
36 i: Integer;
37begin
38 Result := False;
39 if SelectedList.Count = 0 then Exit;
40 frmCompleteOrders := TfrmCompleteOrders.Create(Application);
41 try
42 ResizeFormToFont(TForm(frmCompleteOrders));
43 with SelectedList do for i := 0 to Count - 1 do
44 frmCompleteOrders.lstOrders.Items.Add(TOrder(Items[i]).Text);
45 frmCompleteOrders.ShowModal;
46 if frmCompleteOrders.OKPressed then
47 begin
48 with SelectedList do
49 for i := 0 to Count - 1 do CompleteOrder(TOrder(Items[i]), frmCompleteOrders.ESCode);
50 Result := True;
51 end;
52 finally
53 frmCompleteOrders.Release;
54 with SelectedList do for i := 0 to Count - 1 do UnlockOrder(TOrder(Items[i]).ID);
55 end;
56end;
57
58procedure TfrmCompleteOrders.FormCreate(Sender: TObject);
59begin
60 inherited;
61 OKPressed := False;
62end;
63
64procedure TfrmCompleteOrders.cmdOKClick(Sender: TObject);
65const
66 TX_NO_CODE = 'An electronic signature code must be entered to complete orders.';
67 TC_NO_CODE = 'Electronic Signature Code Required';
68 TX_BAD_CODE = 'The electronic signature code entered is not valid.';
69 TC_BAD_CODE = 'Invalid Electronic Signature Code';
70begin
71 inherited;
72 if Length(txtESCode.Text) = 0 then
73 begin
74 InfoBox(TX_NO_CODE, TC_NO_CODE, MB_OK);
75 Exit;
76 end;
77 if not ValidESCode(txtESCode.Text) then
78 begin
79 InfoBox(TX_BAD_CODE, TC_BAD_CODE, MB_OK);
80 txtESCode.SetFocus;
81 txtESCode.SelectAll;
82 Exit;
83 end;
84 ESCode := Encrypt(txtESCode.Text);
85 OKPressed := True;
86 Close;
87end;
88
89procedure TfrmCompleteOrders.cmdCancelClick(Sender: TObject);
90begin
91 inherited;
92 Close;
93end;
94
95end.
Note: See TracBrowser for help on using the repository browser.