123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- unit ProjectGLFme;
- // 2016.8.18 真的是理解不来这家公司,看在钱的面子上,拿人钱财替人消灾。
- 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;
- saGather: TsdGridDBA;
- zgGather: TZJGrid;
- 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;
- saGather.DataView := FProjectGLData.sdvGather;
- ResetViewControl;
- end;
- destructor TProjectGLFrame.Destroy;
- begin
- inherited;
- end;
- procedure TProjectGLFrame.ResetViewControl;
- var
- AReadOnly: Boolean;
- begin
- with TProjectData(FProjectGLData.ProjectData) do
- AReadOnly := PriceMarginReadOnly;
- saProjectGL.Columns.ColumnByName('Code').ReadOnly := AReadOnly;
- saProjectGL.Columns.ColumnByName('Name').ReadOnly := AReadOnly;
- saProjectGL.Columns.ColumnByName('Units').ReadOnly := AReadOnly;
- saProjectGL.Columns.ColumnByName('Specs').ReadOnly := AReadOnly;
- saProjectGL.Columns.ColumnByName('BasePrice').ReadOnly := AReadOnly;
- saProjectGL.Columns.ColumnByName('RiskRange').ReadOnly := AReadOnly;
- saProjectGL.Columns.ColumnByName('InfoPrice').ReadOnly := AReadOnly;
- saProjectGL.Columns.ColumnByName('InfoDate').ReadOnly := AReadOnly;
- if AReadOnly then
- saProjectGL.Options := saProjectGL.Options - [aoAllowInsert, aoAllowDelete]
- else
- saProjectGL.Options := saProjectGL.Options + [aoAllowInsert, aoAllowDelete];
- 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.
|