Sfoglia il codice sorgente

Merge branch 'master' of http://192.168.1.12:3000/MaiXinRong/Measure

chenshilong 6 anni fa
parent
commit
a7517531d2

+ 4 - 0
DataModules/BillsGatherDm.dfm

@@ -10,6 +10,7 @@ object BillsGatherData: TBillsGatherData
   end
   object sddGclBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = smpGclBills
     Left = 40
     Top = 72
@@ -288,6 +289,7 @@ object BillsGatherData: TBillsGatherData
   end
   object sddDetailGclBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = smpDetailGclBills
     Left = 40
     Top = 248
@@ -564,6 +566,7 @@ object BillsGatherData: TBillsGatherData
   end
   object sddDetailDealBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = smpDetailDealBills
     Left = 136
     Top = 248
@@ -631,6 +634,7 @@ object BillsGatherData: TBillsGatherData
   end
   object sddDetailBGLBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = smpDetailBGLBills
     Left = 240
     Top = 248

+ 38 - 3
DataModules/BillsGatherDm.pas

@@ -28,7 +28,7 @@ type
   private
     FProjectData: TObject;
 
-    procedure WriteGatherRecord(AGcls, AXmjs: TList);
+    procedure WriteGatherRecord(AGcls, AXmjs: TList; AGather: TGatherNode);
 
     function GetMainBillsTree: TsdIDTree;
   public
@@ -109,7 +109,7 @@ begin
   end;
 end;
 
-procedure TBillsGatherData.WriteGatherRecord(AGcls, AXmjs: TList);
+procedure TBillsGatherData.WriteGatherRecord(AGcls, AXmjs: TList; AGather: TGatherNode);
 var
   sCurB_Code, sCurName, sCurUnits, sCurPrice: string;
   bHasCurrrent: Boolean;
@@ -359,6 +359,40 @@ var
     WriteDetailBGLNode(AGclNode);
   end;
 
+  procedure WriteGatherNode(AGather: TGatherNode);
+  var
+    Rec: TsdDataRecord;
+  begin
+    Rec := sddGclBills.Add;
+    Rec.ValueByName('ID').AsInteger := AGather.ID;
+
+    Rec.ValueByName('IndexCode').AsString := '9999999999999999';
+    Rec.ValueByName('Name').AsString := 'ºÏ¼Æ';
+
+    Rec.ValueByName('DealTotalPrice').AsFloat := AGather.DealTotalPrice;
+    Rec.ValueByName('BGLTotalPrice').AsFloat := AGather.BGLTotalPrice;
+    Rec.ValueByName('TotalPrice').AsFloat := AGather.TotalPrice;
+
+    Rec.ValueByName('CurDealTotalPrice').AsFloat := AGather.CurDealTotalPrice;
+    Rec.ValueByName('CurQcTotalPrice').AsFloat := AGather.CurQcTotalPrice;
+    Rec.ValueByName('CurGatherTotalPrice').AsFloat := AGather.CurGatherTotalPrice;
+
+    Rec.ValueByName('PreDealTotalPrice').AsFloat := AGather.PreDealTotalPrice;
+    Rec.ValueByName('PreQcTotalPrice').AsFloat := AGather.PreQcTotalPrice;
+    Rec.ValueByName('PreGatherTotalPrice').AsFloat := AGather.PreGatherTotalPrice;
+
+    Rec.ValueByName('EndDealTotalPrice').AsFloat := AGather.EndDealTotalPrice;
+    Rec.ValueByName('EndQcTotalPrice').AsFloat := AGather.EndQcTotalPrice;
+    Rec.ValueByName('EndGatherTotalPrice').AsFloat := AGather.EndGatherTotalPrice;
+
+    Rec.ValueByName('AddDealTotalPrice').AsFloat := AGather.AddDealTotalPrice;
+    Rec.ValueByName('AddQcTotalPrice').AsFloat := AGather.AddQcTotalPrice;
+    Rec.ValueByName('AddGatherTotalPrice').AsFloat := AGather.AddGatherTotalPrice;
+
+    Rec.ValueByName('Deal_BGLTotalPrice').AsFloat := AGather.Deal_BGLTotalPrice;
+    Rec.ValueByName('Deal_BGLPercent').AsFloat := AGather.Deal_BGLPercent;
+  end;
+
 var
   iGcl: Integer;
   vGclNode: TGclNode;
@@ -369,7 +403,8 @@ begin
     begin
       vGclNode := TGclNode(AGcls.Items[iGcl]);
       WriteGclNode(vGclNode);
-    end;
+    end;                     
+    WriteGatherNode(AGather);
   finally
     AfterWrite;
   end;

+ 2 - 0
DataModules/PriceMarginBillsDm.dfm

@@ -10,6 +10,7 @@ object PriceMarginBillsData: TPriceMarginBillsData
   end
   object sddGclBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = sdmpGclBills
     Left = 64
     Top = 80
@@ -51,6 +52,7 @@ object PriceMarginBillsData: TPriceMarginBillsData
   end
   object sddDetailGclBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = sdmpDetailGclBills
     Left = 160
     Top = 80

+ 2 - 2
DataModules/PriceMarginBillsDm.pas

@@ -32,7 +32,7 @@ type
       AValue: TsdValue; AColumn: TsdViewColumn; var Allow: Boolean);
   private
     FProjectData: TObject;
-    procedure WriteGclBillsData(AGcls, AXmjs: TList);
+    procedure WriteGclBillsData(AGcls, AXmjs: TList; AGather: TGatherNode);
     function GetMainBillsTree: TBillsIDTree;
     function GetDecimal: TCalcDecimal;
   public
@@ -102,7 +102,7 @@ begin
   end;
 end;
 
-procedure TPriceMarginBillsData.WriteGclBillsData(AGcls, AXmjs: TList);
+procedure TPriceMarginBillsData.WriteGclBillsData(AGcls, AXmjs: TList; AGather: TGatherNode);
 
   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, AXmjs: TList);
+    procedure WriteData(AGcls, AXmjs: TList; AGather: TGatherNode);
 
     procedure GatherData;
   public
@@ -131,7 +131,7 @@ begin
   end;
 end;
 
-procedure TrmGcl_XmjBillsData.WriteData(AGcls, AXmjs: TList);
+procedure TrmGcl_XmjBillsData.WriteData(AGcls, AXmjs: TList; AGather: TGatherNode);
 begin
   case FGXType of
     gxtTopGcl, gxtWithoutXmj: WriteTopGclTypeData(AGcls);

+ 15 - 2
Forms/MainFrm.dfm

@@ -208,8 +208,8 @@ object MainForm: TMainForm
       object jpsProjects: TJimPages
         Left = 0
         Top = 0
-        Width = 971
-        Height = 440
+        Width = 742
+        Height = 417
         ActivePageIndex = -1
         Align = alClient
         Caption = 'jpsProjects'
@@ -437,6 +437,10 @@ object MainForm: TMainForm
         item
           Item = dxbtnExportBillsJson
           Visible = True
+        end
+        item
+          Item = dxbtnExportBillsPosExcelData
+          Visible = True
         end>
     end
     object dxsiEdit: TdxBarSubItem
@@ -1208,6 +1212,10 @@ object MainForm: TMainForm
       Action = actnExportBillsJson
       Category = 3
     end
+    object dxbtnExportBillsPosExcelData: TdxBarButton
+      Action = actnExportBillsPosExcelData
+      Category = 2
+    end
   end
   object Images: TImageList
     DrawingStyle = dsTransparent
@@ -3398,6 +3406,11 @@ object MainForm: TMainForm
       OnExecute = actnExportBillsJsonExecute
       OnUpdate = actnExportBillsJsonUpdate
     end
+    object actnExportBillsPosExcelData: TAction
+      Caption = #23548#20986#28165#21333#37096#20301#26126#32454'Excel'#25968#25454
+      OnExecute = actnExportBillsPosExcelDataExecute
+      OnUpdate = actnExportBillsJsonUpdate
+    end
   end
   object dxpmTabSet: TdxBarPopupMenu
     BarManager = dxBarManager

+ 19 - 0
Forms/MainFrm.pas

@@ -180,6 +180,8 @@ type
     actnImportSubTenderGather: TAction;
     dxbtnExportBillsJson: TdxBarButton;
     actnExportBillsJson: TAction;
+    dxbtnExportBillsPosExcelData: TdxBarButton;
+    actnExportBillsPosExcelData: TAction;
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;
@@ -231,6 +233,7 @@ type
     procedure actnImportSubTenderGatherUpdate(Sender: TObject);
     procedure actnExportBillsJsonExecute(Sender: TObject);
     procedure actnExportBillsJsonUpdate(Sender: TObject);
+    procedure actnExportBillsPosExcelDataExecute(Sender: TObject);
   private
     FProjectManagerFrame: TProjectManagerFrame;
     FProjectFrames: TList;
@@ -970,4 +973,20 @@ begin
   TAction(Sender).Enabled := jtsProjects.Tabs.Count > 1;
 end;
 
+procedure TMainForm.actnExportBillsPosExcelDataExecute(Sender: TObject);
+var
+  sFileName: string;
+  Exportor: TBillsPosExcelExportor;
+begin
+  if SaveExcelFile(sFileName) then
+  begin
+    Exportor := TBillsPosExcelExportor.Create;
+    try
+      Exportor.ExportToFile(CurProjectFrame.ProjectData.BillsCompileData.BillsCompileTree, sFileName);
+    finally
+      Exportor.Free;
+    end;
+  end;
+end;
+
 end.

+ 1 - 1
Frames/BillsGatherFme.pas

@@ -188,7 +188,7 @@ begin
   begin
     if ACoord.Y = zgGclBills.FixedRowCount then
       bSimilarBills := CheckSimilarBills(ACoord.Y, ACoord.Y + 1)
-    else if ACoord.Y < zgGclBills.RowCount - zgGclBills.FixedRowCount then
+    else if ACoord.Y < zgGclBills.FixedRowCount + saGclBills.DataView.RecordCount - 1 then
       bSimilarBills := CheckSimilarBills(ACoord.Y, ACoord.Y - 1) or
           CheckSimilarBills(ACoord.Y, ACoord.Y + 1)
     else

+ 330 - 264
Report/DataPrepare/rdpBillsGatherDm.dfm

@@ -11,133 +11,159 @@ object rdpBillsGatherData: TrdpBillsGatherData
   end
   object sddGclBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = sdpGclBills
     Left = 40
     Top = 72
     FieldListData = {
       0101044E616D6506024944094669656C644E616D650602494408446174615479
       70650203084461746153697A6502040549734B6579080F4E65656450726F6365
-      73734E616D65090001044E616D650606425F436F6465094669656C644E616D65
-      0606425F436F64650844617461547970650218084461746153697A6502320549
-      734B6579080F4E65656450726F636573734E616D65090001044E616D65060949
-      6E646578436F6465094669656C644E616D650609496E646578436F6465084461
-      7461547970650218084461746153697A6502320549734B6579080F4E65656450
-      726F636573734E616D65090001044E616D6506044E616D65094669656C644E61
-      6D6506044E616D650844617461547970650218084461746153697A6503FF0005
-      49734B6579080F4E65656450726F636573734E616D65090001044E616D650605
-      556E697473094669656C644E616D650605556E69747308446174615479706502
-      18084461746153697A6502140549734B6579080F4E65656450726F636573734E
-      616D65090001044E616D6506055072696365094669656C644E616D6506055072
-      6963650844617461547970650206084461746153697A6502080549734B657908
-      0F4E65656450726F636573734E616D65090001044E616D65060B4F7267517561
-      6E74697479094669656C644E616D65060B4F72675175616E7469747908446174
+      73734E616D650909507265636973696F6E02000453697A6502000001044E616D
+      650606425F436F6465094669656C644E616D650606425F436F64650844617461
+      547970650218084461746153697A6502320549734B6579080F4E65656450726F
+      636573734E616D650909507265636973696F6E02000453697A6502000001044E
+      616D650609496E646578436F6465094669656C644E616D650609496E64657843
+      6F64650844617461547970650218084461746153697A6502320549734B657908
+      0F4E65656450726F636573734E616D650909507265636973696F6E0200045369
+      7A6502000001044E616D6506044E616D65094669656C644E616D6506044E616D
+      650844617461547970650218084461746153697A6503FF000549734B6579080F
+      4E65656450726F636573734E616D650909507265636973696F6E02000453697A
+      6502000001044E616D650605556E697473094669656C644E616D650605556E69
+      74730844617461547970650218084461746153697A6502140549734B6579080F
+      4E65656450726F636573734E616D650909507265636973696F6E02000453697A
+      6502000001044E616D6506055072696365094669656C644E616D650605507269
+      63650844617461547970650206084461746153697A6502080549734B6579080F
+      4E65656450726F636573734E616D650909507265636973696F6E02000453697A
+      6502000001044E616D65060B4F72675175616E74697479094669656C644E616D
+      65060B4F72675175616E74697479084461746154797065020608446174615369
+      7A6502080549734B6579080F4E65656450726F636573734E616D650909507265
+      636973696F6E02000453697A6502000001044E616D65060D4F7267546F74616C
+      5072696365094669656C644E616D65060D4F7267546F74616C50726963650844
+      617461547970650206084461746153697A6502080549734B6579080F4E656564
+      50726F636573734E616D650909507265636973696F6E02000453697A65020000
+      01044E616D65060B4D69735175616E74697479094669656C644E616D65060B4D
+      69735175616E746974790844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090950726563697369
+      6F6E02000453697A6502000001044E616D65060D4D6973546F74616C50726963
+      65094669656C644E616D65060D4D6973546F74616C5072696365084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D65060B4F74685175616E74697479094669656C644E616D65060B4F74685175
+      616E746974790844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D650909507265636973696F6E0200
+      0453697A6502000001044E616D65060D4F7468546F74616C5072696365094669
+      656C644E616D65060D4F7468546F74616C507269636508446174615479706502
+      06084461746153697A6502080549734B6579080F4E65656450726F636573734E
+      616D650909507265636973696F6E02000453697A6502000001044E616D650608
+      5175616E74697479094669656C644E616D6506085175616E7469747908446174
       61547970650206084461746153697A6502080549734B6579080F4E6565645072
-      6F636573734E616D65090001044E616D65060D4F7267546F74616C5072696365
-      094669656C644E616D65060D4F7267546F74616C507269636508446174615479
-      70650206084461746153697A6502080549734B6579080F4E65656450726F6365
-      73734E616D65090001044E616D65060B4D69735175616E74697479094669656C
-      644E616D65060B4D69735175616E746974790844617461547970650206084461
+      6F636573734E616D650909507265636973696F6E02000453697A650200000104
+      4E616D65060A546F74616C5072696365094669656C644E616D65060A546F7461
+      6C50726963650844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D650909507265636973696F6E0200
+      0453697A6502000001044E616D65060F4375724465616C5175616E7469747909
+      4669656C644E616D65060F4375724465616C5175616E74697479084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D6506114375724465616C546F74616C5072696365094669656C644E616D6506
+      114375724465616C546F74616C50726963650844617461547970650206084461
       746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
-      0001044E616D65060D4D6973546F74616C5072696365094669656C644E616D65
-      060D4D6973546F74616C50726963650844617461547970650206084461746153
-      697A6502080549734B6579080F4E65656450726F636573734E616D6509000104
-      4E616D65060B4F74685175616E74697479094669656C644E616D65060B4F7468
-      5175616E746974790844617461547970650206084461746153697A6502080549
-      734B6579080F4E65656450726F636573734E616D65090001044E616D65060D4F
-      7468546F74616C5072696365094669656C644E616D65060D4F7468546F74616C
-      50726963650844617461547970650206084461746153697A6502080549734B65
-      79080F4E65656450726F636573734E616D65090001044E616D6506085175616E
-      74697479094669656C644E616D6506085175616E746974790844617461547970
-      650206084461746153697A6502080549734B6579080F4E65656450726F636573
-      734E616D65090001044E616D65060A546F74616C5072696365094669656C644E
-      616D65060A546F74616C50726963650844617461547970650206084461746153
-      697A6502080549734B6579080F4E65656450726F636573734E616D6509000104
-      4E616D65060F4375724465616C5175616E74697479094669656C644E616D6506
-      0F4375724465616C5175616E7469747908446174615479706502060844617461
-      53697A6502080549734B6579080F4E65656450726F636573734E616D65090001
-      044E616D6506114375724465616C546F74616C5072696365094669656C644E61
-      6D6506114375724465616C546F74616C50726963650844617461547970650206
-      084461746153697A6502080549734B6579080F4E65656450726F636573734E61
-      6D65090001044E616D65060D43757251635175616E74697479094669656C644E
-      616D65060D43757251635175616E746974790844617461547970650206084461
+      09507265636973696F6E02000453697A6502000001044E616D65060D43757251
+      635175616E74697479094669656C644E616D65060D43757251635175616E7469
+      74790844617461547970650206084461746153697A6502080549734B6579080F
+      4E65656450726F636573734E616D650909507265636973696F6E02000453697A
+      6502000001044E616D65060F4375725163546F74616C5072696365094669656C
+      644E616D65060F4375725163546F74616C507269636508446174615479706502
+      06084461746153697A6502080549734B6579080F4E65656450726F636573734E
+      616D650909507265636973696F6E02000453697A6502000001044E616D650611
+      4375724761746865725175616E74697479094669656C644E616D650611437572
+      4761746865725175616E74697479084461746154797065020608446174615369
+      7A6502080549734B6579080F4E65656450726F636573734E616D650909507265
+      636973696F6E02000453697A6502000001044E616D6506134375724761746865
+      72546F74616C5072696365094669656C644E616D650613437572476174686572
+      546F74616C50726963650844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090950726563697369
+      6F6E02000453697A6502000001044E616D65060F5072654465616C5175616E74
+      697479094669656C644E616D65060F5072654465616C5175616E746974790844
+      617461547970650206084461746153697A6502080549734B6579080F4E656564
+      50726F636573734E616D650909507265636973696F6E02000453697A65020000
+      01044E616D6506115072654465616C546F74616C5072696365094669656C644E
+      616D6506115072654465616C546F74616C507269636508446174615479706502
+      06084461746153697A6502080549734B6579080F4E65656450726F636573734E
+      616D650909507265636973696F6E02000453697A6502000001044E616D65060D
+      50726551635175616E74697479094669656C644E616D65060D50726551635175
+      616E746974790844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D650909507265636973696F6E0200
+      0453697A6502000001044E616D65060F5072655163546F74616C507269636509
+      4669656C644E616D65060F5072655163546F74616C5072696365084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D6506115072654761746865725175616E74697479094669656C644E616D6506
+      115072654761746865725175616E746974790844617461547970650206084461
       746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
-      0001044E616D65060F4375725163546F74616C5072696365094669656C644E61
-      6D65060F4375725163546F74616C507269636508446174615479706502060844
-      61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
-      090001044E616D6506114375724761746865725175616E74697479094669656C
-      644E616D6506114375724761746865725175616E746974790844617461547970
-      650206084461746153697A6502080549734B6579080F4E65656450726F636573
-      734E616D65090001044E616D650613437572476174686572546F74616C507269
-      6365094669656C644E616D650613437572476174686572546F74616C50726963
-      650844617461547970650206084461746153697A6502080549734B6579080F4E
-      65656450726F636573734E616D65090001044E616D65060F5072654465616C51
-      75616E74697479094669656C644E616D65060F5072654465616C5175616E7469
+      09507265636973696F6E02000453697A6502000001044E616D65061350726547
+      6174686572546F74616C5072696365094669656C644E616D6506135072654761
+      74686572546F74616C5072696365084461746154797065020608446174615369
+      7A6502080549734B6579080F4E65656450726F636573734E616D650909507265
+      636973696F6E02000453697A6502000001044E616D65060F456E644465616C51
+      75616E74697479094669656C644E616D65060F456E644465616C5175616E7469
       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
+      4E65656450726F636573734E616D650909507265636973696F6E02000453697A
+      6502000001044E616D650611456E644465616C546F74616C5072696365094669
+      656C644E616D650611456E644465616C546F74616C5072696365084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D65060D456E6451635175616E74697479094669656C644E616D65060D456E64
+      51635175616E746974790844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090950726563697369
+      6F6E02000453697A6502000001044E616D65060F456E645163546F74616C5072
+      696365094669656C644E616D65060F456E645163546F74616C50726963650844
+      617461547970650206084461746153697A6502080549734B6579080F4E656564
+      50726F636573734E616D650909507265636973696F6E02000453697A65020000
+      01044E616D650611456E644761746865725175616E74697479094669656C644E
+      616D650611456E644761746865725175616E7469747908446174615479706502
       06084461746153697A6502080549734B6579080F4E65656450726F636573734E
-      616D65090001044E616D65060F456E645163546F74616C507269636509466965
-      6C644E616D65060F456E645163546F74616C5072696365084461746154797065
-      0206084461746153697A6502080549734B6579080F4E65656450726F63657373
-      4E616D65090001044E616D650611456E644761746865725175616E7469747909
-      4669656C644E616D650611456E644761746865725175616E7469747908446174
-      61547970650206084461746153697A6502080549734B6579080F4E6565645072
-      6F636573734E616D65090001044E616D650613456E64476174686572546F7461
-      6C5072696365094669656C644E616D650613456E64476174686572546F74616C
-      50726963650844617461547970650206084461746153697A6502080549734B65
-      79080F4E65656450726F636573734E616D65090001044E616D65060F41646444
+      616D650909507265636973696F6E02000453697A6502000001044E616D650613
+      456E64476174686572546F74616C5072696365094669656C644E616D65061345
+      6E64476174686572546F74616C50726963650844617461547970650206084461
+      746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
+      09507265636973696F6E02000453697A6502000001044E616D65060F41646444
       65616C5175616E74697479094669656C644E616D65060F4164644465616C5175
       616E746974790844617461547970650206084461746153697A6502080549734B
-      6579080F4E65656450726F636573734E616D65090001044E616D650611416464
-      4465616C546F74616C5072696365094669656C644E616D650611416464446561
-      6C546F74616C50726963650844617461547970650206084461746153697A6502
-      080549734B6579080F4E65656450726F636573734E616D65090001044E616D65
-      060D41646451635175616E74697479094669656C644E616D65060D4164645163
-      5175616E746974790844617461547970650206084461746153697A6502080549
-      734B6579080F4E65656450726F636573734E616D65090001044E616D65060F41
-      64645163546F74616C5072696365094669656C644E616D65060F416464516354
-      6F74616C50726963650844617461547970650206084461746153697A65020805
-      49734B6579080F4E65656450726F636573734E616D65090001044E616D650611
-      4164644761746865725175616E74697479094669656C644E616D650611416464
-      4761746865725175616E74697479084461746154797065020608446174615369
-      7A6502080549734B6579080F4E65656450726F636573734E616D65090001044E
-      616D650613416464476174686572546F74616C5072696365094669656C644E61
-      6D650613416464476174686572546F74616C5072696365084461746154797065
-      0206084461746153697A6502080549734B6579080F4E65656450726F63657373
-      4E616D65090001044E616D65060C4465616C5175616E74697479094669656C64
-      4E616D65060C4465616C5175616E746974790844617461547970650206084461
+      6579080F4E65656450726F636573734E616D650909507265636973696F6E0200
+      0453697A6502000001044E616D6506114164644465616C546F74616C50726963
+      65094669656C644E616D6506114164644465616C546F74616C50726963650844
+      617461547970650206084461746153697A6502080549734B6579080F4E656564
+      50726F636573734E616D650909507265636973696F6E02000453697A65020000
+      01044E616D65060D41646451635175616E74697479094669656C644E616D6506
+      0D41646451635175616E74697479084461746154797065020608446174615369
+      7A6502080549734B6579080F4E65656450726F636573734E616D650909507265
+      636973696F6E02000453697A6502000001044E616D65060F4164645163546F74
+      616C5072696365094669656C644E616D65060F4164645163546F74616C507269
+      63650844617461547970650206084461746153697A6502080549734B6579080F
+      4E65656450726F636573734E616D650909507265636973696F6E02000453697A
+      6502000001044E616D6506114164644761746865725175616E74697479094669
+      656C644E616D6506114164644761746865725175616E74697479084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D650613416464476174686572546F74616C5072696365094669656C644E616D
+      650613416464476174686572546F74616C507269636508446174615479706502
+      06084461746153697A6502080549734B6579080F4E65656450726F636573734E
+      616D650909507265636973696F6E02000453697A6502000001044E616D65060C
+      4465616C5175616E74697479094669656C644E616D65060C4465616C5175616E
+      746974790844617461547970650206084461746153697A6502080549734B6579
+      080F4E65656450726F636573734E616D650909507265636973696F6E02000453
+      697A6502000001044E616D65060E4465616C546F74616C507269636509466965
+      6C644E616D65060E4465616C546F74616C507269636508446174615479706502
+      06084461746153697A6502080549734B6579080F4E65656450726F636573734E
+      616D650909507265636973696F6E02000453697A6502000001044E616D65060B
+      42474C5175616E74697479094669656C644E616D65060B42474C5175616E7469
+      74790844617461547970650206084461746153697A6502080549734B6579080F
+      4E65656450726F636573734E616D650909507265636973696F6E02000453697A
+      6502000001044E616D65060D42474C546F74616C5072696365094669656C644E
+      616D65060D42474C546F74616C50726963650844617461547970650206084461
       746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
-      0001044E616D65060E4465616C546F74616C5072696365094669656C644E616D
-      65060E4465616C546F74616C5072696365084461746154797065020608446174
-      6153697A6502080549734B6579080F4E65656450726F636573734E616D650900
-      01044E616D65060B42474C5175616E74697479094669656C644E616D65060B42
-      474C5175616E746974790844617461547970650206084461746153697A650208
-      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
-      0D42474C546F74616C5072696365094669656C644E616D65060D42474C546F74
-      616C50726963650844617461547970650206084461746153697A650208054973
-      4B6579080F4E65656450726F636573734E616D65090000}
+      09507265636973696F6E02000453697A6502000000}
   end
   object sdpDetailGclBills: TsdADOProvider
     TableName = 'rdp_DetailGclBills'
@@ -146,103 +172,123 @@ object rdpBillsGatherData: TrdpBillsGatherData
   end
   object sddDetailGclBills: TsdDataSet
     Active = False
+    Filtered = 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
+      73734E616D650909507265636973696F6E02000453697A6502000001044E616D
+      65060742696C6C734944094669656C644E616D65060742696C6C734944084461
+      7461547970650203084461746153697A6502040549734B6579080F4E65656450
+      726F636573734E616D650909507265636973696F6E02000453697A6502000001
+      044E616D65060C5472656553657269616C4E6F094669656C644E616D65060C54
+      72656553657269616C4E6F0844617461547970650203084461746153697A6502
+      040549734B6579080F4E65656450726F636573734E616D650909507265636973
+      696F6E02000453697A6502000001044E616D65060B52656C6142696C6C734944
+      094669656C644E616D65060B52656C6142696C6C734944084461746154797065
+      0203084461746153697A6502040549734B6579080F4E65656450726F63657373
+      4E616D650909507265636973696F6E02000453697A6502000001044E616D6506
+      094C656166586D6A4944094669656C644E616D6506094C656166586D6A494408
+      44617461547970650203084461746153697A6502040549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0001044E616D6506085175616E74697479094669656C644E616D650608517561
+      6E746974790844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D650909507265636973696F6E020004
+      53697A6502000001044E616D65060A546F74616C5072696365094669656C644E
+      616D65060A546F74616C50726963650844617461547970650206084461746153
+      697A6502080549734B6579080F4E65656450726F636573734E616D6509095072
+      65636973696F6E02000453697A6502000001044E616D65060F4375724465616C
+      5175616E74697479094669656C644E616D65060F4375724465616C5175616E74
+      6974790844617461547970650206084461746153697A6502080549734B657908
+      0F4E65656450726F636573734E616D650909507265636973696F6E0200045369
+      7A6502000001044E616D6506114375724465616C546F74616C50726963650946
+      69656C644E616D6506114375724465616C546F74616C50726963650844617461
+      547970650206084461746153697A6502080549734B6579080F4E65656450726F
+      636573734E616D650909507265636973696F6E02000453697A6502000001044E
+      616D65060D43757251635175616E74697479094669656C644E616D65060D4375
+      7251635175616E746974790844617461547970650206084461746153697A6502
+      080549734B6579080F4E65656450726F636573734E616D650909507265636973
+      696F6E02000453697A6502000001044E616D65060F4375725163546F74616C50
+      72696365094669656C644E616D65060F4375725163546F74616C507269636508
+      44617461547970650206084461746153697A6502080549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0001044E616D6506114375724761746865725175616E74697479094669656C64
+      4E616D6506114375724761746865725175616E74697479084461746154797065
+      0206084461746153697A6502080549734B6579080F4E65656450726F63657373
+      4E616D650909507265636973696F6E02000453697A6502000001044E616D6506
+      13437572476174686572546F74616C5072696365094669656C644E616D650613
+      437572476174686572546F74616C507269636508446174615479706502060844
+      61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
+      0909507265636973696F6E02000453697A6502000001044E616D65060F507265
+      4465616C5175616E74697479094669656C644E616D65060F5072654465616C51
+      75616E746974790844617461547970650206084461746153697A650208054973
+      4B6579080F4E65656450726F636573734E616D650909507265636973696F6E02
+      000453697A6502000001044E616D6506115072654465616C546F74616C507269
+      6365094669656C644E616D6506115072654465616C546F74616C507269636508
+      44617461547970650206084461746153697A6502080549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0001044E616D65060D50726551635175616E74697479094669656C644E616D65
+      060D50726551635175616E746974790844617461547970650206084461746153
+      697A6502080549734B6579080F4E65656450726F636573734E616D6509095072
+      65636973696F6E02000453697A6502000001044E616D65060F5072655163546F
+      74616C5072696365094669656C644E616D65060F5072655163546F74616C5072
       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
+      0F4E65656450726F636573734E616D650909507265636973696F6E0200045369
+      7A6502000001044E616D6506115072654761746865725175616E746974790946
+      69656C644E616D6506115072654761746865725175616E746974790844617461
+      547970650206084461746153697A6502080549734B6579080F4E65656450726F
+      636573734E616D650909507265636973696F6E02000453697A6502000001044E
+      616D650613507265476174686572546F74616C5072696365094669656C644E61
+      6D650613507265476174686572546F74616C5072696365084461746154797065
+      0206084461746153697A6502080549734B6579080F4E65656450726F63657373
+      4E616D650909507265636973696F6E02000453697A6502000001044E616D6506
+      0F456E644465616C5175616E74697479094669656C644E616D65060F456E6444
+      65616C5175616E746974790844617461547970650206084461746153697A6502
+      080549734B6579080F4E65656450726F636573734E616D650909507265636973
+      696F6E02000453697A6502000001044E616D650611456E644465616C546F7461
+      6C5072696365094669656C644E616D650611456E644465616C546F74616C5072
+      6963650844617461547970650206084461746153697A6502080549734B657908
+      0F4E65656450726F636573734E616D650909507265636973696F6E0200045369
+      7A6502000001044E616D65060D456E6451635175616E74697479094669656C64
+      4E616D65060D456E6451635175616E7469747908446174615479706502060844
       61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
-      090001044E616D6506115072654761746865725175616E74697479094669656C
-      644E616D6506115072654761746865725175616E746974790844617461547970
-      650206084461746153697A6502080549734B6579080F4E65656450726F636573
-      734E616D65090001044E616D650613507265476174686572546F74616C507269
-      6365094669656C644E616D650613507265476174686572546F74616C50726963
-      650844617461547970650206084461746153697A6502080549734B6579080F4E
-      65656450726F636573734E616D65090001044E616D65060F456E644465616C51
-      75616E74697479094669656C644E616D65060F456E644465616C5175616E7469
-      74790844617461547970650206084461746153697A6502080549734B6579080F
-      4E65656450726F636573734E616D65090001044E616D650611456E644465616C
-      546F74616C5072696365094669656C644E616D650611456E644465616C546F74
+      0909507265636973696F6E02000453697A6502000001044E616D65060F456E64
+      5163546F74616C5072696365094669656C644E616D65060F456E645163546F74
       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
+      4B6579080F4E65656450726F636573734E616D650909507265636973696F6E02
+      000453697A6502000001044E616D650611456E644761746865725175616E7469
+      7479094669656C644E616D650611456E644761746865725175616E7469747908
+      44617461547970650206084461746153697A6502080549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0001044E616D650613456E64476174686572546F74616C507269636509466965
+      6C644E616D650613456E64476174686572546F74616C50726963650844617461
+      547970650206084461746153697A6502080549734B6579080F4E65656450726F
+      636573734E616D650909507265636973696F6E02000453697A6502000001044E
+      616D65060F4164644465616C5175616E74697479094669656C644E616D65060F
+      4164644465616C5175616E746974790844617461547970650206084461746153
+      697A6502080549734B6579080F4E65656450726F636573734E616D6509095072
+      65636973696F6E02000453697A6502000001044E616D6506114164644465616C
+      546F74616C5072696365094669656C644E616D6506114164644465616C546F74
+      616C50726963650844617461547970650206084461746153697A650208054973
+      4B6579080F4E65656450726F636573734E616D650909507265636973696F6E02
+      000453697A6502000001044E616D65060D41646451635175616E746974790946
+      69656C644E616D65060D41646451635175616E74697479084461746154797065
       0206084461746153697A6502080549734B6579080F4E65656450726F63657373
-      4E616D65090001044E616D6506114164644761746865725175616E7469747909
-      4669656C644E616D6506114164644761746865725175616E7469747908446174
-      61547970650206084461746153697A6502080549734B6579080F4E6565645072
-      6F636573734E616D65090001044E616D650613416464476174686572546F7461
-      6C5072696365094669656C644E616D650613416464476174686572546F74616C
-      50726963650844617461547970650206084461746153697A6502080549734B65
-      79080F4E65656450726F636573734E616D65090000}
+      4E616D650909507265636973696F6E02000453697A6502000001044E616D6506
+      0F4164645163546F74616C5072696365094669656C644E616D65060F41646451
+      63546F74616C50726963650844617461547970650206084461746153697A6502
+      080549734B6579080F4E65656450726F636573734E616D650909507265636973
+      696F6E02000453697A6502000001044E616D6506114164644761746865725175
+      616E74697479094669656C644E616D6506114164644761746865725175616E74
+      6974790844617461547970650206084461746153697A6502080549734B657908
+      0F4E65656450726F636573734E616D650909507265636973696F6E0200045369
+      7A6502000001044E616D650613416464476174686572546F74616C5072696365
+      094669656C644E616D650613416464476174686572546F74616C507269636508
+      44617461547970650206084461746153697A6502080549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0000}
   end
   object sdpDetailBGLBills: TsdADOProvider
     TableName = 'rdp_DetailBGLBills'
@@ -251,37 +297,44 @@ object rdpBillsGatherData: TrdpBillsGatherData
   end
   object sddDetailBGLBills: TsdDataSet
     Active = False
+    Filtered = 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}
+      73734E616D650909507265636973696F6E02000453697A6502000001044E616D
+      65060742696C6C734944094669656C644E616D65060742696C6C734944084461
+      7461547970650203084461746153697A6502040549734B6579080F4E65656450
+      726F636573734E616D650909507265636973696F6E02000453697A6502000001
+      044E616D650609424742696C6C734944094669656C644E616D65060942474269
+      6C6C7349440844617461547970650203084461746153697A6502040549734B65
+      79080F4E65656450726F636573734E616D650909507265636973696F6E020004
+      53697A6502000001044E616D65060542474C4944094669656C644E616D650605
+      42474C49440844617461547970650203084461746153697A6502040549734B65
+      79080F4E65656450726F636573734E616D650909507265636973696F6E020004
+      53697A6502000001044E616D65060742474C436F6465094669656C644E616D65
+      060742474C436F64650844617461547970650218084461746153697A65023205
+      49734B6579080F4E65656450726F636573734E616D650909507265636973696F
+      6E02000453697A6502000001044E616D65060742474C4E616D65094669656C64
+      4E616D65060742474C4E616D650844617461547970650218084461746153697A
+      6503FF000549734B6579080F4E65656450726F636573734E616D650909507265
+      636973696F6E02000453697A6502000001044E616D65060F42474C417070726F
+      76616C436F6465094669656C644E616D65060F42474C417070726F76616C436F
+      64650844617461547970650218084461746153697A6503FF000549734B657908
+      0F4E65656450726F636573734E616D650909507265636973696F6E0200045369
+      7A6502000001044E616D65060E42474C44726177696E67436F6465094669656C
+      644E616D65060E42474C44726177696E67436F64650844617461547970650218
+      084461746153697A6503FF000549734B6579080F4E65656450726F636573734E
+      616D650909507265636973696F6E02000453697A6502000001044E616D650608
+      5175616E74697479094669656C644E616D6506085175616E7469747908446174
+      61547970650206084461746153697A6502080549734B6579080F4E6565645072
+      6F636573734E616D650909507265636973696F6E02000453697A650200000104
+      4E616D65060A546F74616C5072696365094669656C644E616D65060A546F7461
+      6C50726963650844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D650909507265636973696F6E0200
+      0453697A6502000000}
   end
   object sdpDetailDealBills: TsdADOProvider
     TableName = 'rdp_DetailDealBills'
@@ -290,23 +343,27 @@ object rdpBillsGatherData: TrdpBillsGatherData
   end
   object sddDetailDealBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = sdpDetailDealBills
     Left = 248
     Top = 192
     FieldListData = {
       0101044E616D6506024944094669656C644E616D650602494408446174615479
       70650203084461746153697A6502040549734B6579080F4E65656450726F6365
-      73734E616D65090001044E616D65060742696C6C734944094669656C644E616D
-      65060742696C6C7349440844617461547970650203084461746153697A650204
-      0549734B6579080F4E65656450726F636573734E616D65090001044E616D6506
-      064465616C4944094669656C644E616D6506064465616C494408446174615479
-      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
-      73734E616D65090001044E616D6506085175616E74697479094669656C644E61
-      6D6506085175616E746974790844617461547970650206084461746153697A65
-      02080549734B6579080F4E65656450726F636573734E616D65090001044E616D
-      65060A546F74616C5072696365094669656C644E616D65060A546F74616C5072
-      6963650844617461547970650206084461746153697A6502080549734B657908
-      0F4E65656450726F636573734E616D65090000}
+      73734E616D650909507265636973696F6E02000453697A6502000001044E616D
+      65060742696C6C734944094669656C644E616D65060742696C6C734944084461
+      7461547970650203084461746153697A6502040549734B6579080F4E65656450
+      726F636573734E616D650909507265636973696F6E02000453697A6502000001
+      044E616D6506064465616C4944094669656C644E616D6506064465616C494408
+      44617461547970650203084461746153697A6502040549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0001044E616D6506085175616E74697479094669656C644E616D650608517561
+      6E746974790844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D650909507265636973696F6E020004
+      53697A6502000001044E616D65060A546F74616C5072696365094669656C644E
+      616D65060A546F74616C50726963650844617461547970650206084461746153
+      697A6502080549734B6579080F4E65656450726F636573734E616D6509095072
+      65636973696F6E02000453697A6502000000}
   end
   object sdpLeafXmjs: TsdADOProvider
     TableName = 'rdp_LeafXmjs'
@@ -315,40 +372,49 @@ object rdpBillsGatherData: TrdpBillsGatherData
   end
   object sddLeafXmjs: TsdDataSet
     Active = False
+    Filtered = 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
+      73734E616D650909507265636973696F6E02000453697A6502000001044E616D
+      650604436F6465094669656C644E616D650604436F6465084461746154797065
+      0218084461746153697A6502320549734B6579080F4E65656450726F63657373
+      4E616D650909507265636973696F6E02000453697A6502000001044E616D6506
+      044E616D65094669656C644E616D6506044E616D650844617461547970650218
       084461746153697A6503FF000549734B6579080F4E65656450726F636573734E
-      616D65080001044E616D65060B44726177696E67436F6465094669656C644E61
-      6D65060B44726177696E67436F64650844617461547970650218084461746153
-      697A6502320549734B6579080F4E65656450726F636573734E616D65090000}
+      616D650909507265636973696F6E02000453697A6502000001044E616D650605
+      556E697473094669656C644E616D650605556E69747308446174615479706502
+      18084461746153697A6502140549734B6579080F4E65656450726F636573734E
+      616D650909507265636973696F6E02000453697A6502000001044E616D65060A
+      4E616D6544616E576569094669656C644E616D65060A4E616D6544616E576569
+      0844617461547970650218084461746153697A6503FF000549734B6579080F4E
+      65656450726F636573734E616D650909507265636973696F6E02000453697A65
+      02000001044E616D6506094E616D6546656E4275094669656C644E616D650609
+      4E616D6546656E42750844617461547970650218084461746153697A6503FF00
+      0549734B6579080F4E65656450726F636573734E616D65090950726563697369
+      6F6E02000453697A6502000001044E616D65060C4E616D6546656E5869616E67
+      094669656C644E616D65060C4E616D6546656E5869616E670844617461547970
+      650218084461746153697A6503FF000549734B6579080F4E65656450726F6365
+      73734E616D650909507265636973696F6E02000453697A6502000001044E616D
+      6506084E616D65556E6974094669656C644E616D6506084E616D65556E697408
+      44617461547970650218084461746153697A6503FF000549734B6579080F4E65
+      656450726F636573734E616D650909507265636973696F6E02000453697A6502
+      000001044E616D650603506567094669656C644E616D65060350656708446174
+      61547970650218084461746153697A6503FF000549734B6579080F4E65656450
+      726F636573734E616D650909507265636973696F6E02000453697A6502000001
+      044E616D6506095065674C656E677468094669656C644E616D6506095065674C
+      656E6774680844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D650909507265636973696F6E020004
+      53697A6502000001044E616D65060C52656C61506F736974696F6E094669656C
+      644E616D65060C52656C61506F736974696F6E08446174615479706502180844
+      61746153697A6503FF000549734B6579080F4E65656450726F636573734E616D
+      650809507265636973696F6E02000453697A6502000001044E616D65060B4472
+      6177696E67436F6465094669656C644E616D65060B44726177696E67436F6465
+      0844617461547970650218084461746153697A6502320549734B6579080F4E65
+      656450726F636573734E616D650909507265636973696F6E02000453697A6502
+      000000}
   end
 end

+ 2 - 2
Report/DataPrepare/rdpBillsGatherDm.pas

@@ -30,7 +30,7 @@ type
     procedure WriteDetailGclNode(AGclNode: TGclNode);
     procedure WriteGclNode(AGclNode: TGclNode);
     procedure WriteLeafXmjNode(ALeafXmj: TLeafXmjNode);
-    procedure WriteGatherRecord(AGcls, AXmjs: TList);
+    procedure WriteGatherRecord(AGcls, AXmjs: TList; AGather: TGatherNode);
   public
     constructor Create(AProjectData: TProjectData);
     destructor Destroy; override;
@@ -203,7 +203,7 @@ begin
   end;
 end;
 
-procedure TrdpBillsGatherData.WriteGatherRecord(AGcls, AXmjs: TList);
+procedure TrdpBillsGatherData.WriteGatherRecord(AGcls, AXmjs: TList; AGather: TGatherNode);
 var
   iGcl, iXmj: Integer;
   vGclNode: TGclNode;

+ 327 - 2
Units/ExportExcel.pas

@@ -5,7 +5,7 @@ interface
 uses
   Classes, ZjGrid, ScXlsOutput, ScXlsCustomUD, Windows, StdCtrls,
   sdIDTree, sdDB, Graphics, SysUtils, ProgressHintFrm, Forms, Controls,
-  OExport, OExport_Vcl, OExport_VclForms;
+  OExport, OExport_Vcl, OExport_VclForms, BillsPosTree, BillsTree;
 
 type
   TExcelExportor = class
@@ -117,6 +117,47 @@ type
     procedure ExportToFile(const AFileName: string);
   end;
 
+  TBillsPosExcelExportor = class
+  private
+    FOExport: TOExport;
+    FTempFile: string;
+
+    FTree: TBillsPosTree;
+    FCodeCol: Integer;
+    FB_CodeCol: Integer;
+    FP_COdeCol: Integer;
+    FNameCol: Integer;
+    FUnitsCol: Integer;
+    FQuantityCol: Integer;
+    FDgnQty1: Integer;
+    FDgnQty2: Integer;
+    FPriceCol: Integer;
+    FTotalPriceCol: Integer;
+    FDrawingCodeCol: Integer;
+    FMemoStrCol: Integer;
+
+    procedure DefineHeader(ASheet: TExportWorkSheet);
+
+    function HasGclChild(ANode: TBillsIDTreeNode): Boolean;
+    function FindNode(AParent: TBillsPosTreeNode; AMatch: TBillsIDTreeNode): TBillsPosTreeNode;
+    procedure ConversePosNode(ANode: TBillsIDTreeNode; AParent: TBillsPosTreeNode = nil);
+    function ConverseNodeData(ANode: TBillsIDTreeNode; AParent: TBillsPosTreeNode = nil): TBillsPosTreeNode;
+    procedure ConverseTreeNode(ANode: TBillsIDTreeNode; AParent: TBillsPosTreeNode = nil);
+
+    procedure ExportPos(ASheet: TExportWorkSheet; ANode: TBillsPosTreeNode);
+    procedure ExportNode(ASheet: TExportWorkSheet; ANode: TBillsPosTreeNode);
+    procedure ExportData(ASheet: TExportWorkSheet);
+  protected
+    procedure BeforeExport;
+    procedure AfterExport;
+  public
+    constructor Create;
+    destructor Destroy; override;
+
+    procedure ExportToSheet(ABillsIDTree: TBillsIDTree; ASheet: TExportWorkSheet);
+    procedure ExportToFile(ABillsIDTree: TBillsIDTree; const AFileName: string);
+  end;
+
 const
   ciLedger: array [0..8] of TColInfo =(
     (FieldName: 'Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '项目节编号'; Width: 120; HorTextAlign: cahLeft),
@@ -216,7 +257,7 @@ const
 implementation
 
 uses
-  ZhAPI, Variants, UtilMethods, Math;
+  ZhAPI, Variants, UtilMethods, Math, CacheTree, mDataRecord;
 
 function GetExportor(const AFileType: string): TOCustomExporter;
 begin
@@ -768,4 +809,288 @@ begin
   end;
 end;
 
+{ TBillsPosExcelExportor }
+
+procedure TBillsPosExcelExportor.AfterExport;
+begin
+  Screen.Cursor := crDefault;
+end;
+
+procedure TBillsPosExcelExportor.BeforeExport;
+begin
+  Screen.Cursor := crHourGlass;
+end;
+
+procedure TBillsPosExcelExportor.ConversePosNode(ANode: TBillsIDTreeNode;
+  AParent: TBillsPosTreeNode);
+var
+  i: Integer;
+  vChild: TBillsIDTreeNode;
+  vCur: TBillsPosTreeNode;
+  vPos: TPosNode;
+begin
+  if ANode.ChildCount = 0 then Exit;
+  for i := 0 to ANode.ChildCount - 1 do
+  begin
+    vChild := TBillsIDTreeNode(ANode.ChildNodes[i]);
+    if (vChild.Rec.B_Code.AsString <> '') then
+    begin
+      vCur := FindNode(AParent, vChild);
+      if not Assigned(vCur) then
+        vCur := ConverseNodeData(vChild, AParent);
+
+      vPos := vCur.AddPos;
+      vPos.Name := ANode.Rec.Name.AsString;
+      vPos.Quantity := vChild.Rec.Quantity.AsFloat;
+      vPos.MemoStr := ANode.Rec.MemoStr.AsString;
+    end;
+  end;
+end;
+
+procedure TBillsPosExcelExportor.ConverseTreeNode(
+  ANode: TBillsIDTreeNode; AParent: TBillsPosTreeNode);
+var
+  vCur: TBillsPosTreeNode;
+begin
+  if not Assigned(ANode) then Exit;
+
+  if (ANode.Rec.B_Code.AsString = '') then
+  begin
+    if (Pos('1-1-', ANode.Rec.Code.AsString) = 1) or (not HasGclChild(ANode)) then
+    begin
+      vCur := ConverseNodeData(ANode, AParent);
+      ConverseTreeNode(TBillsIDTreeNode(ANode.FirstChild), vCur);
+    end
+    else
+      ConversePosNode(ANode, AParent);
+  end
+  else if (Assigned(ANode.Parent) And (Pos('1-1-', TBillsIDTreeNode(ANode.Parent).Rec.Code.AsString) = 1)) then
+  begin
+    vCur := ConverseNodeData(ANode, AParent);
+    vCur.Quantity := ANode.Rec.Quantity.AsFloat;
+    ConverseTreeNode(TBillsIDTreeNode(ANode.FirstChild), vCur);
+  end;
+  ConverseTreeNode(TBillsIDTreeNode(ANode.NextSibling), AParent);
+end;
+
+function TBillsPosExcelExportor.ConverseNodeData(ANode: TBillsIDTreeNode;
+  AParent: TBillsPosTreeNode): TBillsPosTreeNode;
+begin
+  Result := TBillsPosTreeNode(FTree.AddNode(AParent));
+  Result.Code := ANode.Rec.Code.AsString;
+  Result.B_Code := ANode.Rec.B_Code.AsString;
+  Result.Name := ANode.Rec.Name.AsString;
+  Result.Units := ANode.Rec.Units.AsString;
+  Result.DrawingCode := ANode.Rec.DrawingCode.AsString;
+  Result.MemoStr := ANode.Rec.MemoStr.AsString;
+  Result.DgnQty1 := ANode.Rec.DgnQuantity1.AsFloat;
+  Result.DgnQty2 := ANode.Rec.DgnQuantity2.AsFloat;
+  Result.Price := ANode.Rec.Price.AsFloat;
+  Result.TotalPrice := ANode.Rec.TotalPrice.AsFloat;
+end;
+
+constructor TBillsPosExcelExportor.Create;
+begin
+  FOExport := TOExport.Create;
+  FTempFile := GetTempFileName;
+
+  FCodeCol := 0;
+  FB_CodeCol := 1;
+  FP_COdeCol := 2;
+  FNameCol := 3;
+  FUnitsCol := 4;
+  FQuantityCol := 5;
+  FDgnQty1 := 6;
+  FDgnQty2 := 7;
+  FPriceCol := 8;
+  FTotalPriceCol := 9;
+  FDrawingCodeCol := 10;
+  FMemoStrCol := 11;
+end;
+
+procedure TBillsPosExcelExportor.DefineHeader(ASheet: TExportWorkSheet);
+
+  procedure AddHeaderCell(ARow: TExportRow; iCol: Integer; const AText: String; AWidth: Integer);
+  var
+    vCell: TExportCell;
+  begin
+    vCell := ARow.AddCellString(AText);
+    vCell.SetAlignment(cahCenter);
+    vCell.SetVAlignment(cavCenter);
+    vCell.Font.Name := '黑体';
+    vCell.Font.Size := 10;
+    vCell.Width := AWidth;
+  end;
+
+var
+  iCol: Integer;
+  ColInfo: TColInfo;
+  vRow: TExportRow;
+  vCell: TExportCell;
+begin
+  vRow := ASheet.AddRow;
+  vRow.Height := 20;
+  AddHeaderCell(vRow, FCodeCol, '项目节编号', 100);
+  AddHeaderCell(vRow, FB_CodeCol, '清单编号', 80);
+  AddHeaderCell(vRow, FP_CodeCol, '部位明细', 80);
+  AddHeaderCell(vRow, FNameCol, '名称', 300);
+  AddHeaderCell(vRow, FUnitsCol, '单位', 60);
+  AddHeaderCell(vRow, FQuantityCol, '清单数量', 70);
+  AddHeaderCell(vRow, FDgnQty1, '设计数量1', 70);
+  AddHeaderCell(vRow, FDgnQty2, '设计数量2', 70);
+  AddHeaderCell(vRow, FPriceCol, '单价', 70);
+  AddHeaderCell(vRow, FTotalPriceCol, '合价', 70);
+  AddHeaderCell(vRow, FDrawingCodeCol, '图号', 85);
+  AddHeaderCell(vRow, FMemoStrCol, '备注', 100);
+end;
+
+destructor TBillsPosExcelExportor.Destroy;
+begin
+  if FileExists(FTempFile) then
+    DeleteFileOrFolder(FTempFile);
+  FOExport.Free;
+  inherited;
+end;
+
+procedure TBillsPosExcelExportor.ExportData(ASheet: TExportWorkSheet);
+begin
+  ExportNode(ASheet, TBillsPosTreeNode(FTree.FirstNode));
+end;
+
+procedure TBillsPosExcelExportor.ExportNode(ASheet: TExportWorkSheet;
+  ANode: TBillsPosTreeNode);
+var
+  vRow: TExportRow;
+  vCell: TExportCellNumber;
+begin
+  if not Assigned(ANode) then Exit;
+
+  vRow := ASheet.AddRow;
+  vRow.AddCellString(ANode.Code);
+  vRow.AddCellString(ANode.B_Code);
+  vRow.AddCellString('');
+  vRow.AddCellString(ANode.Name);
+  vRow.AddCellString(ANode.Units);
+  vCell := vRow.AddCellNumber(ANode.Quantity);
+  vCell.EmptyIfZero := True;
+  vCell := vRow.AddCellNumber(ANode.DgnQty1);
+  vCell.EmptyIfZero := True;
+  vCell := vRow.AddCellNumber(ANode.DgnQty2);
+  vCell.EmptyIfZero := True;
+  vCell := vRow.AddCellNumber(ANode.Price);
+  vCell.EmptyIfZero := True;
+  vCell := vRow.AddCellNumber(ANode.TotalPrice);
+  vCell.EmptyIfZero := True;
+  vRow.AddCellString(ANode.DrawingCode);
+  vRow.AddCellString(ANode.MemoStr);
+  ExportPos(ASheet, ANode);
+
+  ExportNode(ASheet, TBillsPosTreeNode(ANode.FirstChild));
+  ExportNode(ASheet, TBillsPosTreeNode(ANode.NextSibling));
+end;
+
+procedure TBillsPosExcelExportor.ExportPos(ASheet: TExportWorkSheet;
+  ANode: TBillsPosTreeNode);
+var
+  i: Integer;
+  vPos: TPosNode;
+  vRow: TExportRow;
+  vCell: TExportCellNumber;
+begin
+  if not Assigned(ANode) then Exit;
+
+  for i := 0 to ANode.PosCount - 1 do
+  begin
+    vPos := ANode.Pos[i];
+    vRow := ASheet.AddRow;
+    vRow.AddCellString();
+    vRow.AddCellString();
+    vRow.AddCellString(IntToStr(i+1));
+    vRow.AddCellString(vPos.Name);
+    vRow.AddCellString();
+    vCell := vRow.AddCellNumber(vPos.Quantity);
+    vCell.EmptyIfZero := True;
+    vCell := vRow.AddCellNumber(); 
+    vCell.EmptyIfZero := True;
+    vCell := vRow.AddCellNumber(); 
+    vCell.EmptyIfZero := True;
+    vCell := vRow.AddCellNumber(); 
+    vCell.EmptyIfZero := True;
+    vCell := vRow.AddCellNumber(); 
+    vCell.EmptyIfZero := True;
+    vRow.AddCellString();
+    vRow.AddCellString(vPos.MemoStr);
+  end;
+end;
+
+procedure TBillsPosExcelExportor.ExportToFile(ABillsIDTree: TBillsIDTree; const AFileName: string);
+var
+  vExportor: TOCustomExporter;
+begin
+  BeforeExport;
+  try
+    vExportor := GetExportor(ExtractFileExt(AFileName));
+    ExportToSheet(ABillsIDTree, FOExport.AddWorkSheet);
+    FOExport.SaveToFile(FTempFile, vExportor);
+    if not FileExists(AFileName) or QuestMessage('存在同名文件,是否替换?') then
+      CopyFile(PChar(FTempFile), PChar(AFileName), False);
+  finally
+    vExportor.Free;
+    AfterExport;
+  end;
+end;
+
+procedure TBillsPosExcelExportor.ExportToSheet(ABillsIDTree: TBillsIDTree; ASheet: TExportWorkSheet);
+begin
+  DefineHeader(ASheet);
+  FTree := TBillsPosTree.Create;
+  try
+    ConverseTreeNode(TBillsIDTreeNode(ABillsIDTree.FirstNode));
+    FTree.CalculateAll;
+    ExportData(ASheet);
+  finally
+    FTree.Free;
+  end;
+end;
+
+function TBillsPosExcelExportor.HasGclChild(
+  ANode: TBillsIDTreeNode): Boolean;
+var
+  i: Integer;
+  vChild: TBillsIDTreeNode;
+begin
+  Result := False;
+  for i := 0 to ANode.ChildCount - 1 do
+  begin
+    vChild := TBillsIDTreeNode(ANode.ChildNodes[i]);
+    if (vChild.Rec.B_Code.AsString <> '') then
+    begin
+      Result := True;
+      Exit;
+    end;
+  end;
+end;
+
+function TBillsPosExcelExportor.FindNode(AParent: TBillsPosTreeNode;
+  AMatch: TBillsIDTreeNode): TBillsPosTreeNode;
+var
+  i: Integer;
+  vChild: TBillsPosTreeNode;
+begin
+  Result := nil;
+  if not Assigned(AParent) then Exit;
+  for i := 0 to AParent.Children.Count - 1 do
+  begin
+    vChild := TBillsPosTreeNode(AParent.Children.Items[i]);
+    if ((vChild.B_Code = AMatch.Rec.B_Code.AsString) And
+        (vChild.Name = AMatch.Rec.Name.AsString) And
+        (vChild.Units = AMatch.Rec.Units.AsString) And
+        (PriceRoundTo(vChild.Price - AMatch.Rec.Price.AsFloat) = 0)) then
+    begin
+      Result := vChild;
+      Break;
+    end;
+  end;
+end;
+
 end.

+ 117 - 3
Units/GclBillsGatherModel.pas

@@ -7,8 +7,6 @@ uses
   Classes, mDataRecord, BillsTree, CalcDecimal;
 
 type
-  TGatherDataWriteEvent = procedure (AGcls, AXmjs: TList) of object;
-
   TLeafXmjNode = class
   private
     FID: Integer;
@@ -348,6 +346,75 @@ type
     property Decimal: TCalcDecimal read FDecimal;
   end;
 
+  TGatherNode = class
+  private
+    FID: Integer;
+
+    FOrgTotalPrice: Double;
+    FMisTotalPrice: Double;
+    FOthTotalPrice: Double;
+
+    FTotalPrice: Double;
+
+    FCurDealTotalPrice: Double;
+    FCurQcTotalPrice: Double;
+    FCurGatherTotalPrice: Double;
+
+    FPreDealTotalPrice: Double;
+    FPreQcTotalPrice: Double;
+    FPreGatherTotalPrice: Double;
+
+    FEndDealTotalPrice: Double;
+    FEndQcTotalPrice: Double;
+    FEndGatherTotalPrice: Double;
+
+    FAddDealTotalPrice: Double;
+    FAddQcTotalPrice: Double;
+    FAddGatherTotalPrice: Double;
+
+    FDealTotalPrice: Double;
+
+    FBGLTotalPrice: Double;
+
+    FDeal_BGLTotalPrice: Double;
+    FDeal_BGLPercent: Double;
+  public                 
+    property ID: Integer read FID write FID;
+
+    property OrgTotalPrice: Double read FOrgTotalPrice write FOrgTotalPrice;
+    property MisTotalPrice: Double read FMisTotalPrice write FMisTotalPrice;
+    property OthTotalPrice: Double read FOthTotalPrice write FOthTotalPrice;
+
+    property TotalPrice: Double read FTotalPrice write FTotalPrice;
+
+    property CurDealTotalPrice: Double read FCurDealTotalPrice write FCurDealTotalPrice;
+    property CurQcTotalPrice: Double read FCurQcTotalPrice write FCurQcTotalPrice;
+    property CurGatherTotalPrice: Double read FCurGatherTotalPrice write FCurGatherTotalPrice;
+
+    property PreDealTotalPrice: Double read FPreGatherTotalPrice write FPreDealTotalPrice;
+    property PreQcTotalPrice: Double read FPreQcTotalPrice write FPreQcTotalPrice;
+    property PreGatherTotalPrice: Double read FPreGatherTotalPrice write FPreGatherTotalPrice;
+
+    property EndDealTotalPrice: Double read FEndDealTotalPrice write FEndDealTotalPrice;
+    property EndQcTotalPrice: Double read FEndQcTotalPrice write FEndQcTotalPrice;
+    property EndGatherTotalPrice: Double read FEndGatherTotalPrice write FEndGatherTotalPrice;
+
+    property AddDealTotalPrice: Double read FAddGatherTotalPrice write FAddDealTotalPrice;
+    property AddQcTotalPrice: Double read FAddQcTotalPrice write FAddQcTotalPrice;
+    property AddGatherTotalPrice: Double read FAddGatherTotalPrice write FAddGatherTotalPrice;
+
+    property DealTotalPrice: Double read FDealTotalPrice write FDealTotalPrice;
+
+    property BGLTotalPrice: Double read FBGLTotalPrice write FBGLTotalPrice;
+
+    // ---------- Calculate --------------
+    property Deal_BGLTotalPrice: Double read FDeal_BGLTotalPrice write FDeal_BGLTotalPrice;
+    property Deal_BGLPercent: Double read FDeal_BGLPercent write FDeal_BGLPercent;
+    // -----------------------------------
+  end;
+  
+  TGatherDataWriteEvent = procedure (AGcls, AXmjs: TList; AGather: TGatherNode) of object;
+
   TGclGatherModel = class
   private
     FProjectData: TObject;
@@ -362,6 +429,7 @@ type
     FNewDetailGclID: Integer;
     FNewDetailDealID: Integer;
     FNewDetailBGLID: Integer;
+    FGather: TGatherNode;
 
     FWriteGatherData: TGatherDataWriteEvent;
     FDecimal: TCalcDecimal;
@@ -383,6 +451,7 @@ type
     procedure GatherDealData;
     procedure GatherBGLData;
 
+    procedure CalculateGather;
     procedure CalculateAll;
 
     function GetNewDetailBGLID: Integer;
@@ -478,6 +547,7 @@ procedure TGclGatherModel.BeginGather;
 begin
   FGcls := TList.Create;
   FXmjs := TList.Create;
+  FGather := TGatherNode.Create;
 end;
 
 procedure TGclGatherModel.CalculateAll;
@@ -486,6 +556,49 @@ var
 begin
   for iGcl := 0 to FGcls.Count - 1 do
     TGclNode(FGcls.Items[iGcl]).Calculate;
+  CalculateGather;
+end;
+
+procedure TGclGatherModel.CalculateGather;
+var
+  i: Integer;
+  vGcl: TGclNode;
+begin
+  FGather.ID := FNewGclID + 1;
+  for i := 0 to FGcls.Count - 1 do
+  begin
+    vGcl := TGclNode(FGcls.Items[i]);
+    FGather.TotalPrice := FGather.TotalPrice + vGcl.TotalPrice;
+
+    FGather.OrgTotalPrice := FGather.OrgTotalPrice + vGcl.OrgTotalPrice;
+    FGather.MisTotalPrice := FGather.MisTotalPrice + vGcl.MisTotalPrice;
+    FGather.OthTotalPrice := FGather.OthTotalPrice + vGcl.OthTotalPrice;
+
+    FGather.CurDealTotalPrice := FGather.CurDealTotalPrice + vGcl.CurDealTotalPrice;
+    FGather.CurQcTotalPrice := FGather.CurQcTotalPrice + vGcl.CurQcTotalPrice;
+    FGather.CurGatherTotalPrice := FGather.CurGatherTotalPrice + vGcl.CurGatherTotalPrice;
+
+    FGather.PreDealTotalPrice := FGather.PreDealTotalPrice + vGcl.PreDealTotalPrice;
+    FGather.PreQcTotalPrice := FGather.PreQcTotalPrice + vGcl.PreQcTotalPrice;
+    FGather.PreGatherTotalPrice := FGather.PreGatherTotalPrice + vGcl.PreGatherTotalPrice;
+
+    FGather.EndDealTotalPrice := FGather.EndDealTotalPrice + vGcl.EndDealTotalPrice;
+    FGather.EndQcTotalPrice := FGather.EndQcTotalPrice + vGcl.EndQcTotalPrice;
+    FGather.EndGatherTotalPrice := FGather.EndGatherTotalPrice + vGcl.EndGatherTotalPrice;
+
+    FGather.AddDealTotalPrice := FGather.AddDealTotalPrice + vGcl.AddDealTotalPrice;
+    FGather.AddQcTotalPrice := FGather.AddQcTotalPrice + vGcl.AddQcTotalPrice;
+    FGather.AddGatherTotalPrice := FGather.AddGatherTotalPrice + vGcl.AddGatherTotalPrice;
+
+    FGather.DealTotalPrice := FGather.DealTotalPrice + vGcl.DealTotalPrice;
+    FGather.BGLTotalPrice := FGather.BGLTotalPrice + vGcl.BGLTotalPrice;
+  end;
+
+  FGather.Deal_BGLTotalPrice := Decimal.TotalPrice.RoundTo(FGather.TotalPrice + FGather.BGLTotalPrice);
+  if FGather.Deal_BGLTotalPrice <> 0 then
+    FGather.Deal_BGLPercent := CommonRoundTo(FGather.EndGatherTotalPrice/FGather.Deal_BGLTotalPrice*100, -2)
+  else
+    FGather.Deal_BGLPercent := 0;
 end;
 
 constructor TGclGatherModel.Create(AProjectData: TObject);
@@ -508,6 +621,7 @@ begin
   FXmjs.Free;
   ClearObjects(FGcls);
   FGcls.Free;
+  FGather.Free;
 end;
 
 procedure TGclGatherModel.Execute;
@@ -519,7 +633,7 @@ begin
     GatherBGLData;
     CalculateAll;
     if Assigned(FWriteGatherData) then
-      FWriteGatherData(FGcls, FXmjs);
+      FWriteGatherData(FGcls, FXmjs, FGather);
   finally
     EndGather;
   end;

+ 7 - 0
Units/UtilMethods.pas

@@ -11,6 +11,8 @@ type
   TRoundMode = (rmNearest, rmUp, rmDown);
   TBookmarkRefreshEvent = procedure (AExpandFrame: Boolean) of object;
 
+  function TickCount: Integer;
+
   {RoundTo}
   function GetCompareDigitValue(ADigit: Integer): Double;
   function QuantityRoundTo(AValue: Double): Double;
@@ -137,6 +139,11 @@ uses
 var
   SysProgressDisabled: Boolean;
 
+function TickCount: Integer;
+begin
+  Result := GetTickCount;
+end;
+
 {RoundTo}
 function InnerRoundTo(const AValue: Extended; const ADigit: Integer; RoundMode: TRoundMode): Extended;
 var