|
|
@@ -668,18 +668,21 @@ begin
|
|
|
vIdx := LeafXmjGlData.sddLeafXmjGL.FindIndex('idxGL');
|
|
|
iFirst := vIdx.FindKeyIndex(ARec.ID.AsInteger);
|
|
|
iLast := vIdx.FindKeyLastIndex(ARec.ID.AsInteger);
|
|
|
- for i := iFirst to iLast do
|
|
|
+ if (iFirst <> -1) then
|
|
|
begin
|
|
|
- XmjGLRec := TLeafXmjGlRecord(vIdx.Records[i]);
|
|
|
- StageRec := TStageLeafXmjGlRecord(XmjGLRec.StageRec);
|
|
|
- if Assigned(StageRec) then
|
|
|
+ for i := iFirst to iLast do
|
|
|
begin
|
|
|
- fUsedQuantity := fUsedQuantity + StageRec.UsedQuantity.AsFloat;
|
|
|
- fUsedTotalPrice := fUsedTotalPrice + StageRec.UsedTotalPrice.AsFloat;
|
|
|
- fPAL_UsedQuantity := fPAL_UsedQuantity + StageRec.PAL_UsedQuantity.AsFloat;
|
|
|
- fPAL_UsedTotalPrice := fPAL_UsedTotalPrice + StageRec.PAL_UsedTotalPrice.AsFloat;
|
|
|
- fPAL_DeltaPrice := fPAL_DeltaPrice + StageRec.PAL_DeltaPrice.AsFloat;
|
|
|
- fPAL_Total := fPAL_Total + StageRec.PAL_Total.AsFloat;
|
|
|
+ XmjGLRec := TLeafXmjGlRecord(vIdx.Records[i]);
|
|
|
+ StageRec := TStageLeafXmjGlRecord(XmjGLRec.StageRec);
|
|
|
+ if Assigned(StageRec) then
|
|
|
+ begin
|
|
|
+ fUsedQuantity := fUsedQuantity + StageRec.UsedQuantity.AsFloat;
|
|
|
+ fUsedTotalPrice := fUsedTotalPrice + StageRec.UsedTotalPrice.AsFloat;
|
|
|
+ fPAL_UsedQuantity := fPAL_UsedQuantity + StageRec.PAL_UsedQuantity.AsFloat;
|
|
|
+ fPAL_UsedTotalPrice := fPAL_UsedTotalPrice + StageRec.PAL_UsedTotalPrice.AsFloat;
|
|
|
+ fPAL_DeltaPrice := fPAL_DeltaPrice + StageRec.PAL_DeltaPrice.AsFloat;
|
|
|
+ fPAL_Total := fPAL_Total + StageRec.PAL_Total.AsFloat;
|
|
|
+ end;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|