|
@@ -328,12 +328,15 @@ procedure TDealPaymentData.sdvDealPaymentNeedLookupRecord(
|
|
|
sTPField := 'TotalPrice' + IntToStr(TProjectData(FProjectData).PhaseData.StageIndex);
|
|
|
sFField := 'Formula' + IntToStr(TProjectData(FProjectData).PhaseData.StageIndex);
|
|
|
if CheckNumeric(ANewText) then
|
|
|
- fTotalPrice := StrToFloat(ANewText)
|
|
|
+ begin
|
|
|
+ APayRec.ValueByName(sFField).AsString := ANewText;
|
|
|
+ fTotalPrice := StrToFloat(ANewText);
|
|
|
+ end
|
|
|
else
|
|
|
begin
|
|
|
APayRec.ValueByName(sFField).AsString := ANewText;
|
|
|
ARecord.ValueByName('Formula').AsString := ANewText;
|
|
|
- fTotalPrice := FPayFormula.Calculate(ANewText);
|
|
|
+ fTotalPrice := FPayFormula.Calculate(ANewText, ARecord.ValueByName('StartedPrice').AsFloat);
|
|
|
end;
|
|
|
iID := ARecord.ValueByName('ID').AsInteger;
|
|
|
if CheckStartedPrice(iID) then
|
|
@@ -459,7 +462,10 @@ procedure TDealPaymentData.sdvDealPaymentSetText(var Text: string;
|
|
|
begin
|
|
|
Rec.ValueByName('Formula').AsString := Text;
|
|
|
AValue.Owner.ValueByName(sFField).AsString := Text;
|
|
|
- fTotalPrice := FPayFormula.Calculate(Text);
|
|
|
+ if ARecord.ValueByName('Pre' + AValue.FieldName).AsFloat = 0 then
|
|
|
+ fTotalPrice := FPayFormula.Calculate(Text, Rec.ValueByName('StartedPrice').AsFloat) - AValue.AsFloat
|
|
|
+ else
|
|
|
+ fTotalPrice := FPayFormula.Calculate(Text) - AValue.AsFloat;
|
|
|
end;
|
|
|
iID := ARecord.ValueByName('ID').AsInteger;
|
|
|
if CheckStartedPrice(iID) then
|