source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fOrdersVerify.pas@ 1156

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 5.7 KB
Line 
1//kt -- Modified with SourceScanner on 8/8/2007
2unit fOrdersVerify;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fAutoSz, StdCtrls, ORFn, ORCtrls, ExtCtrls, DKLang;
9
10type
11 TfrmVerifyOrders = class(TfrmAutoSz)
12 Panel1: TPanel;
13 lblVerify: TLabel;
14 lstOrders: TCaptionListBox;
15 Panel2: TPanel;
16 lblESCode: TLabel;
17 txtESCode: TCaptionEdit;
18 cmdOK: TButton;
19 cmdCancel: TButton;
20 procedure FormCreate(Sender: TObject);
21 procedure cmdOKClick(Sender: TObject);
22 procedure cmdCancelClick(Sender: TObject);
23 procedure lstOrdersMeasureItem(Control: TWinControl; Index: Integer;
24 var AHeight: Integer);
25 procedure lstOrdersDrawItem(Control: TWinControl; Index: Integer;
26 Rect: TRect; State: TOwnerDrawState);
27 procedure Panel1Resize(Sender: TObject);
28 private
29 OKPressed: Boolean;
30 ESCode: string;
31 end;
32
33function ExecuteVerifyOrders(SelectedList: TList; ChartReview: Boolean): Boolean;
34
35implementation
36
37{$R *.DFM}
38
39uses Hash, rCore, rOrders;
40
41//const
42//TX_CHART_REVIEW = 'The following orders will be marked as reviewed -'; <-- original line. //kt 8/8/2007
43
44var
45 TX_CHART_REVIEW : string; //kt
46
47
48procedure SetupVars;
49//kt Added entire function to replace constant declarations 8/8/2007
50begin
51 TX_CHART_REVIEW := DKLangConstW('fOrdersVerify_The_following_orders_will_be_marked_as_reviewed_x');
52end;
53
54function ExecuteVerifyOrders(SelectedList: TList; ChartReview: Boolean): Boolean;
55var
56 frmVerifyOrders: TfrmVerifyOrders;
57 i: Integer;
58begin
59 SetupVars; //kt added 8/8/2007 to replace constants with vars.
60 Result := False;
61 if SelectedList.Count = 0 then Exit;
62 frmVerifyOrders := TfrmVerifyOrders.Create(Application);
63 try
64 ResizeFormToFont(TForm(frmVerifyOrders));
65 if ChartReview then
66 begin
67 frmVerifyOrders.lblVerify.Caption := TX_CHART_REVIEW;
68// frmVerifyOrders.Caption := 'Chart Review'; <-- original line. //kt 8/8/2007
69 frmVerifyOrders.Caption := DKLangConstW('fOrdersVerify_Chart_Review'); //kt added 8/8/2007
70 end;
71 with SelectedList do for i := 0 to Count - 1 do
72 frmVerifyOrders.lstOrders.Items.Add(TOrder(Items[i]).Text);
73 frmVerifyOrders.ShowModal;
74 if frmVerifyOrders.OKPressed then
75 begin
76 with SelectedList do for i := 0 to Count - 1 do
77 begin
78 if ChartReview
79 then VerifyOrderChartReview(TOrder(Items[i]), frmVerifyOrders.ESCode)
80 else VerifyOrder(TOrder(Items[i]), frmVerifyOrders.ESCode);
81 end;
82 Result := True;
83 end;
84 finally
85 frmVerifyOrders.Release;
86 with SelectedList do for i := 0 to Count - 1 do UnlockOrder(TOrder(Items[i]).ID);
87 end;
88end;
89
90procedure TfrmVerifyOrders.FormCreate(Sender: TObject);
91begin
92 inherited;
93 OKPressed := False;
94end;
95
96procedure TfrmVerifyOrders.cmdOKClick(Sender: TObject);
97//const
98//TX_NO_CODE = 'An electronic signature code must be entered to verify orders.'; <-- original line. //kt 8/8/2007
99//TC_NO_CODE = 'Electronic Signature Code Required'; <-- original line. //kt 8/8/2007
100//TX_BAD_CODE = 'The electronic signature code entered is not valid.'; <-- original line. //kt 8/8/2007
101//TC_BAD_CODE = 'Invalid Electronic Signature Code'; <-- original line. //kt 8/8/2007
102
103var
104 TX_NO_CODE : string; //kt
105 TC_NO_CODE : string; //kt
106 TX_BAD_CODE : string; //kt
107 TC_BAD_CODE : string; //kt
108
109begin
110 inherited;
111 TX_NO_CODE := DKLangConstW('fOrdersVerify_An_electronic_signature_code_must_be_entered_to_verify_ordersx'); //kt added 8/8/2007
112 TC_NO_CODE := DKLangConstW('fOrdersVerify_Electronic_Signature_Code_Required'); //kt added 8/8/2007
113 TX_BAD_CODE := DKLangConstW('fOrdersVerify_The_electronic_signature_code_entered_is_not_validx'); //kt added 8/8/2007
114 TC_BAD_CODE := DKLangConstW('fOrdersVerify_Invalid_Electronic_Signature_Code'); //kt added 8/8/2007
115 if Length(txtESCode.Text) = 0 then
116 begin
117 InfoBox(TX_NO_CODE, TC_NO_CODE, MB_OK);
118 Exit;
119 end;
120 if not ValidESCode(txtESCode.Text) then
121 begin
122 InfoBox(TX_BAD_CODE, TC_BAD_CODE, MB_OK);
123 txtESCode.SetFocus;
124 txtESCode.SelectAll;
125 Exit;
126 end;
127 ESCode := Encrypt(txtESCode.Text);
128 OKPressed := True;
129 Close;
130end;
131
132procedure TfrmVerifyOrders.cmdCancelClick(Sender: TObject);
133begin
134 inherited;
135 Close;
136end;
137
138
139
140procedure TfrmVerifyOrders.lstOrdersMeasureItem(Control: TWinControl;
141 Index: Integer; var AHeight: Integer);
142var
143 x: string;
144 ARect: TRect;
145begin
146 inherited;
147 with lstOrders do if Index < Items.Count then
148 begin
149 ARect := ItemRect(Index);
150 Canvas.FillRect(ARect);
151 x := FilteredString(Items[Index]);
152 AHeight := WrappedTextHeightByFont(Canvas, Font, x, ARect);
153 //if AHeight > 255 then AHeight := 255;
154 if AHeight < 13 then AHeight := 15;
155 end;
156end;
157
158procedure TfrmVerifyOrders.lstOrdersDrawItem(Control: TWinControl;
159 Index: Integer; Rect: TRect; State: TOwnerDrawState);
160var
161 x: string;
162 ARect: TRect;
163 SaveColor: TColor;
164begin
165 inherited;
166 with lstOrders do
167 begin
168 ARect := Rect;
169 ARect.Left := ARect.Left + 2;
170 Canvas.FillRect(ARect);
171 Canvas.Pen.Color := clSilver;
172 SaveColor := Canvas.Brush.Color;
173 Canvas.MoveTo(ARect.Left, ARect.Bottom - 1);
174 Canvas.LineTo(ARect.Right, ARect.Bottom - 1);
175 if Index < Items.Count then
176 begin
177 x := FilteredString(Items[Index]);
178 DrawText(Canvas.Handle, PChar(x), Length(x), ARect, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK);
179 Canvas.Brush.Color := SaveColor;
180 ARect.Right := ARect.Right + 4;
181 end;
182 end;
183end;
184
185procedure TfrmVerifyOrders.Panel1Resize(Sender: TObject);
186begin
187 inherited;
188 lstOrders.Invalidate;
189end;
190
191end.
Note: See TracBrowser for help on using the repository browser.