Browse Source

恢复代码
1. 回滚代码至 3d9eaeb7c4a25cdaaddf5721a650cbaafa374591 合并3.1.3.3
2. 合并代码 975a3fe03c13533c1226828c1f6ad8449dfeddcf
3-31提交代码中在线审批部分(手工合并ProjectManagerFme&ProjectFme)
3. 合并代码 abe160880c6ae94dbf1a5c960650f9211488161f
3-31Builder完善Dpr信息

由于以上操作,自3.1.3.3合并来的代码,自标段划分(含)之后可能存在问题,须全部在3.1.5测试。

MaiXinRong 9 years ago
parent
commit
b7944402e8

+ 5 - 11
DataModules/BillsCompileDm.pas

@@ -4,7 +4,7 @@ interface
 
 uses
   BillsDm, StandardBillsFme,
-  SysUtils, Classes, sdDB, BillsTree, sdIDTree;
+  SysUtils, Classes, sdDB, BillsTree, sdIDTree, DB;
 
 type
   TBillsCompileData = class(TDataModule)
@@ -147,11 +147,6 @@ procedure TBillsCompileData.sdvBillsCompileGetText(var Text: String;
   ARecord: TsdDataRecord; AValue: TsdValue; AColumn: TsdViewColumn;
   DisplayText: Boolean);
 
-  function GetQtyEditText(const AFormulaField: string): Boolean;
-  begin
-
-  end;
-
   procedure GetEditText;
   var
     sFormula: string;
@@ -183,8 +178,7 @@ procedure TBillsCompileData.sdvBillsCompileGetText(var Text: String;
 
   procedure GetDisplayText;
   begin
-    if (Pos('Price', AColumn.FieldName) > 0) or
-       (Pos('Quantity', AColumn.FieldName) > 0) then
+    if AValue.DataType = ftFloat then
     begin
       if not Assigned(AValue) or (AValue.AsFloat = 0) then
         Text := '';
@@ -206,13 +200,13 @@ end;
 procedure TBillsCompileData.ExpandXmjNode;
 var
   iIndex: Integer;
-  stnNode: TsdIDTreeNode;
+  stnNode: TBillsIDTreeNode;
 begin
   for iIndex := 0 to BillsCompileTree.Count - 1 do
   begin
-    stnNode := BillsCompileTree.Items[iIndex];
+    stnNode := TBillsIDTreeNode(BillsCompileTree.Items[iIndex]);
     if (stnNode.ParentID <> -1) then
-      stnNode.Parent.Expanded := stnNode.Rec.ValueByName('B_Code').AsString = '';
+      stnNode.Parent.Expanded := stnNode.Rec.B_Code.AsString = '';
   end;
 end;
 

+ 12 - 22
DataModules/BillsMeasureDm.pas

@@ -4,7 +4,7 @@ interface
 
 uses
   BillsDm, BillsTree, FormulaCalc, sdIDTree, StageDm,
-  SysUtils, Classes, sdDB;
+  SysUtils, Classes, sdDB, DB;
 
 type
   TBillsMeasureData = class(TDataModule)
@@ -39,7 +39,7 @@ type
     function SelectAndUpdateBGL(ABillsID: Integer; ARec: TsdDataRecord;
       ANewValue: Double; const AType: string): Boolean;
 
-    procedure CalculateNode(ANode: TBillsIDTreeNode);            
+    procedure CalculateNode(ANode: TBillsIDTreeNode);
     procedure UpdateRecordGather(ANode: TsdIDTreeNode; AQuantity, ATotalPrice: Double);
 
     function GetStageData: TStageData;
@@ -110,7 +110,7 @@ begin
 end;
 
 destructor TBillsMeasureData.Destroy;
-begin
+begin   
   FFormulaCalc.Free;
   FBillsMeasureTree.Free;
   inherited;
@@ -199,23 +199,12 @@ procedure TBillsMeasureData.sdvBillsMeasureGetText(var Text: String;
   var
     stnNode: TsdIDTreeNode;
   begin
-    if (Pos('TotalPrice', AColumn.FieldName) > 0) or
-       (Pos('Quantity', AColumn.FieldName) > 0) or
-       (Pos('Price', AColumn.FieldName) > 0) then
+    if Assigned(AValue) and (AValue.DataType = ftFloat) and (AValue.AsFloat = 0) then
     begin
-      if AValue.AsFloat = 0 then
-        Text := '';
+      Text := '';
+      Exit;
     end;
 
-    if SameText('Quantity', AColumn.FieldName) or
-        SameText('Price', AColumn.FieldName) or
-        SameText('NewPrice', AColumn.FieldName) or
-        SameText('AddGatherQuantity', AColumn.FieldName) then
-    begin
-      stnNode := BillsMeasureTree.FindNode(AValue.Owner.ValueByName('ID').AsInteger);
-      if stnNode.HasChildren then
-        Text := '';
-    end;
     // 所有本期数据,当节点为父节点时,不显示值(实际上需要计算其中的金额值,但又不能显示)
     // 有病。每天都在变。
     if not ShowParentData and (Pos('Cur', AColumn.FieldName) > 0) and (Pos('Gather', AColumn.FieldName) = 0) then
@@ -684,13 +673,13 @@ end;
 procedure TBillsMeasureData.ExpandXmjNode;
 var
   iIndex: Integer;
-  stnNode: TsdIDTreeNode;
+  stnNode: TBillsIDTreeNode;
 begin
   for iIndex := 0 to BillsMeasureTree.Count - 1 do
   begin
-    stnNode := BillsMeasureTree.Items[iIndex];
+    stnNode := TBillsIDTreeNode(BillsMeasureTree.Items[iIndex]);
     if (stnNode.ParentID <> -1) then
-      stnNode.Parent.Expanded := stnNode.Rec.ValueByName('B_Code').AsString = '';
+      stnNode.Parent.Expanded := stnNode.Rec.B_Code.AsString = '';
   end;
 end;
 
@@ -828,7 +817,7 @@ procedure TBillsMeasureData.ExpandCurPhase;
 var
   iIndex: Integer;
   stnNode: TsdIDTreeNode;
-  StageRec: TsdDataRecord;
+  StageRec: TStageRecord;
 begin
   for iIndex := 0 to BillsMeasureTree.Count - 1 do
   begin
@@ -836,7 +825,7 @@ begin
     StageRec := TBillsIDTreeNode(stnNode).StageRec;
     if (stnNode.ParentID <> -1) then
       if Assigned(StageRec) then
-        stnNode.Expanded := StageRec.ValueByName('GatherTotalPrice').AsFloat <> 0
+        stnNode.Expanded := StageRec.GatherTotalPrice.AsFloat <> 0
       else
         stnNode.Expanded := False;
   end;
@@ -944,6 +933,7 @@ var
   i: Integer;
   vNode: TBillsIDTreeNode;
 begin
+  if not StageData.Active then Exit;
   for i := 0 to BillsMeasureTree.Count - 1 do
   begin
     vNode := TBillsIDTreeNode(BillsMeasureTree.Items[i]);

+ 3 - 1
DataModules/DealBillsDm.dfm

@@ -33,7 +33,9 @@ object DealBillsData: TDealBillsData
       0F4E65656450726F636573734E616D65090001044E616D65060A546F74616C50
       72696365094669656C644E616D65060A546F74616C5072696365084461746154
       7970650206084461746153697A6502080549734B6579080F4E65656450726F63
-      6573734E616D65090000}
+      6573734E616D65090001044E616D650609496E646578436F6465094669656C64
+      4E616D650609496E646578436F64650844617461547970650201084461746153
+      697A6502320549734B6579080F4E65656450726F636573734E616D65090000}
   end
   object sdvDealBills: TsdDataView
     Active = False

+ 6 - 7
DataModules/PhaseCompareDm.pas

@@ -110,7 +110,8 @@ type
 implementation
 
 uses
-  ProjectData, PhaseData, StageDm, StageCompareDm, UtilMethods;
+  ProjectData, PhaseData, StageDm, StageCompareDm, UtilMethods,
+  ProjectProperty;
 
 {$R *.dfm}
 
@@ -126,6 +127,7 @@ begin
   vColumn.LookupKeyFields := 'BillsID';
   vColumn.LookupResultField := Format('Quantity%d', [AStageIndex]);
   vColumn.LookupDataSet := TProjectData(FProjectData).PhaseData.StageCompareData.sddStageCompare;
+  vColumn.DisplayFormat := TProjectData(FProjectData).ProjProperties.QuantityFormat;
 
   vColumn := sdvPhaseCompare.Columns.Add;
   vColumn.FieldName := Format('TotalPrice%d', [AStageIndex]);
@@ -133,6 +135,7 @@ begin
   vColumn.LookupKeyFields := 'BillsID';
   vColumn.LookupResultField := Format('TotalPrice%d', [AStageIndex]);
   vColumn.LookupDataSet := TProjectData(FProjectData).PhaseData.StageCompareData.sddStageCompare;
+  vColumn.DisplayFormat := TProjectData(FProjectData).ProjProperties.TotalPriceFormat;
 end;
 
 procedure TPhaseCompareData.ClearStageColumn;
@@ -241,12 +244,8 @@ procedure TPhaseCompareData.sdvPhaseCompareGetText(var Text: String;
   ARecord: TsdDataRecord; AValue: TsdValue; AColumn: TsdViewColumn;
   DisplayText: Boolean);
 begin
-  if (Pos('TotalPrice', AColumn.FieldName) > 0) or
-     (Pos('Quantity', AColumn.FieldName) > 0) then
-  begin
-    if Assigned(AValue) and (AValue.AsFloat = 0) then
-      Text := '';
-  end;
+  if Assigned(AValue) and (AValue.DataType = ftFloat) and (AValue.AsFloat = 0) then
+    Text := '';
 end;
 
 end.

+ 1 - 0
DataModules/PriceMarginBillsDm.dfm

@@ -217,6 +217,7 @@ object PriceMarginBillsData: TPriceMarginBillsData
     AfterDeleteRecord = sdvDetailGLAfterDeleteRecord
     AfterValueChanged = sdvDetailGLAfterValueChanged
     OnFilterRecord = sdvDetailGLFilterRecord
+    OnSetText = sdvDetailGLSetText
     Left = 264
     Top = 136
   end

+ 12 - 1
DataModules/PriceMarginBillsDm.pas

@@ -4,7 +4,7 @@ interface
 
 uses
   SysUtils, Classes, sdDB, sdProvider, BillsTree, mDataRecord,
-  GclBillsGatherModel;
+  GclBillsGatherModel, DB;
 
 type
   TPriceMarginBillsData = class(TDataModule)
@@ -28,6 +28,8 @@ type
     procedure sdvDetailGLAfterDeleteRecord(ARecord: TsdDataRecord);
     procedure sdvGclBillsGetText(var Text: String; ARecord: TsdDataRecord;
       AValue: TsdValue; AColumn: TsdViewColumn; DisplayText: Boolean);
+    procedure sdvDetailGLSetText(var Text: String; ARecord: TsdDataRecord;
+      AValue: TsdValue; AColumn: TsdViewColumn; var Allow: Boolean);
   private
     FProjectData: TObject;
     procedure WriteGclBillsData(AGcls: TList);
@@ -374,4 +376,13 @@ begin
   end;
 end;
 
+procedure TPriceMarginBillsData.sdvDetailGLSetText(var Text: String;
+  ARecord: TsdDataRecord; AValue: TsdValue; AColumn: TsdViewColumn;
+  var Allow: Boolean);
+begin
+  if AValue.DataType in [ftInteger, ftFloat] then
+    if not CheckNumeric(Text) then
+      Text := '';
+end;
+
 end.

+ 18 - 5
DataModules/ProjectGLDm.pas

@@ -3,7 +3,7 @@ unit ProjectGLDm;
 interface
 
 uses
-  SysUtils, Classes, sdDB, sdProvider, ADODB, mDataRecord;
+  SysUtils, Classes, sdDB, sdProvider, ADODB, mDataRecord, CalcDecimal;
 
 type
   TProjectGLData = class(TDataModule)
@@ -49,6 +49,7 @@ type
     function GetValidDeltaPrice(AID: Integer): Double;
     function GetPM_TotalPrice: Double;
     function GetActive: Boolean;
+    function GetDecimal: TCalcDecimal;
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
@@ -68,13 +69,14 @@ type
 
     property ValidDeltaPrice[AID: Integer]: Double read GetValidDeltaPrice;
     property PM_TotalPrice: Double read GetPM_TotalPrice;
+    property Decimal: TCalcDecimal read GetDecimal;
   end;
 
 implementation
 
 uses
   ProjectData, UtilMethods, DB, Variants, PhaseData, DetailGLDm,
-  BillsMeasureDm, BillsTree, sdIDTree, PhasePayDm, DateUtils;
+  BillsMeasureDm, BillsTree, sdIDTree, PhasePayDm, DateUtils, ZhAPI;
 
 {$R *.dfm}
 
@@ -269,9 +271,9 @@ begin
     ValidDeltaC := 0;
 
   if DeltaC <> ARec.DeltaPrice.AsFloat then
-    ARec.DeltaPrice.AsFloat := PriceRoundTo(DeltaC);
+    ARec.DeltaPrice.AsFloat := Decimal.Price.RoundTo(DeltaC);
   if ValidDeltaC <> ARec.ValidDeltaPrice.AsFloat then
-    ARec.ValidDeltaPrice.AsFloat := PriceRoundTo(ValidDeltaC);
+    ARec.ValidDeltaPrice.AsFloat := Decimal.Price.RoundTo(ValidDeltaC);
 end;
 
 procedure TProjectGLData.sdvProjectGLGetText(var Text: String;
@@ -285,7 +287,9 @@ procedure TProjectGLData.sdvProjectGLGetText(var Text: String;
         SameText('RiskRange', AColumn.FieldName)) then
     begin
       if AValue.AsFloat = 0 then
-        Text := '';
+        Text := ''
+      else
+        Text := FormatFloat('0.###', Decimal.Price.RoundTo(AValue.AsFloat));
     end;
   end;
 
@@ -493,6 +497,10 @@ begin
     if iPhaseID > 0 then
       DataSetErrorMessage(Allow, Format('该工料在第%d期已进行调差计算,不可修改基础数据。', [iPhaseID]));
   end;
+
+  if AValue.DataType in [ftInteger, ftFloat] then
+    if not CheckNumeric(Text) then
+      Text := '';
 end;
 
 procedure TProjectGLData.LoadStagePM_CalcData;
@@ -572,4 +580,9 @@ begin
     ErrorMessage('工料已被应用,不可删除。');
 end;
 
+function TProjectGLData.GetDecimal: TCalcDecimal;
+begin
+  Result := TProjectData(FProjectData).ProjProperties.DecimalManager.PriceMargin;
+end;
+
 end.

+ 156 - 2
DataModules/ReportMemoryDm/rmBillsGatherDm.dfm

@@ -134,6 +134,84 @@ object rmBillsGatherData: TrmBillsGatherData
       item
         Name = 'AddRatioPercent'
         DataType = ftFloat
+      end
+      item
+        Name = 'DealDgnQuantity1'
+        DataType = ftFloat
+      end
+      item
+        Name = 'DealDgnQuantity2'
+        DataType = ftFloat
+      end
+      item
+        Name = 'DealDgnQuantity'
+        DataType = ftString
+        Size = 50
+      end
+      item
+        Name = 'DealDgnPrice1'
+        DataType = ftFloat
+      end
+      item
+        Name = 'DealDgnPrice2'
+        DataType = ftFloat
+      end
+      item
+        Name = 'DealDgnPrice'
+        DataType = ftString
+        Size = 50
+      end
+      item
+        Name = 'CDgnQuantity1'
+        DataType = ftFloat
+      end
+      item
+        Name = 'CDgnQuantity2'
+        DataType = ftFloat
+      end
+      item
+        Name = 'CDgnQuantity'
+        DataType = ftString
+        Size = 50
+      end
+      item
+        Name = 'CDgnPrice1'
+        DataType = ftFloat
+      end
+      item
+        Name = 'CDgnPrice2'
+        DataType = ftFloat
+      end
+      item
+        Name = 'CDgnPrice'
+        DataType = ftString
+        Size = 50
+      end
+      item
+        Name = 'FinalDgnQuantity1'
+        DataType = ftFloat
+      end
+      item
+        Name = 'FinalDgnQuantity2'
+        DataType = ftFloat
+      end
+      item
+        Name = 'FinalDgnQuantity'
+        DataType = ftString
+        Size = 50
+      end
+      item
+        Name = 'FinalDgnPrice1'
+        DataType = ftFloat
+      end
+      item
+        Name = 'FinalDgnPrice2'
+        DataType = ftFloat
+      end
+      item
+        Name = 'FinalDgnPrice'
+        DataType = ftString
+        Size = 50
       end>
     IndexDefs = <>
     Params = <>
@@ -141,7 +219,7 @@ object rmBillsGatherData: TrmBillsGatherData
     Left = 32
     Top = 24
     Data = {
-      CD0200009619E0BD01000000180000001D000000000003000000CD0209586961
+      AA0400009619E0BD01000000180000002F000000000003000000AA0409586961
       6E67436F64650100490000000100055749445448020002000A00064D75436F64
       650100490000000100055749445448020002000A00074A6965436F6465010049
       0000000100055749445448020002000A000858694D75436F6465010049000000
@@ -163,7 +241,22 @@ object rmBillsGatherData: TrmBillsGatherData
       000944676E50726963653208000400000000000944676E507269636531080004
       00000000000844676E5072696365010049000000010005574944544802000200
       32000C526174696F50657263656E7408000400000000000F416464526174696F
-      50657263656E7408000400000000000000}
+      50657263656E740800040000000000104465616C44676E5175616E7469747931
+      0800040000000000104465616C44676E5175616E746974793208000400000000
+      000F4465616C44676E5175616E74697479010049000000010005574944544802
+      00020032000D4465616C44676E50726963653108000400000000000D4465616C
+      44676E50726963653208000400000000000C4465616C44676E50726963650100
+      4900000001000557494454480200020032000D4344676E5175616E7469747931
+      08000400000000000D4344676E5175616E746974793208000400000000000C43
+      44676E5175616E7469747901004900000001000557494454480200020032000A
+      4344676E50726963653108000400000000000A4344676E507269636532080004
+      0000000000094344676E50726963650100490000000100055749445448020002
+      0032001146696E616C44676E5175616E74697479310800040000000000114669
+      6E616C44676E5175616E746974793208000400000000001046696E616C44676E
+      5175616E7469747901004900000001000557494454480200020032000E46696E
+      616C44676E50726963653108000400000000000E46696E616C44676E50726963
+      653208000400000000000D46696E616C44676E50726963650100490000000100
+      0557494454480200020032000000}
     object cdsFxBillsXiangCode: TStringField
       FieldName = 'XiangCode'
       Size = 10
@@ -261,6 +354,67 @@ object rmBillsGatherData: TrmBillsGatherData
     object cdsFxBillsAddRatioPercent: TFloatField
       FieldName = 'AddRatioPercent'
     end
+    object cdsFxBillsDealDgnQuantity1: TFloatField
+      FieldName = 'DealDgnQuantity1'
+    end
+    object cdsFxBillsDealDgnQuantity2: TFloatField
+      FieldName = 'DealDgnQuantity2'
+    end
+    object cdsFxBillsDealDgnQuantity: TStringField
+      FieldName = 'DealDgnQuantity'
+      Size = 50
+    end
+    object cdsFxBillsDealDgnPrice1: TFloatField
+      FieldName = 'DealDgnPrice1'
+    end
+    object cdsFxBillsDealDgnPrice2: TFloatField
+      FieldName = 'DealDgnPrice2'
+    end
+    object cdsFxBillsDealDgnPrice: TStringField
+      FieldName = 'DealDgnPrice'
+      Size = 50
+    end
+    object cdsFxBillsCDgnQuantity1: TFloatField
+      FieldName = 'CDgnQuantity1'
+    end
+    object cdsFxBillsCDgnQuantity2: TFloatField
+      FieldName = 'CDgnQuantity2'
+    end
+    object cdsFxBillsCDgnQuantity: TStringField
+      FieldName = 'CDgnQuantity'
+      Size = 50
+    end
+    object cdsFxBillsCDgnPrice1: TFloatField
+      FieldName = 'CDgnPrice1'
+    end
+    object cdsFxBillsCDgnPrice2: TFloatField
+      FieldName = 'CDgnPrice2'
+    end
+    object cdsFxBillsCDgnPrice: TStringField
+      FieldName = 'CDgnPrice'
+      Size = 50
+    end
+    object cdsFxBillsFinalDgnQuantity1: TFloatField
+      FieldName = 'FinalDgnQuantity1'
+    end
+    object cdsFxBillsFinalDgnQuantity2: TFloatField
+      FieldName = 'FinalDgnQuantity2'
+    end
+    object cdsFxBillsFinalDgnQuantity: TStringField
+      DisplayWidth = 50
+      FieldName = 'FinalDgnQuantity'
+      Size = 50
+    end
+    object cdsFxBillsFinalDgnPrice1: TFloatField
+      FieldName = 'FinalDgnPrice1'
+    end
+    object cdsFxBillsFinalDgnPrice2: TFloatField
+      FieldName = 'FinalDgnPrice2'
+    end
+    object cdsFxBillsFinalDgnPrice: TStringField
+      FieldName = 'FinalDgnPrice'
+      Size = 50
+    end
   end
   object cdsGclBills: TClientDataSet
     Active = True

+ 39 - 0
DataModules/ReportMemoryDm/rmBillsGatherDm.pas

@@ -70,6 +70,24 @@ type
     cdsFxBillsDgnPrice: TStringField;
     cdsFxBillsRatioPercent: TFloatField;
     cdsFxBillsAddRatioPercent: TFloatField;
+    cdsFxBillsDealDgnQuantity1: TFloatField;
+    cdsFxBillsDealDgnQuantity2: TFloatField;
+    cdsFxBillsDealDgnQuantity: TStringField;
+    cdsFxBillsDealDgnPrice1: TFloatField;
+    cdsFxBillsDealDgnPrice2: TFloatField;
+    cdsFxBillsDealDgnPrice: TStringField;
+    cdsFxBillsCDgnQuantity1: TFloatField;
+    cdsFxBillsCDgnQuantity2: TFloatField;
+    cdsFxBillsCDgnQuantity: TStringField;
+    cdsFxBillsCDgnPrice1: TFloatField;
+    cdsFxBillsCDgnPrice2: TFloatField;
+    cdsFxBillsCDgnPrice: TStringField;
+    cdsFxBillsFinalDgnQuantity1: TFloatField;
+    cdsFxBillsFinalDgnQuantity2: TFloatField;
+    cdsFxBillsFinalDgnQuantity: TStringField;
+    cdsFxBillsFinalDgnPrice1: TFloatField;
+    cdsFxBillsFinalDgnPrice2: TFloatField;
+    cdsFxBillsFinalDgnPrice: TStringField;
     // ¾öËã05-2
     cdsGclBills: TClientDataSet;
     cdsGclBillsB_Code: TStringField;
@@ -646,6 +664,27 @@ begin
     cdsFxBillsDgnPrice2.AsFloat := PriceRoundTo(ANode.TotalPrice/ANode.DesignQuantity2);
   if cdsFxBillsDgnPrice1.AsFloat <> 0 then
     cdsFxBillsDgnPrice.AsString := GetDgnQuantity(cdsFxBillsDgnPrice1.AsFloat, cdsFxBillsDgnPrice2.AsFloat);
+
+  cdsFxBillsDealDgnQuantity1.AsFloat := ANode.DealDesignQuantity1;
+  cdsFxBillsDealDgnQuantity2.AsFloat := ANode.DealDesignQuantity2;
+  cdsFxBillsDealDgnQuantity.AsString := GetDgnQuantity(ANode.DealDesignQuantity1, ANode.DesignQuantity2);
+  cdsFxBillsDealDgnPrice1.AsFloat := GetDgnPrice(cdsFxBillsAddDealTotalPrice.AsFloat, cdsFxBillsDealDgnQuantity1.AsFloat);
+  cdsFxBillsDealDgnPrice2.AsFloat := GetDgnPrice(cdsFxBillsAddDealTotalPrice.AsFloat, cdsFxBillsDealDgnQuantity2.AsFloat);
+  cdsFxBillsDealDgnPrice.AsString := GetDgnQuantity(cdsFxBillsDealDgnPrice1.AsFloat, cdsFxBillsDealDgnPrice2.AsFloat);
+
+  cdsFxBillsCDgnQuantity1.AsFloat := ANode.CDesignQuantity1;
+  cdsFxBillsCDgnQuantity2.AsFloat := ANode.CDesignQuantity2;
+  cdsFxBillsCDgnQuantity.AsString := GetDgnQuantity(ANode.CDesignQuantity1, ANode.CDesignQuantity2);
+  cdsFxBillsCDgnPrice1.AsFloat := GetDgnPrice(cdsFxBillsAddQcTotalPrice.AsFloat, cdsFxBillsCDgnQuantity1.AsFloat);
+  cdsFxBillsCDgnPrice2.AsFloat := GetDgnPrice(cdsFxBillsAddQcTotalPrice.AsFloat, cdsFxBillsCDgnQuantity2.AsFloat);
+  cdsFxBillsCDgnPrice.AsString := GetDgnQuantity(cdsFxBillsCDgnPrice1.AsFloat, cdsFxBillsCDgnPrice2.AsFloat);
+
+  cdsFxBillsFinalDgnQuantity1.AsFloat := ANode.DealDesignQuantity1 + ANode.CDesignQuantity1;
+  cdsFxBillsFinalDgnQuantity2.AsFloat := ANode.DealDesignQuantity2 + ANode.CDesignQuantity2;
+  cdsFxBillsFinalDgnQuantity.AsString := GetDgnQuantity(cdsFxBillsFinalDgnQuantity1.AsFloat, cdsFxBillsFinalDgnQuantity2.AsFloat);
+  cdsFxBillsFinalDgnPrice1.AsFloat := GetDgnPrice(cdsFxBillsAddGatherTotalPrice.AsFloat, cdsFxBillsFinalDgnQuantity1.AsFloat);
+  cdsFxBillsFinalDgnPrice2.AsFloat := GetDgnPrice(cdsFxBillsAddGatherTotalPrice.AsFloat, cdsFxBillsFinalDgnQuantity2.AsFloat);
+  cdsFxBillsFinalDgnPrice.AsString := GetDgnQuantity(cdsFxBillsFinalDgnPrice1.AsFloat, cdsFxBillsFinalDgnPrice2.AsFloat);
   cdsFxBills.Post;
   WriteNode(TReportCacheNode(ANode.FirstChild));
   WriteNode(TReportCacheNode(ANode.NextSibling));

+ 25 - 2
DataModules/ReportMemoryDm/rmXmjBGLDetailDm.dfm

@@ -91,6 +91,18 @@ object rmXmjBGLDetailData: TrmXmjBGLDetailData
         Name = 'MemoStr'
         DataType = ftWideString
         Size = 50
+      end
+      item
+        Name = 'TotalPrice'
+        DataType = ftFloat
+      end
+      item
+        Name = 'EndQcTotalPrice'
+        DataType = ftFloat
+      end
+      item
+        Name = 'FinalTotalPrice'
+        DataType = ftFloat
       end>
     IndexDefs = <>
     Params = <>
@@ -98,7 +110,7 @@ object rmXmjBGLDetailData: TrmXmjBGLDetailData
     Left = 72
     Top = 32
     Data = {
-      0B0200009619E0BD0100000018000000120000000000030000000B0204436F64
+      4E0200009619E0BD0100000018000000150000000000030000004E0204436F64
       650100490000000100055749445448020002003200044E616D6502004A000000
       01000557494454480200020090010C44676E5175616E74697479310800040000
       0000000C44676E5175616E746974793208000400000000000B44676E5175616E
@@ -114,7 +126,9 @@ object rmXmjBGLDetailData: TrmXmjBGLDetailData
       000001000557494454480200020064000C417070726F76616C436F646501004A
       00000001000557494454480200020064000B42474C52656C6146696C6501004A
       0000000100055749445448020002000100074D656D6F53747201004A00000001
-      000557494454480200020064000000}
+      000557494454480200020064000A546F74616C50726963650800040000000000
+      0F456E645163546F74616C507269636508000400000000000F46696E616C546F
+      74616C507269636508000400000000000000}
     object cdsXmjBGLDetailCode: TStringField
       FieldName = 'Code'
       Size = 50
@@ -181,5 +195,14 @@ object rmXmjBGLDetailData: TrmXmjBGLDetailData
       FieldName = 'MemoStr'
       Size = 50
     end
+    object cdsXmjBGLDetailTotalPrice: TFloatField
+      FieldName = 'TotalPrice'
+    end
+    object cdsXmjBGLDetailEndQcTotalPrice: TFloatField
+      FieldName = 'EndQcTotalPrice'
+    end
+    object cdsXmjBGLDetailFinalTotalPrice: TFloatField
+      FieldName = 'FinalTotalPrice'
+    end
   end
 end

+ 25 - 0
DataModules/ReportMemoryDm/rmXmjBGLDetailDm.pas

@@ -32,6 +32,9 @@ type
     FEndDealTotalPrice: Double;
     FEndGatherTotalPrice: Double;
 
+    FTotalPrice: Double;
+    FEndQcTotalPrice: Double;
+
     function GetChildCount: Integer;
     function GetChildNode(AIndex: Integer): TXmjNode;
     function GetBGLCount: Integer;
@@ -68,6 +71,9 @@ type
     cdsXmjBGLDetailApprovalCode: TWideStringField;
     cdsXmjBGLDetailBGLRelaFile: TWideStringField;
     cdsXmjBGLDetailMemoStr: TWideStringField;
+    cdsXmjBGLDetailTotalPrice: TFloatField;
+    cdsXmjBGLDetailEndQcTotalPrice: TFloatField;
+    cdsXmjBGLDetailFinalTotalPrice: TFloatField;
   private
     FProjectData: TProjectData;
     FClassXmjList: TList;
@@ -152,6 +158,7 @@ end;
 procedure TrmXmjBGLDetailData.AddClassXmjNode(ANode: TsdIDTreeNode);
 var
   XmjNode: TXmjNode;
+  StageRec: TsdDataRecord;
 begin
   if not Assigned(ANode) then Exit;
   XmjNode := TXmjNode.Create;
@@ -159,6 +166,18 @@ begin
   XmjNode.FCode := ANode.Rec.ValueByName('Code').AsString;
   XmjNode.FName := ANode.Rec.ValueByName('Name').AsString;
   XmjNode.FDgnQuantity1 := ANode.Rec.ValueByName('DgnQuantity1').AsFloat;
+  XmjNode.FDgnQuantity2 := ANode.Rec.ValueByName('DgnQuantity2').AsFloat;
+  XmjNode.FTotalPrice := ANode.Rec.ValueByName('TotalPrice').AsFloat;
+  if FProjectData.PhaseData.Active then
+  begin
+    StageRec := FProjectData.PhaseData.StageData.StageRecord(ANode.ID);
+    if Assigned(StageRec) then
+    begin
+      XmjNode.FEndDealTotalPrice := StageRec.ValueByName('EndDealTotalPrice').AsFloat;
+      XmjNode.FEndGatherTotalPrice := StageRec.ValueByName('EndGatherTotalPrice').AsFloat;
+      XmjNode.FEndQcTotalPrice := StageRec.ValueByName('EndQcTotalPrice').AsFloat;
+    end;
+  end;
   FilterDetailNode(ANode, XmjNode);
 end;
 
@@ -173,6 +192,7 @@ begin
   DetailNode.FName := ANode.Rec.ValueByName('Name').AsString;
   DetailNode.FDgnQuantity1 := ANode.Rec.ValueByName('DgnQuantity1').AsFloat;
   DetailNode.FDgnQuantity2 := ANode.Rec.ValueByName('DgnQuantity2').AsFloat;
+  DetailNode.FTotalPrice := ANode.Rec.ValueByName('TotalPrice').AsFloat;
   if FProjectData.PhaseData.Active then
   begin
     StageRec := FProjectData.PhaseData.StageData.StageRecord(ANode.ID);
@@ -180,6 +200,7 @@ begin
     begin
       DetailNode.FEndDealTotalPrice := StageRec.ValueByName('EndDealTotalPrice').AsFloat;
       DetailNode.FEndGatherTotalPrice := StageRec.ValueByName('EndGatherTotalPrice').AsFloat;
+      DetailNode.FEndQcTotalPrice := StageRec.ValueByName('EndQcTotalPrice').AsFloat;
     end;
   end;
   FilterBGLData(ANode, DetailNode);
@@ -359,6 +380,10 @@ begin
   cdsXmjBGLDetailEndGatherTotalPrice.AsFloat := AXmjNode.FEndGatherTotalPrice;
   cdsXmjBGLDetailBGTotalPrice.AsFloat := AXmjNode.FEndGatherTotalPrice - AXmjNode.FEndDealTotalPrice;
 
+  cdsXmjBGLDetailTotalPrice.AsFloat := AXmjNode.FTotalPrice;
+  cdsXmjBGLDetailEndQcTotalPrice.AsFloat := AXmjNode.FEndQcTotalPrice;
+  cdsXmjBGLDetailFinalTotalPrice.AsFloat := AXmjNode.FTotalPrice + AXmjNode.FEndQcTotalPrice;
+
   cdsXmjBGLDetailXmj_BGLName.AsString := AXmjNode.FName;
   cdsXmjBGLDetail.Post;
   for i := 0 to AXmjNode.BGLCount - 1 do

+ 75 - 115
DataModules/SearchDm.pas

@@ -3,7 +3,7 @@ unit SearchDm;
 interface
 
 uses
-  SysUtils, Classes, DB, DBClient, sdIDTree, sdDB;
+  SysUtils, Classes, DB, DBClient, sdIDTree, sdDB, BillsTree;
 
 type
   TLocateType = (ltCompile, ltMeasure);
@@ -25,10 +25,7 @@ type
   private
     FProjectData: TObject;
 
-    procedure BeginSearch;
-    procedure EndSearch;
-
-    procedure AddSearchResult(Rec, StageRec: TsdDataRecord);
+    procedure AddSearchResult(ANode: TBillsIDTreeNode);
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
@@ -45,36 +42,37 @@ type
 implementation
 
 uses
-  ProjectData, BillsMeasureDm, BillsCompileDm, Math, ZhAPI;
+  ProjectData, BillsMeasureDm, BillsCompileDm, Math, ZhAPI,
+  UtilMethods, Forms, Controls;
 
 {$R *.dfm}
 
 { TSearchData }
 
-procedure TSearchData.AddSearchResult(Rec, StageRec: TsdDataRecord);
+procedure TSearchData.AddSearchResult(ANode: TBillsIDTreeNode);
 begin
+  if not Assigned(ANode) then Exit;
+
   cdsSearch.Append;
-  cdsSearchID.AsInteger := Rec.ValueByName('ID').AsInteger;
-  cdsSearchCode.AsString := Rec.ValueByName('Code').AsString;
-  cdsSearchB_Code.AsString := Rec.ValueByName('B_Code').AsString;
-  cdsSearchName.AsString := Rec.ValueByName('Name').AsString;
-  cdsSearchUnits.AsString := Rec.ValueByName('Units').AsString;
-  cdsSearchPrice.AsFloat := Rec.ValueByName('Price').AsFloat;
-  cdsSearchQuantity.AsString := Rec.ValueByName('Quantity').AsString;
-  if Assigned(StageRec) then
-    cdsSearchCurQcQuantity.AsFloat := StageRec.ValueByName('QcQuantity').AsFloat;
-  cdsSearchAddGatherQuantity.AsString := Rec.ValueByName('AddGatherQuantity').AsString;
-  if cdsSearchQuantity.AsFloat <> 0 then
-    cdsSearchCompleteRate.AsFloat := advRoundTo(
-        Rec.ValueByName('AddDealQuantity').AsFloat/cdsSearchQuantity.AsFloat*100);
+  with ANode do
+  begin
+    cdsSearchID.AsInteger := Rec.ValueByName('ID').AsInteger;
+    cdsSearchCode.AsString := Rec.ValueByName('Code').AsString;
+    cdsSearchB_Code.AsString := Rec.ValueByName('B_Code').AsString;
+    cdsSearchName.AsString := Rec.ValueByName('Name').AsString;
+    cdsSearchUnits.AsString := Rec.ValueByName('Units').AsString;
+    cdsSearchPrice.AsFloat := Rec.ValueByName('Price').AsFloat;
+    cdsSearchQuantity.AsString := Rec.ValueByName('Quantity').AsString;
+    if Assigned(StageRec) then
+      cdsSearchCurQcQuantity.AsFloat := StageRec.ValueByName('QcQuantity').AsFloat;
+    cdsSearchAddGatherQuantity.AsString := Rec.ValueByName('AddGatherQuantity').AsString;
+    if cdsSearchQuantity.AsFloat <> 0 then
+      cdsSearchCompleteRate.AsFloat := advRoundTo(
+          Rec.ValueByName('AddDealQuantity').AsFloat/cdsSearchQuantity.AsFloat*100);
+  end;
   cdsSearch.Post;
 end;
 
-procedure TSearchData.BeginSearch;
-begin
-  cdsSearch.DisableControls;
-end;
-
 constructor TSearchData.Create(AProjectData: TObject);
 begin
   inherited Create(nil);
@@ -86,11 +84,6 @@ begin
   inherited;
 end;
 
-procedure TSearchData.EndSearch;
-begin
-  cdsSearch.EnableControls;
-end;
-
 procedure TSearchData.LocateCurrent(ALocateType: TLocateType);
 
   procedure LocateCompile;
@@ -116,82 +109,62 @@ procedure TSearchData.LocateCurrent(ALocateType: TLocateType);
   end;
 
 begin
-  if ALocateType = ltCompile then
-    LocateCompile
-  else if ALocateType = ltMeasure then
-    LocateMeasure;
+  Screen.Cursor := crHourGlass;
+  try
+    if ALocateType = ltCompile then
+      LocateCompile
+    else if ALocateType = ltMeasure then
+      LocateMeasure;
+  finally
+    Screen.Cursor := crDefault;
+  end;
 end;
 
 procedure TSearchData.SearchKeyword(const AKeyword: string);
-
-  procedure CheckKeyword(ANode: TsdIDTreeNode);
-  var
-    Rec, StageRec: TsdDataRecord;
-  begin
-    Rec := ANode.Rec;
-    StageRec := TProjectData(FProjectData).PhaseData.StageData.StageRecord(ANode.ID);
-    // Task 꼇꿴璂淃커쌘,쏭꿴璂묏넋좆헌데
-    if {(Pos(AKeyword, Rec.ValueByName('Code').AsString) > 0) or}
-        (Pos(AKeyword, Rec.ValueByName('B_Code').AsString) > 0) or
-        (Pos(AKeyword, Rec.ValueByName('Name').AsString) > 0) then
-    begin
-      AddSearchResult(Rec, StageRec);
-    end;
-  end;
-
-  procedure RecursiveSearchKeyword(ANode: TsdIDTreeNode);
-  begin
-    if not Assigned(ANode) then Exit;
-    CheckKeyword(ANode);
-    if ANode.HasChildren then
-      RecursiveSearchKeyword(ANode.FirstChild);
-    RecursiveSearchKeyword(ANode.NextSibling);
-  end;
-
+var
+  iNode: Integer;
+  vNode: TBillsIDTreeNode;
 begin
   if AKeyword = '' then Exit;
-  BeginSearch;
+
+  cdsSearch.DisableControls;
   try
     cdsSearch.EmptyDataSet;
     with TProjectData(FProjectData).BillsMeasureData do
-      RecursiveSearchKeyword(BillsMeasureTree.FirstNode);
+    begin
+      for iNode := 0 to BillsMeasureTree.Count - 1 do
+      begin
+        vNode := TBillsIDTreeNode(BillsMeasureTree.Items[iNode]);
+        if (Pos(AKeyword, vNode.Rec.B_Code.AsString) > 0) or
+            (Pos(AKeyword, vNode.Rec.Name.AsString) > 0) then
+          AddSearchResult(vNode);
+      end;
+    end;
   finally
-    EndSearch;
+    cdsSearch.EnableControls;
   end;
 end;
 
 procedure TSearchData.SearchOverRange;
-
-  procedure CheckOverRange(ANode: TsdIDTreeNode);
-  var
-    Rec, StageRec: TsdDataRecord;
-  begin
-    Rec := ANode.Rec;
-    StageRec := TProjectData(FProjectData).PhaseData.StageData.StageRecord(ANode.ID);
-    if Rec.ValueByName('Quantity').AsFloat < Rec.ValueByName('AddDealQuantity').AsFloat then
-    begin
-      AddSearchResult(Rec, StageRec)
-    end;
-  end;
-
-  procedure RecursiveSearchOverRange(ANode: TsdIDTreeNode);
-  begin
-    if not Assigned(ANode) then Exit;
-    if ANode.HasChildren then
-      RecursiveSearchOverRange(ANode.FirstChild)
-    else
-      CheckOverRange(ANode);
-    RecursiveSearchOverRange(ANode.NextSibling);
-  end;
-
+var
+  i: Integer;
+  vNode: TBillsIDTreeNode;
 begin
-  BeginSearch;
+  cdsSearch.DisableControls;
   try
     cdsSearch.EmptyDataSet;
     with TProjectData(FProjectData).BillsMeasureData do
-      RecursiveSearchOverRange(BillsMeasureTree.FirstNode);
+    begin
+      for i := 0 to BillsMeasureTree.Count - 1 do
+      begin
+        vNode := TBillsIDTreeNode(BillsMeasureTree.Items[i]);
+        if not vNode.HasChildren then
+          if vNode.Rec.Quantity.AsFloat < vNode.Rec.AddDealQuantity.AsFloat then
+            AddSearchResult(vNode);
+      end;
+    end;
   finally
-    EndSearch;
+    cdsSearch.EnableControls;
   end;
 end;
 
@@ -205,38 +178,25 @@ begin
 end;
 
 procedure TSearchData.SearchBelowRange;
-
-  procedure CheckBelowRange(ANode: TsdIDTreeNode);
-  var
-    Rec, StageRec: TsdDataRecord;
-  begin
-    Rec := ANode.Rec;
-    if Rec.ValueByName('Quantity').AsFloat = 0 then Exit;
-    StageRec := TProjectData(FProjectData).PhaseData.StageData.StageRecord(ANode.ID);
-    if Rec.ValueByName('Quantity').AsFloat > Rec.ValueByName('AddDealQuantity').AsFloat then
-    begin
-      AddSearchResult(Rec, StageRec)
-    end;
-  end;
-
-  procedure RecursiveSearchBelowRange(ANode: TsdIDTreeNode);
-  begin
-    if not Assigned(ANode) then Exit;
-    if ANode.HasChildren then
-      RecursiveSearchBelowRange(ANode.FirstChild)
-    else
-      CheckBelowRange(ANode);
-    RecursiveSearchBelowRange(ANode.NextSibling);
-  end;
-
+var
+  i: Integer;
+  vNode: TBillsIDTreeNode;
 begin
-  BeginSearch;
+  cdsSearch.DisableControls;
   try
     cdsSearch.EmptyDataSet;
     with TProjectData(FProjectData).BillsMeasureData do
-      RecursiveSearchBelowRange(BillsMeasureTree.FirstNode);
+    begin
+      for i := 0 to BillsMeasureTree.Count - 1 do
+      begin
+        vNode := TBillsIDTreeNode(BillsMeasureTree.Items[i]);
+        if not vNode.HasChildren then
+          if vNode.Rec.Quantity.AsFloat > vNode.Rec.AddDealQuantity.AsFloat then
+            AddSearchResult(vNode);
+      end;
+    end;
   finally
-    EndSearch;
+    cdsSearch.EnableControls;
   end;
 end;
 

+ 1 - 0
DataModules/StageCompareDm.dfm

@@ -12,6 +12,7 @@ object StageCompareData: TStageCompareData
   object sddStageCompare: TsdDataSet
     Active = False
     Provider = sdpStageCompare
+    OnGetRecordClass = sddStageCompareGetRecordClass
     Left = 72
     Top = 96
     FieldListData = {

+ 44 - 18
DataModules/StageCompareDm.pas

@@ -8,7 +8,7 @@ unit StageCompareDm;
 interface
 
 uses
-  SysUtils, Classes, sdDB, sdProvider, ADODB;
+  SysUtils, Classes, sdDB, sdProvider, ADODB, mDataRecord;
 
 const
   TableDeleteSql = 'Drop Table StageCompare';
@@ -40,10 +40,29 @@ const
               '    Set S.Quantity%d = A.GatherQuantity, S.TotalPrice%d = A.GatherTotalPrice'+
               '  Where S.BillsID = A.BillsID';
 
+  DeleteCacheSql = 'Delete From StageCompare Where '+
+                   '  (IsNull(Quantity0) or Quantity0 = 0) and (IsNull(TotalPrice0) or TotalPrice0 = 0)'+
+                   '   and (IsNull(Quantity1) or Quantity1 = 0) and (IsNull(TotalPrice1) or TotalPrice1 = 0)'+
+                   '   and (IsNull(Quantity2) or Quantity2 = 0) and (IsNull(TotalPrice2) or TotalPrice2 = 0)'+
+                   '   and (IsNull(Quantity3) or Quantity3 = 0) and (IsNull(TotalPrice3) or TotalPrice3 = 0)'+
+                   '   and (IsNull(Quantity4) or Quantity4 = 0) and (IsNull(TotalPrice4) or TotalPrice4 = 0)'+
+                   '   and (IsNull(Quantity5) or Quantity5 = 0) and (IsNull(TotalPrice5) or TotalPrice5 = 0)'+
+                   '   and (IsNull(Quantity6) or Quantity6 = 0) and (IsNull(TotalPrice6) or TotalPrice6 = 0)'+
+                   '   and (IsNull(Quantity7) or Quantity7 = 0) and (IsNull(TotalPrice7) or TotalPrice7 = 0)'+
+                   '   and (IsNull(Quantity8) or Quantity8 = 0) and (IsNull(TotalPrice8) or TotalPrice8 = 0)'+
+                   '   and (IsNull(Quantity9) or Quantity9 = 0) and (IsNull(TotalPrice9) or TotalPrice9 = 0)'+
+                   '   and (IsNull(Quantity10) or Quantity10 = 0) and (IsNull(TotalPrice10) or TotalPrice10 = 0)'+
+                   '   and (IsNull(Quantity11) or Quantity11 = 0) and (IsNull(TotalPrice11) or TotalPrice11 = 0)'+
+                   '   and (IsNull(Quantity12) or Quantity12 = 0) and (IsNull(TotalPrice12) or TotalPrice12 = 0)'+
+                   '   and (IsNull(Quantity13) or Quantity13 = 0) and (IsNull(TotalPrice13) or TotalPrice13 = 0)'+
+                   '   and (IsNull(Quantity14) or Quantity14 = 0) and (IsNull(TotalPrice14) or TotalPrice14 = 0)';
+
 type
   TStageCompareData = class(TDataModule)
     sdpStageCompare: TsdADOProvider;
     sddStageCompare: TsdDataSet;
+    procedure sddStageCompareGetRecordClass(
+      var ARecordClass: TsdRecordClass);
   private
     FPhaseData: TObject;
 
@@ -120,27 +139,27 @@ end;
 
 function TStageCompareData.HasPhaseData(AID: Integer): Boolean;
 var
-  Rec: TsdDataRecord;
+  Rec: TStageCompareRecord;
 begin
   Result := False;
-  Rec := sddStageCompare.FindKey('idxID', AID);
+  Rec := TStageCompareRecord(sddStageCompare.FindKey('idxID', AID));
   if not Assigned(Rec) then Exit;
 
-  Result := (Rec.ValueByName('TotalPrice0').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice1').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice2').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice3').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice4').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice5').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice6').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice7').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice8').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice9').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice10').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice11').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice12').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice13').AsFloat <> 0)
-         or (Rec.ValueByName('TotalPrice14').AsFloat <> 0);
+  Result := (Rec.TotalPrice0.AsFloat <> 0)
+         or (Rec.TotalPrice1.AsFloat <> 0)
+         or (Rec.TotalPrice2.AsFloat <> 0)
+         or (Rec.TotalPrice3.AsFloat <> 0)
+         or (Rec.TotalPrice4.AsFloat <> 0)
+         or (Rec.TotalPrice5.AsFloat <> 0)
+         or (Rec.TotalPrice6.AsFloat <> 0)
+         or (Rec.TotalPrice7.AsFloat <> 0)
+         or (Rec.TotalPrice8.AsFloat <> 0)
+         or (Rec.TotalPrice9.AsFloat <> 0)
+         or (Rec.TotalPrice10.AsFloat <> 0)
+         or (Rec.TotalPrice11.AsFloat <> 0)
+         or (Rec.TotalPrice12.AsFloat <> 0)
+         or (Rec.TotalPrice13.AsFloat <> 0)
+         or (Rec.TotalPrice14.AsFloat <> 0);
 end;
 
 procedure TStageCompareData.InsertLastesyStageData(AIndex: Integer;
@@ -175,6 +194,7 @@ begin
       for iStage := 0 to AuditCount - 1 do
         UpdateHistoryStageData(iStage, StageTableName[iStage]);
   end;
+  ExecuteSql(DeleteCacheSql);
 end;
 
 procedure TStageCompareData.UpdateHistoryStageData(AIndex: Integer;
@@ -186,4 +206,10 @@ begin
   ExecuteSql(sSql);
 end;
 
+procedure TStageCompareData.sddStageCompareGetRecordClass(
+  var ARecordClass: TsdRecordClass);
+begin
+  ARecordClass := TStageCompareRecord;
+end;
+
 end.

+ 14 - 1
DataModules/StageDm.pas

@@ -31,6 +31,8 @@ type
     procedure UpdateParentRecord(ABillsID: Integer; ATotalPrice: Double; const AFieldName: string);
     procedure UpdateComplete(ABillsID: Integer; AQuantity, ATotalPrice: Double);
 
+    function HasPriceMarginBills: Boolean;
+
     // 向父项增量--PM_TotalPrice
     procedure UpdateParentPriceMargin(ABillsID: Integer; ADiffer: Double);
     // 向价差调整节点增量--GatherTotalPrice
@@ -368,7 +370,6 @@ end;
 
 procedure TStageData.Save;
 begin
-  sddStage.SaveToFile('E:\1.xml');
   sddStage.Save;
 end;
 
@@ -819,6 +820,8 @@ var
   Rec: TStageRecord;
   fDiffer: Double;
 begin
+  if not HasPriceMarginBills then Exit;
+   
   with TProjectData(TPhaseData(FPhaseData).ProjectData) do
   begin
     Rec := StageRecord(iPriceMarginID);
@@ -861,6 +864,8 @@ var
   Rec: TStageRecord;
   fPM, fPMDiffer: Double;
 begin
+  if not HasPriceMarginBills then Exit;
+  
   Rec := StageRecord(ABillsID);
   if not Assigned(Rec) then Exit;
 
@@ -947,4 +952,12 @@ begin
   end;
 end;
 
+function TStageData.HasPriceMarginBills: Boolean;
+var
+  vPM_Node: TsdIDTreeNode;
+begin
+  vPM_Node := MainBillsTree.FindNode(iPriceMarginID);
+  Result := Assigned(vPM_Node);
+end;
+
 end.

+ 2 - 2
Dprs/CSL/Measure_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=3
-Build=1066
+Build=1067
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化云版
-FileVersion=3.1.3.1066
+FileVersion=3.1.3.1067
 InternalName=Measure
 LegalCopyright=版权所有(C) 珠海纵横创新软件有限公司 2003-2014。保留所有权利。
 LegalTrademarks=Measure

BIN
Dprs/CSL/Measure_Cloud.res


+ 44 - 3
Dprs/Trail/Measure.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=3
-Build=3013
+Build=3027
 Debug=0
 PreRelease=0
 Special=0
@@ -125,5 +125,46 @@ Locale=2052
 CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
-FileDescription=纵横结算决算计量一体化专业版
-FileVersion=3.1.3.3013
+FileDescription=纵横结算决算计量一体化学习版
+FileVersion=3.1.3.3027
+InternalName=Measure
+LegalCopyright=版权所有(C) 珠海纵横创新软件有限公司 2003-2014。保留所有权利。
+LegalTrademarks=Measure
+OriginalFilename=
+ProductName=纵横公路工程计量决算一体化软件
+ProductVersion=3
+Comments=
+[Excluded Packages]
+C:\Program Files (x86)\Borland\Delphi7\Lib\3F\Developer Express Inc\ExpressEditors Library 5\Delphi 7\Bin\dclcxEditorsVCLD7.bpl=ExpressEditors Library 5 (VCL Edition) by Developer Express Inc.
+C:\Program Files (x86)\Borland\Delphi7\Lib\3F\Developer Express Inc\ExpressEditors Library 5\Delphi 7\Bin\dclcxExtEditorsVCLD7.bpl=ExpressExtendedEditors Library 5 (VCL Edition) by Developer Express Inc.
+[HistoryLists\hlConditionals]
+Count=9
+Item0=_mEncrypt;cplPrint;cplOutputToExcelRange
+Item1=cplPrint;_mEncrypt;cplPrint;cplOutputToExcelRange
+Item2=cplPrint;_mEncrypt;cplPrint
+Item3=cplPrint;_mEncrypt
+Item4=cplPrint;
+Item5=cplPrint;_mEncrypt;
+Item6=cplPrint;mEncrypt;
+Item7=cplPrint
+Item8=cplPrint;cplOutputToExcelRange;
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlUnitOutputDirectory]
+Count=2
+Item0=..\..\Dcus
+Item1=..\Dcus
+[HistoryLists\hlOutputDirectorry]
+Count=11
+Item0=D:\SmartCostExe\MeasureTrail
+Item1=E:\资料\软件安装文件\纵横结算决算计量一体化软件(专业版)
+Item2=E:\SmartCostExe\MeasureTrail
+Item3=E:\SmartCostExe\Measure
+Item4=D:\Program Files (x86)\纵横软件\纵横计量决算一体化软件(广东专业版)
+Item5=D:\Program Files (x86)\纵横软件\纵横计量决算一体化软件(专业版)
+Item6=D:\Program Files (x86)\纵横软件\纵横计量决算一体化软件(专业版2)
+Item7=D:\Program Files (x86)\纵横软件\纵横公路工程计量支付(专业版)
+Item8=D:\Program Files\纵横软件\Environment
+Item9=..\..\Environment
+Item10=..\Dcus

+ 44 - 2
Dprs/Trail/Measure_GuangDong.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=3
-Build=3013
+Build=3027
 Debug=0
 PreRelease=0
 Special=0
@@ -126,4 +126,46 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东学习版
-FileVersion=3.1.3.3013
+FileVersion=3.1.3.3027
+InternalName=Measure
+LegalCopyright=版权所有(C) 珠海纵横创新软件有限公司 2003-2014。保留所有权利。
+LegalTrademarks=Measure
+OriginalFilename=
+ProductName=纵横公路工程计量决算一体化软件
+ProductVersion=3
+Comments=
+[Excluded Packages]
+C:\Program Files (x86)\Borland\Delphi7\Lib\3F\Developer Express Inc\ExpressEditors Library 5\Delphi 7\Bin\dclcxEditorsVCLD7.bpl=ExpressEditors Library 5 (VCL Edition) by Developer Express Inc.
+C:\Program Files (x86)\Borland\Delphi7\Lib\3F\Developer Express Inc\ExpressEditors Library 5\Delphi 7\Bin\dclcxExtEditorsVCLD7.bpl=ExpressExtendedEditors Library 5 (VCL Edition) by Developer Express Inc.
+[HistoryLists\hlConditionals]
+Count=12
+Item0=_mGuangDong
+Item1=_mEncrypt;_mGuangDong
+Item2=_mEncrypt;_mGuangDong;cplPrint;cplOutputToExcelRange
+Item3=_mEncrypt;cplPrint;cplOutputToExcelRange
+Item4=cplPrint;_mEncrypt;cplPrint;cplOutputToExcelRange
+Item5=cplPrint;_mEncrypt;cplPrint
+Item6=cplPrint;_mEncrypt
+Item7=cplPrint;
+Item8=cplPrint;_mEncrypt;
+Item9=cplPrint;mEncrypt;
+Item10=cplPrint
+Item11=cplPrint;cplOutputToExcelRange;
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlUnitOutputDirectory]
+Count=2
+Item0=..\..\Dcus
+Item1=..\Dcus
+[HistoryLists\hlOutputDirectorry]
+Count=9
+Item0=D:\SmartCostExe\MeasureTrail
+Item1=E:\SmartCostExe\MeasureTrail
+Item2=E:\SmartCostExe\Measure
+Item3=D:\Program Files (x86)\纵横软件\纵横计量决算一体化软件(专业版)
+Item4=D:\Program Files (x86)\纵横软件\纵横计量决算一体化软件(专业版2)
+Item5=D:\Program Files (x86)\纵横软件\纵横公路工程计量支付(专业版)
+Item6=D:\Program Files\纵横软件\Environment
+Item7=..\..\Environment
+Item8=..\Dcus

+ 13 - 0
Forms/BatchInsertBillsFrm.dfm

@@ -293,8 +293,13 @@ object BatchInsertBillsForm: TBatchInsertBillsForm
       item
         Item = MainForm.dxbtnPaste
         Visible = True
+      end
+      item
+        Item = MainForm.dxbtnInsertCol
+        Visible = True
       end>
     UseOwnFont = False
+    OnPopup = dxpmInsertBillsPopup
     Left = 139
     Top = 99
   end
@@ -378,4 +383,12 @@ object BatchInsertBillsForm: TBatchInsertBillsForm
     Left = 568
     Top = 139
   end
+  object alBatchInsertBills: TActionList
+    Left = 203
+    Top = 99
+    object actnInsertCol: TAction
+      Caption = #25554#20837#19968#21015
+      OnExecute = actnInsertColExecute
+    end
+  end
 end

+ 23 - 4
Forms/BatchInsertBillsFrm.pas

@@ -5,7 +5,8 @@ interface
 uses
   BillsCompileDm,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
-  Dialogs, StdCtrls, ExtCtrls, ZJGrid, sdIDTree, dxBar, sdGridDBA, ComCtrls;
+  Dialogs, StdCtrls, ExtCtrls, ZJGrid, sdIDTree, dxBar, sdGridDBA, ComCtrls,
+  ActnList;
 
 type
   TInsertType = (itChild, itNextSibling);
@@ -35,6 +36,8 @@ type
     lblHint: TLabel;
     sgdDealBills: TsdGridDBA;
     udBeginCode: TUpDown;
+    alBatchInsertBills: TActionList;
+    actnInsertCol: TAction;
     procedure zgPositionCustomPaste(Sender: TObject; ABounds: TRect;
       ASourSheet: TZjSheet);
     procedure zgBillsCustomPaste(Sender: TObject; ABounds: TRect;
@@ -48,6 +51,8 @@ type
     procedure leBeginCodeKeyPress(Sender: TObject; var Key: Char);
     procedure zgPositionCellTextChanged(Sender: TObject; Col,
       Row: Integer);
+    procedure dxpmInsertBillsPopup(Sender: TObject);
+    procedure actnInsertColExecute(Sender: TObject);
   private
     FInsertType: TInsertType;
     FBillsCompileData: TBillsCompileData;
@@ -75,7 +80,7 @@ procedure AddLeafBills(ABillsCompileData: TBillsCompileData; AInsertType: TInser
 implementation
 
 uses
-  sdDB, UtilMethods, ProjectData;
+  sdDB, UtilMethods, ProjectData, MainFrm;
 
 {$R *.dfm}
 
@@ -199,8 +204,8 @@ end;
 procedure TBatchInsertBillsForm.SetRowAndColumnCount(AGrid: TZJGrid;
   ASourSheet: TZjSheet);
 begin
-  if AGrid.ColCount < ASourSheet.ColCount + AGrid.CurCol then
-    AGrid.ColCount := ASourSheet.ColCount + AGrid.CurCol;
+  if AGrid.ColCount < ASourSheet.ColCount + AGrid.CurCol + 1 then
+    AGrid.ColCount := ASourSheet.ColCount + AGrid.CurCol + 1;
   if AGrid.RowCount < ASourSheet.RowCount + AGrid.CurRow + 1 then
     AGrid.RowCount := ASourSheet.RowCount + AGrid.CurRow + 1;
 end;
@@ -403,4 +408,18 @@ begin
   end;
 end;
 
+procedure TBatchInsertBillsForm.dxpmInsertBillsPopup(Sender: TObject);
+begin
+  SetDxBtnAction(actnInsertCol, MainForm.dxbtnInsertCol);
+end;
+
+procedure TBatchInsertBillsForm.actnInsertColExecute(Sender: TObject);
+begin
+  zgPosition.ColCount := zgPosition.ColCount + 1;
+  zgPosition.Cells[zgPosition.ColCount-1, 0].Text := 'Çåµ¥' + IntToStr(zgPosition.ColCount -1 - 1);
+  zgPosition.ColWidths[zgPosition.ColCount-1] := 50;
+  zgBills.RowCount := zgPosition.ColCount - 1;
+  zgBills.Cells[0, zgBills.RowCount-1].Text := 'Çåµ¥' + IntToStr(zgBills.RowCount-1);
+end;
+
 end.

+ 1 - 1
Forms/DealPayPlanFrm.dfm

@@ -142,7 +142,7 @@ object DealPayPlanForm: TDealPayPlanForm
       Ctl3D = False
       EditLabel.Width = 66
       EditLabel.Height = 12
-      EditLabel.Caption = #38480#21046#37329#39069#65306' '
+      EditLabel.Caption = #38480#21046#26399#25968#65306' '
       LabelPosition = lpLeft
       ParentCtl3D = False
       TabOrder = 0

+ 7 - 2
Forms/MainFrm.dfm

@@ -1,6 +1,6 @@
 object MainForm: TMainForm
-  Left = 542
-  Top = 223
+  Left = 544
+  Top = 226
   Width = 750
   Height = 538
   ActiveControl = jpsMainProjectsManager
@@ -1031,6 +1031,11 @@ object MainForm: TMainForm
       Caption = #24635#37327#25511#21046#26684#24335
       Category = 0
       Hint = #24635#37327#25511#21046#26684#24335
+    end
+    object dxbtnInsertCol: TdxBarButton
+      Caption = #26032#22686#19968#21015
+      Category = 0
+      Hint = #26032#22686#19968#21015
       Visible = ivAlways
     end
   end

+ 4 - 1
Forms/MainFrm.pas

@@ -153,6 +153,7 @@ type
     dxbtnCalculatePriceMargin: TdxBarButton;
     dxbtnFxZJJL: TdxBarButton;
     dxbtnGclZJJL: TdxBarButton;
+    dxbtnInsertCol: TdxBarButton;
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;
@@ -272,7 +273,9 @@ procedure TMainForm.FormCreate(Sender: TObject);
       Result := Result + '¹ã¶«';
     if _ModuleType = mtAll then
     begin
-      if G_IsCloud then
+      if G_IsTest then
+        Result := '²âÊÔ'
+      else if G_IsCloud then
         Result := Result + 'ÔÆ'
       else if _IsEncrypt then
         Result := Result + 'רҵ'

+ 74 - 43
Forms/ProjectPropertiesFrm.dfm

@@ -215,6 +215,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           Width = 438
           Height = 247
           HorzScrollBar.Range = 401
+          VertScrollBar.Position = 758
           VertScrollBar.Range = 1005
           Align = alClient
           AutoScroll = False
@@ -232,7 +233,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           OnVScroll = msbBaseVScroll
           object lblDealInfo: TLabel
             Left = 7
-            Top = 4
+            Top = -754
             Width = 48
             Height = 12
             Caption = #21512#21516#20449#24687
@@ -245,28 +246,28 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblBuilder: TLabel
             Left = 34
-            Top = 108
+            Top = -650
             Width = 60
             Height = 12
             Caption = #24314#35774#21333#20301#65306
           end
           object lblConstructor: TLabel
             Left = 34
-            Top = 192
+            Top = -566
             Width = 60
             Height = 12
             Caption = #25215#21253#21333#20301#65306
           end
           object lblSupervisor: TLabel
             Left = 34
-            Top = 276
+            Top = -482
             Width = 60
             Height = 12
             Caption = #30417#29702#21333#20301#65306
           end
           object lblTechParameters: TLabel
             Left = 7
-            Top = 371
+            Top = -387
             Width = 48
             Height = 12
             Caption = #25216#26415#21442#25968
@@ -279,14 +280,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblLoadLevel: TLabel
             Left = 34
-            Top = 393
+            Top = -365
             Width = 60
             Height = 12
             Caption = #20844#36335#31561#32423#65306
           end
           object lblDealPayTitle: TLabel
             Left = 7
-            Top = 531
+            Top = -227
             Width = 48
             Height = 12
             Caption = #21512#21516#25903#20184
@@ -299,7 +300,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblSafeTitel: TLabel
             Left = 7
-            Top = 635
+            Top = -123
             Width = 48
             Height = 12
             Caption = #25991#20214#23433#20840
@@ -312,14 +313,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblUnlockPassword: TLabel
             Left = 36
-            Top = 659
+            Top = -99
             Width = 84
             Height = 12
             Caption = #35299#38145#33410#28857#23494#30721#65306
           end
           object lblPasswordHint: TLabel
             Left = 128
-            Top = 660
+            Top = -98
             Width = 90
             Height = 12
             Caption = 'lblPasswordHint'
@@ -333,7 +334,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblCalcParametersTitel: TLabel
             Left = 7
-            Top = 763
+            Top = 5
             Width = 48
             Height = 12
             Caption = #35745#31639#21442#25968
@@ -346,14 +347,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object Label1: TLabel
             Left = 36
-            Top = 787
+            Top = 29
             Width = 84
             Height = 12
             Caption = #20445#30041#23567#25968#20301#25968#65306
           end
           object pnlDealInfoBar: TPanel
             Left = 62
-            Top = 9
+            Top = -749
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -361,7 +362,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leProjectName: TLabeledEdit
             Left = 33
-            Top = 36
+            Top = -722
             Width = 330
             Height = 18
             Ctl3D = False
@@ -373,7 +374,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealName: TLabeledEdit
             Left = 33
-            Top = 76
+            Top = -682
             Width = 152
             Height = 18
             Ctl3D = False
@@ -385,7 +386,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealIndex: TLabeledEdit
             Left = 195
-            Top = 76
+            Top = -682
             Width = 80
             Height = 18
             Ctl3D = False
@@ -397,7 +398,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBName: TLabeledEdit
             Left = 101
-            Top = 123
+            Top = -635
             Width = 261
             Height = 18
             Ctl3D = False
@@ -409,7 +410,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBLegal: TLabeledEdit
             Left = 101
-            Top = 164
+            Top = -594
             Width = 137
             Height = 18
             Ctl3D = False
@@ -421,7 +422,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBDate: TLabeledEdit
             Left = 245
-            Top = 164
+            Top = -594
             Width = 119
             Height = 18
             Ctl3D = False
@@ -433,7 +434,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCName: TLabeledEdit
             Left = 101
-            Top = 207
+            Top = -551
             Width = 262
             Height = 18
             Ctl3D = False
@@ -445,7 +446,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCLegal: TLabeledEdit
             Left = 101
-            Top = 248
+            Top = -510
             Width = 137
             Height = 18
             Ctl3D = False
@@ -457,7 +458,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCDate: TLabeledEdit
             Left = 245
-            Top = 248
+            Top = -510
             Width = 119
             Height = 18
             Ctl3D = False
@@ -469,7 +470,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSName: TLabeledEdit
             Left = 101
-            Top = 291
+            Top = -467
             Width = 262
             Height = 18
             Ctl3D = False
@@ -481,7 +482,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSLegal: TLabeledEdit
             Left = 101
-            Top = 331
+            Top = -427
             Width = 137
             Height = 18
             Ctl3D = False
@@ -493,7 +494,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSDate: TLabeledEdit
             Left = 245
-            Top = 331
+            Top = -427
             Width = 119
             Height = 18
             Ctl3D = False
@@ -505,7 +506,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlTechParametersBar: TPanel
             Left = 62
-            Top = 376
+            Top = -382
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -513,7 +514,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leStartPeg: TLabeledEdit
             Left = 34
-            Top = 451
+            Top = -307
             Width = 132
             Height = 18
             Ctl3D = False
@@ -525,7 +526,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leEndPeg: TLabeledEdit
             Left = 176
-            Top = 451
+            Top = -307
             Width = 131
             Height = 18
             Ctl3D = False
@@ -537,7 +538,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leLength: TLabeledEdit
             Left = 34
-            Top = 491
+            Top = -267
             Width = 132
             Height = 18
             Ctl3D = False
@@ -549,7 +550,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leLaneCount: TLabeledEdit
             Left = 176
-            Top = 491
+            Top = -267
             Width = 132
             Height = 18
             Ctl3D = False
@@ -561,7 +562,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object cbLoadLevel: TComboBox
             Left = 34
-            Top = 410
+            Top = -348
             Width = 132
             Height = 20
             Ctl3D = False
@@ -578,7 +579,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlDealPayBar: TPanel
             Left = 62
-            Top = 537
+            Top = -221
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -586,7 +587,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leContractPrice: TLabeledEdit
             Left = 133
-            Top = 552
+            Top = -206
             Width = 117
             Height = 18
             BiDiMode = bdLeftToRight
@@ -604,7 +605,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leStartedSubsist: TLabeledEdit
             Left = 133
-            Top = 579
+            Top = -179
             Width = 118
             Height = 18
             Ctl3D = False
@@ -618,7 +619,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leMaterialSubsist: TLabeledEdit
             Left = 133
-            Top = 605
+            Top = -153
             Width = 119
             Height = 18
             Ctl3D = False
@@ -632,7 +633,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlSafeBar: TPanel
             Left = 62
-            Top = 641
+            Top = -117
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -640,7 +641,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlUnlockPassword: TPanel
             Left = 40
-            Top = 673
+            Top = -85
             Width = 361
             Height = 85
             BevelOuter = bvNone
@@ -868,7 +869,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealType: TLabeledEdit
             Left = 283
-            Top = 76
+            Top = -682
             Width = 80
             Height = 18
             Ctl3D = False
@@ -880,7 +881,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlCalcParametersBar: TPanel
             Left = 62
-            Top = 769
+            Top = 11
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -888,7 +889,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leQuantityDigit: TLabeledEdit
             Left = 100
-            Top = 804
+            Top = 46
             Width = 87
             Height = 18
             EditLabel.Width = 36
@@ -900,7 +901,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leTotalPriceDigit: TLabeledEdit
             Left = 264
-            Top = 804
+            Top = 46
             Width = 87
             Height = 18
             EditLabel.Width = 36
@@ -912,7 +913,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object udQuantity: TUpDown
             Left = 187
-            Top = 804
+            Top = 46
             Width = 16
             Height = 18
             Associate = leQuantityDigit
@@ -922,13 +923,43 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object udTotalPrice: TUpDown
             Left = 351
-            Top = 804
+            Top = 46
             Width = 16
             Height = 18
             Associate = leTotalPriceDigit
             Max = 10
             TabOrder = 30
           end
+          object gbPM_Digit: TGroupBox
+            Left = 52
+            Top = 72
+            Width = 349
+            Height = 49
+            Caption = #20215#24046
+            TabOrder = 31
+            Visible = False
+            object lePM_PriceDigit: TLabeledEdit
+              Left = 49
+              Top = 19
+              Width = 87
+              Height = 18
+              EditLabel.Width = 36
+              EditLabel.Height = 12
+              EditLabel.Caption = #21333#20215#65306
+              LabelPosition = lpLeft
+              TabOrder = 0
+              Text = '0'
+            end
+            object udPM_PriceDigit: TUpDown
+              Left = 136
+              Top = 19
+              Width = 16
+              Height = 18
+              Associate = lePM_PriceDigit
+              Max = 10
+              TabOrder = 1
+            end
+          end
         end
       end
     end

+ 9 - 0
Forms/ProjectPropertiesFrm.pas

@@ -99,6 +99,9 @@ type
     leTotalPriceDigit: TLabeledEdit;
     udQuantity: TUpDown;
     udTotalPrice: TUpDown;
+    gbPM_Digit: TGroupBox;
+    lePM_PriceDigit: TLabeledEdit;
+    udPM_PriceDigit: TUpDown;
     procedure btnOkClick(Sender: TObject);
     procedure leContractPriceClick(Sender: TObject);
     procedure msbBaseMouseWheel(Sender: TObject; Shift: TShiftState;
@@ -533,6 +536,8 @@ begin
     FProjProperties.TotalPriceDigit := udTotalPrice.Position;
     FProjectData.ResetFloatDigitView;
   end;
+  if (FProjProperties.PhaseCount = 1) and not FProjectData.PriceMarginReadOnly then
+    FProjProperties.DecimalManager.PriceMargin.Price.Digit := udPM_PriceDigit.Position;
 end;
 
 procedure TProjectPropertiesForm.InitCalcParameters;
@@ -543,6 +548,10 @@ begin
   udTotalPrice.Position := FProjProperties.TotalPriceDigit;
   leTotalPriceDigit.ReadOnly := FProjProperties.PhaseCount > 0;
   udTotalPrice.Enabled := FProjProperties.PhaseCount = 0;
+
+  udPM_PriceDigit.Position := FProjProperties.DecimalManager.PriceMargin.Price.Digit;
+  lePM_PriceDigit.ReadOnly := FProjectData.PriceMarginReadOnly and (FProjProperties.PhaseCount > 1);
+  udPM_PriceDigit.Enabled := not lePM_PriceDigit.ReadOnly;
 end;
 
 procedure TProjectPropertiesForm.SaveProjectView;

+ 49 - 20
Units/CalcDecimal.pas

@@ -18,6 +18,8 @@ type
     constructor Create;
     destructor Destroy; override;
 
+    function RoundTo(AValue: Double): Double;
+
     procedure ClearLinkViewCols;
     procedure AddLinkViewCol(ACol: TObject);
 
@@ -36,6 +38,8 @@ type
     constructor Create;
     destructor Destroy; override;
 
+    procedure RefreshLinkViewColumnsFormat;
+
     property Quantity: TDecimal read FQuantity;
     property TotalPrice: TDecimal read FTotalPrice;
     property Price: TDecimal read FPrice;
@@ -46,21 +50,22 @@ type
     FProjectData: TObject;
     FCommon: TCalcDecimal;
     FCompile:TCalcDecimal;
+    FPriceMargin: TCalcDecimal;
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
 
     procedure ResetLinkViewColumns;
-    procedure RefreshLinkViewColumnsFormat;
 
     property Common: TCalcDecimal read FCommon;
     property Compile: TCalcDecimal read FCompile;
+    property PriceMargin: TCalcDecimal read FPriceMargin;
   end;
 
 implementation
 
 uses
-  ProjectData;
+  ProjectData, ScUtils;
 
 { TDecimal }
 
@@ -111,16 +116,26 @@ begin
   for i := 0 to FLinkViewCols.Count - 1 do
   begin
     ViewCol := TsdViewColumn(FLinkViewCols.Items[i]);
+    if not Assigned(ViewCol) then Continue;
+
     ViewCol.DisplayFormat := FFormat;
     ViewCol.EditFormat := FFormat;
   end;
 end;
 
+function TDecimal.RoundTo(AValue: Double): Double;
+begin
+  Result := ScRoundTo(AValue, -Digit);
+end;
+
 procedure TDecimal.SetDigit(const Value: Integer);
 begin
-  FDigit := Value;
-  FFormat := GetDisplayFormat(FDigit);
-  RefreshLinkViewColsFormat;
+  if FDigit <> Value then
+  begin
+    FDigit := Value;
+    FFormat := GetDisplayFormat(FDigit);
+    RefreshLinkViewColsFormat;
+  end;
 end;
 
 { TCalcDecimal }
@@ -140,6 +155,13 @@ begin
   inherited;
 end;
 
+procedure TCalcDecimal.RefreshLinkViewColumnsFormat;
+begin
+  Quantity.RefreshLinkViewColsFormat;
+  TotalPrice.RefreshLinkViewColsFormat;
+  Price.RefreshLinkViewColsFormat;
+end;
+
 { TDecimalManager }
 
 constructor TDecimalManager.Create(AProjectData: TObject);
@@ -147,26 +169,17 @@ begin
   FProjectData := AProjectData;
   FCommon := TCalcDecimal.Create;
   FCompile := TCalcDecimal.Create;
+  FPriceMargin := TCalcDecimal.Create;
 end;
 
 destructor TDecimalManager.Destroy;
 begin
+  FPriceMargin.Free;
   FCompile.Free;
   FCommon.Free;
   inherited;
 end;
 
-procedure TDecimalManager.RefreshLinkViewColumnsFormat;
-begin
-  FCommon.Quantity.RefreshLinkViewColsFormat;
-  FCommon.TotalPrice.RefreshLinkViewColsFormat;
-  FCommon.Price.RefreshLinkViewColsFormat;
-  
-  FCompile.Quantity.RefreshLinkViewColsFormat;
-  FCompile.TotalPrice.RefreshLinkViewColsFormat;
-  FCompile.Price.RefreshLinkViewColsFormat;
-end;
-
 procedure TDecimalManager.ResetLinkViewColumns;
 
   procedure ResetCommonLink;
@@ -239,14 +252,30 @@ procedure TDecimalManager.ResetLinkViewColumns;
     end;
   end;
 
-  procedure ResetCompileLink;
+  procedure ResetComplieLink;
   begin
-    // TODO
+
+  end;
+
+  procedure ResetPriceMarginLink;
+  begin
+    FPriceMargin.Price.ClearLinkViewCols;
+    with TProjectData(FProjectData).ProjectGLData.sdvProjectGL do
+    begin
+      FPriceMargin.Price.AddLinkViewCol(Columns.FindColumn('BasePrice'));
+      FPriceMargin.Price.AddLinkViewCol(Columns.FindColumn('InfoPrice'));
+      FPriceMargin.Price.AddLinkViewCol(Columns.FindColumn('DeltaPrice'));
+      FPriceMargin.Price.AddLinkViewCol(Columns.FindColumn('ValidDeltaPrice'));
+    end;
   end;
 
 begin
-  ResetCommonLink;
-  ResetCompileLink;
+  {ResetCommonLink;
+  FCommon.RefreshLinkViewColumnsFormat;
+  ResetComplieLink;
+  FCompile.RefreshLinkViewColumnsFormat;}
+  ResetPriceMarginLink;
+  FPriceMargin.RefreshLinkViewColumnsFormat;
 end;
 
 end.

+ 51 - 40
Units/Connections.pas

@@ -7,7 +7,8 @@ uses
 
 const
   ProductName = 'Measure';
-  FileVersion = '1.0.0.0';
+  EmptyFileVersion = '1.0.0.0';
+  FileVersion = '1.0.0.2';
   EncryptVersion = 'Auto1.0';
 
 type
@@ -50,7 +51,9 @@ type
     CreateExeVersion: string[20];
     // 最后一次打开 -- Exe版本号
     LastestExeVersion: string[20];
-    Reserve: array [0..1024 - 21 - 21] of Char;
+    // 历史最大 -- exe版本号
+    MaxExeVersion: string[20];
+    Reserve: array [0..1024 -21 -21 -21] of Char;
   end;
 
   TEncryptConnection = class(TCommonConnection)
@@ -68,7 +71,8 @@ type
     procedure ResetFileHead;
     function CheckFileEncrypt: Boolean; overload;
     function CheckFileEncrypt(AFileName: string): Boolean; overload;
-    function GetIsLastest: Boolean;
+    function GetNeedUpdate: Boolean;
+    function GetOverExe: Boolean;
   public
     destructor Destroy; override;
     procedure Open(const AFileName: string); override;
@@ -76,7 +80,8 @@ type
 
     procedure UpdateFileVersion;
 
-    property IsLastest: Boolean read GetIsLastest;
+    property NeedUpdate: Boolean read GetNeedUpdate;
+    property OverExe: Boolean read GetOverExe;
   end;
 
   procedure SimpleDecrypt(const ASourceFile, AResultFile: string);
@@ -340,9 +345,10 @@ begin
     FFileHead.ProductName := ProductName;
     FFileHead.FileType := 1;
     FFileHead.EncryptVersion := EncryptVersion;
-    FFileHead.FileVersion := FileVersion;
+    FFileHead.FileVersion := EmptyFileVersion;
     FFileHead.CreateExeVersion := GetVersion;
     FFileHead.LastestExeVersion := GetVersion;
+    FFileHead.MaxExeVersion := GetVersion;
   end;
 end;
 
@@ -359,6 +365,46 @@ begin
   FFileHead.LastestExeVersion := GetVersion;
 end;
 
+procedure TEncryptConnection.UpdateFileVersion;
+begin
+  FFileHead.FileVersion := FileVersion;
+end;
+
+procedure TEncryptConnection.RecoverFileHead(AFileName: string);
+var
+  sTempFile: string;
+  FileStream: TFileStream;
+begin
+  sTempFile := ExtractFilePath(AFileName) + ExtractSimpleFileName(AFileName) + '.tmp';
+  CopyFile(PChar(AFileName), PChar(sTempFile), False);
+  try
+    if FileExists(sTempFile) then
+    begin
+      FileStream := TFileStream.Create(sTempFile, fmOpenWrite);
+      try
+        FileStream.Seek($00, soFromBeginning);
+        FileStream.Write(MDBOrgHead, SizeOf(MDBOrgHead));
+      finally
+        FileStream.Free;
+      end;
+      CopyFile(PChar(sTempFile), PChar(AFileName), False);
+      DeleteFile(PChar(sTempFile));
+    end;
+  except
+    DeleteFile(PChar(sTempFile));
+  end;
+end;
+
+function TEncryptConnection.GetNeedUpdate: Boolean;
+begin
+  Result := CompareCode(FileVersion, FFileHead.FileVersion, '.') > 0;
+end;
+
+function TEncryptConnection.GetOverExe: Boolean;
+begin
+  Result := CompareCode(FileVersion, FFileHead.FileVersion, '.') < 0;
+end;
+
 { TConnection }
 
 procedure TConnection.Close;
@@ -416,39 +462,4 @@ begin
   FConnection.Open;
 end;
 
-function TEncryptConnection.GetIsLastest: Boolean;
-begin
-  Result := CompareCode(CurrencyString, FFileHead.FileVersion, '.') > 0;
-end;
-
-procedure TEncryptConnection.UpdateFileVersion;
-begin
-  FFileHead.FileVersion := CurrencyString;
-end;
-
-procedure TEncryptConnection.RecoverFileHead(AFileName: string);
-var
-  sTempFile: string;
-  FileStream: TFileStream;
-begin
-  sTempFile := ExtractFilePath(AFileName) + ExtractSimpleFileName(AFileName) + '.tmp';
-  CopyFile(PChar(AFileName), PChar(sTempFile), False);
-  try
-    if FileExists(sTempFile) then
-    begin
-      FileStream := TFileStream.Create(sTempFile, fmOpenWrite);
-      try
-        FileStream.Seek($00, soFromBeginning);
-        FileStream.Write(MDBOrgHead, SizeOf(MDBOrgHead));
-      finally
-        FileStream.Free;
-      end;
-      CopyFile(PChar(sTempFile), PChar(AFileName), False);
-      DeleteFile(PChar(sTempFile));
-    end;
-  except
-    DeleteFile(PChar(sTempFile));
-  end;
-end;
-
 end.

+ 4 - 2
Units/DataBaseTables.pas

@@ -398,7 +398,7 @@ const
 
   {푯獨북谿헌데--묏넋좆헌데}
   SDealBills = 'DealBills';
-  tdDealBills: array [0..6] of TScFieldDef =(
+  tdDealBills: array [0..7] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'B_Code'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'Name'; FieldType: ftString; Size: 200; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -408,7 +408,9 @@ const
     // 푯獨북谿 -- 鑒좆
     (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: 'TotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 긍뵀乞多
+    (FieldName: 'IndexCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
 
   {딧뀌묏죕}

+ 2 - 1
Units/ExcelImport.pas

@@ -789,7 +789,8 @@ begin
     begin
       Rec := FProjectData.DealBillsData.sddDealBills.Add;
       Rec.ValueByName('ID').AsInteger := FBillsID;
-      Rec.ValueByName('B_Code').AsString := sB_Code;
+      Rec.ValueByName('B_Code').AsString := sB_Code; 
+      Rec.ValueByName('IndexCode').AsString := B_CodeToIndexCode(sB_Code);
       Rec.ValueByName('Name').AsString := GetCellTrimText(ASheet, FNameCol, FCurRow);
       Rec.ValueByName('Units').AsString := GetCellTrimText(ASheet, FUnitsCol, FCurRow);
       Rec.ValueByName('Price').AsFloat := PriceRoundTo(

+ 4 - 1
Units/ProjectCommands.pas

@@ -926,7 +926,10 @@ begin
     FNew := AddNewNode(FSelect.ParentID, FSelect.NextSiblingID, FProjectName)
   else
     FNew := AddNewNode(FSelect.ID, -1, FProjectName);}
-  FNew := AddNewNode(FSelect.ParentID, FSelect.NextSiblingID, FProjectName);
+  if Assigned(FSelect) then
+    FNew := AddNewNode(FSelect.ParentID, FSelect.NextSiblingID, FProjectName)
+  else
+    FNew := AddNewNode(-1, -1, FProjectName);
   LoadChildrenFormXml;
 end;
 

+ 3 - 0
Units/ProjectData.pas

@@ -402,6 +402,7 @@ begin
     FProjProperties.UpdateFlag := 1;
   UpdateOldData;
   ResetFloatDigitView;
+  FProjProperties.DecimalManager.ResetLinkViewColumns;
   UpdateSysProgress(25, '正在读取数据');
   FBillsData.Open(FConnection.Connection);
   if FIsNewFile then
@@ -547,6 +548,8 @@ end;
 
 procedure TProjectData.UpdateProjectDataBase;
 begin
+  if TEncryptConnection(FConnection).OverExe then
+    WarningMessage('标段版本高于当前软件版本,可能会产生错误。');
   FUpdator.Update(FConnection);
 end;
 

+ 18 - 9
Units/ProjectProperty.pas

@@ -74,6 +74,7 @@ type
     FPriceFormat: string;
 
     FUpdateFlag: Integer;
+    FPriceMarginStartPhaseID: Integer;
 
     function GetBoolPropertyDef(const AName: string; ADef: Boolean): Boolean;
     function GetIntPropertyDef(const AName: string; ADef: Integer): Integer;
@@ -408,6 +409,13 @@ end;
 
 procedure TProjProperties.LoadCalcParameters;
 begin
+  FQuantityDigit := GetIntPropertyDef('QuantityDigit', 3);
+  FQuantityFormat := GetDisplayFormat(FQuantityDigit);
+  FTotalPriceDigit := GetIntPropertyDef('TotalPriceDigit', 0);
+  FTotalPriceFormat := GetDisplayFormat(FTotalPriceDigit);
+  FPriceDigit := 2;
+  FPriceFormat := GetDisplayFormat(FPriceDigit);
+
   with FDecimalManager.Common do
   begin
     Quantity.Digit := GetIntPropertyDef('QuantityDigit', 3);
@@ -420,13 +428,12 @@ begin
     Compile.TotalPrice.Digit := GetIntPropertyDef('TotalPriceDigit1', Common.TotalPrice.Digit);
     Compile.Price.Digit := 2;
   end;
-
-  FQuantityDigit := GetIntPropertyDef('QuantityDigit', 3);
-  FQuantityFormat := GetDisplayFormat(FQuantityDigit);
-  FTotalPriceDigit := GetIntPropertyDef('TotalPriceDigit', 0);
-  FTotalPriceFormat := GetDisplayFormat(FTotalPriceDigit);
-  FPriceDigit := 2;
-  FPriceFormat := GetDisplayFormat(FPriceDigit);
+  with FDecimalManager do
+  begin
+    PriceMargin.Quantity.Digit := Common.Quantity.Digit;
+    PriceMargin.TotalPrice.Digit := Common.TotalPrice.Digit;
+    PriceMargin.Price.Digit := 3;//GetIntPropertyDef('PM_PriceDigit', Common.Price.Digit);
+  end;
 end;
 
 procedure TProjProperties.LoadDealInfo;
@@ -488,10 +495,12 @@ procedure TProjProperties.SaveCalcParameters;
 begin
   with FDecimalManager do
   begin
-    FPropertyInqurity.Value['QuantityDigit'] := Common.Quantity.Digit;
+    {FPropertyInqurity.Value['QuantityDigit'] := Common.Quantity.Digit;
     FPropertyInqurity.Value['TotalPriceDigit'] := Common.TotalPrice.Digit;
     FPropertyInqurity.Value['QuantityDigit1'] := Compile.Quantity.Digit;
-    FPropertyInqurity.Value['TotalPriceDigit1'] := Compile.TotalPrice.Digit;
+    FPropertyInqurity.Value['TotalPriceDigit1'] := Compile.TotalPrice.Digit;}
+    
+    //FPropertyInqurity.Value['PM_PriceDigit'] := PriceMargin.Price.Digit;
   end;
 end;
 

+ 1 - 1
Units/UpdateDataBase.pas

@@ -55,7 +55,7 @@ end;
 
 procedure TUpdateDB.Update(AConnection: TEncryptConnection);
 begin
-  if not AConnection.IsLastest then
+  if AConnection.NeedUpdate then
   begin
     UpdateAllTables(AConnection.Connection);
     AConnection.UpdateFileVersion;

+ 108 - 0
Units/mDataRecord.pas

@@ -394,6 +394,76 @@ type
     property RelaProjectGL: TProjectGLRecord read FRelaProjectGL write FRelaProjectGL;
   end;
 
+  TStageCompareRecord = class(TMeasureBaseRecord)
+  private
+    FID: TsdValue;
+    FQuantity0: TsdValue;
+    FTotalPrice0: TsdValue;
+    FQuantity1: TsdValue;
+    FTotalPrice1: TsdValue;
+    FQuantity2: TsdValue;
+    FTotalPrice2: TsdValue;
+    FQuantity3: TsdValue;
+    FTotalPrice3: TsdValue;
+    FQuantity4: TsdValue;
+    FTotalPrice4: TsdValue;
+    FQuantity5: TsdValue;
+    FTotalPrice5: TsdValue;
+    FQuantity6: TsdValue;
+    FTotalPrice6: TsdValue;
+    FQuantity7: TsdValue;
+    FTotalPrice7: TsdValue;
+    FQuantity8: TsdValue;
+    FTotalPrice8: TsdValue;
+    FQuantity9: TsdValue;
+    FTotalPrice9: TsdValue;
+    FQuantity10: TsdValue;
+    FTotalPrice10: TsdValue;
+    FQuantity11: TsdValue;
+    FTotalPrice11: TsdValue;
+    FQuantity12: TsdValue;
+    FTotalPrice12: TsdValue;
+    FQuantity13: TsdValue;
+    FTotalPrice13: TsdValue;
+    FQuantity14: TsdValue;
+    FTotalPrice14: TsdValue;
+  protected
+    procedure DoAfterAddFields; override;
+  public
+    property ID: TsdValue read FID;
+    property Quantity0: TsdValue read FQuantity0;
+    property TotalPrice0 : TsdValue read FTotalPrice0;
+    property Quantity1: TsdValue read FQuantity0;
+    property TotalPrice1 : TsdValue read FTotalPrice0;
+    property Quantity2: TsdValue read FQuantity0;
+    property TotalPrice2 : TsdValue read FTotalPrice0;
+    property Quantity3: TsdValue read FQuantity0;
+    property TotalPrice3: TsdValue read FTotalPrice0;
+    property Quantity4: TsdValue read FQuantity0;
+    property TotalPrice4 : TsdValue read FTotalPrice0;
+    property Quantity5: TsdValue read FQuantity0;
+    property TotalPrice5 : TsdValue read FTotalPrice0;
+    property Quantity6: TsdValue read FQuantity0;
+    property TotalPrice6 : TsdValue read FTotalPrice0;
+    property Quantity7: TsdValue read FQuantity0;
+    property TotalPrice7 : TsdValue read FTotalPrice0;
+    property Quantity8: TsdValue read FQuantity0;
+    property TotalPrice8 : TsdValue read FTotalPrice0;
+    property Quantity9: TsdValue read FQuantity0;
+    property TotalPrice9 : TsdValue read FTotalPrice0;
+    property Quantity10: TsdValue read FQuantity0;
+    property TotalPrice10 : TsdValue read FTotalPrice0;
+    property Quantity11: TsdValue read FQuantity0;
+    property TotalPrice11 : TsdValue read FTotalPrice0;
+    property Quantity12: TsdValue read FQuantity0;
+    property TotalPrice12 : TsdValue read FTotalPrice0;
+    property Quantity13: TsdValue read FQuantity0;
+    property TotalPrice13 : TsdValue read FTotalPrice0;
+    property Quantity14: TsdValue read FQuantity0;
+    property TotalPrice14 : TsdValue read FTotalPrice0;
+
+  end;
+
 implementation
 
 { TBillsRecord }
@@ -624,4 +694,42 @@ begin
     AValue.AsString := AStr;
 end;
 
+{ TStageCompareRecord }
+
+procedure TStageCompareRecord.DoAfterAddFields;
+begin
+  inherited;
+  FID := ValueByName('ID');
+  FQuantity0 := ValueByName('Quantity0');
+  FTotalPrice0 := ValueByName('TotalPrice0');
+  FQuantity1 := ValueByName('Quantity1');
+  FTotalPrice1 := ValueByName('TotalPrice1');
+  FQuantity2 := ValueByName('Quantity2');
+  FTotalPrice2 := ValueByName('TotalPrice2');
+  FQuantity3 := ValueByName('Quantity3');
+  FTotalPrice3 := ValueByName('TotalPrice3');
+  FQuantity4 := ValueByName('Quantity4');
+  FTotalPrice4 := ValueByName('TotalPrice4');
+  FQuantity5 := ValueByName('Quantity5');
+  FTotalPrice5 := ValueByName('TotalPrice5');
+  FQuantity6 := ValueByName('Quantity6');
+  FTotalPrice6 := ValueByName('TotalPrice6');
+  FQuantity7 := ValueByName('Quantity7');
+  FTotalPrice7 := ValueByName('TotalPrice7');
+  FQuantity8 := ValueByName('Quantity8');
+  FTotalPrice8 := ValueByName('TotalPrice8');
+  FQuantity9 := ValueByName('Quantity9');
+  FTotalPrice9 := ValueByName('TotalPrice9');
+  FQuantity10 := ValueByName('Quantity10');
+  FTotalPrice10 := ValueByName('TotalPrice10');
+  FQuantity11 := ValueByName('Quantity11');
+  FTotalPrice11 := ValueByName('TotalPrice11');
+  FQuantity12 := ValueByName('Quantity12');
+  FTotalPrice12 := ValueByName('TotalPrice12');
+  FQuantity13 := ValueByName('Quantity13');
+  FTotalPrice13 := ValueByName('TotalPrice13');
+  FQuantity14 := ValueByName('Quantity14');
+  FTotalPrice14 := ValueByName('TotalPrice14');
+end;
+
 end.