PageRenderTime 9ms CodeModel.GetById 4ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Gedemin/Tax/gdc_frmAccountSel_unit.pas

http://gedemin.googlecode.com/
Pascal | 84 lines | 63 code | 18 blank | 3 comment | 0 complexity | 30a33e49f35d41ccb0ae1039e861eff6 MD5 | raw file
 1unit gdc_frmAccountSel_unit;
 2
 3interface
 4
 5uses
 6  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 7  Db, Grids, DBGrids, gsDBGrid, gsIBGrid, IBCustomDataSet, gdcBase,
 8  gdcContacts, StdCtrls, ExtCtrls, gd_Createable_Form, dmDataBase_unit,
 9  gsIBLookupComboBox, ActnList, gdc_frmAnalyticsSel_unit, gdcConstants;
10
11type
12  TfrmAccountSel = class(TfrmAnalyticSel)
13    procedure actOkExecute(Sender: TObject);
14    procedure actCancelExecute(Sender: TObject);
15  private
16    function GetAccountAlias: String;
17  protected
18    function DefaultListField: string; override;
19    function DefaultListTable: string; override;
20    function DefaultKeyField: string; override;
21    function DefaultCaption: string; override;
22    function DefaultCondition: string; override;
23  public
24    property AccountAlias: String read GetAccountAlias;
25  end;
26
27var
28  frmAccountSel: TfrmAccountSel;
29
30implementation
31
32uses
33  gd_Security;
34
35{$R *.DFM}
36
37{ TfrmAccountSel }
38
39{ TfrmAccountSel }
40
41function TfrmAccountSel.GetAccountAlias: String;
42begin
43  Result := ibcbAnalytics.Text;
44end;
45
46procedure TfrmAccountSel.actOkExecute(Sender: TObject);
47begin
48  ModalResult := mrOk;
49end;
50
51procedure TfrmAccountSel.actCancelExecute(Sender: TObject);
52begin
53  ModalResult := mrCancel;
54end;
55
56function TfrmAccountSel.DefaultCaption: string;
57begin
58  Result := '—???'
59end;
60
61function TfrmAccountSel.DefaultCondition: string;
62begin
63  Result := '(ac.lb > ap.lb and ac.rb < ap.rb) or (ac.lb = ap.lb and ac.rb = ap.rb)';
64end;
65
66function TfrmAccountSel.DefaultKeyField: string;
67begin
68  Result := fnID;
69end;
70
71function TfrmAccountSel.DefaultListField: string;
72begin
73  Result := fnAlias
74end;
75
76function TfrmAccountSel.DefaultListTable: string;
77begin
78  Result :=  'ac_account ac ' +
79    'join ac_companyaccount ca ON ' +
80    GetCompCondition('ca.companykey') + ' and ca.isactive = 1 ' +
81    'join ac_account ap ON ap.id = ca.accountkey';
82end;
83
84end.