浏览代码

Task #1229 价差,新增本期实耗、盈亏计算

MaiXinRong 9 年之前
父节点
当前提交
7bc1874637

+ 56 - 1
DataModules/ProjectGLDm.dfm

@@ -58,7 +58,44 @@ object ProjectGLData: TProjectGLData
       734B6579080F4E65656450726F636573734E616D65090001044E616D65060D50
       4D5F546F74616C5072696365094669656C644E616D65060D504D5F546F74616C
       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
   object sdvProjectGL: TsdDataView
     Active = False
@@ -107,6 +144,24 @@ object ProjectGLData: TProjectGLData
       item
         FieldName = 'PM_TotalPrice'
         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>
     OnGetText = sdvProjectGLGetText
     OnSetText = sdvProjectGLSetText

+ 63 - 6
DataModules/ProjectGLDm.pas

@@ -37,6 +37,9 @@ type
 
     procedure CalculateRelaBills(ARec: TProjectGLRecord);
 
+    procedure CalculatePALRela(ARec: TProjectGLRecord);
+    procedure CalculatePALRelas;
+
     procedure ExecuteSql(const ASql: string);
     procedure SaveGLPrice;
     procedure SavePM_CurData;
@@ -122,6 +125,9 @@ var
         Rec.InfoDate.AsString := vQuery.FieldByName('InfoDate').AsString;
         Rec.DeltaPrice.AsFloat := vQuery.FieldByName('DeltaPrice').AsFloat;
         Rec.ValidDeltaPrice.AsFloat := vQuery.FieldByName('ValidDeltaPrice').AsFloat;
+
+        Rec.UsedQuantity.AsFloat := vQuery.FieldByName('UsedQuantity').AsFloat;
+        Rec.UsedTotalPrice.AsFloat := vQuery.FieldByName('UsedTotalPrice').AsFloat;
       end
       else
       begin
@@ -129,6 +135,9 @@ var
         Rec.InfoDate.AsString := '';
         Rec.DeltaPrice.AsFloat := 0;
         Rec.ValidDeltaPrice.AsFloat := 0;
+
+        Rec.UsedQuantity.AsFloat := 0;
+        Rec.UsedTotalPrice.AsFloat := 0;
       end;
     end;
   end;
@@ -176,10 +185,12 @@ procedure TProjectGLData.SaveGLPrice;
 const
   sDeleteSql = 'Delete From GLPrice Where PhaseID = %d';
   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';
   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)';
 var
   iPhaseID: Integer;
@@ -212,9 +223,14 @@ begin
     CalculateDeltaPrice(TProjectGLRecord(AValue.Owner));
     CalculatePM_Quantity(TProjectGLRecord(AValue.Owner));
     CalculatePM_TotalPrice(TProjectGLRecord(AValue.Owner));
+    CalculatePALRela(TProjectGLRecord(AValue.Owner));
     CalculateRelaBills(TProjectGLRecord(AValue.Owner));
     TProjectData(FProjectData).PriceMarginBillsData.RefreshAllDetailBills;
   end;
+  if SameText(AValue.FieldName, 'UsedQuantity') then
+  begin
+    CalculatePALRela(TProjectGLRecord(AValue.Owner));
+  end;
 end;
 
 procedure TProjectGLData.CalculateDeltaPrice(ARec: TProjectGLRecord);
@@ -380,7 +396,11 @@ procedure TProjectGLData.SavePM_CurData;
 const
   sUpdateSql = 'Update GLPrice As G, ProjectGL As P'+
                '  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)';
 var
   iStageIndex: Integer;
@@ -389,7 +409,7 @@ var
 begin
   iStageIndex := TProjectData(FProjectData).PhaseData.StageIndex;
   iPhaseCount := TProjectData(FProjectData).ProjProperties.PhaseCount;
-  sSql := Format(sUpdateSql, [iStageIndex, iStageIndex, iPhaseCount]);
+  sSql := Format(sUpdateSql, [iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iPhaseCount]);
   ExecuteSql(sSql);
 end;
 
@@ -498,8 +518,12 @@ end;
 procedure TProjectGLData.LoadStagePM_CalcData;
 const
   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';
+
 var
   sSql: string;
   vQuery: TADOQuery;
@@ -516,11 +540,21 @@ var
       begin
         Rec.PM_Quantity.AsFloat := vQuery.FieldByName('PM_Quantity').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
       else
       begin
         Rec.PM_Quantity.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;
@@ -531,7 +565,7 @@ begin
   try
     vQuery.Connection := sdpProjectGL.Connection;
     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.Add(sSql);
     vQuery.Open;
@@ -575,4 +609,27 @@ begin
   Result := TProjectData(FProjectData).ProjProperties.DecimalManager.PriceMargin;
 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.

+ 4 - 1
DataModules/StandardBillsDm.dfm

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

+ 109 - 1
Frames/ProjectGLFme.dfm

@@ -11,7 +11,7 @@ object ProjectGLFrame: TProjectGLFrame
     Height = 313
     Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
     OptionsEx = []
-    ColCount = 13
+    ColCount = 19
     RowCount = 6
     FixedRowCount = 2
     ShowGridLine = False
@@ -246,6 +246,114 @@ object ProjectGLFrame: TProjectGLFrame
         FieldName = 'PM_TotalPrice'
         Width = 60
         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>
     Grid = zgProjectGL
     ExtendRowCount = 3

+ 1 - 1
Units/Connections.pas

@@ -8,7 +8,7 @@ uses
 const
   ProductName = 'Measure';
   EmptyFileVersion = '1.0.0.0';
-  FileVersion = '1.0.1.3';
+  FileVersion = '1.0.1.4';
   EncryptVersion = 'Auto1.0';
   SAdoConnectStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;' +
                    'User ID=Admin;Password='''';Persist Security Info=True';

+ 125 - 4
Units/DataBaseTables.pas

@@ -418,7 +418,7 @@ const
 
   {调差工料}
   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: '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_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 当期缓存数据----------------------}
   );
 
   {调差工料--价格信息及计算}
   SGLPrice = 'GLPrice';
-  tdGLPrice: array [0..39] of TScFieldDef =(
+  tdGLPrice: array [0..111] of TScFieldDef =(
     // 工料ID
     (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: '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_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_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审
     (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: '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_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_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_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_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_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_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_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_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_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_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_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_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_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_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)
   );
 
   {清单使用的工料}

+ 8 - 2
Units/ProjectData.pas

@@ -1815,10 +1815,16 @@ procedure TProjectData.CopyPreData;
   const
     sCopySql = 'Insert Into GLPrice (GLID, PhaseID,' +
                '    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,'+
                '    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';
   begin
     if FProjProperties.PhaseCount > 1 then

+ 36 - 0
Units/mDataRecord.pas

@@ -339,6 +339,20 @@ type
     FPM_PreTotalPrice: TsdValue;
     FPM_Quantity: 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
     procedure DoAfterAddFields; override;
   public
@@ -361,6 +375,20 @@ type
     property PM_PreTotalPrice: TsdValue read FPM_PreTotalPrice;
     property PM_Quantity: TsdValue read FPM_Quantity;
     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;
 
   TDetailGLRecord = class(TMeasureBaseRecord)
@@ -642,6 +670,14 @@ begin
   FPM_PreTotalPrice := ValueByName('PM_PreTotalPrice');
   FPM_Quantity := ValueByName('PM_Quantity');
   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;
 
 { TDetailGLRecord }