فهرست منبع

恢复代码
【2016/8/10 16:21:14】提交的SHA-1: 14acd1101976c6d3ba566490c0ff8a93e20d263d,因高危操作导致代码混乱。
该代码基于Parent【2016/7/19 14:27:36】,提交代码时,未先Pull,便Commit至本地Git库
致使Git认为,以下第2部分代码应以【2016/8/10 16:21:14】最新记录为准,并替换之
即将第2部分代码自【2016/8/10 16:02:55】替换为【2016/7/19 14:27:36】,导致第2部分代码非正常回滚

现做如下处理:
1. 基于Sha-1:14acd1101976c6d3ba566490c0ff8a93e20d263d,保留
DataModules\PHPWebDm.pas
Forms\FileDownLoadFrm.dfm
Forms\FileDownLoadFrm.pas
Forms\LoginFrm.pas
Dprs\CSL\Measure_Cloud.cfg
Dprs\CSL\Measure_Cloud.dof
Dprs\CSL\Measure_Cloud.dpr
Dprs\CSL\Measure_Cloud.res

2. 基于Sha-1:7bc18746370cd34cadf5c104d3598acedb7951a0,恢复如下单元
DataModules\BGLDm.dfm
DataModules\BGLDm.pas
DataModules\DbTreeDm.dfm
DataModules\DbTreeDm.pas
DataModules\PhasePayDm.dfm
DataModules\PhasePayDm.pas
DataModules\ProjectGLDm.dfm
DataModules\ProjectGLDm.pas
DataModules\ProjectManagerDm.pas
DataModules\StandardBillsDm.dfm
DataModules\ZJJLDm.pas
Dprs\Pro\Measure.dof
Dprs\Pro\Measure.dpr
Dprs\Pro\Measure.res
Dprs\Pro\Measure_Cloud.dof
Dprs\Pro\Measure_Cloud.dpr
Dprs\Pro\Measure_Cloud.res
Dprs\Pro\Measure_GuangDong.dof
Dprs\Pro\Measure_GuangDong.dpr
Dprs\Pro\Measure_GuangDong.res
Dprs\Pro\Measure_GuangDong_Cloud.dof
Dprs\Pro\Measure_GuangDong_Cloud.dpr
Dprs\Pro\Measure_GuangDong_Cloud.res
Dprs\Pro\Measure_GuangDong_TZ.dof
Dprs\Pro\Measure_GuangDong_TZ.dpr
Dprs\Pro\Measure_GuangDong_TZ.res
Dprs\Pro\Measure_TZ.dof
Dprs\Pro\Measure_TZ.dpr
Dprs\Pro\Measure_TZ.res
Forms\MainFrm.dfm
Forms\MainFrm.pas
Forms\ProjectPropertiesFrm.dfm
Forms\ProjectPropertiesFrm.pas
Forms\ReportsFrm.dfm
Forms\ReportsFrm.pas
Frames\CheckerFme.pas
Frames\DealPaymentFme.dfm
Frames\DealPaymentFme.pas
Frames\ProjectGLFme.dfm
Frames\ZJJLFme.dfm
Frames\ZJJLFme.pas
Report\ReportConnection.pas
Units\BillsClipboard.pas
Units\CacheTree.pas
Units\Checker.pas
Units\ConditionalDefines.pas
Units\Connections.pas
Units\DataBaseTables.pas
Units\DbTreeImport.pas
Units\DebugUsers.pas
Units\ExcelImport.pas
Units\ProjectData.pas
Units\ProjectProperty.pas
Units\UpdateDataBase.pas
Units\mDataRecord.pas

MaiXinRong 9 سال پیش
والد
کامیت
9ac8cacba0
51فایلهای تغییر یافته به همراه1004 افزوده شده و 321 حذف شده
  1. 0 12
      DataModules/BGLDm.dfm
  2. 0 52
      DataModules/BGLDm.pas
  3. 12 9
      DataModules/PhasePayDm.dfm
  4. 23 18
      DataModules/PhasePayDm.pas
  5. 56 1
      DataModules/ProjectGLDm.dfm
  6. 63 6
      DataModules/ProjectGLDm.pas
  7. 7 3
      DataModules/ProjectManagerDm.pas
  8. 4 1
      DataModules/StandardBillsDm.dfm
  9. 30 12
      DataModules/ZJJLDm.pas
  10. 2 2
      Dprs/Pro/Measure.dof
  11. 3 1
      Dprs/Pro/Measure.dpr
  12. BIN
      Dprs/Pro/Measure.res
  13. 4 3
      Dprs/Pro/Measure_Cloud.dof
  14. 4 1
      Dprs/Pro/Measure_Cloud.dpr
  15. BIN
      Dprs/Pro/Measure_Cloud.res
  16. 2 2
      Dprs/Pro/Measure_GuangDong.dof
  17. 3 1
      Dprs/Pro/Measure_GuangDong.dpr
  18. BIN
      Dprs/Pro/Measure_GuangDong.res
  19. 2 2
      Dprs/Pro/Measure_GuangDong_Cloud.dof
  20. 4 1
      Dprs/Pro/Measure_GuangDong_Cloud.dpr
  21. BIN
      Dprs/Pro/Measure_GuangDong_Cloud.res
  22. 2 2
      Dprs/Pro/Measure_GuangDong_TZ.dof
  23. 3 1
      Dprs/Pro/Measure_GuangDong_TZ.dpr
  24. BIN
      Dprs/Pro/Measure_GuangDong_TZ.res
  25. 2 2
      Dprs/Pro/Measure_TZ.dof
  26. 3 1
      Dprs/Pro/Measure_TZ.dpr
  27. BIN
      Dprs/Pro/Measure_TZ.res
  28. 20 0
      Forms/MainFrm.dfm
  29. 12 0
      Forms/MainFrm.pas
  30. 57 9
      Forms/ProjectPropertiesFrm.dfm
  31. 18 0
      Forms/ProjectPropertiesFrm.pas
  32. 21 10
      Forms/ReportsFrm.dfm
  33. 76 71
      Forms/ReportsFrm.pas
  34. 4 2
      Frames/CheckerFme.pas
  35. 10 0
      Frames/DealPaymentFme.dfm
  36. 53 2
      Frames/DealPaymentFme.pas
  37. 109 1
      Frames/ProjectGLFme.dfm
  38. 8 8
      Frames/ZJJLFme.dfm
  39. 1 1
      Frames/ZJJLFme.pas
  40. 1 0
      Report/ReportConnection.pas
  41. 1 0
      Units/BillsClipboard.pas
  42. 1 1
      Units/CacheTree.pas
  43. 2 0
      Units/Checker.pas
  44. 7 0
      Units/ConditionalDefines.pas
  45. 98 9
      Units/Connections.pas
  46. 131 8
      Units/DataBaseTables.pas
  47. 5 3
      Units/ExcelImport.pas
  48. 75 63
      Units/ProjectData.pas
  49. 22 0
      Units/ProjectProperty.pas
  50. 7 0
      Units/UpdateDataBase.pas
  51. 36 0
      Units/mDataRecord.pas

+ 0 - 12
DataModules/BGLDm.dfm

@@ -47,9 +47,6 @@ object BGLData: TBGLData
       FieldName = 'DrawingCode'
       FieldName = 'DrawingCode'
       Size = 50
       Size = 50
     end
     end
-    object cdsBGLLocked: TBooleanField
-      FieldName = 'Locked'
-    end
     object cdsBGLApprovalCode: TWideStringField
     object cdsBGLApprovalCode: TWideStringField
       FieldName = 'ApprovalCode'
       FieldName = 'ApprovalCode'
       Size = 50
       Size = 50
@@ -96,9 +93,6 @@ object BGLData: TBGLData
       FieldName = 'Direction'
       FieldName = 'Direction'
       BlobType = ftMemo
       BlobType = ftMemo
     end
     end
-    object cdsBGLViewLocked: TBooleanField
-      FieldName = 'Locked'
-    end
     object cdsBGLViewDrawingCode: TWideStringField
     object cdsBGLViewDrawingCode: TWideStringField
       FieldName = 'DrawingCode'
       FieldName = 'DrawingCode'
       Size = 50
       Size = 50
@@ -169,9 +163,6 @@ object BGLData: TBGLData
     object cdsBGBillsUsedQuantity: TFloatField
     object cdsBGBillsUsedQuantity: TFloatField
       FieldName = 'UsedQuantity'
       FieldName = 'UsedQuantity'
     end
     end
-    object cdsBGBillsLocked: TBooleanField
-      FieldName = 'Locked'
-    end
   end
   end
   object cdsBGBillsView: TClientDataSet
   object cdsBGBillsView: TClientDataSet
     Aggregates = <>
     Aggregates = <>
@@ -219,8 +210,5 @@ object BGLData: TBGLData
     object cdsBGBillsViewUsedQuantity: TFloatField
     object cdsBGBillsViewUsedQuantity: TFloatField
       FieldName = 'UsedQuantity'
       FieldName = 'UsedQuantity'
     end
     end
-    object cdsBGBillsViewLocked: TBooleanField
-      FieldName = 'Locked'
-    end
   end
   end
 end
 end

+ 0 - 52
DataModules/BGLDm.pas

@@ -53,7 +53,6 @@ type
     cdsBGLPos_Reason: TMemoField;
     cdsBGLPos_Reason: TMemoField;
     cdsBGLDirection: TMemoField;
     cdsBGLDirection: TMemoField;
     cdsBGLDrawingCode: TWideStringField;
     cdsBGLDrawingCode: TWideStringField;
-    cdsBGLLocked: TBooleanField;
     cdsBGLApprovalCode: TWideStringField;
     cdsBGLApprovalCode: TWideStringField;
     cdsBGLCreatePhaseID: TIntegerField;
     cdsBGLCreatePhaseID: TIntegerField;
     cdsBGLExecutionRate: TFloatField;
     cdsBGLExecutionRate: TFloatField;
@@ -66,7 +65,6 @@ type
     cdsBGLViewPos_Reason: TMemoField;
     cdsBGLViewPos_Reason: TMemoField;
     cdsBGLViewDirection: TMemoField;
     cdsBGLViewDirection: TMemoField;
     cdsBGLViewDrawingCode: TWideStringField;
     cdsBGLViewDrawingCode: TWideStringField;
-    cdsBGLViewLocked: TBooleanField;
     cdsBGLViewApprovalCode: TWideStringField;
     cdsBGLViewApprovalCode: TWideStringField;
     cdsBGLViewCreatePhaseID: TIntegerField;
     cdsBGLViewCreatePhaseID: TIntegerField;
     cdsBGLViewExecutionRate: TFloatField;
     cdsBGLViewExecutionRate: TFloatField;
@@ -85,7 +83,6 @@ type
     cdsBGBillsQuantity: TFloatField;
     cdsBGBillsQuantity: TFloatField;
     cdsBGBillsTotalPrice: TFloatField;
     cdsBGBillsTotalPrice: TFloatField;
     cdsBGBillsUsedQuantity: TFloatField;
     cdsBGBillsUsedQuantity: TFloatField;
-    cdsBGBillsLocked: TBooleanField;
     
     
     cdsBGBillsView: TClientDataSet;
     cdsBGBillsView: TClientDataSet;
     cdsBGBillsViewID: TIntegerField;
     cdsBGBillsViewID: TIntegerField;
@@ -97,7 +94,6 @@ type
     cdsBGBillsViewQuantity: TFloatField;
     cdsBGBillsViewQuantity: TFloatField;
     cdsBGBillsViewTotalPrice: TFloatField;
     cdsBGBillsViewTotalPrice: TFloatField;
     cdsBGBillsViewUsedQuantity: TFloatField;
     cdsBGBillsViewUsedQuantity: TFloatField;
-    cdsBGBillsViewLocked: TBooleanField;
     cdsBGLBGLType: TWideStringField;
     cdsBGLBGLType: TWideStringField;
     cdsBGLViewBGLType: TWideStringField;
     cdsBGLViewBGLType: TWideStringField;
     procedure cdsBGBillsViewAfterInsert(DataSet: TDataSet);
     procedure cdsBGBillsViewAfterInsert(DataSet: TDataSet);
@@ -130,9 +126,6 @@ type
 
 
     function LocateBGL(const ACode: string): Boolean;
     function LocateBGL(const ACode: string): Boolean;
     function LocateBGBills(ABGID: Integer; const AB_Code: string): Boolean;
     function LocateBGBills(ABGID: Integer; const AB_Code: string): Boolean;
-
-    procedure LockAllBGL;
-    procedure LockAllBGBills;
   public
   public
     constructor Create(AProjectData: TObject);
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
     destructor Destroy; override;
@@ -148,8 +141,6 @@ type
 
 
     procedure BatchWritePos_Reason;
     procedure BatchWritePos_Reason;
 
 
-    procedure LockAll;
-
     property ProjectData: TObject read FProjectData;
     property ProjectData: TObject read FProjectData;
   end;
   end;
 
 
@@ -412,16 +403,12 @@ begin
       (cdsBGBillsViewUnits.Tag = 1) or
       (cdsBGBillsViewUnits.Tag = 1) or
       (cdsBGBillsViewPrice.Tag = 1) then
       (cdsBGBillsViewPrice.Tag = 1) then
   begin
   begin
-    if cdsBGBillsViewLocked.AsBoolean then
-      DisplayErrorMessage('变更清单已被锁定,不可修改!');
     if cdsBGBillsViewUsedQuantity.AsFloat <> 0 then
     if cdsBGBillsViewUsedQuantity.AsFloat <> 0 then
       DisplayErrorMessage('变更令已被应用至清单,不可修改!');
       DisplayErrorMessage('变更令已被应用至清单,不可修改!');
   end;
   end;
 
 
   if (cdsBGBillsViewQuantity.Tag = 1) then
   if (cdsBGBillsViewQuantity.Tag = 1) then
   begin
   begin
-    if cdsBGBillsViewLocked.AsBoolean then
-      DisplayErrorMessage('变更清单已被锁定,不可修改!');
     if (cdsBGBillsViewUsedQuantity.AsFloat <> 0) and
     if (cdsBGBillsViewUsedQuantity.AsFloat <> 0) and
        (cdsBGBillsViewQuantity.AsFloat < cdsBGBillsViewUsedQuantity.AsFloat) then
        (cdsBGBillsViewQuantity.AsFloat < cdsBGBillsViewUsedQuantity.AsFloat) then
       DisplayErrorMessage('变更清单的清单数量应大于已变更数量!');
       DisplayErrorMessage('变更清单的清单数量应大于已变更数量!');
@@ -451,11 +438,6 @@ begin
   begin
   begin
     cdsBGLViewCode.Tag := 0;
     cdsBGLViewCode.Tag := 0;
 
 
-    if cdsBGLViewLocked.AsBoolean then
-    begin
-      ErrorMessage('当前变更令已锁定,不可修改!');
-      Abort;
-    end;
     if CheckBGLUsed(cdsBGLViewID.AsInteger) then
     if CheckBGLUsed(cdsBGLViewID.AsInteger) then
     begin
     begin
       ErrorMessage('当前变更令下变更清单已被应用到清单,不可修改!');
       ErrorMessage('当前变更令下变更清单已被应用到清单,不可修改!');
@@ -499,8 +481,6 @@ end;
 
 
 procedure TBGLData.cdsBGLViewBeforeDelete(DataSet: TDataSet);
 procedure TBGLData.cdsBGLViewBeforeDelete(DataSet: TDataSet);
 begin
 begin
-  if cdsBGLViewLocked.AsBoolean then
-    raise Exception.Create('变更令已被锁定,不可删除!');
   if CheckBGLUsed(cdsBGLViewID.AsInteger) then
   if CheckBGLUsed(cdsBGLViewID.AsInteger) then
     raise Exception.Create('变更令下变更清单已被应用到清单,不可删除!');
     raise Exception.Create('变更令下变更清单已被应用到清单,不可删除!');
   DeleteBGBills(cdsBGLViewID.AsInteger);
   DeleteBGBills(cdsBGLViewID.AsInteger);
@@ -526,8 +506,6 @@ end;
 
 
 procedure TBGLData.cdsBGBillsViewBeforeDelete(DataSet: TDataSet);
 procedure TBGLData.cdsBGBillsViewBeforeDelete(DataSet: TDataSet);
 begin
 begin
-  if cdsBGBillsViewLocked.AsBoolean then
-    raise Exception.Create('变更清单已被锁定,不可删除!');
   if cdsBGBillsViewUsedQuantity.AsFloat <> 0 then
   if cdsBGBillsViewUsedQuantity.AsFloat <> 0 then
     raise Exception.Create('变更清单已被应用至清单,不可删除!');
     raise Exception.Create('变更清单已被应用至清单,不可删除!');
 end;
 end;
@@ -549,36 +527,6 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TBGLData.LockAll;
-begin
-  LockAllBGL;
-  LockAllBGBills;
-end;
-
-procedure TBGLData.LockAllBGBills;
-begin
-  cdsBGBills.First;
-  while not cdsBGBills.Eof do
-  begin
-    cdsBGBills.Edit;
-    cdsBGBillsLocked.AsBoolean := True;
-    cdsBGBills.Post;
-    cdsBGBills.Next;
-  end;
-end;
-
-procedure TBGLData.LockAllBGL;
-begin
-  cdsBGL.First;
-  while not cdsBGL.Eof do
-  begin
-    cdsBGL.Edit;
-    cdsBGLLocked.AsBoolean := True;
-    cdsBGL.Post;
-    cdsBGL.Next;
-  end;
-end;
-
 procedure TBGLData.cdsBGBillsViewAfterDelete(DataSet: TDataSet);
 procedure TBGLData.cdsBGBillsViewAfterDelete(DataSet: TDataSet);
 begin
 begin
   GatherBGLTotalPrice(cdsBGLViewID.AsInteger);
   GatherBGLTotalPrice(cdsBGLViewID.AsInteger);

+ 12 - 9
DataModules/PhasePayDm.dfm

@@ -173,11 +173,11 @@ object PhasePayData: TPhasePayData
       636573734E616D65090001044E616D650609466F726D756C613133094669656C
       636573734E616D65090001044E616D650609466F726D756C613133094669656C
       644E616D650609466F726D756C61313308446174615479706502180844617461
       644E616D650609466F726D756C61313308446174615479706502180844617461
       53697A6503FF000549734B6579080F4E65656450726F636573734E616D650900
       53697A6503FF000549734B6579080F4E65656450726F636573734E616D650900
-      01044E616D65060F456E64546F74616C50726963653133094669656C644E616D
-      65060F456E64546F74616C507269636531330844617461547970650206084461
+      01044E616D65060F507265546F74616C50726963653133094669656C644E616D
+      65060F507265546F74616C507269636531330844617461547970650206084461
       746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
       746153697A6502080549734B6579080F4E65656450726F636573734E616D6509
-      0001044E616D65060F456E64546F74616C50726963653134094669656C644E61
-      6D65060F456E64546F74616C5072696365313408446174615479706502060844
+      0001044E616D65060F456E64546F74616C50726963653133094669656C644E61
+      6D65060F456E64546F74616C5072696365313308446174615479706502060844
       61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
       61746153697A6502080549734B6579080F4E65656450726F636573734E616D65
       090001044E616D65060C546F74616C50726963653134094669656C644E616D65
       090001044E616D65060C546F74616C50726963653134094669656C644E616D65
       060C546F74616C50726963653134084461746154797065020608446174615369
       060C546F74616C50726963653134084461746154797065020608446174615369
@@ -185,11 +185,14 @@ object PhasePayData: TPhasePayData
       616D650609466F726D756C613134094669656C644E616D650609466F726D756C
       616D650609466F726D756C613134094669656C644E616D650609466F726D756C
       6131340844617461547970650218084461746153697A6503FF000549734B6579
       6131340844617461547970650218084461746153697A6503FF000549734B6579
       080F4E65656450726F636573734E616D65090001044E616D65060F507265546F
       080F4E65656450726F636573734E616D65090001044E616D65060F507265546F
-      74616C50726963653133094669656C644E616D65060F507265546F74616C5072
-      69636531330844617461547970650206084461746153697A6502080549734B65
-      79080F4E65656450726F636573734E616D65090001044E616D65060F50726554
-      6F74616C50726963653134094669656C644E616D65060F507265546F74616C50
+      74616C50726963653134094669656C644E616D65060F507265546F74616C5072
+      69636531340844617461547970650206084461746153697A6502080549734B65
+      79080F4E65656450726F636573734E616D65090001044E616D65060F456E6454
+      6F74616C50726963653134094669656C644E616D65060F456E64546F74616C50
       7269636531340844617461547970650206084461746153697A6502080549734B
       7269636531340844617461547970650206084461746153697A6502080549734B
-      6579080F4E65656450726F636573734E616D65090000}
+      6579080F4E65656450726F636573734E616D65090001044E616D65060853746F
+      7043616C63094669656C644E616D65060853746F7043616C6308446174615479
+      70650205084461746153697A6502010549734B6579080F4E65656450726F6365
+      73734E616D65090000}
   end
   end
 end
 end

+ 23 - 18
DataModules/PhasePayDm.pas

@@ -187,28 +187,33 @@ begin
   sFField := 'Formula' + IntToStr(TPhaseData(FPhaseData).StageIndex);
   sFField := 'Formula' + IntToStr(TPhaseData(FPhaseData).StageIndex);
   sPreField := 'PreTotalPrice' + IntToStr(TPhaseData(FPhaseData).StageIndex);
   sPreField := 'PreTotalPrice' + IntToStr(TPhaseData(FPhaseData).StageIndex);
 
 
-  iID := Rec.ValueByName('ID').AsInteger;
-  with TProjectData(TPhaseData(FPhaseData).ProjectData).DealPaymentData do
+  if not Rec.ValueByName('StopCalc').AsBoolean then
   begin
   begin
-    // 获取起扣金额
-    fStartedPrice :=  GetStartedPrice(iID);
-
-    if Rec.ValueByName(sFField).AsString <> '' then
+    iID := Rec.ValueByName('ID').AsInteger;
+    with TProjectData(TPhaseData(FPhaseData).ProjectData).DealPaymentData do
     begin
     begin
-      // 初次达到起扣金额时,bqwc基数值取值为累计完成计量-起扣金额
-      if Rec.ValueByName('Pre'+sTPField).AsFloat = 0 then
-        fTotalPrice := FPayFormula.Calculate(Rec.ValueByName(sFField).AsString, fStartedPrice)
+      // 获取起扣金额
+      fStartedPrice :=  GetStartedPrice(iID);
+
+      if Rec.ValueByName(sFField).AsString <> '' then
+      begin
+        // 初次达到起扣金额时,bqwc基数值取值为累计完成计量-起扣金额
+        if Rec.ValueByName('Pre'+sTPField).AsFloat = 0 then
+          fTotalPrice := FPayFormula.Calculate(Rec.ValueByName(sFField).AsString, fStartedPrice)
+        else
+          fTotalPrice := FPayFormula.Calculate(Rec.ValueByName(sFField).AsString);
+      end
       else
       else
-        fTotalPrice := FPayFormula.Calculate(Rec.ValueByName(sFField).AsString);
-    end
-    else
-      fTotalPrice := 0;
+        fTotalPrice := 0;
 
 
-    if CheckStartedPrice(iID) then
-      Rec.ValueByName(sTPField).AsFloat := GetAllowTotalPrice(iID, fTotalPrice, Rec.ValueByName(sPreField).AsFloat)
-    else
-      Rec.ValueByName(sTPField).AsFloat := 0;
-  end;
+      if CheckStartedPrice(iID) then
+        Rec.ValueByName(sTPField).AsFloat := GetAllowTotalPrice(iID, fTotalPrice, Rec.ValueByName(sPreField).AsFloat)
+      else
+        Rec.ValueByName(sTPField).AsFloat := 0;
+    end;
+  end
+  else
+    Rec.ValueByName(sTPField).AsFloat := 0;
 
 
   {if Rec.ValueByName(sFField).AsString <> '' then
   {if Rec.ValueByName(sFField).AsString <> '' then
   begin
   begin

+ 56 - 1
DataModules/ProjectGLDm.dfm

@@ -58,7 +58,44 @@ object ProjectGLData: TProjectGLData
       734B6579080F4E65656450726F636573734E616D65090001044E616D65060D50
       734B6579080F4E65656450726F636573734E616D65090001044E616D65060D50
       4D5F546F74616C5072696365094669656C644E616D65060D504D5F546F74616C
       4D5F546F74616C5072696365094669656C644E616D65060D504D5F546F74616C
       50726963650844617461547970650206084461746153697A6502080549734B65
       50726963650844617461547970650206084461746153697A6502080549734B65
-      79080F4E65656450726F636573734E616D65090000}
+      79080F4E65656450726F636573734E616D65090001044E616D65060C55736564
+      5175616E74697479094669656C644E616D65060C557365645175616E74697479
+      0844617461547970650206084461746153697A6502080549734B6579080F4E65
+      656450726F636573734E616D65090001044E616D65060E55736564546F74616C
+      5072696365094669656C644E616D65060E55736564546F74616C507269636508
+      44617461547970650206084461746153697A6502080549734B6579080F4E6565
+      6450726F636573734E616D65090001044E616D65061050414C5F557365645175
+      616E74697479094669656C644E616D65061050414C5F557365645175616E7469
+      74790844617461547970650206084461746153697A6502080549734B6579080F
+      4E65656450726F636573734E616D65090001044E616D65061250414C5F557365
+      64546F74616C5072696365094669656C644E616D65061250414C5F5573656454
+      6F74616C50726963650844617461547970650206084461746153697A65020805
+      49734B6579080F4E65656450726F636573734E616D65090001044E616D65060E
+      50414C5F44656C74615072696365094669656C644E616D65060E50414C5F4465
+      6C746150726963650844617461547970650206084461746153697A6502080549
+      734B6579080F4E65656450726F636573734E616D65090001044E616D65060950
+      414C5F546F74616C094669656C644E616D65060950414C5F546F74616C084461
+      7461547970650206084461746153697A6502080549734B6579080F4E65656450
+      726F636573734E616D65090001044E616D65060F507265557365645175616E74
+      697479094669656C644E616D65060F507265557365645175616E746974790844
+      617461547970650206084461746153697A6502080549734B6579080F4E656564
+      50726F636573734E616D65090001044E616D65061150726555736564546F7461
+      6C5072696365094669656C644E616D65061150726555736564546F74616C5072
+      6963650844617461547970650206084461746153697A6502080549734B657908
+      0F4E65656450726F636573734E616D65090001044E616D65061350726550414C
+      5F557365645175616E74697479094669656C644E616D65061350726550414C5F
+      557365645175616E746974790844617461547970650206084461746153697A65
+      02080549734B6579080F4E65656450726F636573734E616D65090001044E616D
+      65061550726550414C5F55736564546F74616C5072696365094669656C644E61
+      6D65061550726550414C5F55736564546F74616C507269636508446174615479
+      70650206084461746153697A6502080549734B6579080F4E65656450726F6365
+      73734E616D65090001044E616D65061150726550414C5F44656C746150726963
+      65094669656C644E616D65061150726550414C5F44656C746150726963650844
+      617461547970650206084461746153697A6502080549734B6579080F4E656564
+      50726F636573734E616D65090001044E616D65060C50726550414C5F546F7461
+      6C094669656C644E616D65060C50726550414C5F546F74616C08446174615479
+      70650206084461746153697A6502080549734B6579080F4E65656450726F6365
+      73734E616D65090000}
   end
   end
   object sdvProjectGL: TsdDataView
   object sdvProjectGL: TsdDataView
     Active = False
     Active = False
@@ -107,6 +144,24 @@ object ProjectGLData: TProjectGLData
       item
       item
         FieldName = 'PM_TotalPrice'
         FieldName = 'PM_TotalPrice'
         DisplayFormat = '0.##'
         DisplayFormat = '0.##'
+      end
+      item
+        FieldName = 'UsedQuantity'
+      end
+      item
+        FieldName = 'UsedTotalPrice'
+      end
+      item
+        FieldName = 'PAL_UsedQuantity'
+      end
+      item
+        FieldName = 'PAL_UsedTotalPrice'
+      end
+      item
+        FieldName = 'PAL_DeltaPrice'
+      end
+      item
+        FieldName = 'PAL_Total'
       end>
       end>
     OnGetText = sdvProjectGLGetText
     OnGetText = sdvProjectGLGetText
     OnSetText = sdvProjectGLSetText
     OnSetText = sdvProjectGLSetText

+ 63 - 6
DataModules/ProjectGLDm.pas

@@ -37,6 +37,9 @@ type
 
 
     procedure CalculateRelaBills(ARec: TProjectGLRecord);
     procedure CalculateRelaBills(ARec: TProjectGLRecord);
 
 
+    procedure CalculatePALRela(ARec: TProjectGLRecord);
+    procedure CalculatePALRelas;
+
     procedure ExecuteSql(const ASql: string);
     procedure ExecuteSql(const ASql: string);
     procedure SaveGLPrice;
     procedure SaveGLPrice;
     procedure SavePM_CurData;
     procedure SavePM_CurData;
@@ -122,6 +125,9 @@ var
         Rec.InfoDate.AsString := vQuery.FieldByName('InfoDate').AsString;
         Rec.InfoDate.AsString := vQuery.FieldByName('InfoDate').AsString;
         Rec.DeltaPrice.AsFloat := vQuery.FieldByName('DeltaPrice').AsFloat;
         Rec.DeltaPrice.AsFloat := vQuery.FieldByName('DeltaPrice').AsFloat;
         Rec.ValidDeltaPrice.AsFloat := vQuery.FieldByName('ValidDeltaPrice').AsFloat;
         Rec.ValidDeltaPrice.AsFloat := vQuery.FieldByName('ValidDeltaPrice').AsFloat;
+
+        Rec.UsedQuantity.AsFloat := vQuery.FieldByName('UsedQuantity').AsFloat;
+        Rec.UsedTotalPrice.AsFloat := vQuery.FieldByName('UsedTotalPrice').AsFloat;
       end
       end
       else
       else
       begin
       begin
@@ -129,6 +135,9 @@ var
         Rec.InfoDate.AsString := '';
         Rec.InfoDate.AsString := '';
         Rec.DeltaPrice.AsFloat := 0;
         Rec.DeltaPrice.AsFloat := 0;
         Rec.ValidDeltaPrice.AsFloat := 0;
         Rec.ValidDeltaPrice.AsFloat := 0;
+
+        Rec.UsedQuantity.AsFloat := 0;
+        Rec.UsedTotalPrice.AsFloat := 0;
       end;
       end;
     end;
     end;
   end;
   end;
@@ -176,10 +185,12 @@ procedure TProjectGLData.SaveGLPrice;
 const
 const
   sDeleteSql = 'Delete From GLPrice Where PhaseID = %d';
   sDeleteSql = 'Delete From GLPrice Where PhaseID = %d';
   sInsertSql = 'Insert Into GLPrice'+
   sInsertSql = 'Insert Into GLPrice'+
-               '  Select ID As GLID, %d As PhaseID, InfoPrice, InfoDate, DeltaPrice, ValidDeltaPrice' +
+               '  Select ID As GLID, %d As PhaseID, InfoPrice, InfoDate, DeltaPrice, ValidDeltaPrice, UsedQuantity, UsedTotalPrice' +
                '  From ProjectGL';
                '  From ProjectGL';
   sUpdateSql = 'Update GLPrice As G, ProjectGL As P'+
   sUpdateSql = 'Update GLPrice As G, ProjectGL As P'+
-               '    Set G.PM_PreQuantity = P.PM_PreQuantity, G.PM_PreTotalPrice = P.PM_PreTotalPrice'+
+               '    Set G.PM_PreQuantity = P.PM_PreQuantity, G.PM_PreTotalPrice = P.PM_PreTotalPrice,'+
+               '        G.PrePAL_UsedQuantity = P.PrePAL_UsedQuantity, G.PrePAL_UsedTotalPrice = P.PrePAL_UsedTotalPrice,' +
+               '        G.PrePAL_DeltaPrice = P.PrePAL_DeltaPrice, G.PrePAL_Total = P.PrePAL_Total'+
                '  Where (G.PhaseID = %d) and (G.GLID = P.ID)';
                '  Where (G.PhaseID = %d) and (G.GLID = P.ID)';
 var
 var
   iPhaseID: Integer;
   iPhaseID: Integer;
@@ -212,9 +223,14 @@ begin
     CalculateDeltaPrice(TProjectGLRecord(AValue.Owner));
     CalculateDeltaPrice(TProjectGLRecord(AValue.Owner));
     CalculatePM_Quantity(TProjectGLRecord(AValue.Owner));
     CalculatePM_Quantity(TProjectGLRecord(AValue.Owner));
     CalculatePM_TotalPrice(TProjectGLRecord(AValue.Owner));
     CalculatePM_TotalPrice(TProjectGLRecord(AValue.Owner));
+    CalculatePALRela(TProjectGLRecord(AValue.Owner));
     CalculateRelaBills(TProjectGLRecord(AValue.Owner));
     CalculateRelaBills(TProjectGLRecord(AValue.Owner));
     TProjectData(FProjectData).PriceMarginBillsData.RefreshAllDetailBills;
     TProjectData(FProjectData).PriceMarginBillsData.RefreshAllDetailBills;
   end;
   end;
+  if SameText(AValue.FieldName, 'UsedQuantity') then
+  begin
+    CalculatePALRela(TProjectGLRecord(AValue.Owner));
+  end;
 end;
 end;
 
 
 procedure TProjectGLData.CalculateDeltaPrice(ARec: TProjectGLRecord);
 procedure TProjectGLData.CalculateDeltaPrice(ARec: TProjectGLRecord);
@@ -380,7 +396,11 @@ procedure TProjectGLData.SavePM_CurData;
 const
 const
   sUpdateSql = 'Update GLPrice As G, ProjectGL As P'+
   sUpdateSql = 'Update GLPrice As G, ProjectGL As P'+
                '  Set G.PM_Quantity%d = P.PM_Quantity, G.PM_TotalPrice%d = P.PM_TotalPrice,'+
                '  Set G.PM_Quantity%d = P.PM_Quantity, G.PM_TotalPrice%d = P.PM_TotalPrice,'+
-               '    G.PM_Quantity_F = P.PM_Quantity, G.PM_TotalPrice_F = P.PM_TotalPrice'+
+               '    G.PAL_UsedQuantity%d = P.PAL_UsedQuantity, G.PAL_UsedTotalPrice%d = P.PAL_UsedTotalPrice,'+
+               '    G.PAL_DeltaPrice%d = P.PAL_DeltaPrice, G.PAL_Total%d = P.PAL_Total,'+
+               '    G.PM_Quantity_F = P.PM_Quantity, G.PM_TotalPrice_F = P.PM_TotalPrice,'+
+               '    G.PAL_UsedQuantity_F = P.PAL_UsedQuantity, G.PAL_UsedTotalPrice_F = P.PAL_UsedTotalPrice,'+
+               '    G.PAL_DeltaPrice_F = P.PAL_DeltaPrice, G.PAL_Total_F = P.PAL_Total'+
                '  Where (G.PhaseID = %d) and (G.GLID = P.ID)';
                '  Where (G.PhaseID = %d) and (G.GLID = P.ID)';
 var
 var
   iStageIndex: Integer;
   iStageIndex: Integer;
@@ -389,7 +409,7 @@ var
 begin
 begin
   iStageIndex := TProjectData(FProjectData).PhaseData.StageIndex;
   iStageIndex := TProjectData(FProjectData).PhaseData.StageIndex;
   iPhaseCount := TProjectData(FProjectData).ProjProperties.PhaseCount;
   iPhaseCount := TProjectData(FProjectData).ProjProperties.PhaseCount;
-  sSql := Format(sUpdateSql, [iStageIndex, iStageIndex, iPhaseCount]);
+  sSql := Format(sUpdateSql, [iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iPhaseCount]);
   ExecuteSql(sSql);
   ExecuteSql(sSql);
 end;
 end;
 
 
@@ -498,8 +518,12 @@ end;
 procedure TProjectGLData.LoadStagePM_CalcData;
 procedure TProjectGLData.LoadStagePM_CalcData;
 const
 const
   sSelectSql = 'Select GLID, PhaseID, PM_PreQuantity, PM_PreTotalPrice,'+
   sSelectSql = 'Select GLID, PhaseID, PM_PreQuantity, PM_PreTotalPrice,'+
-               '    PM_Quantity%d As PM_Quantity, PM_TotalPrice%d As PM_TotalPrice'+
+               '    PrePAL_UsedQuantity, PrePAL_UsedTotalPrice, PrePAL_DeltaPrice, PrePAL_Total,' +
+               '    PM_Quantity%d As PM_Quantity, PM_TotalPrice%d As PM_TotalPrice,'+
+               '    PAL_UsedQuantity%d As PAL_UsedQuantity, PAL_UsedTotalPrice%d As PAL_UsedTotalPrice,' +
+               '    PAL_DeltaPrice%d As PAL_DeltaPrice, PAL_Total%d As PAL_Total' +
                '  From GLPrice Where PhaseID = %d';
                '  From GLPrice Where PhaseID = %d';
+
 var
 var
   sSql: string;
   sSql: string;
   vQuery: TADOQuery;
   vQuery: TADOQuery;
@@ -516,11 +540,21 @@ var
       begin
       begin
         Rec.PM_Quantity.AsFloat := vQuery.FieldByName('PM_Quantity').AsFloat;
         Rec.PM_Quantity.AsFloat := vQuery.FieldByName('PM_Quantity').AsFloat;
         Rec.PM_TotalPrice.AsFloat := vQuery.FieldByName('PM_TotalPrice').AsFloat;
         Rec.PM_TotalPrice.AsFloat := vQuery.FieldByName('PM_TotalPrice').AsFloat;
+
+        Rec.PAL_UsedQuantity.AsFloat := vQuery.FieldByName('PAL_UsedQuantity').AsFloat;
+        Rec.PAL_UsedTotalPrice.AsFloat := vQuery.FieldByName('PAL_UsedTotalPrice').AsFloat;
+        Rec.PAL_DeltaPrice.AsFloat := vQuery.FieldByName('PAL_DeltaPrice').AsFloat;
+        Rec.PAL_Total.AsFloat := vQuery.FieldByName('PAL_Total').AsFloat;
       end
       end
       else
       else
       begin
       begin
         Rec.PM_Quantity.AsFloat := 0;
         Rec.PM_Quantity.AsFloat := 0;
         Rec.PM_TotalPrice.AsFloat := 0;
         Rec.PM_TotalPrice.AsFloat := 0;
+
+        Rec.PAL_UsedQuantity.AsFloat := 0;
+        Rec.PAL_UsedTotalPrice.AsFloat := 0;
+        Rec.PAL_DeltaPrice.AsFloat := 0;
+        Rec.PAL_Total.AsFloat := 0;
       end;
       end;
     end;
     end;
   end;
   end;
@@ -531,7 +565,7 @@ begin
   try
   try
     vQuery.Connection := sdpProjectGL.Connection;
     vQuery.Connection := sdpProjectGL.Connection;
     with TProjectData(FProjectData) do
     with TProjectData(FProjectData) do
-      sSql := Format(sSelectSql, [StageIndex, StageIndex, PhaseIndex]);
+      sSql := Format(sSelectSql, [StageIndex, StageIndex, StageIndex, StageIndex, StageIndex, StageIndex, PhaseIndex]);
     vQuery.SQL.Clear;
     vQuery.SQL.Clear;
     vQuery.SQL.Add(sSql);
     vQuery.SQL.Add(sSql);
     vQuery.Open;
     vQuery.Open;
@@ -575,4 +609,27 @@ begin
   Result := TProjectData(FProjectData).ProjProperties.DecimalManager.PriceMargin;
   Result := TProjectData(FProjectData).ProjProperties.DecimalManager.PriceMargin;
 end;
 end;
 
 
+procedure TProjectGLData.CalculatePALRela(ARec: TProjectGLRecord);
+begin
+  ARec.UsedTotalPrice.AsFloat := Decimal.TotalPrice.RoundTo(ARec.UsedQuantity.AsFloat * ARec.InfoPrice.AsFloat);
+  ARec.PAL_UsedQuantity.AsFloat := Decimal.Quantity.RoundTo(ARec.PM_Quantity.AsFloat - ARec.UsedQuantity.AsFloat);
+  ARec.PAL_UsedTotalPrice.AsFloat := Decimal.TotalPrice.RoundTo(ARec.PAL_UsedQuantity.AsFloat * ARec.BasePrice.AsFloat);
+  ARec.PAL_DeltaPrice.AsFloat := Decimal.TotalPrice.RoundTo(ARec.UsedQuantity.AsFloat * ARec.ValidDeltaPrice.AsFloat);
+  ARec.PAL_Total.AsFloat := Decimal.TotalPrice.RoundTo(ARec.BasePrice.AsFloat*ARec.PM_Quantity.AsFloat - ARec.InfoPrice.AsFloat*ARec.UsedQuantity.AsFloat);
+end;
+
+procedure TProjectGLData.CalculatePALRelas;
+var
+  iRec: Integer;
+  Rec: TProjectGLRecord;
+begin
+  if TProjectData(FProjectData).PhaseData.StageDataReadOnly then Exit;
+
+  for iRec := 0 to sddProjectGL.RecordCount - 1 do
+  begin
+    Rec := TProjectGLRecord(sddProjectGL.Records[iRec]);
+    CalculatePALRela(Rec);
+  end;
+end;
+
 end.
 end.

+ 7 - 3
DataModules/ProjectManagerDm.pas

@@ -25,7 +25,7 @@ type
     procedure sdvProjectsInfoBeforeDeleteRecord(ARecord: TsdDataRecord;
     procedure sdvProjectsInfoBeforeDeleteRecord(ARecord: TsdDataRecord;
       var Allow: Boolean);
       var Allow: Boolean);
   private
   private
-    FConnection: TEncryptConnection;
+    FConnection: TCommonConnection;
     FProjectsTree: TsdIDTree;
     FProjectsTree: TsdIDTree;
     FBackupManager: TBackupManager;
     FBackupManager: TBackupManager;
 
 
@@ -79,7 +79,7 @@ uses
 constructor TProjectManagerData.Create;
 constructor TProjectManagerData.Create;
 begin
 begin
   inherited Create(nil);
   inherited Create(nil);
-  FConnection := TEncryptConnection.Create;
+  FConnection := TCommonConnection.Create;
   FProjectsTree := TsdIDTree.Create;
   FProjectsTree := TsdIDTree.Create;
   FProjectsTree.KeyFieldName := 'ID';
   FProjectsTree.KeyFieldName := 'ID';
   FProjectsTree.ParentFieldName := 'ParentID';
   FProjectsTree.ParentFieldName := 'ParentID';
@@ -276,9 +276,13 @@ end;
 
 
 procedure TProjectManagerData.Open;
 procedure TProjectManagerData.Open;
 var
 var
+  sFileName: string;
   FQuery: TADOQuery;
   FQuery: TADOQuery;
 begin
 begin
-  FConnection.Open(GetAppFilePath + 'Data\ProjectManager.dat');
+  sFileName := GetAppFilePath + 'Data\ProjectManager.dat';
+  if FileEncrypted(sFileName) then
+    SimpleDecrypt(sFileName, sFileName);
+  FConnection.Open(sFileName);
 
 
   UpdateManagerDataBase;
   UpdateManagerDataBase;
   sdpProjectsInfo.Connection := FConnection.Connection;
   sdpProjectsInfo.Connection := FConnection.Connection;

+ 4 - 1
DataModules/StandardBillsDm.dfm

@@ -30,7 +30,10 @@ object StandardBillsData: TStandardBillsData
       0844617461547970650218084461746153697A6503C8000549734B6579080F4E
       0844617461547970650218084461746153697A6503C8000549734B6579080F4E
       65656450726F636573734E616D65090001044E616D650604556E697409466965
       65656450726F636573734E616D65090001044E616D650604556E697409466965
       6C644E616D650604556E69740844617461547970650218084461746153697A65
       6C644E616D650604556E69740844617461547970650218084461746153697A65
-      02140549734B6579080F4E65656450726F636573734E616D65090000}
+      02140549734B6579080F4E65656450726F636573734E616D65090001044E616D
+      6506085374617469634944094669656C644E616D650608537461746963494408
+      44617461547970650203084461746153697A6502040549734B6579080F4E6565
+      6450726F636573734E616D65090000}
   end
   end
   object sdvStdBills: TsdDataView
   object sdvStdBills: TsdDataView
     Active = False
     Active = False

+ 30 - 12
DataModules/ZJJLDm.pas

@@ -5,9 +5,11 @@ interface
 uses
 uses
   ZjGrid,
   ZjGrid,
   SysUtils, Classes, DB, DBClient, ADODB, sdIDTree, sdDB, Provider,
   SysUtils, Classes, DB, DBClient, ADODB, sdIDTree, sdDB, Provider,
-  Windows;
+  Windows, BillsTree;
 
 
 type
 type
+  TZJJLType = (ztFx, ztGcl);
+
   TZJJLNode = class
   TZJJLNode = class
   private
   private
     FBillsID: Integer;
     FBillsID: Integer;
@@ -75,6 +77,9 @@ type
       var Allow: Boolean);
       var Allow: Boolean);
     procedure DetailGridCellTextChanged(Sender: TObject; Col, Row: Integer);
     procedure DetailGridCellTextChanged(Sender: TObject; Col, Row: Integer);
 
 
+    // 向父项检测,直至提取到图册号为止
+    function GetDrawingCode(ANode: TsdIDTreeNode): string;
+
     function GetMainBillsTree: TsdIDTree;
     function GetMainBillsTree: TsdIDTree;
   public
   public
     constructor Create(APhaseData: TObject);
     constructor Create(APhaseData: TObject);
@@ -396,7 +401,7 @@ begin
   Result.PegName := GetPegName(vPeg);
   Result.PegName := GetPegName(vPeg);
   Result.FBFXName := GetFBFXName(vNode, vPeg);
   Result.FBFXName := GetFBFXName(vNode, vPeg);
   Result.UnitName := GetFieldStrDef(vNode, 'Name', '');
   Result.UnitName := GetFieldStrDef(vNode, 'Name', '');
-  Result.DrawingCode := GetFieldStrDef(vNode, 'DrawingCode', '');
+  Result.DrawingCode := GetDrawingCode(vNode);
 end;
 end;
 
 
 procedure TZJJLData.DetailGridCellTextChanged(Sender: TObject; Col,
 procedure TZJJLData.DetailGridCellTextChanged(Sender: TObject; Col,
@@ -489,16 +494,15 @@ begin
   cdsZJJLBillsID.AsInteger := ANode.ID;
   cdsZJJLBillsID.AsInteger := ANode.ID;
   cdsZJJLType.AsInteger := AType;
   cdsZJJLType.AsInteger := AType;
   ZJJLNode := GetOrgZJJLNode(ANode.ID);
   ZJJLNode := GetOrgZJJLNode(ANode.ID);
-  if not Assigned(ZJJLNode) then
-  begin
-    cdsZJJLCode.AsString := GetNewCode;
-    cdsZJJLBillsCode.AsString := ANode.Rec.ValueByName('Code').AsString;
-  end
-  else
+
+  cdsZJJLCode.AsString := GetNewCode;
+  if AType = Ord(ztFx) then
+    cdsZJJLBillsCode.AsString := ANode.Rec.ValueByName('Code').AsString
+  else if AType = Ord(ztGcl) then
+    cdsZJJLBillsCode.AsString := ANode.Rec.ValueByName('B_Code').AsString;
+  if Assigned(ZJJLNode) then
   begin
   begin
-    cdsZJJLCode.AsString := ZJJLNode.FCode;
     cdsZJJLCertificateCode.AsString := ZJJLNode.FCertificateCode;
     cdsZJJLCertificateCode.AsString := ZJJLNode.FCertificateCode;
-    cdsZJJLBillsCode.AsString := ZJJLNode.FBillsCode;
     cdsZJJLFormulaMemo.AsString := ZJJLNode.FFormulaMemo;
     cdsZJJLFormulaMemo.AsString := ZJJLNode.FFormulaMemo;
     cdsZJJLRelaFile.AsString := ZJJLNode.FRelaFile;
     cdsZJJLRelaFile.AsString := ZJJLNode.FRelaFile;
   end;
   end;
@@ -522,8 +526,8 @@ begin
   if Assigned(vNode.Parent) then
   if Assigned(vNode.Parent) then
     Result.PegName := vNode.Parent.Rec.ValueByName('Name').AsString;
     Result.PegName := vNode.Parent.Rec.ValueByName('Name').AsString;
   Result.FBFXName := '';
   Result.FBFXName := '';
-  Result.UnitName := '';
-  Result.DrawingCode := vNode.Rec.ValueByName('DrawingCode').AsString;
+  Result.UnitName := vNode.Rec.ValueByName('Name').AsString;
+  Result.DrawingCode := GetDrawingCode(vNode);
 end;
 end;
 
 
 function TZJJLData.GetInfoRec(ABillsID, AType: Integer): TZJJLInfoRec;
 function TZJJLData.GetInfoRec(ABillsID, AType: Integer): TZJJLInfoRec;
@@ -545,4 +549,18 @@ begin
   end;
   end;
 end;
 end;
 
 
+function TZJJLData.GetDrawingCode(ANode: TsdIDTreeNode): string;
+var
+  vNode: TBillsIDTreeNode;
+begin
+  Result := '';
+  vNode := TBillsIDTreeNode(ANode);
+  while (Result = '') and Assigned(vNode) do
+  begin
+    if Assigned(vNode.Rec) then
+      Result := vNode.Rec.DrawingCode.AsString;
+    vNode := TBillsIDTreeNode(vNode.Parent);
+  end;
+end;
+
 end.
 end.

+ 2 - 2
Dprs/Pro/Measure.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MajorVer=3
 MinorVer=1
 MinorVer=1
 Release=6
 Release=6
-Build=1003
+Build=1006
 Debug=0
 Debug=0
 PreRelease=0
 PreRelease=0
 Special=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化专业版
 FileDescription=纵横结算决算计量一体化专业版
-FileVersion=3.1.6.1003
+FileVersion=3.1.6.1006
 InternalName=
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure
 LegalTrademarks=Measure

+ 3 - 1
Dprs/Pro/Measure.dpr

@@ -195,7 +195,9 @@ uses
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
-  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas';
+  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas',
+  DbTreeImport in '..\..\Units\DbTreeImport.pas',
+  DbTreeDm in '..\..\DataModules\DbTreeDm.pas';
 
 
 {$R *.res}
 {$R *.res}
 
 

BIN
Dprs/Pro/Measure.res


+ 4 - 3
Dprs/Pro/Measure_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MajorVer=3
 MinorVer=1
 MinorVer=1
 Release=6
 Release=6
-Build=1003
+Build=1006
 Debug=0
 Debug=0
 PreRelease=0
 PreRelease=0
 Special=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化云版
 FileDescription=纵横结算决算计量一体化云版
-FileVersion=3.1.6.1003
+FileVersion=3.1.6.1006
 InternalName=
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure
 LegalTrademarks=Measure
@@ -137,8 +137,9 @@ ProductVersion=3.1.6.1
 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\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.
 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]
 [HistoryLists\hlConditionals]
-Count=1
+Count=2
 Item0=_mCloud;
 Item0=_mCloud;
+Item1=_mCloud;_mDebugView
 [HistoryLists\hlUnitAliases]
 [HistoryLists\hlUnitAliases]
 Count=1
 Count=1
 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

+ 4 - 1
Dprs/Pro/Measure_Cloud.dpr

@@ -199,7 +199,10 @@ uses
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
-  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas';
+  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas',
+  DbTreeImport in '..\..\Units\DbTreeImport.pas',
+  DbTreeDm in '..\..\DataModules\DbTreeDm.pas' {DbTreeData: TDataModule},
+  DebugUsers in '..\..\Units\DebugUsers.pas';
 
 
 {$R *.res}
 {$R *.res}
 
 

BIN
Dprs/Pro/Measure_Cloud.res


+ 2 - 2
Dprs/Pro/Measure_GuangDong.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MajorVer=3
 MinorVer=1
 MinorVer=1
 Release=6
 Release=6
-Build=1003
+Build=1006
 Debug=0
 Debug=0
 PreRelease=0
 PreRelease=0
 Special=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东专业版
 FileDescription=纵横结算决算计量一体化广东专业版
-FileVersion=3.1.6.1003
+FileVersion=3.1.6.1006
 InternalName=
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure
 LegalTrademarks=Measure

+ 3 - 1
Dprs/Pro/Measure_GuangDong.dpr

@@ -195,7 +195,9 @@ uses
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
-  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas';
+  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas',
+  DbTreeImport in '..\..\Units\DbTreeImport.pas',
+  DbTreeDm in '..\..\DataModules\DbTreeDm.pas';
 
 
 {$R *.res}
 {$R *.res}
 
 

BIN
Dprs/Pro/Measure_GuangDong.res


+ 2 - 2
Dprs/Pro/Measure_GuangDong_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MajorVer=3
 MinorVer=1
 MinorVer=1
 Release=6
 Release=6
-Build=1003
+Build=1006
 Debug=0
 Debug=0
 PreRelease=0
 PreRelease=0
 Special=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东云版
 FileDescription=纵横结算决算计量一体化广东云版
-FileVersion=3.1.6.1003
+FileVersion=3.1.6.1006
 InternalName=
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure
 LegalTrademarks=Measure

+ 4 - 1
Dprs/Pro/Measure_GuangDong_Cloud.dpr

@@ -199,7 +199,10 @@ uses
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
-  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas';
+  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas',
+  DbTreeImport in '..\..\Units\DbTreeImport.pas',
+  DbTreeDm in '..\..\DataModules\DbTreeDm.pas',
+  DebugUsers in '..\..\Units\DebugUsers.pas';
 
 
 {$R *.res}
 {$R *.res}
 
 

BIN
Dprs/Pro/Measure_GuangDong_Cloud.res


+ 2 - 2
Dprs/Pro/Measure_GuangDong_TZ.dof

@@ -115,7 +115,7 @@ AutoIncBuild=0
 MajorVer=3
 MajorVer=3
 MinorVer=1
 MinorVer=1
 Release=6
 Release=6
-Build=1001
+Build=1005
 Debug=0
 Debug=0
 PreRelease=0
 PreRelease=0
 Special=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横0号台账广东专业版
 FileDescription=纵横0号台账广东专业版
-FileVersion=3.1.6.1001
+FileVersion=3.1.6.1005
 InternalName=
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure
 LegalTrademarks=Measure

+ 3 - 1
Dprs/Pro/Measure_GuangDong_TZ.dpr

@@ -195,7 +195,9 @@ uses
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
-  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas';
+  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas',
+  DbTreeImport in '..\..\Units\DbTreeImport.pas',
+  DbTreeDm in '..\..\DataModules\DbTreeDm.pas' {DbTreeData: TDataModule};
 
 
 {$R *.res}
 {$R *.res}
 
 

BIN
Dprs/Pro/Measure_GuangDong_TZ.res


+ 2 - 2
Dprs/Pro/Measure_TZ.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MajorVer=3
 MinorVer=1
 MinorVer=1
 Release=6
 Release=6
-Build=1003
+Build=1006
 Debug=0
 Debug=0
 PreRelease=0
 PreRelease=0
 Special=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横0号台账专业版
 FileDescription=纵横0号台账专业版
-FileVersion=3.1.6.1003
+FileVersion=3.1.6.1006
 InternalName=
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure
 LegalTrademarks=Measure

+ 3 - 1
Dprs/Pro/Measure_TZ.dpr

@@ -195,7 +195,9 @@ uses
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   ProjGatherSelectFrm in '..\..\ProjGather\ProjGatherSelectFrm.pas' {ProjGatherSelectForm},
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   DealBillsExcelImport in '..\..\Units\DealBillsExcelImport.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
   ExcelImport_Bills in '..\..\Units\ExcelImport_Bills.pas',
-  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas';
+  ExcelImport_GclBills in '..\..\Units\ExcelImport_GclBills.pas',
+  DbTreeImport in '..\..\Units\DbTreeImport.pas',
+  DbTreeDm in '..\..\DataModules\DbTreeDm.pas' {DbTreeData: TDataModule};
 
 
 {$R *.res}
 {$R *.res}
 
 

BIN
Dprs/Pro/Measure_TZ.res


+ 20 - 0
Forms/MainFrm.dfm

@@ -405,6 +405,10 @@ object MainForm: TMainForm
         item
         item
           Item = dxtbnImportCloudTenderFile
           Item = dxtbnImportCloudTenderFile
           Visible = True
           Visible = True
+        end
+        item
+          Item = dxbtnImportDmf
+          Visible = True
         end>
         end>
     end
     end
     object dxsiEdit: TdxBarSubItem
     object dxsiEdit: TdxBarSubItem
@@ -1051,6 +1055,16 @@ object MainForm: TMainForm
       Hint = #21462#28040#38544#34255
       Hint = #21462#28040#38544#34255
       Visible = ivAlways
       Visible = ivAlways
     end
     end
+    object dxbtnImportDmf: TdxBarButton
+      Action = actnImportDmf
+      Category = 0
+    end
+    object dxbtnCanCalc: TdxBarButton
+      Caption = #20572#29992'/'#21551#29992
+      Category = 0
+      Hint = #20572#29992'/'#21551#29992
+      Visible = ivAlways
+    end
   end
   end
   object Images: TImageList
   object Images: TImageList
     DrawingStyle = dsTransparent
     DrawingStyle = dsTransparent
@@ -3218,6 +3232,12 @@ object MainForm: TMainForm
       Caption = #25209#37327#25554#20837
       Caption = #25209#37327#25554#20837
       ImageIndex = 2
       ImageIndex = 2
     end
     end
+    object actnImportDmf: TAction
+      Category = 'File'
+      Caption = #23548#20837#31639#37327#36719#20214'0'#21495#21488#36134#25509#21475#25968#25454
+      OnExecute = actnImportDmfExecute
+      OnUpdate = actnImportCloudTenderFileUpdate
+    end
   end
   end
   object dxpmTabSet: TdxBarPopupMenu
   object dxpmTabSet: TdxBarPopupMenu
     BarManager = dxBarManager
     BarManager = dxBarManager

+ 12 - 0
Forms/MainFrm.pas

@@ -156,6 +156,9 @@ type
     dxbtnInsertCol: TdxBarButton;
     dxbtnInsertCol: TdxBarButton;
     dxbtnHidden: TdxBarButton;
     dxbtnHidden: TdxBarButton;
     dxbtnCancelHidden: TdxBarButton;
     dxbtnCancelHidden: TdxBarButton;
+    dxbtnImportDmf: TdxBarButton;
+    actnImportDmf: TAction;
+    dxbtnCanCalc: TdxBarButton;
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;
@@ -199,6 +202,7 @@ type
       Shift: TShiftState);
       Shift: TShiftState);
     procedure actnReplyUpdate(Sender: TObject);
     procedure actnReplyUpdate(Sender: TObject);
     procedure dxbtnTenderPartitionClick(Sender: TObject);
     procedure dxbtnTenderPartitionClick(Sender: TObject);
+    procedure actnImportDmfExecute(Sender: TObject);
   private
   private
     FProjectManagerFrame: TProjectManagerFrame;
     FProjectManagerFrame: TProjectManagerFrame;
     FProjectFrames: TList;
     FProjectFrames: TList;
@@ -835,4 +839,12 @@ begin
   PartTendersModel;
   PartTendersModel;
 end;
 end;
 
 
+procedure TMainForm.actnImportDmfExecute(Sender: TObject);
+var
+  sFileName: string;
+begin
+  if SelectFile(sFileName, '.dmf') then
+    CurProjectFrame.ProjectData.ImportDmfFile(sFileName);
+end;
+
 end.
 end.

+ 57 - 9
Forms/ProjectPropertiesFrm.dfm

@@ -1,7 +1,7 @@
 object ProjectPropertiesForm: TProjectPropertiesForm
 object ProjectPropertiesForm: TProjectPropertiesForm
   Left = 663
   Left = 663
   Top = 261
   Top = 261
-  ActiveControl = leProjectName
+  ActiveControl = cbShowAlias
   BorderIcons = [biSystemMenu]
   BorderIcons = [biSystemMenu]
   BorderStyle = bsSingle
   BorderStyle = bsSingle
   Caption = #39033#30446#23646#24615
   Caption = #39033#30446#23646#24615
@@ -120,8 +120,8 @@ object ProjectPropertiesForm: TProjectPropertiesForm
     Top = 63
     Top = 63
     Width = 530
     Width = 530
     Height = 255
     Height = 255
-    ActivePage = jpsPropertiesBase
-    ActivePageIndex = 0
+    ActivePage = jpsPropertiesView
+    ActivePageIndex = 2
     Align = alTop
     Align = alTop
     Caption = 'jpsProperties'
     Caption = 'jpsProperties'
     object jpsPropertiesBase: TJimPage
     object jpsPropertiesBase: TJimPage
@@ -934,13 +934,13 @@ object ProjectPropertiesForm: TProjectPropertiesForm
             Left = 52
             Left = 52
             Top = 72
             Top = 72
             Width = 349
             Width = 349
-            Height = 49
+            Height = 73
             Caption = #20215#24046
             Caption = #20215#24046
             TabOrder = 31
             TabOrder = 31
             Visible = False
             Visible = False
             object lePM_PriceDigit: TLabeledEdit
             object lePM_PriceDigit: TLabeledEdit
-              Left = 49
-              Top = 19
+              Left = 51
+              Top = 43
               Width = 87
               Width = 87
               Height = 18
               Height = 18
               EditLabel.Width = 36
               EditLabel.Width = 36
@@ -951,14 +951,24 @@ object ProjectPropertiesForm: TProjectPropertiesForm
               Text = '0'
               Text = '0'
             end
             end
             object udPM_PriceDigit: TUpDown
             object udPM_PriceDigit: TUpDown
-              Left = 136
-              Top = 19
+              Left = 138
+              Top = 43
               Width = 16
               Width = 16
               Height = 18
               Height = 18
               Associate = lePM_PriceDigit
               Associate = lePM_PriceDigit
               Max = 10
               Max = 10
               TabOrder = 1
               TabOrder = 1
             end
             end
+            object cbDisplayPM: TCheckBox
+              Left = 11
+              Top = 19
+              Width = 166
+              Height = 17
+              Caption = #22635#20889#20215#24046#37329#39069#33267#35745#37327#21488#36134
+              Ctl3D = False
+              ParentCtl3D = False
+              TabOrder = 2
+            end
           end
           end
         end
         end
       end
       end
@@ -1015,6 +1025,19 @@ object ProjectPropertiesForm: TProjectPropertiesForm
         Font.Style = []
         Font.Style = []
         ParentFont = False
         ParentFont = False
       end
       end
+      object leReport: TLabel
+        Left = 7
+        Top = 141
+        Width = 48
+        Height = 12
+        Caption = #25253#34920#24213#32441
+        Font.Charset = ANSI_CHARSET
+        Font.Color = clBlue
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        ParentFont = False
+      end
       object pnlViewBar: TPanel
       object pnlViewBar: TPanel
         Left = 62
         Left = 62
         Top = 11
         Top = 11
@@ -1027,7 +1050,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
         Left = 8
         Left = 8
         Top = 24
         Top = 24
         Width = 505
         Width = 505
-        Height = 225
+        Height = 113
         BevelOuter = bvNone
         BevelOuter = bvNone
         TabOrder = 1
         TabOrder = 1
         object pnlAlias: TPanel
         object pnlAlias: TPanel
@@ -1144,6 +1167,31 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           end
         end
         end
       end
       end
+      object pnlReport: TPanel
+        Left = 62
+        Top = 147
+        Width = 457
+        Height = 2
+        BevelOuter = bvLowered
+        TabOrder = 2
+      end
+      object cbShowReportShading: TCheckBox
+        Left = 40
+        Top = 160
+        Width = 17
+        Height = 17
+        TabOrder = 3
+        OnClick = cbShowReportShadingClick
+      end
+      object edtReportShading: TEdit
+        Left = 64
+        Top = 160
+        Width = 177
+        Height = 18
+        Ctl3D = False
+        ParentCtl3D = False
+        TabOrder = 4
+      end
     end
     end
   end
   end
   object xpm: TXPMenu
   object xpm: TXPMenu

+ 18 - 0
Forms/ProjectPropertiesFrm.pas

@@ -102,6 +102,11 @@ type
     gbPM_Digit: TGroupBox;
     gbPM_Digit: TGroupBox;
     lePM_PriceDigit: TLabeledEdit;
     lePM_PriceDigit: TLabeledEdit;
     udPM_PriceDigit: TUpDown;
     udPM_PriceDigit: TUpDown;
+    cbDisplayPM: TCheckBox;
+    pnlReport: TPanel;
+    leReport: TLabel;
+    cbShowReportShading: TCheckBox;
+    edtReportShading: TEdit;
     procedure btnOkClick(Sender: TObject);
     procedure btnOkClick(Sender: TObject);
     procedure leContractPriceClick(Sender: TObject);
     procedure leContractPriceClick(Sender: TObject);
     procedure msbBaseMouseWheel(Sender: TObject; Shift: TShiftState;
     procedure msbBaseMouseWheel(Sender: TObject; Shift: TShiftState;
@@ -124,6 +129,7 @@ type
     procedure leNewUnlockPasswordAgainExit(Sender: TObject);
     procedure leNewUnlockPasswordAgainExit(Sender: TObject);
     procedure leNewUnLockPasswordExit(Sender: TObject);
     procedure leNewUnLockPasswordExit(Sender: TObject);
     procedure leUnlockPasswordExit(Sender: TObject);
     procedure leUnlockPasswordExit(Sender: TObject);
+    procedure cbShowReportShadingClick(Sender: TObject);
   private
   private
     FProjectData: TProjectData;
     FProjectData: TProjectData;
     FStaffData: TStaffData;
     FStaffData: TStaffData;
@@ -209,6 +215,10 @@ begin
   cbShowBGLCode.Checked := FProjProperties.ShowBGLCode;
   cbShowBGLCode.Checked := FProjProperties.ShowBGLCode;
   cbShowDesignQuantity.Checked := FProjProperties.ShowDesignQuantity;
   cbShowDesignQuantity.Checked := FProjProperties.ShowDesignQuantity;
   cbShowAlias.Checked := FProjProperties.ShowAlias;
   cbShowAlias.Checked := FProjProperties.ShowAlias;
+
+  cbShowReportShading.Checked := FProjProperties.ShowReportShading;
+  edtReportShading.Enabled := cbShowReportShading.Checked;
+  edtReportShading.Text := FProjProperties.ReportShading;
 end;
 end;
 
 
 procedure TProjectPropertiesForm.btnOkClick(Sender: TObject);
 procedure TProjectPropertiesForm.btnOkClick(Sender: TObject);
@@ -556,6 +566,9 @@ end;
 
 
 procedure TProjectPropertiesForm.SaveProjectView;
 procedure TProjectPropertiesForm.SaveProjectView;
 begin
 begin
+  FProjProperties.ShowReportShading := cbShowReportShading.Checked;
+  FProjProperties.ReportShading := edtReportShading.Text;
+
   FProjProperties.ShowPriceChange := cbShowPriceChange.Checked;
   FProjProperties.ShowPriceChange := cbShowPriceChange.Checked;
   FProjProperties.ShowBGLCode := cbShowBGLCode.Checked;
   FProjProperties.ShowBGLCode := cbShowBGLCode.Checked;
   FProjProperties.ShowDesignQuantity := cbShowDesignQuantity.Checked;
   FProjProperties.ShowDesignQuantity := cbShowDesignQuantity.Checked;
@@ -564,4 +577,9 @@ begin
   FProjectFrame.RefreshColumnDisplay;
   FProjectFrame.RefreshColumnDisplay;
 end;
 end;
 
 
+procedure TProjectPropertiesForm.cbShowReportShadingClick(Sender: TObject);
+begin
+  edtReportShading.Enabled := cbShowReportShading.Checked;
+end;
+
 end.
 end.

+ 21 - 10
Forms/ReportsFrm.dfm

@@ -82,23 +82,23 @@ object ReportsForm: TReportsForm
   end
   end
   object pnlReports: TPanel
   object pnlReports: TPanel
     Left = 0
     Left = 0
-    Top = 76
+    Top = 81
     Width = 1107
     Width = 1107
-    Height = 430
+    Height = 425
     Align = alClient
     Align = alClient
     BevelOuter = bvNone
     BevelOuter = bvNone
     TabOrder = 6
     TabOrder = 6
     object sprReportPreview: TSplitter
     object sprReportPreview: TSplitter
       Left = 211
       Left = 211
       Top = 0
       Top = 0
-      Height = 430
+      Height = 425
       AutoSnap = False
       AutoSnap = False
     end
     end
     object pnlReportsList: TPanel
     object pnlReportsList: TPanel
       Left = 0
       Left = 0
       Top = 0
       Top = 0
       Width = 211
       Width = 211
-      Height = 430
+      Height = 425
       Align = alLeft
       Align = alLeft
       BevelOuter = bvNone
       BevelOuter = bvNone
       TabOrder = 0
       TabOrder = 0
@@ -106,7 +106,7 @@ object ReportsForm: TReportsForm
         Left = 0
         Left = 0
         Top = 35
         Top = 35
         Width = 211
         Width = 211
-        Height = 395
+        Height = 390
         Align = alClient
         Align = alClient
         Font.Charset = DEFAULT_CHARSET
         Font.Charset = DEFAULT_CHARSET
         Font.Color = clWindowText
         Font.Color = clWindowText
@@ -193,7 +193,7 @@ object ReportsForm: TReportsForm
       Left = 214
       Left = 214
       Top = 0
       Top = 0
       Width = 893
       Width = 893
-      Height = 430
+      Height = 425
       HorzScrollBar.Increment = 48
       HorzScrollBar.Increment = 48
       HorzScrollBar.Tracking = True
       HorzScrollBar.Tracking = True
       VertScrollBar.Increment = 32
       VertScrollBar.Increment = 32
@@ -216,7 +216,7 @@ object ReportsForm: TReportsForm
     Font.Charset = DEFAULT_CHARSET
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Color = clWindowText
     Font.Height = -12
     Font.Height = -12
-    Font.Name = #23435#20307
+    Font.Name = 'Microsoft YaHei UI'
     Font.Style = []
     Font.Style = []
     Bars = <
     Bars = <
       item
       item
@@ -313,7 +313,7 @@ object ReportsForm: TReportsForm
         Caption = #33539#22260#36755#20986
         Caption = #33539#22260#36755#20986
         DockedDockingStyle = dsTop
         DockedDockingStyle = dsTop
         DockedLeft = 0
         DockedLeft = 0
-        DockedTop = 47
+        DockedTop = 52
         DockingStyle = dsTop
         DockingStyle = dsTop
         FloatLeft = 602
         FloatLeft = 602
         FloatTop = 414
         FloatTop = 414
@@ -343,7 +343,7 @@ object ReportsForm: TReportsForm
         Caption = #25253#34920#36873#39033
         Caption = #25253#34920#36873#39033
         DockedDockingStyle = dsTop
         DockedDockingStyle = dsTop
         DockedLeft = 308
         DockedLeft = 308
-        DockedTop = 47
+        DockedTop = 52
         DockingStyle = dsTop
         DockingStyle = dsTop
         FloatLeft = 484
         FloatLeft = 484
         FloatTop = 279
         FloatTop = 279
@@ -388,7 +388,7 @@ object ReportsForm: TReportsForm
     DockControlHeights = (
     DockControlHeights = (
       0
       0
       0
       0
-      76
+      81
       0)
       0)
     object xlbPrint: TdxBarLargeButton
     object xlbPrint: TdxBarLargeButton
       Caption = #25171#21360
       Caption = #25171#21360
@@ -2906,4 +2906,15 @@ object ReportsForm: TReportsForm
       8001800180018001FFFFFFFFFFFFFFFF00000000000000000000000000000000
       8001800180018001FFFFFFFFFFFFFFFF00000000000000000000000000000000
       000000000000}
       000000000000}
   end
   end
+  object BatchPrintXml: TPrintComXML
+    PreviewRows = 1
+    PreviewCols = 1
+    Scaling = 1.000000000000000000
+    OnGetDatasetEvent = PreviewComXMLGetDatasetEvent
+    OnGetDataConnection = PreviewComXMLGetDataConnection
+    OnCrossTabLabelShow = PreviewComXMLCrossTabLabelShow
+    OnContentDisplay = PreviewComXMLContentDisplay
+    Left = 390
+    Top = 89
+  end
 end
 end

+ 76 - 71
Forms/ReportsFrm.pas

@@ -60,6 +60,7 @@ type
     chkExcel2010: TCheckBox;
     chkExcel2010: TCheckBox;
     dxcciExcelMode: TdxBarControlContainerItem;
     dxcciExcelMode: TdxBarControlContainerItem;
     pnlReports: TPanel;
     pnlReports: TPanel;
+    BatchPrintXml: TPrintComXML;
     procedure PreviewComXMLGetDataConnection(var ADOCon: TADOConnection);
     procedure PreviewComXMLGetDataConnection(var ADOCon: TADOConnection);
     procedure xlbRealSizeClick(Sender: TObject);
     procedure xlbRealSizeClick(Sender: TObject);
     procedure xlbOnePageClick(Sender: TObject);
     procedure xlbOnePageClick(Sender: TObject);
@@ -105,9 +106,9 @@ type
     // 报表数据准备
     // 报表数据准备
     FReportDataPrepare: TReportPrepare;
     FReportDataPrepare: TReportPrepare;
 
 
-    procedure InitPageSettings;
-    procedure InitFont;
-    procedure InitPaperSettings(ATemplate: TTemplateNode);
+    procedure InitPageSettings(APrintCom: TPrintComXML);
+    procedure InitFont(APrintCom: TPrintComXML);
+    procedure InitPaperSettings(ATemplate: TTemplateNode; APrintCom: TPrintComXML);
 
 
     function GetHintStr: string;
     function GetHintStr: string;
 
 
@@ -123,7 +124,7 @@ type
     procedure ResizePreviewBox;
     procedure ResizePreviewBox;
     procedure PreviewReportCurPage;
     procedure PreviewReportCurPage;
     procedure RepaintCurPagePreview;
     procedure RepaintCurPagePreview;
-    procedure LoadTemplet(ATemplate: TTemplateNode);
+    procedure LoadTemplet(ATemplate: TTemplateNode; APrintCom: TPrintComXML);
     procedure LoadTempletAndDisplay;
     procedure LoadTempletAndDisplay;
 
 
     procedure BeforeExport;
     procedure BeforeExport;
@@ -133,7 +134,7 @@ type
     procedure PrintReport(ATemplateNode: TTemplateNode; isPDF, isExcel: boolean;
     procedure PrintReport(ATemplateNode: TTemplateNode; isPDF, isExcel: boolean;
       ExcelOutputName, TemplateFileName: string);
       ExcelOutputName, TemplateFileName: string);
 
 
-    procedure ExportXlsReport(AStartPage, AEndPage: Integer; const AFileName: string);
+    procedure ExportXlsReport(AStartPage, AEndPage: Integer; const AFileName: string; APrintCom: TPrintComXML);
     procedure ExportCurXlsReport;
     procedure ExportCurXlsReport;
     procedure ExportAllSelectedXlsReports;
     procedure ExportAllSelectedXlsReports;
     procedure PrintAllSelectedReports;
     procedure PrintAllSelectedReports;
@@ -151,7 +152,7 @@ type
     destructor Destroy; override;
     destructor Destroy; override;
 
 
     procedure InitFormView;
     procedure InitFormView;
-    procedure InitReportSettings(ATemplate: TTemplateNode = nil);
+    procedure InitReportSettings(APrintCom: TPrintComXML; ATemplate: TTemplateNode = nil);
 
 
     property ProjectData: TProjectData read FProjectData write SetProjectData;
     property ProjectData: TProjectData read FProjectData write SetProjectData;
     // 当前预览的页码
     // 当前预览的页码
@@ -188,7 +189,7 @@ begin
   {ReportsForm.BorderIcons := ReportsForm.BorderIcons - [biMaximize];
   {ReportsForm.BorderIcons := ReportsForm.BorderIcons - [biMaximize];
   ReportsForm.WindowState := wsMaximized;}
   ReportsForm.WindowState := wsMaximized;}
   ReportsForm.ProjectData := AProjectData;
   ReportsForm.ProjectData := AProjectData;
-  ReportsForm.InitReportSettings;
+  ReportsForm.InitReportSettings(ReportsForm.PreviewComXML);
   ReportsForm.InitFormView;
   ReportsForm.InitFormView;
   try
   try
     ReportsForm.ShowModal;
     ReportsForm.ShowModal;
@@ -297,7 +298,7 @@ begin
 
 
   Screen.Cursor := crHourGlass;
   Screen.Cursor := crHourGlass;
   try
   try
-    LoadTemplet(vTemplateNode);
+    LoadTemplet(vTemplateNode, PreviewComXML);
     if PreviewComXML.TotalPages > 0 then
     if PreviewComXML.TotalPages > 0 then
       PreviewTemplet
       PreviewTemplet
     else
     else
@@ -584,7 +585,7 @@ var
 begin
 begin
   sFileName := extvReport.Selected.Text;
   sFileName := extvReport.Selected.Text;
   if (PrintStartPage <= PrintEndPage) and SaveFile(sFileName, '.xls') then
   if (PrintStartPage <= PrintEndPage) and SaveFile(sFileName, '.xls') then
-    ExportXlsReport(PrintStartPage, PrintEndPage, sFileName);
+    ExportXlsReport(PrintStartPage, PrintEndPage, sFileName, PreviewComXML);
 end;
 end;
 
 
 procedure TReportsForm.AfterExport;
 procedure TReportsForm.AfterExport;
@@ -762,29 +763,32 @@ begin
     LoadTempletAndDisplay;
     LoadTempletAndDisplay;
 end;
 end;
 
 
-procedure TReportsForm.InitReportSettings(ATemplate: TTemplateNode);
+procedure TReportsForm.InitReportSettings(APrintCom: TPrintComXML; ATemplate: TTemplateNode);
 begin
 begin
-  PreviewComXML.FillZero := chkFillZero.Checked;
-  InitPageSettings;
-  InitPaperSettings(ATemplate);
+  APrintCom.FillZero := chkFillZero.Checked;
+  InitPageSettings(APrintCom);
+  InitPaperSettings(ATemplate, APrintCom);
+
+  APrintCom.ShowBackgroundMark := FProjectData.ProjProperties.ShowReportShading;
+  APrintCom.BackgroundMarkStr := FProjectData.ProjProperties.ReportShading;
 end;
 end;
 
 
-procedure TReportsForm.InitPageSettings;
+procedure TReportsForm.InitPageSettings(APrintCom: TPrintComXML);
 begin
 begin
   // 设置页面大小
   // 设置页面大小
-  PreviewComXML.setPageSize(ReportConfig.PageSize);
+  APrintCom.setPageSize(ReportConfig.PageSize);
   if ReportConfig.PageSize = 'A3' then
   if ReportConfig.PageSize = 'A3' then
-    PreviewComXML.PrintPageSizeIdx := DMPAPER_A3
+    APrintCom.PrintPageSizeIdx := DMPAPER_A3
   else if ReportConfig.PageSize = 'A4' then
   else if ReportConfig.PageSize = 'A4' then
-    PreviewComXML.PrintPageSizeIdx := DMPAPER_A4;  
+    APrintCom.PrintPageSizeIdx := DMPAPER_A4;
   // 设置边距
   // 设置边距
-  PreviewComXML.setEdge(0, '', ReportConfig.LeftEdge/10);
-  PreviewComXML.setEdge(1, '', ReportConfig.RightEdge/10);
-  PreviewComXML.setEdge(2, '', ReportConfig.UpEdge/10);
-  PreviewComXML.setEdge(3, '', ReportConfig.DownEdge/10);
+  APrintCom.setEdge(0, '', ReportConfig.LeftEdge/10);
+  APrintCom.setEdge(1, '', ReportConfig.RightEdge/10);
+  APrintCom.setEdge(2, '', ReportConfig.UpEdge/10);
+  APrintCom.setEdge(3, '', ReportConfig.DownEdge/10);
 end;
 end;
 
 
-procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
+procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode; APrintCom: TPrintComXML);
 
 
   procedure InitRepBorderLine;
   procedure InitRepBorderLine;
   var
   var
@@ -794,7 +798,7 @@ procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
   begin
   begin
     ObjList := TList.Create;
     ObjList := TList.Create;
     try
     try
-      PreviewComXML.getAllShapeObjs(1, ObjList);
+      APrintCom.getAllShapeObjs(1, ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         ShapeRec := ObjList[i];
         ShapeRec := ObjList[i];
@@ -817,7 +821,7 @@ procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
           else
           else
              ShapeRec.PenStyle := integer(psSolid)
              ShapeRec.PenStyle := integer(psSolid)
         end;
         end;
-        PreviewComXML.setShapeObj(ShapeRec);
+        APrintCom.setShapeObj(ShapeRec);
       end;
       end;
     finally
     finally
       ObjList.Free;
       ObjList.Free;
@@ -834,25 +838,25 @@ procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
   begin
   begin
     ObjList := TList.Create;
     ObjList := TList.Create;
     try
     try
-      PreviewComXML.getAllFlowShowContentObjs(ObjList);
+      APrintCom.getAllFlowShowContentObjs(ObjList);
       // 设置报表表格横线
       // 设置报表表格横线
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         FlowContentRec := ObjList[i];
         FlowContentRec := ObjList[i];
         FlowContentRec.LineInfo.TopThick := ReportConfig.CellHorLineWidth;
         FlowContentRec.LineInfo.TopThick := ReportConfig.CellHorLineWidth;
         FlowContentRec.LineInfo.BottomThick := ReportConfig.CellHorLineWidth;
         FlowContentRec.LineInfo.BottomThick := ReportConfig.CellHorLineWidth;
-        PreviewComXML.setFlowContentObj(FlowContentRec);
+        APrintCom.setFlowContentObj(FlowContentRec);
       end;
       end;
-      PreviewComXML.getAllCrossContentObjs(ObjList);
+      APrintCom.getAllCrossContentObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         CrossContentRec := ObjList[i];
         CrossContentRec := ObjList[i];
         CrossContentRec.CrossContent.LineInfo.TopThick := ReportConfig.CellHorLineWidth;
         CrossContentRec.CrossContent.LineInfo.TopThick := ReportConfig.CellHorLineWidth;
         CrossContentRec.CrossContent.LineInfo.BottomThick := ReportConfig.CellHorLineWidth;
         CrossContentRec.CrossContent.LineInfo.BottomThick := ReportConfig.CellHorLineWidth;
-        PreviewComXML.setCrossContentObj(CrossContentRec);
+        APrintCom.setCrossContentObj(CrossContentRec);
       end;
       end;
       // 设置报表表格竖线
       // 设置报表表格竖线
-      PreviewComXML.getAllFlowShowContentObjs(ObjList);
+      APrintCom.getAllFlowShowContentObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         FlowContentRec := ObjList[i];
         FlowContentRec := ObjList[i];
@@ -864,10 +868,10 @@ procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
             FlowContentRec.LineInfo.LeftThick := 0
             FlowContentRec.LineInfo.LeftThick := 0
           else if (i = ObjList.Count - 1) then
           else if (i = ObjList.Count - 1) then
             FlowContentRec.LineInfo.RightThick := 0;
             FlowContentRec.LineInfo.RightThick := 0;
-        PreviewComXML.setFlowContentObj(FlowContentRec);
+        APrintCom.setFlowContentObj(FlowContentRec);
       end;
       end;
 
 
-      PreviewComXML.getAllCrossContentObjs(ObjList);
+      APrintCom.getAllCrossContentObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         CrossContentRec := ObjList[i];
         CrossContentRec := ObjList[i];
@@ -931,7 +935,7 @@ procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
             end;
             end;
           end;
           end;
         end;
         end;
-        PreviewComXML.setCrossContentObj(CrossContentRec);
+        APrintCom.setCrossContentObj(CrossContentRec);
       end;
       end;
     finally
     finally
       ObjList.Free;
       ObjList.Free;
@@ -1029,7 +1033,7 @@ procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
             0..2 : SetPTRBorder(PSR.Data); //文本,参数,字段,表栏
             0..2 : SetPTRBorder(PSR.Data); //文本,参数,字段,表栏
             7 : SetPCRBorder(PSR.Data) //Column
             7 : SetPCRBorder(PSR.Data) //Column
           end;
           end;
-          PreviewComXML.setActShowElementObj(PSR);
+          APrintCom.setActShowElementObj(PSR);
         end;
         end;
       end;
       end;
     finally
     finally
@@ -1040,7 +1044,7 @@ procedure TReportsForm.InitPaperSettings(ATemplate: TTemplateNode);
 begin
 begin
   if not Assigned(ATemplate) or (ATemplate.SelfFormat = 0) then
   if not Assigned(ATemplate) or (ATemplate.SelfFormat = 0) then
   begin
   begin
-    InitFont;           // 各类字体
+    InitFont(APrintCom);           // 各类字体
     InitRepBorderLine;  // 报表边框
     InitRepBorderLine;  // 报表边框
     InitRepCellLine;    // 报表表格
     InitRepCellLine;    // 报表表格
     InitOtherArea;      // 活动区域
     InitOtherArea;      // 活动区域
@@ -1094,7 +1098,7 @@ begin
   PreviewReportCurPage;
   PreviewReportCurPage;
 end;
 end;
 
 
-procedure TReportsForm.InitFont;
+procedure TReportsForm.InitFont(APrintCom: TPrintComXML);
 
 
   procedure AssignFontRec(AFontRec: TFontRec; AFont: TFont);
   procedure AssignFontRec(AFontRec: TFontRec; AFont: TFont);
   begin
   begin
@@ -1113,7 +1117,7 @@ procedure TReportsForm.InitFont;
     if TitleRec <> nil then
     if TitleRec <> nil then
     begin
     begin
       AssignFontRec(TitleRec.FontRec, ReportConfig.TitleFont);
       AssignFontRec(TitleRec.FontRec, ReportConfig.TitleFont);
-      PreviewComXML.setTitleObj(TitleRec);
+      APrintCom.setTitleObj(TitleRec);
     end;
     end;
   end;
   end;
 
 
@@ -1143,23 +1147,23 @@ procedure TReportsForm.InitFont;
   begin
   begin
     ObjList := TList.Create;
     ObjList := TList.Create;
     try
     try
-      PreviewComXML.getAllColumnHeadObjs(ObjList);
+      APrintCom.getAllColumnHeadObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         ColumnRec := ObjList[i];
         ColumnRec := ObjList[i];
         AssignFontRec(ColumnRec.FontRec, ReportConfig.ColumnFont);
         AssignFontRec(ColumnRec.FontRec, ReportConfig.ColumnFont);
         InitColumnThick(ColumnRec);
         InitColumnThick(ColumnRec);
-        PreviewComXML.setColumnHeadTailObj(0, ColumnRec);
+        APrintCom.setColumnHeadTailObj(0, ColumnRec);
       end;
       end;
-      PreviewComXML.getAllColumnTailObjs(ObjList);
+      APrintCom.getAllColumnTailObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         ColumnRec := ObjList[i];
         ColumnRec := ObjList[i];
         AssignFontRec(ColumnRec.FontRec, ReportConfig.ColumnFont);
         AssignFontRec(ColumnRec.FontRec, ReportConfig.ColumnFont);
         InitColumnThick(ColumnRec);
         InitColumnThick(ColumnRec);
-        PreviewComXML.setColumnHeadTailObj(1,ColumnRec);
+        APrintCom.setColumnHeadTailObj(1,ColumnRec);
       end;
       end;
-      PreviewComXML.getAllActAreaObjs(ObjList);
+      APrintCom.getAllActAreaObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         AAR := ObjList[i];
         AAR := ObjList[i];
@@ -1171,7 +1175,7 @@ procedure TReportsForm.InitFont;
             ColumnRec := SER.Data;
             ColumnRec := SER.Data;
             AssignFontRec(ColumnRec.FontRec, ReportConfig.ColumnFont);
             AssignFontRec(ColumnRec.FontRec, ReportConfig.ColumnFont);
             InitColumnThick(ColumnRec);
             InitColumnThick(ColumnRec);
-            PreviewComXML.setActShowElementObj(SER);
+            APrintCom.setActShowElementObj(SER);
           end;
           end;
         end;
         end;
       end;
       end;
@@ -1191,45 +1195,45 @@ procedure TReportsForm.InitFont;
     ObjList := TList.Create;
     ObjList := TList.Create;
     try
     try
       // 设置表正文
       // 设置表正文
-      PreviewComXML.getAllFlowShowContentObjs(ObjList);
+      APrintCom.getAllFlowShowContentObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         FlowContentRec := ObjList[i];
         FlowContentRec := ObjList[i];
         if not (FlowContentRec.Fixed) then
         if not (FlowContentRec.Fixed) then
         begin
         begin
           AssignFontRec(FlowContentRec.FontRec, ReportConfig.ContentFont);
           AssignFontRec(FlowContentRec.FontRec, ReportConfig.ContentFont);
-          PreviewComXML.setFlowContentObj(FlowContentRec);
+          APrintCom.setFlowContentObj(FlowContentRec);
         end;
         end;
       end;
       end;
-      PreviewComXML.getAllBillShowContentObjs(ObjList);
+      APrintCom.getAllBillShowContentObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         FlowContentRec := ObjList[i];
         FlowContentRec := ObjList[i];
         if not(FlowContentRec.Fixed) then
         if not(FlowContentRec.Fixed) then
         begin
         begin
           AssignFontRec(FlowContentRec.FontRec, ReportConfig.ContentFont);
           AssignFontRec(FlowContentRec.FontRec, ReportConfig.ContentFont);
-          PreviewComXML.setBillContentObj(FlowContentRec);
+          APrintCom.setBillContentObj(FlowContentRec);
         end;
         end;
       end;
       end;
-      PreviewComXML.getAllCrossContentObjs(ObjList);
+      APrintCom.getAllCrossContentObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         CrossContentRec := ObjList[i];
         CrossContentRec := ObjList[i];
         if not(CrossContentRec.CrossContent.Fixed) then
         if not(CrossContentRec.CrossContent.Fixed) then
         begin
         begin
           AssignFontRec(CrossContentRec.CrossContent.FontRec, ReportConfig.ContentFont);
           AssignFontRec(CrossContentRec.CrossContent.FontRec, ReportConfig.ContentFont);
-          PreviewComXML.setCrossContentObj(CrossContentRec);
+          APrintCom.setCrossContentObj(CrossContentRec);
         end;
         end;
       end;
       end;
       // 设置表合计
       // 设置表合计
       for i := 0 to 2 do
       for i := 0 to 2 do
       begin
       begin
-        PreviewComXML.getAllSumObjs(i,ObjList);
+        APrintCom.getAllSumObjs(i,ObjList);
         for j := 0 to ObjList.Count - 1 do
         for j := 0 to ObjList.Count - 1 do
         begin
         begin
           SumRec := ObjList[j];
           SumRec := ObjList[j];
           AssignFontRec(SumRec.FontRec, ReportConfig.GatherFont);
           AssignFontRec(SumRec.FontRec, ReportConfig.GatherFont);
-          PreviewComXML.setSumObj(SumRec);
+          APrintCom.setSumObj(SumRec);
         end;
         end;
       end;
       end;
     finally
     finally
@@ -1245,19 +1249,19 @@ procedure TReportsForm.InitFont;
   begin
   begin
     ObjList := TList.Create;
     ObjList := TList.Create;
     try
     try
-      PreviewComXML.getAllHeadObjs(ObjList);
+      APrintCom.getAllHeadObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         HeadTailRec := ObjList[i];
         HeadTailRec := ObjList[i];
         AssignFontRec(HeadTailRec.FontRec, ReportConfig.GridHeaderFont);
         AssignFontRec(HeadTailRec.FontRec, ReportConfig.GridHeaderFont);
-        PreviewComXML.setHeadTailObj(0, HeadTailRec);
+        APrintCom.setHeadTailObj(0, HeadTailRec);
       end;
       end;
-      PreviewComXML.getAllTailObjs(ObjList);
+      APrintCom.getAllTailObjs(ObjList);
       for i := 0 to ObjList.Count - 1 do
       for i := 0 to ObjList.Count - 1 do
       begin
       begin
         HeadTailRec := ObjList[i];
         HeadTailRec := ObjList[i];
         AssignFontRec(HeadTailRec.FontRec, ReportConfig.GridHeaderFont);
         AssignFontRec(HeadTailRec.FontRec, ReportConfig.GridHeaderFont);
-        PreviewComXML.setHeadTailObj(1, HeadTailRec);
+        APrintCom.setHeadTailObj(1, HeadTailRec);
       end;
       end;
     finally
     finally
       ObjList.Free;
       ObjList.Free;
@@ -1335,14 +1339,14 @@ procedure TReportsForm.PrintReport(ATemplateNode: TTemplateNode;
   begin
   begin
     if isPDF then
     if isPDF then
     begin
     begin
-      PreviewComXML.PrintPDFAll;
+      BatchPrintXml.PrintPDFAll;
       while not CheckPrinterReady do
       while not CheckPrinterReady do
         Sleep(1000);
         Sleep(1000);
     end
     end
     else if not isExcel then
     else if not isExcel then
-      PreviewComXML.PrintAll(1)
+      BatchPrintXml.PrintAll(1)
     else
     else
-      ExportXlsReport(1, PreviewComXML.TotalPages, ExcelOutputName);
+      ExportXlsReport(1, BatchPrintXml.TotalPages, ExcelOutputName, BatchPrintXml);
   end;
   end;
 
 
 var
 var
@@ -1355,8 +1359,8 @@ begin
 
 
   Screen.Cursor := crHourGlass;
   Screen.Cursor := crHourGlass;
   try
   try
-    LoadTemplet(ATemplateNode);
-    if PreviewComXML.TotalPages > 0 then
+    LoadTemplet(ATemplateNode, BatchPrintXml);
+    if BatchPrintXml.TotalPages > 0 then
       PrintTemplet
       PrintTemplet
     {else if strRptName <> '' then
     {else if strRptName <> '' then
     begin
     begin
@@ -1369,7 +1373,7 @@ begin
 end;
 end;
 
 
 procedure TReportsForm.ExportXlsReport(AStartPage, AEndPage: Integer;
 procedure TReportsForm.ExportXlsReport(AStartPage, AEndPage: Integer;
-  const AFileName: string);
+  const AFileName: string; APrintCom: TPrintComXML);
 
 
   procedure ExportPagesXlsReport(AStartPage, AEndPage: Integer; const AFileName: string);
   procedure ExportPagesXlsReport(AStartPage, AEndPage: Integer; const AFileName: string);
   var
   var
@@ -1378,10 +1382,10 @@ procedure TReportsForm.ExportXlsReport(AStartPage, AEndPage: Integer;
     LoadExcelBorder(Border);
     LoadExcelBorder(Border);
     if IsExcel2010 then
     if IsExcel2010 then
       // 康博士代码中写批量打印是,用Printer.Canvas,打印当前时,用PreviewBox.Canvas。不懂为什么
       // 康博士代码中写批量打印是,用Printer.Canvas,打印当前时,用PreviewBox.Canvas。不懂为什么
-      PreViewComXML.OutputToExcelRangeXMLEx(PreviewBox.Canvas, AStartPage,
+      APrintCom.OutputToExcelRangeXMLEx(PreviewBox.Canvas, AStartPage,
           AEndPage, GetTemplateXlsFileName, AFileName, Border, ExcelMode)
           AEndPage, GetTemplateXlsFileName, AFileName, Border, ExcelMode)
     else
     else
-      PreViewComXML.OutputToExcelFile(PreviewBox.Canvas, AStartPage,
+      APrintCom.OutputToExcelFile(PreviewBox.Canvas, AStartPage,
           AEndPage, GetTemplateXlsFileName, AFileName, ExcelMode, Border);
           AEndPage, GetTemplateXlsFileName, AFileName, ExcelMode, Border);
   end;
   end;
 
 
@@ -1407,13 +1411,13 @@ begin
       until iStartPage > iEndPage;
       until iStartPage > iEndPage;
     end
     end
     else
     else
-      ExportPagesXlsReport(PrintStartPage, PrintEndPage, AFileName);
+      ExportPagesXlsReport(AStartPage, AEndPage, AFileName);
   finally
   finally
     AfterExport;
     AfterExport;
   end;
   end;
 end;
 end;
 
 
-procedure TReportsForm.LoadTemplet(ATemplate: TTemplateNode);
+procedure TReportsForm.LoadTemplet(ATemplate: TTemplateNode; APrintCom: TPrintComXML);
 var
 var
   RptArchiverObj: TReportArchiver;
   RptArchiverObj: TReportArchiver;
   Mem: TMemoryStream;
   Mem: TMemoryStream;
@@ -1428,17 +1432,18 @@ begin
     // 以下代码有顺序限制,不可修改,主要保证在不修改报表模板文件的基础上可以用户定制报表格式
     // 以下代码有顺序限制,不可修改,主要保证在不修改报表模板文件的基础上可以用户定制报表格式
     // 私以为,原因在于这些设置修改后,并不能生效,需要保存再读取方可生效
     // 私以为,原因在于这些设置修改后,并不能生效,需要保存再读取方可生效
     // 读取报表模板
     // 读取报表模板
-    if not PreviewComXML.ReadReportStream(Mem) then Exit;
+    if not APrintCom.ReadReportStream(Mem) then Exit;
     // 将报表设置中的数据覆盖掉原模板的数据
     // 将报表设置中的数据覆盖掉原模板的数据
-    InitReportSettings(ATemplate);
+    InitReportSettings(APrintCom, ATemplate);
     // 保存
     // 保存
-    PreviewComXML.SaveToStream(Mem);
+    APrintCom.SaveToStream(Mem);
     // 再次读取,使报表设置中的设置生效
     // 再次读取,使报表设置中的设置生效
-    PreviewComXML.ReadReportStream(Mem);
+    APrintCom.ReadReportStream(Mem);
     // ReadReportStream之后会将PreviewComXML的FillZero值赋为True,故再赋值一次
     // ReadReportStream之后会将PreviewComXML的FillZero值赋为True,故再赋值一次
-    PreviewComXML.FillZero := chkFillZero.Checked;
-    PreviewComXML.ReadDBData;
-    PreviewComXML.AnalyseData;
+    APrintCom.FillZero := chkFillZero.Checked;
+    InitPageSettings(APrintCom);
+    APrintCom.ReadDBData;
+    APrintCom.AnalyseData;
   finally
   finally
     if Mem <> nil then
     if Mem <> nil then
       Mem.Free;
       Mem.Free;

+ 4 - 2
Frames/CheckerFme.pas

@@ -126,7 +126,7 @@ end;
 
 
 procedure TCheckerFrame.Init;
 procedure TCheckerFrame.Init;
 var
 var
-  i: Integer;
+  i, iIndex: Integer;
   vA: TOVArr;
   vA: TOVArr;
   sURL, sPicPath, sID, sErrors: string;
   sURL, sPicPath, sID, sErrors: string;
   vProj: TProjectData;
   vProj: TProjectData;
@@ -185,7 +185,9 @@ begin
           vA[i, 0], vA[i, 2], vA[i, 1], sPicPath, vA[i, 6], vStatus, vA[i, 8], StrToInt(vA[i, 7]));
           vA[i, 0], vA[i, 2], vA[i, 1], sPicPath, vA[i, 6], vStatus, vA[i, 8], StrToInt(vA[i, 7]));
 
 
       vCM := TChecker.Create;
       vCM := TChecker.Create;
-      vProj.Checkers.Add(StrToInt(vA[i, 4]), vA[i, 0], vA[i, 2], vA[i, 6], vA[i, 8]);
+      iIndex := vProj.Checkers.Add(StrToInt(vA[i, 4]), vA[i, 0], vA[i, 2], vA[i, 6], vA[i, 8]);
+      if vStatus in [csFinished, csNotPass] then
+        vProj.Checkers.LastChecker := vProj.Checkers.Item[iIndex];
     end;
     end;
     RepairOrder;
     RepairOrder;
   end
   end

+ 10 - 0
Frames/DealPaymentFme.dfm

@@ -310,6 +310,11 @@ object DealPaymentFrame: TDealPaymentFrame
       item
       item
         Item = MainForm.dxbtnSetDealPayPlan
         Item = MainForm.dxbtnSetDealPayPlan
         Visible = True
         Visible = True
+      end
+      item
+        BeginGroup = True
+        Item = MainForm.dxbtnCanCalc
+        Visible = True
       end>
       end>
     UseOwnFont = False
     UseOwnFont = False
     OnPopup = dxpmDealPaymentPopup
     OnPopup = dxpmDealPaymentPopup
@@ -332,5 +337,10 @@ object DealPaymentFrame: TDealPaymentFrame
       OnExecute = actnSetDealPayPlanExecute
       OnExecute = actnSetDealPayPlanExecute
       OnUpdate = actnSetDealPayPlanUpdate
       OnUpdate = actnSetDealPayPlanUpdate
     end
     end
+    object actnCanCalc: TAction
+      Caption = #20572#29992'/'#21551#29992
+      OnExecute = actnCanCalcExecute
+      OnUpdate = actnCanCalcUpdate
+    end
   end
   end
 end
 end

+ 53 - 2
Frames/DealPaymentFme.pas

@@ -24,6 +24,7 @@ type
     actnDealPayment: TActionList;
     actnDealPayment: TActionList;
     actnCalculatePhasePay: TAction;
     actnCalculatePhasePay: TAction;
     actnSetDealPayPlan: TAction;
     actnSetDealPayPlan: TAction;
+    actnCanCalc: TAction;
     procedure zgParameterCellCanEdit(Sender: TObject; const ACoord: TPoint;
     procedure zgParameterCellCanEdit(Sender: TObject; const ACoord: TPoint;
       var Allow: Boolean);
       var Allow: Boolean);
     procedure imgHelpClick(Sender: TObject);
     procedure imgHelpClick(Sender: TObject);
@@ -46,6 +47,8 @@ type
     procedure zgDealPaymentShowHint(var HintStr: String;
     procedure zgDealPaymentShowHint(var HintStr: String;
       var CanShow: Boolean; var HintInfo: THintInfo; const ACoord: TPoint);
       var CanShow: Boolean; var HintInfo: THintInfo; const ACoord: TPoint);
     procedure actnSetDealPayPlanUpdate(Sender: TObject);
     procedure actnSetDealPayPlanUpdate(Sender: TObject);
+    procedure actnCanCalcExecute(Sender: TObject);
+    procedure actnCanCalcUpdate(Sender: TObject);
   private
   private
     FDealPaymentData: TDealPaymentData;
     FDealPaymentData: TDealPaymentData;
 
 
@@ -69,7 +72,8 @@ type
 implementation
 implementation
 
 
 uses
 uses
-  MainFrm, UtilMethods, ProjectData, PhaseData, DealPayPlanFrm;
+  MainFrm, UtilMethods, ProjectData, PhaseData, DealPayPlanFrm, PhasePayDm,
+  Math;
 
 
 {$R *.dfm}
 {$R *.dfm}
 
 
@@ -159,6 +163,7 @@ procedure TDealPaymentFrame.dxpmDealPaymentPopup(Sender: TObject);
 begin
 begin
   SetDxBtnAction(actnCalculatePhasePay, MainForm.dxbtnCalculatePhasePay);
   SetDxBtnAction(actnCalculatePhasePay, MainForm.dxbtnCalculatePhasePay);
   SetDxBtnAction(actnSetDealPayPlan, MainForm.dxbtnSetDealPayPlan);
   SetDxBtnAction(actnSetDealPayPlan, MainForm.dxbtnSetDealPayPlan);
+  SetDxBtnAction(actnCanCalc, MainForm.dxbtnCanCalc);
 end;
 end;
 
 
 procedure TDealPaymentFrame.actnCalculatePhasePayExecute(Sender: TObject);
 procedure TDealPaymentFrame.actnCalculatePhasePayExecute(Sender: TObject);
@@ -174,7 +179,7 @@ end;
 procedure TDealPaymentFrame.zgDealPaymentCellGetColor(Sender: TObject;
 procedure TDealPaymentFrame.zgDealPaymentCellGetColor(Sender: TObject;
   ACoord: TPoint; var AColor: TColor);
   ACoord: TPoint; var AColor: TColor);
 var
 var
-  Rec: TsdDataRecord;
+  Rec, PhaseRec: TsdDataRecord;
   iCurPhase: Integer;
   iCurPhase: Integer;
 begin
 begin
   if (ACoord.Y > zgDealPayment.FixedRowCount - 1) and
   if (ACoord.Y > zgDealPayment.FixedRowCount - 1) and
@@ -196,6 +201,14 @@ begin
     // µ±ÆÚÐÂÔöÏî
     // µ±ÆÚÐÂÔöÏî
     else if Rec.ValueByName('CreatePhaseID').AsInteger = iCurPhase then
     else if Rec.ValueByName('CreatePhaseID').AsInteger = iCurPhase then
       AColor := clInfoBk;
       AColor := clInfoBk;
+
+    with TProjectData(FDealPaymentData.ProjectData) do
+      if PhaseData.Active then
+      begin
+        PhaseRec := PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger);
+        if Assigned(PhaseRec) and PhaseRec.ValueByName('StopCalc').AsBoolean then
+          AColor := clSilver;
+      end;
   end;
   end;
 end;
 end;
 
 
@@ -378,4 +391,42 @@ begin
   TAction(Sender).Enabled := Assigned(sdDealPayment.DataView.Current);
   TAction(Sender).Enabled := Assigned(sdDealPayment.DataView.Current);
 end;
 end;
 
 
+procedure TDealPaymentFrame.actnCanCalcExecute(Sender: TObject);
+var
+  Rec, PhaseRec: TsdDataRecord;
+begin
+  Rec := sdDealPayment.DataView.Current;
+  with TProjectData(FDealPaymentData.ProjectData).PhaseData.PhasePayData do
+    PhaseRec := PayRecord(Rec.ValueByName('ID').AsInteger);
+  PhaseRec.ValueByName('StopCalc').AsBoolean := not PhaseRec.ValueByName('StopCalc').AsBoolean;
+
+  TProjectData(FDealPaymentData.ProjectData).PhaseData.PhasePayData.CalculateAll;
+end;
+
+procedure TDealPaymentFrame.actnCanCalcUpdate(Sender: TObject);
+var
+  Rec, PhaseRec: TsdDataRecord;
+begin
+  Rec := sdDealPayment.DataView.Current;
+  if not Assigned(Rec) or Rec.ValueByName('PreDefined').AsBoolean then
+  begin
+    TAction(Sender).Visible := False;
+    Exit;
+  end; 
+  TAction(Sender).Visible := TProjectData(FDealPaymentData.ProjectData).ValidStageIsRefer;
+
+  with TProjectData(FDealPaymentData.ProjectData) do
+    if PhaseData.Active then
+      PhaseRec := PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger)
+    else
+      PhaseRec := nil;
+  if Assigned(PhaseRec) then
+  begin
+    if PhaseRec.ValueByName('StopCalc').AsBoolean then
+      TAction(Sender).Caption := 'ÆôÓÃ'
+    else
+      TAction(Sender).Caption := 'Í£ÓÃ';
+  end;
+end;
+
 end.
 end.

+ 109 - 1
Frames/ProjectGLFme.dfm

@@ -11,7 +11,7 @@ object ProjectGLFrame: TProjectGLFrame
     Height = 313
     Height = 313
     Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
     Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
     OptionsEx = []
     OptionsEx = []
-    ColCount = 13
+    ColCount = 19
     RowCount = 6
     RowCount = 6
     FixedRowCount = 2
     FixedRowCount = 2
     ShowGridLine = False
     ShowGridLine = False
@@ -246,6 +246,114 @@ object ProjectGLFrame: TProjectGLFrame
         FieldName = 'PM_TotalPrice'
         FieldName = 'PM_TotalPrice'
         Width = 60
         Width = 60
         ReadOnly = True
         ReadOnly = True
+      end
+      item
+        Title.Caption = #26412#26399#23454#32791'|'#25968#37327
+        Title.CaptionAcrossCols = '2'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taRightJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'UsedQuantity'
+        Width = 60
+        ReadOnly = False
+      end
+      item
+        Title.Caption = '|'#37329#39069
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taRightJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'UsedTotalPrice'
+        Width = 60
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #26412#26399#28040#32791#30408#20111'|'#25968#37327#30408#20111
+        Title.CaptionAcrossCols = '4'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taRightJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'PAL_UsedQuantity'
+        Width = 60
+        ReadOnly = True
+      end
+      item
+        Title.Caption = '|'#25968#37327#30408#20111#37329#39069
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taRightJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'PAL_UsedTotalPrice'
+        Width = 82
+        ReadOnly = True
+      end
+      item
+        Title.Caption = '|'#20215#24046#30408#20111#37329#39069
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taRightJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'PAL_DeltaPrice'
+        Width = 82
+        ReadOnly = True
+      end
+      item
+        Title.Caption = '|'#21512#35745#30408#20111#37329#39069
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'PAL_Total'
+        Width = 82
+        ReadOnly = True
       end>
       end>
     Grid = zgProjectGL
     Grid = zgProjectGL
     ExtendRowCount = 3
     ExtendRowCount = 3

+ 8 - 8
Frames/ZJJLFme.dfm

@@ -214,7 +214,7 @@ object ZJJLFrame: TZJJLFrame
   object zaZJJL: TZjGridDBA
   object zaZJJL: TZjGridDBA
     Columns = <
     Columns = <
       item
       item
-        Title.Caption = #20013#38388#35745#37327#34920#21495
+        Title.Caption = #32534#21495
         Title.CaptionAcrossCols = '1'
         Title.CaptionAcrossCols = '1'
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Color = clWindowText
         Title.Font.Color = clWindowText
@@ -227,11 +227,11 @@ object ZJJLFrame: TZJJLFrame
         Font.Height = -12
         Font.Height = -12
         Font.Name = #23435#20307
         Font.Name = #23435#20307
         Font.Style = []
         Font.Style = []
-        FieldName = 'Code'
-        ReadOnly = False
+        FieldName = 'BillsCode'
+        ReadOnly = True
       end
       end
       item
       item
-        Title.Caption = #20132#24037#35777#20070'/'#20973#35777#21495
+        Title.Caption = #20013#38388#35745#37327#34920#21495
         Title.CaptionAcrossCols = '1'
         Title.CaptionAcrossCols = '1'
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Color = clWindowText
         Title.Font.Color = clWindowText
@@ -244,11 +244,11 @@ object ZJJLFrame: TZJJLFrame
         Font.Height = -12
         Font.Height = -12
         Font.Name = #23435#20307
         Font.Name = #23435#20307
         Font.Style = []
         Font.Style = []
-        FieldName = 'CertificateCode'
+        FieldName = 'Code'
         ReadOnly = False
         ReadOnly = False
       end
       end
       item
       item
-        Title.Caption = #39033#30446#33410#32534#21495
+        Title.Caption = #20132#24037#35777#20070'/'#20973#35777#21495
         Title.CaptionAcrossCols = '1'
         Title.CaptionAcrossCols = '1'
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Color = clWindowText
         Title.Font.Color = clWindowText
@@ -261,8 +261,8 @@ object ZJJLFrame: TZJJLFrame
         Font.Height = -12
         Font.Height = -12
         Font.Name = #23435#20307
         Font.Name = #23435#20307
         Font.Style = []
         Font.Style = []
-        FieldName = 'BillsCode'
-        ReadOnly = True
+        FieldName = 'CertificateCode'
+        ReadOnly = False
       end>
       end>
     Grid = zgZJJL
     Grid = zgZJJL
     ExtendRowCount = 0
     ExtendRowCount = 0

+ 1 - 1
Frames/ZJJLFme.pas

@@ -127,7 +127,7 @@ procedure TZJJLFrame.zgZJJLMouseDown(Sender: TObject; Button: TMouseButton;
 begin
 begin
   if Button = mbRight then
   if Button = mbRight then
     dxpmZJJL.PopupFromCursorPos
     dxpmZJJL.PopupFromCursorPos
-  else if (ssDouble in Shift) and (zgZJJL.CurCol = 3) then
+  else if (ssDouble in Shift) and (zgZJJL.CurCol = 1) then
   begin
   begin
     if FZJJLData.cdsZJJLView.RecordCount > 0 then
     if FZJJLData.cdsZJJLView.RecordCount > 0 then
       FZJJLData.LocateBills;
       FZJJLData.LocateBills;

+ 1 - 0
Report/ReportConnection.pas

@@ -28,6 +28,7 @@ constructor TReportConnection.Create(AProjectData: TProjectData);
 begin
 begin
   FProjectData := AProjectData;
   FProjectData := AProjectData;
   FCommonGather := TrpgGatherControl.Create(AProjectData.ProjectID);
   FCommonGather := TrpgGatherControl.Create(AProjectData.ProjectID);
+  FConnection := AProjectData.ADOConnection;
 end;
 end;
 
 
 destructor TReportConnection.Destroy;
 destructor TReportConnection.Destroy;

+ 1 - 0
Units/BillsClipboard.pas

@@ -110,6 +110,7 @@ begin
   Clear;
   Clear;
   CopyData(ANode, ACount);
   CopyData(ANode, ACount);
   SaveToStream;
   SaveToStream;
+  SaveToXmlFile('E:\1.xml');
   SaveToClipboard(CF_BillsBlock);
   SaveToClipboard(CF_BillsBlock);
 end;
 end;
 
 

+ 1 - 1
Units/CacheTree.pas

@@ -230,7 +230,7 @@ end;
 
 
 function TCacheNode.GetNodeID(ANode: TCacheNode): Integer;
 function TCacheNode.GetNodeID(ANode: TCacheNode): Integer;
 begin
 begin
-  if Assigned(ANode) then
+  if Assigned(ANode) and (ANode <> nil) then
     Result := ANode.ID
     Result := ANode.ID
   else
   else
     Result := -1;
     Result := -1;

+ 2 - 0
Units/Checker.pas

@@ -42,6 +42,7 @@ type
   TCheckers = class(TObject)			// ÉóºËÈ˹ÜÀíÀà
   TCheckers = class(TObject)			// ÉóºËÈ˹ÜÀíÀà
   private
   private
     FList: TList;
     FList: TList;
+    FLastChecker: TChecker;
     function GetItem(Index: Integer): TChecker;
     function GetItem(Index: Integer): TChecker;
     function GetCount: Integer;
     function GetCount: Integer;
   public
   public
@@ -56,6 +57,7 @@ type
     function FindByID(AID: Integer): TChecker;
     function FindByID(AID: Integer): TChecker;
     property Item[Index: Integer]: TChecker read GetItem; default;
     property Item[Index: Integer]: TChecker read GetItem; default;
     property Count: Integer read GetCount;
     property Count: Integer read GetCount;
+    property LastChecker: TChecker read FLastChecker write FLastChecker;
   end;
   end;
 
 
 implementation
 implementation

+ 7 - 0
Units/ConditionalDefines.pas

@@ -30,6 +30,13 @@ var
     _IsDebugView: Boolean = False;
     _IsDebugView: Boolean = False;
   {$ENDIF}
   {$ENDIF}
 
 
+  // 使用G_IsCloud变量总是出现编译问题
+  {$IFDEF _mCloud}
+    _IsCloud: Boolean = True;
+  {$ELSE}
+    _IsCloud: Boolean = False;
+  {$ENDIF}
+
 implementation
 implementation
 
 
 end.
 end.

+ 98 - 9
Units/Connections.pas

@@ -8,7 +8,7 @@ uses
 const
 const
   ProductName = 'Measure';
   ProductName = 'Measure';
   EmptyFileVersion = '1.0.0.0';
   EmptyFileVersion = '1.0.0.0';
-  FileVersion = '1.0.1.2';
+  FileVersion = '1.0.1.4';
   EncryptVersion = 'Auto1.0';
   EncryptVersion = 'Auto1.0';
   SAdoConnectStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;' +
   SAdoConnectStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;' +
                    'User ID=Admin;Password='''';Persist Security Info=True';
                    'User ID=Admin;Password='''';Persist Security Info=True';
@@ -21,7 +21,7 @@ type
     function GetConnection: TADOConnection; virtual; abstract;
     function GetConnection: TADOConnection; virtual; abstract;
   public
   public
     procedure Open(const AFileName: string); virtual; abstract;
     procedure Open(const AFileName: string); virtual; abstract;
-    procedure Save; virtual;
+    procedure Save; virtual; abstract;
     procedure Close;
     procedure Close;
     function HasOpened: Boolean; virtual; abstract;
     function HasOpened: Boolean; virtual; abstract;
 
 
@@ -41,6 +41,7 @@ type
     destructor Destroy; override;
     destructor Destroy; override;
 
 
     procedure Open(const AFileName: string); override;
     procedure Open(const AFileName: string); override;
+    procedure Save; override;
     function HasOpened: Boolean; override;
     function HasOpened: Boolean; override;
   end;
   end;
 
 
@@ -61,6 +62,8 @@ type
   TEncryptConnection = class(TCommonConnection)
   TEncryptConnection = class(TCommonConnection)
   private
   private
     FFileHead: TDrawingFileHead;
     FFileHead: TDrawingFileHead;
+    function CheckFileValid(const AFileName: string): Boolean;
+
     procedure Encrypt;
     procedure Encrypt;
     function Decrypt(const AFileName: string): string;
     function Decrypt(const AFileName: string): string;
 
 
@@ -79,6 +82,7 @@ type
     destructor Destroy; override;
     destructor Destroy; override;
     procedure Open(const AFileName: string); override;
     procedure Open(const AFileName: string); override;
     procedure Save; override;
     procedure Save; override;
+    procedure UnEncryptSave;
 
 
     procedure UpdateFileVersion;
     procedure UpdateFileVersion;
     procedure SaveDebugFile(const AFileName: string);
     procedure SaveDebugFile(const AFileName: string);
@@ -88,6 +92,7 @@ type
   end;
   end;
 
 
   procedure SimpleDecrypt(const ASourceFile, AResultFile: string);
   procedure SimpleDecrypt(const ASourceFile, AResultFile: string);
+  function FileEncrypted(const AFileName: string): Boolean;
 
 
 implementation
 implementation
 
 
@@ -126,6 +131,31 @@ procedure SimpleDecrypt(const ASourceFile, AResultFile: string);
     end;
     end;
   end;
   end;
 
 
+  procedure RecoverFileHead(const 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;
+
 var
 var
   sTempFile: string;
   sTempFile: string;
 begin
 begin
@@ -135,11 +165,26 @@ begin
     CopyFile(PChar(ASourceFile), PChar(sTempFile), False);
     CopyFile(PChar(ASourceFile), PChar(sTempFile), False);
     RemoveHead(sTempFile);
     RemoveHead(sTempFile);
     AutoDecryptFile(sTempFile, AResultFile);
     AutoDecryptFile(sTempFile, AResultFile);
+    RecoverFileHead(AResultFile);
   finally
   finally
     DeleteFile(PChar(sTempFile));
     DeleteFile(PChar(sTempFile));
   end;
   end;
 end;
 end;
 
 
+function FileEncrypted(const AFileName: string): Boolean;
+var
+  FileHead: TDrawingFileHead;
+  FileStream: TFileStream;
+begin
+  FileStream := TFileStream.Create(AFileName, fmOpenRead);
+  try
+    FileStream.ReadBuffer(FileHead, SizeOf(TDrawingFileHead));
+    Result := FileHead.ProductName = ProductName;
+  finally
+    FileStream.Free;
+  end;
+end;
+
 procedure EncryptFile(const AFileName: string);
 procedure EncryptFile(const AFileName: string);
 var
 var
   fileStream: TFileStream;
   fileStream: TFileStream;
@@ -181,7 +226,10 @@ begin
       AutoEncryptFile(sTempFile, sEncryptFile);
       AutoEncryptFile(sTempFile, sEncryptFile);
       RefreshFileHead;
       RefreshFileHead;
       WriteAndAddHead(sEncryptFile);
       WriteAndAddHead(sEncryptFile);
-      CopyFile(PChar(sEncryptFile), PChar(FOrgFile), False);
+      if CheckFileValid(sEncryptFile) then
+        CopyFile(PChar(sEncryptFile), PChar(FOrgFile), False)
+      else
+        Abort;
     finally
     finally
       DeleteFile(PChar(sTempFile));
       DeleteFile(PChar(sTempFile));
       DeleteFile(PChar(sEncryptFile));
       DeleteFile(PChar(sEncryptFile));
@@ -207,6 +255,7 @@ begin
   FFileName := Decrypt(AFileName);
   FFileName := Decrypt(AFileName);
   if FileExists(FFileName) then
   if FileExists(FFileName) then
   begin
   begin
+    RecoverFileHead(FFileName);
     InnerOpen(FFileName);
     InnerOpen(FFileName);
     DamageFileHead(FFileName);
     DamageFileHead(FFileName);
   end
   end
@@ -411,16 +460,51 @@ begin
   RecoverFileHead(AFileName);
   RecoverFileHead(AFileName);
 end;
 end;
 
 
-{ TConnection }
-
-procedure TConnection.Close;
+function TEncryptConnection.CheckFileValid(
+  const AFileName: string): Boolean;
+var
+  sConnectFile, sTempFile: string;
+  vCon: TADOConnection;
 begin
 begin
-  Connection.Close;
+  Result := False;
+  vCon := TADOConnection.Create(nil);
+  vCon.LoginPrompt := False;
+  sConnectFile := GetTempFileName;
+  sTempFile := GetTempFileName;
+  try
+    if FileExists(AFileName) then
+    begin
+      CopyFile(PChar(AFileName), PChar(sTempFile), False);
+      if CheckFileEncrypt(sTempFile) then
+      begin
+        ReadAndRemoveHead(sTempFile);
+        AutoDecryptFile(sTempFile, sConnectFile);
+      end
+      else
+        CopyFile(PChar(sTempFile), PChar(sConnectFile), False);
+      RecoverFileHead(sConnectFile);
+      vCon.ConnectionString := Format(SAdoConnectStr, [sConnectFile]);
+      vCon.Open;
+      Result := True;
+    end;
+  finally
+    DeleteFile(PChar(sConnectFile));
+    DeleteFile(PChar(sTempFile));
+    vCon.Free;
+  end;
 end;
 end;
 
 
-procedure TConnection.Save;
+procedure TEncryptConnection.UnEncryptSave;
 begin
 begin
+  RecoverFileHead(FFileName);
+  
+end;
 
 
+{ TConnection }
+
+procedure TConnection.Close;
+begin
+  Connection.Close;
 end;
 end;
 
 
 { TCommonConnection }
 { TCommonConnection }
@@ -453,7 +537,7 @@ begin
   Close;
   Close;
   if FileExists(AFileName) then
   if FileExists(AFileName) then
   begin
   begin
-    DecryptFile(AFileName);
+    //DecryptFile(AFileName);
     InnerOpen(AFileName);
     InnerOpen(AFileName);
   end
   end
   else
   else
@@ -468,4 +552,9 @@ begin
   FConnection.Open;
   FConnection.Open;
 end;
 end;
 
 
+procedure TCommonConnection.Save;
+begin
+  inherited;
+end;
+
 end.
 end.

+ 131 - 8
Units/DataBaseTables.pas

@@ -343,7 +343,7 @@ const
     (FieldName: 'Pos_Reason'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'Pos_Reason'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更工程量说明
     // 变更工程量说明
     (FieldName: 'Direction'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'Direction'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
-    // 锁定
+    // 锁定 -- 废弃,不再使用
     (FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更图号
     // 变更图号
     (FieldName: 'DrawingCode'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'DrawingCode'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -375,7 +375,7 @@ const
     (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 已变更数量
     // 已变更数量
     (FieldName: 'UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
-    // 锁定
+    // 锁定 -- 废弃,不再使用
     (FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
     (FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
   );
 
 
@@ -418,7 +418,7 @@ const
 
 
   {调差工料}
   {调差工料}
   SProjectGL = 'ProjectGL';
   SProjectGL = 'ProjectGL';
-  tdProjectGL: array [0..16] of TScFieldDef =(
+  tdProjectGL: array [0..28] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 工料机编号
     // 工料机编号
     (FieldName: 'Code'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'Code'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -452,13 +452,39 @@ const
     // 当前阶段 -- 调差数量
     // 当前阶段 -- 调差数量
     (FieldName: 'PM_Quantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 当期阶段 -- 调差金额
     // 当期阶段 -- 调差金额
-    (FieldName: 'PM_TotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'PM_TotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 截止上期实耗 -- 数量
+    (FieldName: 'PreUsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期实耗 -- 金额
+    (FieldName: 'PreUsedTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期消耗盈亏 -- 数量盈亏       盈亏 -- 工料损耗 -- 数量
+    (FieldName: 'PrePAL_UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期消耗盈亏 -- 数量盈亏金额   盈亏 -- 工料损耗 -- 金额
+    (FieldName: 'PrePAL_UsedTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期消耗盈亏 -- 价差盈亏       盈亏 -- 价差盈亏
+    (FieldName: 'PrePAL_DeltaPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期消耗盈亏 -- 合计盈亏       盈亏 -- 合计
+    (FieldName: 'PrePAL_Total'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 本期实耗 -- 数量
+    (FieldName: 'UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期实耗 -- 金额
+    (FieldName: 'UsedTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期消耗盈亏 -- 数量盈亏       本期盈亏 -- 工料损耗 -- 数量
+    (FieldName: 'PAL_UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期消耗盈亏 -- 数量盈亏金额   本期盈亏 -- 工料损耗 -- 金额
+    (FieldName: 'PAL_UsedTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期消耗盈亏 -- 价差盈亏       本期盈亏 -- 价差盈亏
+    (FieldName: 'PAL_DeltaPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期消耗盈亏 -- 合计盈亏       本期盈亏 -- 合计
+    (FieldName: 'PAL_Total'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
     {--------------------End 当期缓存数据----------------------}
     {--------------------End 当期缓存数据----------------------}
   );
   );
 
 
   {调差工料--价格信息及计算}
   {调差工料--价格信息及计算}
   SGLPrice = 'GLPrice';
   SGLPrice = 'GLPrice';
-  tdGLPrice: array [0..39] of TScFieldDef =(
+  tdGLPrice: array [0..111] of TScFieldDef =(
     // 工料ID
     // 工料ID
     (FieldName: 'GLID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'GLID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 期号
     // 期号
@@ -471,44 +497,139 @@ const
     (FieldName: 'DeltaPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'DeltaPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 有效价差
     // 有效价差
     (FieldName: 'ValidDeltaPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'ValidDeltaPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 截止上期 -- 数量
+    (FieldName: 'PreUsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期 -- 金额
+    (FieldName: 'PreUsedTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期实耗 -- 数量
+    (FieldName: 'UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 本期实耗 -- 金额
+    (FieldName: 'UsedTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     // 截止上期
     // 截止上期
     (FieldName: 'PM_PreQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_PreQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_PreTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_PreTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 消耗盈亏 -- 数量盈亏       盈亏 -- 工料损耗 -- 数量
+    (FieldName: 'PrePAL_UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 消耗盈亏 -- 数量盈亏金额   盈亏 -- 工料损耗 -- 金额
+    (FieldName: 'PrePAL_UsedTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 消耗盈亏 -- 价差盈亏       盈亏 -- 价差盈亏
+    (FieldName: 'PrePAL_DeltaPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 消耗盈亏 -- 合计盈亏       盈亏 -- 合计
+    (FieldName: 'PrePAL_Total'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 本期 -- 原报
     // 本期 -- 原报
     (FieldName: 'PM_Quantity0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total0'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 本期 -- 1审~14审
     // 本期 -- 1审~14审
     (FieldName: 'PM_Quantity1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total1'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total2'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total3'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total4'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total5'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total6'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total7'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total8'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total9'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total10'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total11'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total12'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total13'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
     (FieldName: 'PM_Quantity14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_TotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 本期 -- 终审数据(当前文件中最后一人的数据)-- 数据缓存
     // 本期 -- 终审数据(当前文件中最后一人的数据)-- 数据缓存
     (FieldName: 'PM_Quantity_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'PM_Quantity_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
-    (FieldName: 'PM_TotalPrice_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'PM_TotalPrice_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedQuantity_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_UsedTotalPrice_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_DeltaPrice_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'PAL_Total_F'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
   );
 
 
   {清单使用的工料}
   {清单使用的工料}
@@ -690,7 +811,7 @@ const
 
 
   // 计量期合同支付
   // 计量期合同支付
   SPhasePay = 'PhasePay';
   SPhasePay = 'PhasePay';
-  tdPhasePay: array [0..60] of TScFieldDef =(
+  tdPhasePay: array [0..61] of TScFieldDef =(
     // 与DealPayment一一对应
     // 与DealPayment一一对应
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 本期金额 0:原报,1..14:1..14审
     // 本期金额 0:原报,1..14:1..14审
@@ -756,7 +877,9 @@ const
     (FieldName: 'TotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'TotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'Formula14'; FieldType: ftString; Size: 100; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'Formula14'; FieldType: ftString; Size: 100; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'EndTotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'EndTotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
-    (FieldName: 'PreTotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'PreTotalPrice14'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 是否停用:0、False--否,-1、True--是
+    (FieldName: 'StopCalc'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
   );
 
 
   // 计量期属性表
   // 计量期属性表

+ 5 - 3
Units/ExcelImport.pas

@@ -154,9 +154,9 @@ procedure TBillsExcelImport.BeginImport;
 begin
 begin
   FCurRow := 0;
   FCurRow := 0;
   FCacheTree := TBillsCacheTree.Create;
   FCacheTree := TBillsCacheTree.Create;
-  FCacheTree.NewNodeID := 101;
-  FCacheTree.SeparateChar := '.';
   FCacheTree.AutoSort := True;
   FCacheTree.AutoSort := True;
+  FCacheTree.SeparateChar := '.';
+  FCacheTree.NewNodeID := Max(FCacheTree.NewNodeID, 101);
 end;
 end;
 
 
 procedure TBillsExcelImport.EndImport;
 procedure TBillsExcelImport.EndImport;
@@ -180,6 +180,7 @@ begin
   FCacheTree := ACacheTree;
   FCacheTree := ACacheTree;
   sChar := FCacheTree.SeparateChar;
   sChar := FCacheTree.SeparateChar;
   FCacheTree.SeparateChar := '.';
   FCacheTree.SeparateChar := '.';
+  FCacheTree.NewNodeID := Max(FCacheTree.NewNodeID, 101);
 
 
   MSExcel.LoadFromFile(sFileName);
   MSExcel.LoadFromFile(sFileName);
   LoadColumnsFromHead(FMSExcel.Sheets.Spreadsheet(0));
   LoadColumnsFromHead(FMSExcel.Sheets.Spreadsheet(0));
@@ -193,7 +194,7 @@ var
   iCol: Integer;
   iCol: Integer;
   sColName: string;
   sColName: string;
 begin
 begin
-  for iCol := 0 to ASheet.Cells.UsedRowCount do
+  for iCol := 0 to ASheet.Cells.UsedColCount do
   begin
   begin
     sColName := VarToStrDef(ASheet.Cells.GetValue(iCol, FCurRow), '');
     sColName := VarToStrDef(ASheet.Cells.GetValue(iCol, FCurRow), '');
     if sColName = '²ã´Î±àºÅ' then
     if sColName = '²ã´Î±àºÅ' then
@@ -240,6 +241,7 @@ begin
     LoadNode(ASheet);
     LoadNode(ASheet);
     Inc(FCurRow);
     Inc(FCurRow);
   end;
   end;
+  FCacheTree.SaveTreeToFile('E:\Tree.txt');
 end;
 end;
 
 
 procedure TBillsExcelImport.WriteNode(ADataSet: TsdDataSet;
 procedure TBillsExcelImport.WriteNode(ADataSet: TsdDataSet;

+ 75 - 63
Units/ProjectData.pas

@@ -76,7 +76,6 @@ type
     // 锁定数据 -- Sql语句方式(使用时注意相应的DataMoudle应处于关闭状态)
     // 锁定数据 -- Sql语句方式(使用时注意相应的DataMoudle应处于关闭状态)
     procedure LockBillsBaseData;
     procedure LockBillsBaseData;
     procedure LockDealPaymentData;
     procedure LockDealPaymentData;
-    procedure LockBGLData;
     procedure LockProjectGLData;
     procedure LockProjectGLData;
     procedure LockDetailGLData;
     procedure LockDetailGLData;
 
 
@@ -98,6 +97,7 @@ type
     function GetStageIndex: Integer;
     function GetStageIndex: Integer;
     procedure SetStageIndex(const Value: Integer);
     procedure SetStageIndex(const Value: Integer);
     function GetCanInsertNormalBills: Boolean;
     function GetCanInsertNormalBills: Boolean;
+    function GetValidStageIsRefer: Boolean;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -179,6 +179,7 @@ type
     function CheckDataBaseInfo(APhaseCount, AAuditStatus: Integer): Boolean;
     function CheckDataBaseInfo(APhaseCount, AAuditStatus: Integer): Boolean;
 
 
     procedure ImportCloudTenderFile(const AFileName: string);
     procedure ImportCloudTenderFile(const AFileName: string);
+    procedure ImportDmfFile(const AFileName: string);
 
 
     function CheckPassword: Boolean;
     function CheckPassword: Boolean;
 
 
@@ -213,6 +214,7 @@ type
     property BaseDataReadOnly: Boolean read GetBaseDataReadOnly;
     property BaseDataReadOnly: Boolean read GetBaseDataReadOnly;
     property StageDataReadOnly: Boolean read GetStageDataReadOnly;
     property StageDataReadOnly: Boolean read GetStageDataReadOnly;
     property PriceMarginReadOnly: Boolean read GetPriceMarginReadOnly;
     property PriceMarginReadOnly: Boolean read GetPriceMarginReadOnly;
+    property ValidStageIsRefer: Boolean read GetValidStageIsRefer;
 
 
     property CanUnlockInfo: Boolean read FCanUnlockInfo write FCanUnlockInfo;
     property CanUnlockInfo: Boolean read FCanUnlockInfo write FCanUnlockInfo;
     property CanInsertNormalBills: Boolean read GetCanInsertNormalBills;
     property CanInsertNormalBills: Boolean read GetCanInsertNormalBills;
@@ -238,7 +240,7 @@ implementation
 
 
 uses UtilMethods, Globals, ProjectCommands, sdIDTree, StageDm,
 uses UtilMethods, Globals, ProjectCommands, sdIDTree, StageDm,
   ZJJLDm, PHPWebDm, XMLDoc, XMLIntf, ConstUnit, PasswordInputFrm,
   ZJJLDm, PHPWebDm, XMLDoc, XMLIntf, ConstUnit, PasswordInputFrm,
-  mProgressProFrm, mDataRecord, ConditionalDefines;
+  mProgressProFrm, mDataRecord, ConditionalDefines, DbTreeImport;
 
 
 { TProjectData }
 { TProjectData }
 
 
@@ -376,7 +378,6 @@ begin
   FProjProperties.AuditStatus := -1;
   FProjProperties.AuditStatus := -1;
   FProjProperties.FinalAuditCount := FProjProperties.PhaseCount;
   FProjProperties.FinalAuditCount := FProjProperties.PhaseCount;
   FStaffData.LockedDataForReply;
   FStaffData.LockedDataForReply;
-  LockBGLData;
 end;
 end;
 
 
 procedure TProjectData.LockedDataForSubmit;
 procedure TProjectData.LockedDataForSubmit;
@@ -385,7 +386,6 @@ begin
   LockDealPaymentData;
   LockDealPaymentData;
   FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;
   FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;
   FStaffData.LockedDataForAudit;
   FStaffData.LockedDataForAudit;
-  LockBGLData;
 end;
 end;
 
 
 procedure TProjectData.Open(AProjRec: TsdDataRecord);
 procedure TProjectData.Open(AProjRec: TsdDataRecord);
@@ -469,42 +469,46 @@ end;
 
 
 procedure TProjectData.Save;
 procedure TProjectData.Save;
 begin
 begin
-  UpdateSysProgress(5, '正在保存数据');
-  SaveLastestPhaseMainData;
-  UpdateSysProgress(10, '正在保存数据');
-  if FPhaseData.Active then
-    FPhaseData.Save;
-  UpdateSysProgress(40, '正在保存数据');
-  FMainListData.Save;
-  FDealPaymentData.Save;
-  UpdateSysProgress(50, '正在保存数据');
-  FStaffData.Save;
-  UpdateSysProgress(60, '正在保存数据');
-  FBGLData.Save;
-  UpdateSysProgress(70, '正在保存数据');
-  FDealBillsData.Save;
-  UpdateSysProgress(80, '正在保存数据');
-
-  FProjectGLData.Save;
-  FDetailGLData.Save;
-  UpdateSysProgress(100, '正在保存数据');
-
-  FBillsCompileData.ReLockBaseData;
-  UpdateSysProgress(110, '正在保存数据');
-  FBillsData.Save;
-  UpdateSysProgress(170, '正在保存数据');
-
-  FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;
-  FProjProperties.Save;
-  UpdateSysProgress(180, '正在保存数据');
-  FConnection.Save;
-  UpdateSysProgress(190, '正在保存数据');
-
-  ZipFolder(FTempFolder, FileName);
-  SaveInfoToManager;
-  UpdateSysProgress(200, '就绪');
-
-  ProjectManager.AddSaveTenderBackup(FProjectID);
+  try
+    UpdateSysProgress(5, '正在保存数据');
+    SaveLastestPhaseMainData;
+    UpdateSysProgress(10, '正在保存数据');
+    if (FPhaseData.Active) and (FPhaseIndex = ProjProperties.PhaseCount) then
+      FPhaseData.Save;
+    UpdateSysProgress(40, '正在保存数据');
+    FMainListData.Save;
+    FDealPaymentData.Save;
+    UpdateSysProgress(50, '正在保存数据');
+    FStaffData.Save;
+    UpdateSysProgress(60, '正在保存数据');
+    FBGLData.Save;
+    UpdateSysProgress(70, '正在保存数据');
+    FDealBillsData.Save;
+    UpdateSysProgress(80, '正在保存数据');
+
+    FProjectGLData.Save;
+    FDetailGLData.Save;
+    UpdateSysProgress(100, '正在保存数据');
+
+    FBillsCompileData.ReLockBaseData;
+    UpdateSysProgress(110, '正在保存数据');
+    FBillsData.Save;
+    UpdateSysProgress(170, '正在保存数据');
+
+    FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;
+    FProjProperties.Save;
+    UpdateSysProgress(180, '正在保存数据');
+    FConnection.Save;
+    UpdateSysProgress(190, '正在保存数据');
+
+    ZipFolder(FTempFolder, FileName);
+    SaveInfoToManager;
+    UpdateSysProgress(200, '就绪');
+
+    ProjectManager.AddSaveTenderBackup(FProjectID);
+  except
+    ErrorMessage('保存数据出错。请重试,或联系纵横客服:企业QQ:800003850   客服热线:(0756)3850888');
+  end;
 end;
 end;
 
 
 procedure TProjectData.SaveInfoToManager;
 procedure TProjectData.SaveInfoToManager;
@@ -534,20 +538,23 @@ procedure TProjectData.SetPhaseIndex(const Value: Integer);
     Result := Format('%s\Phase%d.dat', [TempPath, FPhaseIndex]);
     Result := Format('%s\Phase%d.dat', [TempPath, FPhaseIndex]);
   end;
   end;
 
 
-  procedure ReCreatePhaseData;
+  procedure ReCreatePhaseData(AOrgPhaseIndex: Integer);
   begin
   begin
-    if FPhaseData.Active then
+    if (FPhaseData.Active) and (AOrgPhaseIndex = ProjProperties.PhaseCount) then
       FPhaseData.Save;
       FPhaseData.Save;
     FPhaseData.Free;
     FPhaseData.Free;
     FPhaseData := TPhaseData.Create(Self);
     FPhaseData := TPhaseData.Create(Self);
   end;
   end;
 
 
+var
+  iOrgPhaseIndex: Integer;
 begin
 begin
   SaveLastestPhaseMainData;
   SaveLastestPhaseMainData;
   FProjectGLData.Save;
   FProjectGLData.Save;
+  iOrgPhaseIndex := FPhaseIndex;
   FPhaseIndex := Value;
   FPhaseIndex := Value;
   ProjProperties.PhaseIndex := FPhaseIndex;
   ProjProperties.PhaseIndex := FPhaseIndex;
-  ReCreatePhaseData;
+  ReCreatePhaseData(iOrgPhaseIndex);
   FPhaseData.Open(GetPhaseFileName);
   FPhaseData.Open(GetPhaseFileName);
   ResetPhaseDataLink;
   ResetPhaseDataLink;
   // 须保存项目工料数据,重新加载当期的项目工料数据
   // 须保存项目工料数据,重新加载当期的项目工料数据
@@ -1058,14 +1065,9 @@ procedure TProjectData.CopyPhaseData;
       ExecuteSql(sSql);
       ExecuteSql(sSql);
     end;
     end;
     // 审核通过的最后一人
     // 审核通过的最后一人
-    if ProjProperties.AuditStatus <> 0 then
-    begin
-      if ProjProperties.AuditStatus = -1 then
-        vChecker := Checkers.Item[Checkers.Count -1]
-      else
-        vChecker := Checkers.Item[ProjProperties.AuditStatus-1];
-      sSql := Format(sInsertSql, [vChecker.No, vChecker.Name, vChecker.Role, vChecker.Memo, vChecker.CheckedDateTime, 1]);
-    end
+    vChecker := Checkers.LastChecker;
+    if Assigned(vChecker) then
+      sSql := Format(sInsertSql, [vChecker.No, vChecker.Name, vChecker.Role, vChecker.Memo, vChecker.CheckedDateTime, 1])
     else
     else
       sSql := Format(sInsertSql, [-1, '', '', '', '', 1]);
       sSql := Format(sInsertSql, [-1, '', '', '', '', 1]);
     ExecuteSql(sSql);
     ExecuteSql(sSql);
@@ -1084,7 +1086,7 @@ begin
     CopyCurPhaseData;
     CopyCurPhaseData;
   FDealPaymentData.UpdateLinkSerialNo;
   FDealPaymentData.UpdateLinkSerialNo;
   //CopyHistoryCompleteData;
   //CopyHistoryCompleteData;
-  if G_IsCloud then
+  if _IsCloud then
     SaveCloudInfo;
     SaveCloudInfo;
   if _IsDebugView then
   if _IsDebugView then
     SaveDebugFile('Report.dat');
     SaveDebugFile('Report.dat');
@@ -1401,15 +1403,6 @@ begin
   ExecuteSql(sLockFormulaSql);
   ExecuteSql(sLockFormulaSql);
 end;
 end;
 
 
-procedure TProjectData.LockBGLData;
-const
-  sBGSql = 'Update BGL Set Locked = True';
-  sBGBillsSql = 'Update BGBills Set Locked = True';
-begin
-  ExecuteSql(sBGSql);
-  ExecuteSql(sBGBillsSql);
-end;
-
 procedure TProjectData.OpenForReport(const AFileName: string);
 procedure TProjectData.OpenForReport(const AFileName: string);
 begin
 begin
   FProjectID := -1;
   FProjectID := -1;
@@ -1822,10 +1815,16 @@ procedure TProjectData.CopyPreData;
   const
   const
     sCopySql = 'Insert Into GLPrice (GLID, PhaseID,' +
     sCopySql = 'Insert Into GLPrice (GLID, PhaseID,' +
                '    InfoPrice, InfoDate, DeltaPrice, ValidDeltaPrice,' +
                '    InfoPrice, InfoDate, DeltaPrice, ValidDeltaPrice,' +
-               '    PM_PreQuantity, PM_PreTotalPrice)'+
+               '    PreUsedQuantity, PreUsedTotalprice' +
+               '    PM_PreQuantity, PM_PreTotalPrice,'+
+               '    PrePAL_UsedQuantity, PrePAL_UsedTotalPrice,'+
+               '    PrePAL_DeltaPrice, PrePAL_Total)'+
                '  Select GLID, %d,'+
                '  Select GLID, %d,'+
                '    InfoPrice, InfoDate, DeltaPrice, ValidDeltaPrice,'+
                '    InfoPrice, InfoDate, DeltaPrice, ValidDeltaPrice,'+
-               '    PM_PreQuantity+PM_Quantity_F, PM_PreTotalPrice+PM_TotalPrice_F'+
+               '    PreUsedQuantity+UsedQuantity, PreUsedTotalPrice+UsedTotalPrice,'+
+               '    PM_PreQuantity+PM_Quantity_F, PM_PreTotalPrice+PM_TotalPrice_F,'+
+               '    PrePAL_UsedQuantity+PAL_UsedQuantity_F, PrePAL_UsedTotalPrice+PAL_UsedTotalPrice_F,'+
+               '    PrePAL_DeltaPrice+PAL_DeltaPrice_F, PrePAL_Total+PAL_Total_F'+
                '  From GLPrice Where PhaseID = %d';
                '  From GLPrice Where PhaseID = %d';
   begin
   begin
     if FProjProperties.PhaseCount > 1 then
     if FProjProperties.PhaseCount > 1 then
@@ -1907,4 +1906,17 @@ begin
   FConnection.SaveDebugFile(AFileName);
   FConnection.SaveDebugFile(AFileName);
 end;
 end;
 
 
+procedure TProjectData.ImportDmfFile(const AFileName: string);
+begin
+  ImportDbTreeTo(AFileName, Self);
+end;
+
+function TProjectData.GetValidStageIsRefer: Boolean;
+begin
+  if FPhaseData.Active then
+    Result := (FPhaseIndex = FProjProperties.PhaseCount) and (FPhaseData.StageCount = 1) and (FProjProperties.AuditStatus <> -1)
+  else
+    Result := False;
+end;
+
 end.
 end.

+ 22 - 0
Units/ProjectProperty.pas

@@ -75,6 +75,8 @@ type
 
 
     FUpdateFlag: Integer;
     FUpdateFlag: Integer;
     FPriceMarginStartPhaseID: Integer;
     FPriceMarginStartPhaseID: Integer;
+    FShowReportShading: Boolean;
+    FReportShading: string;
 
 
     function GetBoolPropertyDef(const AName: string; ADef: Boolean): Boolean;
     function GetBoolPropertyDef(const AName: string; ADef: Boolean): Boolean;
     function GetIntPropertyDef(const AName: string; ADef: Integer): Integer;
     function GetIntPropertyDef(const AName: string; ADef: Integer): Integer;
@@ -115,6 +117,8 @@ type
     procedure SetQuantityDigit(const Value: Integer);
     procedure SetQuantityDigit(const Value: Integer);
     procedure SetTotalPriceDigit(const Value: Integer);
     procedure SetTotalPriceDigit(const Value: Integer);
     procedure SetUpdateFlag(const Value: Integer);
     procedure SetUpdateFlag(const Value: Integer);
+    procedure SetReportShading(const Value: string);
+    procedure SetShowReportShading(const Value: Boolean);
   public
   public
     constructor Create(AProjectData: TObject);
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
     destructor Destroy; override;
@@ -210,6 +214,9 @@ type
     property ShowBGLCode: Boolean read FShowBGLCode write SetShowBGLCode;
     property ShowBGLCode: Boolean read FShowBGLCode write SetShowBGLCode;
     property ShowDesignQuantity: Boolean read FShowDesignQuantity write SetShowDesignQuantity;
     property ShowDesignQuantity: Boolean read FShowDesignQuantity write SetShowDesignQuantity;
     property ShowAlias: Boolean read FShowAlias write SetShowAlias;
     property ShowAlias: Boolean read FShowAlias write SetShowAlias;
+
+    property ShowReportShading: Boolean read FShowReportShading write SetShowReportShading;
+    property ReportShading: string read FReportShading write SetReportShading;
   end;
   end;
 
 
 implementation
 implementation
@@ -469,6 +476,9 @@ begin
   FShowBGLCode := GetBoolPropertyDef('ShowBGLCode', True);
   FShowBGLCode := GetBoolPropertyDef('ShowBGLCode', True);
   FShowDesignQuantity := GetBoolPropertyDef('ShowDesignQuantity', False);
   FShowDesignQuantity := GetBoolPropertyDef('ShowDesignQuantity', False);
   FShowAlias := GetBoolPropertyDef('ShowAlias', False);
   FShowAlias := GetBoolPropertyDef('ShowAlias', False);
+
+  FShowReportShading := GetBoolPropertyDef('ShowReportShading', False);
+  FReportShading := GetStrPropertyDef('ReportShading', '');
 end;
 end;
 
 
 procedure TProjProperties.Open(AConnection: TADOConnection);
 procedure TProjProperties.Open(AConnection: TADOConnection);
@@ -593,6 +603,12 @@ begin
   FQuantityFormat := GetDisplayFormat(FQuantityDigit);
   FQuantityFormat := GetDisplayFormat(FQuantityDigit);
 end;
 end;
 
 
+procedure TProjProperties.SetReportShading(const Value: string);
+begin
+  FReportShading := Value;
+  FPropertyInqurity.Value['ReportShading'] := Value;
+end;
+
 procedure TProjProperties.SetShowAlias(const Value: Boolean);
 procedure TProjProperties.SetShowAlias(const Value: Boolean);
 begin
 begin
   FShowAlias := Value;
   FShowAlias := Value;
@@ -617,6 +633,12 @@ begin
   FPropertyInqurity.Value['ShowPriceChange'] := Value;
   FPropertyInqurity.Value['ShowPriceChange'] := Value;
 end;
 end;
 
 
+procedure TProjProperties.SetShowReportShading(const Value: Boolean);
+begin
+  FShowReportShading := Value;
+  FPropertyInqurity.Value['ShowReportShading'] := Value;
+end;
+
 procedure TProjProperties.SetStartedSubsist(const Value: Double);
 procedure TProjProperties.SetStartedSubsist(const Value: Double);
 begin
 begin
   FStartedSubsist := Value;
   FStartedSubsist := Value;

+ 7 - 0
Units/UpdateDataBase.pas

@@ -18,6 +18,8 @@ type
   TUpdateManagerDB = class(TUpdateDB)
   TUpdateManagerDB = class(TUpdateDB)
   private
   private
     Procedure UpdateAllTables(AConnection: TADOConnection); override;
     Procedure UpdateAllTables(AConnection: TADOConnection); override;
+  public
+    procedure Update(AConnection: TConnection); overload;
   end;
   end;
 
 
   TUpdateProjectDB = class(TUpdateDB)
   TUpdateProjectDB = class(TUpdateDB)
@@ -178,6 +180,11 @@ end;
 
 
 { TUpdateManagerDB }
 { TUpdateManagerDB }
 
 
+procedure TUpdateManagerDB.Update(AConnection: TConnection);
+begin
+  UpdateAllTables(AConnection.Connection);
+end;
+
 procedure TUpdateManagerDB.UpdateAllTables(AConnection: TADOConnection);
 procedure TUpdateManagerDB.UpdateAllTables(AConnection: TADOConnection);
 var
 var
   Updater: TScUpdater;
   Updater: TScUpdater;

+ 36 - 0
Units/mDataRecord.pas

@@ -339,6 +339,20 @@ type
     FPM_PreTotalPrice: TsdValue;
     FPM_PreTotalPrice: TsdValue;
     FPM_Quantity: TsdValue;
     FPM_Quantity: TsdValue;
     FPM_TotalPrice: TsdValue;
     FPM_TotalPrice: TsdValue;
+
+    FPreUsedQuantity: TsdValue;
+    FPreUsedTotalPrice: TsdValue;
+    FUsedQuantity: TsdValue;
+    FUsedTotalPrice: TsdValue;
+
+    FPrePAL_UsedQuantity: TsdValue;
+    FPrePAL_UsedTotalPrice: TsdValue;
+    FPrePAL_DeltaPrice: TsdValue;
+    FPrePAL_Total: TsdValue;
+    FPAL_UsedQuantity: TsdValue;
+    FPAL_UsedTotalPrice: TsdValue;
+    FPAL_DeltaPrice: TsdValue;
+    FPAL_Total: TsdValue;
   protected
   protected
     procedure DoAfterAddFields; override;
     procedure DoAfterAddFields; override;
   public
   public
@@ -361,6 +375,20 @@ type
     property PM_PreTotalPrice: TsdValue read FPM_PreTotalPrice;
     property PM_PreTotalPrice: TsdValue read FPM_PreTotalPrice;
     property PM_Quantity: TsdValue read FPM_Quantity;
     property PM_Quantity: TsdValue read FPM_Quantity;
     property PM_TotalPrice: TsdValue read FPM_TotalPrice;
     property PM_TotalPrice: TsdValue read FPM_TotalPrice;
+
+    property PreUsedQuantity: TsdValue read FPreUsedQuantity;
+    property PreUsedTotalPrice: TsdValue read FPreUsedTotalPrice;
+    property UsedQuantity: TsdValue read FUsedQuantity;
+    property UsedTotalPrice: TsdValue read FUsedTotalPrice;
+
+    property PrePAL_UsedQuantity: TsdValue read FPrePAL_UsedQuantity;
+    property PrePAL_UsedTotalPrice: TsdValue read FPrePAL_UsedTotalPrice;
+    property PrePAL_DeltaPrice: TsdValue read FPrePAL_DeltaPrice;
+    property PrePAL_Total: TsdValue read FPrePAL_Total;
+    property PAL_UsedQuantity: TsdValue read FPAL_UsedQuantity;
+    property PAL_UsedTotalPrice: TsdValue read FPAL_UsedTotalPrice;
+    property PAL_DeltaPrice: TsdValue read FPAL_DeltaPrice;
+    property PAL_Total: TsdValue read FPAL_Total;
   end;
   end;
 
 
   TDetailGLRecord = class(TMeasureBaseRecord)
   TDetailGLRecord = class(TMeasureBaseRecord)
@@ -642,6 +670,14 @@ begin
   FPM_PreTotalPrice := ValueByName('PM_PreTotalPrice');
   FPM_PreTotalPrice := ValueByName('PM_PreTotalPrice');
   FPM_Quantity := ValueByName('PM_Quantity');
   FPM_Quantity := ValueByName('PM_Quantity');
   FPM_TotalPrice := ValueByName('PM_TotalPrice');
   FPM_TotalPrice := ValueByName('PM_TotalPrice');
+
+  FUsedQuantity := ValueByName('UsedQuantity');
+  FUsedTotalPrice := ValueByName('UsedTotalPrice');
+
+  FPAL_UsedQuantity := ValueByName('PAL_UsedQuantity');
+  FPAL_UsedTotalPrice := ValueByName('PAL_UsedTotalPrice');
+  FPAL_DeltaPrice := ValueByName('PAL_DeltaPrice');
+  FPAL_Total := ValueByName('PAL_Total');
 end;
 end;
 
 
 { TDetailGLRecord }
 { TDetailGLRecord }