123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- unit ProjectGLFme;
- interface
- uses
- ProjectGLDm,
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, sdGridDBA, ZJGrid, dxBar, ActnList;
- type
- TProjectGLFrame = class(TFrame)
- zgProjectGL: TZJGrid;
- saProjectGL: TsdGridDBA;
- dxpmProjectGL: TdxBarPopupMenu;
- actnProjectGL: TActionList;
- actnCalculatePriceMargin: TAction;
- procedure zgProjectGLMouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure dxpmProjectGLPopup(Sender: TObject);
- procedure actnCalculatePriceMarginExecute(Sender: TObject);
- private
- FProjectGLData: TProjectGLData;
- public
- constructor Create(AProjectGLData: TProjectGLData);
- destructor Destroy; override;
- procedure ResetViewControl;
- end;
- implementation
- uses
- ProjectData, MainFrm, UtilMethods;
- {$R *.dfm}
- { TProjectGLFrame }
- constructor TProjectGLFrame.Create(AProjectGLData: TProjectGLData);
- begin
- inherited Create(nil);
- FProjectGLData := AProjectGLData;
- saProjectGL.DataView := FProjectGLData.sdvProjectGL;
- ResetViewControl;
- end;
- destructor TProjectGLFrame.Destroy;
- begin
- inherited;
- end;
- procedure TProjectGLFrame.ResetViewControl;
- begin
- with TProjectData(FProjectGLData.ProjectData) do
- begin
- saProjectGL.Columns.ColumnByName('InfoPrice').ReadOnly := PriceMarginReadOnly;
- saProjectGL.Columns.ColumnByName('InfoDate').ReadOnly := PriceMarginReadOnly;
- end;
- end;
- procedure TProjectGLFrame.zgProjectGLMouseDown(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- if Button = mbRight then
- dxpmProjectGL.PopupFromCursorPos;
- end;
- procedure TProjectGLFrame.dxpmProjectGLPopup(Sender: TObject);
- begin
- SetDxBtnAction(actnCalculatePriceMargin, MainForm.dxbtnCalculatePriceMargin);
- end;
- procedure TProjectGLFrame.actnCalculatePriceMarginExecute(Sender: TObject);
- begin
- if TProjectData(FProjectGLData.ProjectData).PhaseData.StageDataReadOnly then
- TipMessage('历史数据不可重新计算。')
- else
- TProjectData(FProjectGLData.ProjectData).CalculatePriceMargin;
- end;
- end.
|