/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

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