PriceMarginFme.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. unit PriceMarginFme;
  2. interface
  3. uses
  4. ProjectGLFme, PriceMarginBillsFme,
  5. ProjectData,
  6. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7. Dialogs, ExtCtrls, JimPages, ComCtrls, ToolWin, XPMenu;
  8. type
  9. TPriceMarginFrame = class(TFrame)
  10. pnlTopTag: TPanel;
  11. tbTopTag: TToolBar;
  12. tobtnBills: TToolButton;
  13. tobtnGL: TToolButton;
  14. jpsPriceMargin: TJimPages;
  15. jpsPriceMarginBills: TJimPage;
  16. jpsPriceMarginGL: TJimPage;
  17. xpm: TXPMenu;
  18. procedure tobtnBillsClick(Sender: TObject);
  19. private
  20. FProjectData: TProjectData;
  21. FProjectGLFrame: TProjectGLFrame;
  22. FPriceMarginBillsFrame: TPriceMarginBillsFrame;
  23. public
  24. constructor Create(AProjectData: TProjectData);
  25. destructor Destroy; override;
  26. procedure RefreshBills;
  27. procedure ResetViewControl;
  28. end;
  29. implementation
  30. uses
  31. UtilMethods;
  32. {$R *.dfm}
  33. { TPriceMarginFrame }
  34. constructor TPriceMarginFrame.Create(AProjectData: TProjectData);
  35. begin
  36. inherited Create(nil);
  37. FProjectData := AProjectData;
  38. FProjectGLFrame := TProjectGLFrame.Create(FProjectData.ProjectGLData);
  39. AlignControl(FProjectGLFrame, jpsPriceMarginGL, alClient);
  40. FPriceMarginBillsFrame := TPriceMarginBillsFrame.Create(FProjectData.PriceMarginBillsData);
  41. AlignControl(FPriceMarginBillsFrame, jpsPriceMarginBills, alClient);
  42. end;
  43. destructor TPriceMarginFrame.Destroy;
  44. begin
  45. FPriceMarginBillsFrame.Free;
  46. FProjectGLFrame.Free;
  47. inherited;
  48. end;
  49. procedure TPriceMarginFrame.RefreshBills;
  50. begin
  51. FProjectData.PriceMarginBillsData.RefreshBills;
  52. end;
  53. procedure TPriceMarginFrame.ResetViewControl;
  54. begin
  55. FProjectGLFrame.ResetViewControl;
  56. FPriceMarginBillsFrame.ResetViewControl;
  57. end;
  58. procedure TPriceMarginFrame.tobtnBillsClick(Sender: TObject);
  59. begin
  60. tobtnGL.Down := tobtnGL.Tag = TToolButton(Sender).Tag;
  61. tobtnBills.Down := tobtnBills.Tag = TToolButton(Sender).Tag;
  62. jpsPriceMargin.ActivePageIndex := TToolButton(Sender).Tag;
  63. end;
  64. end.