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