source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fOrdersComplete.pas@ 793

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

Initial upload of TMG-CPRS 1.0.26.69

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