source: cprs/branches/foia-cprs/CPRS-Chart/Orders/fOrderFlag.pas@ 701

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

Uploading from OR_30_258

File size: 2.6 KB
Line 
1unit fOrderFlag;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fAutoSz, StdCtrls, ComCtrls, ORFn, rOrders, ORCtrls;
8
9type
10 TfrmFlagOrder = class(TfrmAutoSz)
11 txtReason: TCaptionEdit;
12 Label1: TLabel;
13 cmdOK: TButton;
14 cmdCancel: TButton;
15 memOrder: TMemo;
16 lblAlertRecipient: TLabel;
17 cboAlertRecipient: TORComboBox;
18 procedure FormCreate(Sender: TObject);
19 procedure cmdOKClick(Sender: TObject);
20 procedure cmdCancelClick(Sender: TObject);
21 procedure cboOnExit(Sender: TObject);
22 procedure cboAlertRecipientNeedData(Sender: TObject;
23 const StartFrom: String; Direction, InsertAt: Integer);
24 private
25 OKPressed: Boolean;
26 end;
27
28function ExecuteFlagOrder(AnOrder: TOrder): Boolean;
29
30implementation
31
32{$R *.DFM}
33
34uses uCore, rCore;
35
36var AlertRecip: Int64;
37
38function ExecuteFlagOrder(AnOrder: TOrder): Boolean;
39var
40 frmFlagOrder: TfrmFlagOrder;
41begin
42 Result := False;
43 frmFlagOrder := TfrmFlagOrder.Create(Application);
44 try
45 ResizeFormToFont(TForm(frmFlagOrder));
46 //AlertRecip := User.DUZ;
47 with frmFlagOrder do
48 begin
49 memOrder.SetTextBuf(PChar(AnOrder.Text));
50 ShowModal;
51 if OKPressed then
52 begin
53 FlagOrder(AnOrder, txtReason.Text, AlertRecip);
54 Result := True;
55 end;
56 end;
57 finally
58 frmFlagOrder.Release;
59 AlertRecip := 0;
60 end;
61end;
62
63procedure TfrmFlagOrder.FormCreate(Sender: TObject);
64begin
65 inherited;
66 OKPressed := False;
67 cboAlertRecipient.InitLongList('');
68 //cboAlertRecipient.SelectByIEN(User.DUZ);
69end;
70
71procedure TfrmFlagOrder.cmdOKClick(Sender: TObject);
72const
73 TX_REASON_REQ = 'A reason must be entered to flag an order.';
74 TC_REASON_REQ = 'Reason Required';
75begin
76 inherited;
77 if txtReason.Text = '' then
78 begin
79 InfoBox(TX_REASON_REQ, TC_REASON_REQ, MB_OK);
80 Exit;
81 end;
82 cmdOK.SetFocus;
83 OKPressed := True;
84 Close;
85end;
86
87procedure TfrmFlagOrder.cmdCancelClick(Sender: TObject);
88begin
89 inherited;
90 Close;
91end;
92
93procedure TfrmFlagOrder.cboOnExit(Sender: TObject);
94begin
95 with cboAlertRecipient do
96 if (ItemIndex = -1) or (Text = '') then
97 begin
98 AlertRecip := -1;
99 ItemIndex := -1;
100 Text := '';
101 end
102 else
103 begin
104 AlertRecip := ItemIEN;
105 end;
106end;
107
108procedure TfrmFlagOrder.cboAlertRecipientNeedData(Sender: TObject;
109 const StartFrom: String; Direction, InsertAt: Integer);
110begin
111 cboAlertRecipient.ForDataUse(SubSetOfPersons(StartFrom, Direction));
112end;
113
114end.
Note: See TracBrowser for help on using the repository browser.