MaiXinRong 9 лет назад
Родитель
Сommit
83531fc3d2

+ 68 - 1
DataModules/LeafXmjGlDm.pas

@@ -220,6 +220,73 @@ procedure TLeafXmjGlData.RefreshLeafXmj;
       Result := False;
   end;
 
+  function CheckFilterLeafXmj(ANode: TBillsIDTreeNode): Boolean;
+
+    function CheckExist: Boolean;
+    begin
+      Result := Assigned(sddLeafXmjGL.FindKey('idxXmj', ANode.ID));
+    end;
+
+    function CheckCur: Boolean;
+    var
+      vIdx: TsdIndex;
+      iRec, iBegin, iEnd: Integer;
+      Rec: TLeafXmjGlRecord;
+      StageRec: TStageLeafXmjGlRecord;
+    begin
+      Result := False;
+      vIdx := sddLeafXmjGL.FindIndex('idxXmj');
+      iBegin := vIdx.FindKeyIndex(ANode.ID);
+      iEnd := vIdx.FindKeyLastIndex(ANode.ID);
+      if iBegin >= 0 then
+      begin
+        for iRec := iBegin to iEnd do
+        begin
+          Rec := TLeafXmjGlRecord(vIdx.Records[iRec]);
+          StageRec := TStageLeafXmjGlRecord(Rec.StageRec);
+          if Assigned(StageRec) and (StageRec.Quantity.AsFloat <> 0) then
+          begin
+            Result := True;
+            Break;
+          end;
+        end;
+      end;
+    end;
+
+    function CheckEnd: Boolean;
+    var
+      vIdx: TsdIndex;
+      iRec, iBegin, iEnd: Integer;
+      Rec: TLeafXmjGlRecord;
+      StageRec: TStageLeafXmjGlRecord;
+    begin
+      Result := False;
+      vIdx := sddLeafXmjGL.FindIndex('idxXmj');
+      iBegin := vIdx.FindKeyIndex(ANode.ID);
+      iEnd := vIdx.FindKeyLastIndex(ANode.ID);
+      if iBegin >= 0 then
+      begin
+        for iRec := iBegin to iEnd do
+        begin
+          Rec := TLeafXmjGlRecord(vIdx.Records[iRec]);
+          StageRec := TStageLeafXmjGlRecord(Rec.StageRec);
+          if Assigned(StageRec) and (StageRec.EndQuantity.AsFloat <> 0) then
+          begin
+            Result := True;
+            Break;
+          end;
+        end;
+      end;
+    end;
+
+  begin
+    case TProjectData(FProjectData).ProjProperties.LeafXmjGlFilterType of
+      0: Result := CheckExist;
+      1: Result := CheckCur;
+      2: Result := CheckEnd;
+    end;
+  end;
+
   function GetPegNode(ANode: TBillsIDTreeNode): TBillsIDTreeNode;
   begin
     Result := nil;
@@ -270,7 +337,7 @@ begin
       for iNode := 0 to BillsCompileTree.Count - 1 do
       begin
         vNode := TBillsIDTreeNode(BillsCompileTree.Items[iNode]);
-        if CheckLeafXmj(vNode) then
+        if CheckLeafXmj(vNode) and CheckFilterLeafXmj(vNode) then
           AddLeafXmj(vNode, iNode);
       end;
     end;

+ 48 - 12
Forms/MainFrm.dfm

@@ -21,7 +21,7 @@ object MainForm: TMainForm
   object jtsProjects: TJimTabSet
     Left = 0
     Top = 49
-    Width = 734
+    Width = 742
     Height = 21
     Align = alTop
     BackgroundColor = clGradientInactiveCaption
@@ -45,8 +45,8 @@ object MainForm: TMainForm
   end
   object dxStatusBar: TdxStatusBar
     Left = 0
-    Top = 480
-    Width = 734
+    Top = 487
+    Width = 742
     Height = 20
     Panels = <
       item
@@ -78,12 +78,12 @@ object MainForm: TMainForm
     object dxStatusBarContainer2: TdxStatusBarContainerControl
       Left = 604
       Top = 2
-      Width = 128
+      Width = 136
       Height = 16
       object ProgressBar: TProgressBar
         Left = 0
         Top = 0
-        Width = 128
+        Width = 136
         Height = 16
         Align = alClient
         Max = 200
@@ -94,8 +94,8 @@ object MainForm: TMainForm
   object jpsMain: TJimPages
     Left = 0
     Top = 70
-    Width = 734
-    Height = 410
+    Width = 742
+    Height = 417
     ActivePage = jpsMainProjectsManager
     ActivePageIndex = 0
     Align = alClient
@@ -103,8 +103,8 @@ object MainForm: TMainForm
     object jpsMainProjectsManager: TJimPage
       Left = 0
       Top = 0
-      Width = 734
-      Height = 410
+      Width = 742
+      Height = 417
       TabName = 'ProjectsManager'
       Caption = 'ProjsMgr'
       object pnlUser: TPanel
@@ -201,8 +201,8 @@ object MainForm: TMainForm
     object jpsMainProjects: TJimPage
       Left = 0
       Top = 0
-      Width = 734
-      Height = 410
+      Width = 742
+      Height = 417
       TabName = 'Projects'
       Caption = 'Projects'
       object jpsProjects: TJimPages
@@ -220,7 +220,7 @@ object MainForm: TMainForm
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Height = -12
-    Font.Name = #24494#36719#38597#40657
+    Font.Name = 'Microsoft YaHei UI'
     Font.Style = []
     Bars = <
       item
@@ -1065,6 +1065,42 @@ object MainForm: TMainForm
       Hint = #20572#29992'/'#21551#29992
       Visible = ivAlways
     end
+    object dxbtnFilterLeafXmj: TdxBarSubItem
+      Caption = #31579#36873#26174#31034
+      Category = 0
+      Visible = ivAlways
+      ItemLinks = <
+        item
+          Item = dxbtnWithoutFilter
+          Visible = True
+        end
+        item
+          Item = dxbtnFilterCur
+          Visible = True
+        end
+        item
+          Item = dxbtnFilterEnd
+          Visible = True
+        end>
+    end
+    object dxbtnFilterCur: TdxBarButton
+      Caption = #21482#26174#31034#26412#26399
+      Category = 0
+      Hint = #21482#26174#31034#26412#26399
+      Visible = ivAlways
+    end
+    object dxbtnFilterEnd: TdxBarButton
+      Caption = #21482#26174#31034#25130#33267#26412#26399
+      Category = 0
+      Hint = #21482#26174#31034#25130#33267#26412#26399
+      Visible = ivAlways
+    end
+    object dxbtnWithoutFilter: TdxBarButton
+      Caption = #26174#31034#20840#37096
+      Category = 0
+      Hint = #26174#31034#20840#37096
+      Visible = ivAlways
+    end
   end
   object Images: TImageList
     DrawingStyle = dsTransparent

+ 4 - 0
Forms/MainFrm.pas

@@ -159,6 +159,10 @@ type
     dxbtnImportDmf: TdxBarButton;
     actnImportDmf: TAction;
     dxbtnCanCalc: TdxBarButton;
+    dxbtnFilterLeafXmj: TdxBarSubItem;
+    dxbtnFilterCur: TdxBarButton;
+    dxbtnFilterEnd: TdxBarButton;
+    dxbtnWithoutFilter: TdxBarButton;
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;

+ 35 - 0
Frames/LeafXmjGlFme.dfm

@@ -21,6 +21,7 @@ object LeafXmjGlFrame: TLeafXmjGlFrame
     Selection.TransparentColor = False
     FrozenCol = 0
     FrozenRow = 0
+    OnMouseDown = zgLeafXmjMouseDown
     Align = alClient
   end
   object pnlGL: TPanel
@@ -503,4 +504,38 @@ object LeafXmjGlFrame: TLeafXmjGlFrame
     Left = 264
     Top = 472
   end
+  object dxpmLeafXmj: TdxBarPopupMenu
+    BarManager = MainForm.dxBarManager
+    ItemLinks = <
+      item
+        Item = MainForm.dxbtnFilterLeafXmj
+        Visible = True
+      end>
+    UseOwnFont = False
+    OnPopup = dxpmLeafXmjPopup
+    Left = 344
+    Top = 56
+  end
+  object alLeafXmjGl: TActionList
+    Images = MainForm.Images
+    Left = 408
+    Top = 56
+    object actnFilterCur: TAction
+      Tag = 1
+      Caption = #21482#26174#31034#26412#26399
+      OnExecute = actnFilterCurExecute
+      OnUpdate = actnFilterCurUpdate
+    end
+    object actnFilterEnd: TAction
+      Tag = 2
+      Caption = #21482#26174#31034#25130#33267#26412#26399
+      OnExecute = actnFilterCurExecute
+      OnUpdate = actnFilterCurUpdate
+    end
+    object actnWithoutFilter: TAction
+      Caption = #26174#31034#20840#37096
+      OnExecute = actnFilterCurExecute
+      OnUpdate = actnFilterCurUpdate
+    end
+  end
 end

+ 47 - 2
Frames/LeafXmjGlFme.pas

@@ -5,7 +5,8 @@ interface
 uses
   LeafXmjGlDm,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
-  Dialogs, XPMenu, ComCtrls, ToolWin, sdGridDBA, ExtCtrls, ZJGrid;
+  Dialogs, XPMenu, ComCtrls, ToolWin, sdGridDBA, ExtCtrls, ZJGrid,
+  ActnList, dxBar;
 
 type
   TLeafXmjGlFrame = class(TFrame)
@@ -18,6 +19,16 @@ type
     xpm: TXPMenu;
     zgLeafXmjGL: TZJGrid;
     saLeafXmjGL: TsdGridDBA;
+    dxpmLeafXmj: TdxBarPopupMenu;
+    alLeafXmjGl: TActionList;
+    actnFilterCur: TAction;
+    actnFilterEnd: TAction;
+    actnWithoutFilter: TAction;
+    procedure dxpmLeafXmjPopup(Sender: TObject);
+    procedure actnFilterCurUpdate(Sender: TObject);
+    procedure actnFilterCurExecute(Sender: TObject);
+    procedure zgLeafXmjMouseDown(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
   private
     FLeafXmjGlData: TLeafXmjGlData;
   public
@@ -30,7 +41,7 @@ type
 implementation
 
 uses
-  ProjectData;
+  ProjectData, UtilMethods, MainFrm;
 
 {$R *.dfm}
 
@@ -55,4 +66,38 @@ begin
     saLeafXmjGL.Columns.ColumnByName('UsedQuantity').ReadOnly := StageDataReadOnly;
 end;
 
+procedure TLeafXmjGlFrame.dxpmLeafXmjPopup(Sender: TObject);
+begin
+  SetDxBtnAction(actnWithoutFilter, MainForm.dxbtnWithoutFilter);
+  SetDxBtnAction(actnFilterCur, MainForm.dxbtnFilterCur);
+  SetDxBtnAction(actnFilterEnd, MainForm.dxbtnFilterEnd);
+end;
+
+procedure TLeafXmjGlFrame.actnFilterCurUpdate(Sender: TObject);
+begin
+  if TProjectData(FLeafXmjGlData.ProjectData).ProjProperties.LeafXmjGlFilterType = TAction(Sender).Tag then
+  begin
+    if TAction(Sender).ImageIndex <> 43 then
+      TAction(Sender).ImageIndex := 43;
+  end
+  else
+  begin
+    if TAction(Sender).ImageIndex <> -1 then
+      TAction(Sender).ImageIndex := -1;
+  end;
+end;
+
+procedure TLeafXmjGlFrame.actnFilterCurExecute(Sender: TObject);
+begin
+  TProjectData(FLeafXmjGlData.ProjectData).ProjProperties.LeafXmjGlFilterType := TAction(Sender).Tag;
+  FLeafXmjGlData.RefreshLeafXmj;
+end;
+
+procedure TLeafXmjGlFrame.zgLeafXmjMouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+begin
+  if Button = mbRight then
+    dxpmLeafXmj.PopupFromCursorPos;
+end;
+
 end.

+ 11 - 5
Frames/PriceMarginFme.dfm

@@ -3,6 +3,12 @@ object PriceMarginFrame: TPriceMarginFrame
   Top = 0
   Width = 1109
   Height = 591
+  Font.Charset = ANSI_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -12
+  Font.Name = #23435#20307
+  Font.Style = []
+  ParentFont = False
   TabOrder = 0
   object pnlTopTag: TPanel
     Left = 0
@@ -15,12 +21,12 @@ object PriceMarginFrame: TPriceMarginFrame
     object tbTopTag: TToolBar
       Left = 0
       Top = 0
-      Width = 273
+      Width = 309
       Height = 21
       Align = alLeft
       AutoSize = True
-      ButtonHeight = 21
-      ButtonWidth = 91
+      ButtonHeight = 20
+      ButtonWidth = 103
       EdgeBorders = []
       Flat = True
       ShowCaptions = True
@@ -36,7 +42,7 @@ object PriceMarginFrame: TPriceMarginFrame
       end
       object tobtnBills: TToolButton
         Tag = 1
-        Left = 91
+        Left = 103
         Top = 0
         Caption = ' '#28165#21333#27719#24635' '
         ImageIndex = 0
@@ -45,7 +51,7 @@ object PriceMarginFrame: TPriceMarginFrame
       end
       object tobtnLeafXmj: TToolButton
         Tag = 2
-        Left = 182
+        Left = 206
         Top = 0
         Caption = '  '#20998#37096#20998#39033#24037#26009'  '
         ImageIndex = 1

+ 13 - 0
Units/ProjectProperty.pas

@@ -79,6 +79,7 @@ type
     FReportShading: string;
     FBaseline: string;
     FDeadline: string;
+    FLeafXmjGlFilterType: Integer;
 
     function GetBoolPropertyDef(const AName: string; ADef: Boolean): Boolean;
     function GetIntPropertyDef(const AName: string; ADef: Integer): Integer;
@@ -124,6 +125,7 @@ type
     procedure SetShowReportShading(const Value: Boolean);
     procedure SetBaseline(const Value: string);
     procedure SetDeadline(const Value: string);
+    procedure SetleafXmjGlFilterType(const Value: Integer);
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
@@ -226,6 +228,9 @@ type
     property ShowDesignQuantity: Boolean read FShowDesignQuantity write SetShowDesignQuantity;
     property ShowAlias: Boolean read FShowAlias write SetShowAlias;
 
+    // 0: 是否存在工料 1: 本期 2: 截至本期
+    property LeafXmjGlFilterType: Integer read FLeafXmjGlFilterType write SetleafXmjGlFilterType;
+
     property ShowReportShading: Boolean read FShowReportShading write SetShowReportShading;
     property ReportShading: string read FReportShading write SetReportShading;
   end;
@@ -494,6 +499,8 @@ begin
   FShowDesignQuantity := GetBoolPropertyDef('ShowDesignQuantity', False);
   FShowAlias := GetBoolPropertyDef('ShowAlias', False);
 
+  FLeafXmjGlFilterType := GetIntPropertyDef('LeafXmjGlFilterType', 0);
+
   FShowReportShading := GetBoolPropertyDef('ShowReportShading', False);
   FReportShading := GetStrPropertyDef('ReportShading', '');
 end;
@@ -602,6 +609,12 @@ begin
   FPropertyInqurity.Value['FinalAuditCount'] := Value;
 end;
 
+procedure TProjProperties.SetleafXmjGlFilterType(const Value: Integer);
+begin
+  FLeafXmjGlFilterType := Value;
+  FPropertyInqurity.Value['LeafXmjGlFilterType'] := Value;
+end;
+
 procedure TProjProperties.SetLockedLedgerData(const Value: Boolean);
 begin
   FLockedLedgerData := Value;