Prechádzať zdrojové kódy

Merge branch '3.1.5'

Conflicts:
	Dprs/Pro/Measure.dof
	Dprs/Pro/Measure.res
	Dprs/Pro/Measure_Cloud.dof
	Dprs/Pro/Measure_Cloud.res
	Dprs/Pro/Measure_GuangDong.dof
	Dprs/Pro/Measure_GuangDong.res
	Dprs/Pro/Measure_GuangDong_Cloud.dof
	Dprs/Pro/Measure_GuangDong_Cloud.res
	Dprs/Pro/Measure_GuangDong_TZ.dof
	Dprs/Pro/Measure_GuangDong_TZ.res
	Dprs/Pro/Measure_TZ.dof
	Dprs/Pro/Measure_TZ.res
	Dprs/Trail/Measure.dof
	Dprs/Trail/Measure.res
	Dprs/Trail/Measure_GuangDong.dof
	Dprs/Trail/Measure_GuangDong.res
MaiXinRong 9 rokov pred
rodič
commit
a8fc54b4bc
41 zmenil súbory, kde vykonal 1680 pridanie a 119 odobranie
  1. 6 6
      DataModules/BillsDm.dfm
  2. 4 0
      DataModules/BillsGatherDm.dfm
  3. 13 2
      DataModules/BillsGatherDm.pas
  4. 2 2
      DataModules/PriceMarginBillsDm.pas
  5. 2 2
      DataModules/ReportMemoryDm/rmGcl_XmjBillsDm.pas
  6. 16 1
      DataModules/ReportMemoryDm/rmHaBaiCustomizedDm.pas
  7. 15 15
      DataModules/StageDm.dfm
  8. 9 0
      Dprs/Pro/Measure.dof
  9. 6 2
      Dprs/Pro/Measure.dpr
  10. 9 0
      Dprs/Pro/Measure_Cloud.dof
  11. 6 2
      Dprs/Pro/Measure_Cloud.dpr
  12. 9 0
      Dprs/Pro/Measure_GuangDong.dof
  13. 6 2
      Dprs/Pro/Measure_GuangDong.dpr
  14. 9 0
      Dprs/Pro/Measure_GuangDong_Cloud.dof
  15. 6 2
      Dprs/Pro/Measure_GuangDong_Cloud.dpr
  16. 9 0
      Dprs/Pro/Measure_GuangDong_TZ.dof
  17. 6 2
      Dprs/Pro/Measure_GuangDong_TZ.dpr
  18. 9 0
      Dprs/Pro/Measure_TZ.dof
  19. 6 2
      Dprs/Pro/Measure_TZ.dpr
  20. 9 0
      Dprs/Trail/Measure.dof
  21. 5 2
      Dprs/Trail/Measure.dpr
  22. 9 0
      Dprs/Trail/Measure_GuangDong.dof
  23. 5 2
      Dprs/Trail/Measure_GuangDong.dpr
  24. 28 16
      Forms/MainFrm.dfm
  25. 2 0
      Forms/MainFrm.pas
  26. 18 2
      Forms/ReportsFrm.pas
  27. 4 0
      Frames/BillsGatherFme.pas
  28. 24 0
      Frames/BillsMeasureFme.dfm
  29. 74 26
      Frames/BillsMeasureFme.pas
  30. 14 4
      Frames/ZJJLFme.pas
  31. 354 0
      Report/DataPrepare/rdpBillsGatherDm.dfm
  32. 316 0
      Report/DataPrepare/rdpBillsGatherDm.pas
  33. 269 0
      Report/DataPrepare/rdpTables.pas
  34. 98 0
      Report/ReportPrepare.pas
  35. 236 0
      Units/ColVisibleManager.pas
  36. 8 1
      Units/Connections.pas
  37. 16 16
      Units/DataBaseTables.pas
  38. 2 2
      Units/GclBillsGatherModel.pas
  39. 26 7
      Units/ProjectData.pas
  40. 14 1
      Units/ReportManager.pas
  41. 1 0
      Units/ZhAPI.pas

+ 6 - 6
DataModules/BillsDm.dfm

@@ -103,11 +103,11 @@ object BillsData: TBillsData
       4E616D65060F4164645163546F74616C50726963650844617461547970650206
       084461746153697A6502080549734B6579080F4E65656450726F636573734E61
       6D65090001044E616D65060C416464516342474C436F6465094669656C644E61
-      6D65060C416464516342474C436F646508446174615479706502180844617461
-      53697A6503FF000549734B6579080F4E65656450726F636573734E616D650900
+      6D65060C416464516342474C436F646508446174615479706502100844617461
+      53697A6503A00F0549734B6579080F4E65656450726F636573734E616D650900
       01044E616D65060B416464516342474C4E756D094669656C644E616D65060B41
-      6464516342474C4E756D0844617461547970650218084461746153697A6503FF
-      000549734B6579080F4E65656450726F636573734E616D65090001044E616D65
+      6464516342474C4E756D0844617461547970650210084461746153697A6503A0
+      0F0549734B6579080F4E65656450726F636573734E616D65090001044E616D65
       060D41646450635175616E74697479094669656C644E616D65060D4164645063
       5175616E746974790844617461547970650206084461746153697A6502080549
       734B6579080F4E65656450726F636573734E616D65090001044E616D65060F41
@@ -115,10 +115,10 @@ object BillsData: TBillsData
       6F74616C50726963650844617461547970650206084461746153697A65020805
       49734B6579080F4E65656450726F636573734E616D65090001044E616D65060C
       416464506342474C436F6465094669656C644E616D65060C416464506342474C
-      436F64650844617461547970650218084461746153697A6503FF000549734B65
+      436F64650844617461547970650210084461746153697A6503A00F0549734B65
       79080F4E65656450726F636573734E616D65090001044E616D65060B41646450
       6342474C4E756D094669656C644E616D65060B416464506342474C4E756D0844
-      617461547970650218084461746153697A6503FF000549734B6579080F4E6565
+      617461547970650210084461746153697A6503A00F0549734B6579080F4E6565
       6450726F636573734E616D65090001044E616D65061141646447617468657251
       75616E74697479094669656C644E616D6506114164644761746865725175616E
       746974790844617461547970650206084461746153697A6502080549734B6579

+ 4 - 0
DataModules/BillsGatherDm.dfm

@@ -254,6 +254,7 @@ object BillsGatherData: TBillsGatherData
         DisplayFormat = '0.##'
       end>
     OnCurrentChanged = sdvGclBillsCurrentChanged
+    OnGetText = sdvGclBillsGetText
     Left = 40
     Top = 136
   end
@@ -426,6 +427,7 @@ object BillsGatherData: TBillsGatherData
         FieldName = 'Quantity'
       end>
     OnFilterRecord = sdvDetailGclBillsFilterRecord
+    OnGetText = sdvGclBillsGetText
     Left = 40
     Top = 312
   end
@@ -487,6 +489,7 @@ object BillsGatherData: TBillsGatherData
         FieldName = 'TotalPrice'
       end>
     OnFilterRecord = sdvDetailGclBillsFilterRecord
+    OnGetText = sdvGclBillsGetText
     Left = 136
     Top = 312
   end
@@ -552,6 +555,7 @@ object BillsGatherData: TBillsGatherData
         FieldName = 'TotalPrice'
       end>
     OnFilterRecord = sdvDetailGclBillsFilterRecord
+    OnGetText = sdvGclBillsGetText
     Left = 240
     Top = 312
   end

+ 13 - 2
DataModules/BillsGatherDm.pas

@@ -23,10 +23,12 @@ type
     procedure sdvGclBillsCurrentChanged(ARecord: TsdDataRecord);
     procedure sdvDetailGclBillsFilterRecord(ARecord: TsdDataRecord;
       var Allow: Boolean);
+    procedure sdvGclBillsGetText(var Text: String; ARecord: TsdDataRecord;
+      AValue: TsdValue; AColumn: TsdViewColumn; DisplayText: Boolean);
   private
     FProjectData: TObject;
 
-    procedure WriteGatherRecord(AGcls: TList);
+    procedure WriteGatherRecord(AGcls, AXmjs: TList);
 
     function GetMainBillsTree: TsdIDTree;
   public
@@ -35,6 +37,7 @@ type
 
     procedure RefreshBills;
 
+    property ProjectData: TObject read FProjectData;
     property MainBillsTree: TsdIDTree read GetMainBillsTree;
   end;
 
@@ -105,7 +108,7 @@ begin
   end;
 end;
 
-procedure TBillsGatherData.WriteGatherRecord(AGcls: TList);
+procedure TBillsGatherData.WriteGatherRecord(AGcls, AXmjs: TList);
 
   procedure DisableAndClearDataSet(ADataSet: TsdDataSet);
   begin
@@ -347,4 +350,12 @@ begin
     Allow := False;
 end;
 
+procedure TBillsGatherData.sdvGclBillsGetText(var Text: String;
+  ARecord: TsdDataRecord; AValue: TsdValue; AColumn: TsdViewColumn;
+  DisplayText: Boolean);
+begin
+  if Assigned(AValue) and (AValue.Field.DataType = ftFloat) and (AValue.AsFloat = 0) then
+    Text := '';
+end;
+
 end.

+ 2 - 2
DataModules/PriceMarginBillsDm.pas

@@ -32,7 +32,7 @@ type
       AValue: TsdValue; AColumn: TsdViewColumn; var Allow: Boolean);
   private
     FProjectData: TObject;
-    procedure WriteGclBillsData(AGcls: TList);
+    procedure WriteGclBillsData(AGcls, AXmjs: TList);
     function GetMainBillsTree: TBillsIDTree;
   public
     constructor Create(AProjectData: TObject);
@@ -100,7 +100,7 @@ begin
   end;
 end;
 
-procedure TPriceMarginBillsData.WriteGclBillsData(AGcls: TList);
+procedure TPriceMarginBillsData.WriteGclBillsData(AGcls, AXmjs: TList);
 
   procedure BeforeWrite;
   begin

+ 2 - 2
DataModules/ReportMemoryDm/rmGcl_XmjBillsDm.pas

@@ -70,7 +70,7 @@ type
     procedure WriteFlowGclNode(AGclNode: TGclNode);
     procedure WriteFlowGclTypeData(AGcls: TList);
 
-    procedure WriteData(AGcls: TList);
+    procedure WriteData(AGcls, AXmjs: TList);
 
     procedure GatherData;
   public
@@ -131,7 +131,7 @@ begin
   end;
 end;
 
-procedure TrmGcl_XmjBillsData.WriteData(AGcls: TList);
+procedure TrmGcl_XmjBillsData.WriteData(AGcls, AXmjs: TList);
 begin
   case FGXType of
     gxtTopGcl, gxtWithoutXmj: WriteTopGclTypeData(AGcls);

+ 16 - 1
DataModules/ReportMemoryDm/rmHaBaiCustomizedDm.pas

@@ -618,6 +618,19 @@ procedure TrmHaBaiCustomizedData.WriteReport2;
     cdsCustom2.Post;
   end;
 
+  procedure WriteMentalNode;
+  begin
+    cdsCustom2.Append;
+    cdsCustom2Name.AsString := '連  마';
+    cdsCustom2EndGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.EndGatherTotalPrice + FDealPayControl.PlusGather.EndTotalPrice
+        - FDealPayControl.MinusGather.EndTotalPrice;
+    cdsCustom2PreGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.PreGatherTotalPrice + FDealPayControl.PlusGather.PreTotalPrice
+        - FDealPayControl.MinusGather.PreTotalPrice;
+    cdsCustom2CurGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.CurGatherTotalPrice + FDealPayControl.PlusGather.CurTotalPrice
+        - FDealPayControl.MinusGather.CurTotalPrice;
+    cdsCustom2.Post;
+  end;
+
 var
   iIndex: Integer;
 begin
@@ -633,7 +646,9 @@ begin
   WriteSpecialRecord;
   for iIndex := 0 to FDealPayControl.MinusPayCount - 1 do
     WritePayNode(FDealPayControl.MinusPayNode[iIndex]);
-  WritePayNode(FDealPayControl.GatherPayNode, '連  마');
+  //WritePayNode(FDealPayControl.GatherPayNode, '連  마');
+  // �쒔깹唐챘깹
+  WriteMentalNode;
 end;
 
 procedure TrmHaBaiCustomizedData.WriteReport3;

+ 15 - 15
DataModules/StageDm.dfm

@@ -43,10 +43,10 @@ object StageData: TStageData
       670844617461547970650203084461746153697A6502040549734B6579080F4E
       65656450726F636573734E616D65090001044E616D650609516342474C436F64
       65094669656C644E616D650609516342474C436F646508446174615479706502
-      01084461746153697A6503FF000549734B6579080F4E65656450726F63657373
+      10084461746153697A6503A00F0549734B6579080F4E65656450726F63657373
       4E616D65090001044E616D650608516342474C4E756D094669656C644E616D65
-      0608516342474C4E756D0844617461547970650201084461746153697A6503FF
-      000549734B6579080F4E65656450726F636573734E616D65090001044E616D65
+      0608516342474C4E756D0844617461547970650210084461746153697A6503A0
+      0F0549734B6579080F4E65656450726F636573734E616D65090001044E616D65
       060A50635175616E74697479094669656C644E616D65060A50635175616E7469
       74790844617461547970650206084461746153697A6502080549734B6579080F
       4E65656450726F636573734E616D65090001044E616D65060C5063546F74616C
@@ -59,10 +59,10 @@ object StageData: TStageData
       610844617461547970650201084461746153697A6503FF000549734B6579080F
       4E65656450726F636573734E616D65090001044E616D650609506342474C436F
       6465094669656C644E616D650609506342474C436F6465084461746154797065
-      0201084461746153697A6503FF000549734B6579080F4E65656450726F636573
+      0210084461746153697A6503A00F0549734B6579080F4E65656450726F636573
       734E616D65090001044E616D650608506342474C4E756D094669656C644E616D
-      650608506342474C4E756D0844617461547970650201084461746153697A6503
-      FF000549734B6579080F4E65656450726F636573734E616D65090001044E616D
+      650608506342474C4E756D0844617461547970650210084461746153697A6503
+      A00F0549734B6579080F4E65656450726F636573734E616D65090001044E616D
       65060E4761746865725175616E74697479094669656C644E616D65060E476174
       6865725175616E746974790844617461547970650206084461746153697A6502
       080549734B6579080F4E65656450726F636573734E616D65090001044E616D65
@@ -82,10 +82,10 @@ object StageData: TStageData
       65060F456E645163546F74616C50726963650844617461547970650206084461
       746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
       0001044E616D65060C456E64516342474C436F6465094669656C644E616D6506
-      0C456E64516342474C436F64650844617461547970650218084461746153697A
-      6503FF000549734B6579080F4E65656450726F636573734E616D65090001044E
+      0C456E64516342474C436F64650844617461547970650210084461746153697A
+      6503A00F0549734B6579080F4E65656450726F636573734E616D65090001044E
       616D65060B456E64516342474C4E756D094669656C644E616D65060B456E6451
-      6342474C4E756D0844617461547970650218084461746153697A6503FF000549
+      6342474C4E756D0844617461547970650210084461746153697A6503A00F0549
       734B6579080F4E65656450726F636573734E616D65090001044E616D65060D45
       6E6450635175616E74697479094669656C644E616D65060D456E645063517561
       6E746974790844617461547970650206084461746153697A6502080549734B65
@@ -94,10 +94,10 @@ object StageData: TStageData
       6C50726963650844617461547970650206084461746153697A6502080549734B
       6579080F4E65656450726F636573734E616D65090001044E616D65060C456E64
       506342474C436F6465094669656C644E616D65060C456E64506342474C436F64
-      650844617461547970650218084461746153697A6503FF000549734B6579080F
+      650844617461547970650210084461746153697A6503A00F0549734B6579080F
       4E65656450726F636573734E616D65090001044E616D65060B456E6450634247
       4C4E756D094669656C644E616D65060B456E64506342474C4E756D0844617461
-      547970650218084461746153697A6503FF000549734B6579080F4E6565645072
+      547970650210084461746153697A6503A00F0549734B6579080F4E6565645072
       6F636573734E616D65090001044E616D650611456E644761746865725175616E
       74697479094669656C644E616D650611456E644761746865725175616E746974
       790844617461547970650206084461746153697A6502080549734B6579080F4E
@@ -118,10 +118,10 @@ object StageData: TStageData
       72655163546F74616C5072696365084461746154797065020608446174615369
       7A6502080549734B6579080F4E65656450726F636573734E616D65090001044E
       616D65060C507265516342474C436F6465094669656C644E616D65060C507265
-      516342474C436F64650844617461547970650218084461746153697A6503FF00
+      516342474C436F64650844617461547970650210084461746153697A6503A00F
       0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
       0B507265516342474C4E756D094669656C644E616D65060B507265516342474C
-      4E756D0844617461547970650218084461746153697A6503FF000549734B6579
+      4E756D0844617461547970650210084461746153697A6503A00F0549734B6579
       080F4E65656450726F636573734E616D65090001044E616D65060D5072655063
       5175616E74697479094669656C644E616D65060D50726550635175616E746974
       790844617461547970650206084461746153697A6502080549734B6579080F4E
@@ -130,10 +130,10 @@ object StageData: TStageData
       63650844617461547970650206084461746153697A6502080549734B6579080F
       4E65656450726F636573734E616D65090001044E616D65060C50726550634247
       4C436F6465094669656C644E616D65060C507265506342474C436F6465084461
-      7461547970650218084461746153697A6503FF000549734B6579080F4E656564
+      7461547970650210084461746153697A6503A00F0549734B6579080F4E656564
       50726F636573734E616D65090001044E616D65060B507265506342474C4E756D
       094669656C644E616D65060B507265506342474C4E756D084461746154797065
-      0218084461746153697A6503FF000549734B6579080F4E65656450726F636573
+      0210084461746153697A6503A00F0549734B6579080F4E65656450726F636573
       734E616D65090001044E616D6506115072654761746865725175616E74697479
       094669656C644E616D6506115072654761746865725175616E74697479084461
       7461547970650206084461746153697A6502080549734B6579080F4E65656450

+ 9 - 0
Dprs/Pro/Measure.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=1
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=103
+=======
+Release=5
+Build=3004
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化专业版
+<<<<<<< HEAD
 FileVersion=3.1.6.103
+=======
+FileVersion=3.1.5.3004
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 2
Dprs/Pro/Measure.dpr

@@ -174,7 +174,11 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  mPegFilter in '..\..\Units\mPegFilter.pas';
+  mPegFilter in '..\..\Units\mPegFilter.pas',
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas',
+  ColVisibleManager in '..\..\Units\ColVisibleManager.pas';
 
 {$R *.res}
 
@@ -195,7 +199,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
-    end
+  end
     else  HideWelcome;
     Application.Run;
   end;

+ 9 - 0
Dprs/Pro/Measure_Cloud.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=1
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=103
+=======
+Release=5
+Build=3004
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化云版
+<<<<<<< HEAD
 FileVersion=3.1.6.103
+=======
+FileVersion=3.1.5.3004
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 2
Dprs/Pro/Measure_Cloud.dpr

@@ -178,7 +178,11 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  PriceMarginBillsFme in '..\..\Frames\PriceMarginBillsFme.pas' {PriceMarginBillsFrame: TFrame};
+  PriceMarginBillsFme in '..\..\Frames\PriceMarginBillsFme.pas' {PriceMarginBillsFrame: TFrame},
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas',
+  ColVisibleManager in '..\..\Units\ColVisibleManager.pas';
 
 {$R *.res}
 
@@ -222,7 +226,7 @@ begin
     if CheckDogExists then
     begin
       Application.CreateForm(TMainForm, MainForm);
-    end;
+  end;
     Application.Run;
   end;
 

+ 9 - 0
Dprs/Pro/Measure_GuangDong.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=1
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=103
+=======
+Release=5
+Build=3004
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东专业版
+<<<<<<< HEAD
 FileVersion=3.1.6.103
+=======
+FileVersion=3.1.5.3004
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 2
Dprs/Pro/Measure_GuangDong.dpr

@@ -174,7 +174,11 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  mPegFilter in '..\..\Units\mPegFilter.pas';
+  mPegFilter in '..\..\Units\mPegFilter.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas',
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  ColVisibleManager in '..\..\Units\ColVisibleManager.pas';
 
 {$R *.res}
 
@@ -194,7 +198,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
-    end
+  end
     else  HideWelcome;
     Application.Run;
   end;

+ 9 - 0
Dprs/Pro/Measure_GuangDong_Cloud.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=1
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=103
+=======
+Release=5
+Build=3004
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东云版
+<<<<<<< HEAD
 FileVersion=3.1.6.103
+=======
+FileVersion=3.1.5.3004
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 2
Dprs/Pro/Measure_GuangDong_Cloud.dpr

@@ -178,7 +178,11 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  mPegFilter in '..\..\Units\mPegFilter.pas';
+  mPegFilter in '..\..\Units\mPegFilter.pas',
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas',
+  ColVisibleManager in '..\..\Units\ColVisibleManager.pas';
 
 {$R *.res}
 
@@ -224,7 +228,7 @@ begin
     if CheckDogExists then
     begin
       Application.CreateForm(TMainForm, MainForm);
-    end;
+  end;
     Application.Run;
   end;
 

+ 9 - 0
Dprs/Pro/Measure_GuangDong_TZ.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=0
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=102
+=======
+Release=5
+Build=3004
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横0号台账广东专业版
+<<<<<<< HEAD
 FileVersion=3.1.6.102
+=======
+FileVersion=3.1.5.3004
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 2
Dprs/Pro/Measure_GuangDong_TZ.dpr

@@ -174,7 +174,11 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  mPegFilter in '..\..\Units\mPegFilter.pas';
+  mPegFilter in '..\..\Units\mPegFilter.pas',
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas',
+  ColVisibleManager in '..\..\Units\ColVisibleManager.pas';
 
 {$R *.res}
 
@@ -195,7 +199,7 @@ begin
     begin
 	    HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
-    end
+  end
     else  HideWelcome;
     Application.Run;
   end;

+ 9 - 0
Dprs/Pro/Measure_TZ.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=1
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=103
+=======
+Release=5
+Build=3004
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横0号台账专业版
+<<<<<<< HEAD
 FileVersion=3.1.6.103
+=======
+FileVersion=3.1.5.3004
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 2
Dprs/Pro/Measure_TZ.dpr

@@ -174,7 +174,11 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  mPegFilter in '..\..\Units\mPegFilter.pas';
+  mPegFilter in '..\..\Units\mPegFilter.pas',
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas',
+  ColVisibleManager in '..\..\Units\ColVisibleManager.pas';
 
 {$R *.res}
 
@@ -196,7 +200,7 @@ begin
     begin
 	    HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
-    end
+  end
     else  HideWelcome;
     Application.Run;
   end;

+ 9 - 0
Dprs/Trail/Measure.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=1
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=103
+=======
+Release=5
+Build=3003
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化学习版
+<<<<<<< HEAD
 FileVersion=3.1.6.103
+=======
+FileVersion=3.1.5.3003
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 5 - 2
Dprs/Trail/Measure.dpr

@@ -174,7 +174,10 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  mPegFilter in '..\..\Units\mPegFilter.pas';
+  mPegFilter in '..\..\Units\mPegFilter.pas',
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas';
 
 {$R *.res}
 
@@ -194,7 +197,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
-    end
+  end
     else  HideWelcome;
     Application.Run;
   end;

+ 9 - 0
Dprs/Trail/Measure_GuangDong.dof

@@ -114,8 +114,13 @@ IncludeVerInfo=1
 AutoIncBuild=1
 MajorVer=3
 MinorVer=1
+<<<<<<< HEAD
 Release=6
 Build=103
+=======
+Release=5
+Build=3003
+>>>>>>> 3.1.5
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +131,11 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东学习版
+<<<<<<< HEAD
 FileVersion=3.1.6.103
+=======
+FileVersion=3.1.5.3003
+>>>>>>> 3.1.5
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 5 - 2
Dprs/Trail/Measure_GuangDong.dpr

@@ -174,7 +174,10 @@ uses
   tpSelectTenderNode in '..\..\TenderPartition\tpSelectTenderNode.pas',
   tpSelectTendersFrm in '..\..\TenderPartition\tpSelectTendersFrm.pas' {SelectTendersForm},
   tpTrialPegInputFrm in '..\..\TenderPartition\tpTrialPegInputFrm.pas' {TrialPegInputForm},
-  mPegFilter in '..\..\Units\mPegFilter.pas';
+  mPegFilter in '..\..\Units\mPegFilter.pas',
+  ReportPrepare in '..\..\Report\ReportPrepare.pas',
+  rdpBillsGatherDm in '..\..\Report\DataPrepare\rdpBillsGatherDm.pas' {rdpBillsGatherData: TDataModule},
+  rdpTables in '..\..\Report\DataPrepare\rdpTables.pas';
 
 {$R *.res}
 
@@ -194,7 +197,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
-    end
+  end
     else  HideWelcome;
     Application.Run;
   end;

+ 28 - 16
Forms/MainFrm.dfm

@@ -20,8 +20,8 @@ object MainForm: TMainForm
   TextHeight = 12
   object jtsProjects: TJimTabSet
     Left = 0
-    Top = 49
-    Width = 734
+    Top = 48
+    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 = 484
+    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
@@ -93,9 +93,9 @@ object MainForm: TMainForm
   end
   object jpsMain: TJimPages
     Left = 0
-    Top = 70
-    Width = 734
-    Height = 410
+    Top = 69
+    Width = 742
+    Height = 415
     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 = 415
       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 = 415
       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 = #23435#20307
     Font.Style = []
     Bars = <
       item
@@ -270,7 +270,7 @@ object MainForm: TMainForm
         Caption = #24037#20855#26639
         DockedDockingStyle = dsTop
         DockedLeft = 0
-        DockedTop = 27
+        DockedTop = 26
         DockingStyle = dsTop
         FloatLeft = 484
         FloatTop = 279
@@ -379,7 +379,7 @@ object MainForm: TMainForm
     DockControlHeights = (
       0
       0
-      49
+      48
       0)
     object dxsiFile: TdxBarSubItem
       Caption = #25991#20214'(&F)'
@@ -1039,6 +1039,18 @@ object MainForm: TMainForm
       Hint = #26032#22686#19968#21015
       Visible = ivAlways
     end
+    object dxbtnHidden: TdxBarButton
+      Caption = #38544#34255
+      Category = 0
+      Hint = #38544#34255
+      Visible = ivAlways
+    end
+    object dxbtnCancelHidden: TdxBarButton
+      Caption = #21462#28040#38544#34255
+      Category = 0
+      Hint = #21462#28040#38544#34255
+      Visible = ivAlways
+    end
   end
   object Images: TImageList
     DrawingStyle = dsTransparent

+ 2 - 0
Forms/MainFrm.pas

@@ -154,6 +154,8 @@ type
     dxbtnFxZJJL: TdxBarButton;
     dxbtnGclZJJL: TdxBarButton;
     dxbtnInsertCol: TdxBarButton;
+    dxbtnHidden: TdxBarButton;
+    dxbtnCancelHidden: TdxBarButton;
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;

+ 18 - 2
Forms/ReportsFrm.pas

@@ -9,7 +9,7 @@ interface
 
 uses
   ProjectData, ScFileArchiver, ReportManager, ConditionalDefines,
-  PrintComTypeDefUnit, ADODB, DB,
+  PrintComTypeDefUnit, ADODB, DB, ReportPrepare,
   AuditSelectFrm,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, PrintCom, PrintComXML, ExtCtrls, ExTreeView, ImgList,
@@ -100,6 +100,9 @@ type
 
     FLockForm: Boolean;
 
+    // 报表数据准备
+    FReportDataPrepare: TReportPrepare;
+
     procedure InitPageSettings;
     procedure InitFont;
     procedure InitPaperSettings;
@@ -143,6 +146,8 @@ type
     function GetExcelMode: TOutputExcelMode;
     function GetIsExcel2010: Boolean;
   public
+    destructor Destroy; override;
+
     procedure InitFormView;
     procedure InitReportSettings;
 
@@ -168,7 +173,8 @@ implementation
 
 uses
   UtilMethods, Math, DirectPrintUnit, Globals, ZhAPI, ReportAdjustFrm,
-  Contnrs, mEncryptUnit, Printers, WinSpool, MainFrm, ConstUnit;
+  Contnrs, mEncryptUnit, Printers, WinSpool, MainFrm, ConstUnit,
+  GclBillsGatherModel;
 
 {$R *.dfm}
 
@@ -282,6 +288,9 @@ begin
   // 交互表
   if vTemplateNode.InteractFlag <> 0 then
     SaveReportInteractData(vTemplateNode);
+  // 准备额外数据
+  if vTemplateNode.DataPrepareFlag <> 0 then
+    FReportDataPrepare.PrepareData(vTemplateNode.DataPrepareFlag);
 
   Screen.Cursor := crHourGlass;
   try
@@ -301,6 +310,7 @@ end;
 procedure TReportsForm.SetProjectData(const Value: TProjectData);
 begin
   FProjectData := Value;
+  FReportDataPrepare := TReportPrepare.Create(FProjectData);
   extvReport.Selected := extvReport.Items[0];
   LoadReportTemplets;
   LoadTempletAndDisplay;
@@ -1495,4 +1505,10 @@ begin
   end;
 end;
 
+destructor TReportsForm.Destroy;
+begin
+  FReportDataPrepare.Free;
+  inherited;
+end;
+
 end.

+ 4 - 0
Frames/BillsGatherFme.pas

@@ -55,6 +55,9 @@ type
 
 implementation
 
+uses
+  ProjectData;
+
 {$R *.dfm}
 
 { TBillsGatherFrame }
@@ -78,6 +81,7 @@ end;
 procedure TBillsGatherFrame.RefreshBills;
 begin
   FBillsGatherData.RefreshBills;
+  ShowPhaseData := TProjectData(FBillsGatherData.ProjectData).ProjProperties.PhaseCount > 0;
 end;
 
 procedure TBillsGatherFrame.SetColumnVisible(const AColumn: string;

+ 24 - 0
Frames/BillsMeasureFme.dfm

@@ -1101,5 +1101,29 @@ object BillsMeasureFrame: TBillsMeasureFrame
       OnExecute = actnSetStageBookmarkExecute
       OnUpdate = actnSetStageBookmarkUpdate
     end
+    object actnHiddenCol: TAction
+      Caption = #38544#34255
+      OnExecute = actnHiddenColExecute
+    end
+    object actnCancelHiddenCol: TAction
+      Caption = #21462#28040#38544#34255
+      OnExecute = actnCancelHiddenColExecute
+    end
+  end
+  object dxpmBillsCol: TdxBarPopupMenu
+    BarManager = MainForm.dxBarManager
+    ItemLinks = <
+      item
+        Item = MainForm.dxbtnHidden
+        Visible = True
+      end
+      item
+        Item = MainForm.dxbtnCancelHidden
+        Visible = True
+      end>
+    UseOwnFont = False
+    OnPopup = dxpmBillsColPopup
+    Left = 232
+    Top = 120
   end
 end

+ 74 - 26
Frames/BillsMeasureFme.pas

@@ -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.

+ 14 - 4
Frames/ZJJLFme.pas

@@ -170,8 +170,13 @@ end;
 procedure TZJJLFrame.actnGenerateFxZJJLExecute(Sender: TObject);
 begin
   with TPhaseData(FZJJLData.PhaseData).PhaseProperty do
-    ZJJLType := 0;
-  GenerateZJJL;
+  begin
+    if (ZJJLType = 0) or QuestMessage('当前为“0号台账”格式,切换至“总量控制”将清空数据并重新生成,确定要切换吗?') then
+    begin
+      ZJJLType := 0;
+      GenerateZJJL;
+    end;
+  end;
 end;
 
 procedure TZJJLFrame.GenerateZJJL;
@@ -193,8 +198,13 @@ end;
 procedure TZJJLFrame.actnGenerateGclZJJLExecute(Sender: TObject);
 begin
   with TPhaseData(FZJJLData.PhaseData).PhaseProperty do
-    ZJJLType := 1;
-  GenerateZJJL;
+  begin
+    if (ZJJLType = 1) or (QuestMessage('当前为“总量控制”格式,切换至“0号台账”将清空数据并重新生成,确定要切换吗?')) then
+    begin
+      ZJJLType := 1;
+      GenerateZJJL;
+    end;
+  end;
 end;
 
 procedure TZJJLFrame.actnGenerateUpdate(Sender: TObject);

+ 354 - 0
Report/DataPrepare/rdpBillsGatherDm.dfm

@@ -0,0 +1,354 @@
+object rdpBillsGatherData: TrdpBillsGatherData
+  OldCreateOrder = False
+  Left = 790
+  Top = 258
+  Height = 302
+  Width = 322
+  object sdpGclBills: TsdADOProvider
+    TableName = 'rdp_GclBills'
+    Left = 40
+    Top = 16
+  end
+  object sddGclBills: TsdDataSet
+    Active = False
+    Provider = sdpGclBills
+    Left = 40
+    Top = 72
+    FieldListData = {
+      0101044E616D6506024944094669656C644E616D650602494408446174615479
+      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D650606425F436F6465094669656C644E616D65
+      0606425F436F64650844617461547970650218084461746153697A6502320549
+      734B6579080F4E65656450726F636573734E616D65090001044E616D65060949
+      6E646578436F6465094669656C644E616D650609496E646578436F6465084461
+      7461547970650218084461746153697A6502320549734B6579080F4E65656450
+      726F636573734E616D65090001044E616D6506044E616D65094669656C644E61
+      6D6506044E616D650844617461547970650218084461746153697A6503FF0005
+      49734B6579080F4E65656450726F636573734E616D65090001044E616D650605
+      556E697473094669656C644E616D650605556E69747308446174615479706502
+      18084461746153697A6502140549734B6579080F4E65656450726F636573734E
+      616D65090001044E616D6506055072696365094669656C644E616D6506055072
+      6963650844617461547970650206084461746153697A6502080549734B657908
+      0F4E65656450726F636573734E616D65090001044E616D65060B4F7267517561
+      6E74697479094669656C644E616D65060B4F72675175616E7469747908446174
+      61547970650206084461746153697A6502080549734B6579080F4E6565645072
+      6F636573734E616D65090001044E616D65060D4F7267546F74616C5072696365
+      094669656C644E616D65060D4F7267546F74616C507269636508446174615479
+      70650206084461746153697A6502080549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D65060B4D69735175616E74697479094669656C
+      644E616D65060B4D69735175616E746974790844617461547970650206084461
+      746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
+      0001044E616D65060D4D6973546F74616C5072696365094669656C644E616D65
+      060D4D6973546F74616C50726963650844617461547970650206084461746153
+      697A6502080549734B6579080F4E65656450726F636573734E616D6509000104
+      4E616D65060B4F74685175616E74697479094669656C644E616D65060B4F7468
+      5175616E746974790844617461547970650206084461746153697A6502080549
+      734B6579080F4E65656450726F636573734E616D65090001044E616D65060D4F
+      7468546F74616C5072696365094669656C644E616D65060D4F7468546F74616C
+      50726963650844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D65090001044E616D6506085175616E
+      74697479094669656C644E616D6506085175616E746974790844617461547970
+      650206084461746153697A6502080549734B6579080F4E65656450726F636573
+      734E616D65090001044E616D65060A546F74616C5072696365094669656C644E
+      616D65060A546F74616C50726963650844617461547970650206084461746153
+      697A6502080549734B6579080F4E65656450726F636573734E616D6509000104
+      4E616D65060F4375724465616C5175616E74697479094669656C644E616D6506
+      0F4375724465616C5175616E7469747908446174615479706502060844617461
+      53697A6502080549734B6579080F4E65656450726F636573734E616D65090001
+      044E616D6506114375724465616C546F74616C5072696365094669656C644E61
+      6D6506114375724465616C546F74616C50726963650844617461547970650206
+      084461746153697A6502080549734B6579080F4E65656450726F636573734E61
+      6D65090001044E616D65060D43757251635175616E74697479094669656C644E
+      616D65060D43757251635175616E746974790844617461547970650206084461
+      746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
+      0001044E616D65060F4375725163546F74616C5072696365094669656C644E61
+      6D65060F4375725163546F74616C507269636508446174615479706502060844
+      61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
+      090001044E616D6506114375724761746865725175616E74697479094669656C
+      644E616D6506114375724761746865725175616E746974790844617461547970
+      650206084461746153697A6502080549734B6579080F4E65656450726F636573
+      734E616D65090001044E616D650613437572476174686572546F74616C507269
+      6365094669656C644E616D650613437572476174686572546F74616C50726963
+      650844617461547970650206084461746153697A6502080549734B6579080F4E
+      65656450726F636573734E616D65090001044E616D65060F5072654465616C51
+      75616E74697479094669656C644E616D65060F5072654465616C5175616E7469
+      74790844617461547970650206084461746153697A6502080549734B6579080F
+      4E65656450726F636573734E616D65090001044E616D6506115072654465616C
+      546F74616C5072696365094669656C644E616D6506115072654465616C546F74
+      616C50726963650844617461547970650206084461746153697A650208054973
+      4B6579080F4E65656450726F636573734E616D65090001044E616D65060D5072
+      6551635175616E74697479094669656C644E616D65060D50726551635175616E
+      746974790844617461547970650206084461746153697A6502080549734B6579
+      080F4E65656450726F636573734E616D65090001044E616D65060F5072655163
+      546F74616C5072696365094669656C644E616D65060F5072655163546F74616C
+      50726963650844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D65090001044E616D65061150726547
+      61746865725175616E74697479094669656C644E616D65061150726547617468
+      65725175616E746974790844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
+      13507265476174686572546F74616C5072696365094669656C644E616D650613
+      507265476174686572546F74616C507269636508446174615479706502060844
+      61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
+      090001044E616D65060F456E644465616C5175616E74697479094669656C644E
+      616D65060F456E644465616C5175616E74697479084461746154797065020608
+      4461746153697A6502080549734B6579080F4E65656450726F636573734E616D
+      65090001044E616D650611456E644465616C546F74616C507269636509466965
+      6C644E616D650611456E644465616C546F74616C507269636508446174615479
+      70650206084461746153697A6502080549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D65060D456E6451635175616E74697479094669
+      656C644E616D65060D456E6451635175616E7469747908446174615479706502
+      06084461746153697A6502080549734B6579080F4E65656450726F636573734E
+      616D65090001044E616D65060F456E645163546F74616C507269636509466965
+      6C644E616D65060F456E645163546F74616C5072696365084461746154797065
+      0206084461746153697A6502080549734B6579080F4E65656450726F63657373
+      4E616D65090001044E616D650611456E644761746865725175616E7469747909
+      4669656C644E616D650611456E644761746865725175616E7469747908446174
+      61547970650206084461746153697A6502080549734B6579080F4E6565645072
+      6F636573734E616D65090001044E616D650613456E64476174686572546F7461
+      6C5072696365094669656C644E616D650613456E64476174686572546F74616C
+      50726963650844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D65090001044E616D65060F41646444
+      65616C5175616E74697479094669656C644E616D65060F4164644465616C5175
+      616E746974790844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D65090001044E616D650611416464
+      4465616C546F74616C5072696365094669656C644E616D650611416464446561
+      6C546F74616C50726963650844617461547970650206084461746153697A6502
+      080549734B6579080F4E65656450726F636573734E616D65090001044E616D65
+      060D41646451635175616E74697479094669656C644E616D65060D4164645163
+      5175616E746974790844617461547970650206084461746153697A6502080549
+      734B6579080F4E65656450726F636573734E616D65090001044E616D65060F41
+      64645163546F74616C5072696365094669656C644E616D65060F416464516354
+      6F74616C50726963650844617461547970650206084461746153697A65020805
+      49734B6579080F4E65656450726F636573734E616D65090001044E616D650611
+      4164644761746865725175616E74697479094669656C644E616D650611416464
+      4761746865725175616E74697479084461746154797065020608446174615369
+      7A6502080549734B6579080F4E65656450726F636573734E616D65090001044E
+      616D650613416464476174686572546F74616C5072696365094669656C644E61
+      6D650613416464476174686572546F74616C5072696365084461746154797065
+      0206084461746153697A6502080549734B6579080F4E65656450726F63657373
+      4E616D65090001044E616D65060C4465616C5175616E74697479094669656C64
+      4E616D65060C4465616C5175616E746974790844617461547970650206084461
+      746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
+      0001044E616D65060E4465616C546F74616C5072696365094669656C644E616D
+      65060E4465616C546F74616C5072696365084461746154797065020608446174
+      6153697A6502080549734B6579080F4E65656450726F636573734E616D650900
+      01044E616D65060B42474C5175616E74697479094669656C644E616D65060B42
+      474C5175616E746974790844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
+      0D42474C546F74616C5072696365094669656C644E616D65060D42474C546F74
+      616C50726963650844617461547970650206084461746153697A650208054973
+      4B6579080F4E65656450726F636573734E616D65090000}
+  end
+  object sdpDetailGclBills: TsdADOProvider
+    TableName = 'rdp_DetailGclBills'
+    Left = 40
+    Top = 136
+  end
+  object sddDetailGclBills: TsdDataSet
+    Active = False
+    Provider = sdpDetailGclBills
+    Left = 40
+    Top = 192
+    FieldListData = {
+      0101044E616D6506024944094669656C644E616D650602494408446174615479
+      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D65060742696C6C734944094669656C644E616D
+      65060742696C6C7349440844617461547970650203084461746153697A650204
+      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
+      0C5472656553657269616C4E6F094669656C644E616D65060C54726565536572
+      69616C4E6F0844617461547970650203084461746153697A6502040549734B65
+      79080F4E65656450726F636573734E616D65090001044E616D65060B52656C61
+      42696C6C734944094669656C644E616D65060B52656C6142696C6C7349440844
+      617461547970650203084461746153697A6502040549734B6579080F4E656564
+      50726F636573734E616D65090001044E616D6506094C656166586D6A49440946
+      69656C644E616D6506094C656166586D6A494408446174615479706502030844
+      61746153697A6502040549734B6579080F4E65656450726F636573734E616D65
+      090001044E616D6506085175616E74697479094669656C644E616D6506085175
+      616E746974790844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D65090001044E616D65060A546F74
+      616C5072696365094669656C644E616D65060A546F74616C5072696365084461
+      7461547970650206084461746153697A6502080549734B6579080F4E65656450
+      726F636573734E616D65090001044E616D65060F4375724465616C5175616E74
+      697479094669656C644E616D65060F4375724465616C5175616E746974790844
+      617461547970650206084461746153697A6502080549734B6579080F4E656564
+      50726F636573734E616D65090001044E616D6506114375724465616C546F7461
+      6C5072696365094669656C644E616D6506114375724465616C546F74616C5072
+      6963650844617461547970650206084461746153697A6502080549734B657908
+      0F4E65656450726F636573734E616D65090001044E616D65060D437572516351
+      75616E74697479094669656C644E616D65060D43757251635175616E74697479
+      0844617461547970650206084461746153697A6502080549734B6579080F4E65
+      656450726F636573734E616D65090001044E616D65060F4375725163546F7461
+      6C5072696365094669656C644E616D65060F4375725163546F74616C50726963
+      650844617461547970650206084461746153697A6502080549734B6579080F4E
+      65656450726F636573734E616D65090001044E616D6506114375724761746865
+      725175616E74697479094669656C644E616D6506114375724761746865725175
+      616E746974790844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D65090001044E616D650613437572
+      476174686572546F74616C5072696365094669656C644E616D65061343757247
+      6174686572546F74616C50726963650844617461547970650206084461746153
+      697A6502080549734B6579080F4E65656450726F636573734E616D6509000104
+      4E616D65060F5072654465616C5175616E74697479094669656C644E616D6506
+      0F5072654465616C5175616E7469747908446174615479706502060844617461
+      53697A6502080549734B6579080F4E65656450726F636573734E616D65090001
+      044E616D6506115072654465616C546F74616C5072696365094669656C644E61
+      6D6506115072654465616C546F74616C50726963650844617461547970650206
+      084461746153697A6502080549734B6579080F4E65656450726F636573734E61
+      6D65090001044E616D65060D50726551635175616E74697479094669656C644E
+      616D65060D50726551635175616E746974790844617461547970650206084461
+      746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
+      0001044E616D65060F5072655163546F74616C5072696365094669656C644E61
+      6D65060F5072655163546F74616C507269636508446174615479706502060844
+      61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
+      090001044E616D6506115072654761746865725175616E74697479094669656C
+      644E616D6506115072654761746865725175616E746974790844617461547970
+      650206084461746153697A6502080549734B6579080F4E65656450726F636573
+      734E616D65090001044E616D650613507265476174686572546F74616C507269
+      6365094669656C644E616D650613507265476174686572546F74616C50726963
+      650844617461547970650206084461746153697A6502080549734B6579080F4E
+      65656450726F636573734E616D65090001044E616D65060F456E644465616C51
+      75616E74697479094669656C644E616D65060F456E644465616C5175616E7469
+      74790844617461547970650206084461746153697A6502080549734B6579080F
+      4E65656450726F636573734E616D65090001044E616D650611456E644465616C
+      546F74616C5072696365094669656C644E616D650611456E644465616C546F74
+      616C50726963650844617461547970650206084461746153697A650208054973
+      4B6579080F4E65656450726F636573734E616D65090001044E616D65060D456E
+      6451635175616E74697479094669656C644E616D65060D456E6451635175616E
+      746974790844617461547970650206084461746153697A6502080549734B6579
+      080F4E65656450726F636573734E616D65090001044E616D65060F456E645163
+      546F74616C5072696365094669656C644E616D65060F456E645163546F74616C
+      50726963650844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D65090001044E616D650611456E6447
+      61746865725175616E74697479094669656C644E616D650611456E6447617468
+      65725175616E746974790844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
+      13456E64476174686572546F74616C5072696365094669656C644E616D650613
+      456E64476174686572546F74616C507269636508446174615479706502060844
+      61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
+      090001044E616D65060F4164644465616C5175616E74697479094669656C644E
+      616D65060F4164644465616C5175616E74697479084461746154797065020608
+      4461746153697A6502080549734B6579080F4E65656450726F636573734E616D
+      65090001044E616D6506114164644465616C546F74616C507269636509466965
+      6C644E616D6506114164644465616C546F74616C507269636508446174615479
+      70650206084461746153697A6502080549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D65060D41646451635175616E74697479094669
+      656C644E616D65060D41646451635175616E7469747908446174615479706502
+      06084461746153697A6502080549734B6579080F4E65656450726F636573734E
+      616D65090001044E616D65060F4164645163546F74616C507269636509466965
+      6C644E616D65060F4164645163546F74616C5072696365084461746154797065
+      0206084461746153697A6502080549734B6579080F4E65656450726F63657373
+      4E616D65090001044E616D6506114164644761746865725175616E7469747909
+      4669656C644E616D6506114164644761746865725175616E7469747908446174
+      61547970650206084461746153697A6502080549734B6579080F4E6565645072
+      6F636573734E616D65090001044E616D650613416464476174686572546F7461
+      6C5072696365094669656C644E616D650613416464476174686572546F74616C
+      50726963650844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D65090000}
+  end
+  object sdpDetailBGLBills: TsdADOProvider
+    TableName = 'rdp_DetailBGLBills'
+    Left = 144
+    Top = 136
+  end
+  object sddDetailBGLBills: TsdDataSet
+    Active = False
+    Provider = sdpDetailBGLBills
+    Left = 144
+    Top = 192
+    FieldListData = {
+      0101044E616D6506024944094669656C644E616D650602494408446174615479
+      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D65060742696C6C734944094669656C644E616D
+      65060742696C6C7349440844617461547970650203084461746153697A650204
+      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
+      09424742696C6C734944094669656C644E616D650609424742696C6C73494408
+      44617461547970650203084461746153697A6502040549734B6579080F4E6565
+      6450726F636573734E616D65090001044E616D65060542474C4944094669656C
+      644E616D65060542474C49440844617461547970650203084461746153697A65
+      02040549734B6579080F4E65656450726F636573734E616D65090001044E616D
+      65060742474C436F6465094669656C644E616D65060742474C436F6465084461
+      7461547970650218084461746153697A6502320549734B6579080F4E65656450
+      726F636573734E616D65090001044E616D65060742474C4E616D65094669656C
+      644E616D65060742474C4E616D65084461746154797065021808446174615369
+      7A6503FF000549734B6579080F4E65656450726F636573734E616D6509000104
+      4E616D65060F42474C417070726F76616C436F6465094669656C644E616D6506
+      0F42474C417070726F76616C436F646508446174615479706502180844617461
+      53697A6503FF000549734B6579080F4E65656450726F636573734E616D650900
+      01044E616D65060E42474C44726177696E67436F6465094669656C644E616D65
+      060E42474C44726177696E67436F646508446174615479706502180844617461
+      53697A6503FF000549734B6579080F4E65656450726F636573734E616D650900
+      01044E616D6506085175616E74697479094669656C644E616D6506085175616E
+      746974790844617461547970650206084461746153697A6502080549734B6579
+      080F4E65656450726F636573734E616D65090001044E616D65060A546F74616C
+      5072696365094669656C644E616D65060A546F74616C50726963650844617461
+      547970650206084461746153697A6502080549734B6579080F4E65656450726F
+      636573734E616D65090000}
+  end
+  object sdpDetailDealBills: TsdADOProvider
+    TableName = 'rdp_DetailDealBills'
+    Left = 248
+    Top = 136
+  end
+  object sddDetailDealBills: TsdDataSet
+    Active = False
+    Provider = sdpDetailDealBills
+    Left = 248
+    Top = 192
+    FieldListData = {
+      0101044E616D6506024944094669656C644E616D650602494408446174615479
+      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D65060742696C6C734944094669656C644E616D
+      65060742696C6C7349440844617461547970650203084461746153697A650204
+      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
+      064465616C4944094669656C644E616D6506064465616C494408446174615479
+      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D6506085175616E74697479094669656C644E61
+      6D6506085175616E746974790844617461547970650206084461746153697A65
+      02080549734B6579080F4E65656450726F636573734E616D65090001044E616D
+      65060A546F74616C5072696365094669656C644E616D65060A546F74616C5072
+      6963650844617461547970650206084461746153697A6502080549734B657908
+      0F4E65656450726F636573734E616D65090000}
+  end
+  object sdpLeafXmjs: TsdADOProvider
+    TableName = 'rdp_LeafXmjs'
+    Left = 136
+    Top = 16
+  end
+  object sddLeafXmjs: TsdDataSet
+    Active = False
+    Provider = sdpLeafXmjs
+    Left = 136
+    Top = 72
+    FieldListData = {
+      0101044E616D6506024944094669656C644E616D650602494408446174615479
+      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D650604436F6465094669656C644E616D650604
+      436F64650844617461547970650218084461746153697A6502320549734B6579
+      080F4E65656450726F636573734E616D65090001044E616D6506044E616D6509
+      4669656C644E616D6506044E616D650844617461547970650218084461746153
+      697A6503FF000549734B6579080F4E65656450726F636573734E616D65090001
+      044E616D650605556E697473094669656C644E616D650605556E697473084461
+      7461547970650218084461746153697A6502140549734B6579080F4E65656450
+      726F636573734E616D65090001044E616D65060A4E616D6544616E5765690946
+      69656C644E616D65060A4E616D6544616E576569084461746154797065021808
+      4461746153697A6503FF000549734B6579080F4E65656450726F636573734E61
+      6D65090001044E616D6506094E616D6546656E4275094669656C644E616D6506
+      094E616D6546656E42750844617461547970650218084461746153697A6503FF
+      000549734B6579080F4E65656450726F636573734E616D65090001044E616D65
+      060C4E616D6546656E5869616E67094669656C644E616D65060C4E616D654665
+      6E5869616E670844617461547970650218084461746153697A6503FF00054973
+      4B6579080F4E65656450726F636573734E616D65090001044E616D6506084E61
+      6D65556E6974094669656C644E616D6506084E616D65556E6974084461746154
+      7970650218084461746153697A6503FF000549734B6579080F4E65656450726F
+      636573734E616D65090001044E616D650603506567094669656C644E616D6506
+      035065670844617461547970650218084461746153697A6503FF000549734B65
+      79080F4E65656450726F636573734E616D65090001044E616D6506095065674C
+      656E677468094669656C644E616D6506095065674C656E677468084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D65090001044E616D65060C52656C61506F736974696F6E094669
+      656C644E616D65060C52656C61506F736974696F6E0844617461547970650218
+      084461746153697A6503FF000549734B6579080F4E65656450726F636573734E
+      616D65080001044E616D65060B44726177696E67436F6465094669656C644E61
+      6D65060B44726177696E67436F64650844617461547970650218084461746153
+      697A6502320549734B6579080F4E65656450726F636573734E616D65090000}
+  end
+end

+ 316 - 0
Report/DataPrepare/rdpBillsGatherDm.pas

@@ -0,0 +1,316 @@
+unit rdpBillsGatherDm;
+// Report Data Prepare -- Gcl_Bills_Gather
+
+interface
+
+uses
+  SysUtils, Classes, sdProvider, sdDB, ADODB, GclBillsGatherModel,
+  ProjectData;
+
+type
+  TrdpBillsGatherData = class(TDataModule)
+    sdpGclBills: TsdADOProvider;
+    sddGclBills: TsdDataSet;
+    sdpDetailGclBills: TsdADOProvider;
+    sddDetailGclBills: TsdDataSet;
+    sdpDetailBGLBills: TsdADOProvider;
+    sddDetailBGLBills: TsdDataSet;
+    sdpDetailDealBills: TsdADOProvider;
+    sddDetailDealBills: TsdDataSet;
+    sdpLeafXmjs: TsdADOProvider;
+    sddLeafXmjs: TsdDataSet;
+  private
+    FProjectData: TProjectData;
+
+    procedure BeforeWrite;
+    procedure AfterWrite;
+
+    procedure WriteDetailDealNode(AGclNode: TGclNode);
+    procedure WriteDetailBGLNode(AGclNode: TGclNode);
+    procedure WriteDetailGclNode(AGclNode: TGclNode);
+    procedure WriteGclNode(AGclNode: TGclNode);
+    procedure WriteLeafXmjNode(ALeafXmj: TLeafXmjNode);
+    procedure WriteGatherRecord(AGcls, AXmjs: TList);
+  public
+    constructor Create(AProjectData: TProjectData);
+    destructor Destroy; override;
+
+    procedure LoadGclBillsGatherData;
+  end;
+
+implementation
+
+uses
+  mPegFilter;
+
+{$R *.dfm}
+
+{ TrdpBillsGatherData }
+
+procedure TrdpBillsGatherData.AfterWrite;
+begin
+  sddGclBills.EndUpdate;
+  sddLeafXmjs.EndUpdate;
+  sddDetailGclBills.EndUpdate;
+  sddDetailBGLBills.EndUpdate;
+  sddDetailDealBills.EndUpdate;
+end;
+
+procedure TrdpBillsGatherData.BeforeWrite;
+begin
+  sddGclBills.BeginUpdate;
+  sddLeafXmjs.BeginUpdate;
+  sddDetailGclBills.BeginUpdate;
+  sddDetailBGLBills.BeginUpdate;
+  sddDetailDealBills.BeginUpdate;
+end;
+
+constructor TrdpBillsGatherData.Create(AProjectData: TProjectData);
+begin
+  inherited Create(nil);
+  FProjectData := AProjectData;
+  sdpLeafXmjs.Connection := FProjectData.ADOConnection;
+  sddLeafXmjs.Open;
+  sdpGclBills.Connection := FProjectData.ADOConnection;
+  sddGclBills.Open;
+  sdpDetailGclBills.Connection := FProjectData.ADOConnection;
+  sddDetailGclBills.Open;
+  sdpDetailBGLBills.Connection := FProjectData.ADOConnection;
+  sddDetailBGLBills.Open;
+  sdpDetailDealBills.Connection := FProjectData.ADOConnection;
+  sddDetailDealBills.Open;
+end;
+
+destructor TrdpBillsGatherData.Destroy;
+begin
+  sddLeafXmjs.Save;
+  sddGclBills.Save;
+  sddDetailGclBills.Save;
+  sddDetailBGLBills.Save;
+  sddDetailDealBills.Save;
+  inherited;
+end;
+
+procedure TrdpBillsGatherData.LoadGclBillsGatherData;
+var
+  Gather: TGclGatherModel;
+begin
+  Gather := TGclGatherModel.Create(FProjectData);
+  try
+    Gather.WriteGatherData := WriteGatherRecord;
+    Gather.Execute;
+  finally
+    Gather.Free;
+  end;
+end;
+
+procedure TrdpBillsGatherData.WriteDetailBGLNode(AGclNode: TGclNode);
+var
+  iBGL: Integer;
+  vBGL: TDetailBGLNode;
+  Rec: TsdDataRecord;
+begin
+  for iBGL := 0 to AGclNode.DetailBGLCount - 1 do
+  begin
+    vBGL := AGclNode.DetailBGL[iBGL];
+    Rec := sddDetailBGLBills.Add;
+
+    Rec.ValueByName('ID').AsInteger := vBGL.ID;
+    Rec.ValueByName('BillsID').AsInteger := AGclNode.ID;
+    Rec.ValueByName('BGBillsID').AsInteger := vBGL.BGBillsID;
+    Rec.ValueByName('BGLID').AsInteger := vBGL.BGLID;
+
+    Rec.ValueByName('BGLCode').AsString := vBGL.BGLCode;
+    Rec.ValueByName('BGLName').AsString := vBGL.BGLName;
+    Rec.ValueByName('BGLApprovalCode').AsString := vBGL.BGLApprovalCode;
+    Rec.ValueByName('BGLDrawingCode').AsString := vBGL.BGLDrawingCode;
+
+    Rec.ValueByName('Quantity').AsFloat := vBGL.Quantity;
+    Rec.ValueByName('TotalPrice').AsFloat := vBGL.TotalPrice;
+  end;
+end;
+
+procedure TrdpBillsGatherData.WriteDetailDealNode(AGclNode: TGclNode);
+var
+  iDeal: Integer;
+  vDeal: TDetailDealNode;
+  Rec: TsdDataRecord;
+begin
+  for iDeal := 0 to AGclNode.DetailDealCount - 1 do
+  begin
+    vDeal := AGclNode.DetailDeal[iDeal];
+    Rec := sddDetailDealBills.Add;
+    Rec.ValueByName('ID').AsInteger := vDeal.ID;
+    Rec.ValueByName('BillsID').AsInteger := AGclNode.ID;
+    Rec.ValueByName('DealID').AsInteger := vDeal.DealID;
+
+    Rec.ValueByName('Quantity').AsFloat := vDeal.Quantity;
+    Rec.ValueByName('TotalPrice').AsFloat := vDeal.TotalPrice;
+  end;
+end;
+
+procedure TrdpBillsGatherData.WriteDetailGclNode(AGclNode: TGclNode);
+var
+  iDetailGcl: Integer;
+  vDetailGcl: TDetailGclNode;
+  Rec: TsdDataRecord;
+begin
+  for iDetailGcl := 0 to AGclNode.DetailGclCount -1 do
+  begin
+    vDetailGcl := AGclNode.DetailGcl[iDetailGcl];
+
+    Rec := sddDetailGclBills.Add;
+    Rec.ValueByName('ID').AsInteger := vDetailGcl.ID;
+    Rec.ValueByName('BillsID').AsInteger := AGclNode.ID;
+    Rec.ValueByName('TreeSerialNo').AsInteger := vDetailGcl.TreeSerialNo;
+    Rec.ValueByName('RelaBillsID').AsInteger := vDetailGcl.BillsID;
+
+    if Assigned(vDetailGcl.LeafXmj) then
+      Rec.ValueByName('LeafXmjID').AsInteger := vDetailGcl.LeafXmj.ID
+    else
+      Rec.ValueByName('LeafXmjID').AsInteger := -1;
+
+    Rec.ValueByName('Quantity').AsFloat := vDetailGcl.Quantity;
+    Rec.ValueByName('TotalPrice').AsFloat := vDetailGcl.TotalPrice;
+
+    Rec.ValueByName('CurDealQuantity').AsFloat := vDetailGcl.CurDealQuantity;
+    Rec.ValueByName('CurDealTotalPrice').AsFloat := vDetailGcl.CurDealTotalPrice;
+    Rec.ValueByName('CurQcQuantity').AsFloat := vDetailGcl.CurQcQuantity;
+    Rec.ValueByName('CurQcTotalPrice').AsFloat := vDetailGcl.CurQcTotalPrice;
+    Rec.ValueByName('CurGatherQuantity').AsFloat := vDetailGcl.CurGatherQuantity;
+    Rec.ValueByName('CurGatherTotalPrice').AsFloat := vDetailGcl.CurGatherTotalPrice;
+
+    Rec.ValueByName('PreDealQuantity').AsFloat := vDetailGcl.PreDealQuantity;
+    Rec.ValueByName('PreDealTotalPrice').AsFloat := vDetailGcl.PreDealTotalPrice;
+    Rec.ValueByName('PreQcQuantity').AsFloat := vDetailGcl.PreQcQuantity;
+    Rec.ValueByName('PreQcTotalPrice').AsFloat := vDetailGcl.PreQcTotalPrice;
+    Rec.ValueByName('PreGatherQuantity').AsFloat := vDetailGcl.PreGatherQuantity;
+    Rec.ValueByName('PreGatherTotalPrice').AsFloat := vDetailGcl.PreGatherTotalPrice;
+
+    Rec.ValueByName('EndDealQuantity').AsFloat := vDetailGcl.EndDealQuantity;
+    Rec.ValueByName('EndDealTotalPrice').AsFloat := vDetailGcl.EndDealTotalPrice;
+    Rec.ValueByName('EndQcQuantity').AsFloat := vDetailGcl.EndQcQuantity;
+    Rec.ValueByName('EndQcTotalPrice').AsFloat := vDetailGcl.EndQcTotalPrice;
+    Rec.ValueByName('EndGatherQuantity').AsFloat := vDetailGcl.EndGatherQuantity;
+    Rec.ValueByName('EndGatherTotalPrice').AsFloat := vDetailGcl.EndGatherTotalPrice;
+
+    Rec.ValueByName('AddDealQuantity').AsFloat := vDetailGcl.AddDealQuantity;
+    Rec.ValueByName('AddDealTotalPrice').AsFloat := vDetailGcl.AddDealTotalPrice;
+    Rec.ValueByName('AddQcQuantity').AsFloat := vDetailGcl.AddQcQuantity;
+    Rec.ValueByName('AddQcTotalPrice').AsFloat := vDetailGcl.AddQcTotalPrice;
+    Rec.ValueByName('AddGatherQuantity').AsFloat := vDetailGcl.AddGatherQuantity;
+    Rec.ValueByName('AddGatherTotalPrice').AsFloat := vDetailGcl.AddGatherTotalPrice;
+  end;
+end;
+
+procedure TrdpBillsGatherData.WriteGatherRecord(AGcls, AXmjs: TList);
+var
+  iGcl, iXmj: Integer;
+  vGclNode: TGclNode;
+  vLeafXmj: TLeafXmjNode;
+begin
+  BeforeWrite;
+  try
+    for iGcl := 0 to AGcls.Count - 1 do
+    begin
+      vGclNode := TGclNode(AGcls.Items[iGcl]);
+      WriteGclNode(vGclNode);
+    end;
+
+    for iXmj := 0 to AXmjs.Count - 1 do
+    begin
+      vLeafXmj := TLeafXmjNode(AXmjs.Items[iXmj]);
+      WriteLeafXmjNode(vLeafXmj);
+    end;
+  finally
+    AfterWrite;
+  end;
+end;
+
+procedure TrdpBillsGatherData.WriteGclNode(AGclNode: TGclNode);
+var
+  Rec: TsdDataRecord;
+begin
+  Rec := sddGclBills.Add;
+  Rec.ValueByName('ID').AsInteger := AGclNode.ID;
+
+  Rec.ValueByName('IndexCode').AsString := AGclNode.IndexCode;
+  Rec.ValueByName('B_Code').AsString := AGclNode.B_Code;
+  Rec.ValueByName('Name').AsString := AGclNode.Name;
+  Rec.ValueByName('Units').AsString := AGclNode.Units;
+  Rec.ValueByName('Price').AsFloat := AGclNode.Price;
+
+  Rec.ValueByName('OrgQuantity').AsFloat := AGclNode.OrgQuantity;
+  Rec.ValueByName('OrgTotalPrice').AsFloat := AGclNode.OrgTotalPrice;
+  Rec.ValueByName('MisQuantity').AsFloat := AGclNode.MisQuantity;
+  Rec.ValueByName('MisTotalPrice').AsFloat := AGclNode.MisTotalPrice;
+  Rec.ValueByName('OthQuantity').AsFloat := AGclNode.OthQuantity;
+  Rec.ValueByName('OthTotalPrice').AsFloat := AGclNode.OthTotalPrice;
+
+  Rec.ValueByName('Quantity').AsFloat := AGclNode.Quantity;
+  Rec.ValueByName('TotalPrice').AsFloat := AGclNode.TotalPrice;
+
+  Rec.ValueByName('CurDealQuantity').AsFloat := AGclNode.CurDealQuantity;
+  Rec.ValueByName('CurDealTotalPrice').AsFloat := AGclNode.CurDealTotalPrice;
+  Rec.ValueByName('CurQcQuantity').AsFloat := AGclNode.CurQcQuantity;
+  Rec.ValueByName('CurQcTotalPrice').AsFloat := AGclNode.CurQcTotalPrice;
+  Rec.ValueByName('CurGatherQuantity').AsFloat := AGclNode.CurGatherQuantity;
+  Rec.ValueByName('CurGatherTotalPrice').AsFloat := AGclNode.CurGatherTotalPrice;
+
+  Rec.ValueByName('PreDealQuantity').AsFloat := AGclNode.PreDealQuantity;
+  Rec.ValueByName('PreDealTotalPrice').AsFloat := AGclNode.PreDealTotalPrice;
+  Rec.ValueByName('PreQcQuantity').AsFloat := AGclNode.PreQcQuantity;
+  Rec.ValueByName('PreQcTotalPrice').AsFloat := AGclNode.PreQcTotalPrice;
+  Rec.ValueByName('PreGatherQuantity').AsFloat := AGclNode.PreGatherQuantity;
+  Rec.ValueByName('PreGatherTotalPrice').AsFloat := AGclNode.PreGatherTotalPrice;
+
+  Rec.ValueByName('EndDealQuantity').AsFloat := AGclNode.EndDealQuantity;
+  Rec.ValueByName('EndDealTotalPrice').AsFloat := AGclNode.EndDealTotalPrice;
+  Rec.ValueByName('EndQcQuantity').AsFloat := AGclNode.EndQcQuantity;
+  Rec.ValueByName('EndQcTotalPrice').AsFloat := AGclNode.EndQcTotalPrice;
+  Rec.ValueByName('EndGatherQuantity').AsFloat := AGclNode.EndGatherQuantity;
+  Rec.ValueByName('EndGatherTotalPrice').AsFloat := AGclNode.EndGatherTotalPrice;
+
+  Rec.ValueByName('AddDealQuantity').AsFloat := AGclNode.AddDealQuantity;
+  Rec.ValueByName('AddDealTotalPrice').AsFloat := AGclNode.AddDealTotalPrice;
+  Rec.ValueByName('AddQcQuantity').AsFloat := AGclNode.AddQcQuantity;
+  Rec.ValueByName('AddQcTotalPrice').AsFloat := AGclNode.AddQcTotalPrice;
+  Rec.ValueByName('AddGatherQuantity').AsFloat := AGclNode.AddGatherQuantity;
+  Rec.ValueByName('AddGatherTotalPrice').AsFloat := AGclNode.AddGatherTotalPrice;
+
+  Rec.ValueByName('DealQuantity').AsFloat := AGclNode.DealQuantity;
+  Rec.ValueByName('DealTotalPrice').AsFloat := AGclNode.DealTotalPrice;
+
+  Rec.ValueByName('BGLQuantity').AsFloat := AGclNode.BGLQuantity;
+  Rec.ValueByName('BGLTotalPrice').AsFloat := AGclNode.BGLTotalPrice;
+
+  WriteDetailGclNode(AGclNode);
+  WriteDetailDealNode(AGclNode);
+  WriteDetailBGLNode(AGclNode);
+end;
+
+procedure TrdpBillsGatherData.WriteLeafXmjNode(ALeafXmj: TLeafXmjNode);
+var
+  Rec: TsdDataRecord;
+begin
+  Rec := sddLeafXmjs.Add;
+
+  Rec.ValueByName('ID').AsInteger := ALeafXmj.ID;
+  Rec.ValueByName('Code').AsString := ALeafXmj.XmjCode;
+  Rec.ValueByName('Name').AsString := ALeafXmj.XmjName;
+  Rec.ValueByName('Units').AsString := ALeafXmj.XmjUnits;
+
+  Rec.ValueByName('NameDanWei').AsString := ALeafXmj.NameDanWei;
+  Rec.ValueByName('NameFenBu').AsString := ALeafXmj.NameFenBu;
+  Rec.ValueByName('NameFenXiang').AsString := ALeafXmj.NameFenXiang;
+  Rec.ValueByName('NameUnit').AsString := ALeafXmj.NameUnit;
+
+  Rec.ValueByName('Peg').AsString := ALeafXmj.Peg;
+  if PegFilter.Filter(ALeafXmj.Peg) then
+    Rec.ValueByName('PegLength').AsFloat := PegFilter.EndPegNum - PegFilter.BeginPegNum;
+
+  Rec.ValueByName('RelaPosition').AsString := ALeafXmj.Position;
+  Rec.ValueByName('DrawingCode').AsString := ALeafXmj.DrawingCode;
+end;
+
+end.

+ 269 - 0
Report/DataPrepare/rdpTables.pas

@@ -0,0 +1,269 @@
+unit rdpTables;
+
+interface
+
+uses
+  DataBaseTables;
+
+const
+  {GclBillsGather}
+  S_rdpLeafXmjs = 'rdp_LeafXmjs';
+  td_rdpLeafXmjs: array [0..11] of TScFieldDef =(
+    // Key -- 可直接关联Bills中的ID得到最底层项目节数据
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+
+    // 通过ID关联Bills所得
+    // 编号
+    (FieldName: 'Code'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 名称
+    (FieldName: 'Name'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 单位
+    (FieldName: 'Units'; FieldType: ftString; Size: 20; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 图号
+    (FieldName: 'DrawingCode'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 根据最底层项目节及其父项的名称运算得到
+    // 单位工程
+    (FieldName: 'NameDanWei'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 分部工程
+    (FieldName: 'NameFenBu'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 分项工程
+    (FieldName: 'NameFenXiang'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 计量单元
+    (FieldName: 'NameUnit'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 位置
+    (FieldName: 'RelaPosition'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 桩号
+    (FieldName: 'Peg'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 桩号长度
+    (FieldName: 'PegLength'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+  S_rdpGclBills = 'rdp_GclBills';
+  td_rdpGclBills: array [0..41] of TScFieldDef =(
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+
+    // 索引编号 - B_Code转化为排序用
+    (FieldName: 'IndexCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 清单编号
+    (FieldName: 'B_Code'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 名称
+    (FieldName: 'Name'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 单位
+    (FieldName: 'Units'; FieldType: ftString; Size: 20; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 单价
+    (FieldName: 'Price'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 施工图原设计 -- 数量
+    (FieldName: 'OrgQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 施工图原设计 -- 金额
+    (FieldName: 'OrgTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 设计错漏增减 -- 数量
+    (FieldName: 'MisQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 设计错漏增减 -- 金额
+    (FieldName: 'MisTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 其他原因增减 -- 数量
+    (FieldName: 'OthQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 其他原因增减 -- 金额
+    (FieldName: 'OthTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 合同 - 数量
+    (FieldName: 'Quantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 合同 - 金额
+    (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 本期 - 合同计量 - 数量
+    (FieldName: 'CurDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 合同计量 - 金额
+    (FieldName: 'CurDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 数量变更 - 数量
+    (FieldName: 'CurQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 数量变更 - 金额
+    (FieldName: 'CurQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 完成计量 - 数量
+    (FieldName: 'CurGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 完成计量 - 金额
+    (FieldName: 'CurGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 截止上期 - 合同计量 - 数量
+    (FieldName: 'PreDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 合同计量 - 金额
+    (FieldName: 'PreDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 数量变更 - 数量
+    (FieldName: 'PreQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 数量变更 - 金额
+    (FieldName: 'PreQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 完成计量 - 数量
+    (FieldName: 'PreGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 完成计量 - 金额
+    (FieldName: 'PreGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 截止本期 - 合同计量 - 数量
+    (FieldName: 'EndDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 合同计量 - 金额
+    (FieldName: 'EndDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 数量变更 - 数量
+    (FieldName: 'EndQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 数量变更 - 金额
+    (FieldName: 'EndQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 完成计量 - 数量
+    (FieldName: 'EndGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 完成计量 - 金额
+    (FieldName: 'EndGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 累计 - 合同计量 - 数量
+    (FieldName: 'AddDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 合同计量 - 金额
+    (FieldName: 'AddDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 数量变更 - 数量
+    (FieldName: 'AddQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 数量变更 - 金额
+    (FieldName: 'AddQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 完成计量 - 数量
+    (FieldName: 'AddGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 完成计量 - 金额
+    (FieldName: 'AddGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 签约清单 - 数量
+    (FieldName: 'DealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 签约清单 - 金额
+    (FieldName: 'DealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 变更令 - 数量
+    (FieldName: 'BGLQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 变更令 - 金额
+    (FieldName: 'BGLTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+  S_rdpDetailGclBills = 'rdp_DetailGclBills';
+  td_rdpDetailGclBills: array [0..36] of TScFieldDef =(
+    // Key
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 rdp_GclBills中的ID字段
+    (FieldName: 'BillsID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 使用RelaBillsID关联的数据行中SerialNo的取值
+    (FieldName: 'TreeSerialNo'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 Bills中的ID字段
+    (FieldName: 'RelaBillsID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 rdp_LeafXmjs中的ID字段
+    (FieldName: 'LeafXmjID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+
+
+    // 施工图原设计 -- 数量
+    (FieldName: 'OrgQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 施工图原设计 -- 金额
+    (FieldName: 'OrgTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 设计错漏增减 -- 数量
+    (FieldName: 'MisQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 设计错漏增减 -- 金额
+    (FieldName: 'MisTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 其他原因增减 -- 数量
+    (FieldName: 'OthQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 其他原因增减 -- 金额
+    (FieldName: 'OthTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 合同 - 数量
+    (FieldName: 'Quantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 合同 - 金额
+    (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 本期 - 合同计量 - 数量
+    (FieldName: 'CurDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 合同计量 - 金额
+    (FieldName: 'CurDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 数量变更 - 数量
+    (FieldName: 'CurQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 数量变更 - 金额
+    (FieldName: 'CurQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 完成计量 - 数量
+    (FieldName: 'CurGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期 - 完成计量 - 金额
+    (FieldName: 'CurGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 截止上期 - 合同计量 - 数量
+    (FieldName: 'PreDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 合同计量 - 金额
+    (FieldName: 'PreDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 数量变更 - 数量
+    (FieldName: 'PreQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 数量变更 - 金额
+    (FieldName: 'PreQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 完成计量 - 数量
+    (FieldName: 'PreGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 - 完成计量 - 金额
+    (FieldName: 'PreGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 截止本期 - 合同计量 - 数量
+    (FieldName: 'EndDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 合同计量 - 金额
+    (FieldName: 'EndDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 数量变更 - 数量
+    (FieldName: 'EndQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 数量变更 - 金额
+    (FieldName: 'EndQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 完成计量 - 数量
+    (FieldName: 'EndGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期 - 完成计量 - 金额
+    (FieldName: 'EndGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 累计 - 合同计量 - 数量
+    (FieldName: 'AddDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 合同计量 - 金额
+    (FieldName: 'AddDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 数量变更 - 数量
+    (FieldName: 'AddQcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 数量变更 - 金额
+    (FieldName: 'AddQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 完成计量 - 数量
+    (FieldName: 'AddGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计 - 完成计量 - 金额
+    (FieldName: 'AddGatherTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+  S_rdpDetailDealBills = 'rdp_DetailDealBills';
+  td_rdpDetailDealBills: array [0..4] of TScFieldDef =(
+    // Key
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 rdp_GclBills中的ID字段
+    (FieldName: 'BillsID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 DealBils中的ID字段
+    (FieldName: 'DealID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+
+    // 通过DealID关联DealBills所得数据
+    // 签约 - 数量
+    (FieldName: 'Quantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 签约 - 金额
+    (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+  S_rdpDetailBGLBills = 'rdp_DetailBGLBills';
+  td_rdpDetailBGLBills: array [0..9] of TScFieldDef =(
+    // Key
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 rdp_GclBills中的ID字段
+    (FieldName: 'BillsID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 BGBills中的ID字段
+    (FieldName: 'BGBillsID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 关联 BGL中的ID字段
+    (FieldName: 'BGLID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+
+    // 通过BGLID关联BGL所得数据
+    // 变更令 -- 变更令号
+    (FieldName: 'BGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 变更令 -- 名称
+    (FieldName: 'BGLName'; FieldType: ftString; Size: 255; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 变更令 -- 批复文号
+    (FieldName: 'BGLApprovalCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 变更令 -- 变更图号
+    (FieldName: 'BGLDrawingCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 通过BGBillsID关联BGBills所得数据
+    // 变更清单 - 数量
+    (FieldName: 'Quantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 变更清单 - 金额
+    (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+implementation
+
+end.

+ 98 - 0
Report/ReportPrepare.pas

@@ -0,0 +1,98 @@
+unit ReportPrepare;
+
+interface
+
+uses
+  rdpBillsGatherDm, ProjectData;
+
+type
+  TReportPrepare = class
+  private
+    FProjectData: TProjectData;
+    FPrepareGclGather: Boolean;
+
+    procedure GatherGclAndSave;
+    procedure UpdateGclGatherTables;
+    procedure PrepareGclGatherData;
+  public
+    constructor Create(AProjectData: TProjectData);
+    destructor Destroy; override;
+
+    procedure PrepareData(AFlag: Integer);
+  end;
+
+implementation
+
+uses
+  ScAutoUpdateUnit, rdpTables, ComObj, UtilMethods, ZhAPI, Classes,
+  ConstUnit;
+
+{ TReportPrepare }
+
+constructor TReportPrepare.Create(AProjectData: TProjectData);
+begin
+  FProjectData := AProjectData;
+  FPrepareGclGather := False;
+  FProjectData.ClearReportPrepareData;
+end;
+
+destructor TReportPrepare.Destroy;
+begin
+  FProjectData.ClearReportPrepareData;
+end;
+
+procedure TReportPrepare.GatherGclAndSave;
+var
+  DataSaver: TrdpBillsGatherData;
+begin
+  DataSaver := TrdpBillsGatherData.Create(FProjectData);
+  try
+    DataSaver.LoadGclBillsGatherData;
+  finally
+    DataSaver.Free;
+  end;
+end;
+
+procedure TReportPrepare.PrepareData(AFlag: Integer);
+begin
+  case AFlag of
+    1: PrepareGclGatherData;
+  end;
+  // For Test
+  if G_IsTest then
+    FProjectData.SaveDebugFile(GetAppFilePath+'ReportDataPrepare.dat');
+end;
+
+procedure TReportPrepare.PrepareGclGatherData;
+begin
+  if FPrepareGclGather then Exit;
+
+  try
+    UpdateGclGatherTables;
+    GatherGclAndSave;
+    FPrepareGclGather := True;
+  except
+    FPrepareGclGather := False;
+  end;
+end;
+
+procedure TReportPrepare.UpdateGclGatherTables;
+var
+  Updater: TScUpdater;
+begin
+  Updater := TScUpdater.Create;
+  try
+    Updater.ForceUpdate := True;
+    Updater.Open('', FProjectData.ADOConnection, '', '');
+    Updater.AddTableDef(S_rdpLeafXmjs, @td_rdpLeafXmjs, Length(td_rdpLeafXmjs), False, False);
+    Updater.AddTableDef(S_rdpGclBills, @td_rdpGclBills, Length(td_rdpGclBills), False, False);
+    Updater.AddTableDef(S_rdpDetailGclBills, @td_rdpDetailGclBills, Length(td_rdpDetailGclBills), False, False);
+    Updater.AddTableDef(S_rdpDetailDealBills, @td_rdpDetailDealBills, Length(td_rdpDetailDealBills), False, False);
+    Updater.AddTableDef(S_rdpDetailBGLBills, @td_rdpDetailBGLBills, Length(td_rdpDetailBGLBills), False, False);
+    Updater.ExcuteUpdate;
+  finally
+    Updater.Free;
+  end;
+end;
+
+end.

+ 236 - 0
Units/ColVisibleManager.pas

@@ -0,0 +1,236 @@
+unit ColVisibleManager;
+
+interface
+
+uses
+  Classes, sdGridDBA, ZhAPI;
+
+type
+  TColVisible = class
+  private
+    FCustom: Boolean;
+    // Defualt CaptionAcrossCols
+    FDefaultCAC: Integer;
+    FDBACol: TsdGridColumn;
+  public
+    constructor Create(ACol: TsdGridColumn); virtual;
+
+    procedure RefreshVisible; virtual;
+
+    property DBACol: TsdGridColumn read FDBACol;
+    property DefaultCAC: Integer read FDefaultCAC;
+    property Custom: Boolean read FCustom write FCustom;
+  end;
+
+  TBM_ColVisible = class(TColVisible)
+  private
+    FPriceChange: Boolean;
+    FBGLCode: Boolean;
+    FAlias: Boolean;
+    FDesign: Boolean;
+  public
+    constructor Create(ACol: TsdGridColumn); override;
+
+    procedure RefreshVisible; override;
+
+    property PriceChange: Boolean read FPriceChange write FPriceChange;
+    property BGLCode: Boolean read FBGLCode write FBGLCode;
+    property Design: Boolean read FDesign write FDesign;
+    property Alias: Boolean read FAlias write FAlias;
+  end;
+
+  TColVisibleManager = class
+  private
+    FColVisibles: TList;
+  protected
+    function CreateColVisible(ACol: TsdGridColumn): TColVisible; virtual;
+  public
+    constructor Create(ACols: TsdGridColumnList);
+    destructor Destroy; override;
+
+    procedure RefreshVisible;
+
+    procedure ShowGridCol(AShow: Boolean; ABeginCol, AEndCol: Integer);
+  end;
+
+  TBM_ColVisibleManager = class(TColVisibleManager)
+  protected
+    function CreateColVisible(ACol: TsdGridColumn): TColVisible; override;
+  public
+    procedure ShowPriceChange(AShow: Boolean);
+    procedure ShowBGLCode(AShow: Boolean);
+    procedure ShowDesign(AShow: Boolean);
+    procedure ShowAlias(AShow: Boolean);
+  end;
+
+implementation
+
+uses SysUtils;
+
+{ TColVisible }
+
+constructor TColVisible.Create(ACol: TsdGridColumn);
+begin
+  FDBACol := ACol;
+  FDefaultCAC := StrToIntDef(FDBACol.Title.CaptionAcrossCols, 1);
+  FCustom := FDBACol.Visible;
+end;
+
+procedure TColVisible.RefreshVisible;
+begin
+  FDBACol.Visible := FCustom;
+end;
+
+{ TBM_ColVisible }
+
+constructor TBM_ColVisible.Create(ACol: TsdGridColumn);
+begin
+  inherited;
+  FPriceChange := True;
+  FBGLCode := True;
+  FDesign := True;
+  FAlias := True;
+end;
+
+procedure TBM_ColVisible.RefreshVisible;
+begin
+  FDBACol.Visible := FCustom and FPriceChange and FBGLCode and FDesign and FAlias;
+end;
+
+{ TColVisibleManager }
+
+constructor TColVisibleManager.Create(ACols: TsdGridColumnList);
+var
+  iCol: Integer;
+  ColVisible: TColVisible;
+begin
+  FColVisibles := TList.Create;
+  for iCol := 0 to ACols.Count - 1 do
+  begin
+    ColVisible := CreateColVisible(ACols.Items[iCol]);
+    FColVisibles.Add(ColVisible);
+  end;
+end;
+
+function TColVisibleManager.CreateColVisible(
+  ACol: TsdGridColumn): TColVisible;
+begin
+  Result := TColVisible.Create(ACol);
+end;
+
+destructor TColVisibleManager.Destroy;
+begin
+  ClearObjects(FColVisibles);
+  FColVisibles.Free;
+  inherited;
+end;
+
+procedure TColVisibleManager.RefreshVisible;
+var
+  iCol: Integer;
+begin
+  for iCol := 0 to FColVisibles.Count - 1 do
+    TColVisible(FColVisibles.Items[iCol]).RefreshVisible;
+end;
+
+procedure TColVisibleManager.ShowGridCol(AShow: Boolean; ABeginCol,
+  AEndCol: Integer);
+var
+  iCol, iRelaCol: Integer;
+  vCol, vRelaCol: TColVisible;
+begin
+  for iCol := ABeginCol to AEndCol do
+  begin
+    vCol := TColVisible(FColVisibles.Items[iCol]);
+    if Pos('|', vCol.DBACol.Title.Caption) <> 1 then
+    begin
+      vCol.Custom := AShow;
+      if vCol.DefaultCAC > 1 then
+      begin
+        for iRelaCol := 1 to vCol.DefaultCAC - 1 do
+        begin
+          vRelaCol := TColVisible(FColVisibles.Items[iCol+iRelaCol]);
+          vRelaCol.Custom := AShow;
+        end;
+      end;
+    end;
+  end;
+  RefreshVisible;
+end;
+
+{ TBM_ColVisibleManager }
+
+function TBM_ColVisibleManager.CreateColVisible(
+  ACol: TsdGridColumn): TColVisible;
+begin
+  Result := TBM_ColVisible.Create(ACol);
+end;
+
+procedure TBM_ColVisibleManager.ShowAlias(AShow: Boolean);
+var
+  iCol: Integer;
+  vCol: TBM_ColVisible;
+begin
+  for iCol := 0 to FColVisibles.Count - 1 do
+  begin
+    vCol := TBM_ColVisible(FColVisibles.Items[iCol]);
+    if SameText('Alias', vCol.DBACol.FieldName) then
+      vCol.FAlias := AShow;
+  end;
+  RefreshVisible;
+end;
+
+procedure TBM_ColVisibleManager.ShowBGLCode(AShow: Boolean);
+var
+  iCol: Integer;
+  vCol: TBM_ColVisible;
+begin
+  for iCol := 0 to FColVisibles.Count - 1 do
+  begin
+    vCol := TBM_ColVisible(FColVisibles.Items[iCol]);
+    if SameText('CurQcQuantity', vCol.DBACol.FieldName) or
+        SameText('CurPcQuantity', vCol.DBACol.FieldName) then
+    begin
+      if AShow then
+        vCol.DBACol.Title.CaptionAcrossCols := '3'
+      else
+        vCol.DBACol.Title.CaptionAcrossCols := '2';
+    end
+    else if Pos('BGLCode', vCol.DBACol.FieldName) > 1 then
+      vCol.FBGLCode := AShow;
+  end;
+  RefreshVisible;
+end;
+
+procedure TBM_ColVisibleManager.ShowDesign(AShow: Boolean);
+var
+  iCol: Integer;
+  vCol: TBM_ColVisible;
+begin
+  for iCol := 0 to FColVisibles.Count - 1 do
+  begin
+    vCol := TBM_ColVisible(FColVisibles.Items[iCol]);
+    if Pos('Dgn', vCol.DBACol.FieldName) > 1 then
+      vCol.FDesign := AShow;
+  end;
+  RefreshVisible;
+end;
+
+procedure TBM_ColVisibleManager.ShowPriceChange(AShow: Boolean);
+var
+  iCol: Integer;
+  vCol: TBM_ColVisible;
+begin
+  for iCol := 0 to FColVisibles.Count - 1 do
+  begin
+    vCol := TBM_ColVisible(FColVisibles.Items[iCol]);
+    if SameText(vCol.DBACol.FieldName, 'NewPrice') or
+        (Pos('CurPc', vCol.DBACol.FieldName) = 1) or
+        (Pos('EndPc', vCol.DBACol.FieldName) = 1) or
+        (Pos('AddPc', vCol.DBACol.FieldName) = 1) then
+      vCol.PriceChange := AShow;
+  end;
+  RefreshVisible;
+end;
+
+end.

+ 8 - 1
Units/Connections.pas

@@ -8,7 +8,7 @@ uses
 const
   ProductName = 'Measure';
   EmptyFileVersion = '1.0.0.0';
-  FileVersion = '1.0.1.1';
+  FileVersion = '1.0.1.2';
   EncryptVersion = 'Auto1.0';
 
 type
@@ -79,6 +79,7 @@ type
     procedure Save; override;
 
     procedure UpdateFileVersion;
+    procedure SaveDebugFile(const AFileName: string);
 
     property NeedUpdate: Boolean read GetNeedUpdate;
     property OverExe: Boolean read GetOverExe;
@@ -405,6 +406,12 @@ begin
   Result := CompareCode(FileVersion, FFileHead.FileVersion, '.') < 0;
 end;
 
+procedure TEncryptConnection.SaveDebugFile(const AFileName: string);
+begin
+  CopyFile(PChar(FFileName), PChar(AFileName), False);
+  RecoverFileHead(AFileName);
+end;
+
 { TConnection }
 
 procedure TConnection.Close;

+ 16 - 16
Units/DataBaseTables.pas

@@ -178,17 +178,17 @@ const
     // 累计数量变更计量 - 金额
     (FieldName: 'AddQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计单价变更计量 - 变更令
-    (FieldName: 'AddQcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'AddQcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计单价变更计量 - 变更数量
-    (FieldName: 'AddQcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'AddQcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计单价变更计量 - 数量
     (FieldName: 'AddPcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计单价变更计量 - 金额
     (FieldName: 'AddPcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计单价变更计量 - 变更令
-    (FieldName: 'AddPcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'AddPcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计单价变更计量 - 变更数量
-    (FieldName: 'AddPcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'AddPcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计完成计量 - 数量
     (FieldName: 'AddGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 累计完成计量 - 金额
@@ -597,9 +597,9 @@ const
     // 数量公式
     (FieldName: 'QcFormula'; FieldType: ftString; Size: 200; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令
-    (FieldName: 'QcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'QcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令数量
-    (FieldName: 'QcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'QcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     //------------------ 本期单价变更计量 ----------------
     // 数量
     (FieldName: 'PcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -610,9 +610,9 @@ const
     // 数量公式
     (FieldName: 'PcFormula'; FieldType: ftString; Size: 200; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令
-    (FieldName: 'PcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令数量
-    (FieldName: 'PcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     //------------------ 本期完成变更计量 ----------------
     // 数量
     (FieldName: 'GatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -629,18 +629,18 @@ const
     // 金额
     (FieldName: 'EndQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令
-    (FieldName: 'EndQcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'EndQcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令数量
-    (FieldName: 'EndQcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'EndQcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     //---------------- 截止本期单价变更计量 ----------------
     // 数量
     (FieldName: 'EndPcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 金额
     (FieldName: 'EndPcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令
-    (FieldName: 'EndPcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'EndPcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令数量
-    (FieldName: 'EndPcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'EndPcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     //------------------ 截止本期完成计量 ----------------
     // 数量
     (FieldName: 'EndGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -657,18 +657,18 @@ const
     // 金额
     (FieldName: 'PreQcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令
-    (FieldName: 'PreQcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PreQcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令数量
-    (FieldName: 'PreQcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PreQcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     //---------------- 截止上期单价变更计量 ----------------
     // 数量
     (FieldName: 'PrePcQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 金额
     (FieldName: 'PrePcTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令
-    (FieldName: 'PrePcBGLCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PrePcBGLCode'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更令数量
-    (FieldName: 'PrePcBGLNum'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PrePcBGLNum'; FieldType: ftMemo; Size: 60535; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     //------------------ 截止上期完成计量 ----------------
     // 数量
     (FieldName: 'PreGatherQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),

+ 2 - 2
Units/GclBillsGatherModel.pas

@@ -7,7 +7,7 @@ uses
   Classes, mDataRecord, BillsTree;
 
 type
-  TGatherDataWriteEvent = procedure (AGLJs: TList) of object;
+  TGatherDataWriteEvent = procedure (AGcls, AXmjs: TList) of object;
 
   TLeafXmjNode = class
   private
@@ -509,7 +509,7 @@ begin
     GatherBGLData;
     CalculateAll;
     if Assigned(FWriteGatherData) then
-      FWriteGatherData(FGcls);
+      FWriteGatherData(FGcls, FXmjs);
   finally
     EndGather;
   end;

+ 26 - 7
Units/ProjectData.pas

@@ -63,7 +63,8 @@ type
 
     procedure SaveInfoToManager;
 
-    procedure ExecuteSql(const ASql: string);
+    procedure DropCacheTable(const AKey: string);
+
     // 备份0号台账的历史数据
     procedure CopyLedgerHistoryData(AAudit: Integer);
     // 备份各期的截止本期累计完成数据
@@ -127,6 +128,7 @@ type
     {OpenForReport3: OpenForReport2的基础上打开最后一个审核人数据,打开BillsMeasureTree不打开BillsCompileTree,链接BillsMeasureTree跟StageData}
     procedure OpenForReport3(const AFileName: string);
     //-----------------------  End ---后台打开 ------------------------
+    procedure SaveDebugFile(const AFileName: string);
 
     procedure SaveLastestPhaseMainData;
 
@@ -165,6 +167,8 @@ type
     {For Reports: 复制当期的全部数据到项目数据中}
     procedure CopyPhaseData;
     procedure ClearReportCacheData;
+    procedure ClearReportPrepareData;
+    procedure ExecuteSql(const ASql: string);
 
     procedure CalculateAll;
     procedure CalculatePriceMargin;
@@ -1761,6 +1765,24 @@ begin
 end;
 
 procedure TProjectData.ClearReportCacheData;
+begin
+  DropCacheTable('P_');
+end;
+
+function TProjectData.GetCanInsertNormalBills: Boolean;
+begin
+  if FProjProperties.PhaseCount > 0 then
+    Result := CanUnlockInfo
+  else
+    Result := True;
+end;
+
+procedure TProjectData.ClearReportPrepareData;
+begin
+  DropCacheTable('rdp_');
+end;
+
+procedure TProjectData.DropCacheTable(const AKey: string);
 var
   FTableList: TStringList;
   iIndex: Integer;
@@ -1772,7 +1794,7 @@ begin
     iIndex := 0;
     while iIndex < FTableList.Count do
     begin
-      if Pos('P_', FTableList.Strings[iIndex]) = 1 then
+      if Pos(AKey, FTableList.Strings[iIndex]) = 1 then
       begin
         sDeleteTableSql := Format('Drop Table %s', [FTableList.Strings[iIndex]]);
         ExecuteSql(sDeleteTableSql);
@@ -1784,12 +1806,9 @@ begin
   end;
 end;
 
-function TProjectData.GetCanInsertNormalBills: Boolean;
+procedure TProjectData.SaveDebugFile(const AFileName: string);
 begin
-  if FProjProperties.PhaseCount > 0 then
-    Result := CanUnlockInfo
-  else
-    Result := True;
+  FConnection.SaveDebugFile(AFileName);
 end;
 
 end.

+ 14 - 1
Units/ReportManager.pas

@@ -32,6 +32,8 @@ type
     FInteractSubFlag: Integer;
 
     FInteractInfo: TInteractInfo;
+    FDataPrepareFlag: Integer;
+    FDataBaseFlag: Integer;
 
     procedure ReadPropertyStr;
     procedure AnalyzePropertyStr;
@@ -60,6 +62,11 @@ type
     property InteractFlag: Integer read FInteractFlag;
     property InteractSubFlag: Integer read FInteractSubFlag;
 
+    // 数据准备类型
+    property DataPrepareFlag: Integer read FDataPrepareFlag;
+    // 链接数据库
+    property DataBaseFlag: Integer read FDataBaseFlag;
+
     property InteractInfo: TInteractInfo read FInteractInfo;
   end;
 
@@ -276,7 +283,11 @@ begin
         else if SameText(sgs.Names[I], '交互类型') then
           FInteractFlag := StrToIntDef(sgs.Values[sgs.Names[I]], 0)
         else if SameText(sgs.Names[I], '交互子类型') then
-          FInteractSubFlag := StrToIntDef(sgs.Values[sgs.Names[I]], 0);
+          FInteractSubFlag := StrToIntDef(sgs.Values[sgs.Names[I]], 0)
+        else if SameText(sgs.Names[I], '数据准备') then
+          FDataPrepareFlag := StrToIntDef(sgs.Values[sgs.Names[I]], 0)
+        else if SameText(sgs.Names[I], '数据库') then
+          FDataPrepareFlag := StrToIntDef(sgs.Values[sgs.Names[I]], 0);
       end;
     finally
       sgs.Free;
@@ -289,6 +300,8 @@ begin
   FFileName := AFileName;
   FInteractFlag := 0;
   FInteractSubFlag := 0;
+  FDataPrepareFlag := 0;
+  FDataBaseFlag := 0;
   LoadTemplateProperties;
 end;
 

+ 1 - 0
Units/ZhAPI.pas

@@ -82,3 +82,4 @@ end.
 
 
 
+