|
@@ -4,6 +4,7 @@ interface
|
|
|
|
|
|
uses
|
|
|
BillsMeasureDm, UtilMethods, BillsClipboard, sdIDTreeCells,
|
|
|
+ ColVisibleManager,
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, ZJGrid, ComCtrls, ToolWin, StdCtrls, ExtCtrls, sdGridDBA,
|
|
|
sdGridTreeDBA, sdDB, ActnList, dxBar, sdIDTree, JimLabels;
|
|
@@ -24,6 +25,9 @@ type
|
|
|
pnlDealProperty: TPanel;
|
|
|
labDealPropertyTitle: TJimGradLabel;
|
|
|
zgDealProperty: TZJGrid;
|
|
|
+ dxpmBillsCol: TdxBarPopupMenu;
|
|
|
+ actnHiddenCol: TAction;
|
|
|
+ actnCancelHiddenCol: TAction;
|
|
|
procedure dxpmBillsPopup(Sender: TObject);
|
|
|
procedure zgBillsMeasureMouseDown(Sender: TObject; Button: TMouseButton;
|
|
|
Shift: TShiftState; X, Y: Integer);
|
|
@@ -50,6 +54,9 @@ type
|
|
|
procedure zgDealPropertyCellCanEdit(Sender: TObject;
|
|
|
const ACoord: TPoint; var Allow: Boolean);
|
|
|
procedure actnSetStageBookmarkUpdate(Sender: TObject);
|
|
|
+ procedure dxpmBillsColPopup(Sender: TObject);
|
|
|
+ procedure actnHiddenColExecute(Sender: TObject);
|
|
|
+ procedure actnCancelHiddenColExecute(Sender: TObject);
|
|
|
private
|
|
|
FBillsMeasureData: TBillsMeasureData;
|
|
|
FShowPriceChange: Boolean;
|
|
@@ -60,8 +67,13 @@ type
|
|
|
FOnAfterSetBookmark: TBookmarkRefreshEvent;
|
|
|
FShowAlias: Boolean;
|
|
|
|
|
|
+ FColVisibleManager: TBM_ColVisibleManager;
|
|
|
+
|
|
|
procedure ExpandMouseDown(AGridCell: TzjCell);
|
|
|
|
|
|
+ function GridColToDBACol(AGridCol: Integer): Integer;
|
|
|
+ procedure ShowGridCols(AShow: Boolean; ALeft, ARight: Integer);
|
|
|
+
|
|
|
function CheckExprsColumn: Boolean;
|
|
|
|
|
|
procedure SetColumnVisible(const AColumn: string; AVisible: Boolean);
|
|
@@ -106,7 +118,7 @@ implementation
|
|
|
|
|
|
uses
|
|
|
MainFrm, ProjectFme, ProjectData, ExportExcel, BGLDm, BGLSelectFrm,
|
|
|
- Types, ZhAPI, BillsTree, mDataRecord;
|
|
|
+ Types, ZhAPI, BillsTree, mDataRecord, ConstUnit;
|
|
|
|
|
|
{ TBillsFrame }
|
|
|
|
|
@@ -117,10 +129,13 @@ begin
|
|
|
FBillsMeasureData := ABillsMeasureData;
|
|
|
stdBillsMeasure.IDTree := FBillsMeasureData.BillsMeasureTree;
|
|
|
zgBillsMeasure.OnExpandMouseDown := ExpandMouseDown;
|
|
|
+
|
|
|
+ FColVisibleManager := TBM_ColVisibleManager.Create(stdBillsMeasure.Columns);
|
|
|
end;
|
|
|
|
|
|
destructor TBillsMeasureFrame.Destroy;
|
|
|
begin
|
|
|
+ FColVisibleManager.Free;
|
|
|
inherited;
|
|
|
end;
|
|
|
|
|
@@ -138,7 +153,12 @@ var
|
|
|
vViewCol: TsdViewColumn;
|
|
|
begin
|
|
|
if Button = mbRight then
|
|
|
- dxpmBills.PopupFromCursorPos
|
|
|
+ begin
|
|
|
+ if G_IsTest and (zgBillsMeasure.Selection.SelectType = stCol) and (Y < (zgBillsMeasure.RowHeights[0] + zgBillsMeasure.RowHeights[1])) then
|
|
|
+ dxpmBillsCol.PopupFromCursorPos
|
|
|
+ else
|
|
|
+ dxpmBills.PopupFromCursorPos;
|
|
|
+ end
|
|
|
else
|
|
|
begin
|
|
|
if CheckExprsColumn then
|
|
@@ -153,14 +173,7 @@ end;
|
|
|
procedure TBillsMeasureFrame.SetShowPriceChange(const Value: Boolean);
|
|
|
begin
|
|
|
FShowPriceChange := Value;
|
|
|
- stdBillsMeasure.Column('NewPrice').Visible := FShowPriceChange;
|
|
|
- stdBillsMeasure.Column('CurPcQuantity').Visible := FShowPriceChange;
|
|
|
- stdBillsMeasure.Column('CurPcTotalPrice').Visible := FShowPriceChange;
|
|
|
- stdBillsMeasure.Column('CurPcBGLCode').Visible := FShowBGLCode and FShowPriceChange;
|
|
|
- stdBillsMeasure.Column('EndPcQuantity').Visible := FShowPriceChange;
|
|
|
- stdBillsMeasure.Column('EndPcTotalPrice').Visible := FShowPriceChange;
|
|
|
- stdBillsMeasure.Column('AddPcQuantity').Visible := FShowPriceChange;
|
|
|
- stdBillsMeasure.Column('AddPcTotalPrice').Visible := FShowPriceChange;
|
|
|
+ FColVisibleManager.ShowPriceChange(FShowPriceChange);
|
|
|
end;
|
|
|
|
|
|
procedure TBillsMeasureFrame.laEdtExprsKeyDown(Sender: TObject; var Key: Word;
|
|
@@ -249,16 +262,7 @@ end;
|
|
|
procedure TBillsMeasureFrame.SetShowBGLCode(const Value: Boolean);
|
|
|
begin
|
|
|
FShowBGLCode := Value;
|
|
|
- if FShowBGLCode then
|
|
|
- stdBillsMeasure.Column('CurQcQuantity').Title.CaptionAcrossCols := '3'
|
|
|
- else
|
|
|
- stdBillsMeasure.Column('CurQcQuantity').Title.CaptionAcrossCols := '2';
|
|
|
- stdBillsMeasure.Column('CurQcBGLCode').Visible := FShowBGLCode;
|
|
|
- if FShowBGLCode then
|
|
|
- stdBillsMeasure.Column('CurPcQuantity').Title.CaptionAcrossCols := '3'
|
|
|
- else
|
|
|
- stdBillsMeasure.Column('CurPcQuantity').Title.CaptionAcrossCols := '2';
|
|
|
- stdBillsMeasure.Column('CurPcBGLCode').Visible := FShowBGLCode and FShowPriceChange;
|
|
|
+ FColVisibleManager.ShowBGLCode(FShowBGLCode);
|
|
|
end;
|
|
|
|
|
|
procedure TBillsMeasureFrame.actnExportGridToExcelExecute(Sender: TObject);
|
|
@@ -382,11 +386,7 @@ end;
|
|
|
procedure TBillsMeasureFrame.SetShowDesignQuantity(const Value: Boolean);
|
|
|
begin
|
|
|
FShowDesignQuantity := Value;
|
|
|
- stdBillsMeasure.Column('DealDgnQuantity1').Visible := FShowDesignQuantity;
|
|
|
- stdBillsMeasure.Column('DealDgnQuantity2').Visible := FShowDesignQuantity;
|
|
|
- stdBillsMeasure.Column('CDgnQuantity1').Visible := FShowDesignQuantity;
|
|
|
- stdBillsMeasure.Column('CDgnQuantity2').Visible := FShowDesignQuantity;
|
|
|
- stdBillsMeasure.Column('AddDgnPrice').Visible := FShowDesignQuantity;
|
|
|
+ FColVisibleManager.ShowDesign(FShowDesignQuantity);
|
|
|
end;
|
|
|
|
|
|
procedure TBillsMeasureFrame.SetAddFieldVisible(AValue: Boolean);
|
|
@@ -559,7 +559,7 @@ end;
|
|
|
procedure TBillsMeasureFrame.SetShowAlias(const Value: Boolean);
|
|
|
begin
|
|
|
FShowAlias := Value;
|
|
|
- stdBillsMeasure.Column('Alias').Visible := FShowAlias;
|
|
|
+ FColVisibleManager.ShowAlias(FShowAlias);
|
|
|
end;
|
|
|
|
|
|
procedure TBillsMeasureFrame.actnSetStageBookmarkUpdate(Sender: TObject);
|
|
@@ -691,4 +691,52 @@ begin
|
|
|
CommonExpand(stnNode);
|
|
|
end;
|
|
|
|
|
|
+procedure TBillsMeasureFrame.dxpmBillsColPopup(Sender: TObject);
|
|
|
+begin
|
|
|
+ SetDxBtnAction(actnHiddenCol, MainForm.dxbtnHidden);
|
|
|
+ SetDxBtnAction(actnCancelHiddenCol, MainForm.dxbtnCancelHidden);
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TBillsMeasureFrame.actnHiddenColExecute(Sender: TObject);
|
|
|
+begin
|
|
|
+ ShowGridCols(False, zgBillsMeasure.Selection.Left, zgBillsMeasure.Selection.Right-1);
|
|
|
+end;
|
|
|
+
|
|
|
+function TBillsMeasureFrame.GridColToDBACol(AGridCol: Integer): Integer;
|
|
|
+var
|
|
|
+ iCol, iVisibleCount: Integer;
|
|
|
+begin
|
|
|
+ Result := -1;
|
|
|
+ if AGridCol > stdBillsMeasure.VisibleColCount then Exit;
|
|
|
+
|
|
|
+ iVisibleCount := 0;
|
|
|
+ for iCol := 0 to stdBillsMeasure.Columns.Count - 1 do
|
|
|
+ begin
|
|
|
+ if stdBillsMeasure.Columns.Items[iCol].Visible then
|
|
|
+ begin
|
|
|
+ Inc(iVisibleCount);
|
|
|
+ if iVisibleCount = AGridCol then
|
|
|
+ begin
|
|
|
+ Result := iCol;
|
|
|
+ Break;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TBillsMeasureFrame.actnCancelHiddenColExecute(Sender: TObject);
|
|
|
+begin
|
|
|
+ ShowGridCols(True, zgBillsMeasure.Selection.Left, zgBillsMeasure.Selection.Right-1);
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TBillsMeasureFrame.ShowGridCols(AShow: Boolean; ALeft,
|
|
|
+ ARight: Integer);
|
|
|
+var
|
|
|
+ iCol, iBegin, iEnd: Integer;
|
|
|
+begin
|
|
|
+ iBegin := GridColToDBACol(ALeft);
|
|
|
+ iEnd := GridColToDBACol(ARight);
|
|
|
+ FColVisibleManager.ShowGridCol(AShow, iBegin, iEnd);
|
|
|
+end;
|
|
|
+
|
|
|
end.
|